-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
97 lines (86 loc) · 2.73 KB
/
mainwindow.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QGraphicsScene>
#include <QLineEdit>
#include <QMainWindow>
#include <QUndoStack>
#include "fortuneavenuegraphicsscene.h"
#include "fortunestreetdata.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QApplication& app);
~MainWindow();
private:
Ui::MainWindow *ui;
QVector<QLineEdit *> waypointStarts;
QMap<int, QVector<QLineEdit *>> waypointDests;
FortuneAvenueGraphicsScene *scene;
FortuneAvenueGraphicsScene *square1Scene;
FortuneAvenueGraphicsScene *square2Scene;
QUndoStack *undoStack;
BoardFile curBoardFile;
QVector<SquareData> &squaresData();
std::function<void(const QMap<int, QPointF> &)> updateOnSquareMove;
int zoomPercent = 100;
int previouslyVisitedSquareId = -1;
const QString defaultPriceFunction = QString("x * ( -0.15 * 0.2^(x/200) + 0.2 )");
QString priceFunction = defaultPriceFunction;
int maxPathSearchDepth = 0;
void addChangeSquaresAction(const QVector<int> &squareIdsToUpdate, const QString &text);
template<class Func>
void addUpdateBoardMetaAction(Func &&func, const QString &text);
void connectSquares(bool previousToCurrent, bool currentToPrevious);
QPair<SquareItem*,SquareItem*> getPreviousAndCurrentSquare();
int calcShopPriceFromValue(const QString &function, int value);
void loadFile(const QString &fname);
void loadFile(const BoardFile &file);
BoardFile exportFile();
void updateBoardInfoSidebar();
void registerSquareSidebarEvents();
void updateSquareSidebar();
template<typename Func> void updateSquare(Func &&func, const QString &text);
void updateWaypoints();
void newFile();
void openFile();
/**
* @return whether file was saved
*/
bool saveFile();
/**
* @return whether file was saved
*/
bool saveFileAs();
void calcStockPrices();
void verifyBoard();
void autoPath();
void screenshot();
void preferences();
void addSquare();
void removeSquare();
int calcSnapSizeFromInput();
void updateSnapSize();
void updateZoom();
/**
* updates allowed directions for autopathing
*/
void updateDestinationUI();
void followWaypoint(int destinationId);
void selectNext();
void selectPrevious();
void selectAll();
void toggleAdvancedAutoPath();
void autoAssignShopModels();
void clearWaypoint(SquareItem *item, int waypointId);
void syncForSwitch(bool isTo);
protected:
void closeEvent(QCloseEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override;
private slots:
void on_actionExit_triggered();
};
#endif // MAINWINDOW_H