src/mainwindow.h

Sun, 09 Apr 2023 15:59:08 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sun, 09 Apr 2023 15:59:08 +0300
changeset 362
e1d646a4cbd8
parent 361
c5e8b68e34f8
permissions
-rw-r--r--

Extracted the state of the program into a MainState structure, and extracted local functions of main() into static functions.
I was planning to make the core logic and state of the program into a Main class, which would be a QObject that would
have lots of signals and slots, but it looks like this works even without it

354
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
1 #ifndef MAINWINDOW_H
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
2 #define MAINWINDOW_H
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
3
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
4 #include <QMainWindow>
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
5 #include "ui_mainwindow.h"
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
6 #include "src/gl/common.h"
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
7
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
8 class MainWindow : public QMainWindow, public Ui_MainWindow
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
9 {
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
10 Q_OBJECT
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
11 public:
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
12 explicit MainWindow(QWidget *parent = nullptr);
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
13 Q_SIGNALS:
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
14 void renderStyleSelected(gl::RenderStyle newStyle);
361
c5e8b68e34f8 Move some recent file handling to MainWindow
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 355
diff changeset
15 void recentFileSelected(const QString& path);
354
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
16 public Q_SLOTS:
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
17 void setRenderStyle(gl::RenderStyle style);
361
c5e8b68e34f8 Move some recent file handling to MainWindow
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 355
diff changeset
18 void rebuildRecentFilesMenu(const QStringList& strings);
362
e1d646a4cbd8 Extracted the state of the program into a MainState structure, and extracted local functions of main() into static functions.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 361
diff changeset
19 void updateTitle();
355
e81f4ad53efd Move the about dialog to MainWindow. The hack to retrieve GL extensions is made a bit cleaner
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 354
diff changeset
20 private Q_SLOTS:
e81f4ad53efd Move the about dialog to MainWindow. The hack to retrieve GL extensions is made a bit cleaner
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 354
diff changeset
21 void showAboutDialog();
354
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
22 };
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
23
91053052bb28 Readd the MainWindow class and renderstyle button handling to it
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
24 #endif // MAINWINDOW_H

mercurial