-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
115 lines (86 loc) · 2.99 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <windows.h>
#include <QAction>
#include <QList>
#include <QListWidgetItem>
#include <QMainWindow>
#include <QMenu>
#include <QMessageBox>
#include "commands.h"
#include "defaultdelaywidget.h"
#include "poshint.h"
#include "CmdWidgets/cmdwidget.h"
#define DELAY_OPTIONS_LEN 2
#define WINDOW_OPTIONS_LEN 5
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void checkUserKeyInput();
//File Actions
void setupBlankMacro();
void newMacro();
bool saveMacro();
void saveMacroAs();
void openMacro();
void tryRunMacro();
void showContextMenu(const QPoint&);
//Adding commands
CmdWidget *addNewCmd(int cmdType);
void addCmdListItem(QListWidgetItem *item, CmdWidget *itemWidget, int row);
void setUnsavedChanges(bool newUnsavedChanges);
void updateWindowTitle();
//Commandlist editing
void copySelected();
void cutSelected();
void pasteClipboard();
void deleteSelected();
void duplicateSelected();
void toggleSelectedItemsDisabled();
void updateRowNumbers();
void handleRowMoved(QModelIndex, int, int, QModelIndex, int);
void handleSelectionChanged();
void selectRow(int row);
void handleCmdSettingChanged(CmdWidget *widget);
void showPosHint(bool visible, int x, int y);
private:
Ui::MainWindow *ui;
DefaultDelayWidget *defaultDelayWidget;
PosHint *posHint = new PosHint();
QMenu contextMenu;
int defX, defY, defW, defH;
void openMacro(QString fileName, QString fullFilePath);
//Running Macro
bool isMacroRunning = false;
bool isMacroExecutionPaused = false;
int AllCmdsValid();
void ExecuteCmds();
void SaveOrRestoreGotoTotalAmounts(bool save);
QList<QListWidgetItem *> GetSortedSelectedItems();
void showMessage(QString title, QString message, QMessageBox::Icon type);
//Storing data
QString macroName;
QString macroPath;
QString fileExtension = "mccr";
QString fileInfo = "Macro Creator Files (*." + fileExtension + ")";
QString getFullFilePath(QString filePath, QString fileName) { return filePath + "/" + fileName + "." + fileExtension; }
bool hasNoSafeFile;
bool hasUnsavedChanges;
void closeEvent(QCloseEvent *event);
enum UnsavedChangesMessageResult {
Save = 0,
DontSave = 1,
Cancel = 2
};
QMessageBox *showUnsavedChangesWarning(UnsavedChangesMessageResult &result);
bool tryLoadCmdsFromFile(QString pathPlusFilename);
QList<QListWidgetItem *> fillCmdListWidget(QStringList cmdListStrings, int startRow, bool &success);
};
#endif // MAINWINDOW_H