summaryrefslogtreecommitdiff
path: root/qhexedit2/example/mainwindow.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-07 12:37:21 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-07 12:37:21 +0200
commitfebaef00017278ac65cb7e285564ebc9d5dadfe5 (patch)
tree940ac1386117785496334432dc03a3c0cfa02de5 /qhexedit2/example/mainwindow.h
parentf41f2dce18111c923c331a3fe6900edee731d040 (diff)
parent004b73ed7ef33cb407897f7eccbec5f3861f99d7 (diff)
Merge commit '004b73ed7ef33cb407897f7eccbec5f3861f99d7' as 'qhexedit2'
Diffstat (limited to 'qhexedit2/example/mainwindow.h')
-rw-r--r--qhexedit2/example/mainwindow.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/qhexedit2/example/mainwindow.h b/qhexedit2/example/mainwindow.h
new file mode 100644
index 0000000..751beec
--- /dev/null
+++ b/qhexedit2/example/mainwindow.h
@@ -0,0 +1,98 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "../src/qhexedit.h"
+#include "optionsdialog.h"
+#include "searchdialog.h"
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QMenu;
+class QUndoStack;
+class QLabel;
+class QDragEnterEvent;
+class QDropEvent;
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+protected:
+ void closeEvent(QCloseEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dropEvent(QDropEvent *event);
+
+private slots:
+ void about();
+ void dataChanged();
+ void open();
+ void optionsAccepted();
+ void findNext();
+ bool save();
+ bool saveAs();
+ void saveSelectionToReadableFile();
+ void saveToReadableFile();
+ void setAddress(qint64 address);
+ void setOverwriteMode(bool mode);
+ void setSize(qint64 size);
+ void showOptionsDialog();
+ void showSearchDialog();
+
+public:
+ void loadFile(const QString &fileName);
+
+private:
+ void init();
+ void createActions();
+ void createMenus();
+ void createStatusBar();
+ void createToolBars();
+ void readSettings();
+ bool saveFile(const QString &fileName);
+ void setCurrentFile(const QString &fileName);
+ QString strippedName(const QString &fullFileName);
+ void writeSettings();
+
+ QString curFile;
+ QFile file;
+ bool isUntitled;
+
+ QMenu *fileMenu;
+ QMenu *editMenu;
+ QMenu *helpMenu;
+
+ QToolBar *fileToolBar;
+ QToolBar *editToolBar;
+
+ QAction *openAct;
+ QAction *saveAct;
+ QAction *saveAsAct;
+ QAction *saveReadable;
+ QAction *closeAct;
+ QAction *exitAct;
+
+ QAction *undoAct;
+ QAction *redoAct;
+ QAction *saveSelectionReadable;
+
+ QAction *aboutAct;
+ QAction *aboutQtAct;
+ QAction *optionsAct;
+ QAction *findAct;
+ QAction *findNextAct;
+
+ QHexEdit *hexEdit;
+ OptionsDialog *optionsDialog;
+ SearchDialog *searchDialog;
+ QLabel *lbAddress, *lbAddressName;
+ QLabel *lbOverwriteMode, *lbOverwriteModeName;
+ QLabel *lbSize, *lbSizeName;
+};
+
+#endif