-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI.h
More file actions
56 lines (49 loc) · 1.25 KB
/
UI.h
File metadata and controls
56 lines (49 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef TIMER_UI_H
#define TIMER_UI_H
#include <algorithm>
#include <deque>
#include <vector>
#include "ScrambleBox.h"
#include "Solve.h"
#include "SolveWindow.h"
#include "SolvesBar.h"
#include "TimerBox.h"
#include "dbConnection.h"
// can check for ctrl + key with userChar == ctrl(key) now
#define ctrl(x) (x & 0x1F)
const unsigned SHORT_AVG_NUM = 5;
const unsigned LONG_AVG_NUM = 15;
class UI {
private:
dbConnection connection;
ScrambleBox sBox;
TimerBox tBox;
SolvesBar sBar;
Solve currentSolve;
std::string currentScramble;
std::deque<Solve> lastNSolves;
unsigned currentId;
unsigned numSolves;
unsigned toShowNum;
int highlightedIndex;
int bottomOfFrameIndex;
int lowestDisplayedIndex;
double shortAvg;
double longAvg;
SolveWindow solveWin;
bool solveWinIsOpen;
public:
UI(std::string dbFile = DEFAULT_FILENAME,
std::string session = DEFAULT_SESSION_NAME);
~UI() { endwin(); }
void mainloop();
void setAverages();
void deleteSolveAtIndex(int index);
void updatePenaltyAtIndex(int index, unsigned penalty);
void endSolve();
void scrollDown();
void scrollUp();
void toggleSolveWindow();
void changeSession(bool forward = true);
};
#endif // !TIMER_UI_H