Changeset View
Changeset View
Standalone View
Standalone View
src/mainwindow.h
Show All 15 Lines | 1 | /* Atelier KDE Printer Host for 3D Printing | |||
---|---|---|---|---|---|
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | 17 | */ | ||
18 | #pragma once | 18 | #pragma once | ||
19 | 19 | | |||
20 | #include <QMainWindow> | 20 | #include <QMainWindow> | ||
21 | #include <QUrl> | 21 | #include <QUrl> | ||
22 | #include <KTextEditor/View> | 22 | #include <KTextEditor/View> | ||
23 | #include <KXmlGui/KXmlGuiWindow> | 23 | #include <KXmlGui/KXmlGuiWindow> | ||
24 | #include <dialogs/connectsettingsdialog.h> | ||||
25 | #include <dialogs/profilesdialog.h> | ||||
26 | #include <QStackedWidget> | ||||
27 | #include <QToolButton> | ||||
28 | #include <QMap> | ||||
29 | #include <QPair> | ||||
30 | #include <QToolButton> | ||||
patrickelectric: ```
#include <QMainWindow>
#include <QToolButton>
```
Thy this is necessary ? | |||||
24 | 31 | | |||
25 | namespace Ui | 32 | namespace Ui | ||
26 | { | 33 | { | ||
27 | class MainWindow; | 34 | class MainWindow; | ||
28 | } | 35 | } | ||
29 | 36 | | |||
37 | struct LateralArea { | ||||
38 | // Area with the the lateral buttons that will open the views. | ||||
39 | // Kind like the KDevelop stuff but way simpler. | ||||
40 | using Btn2Widget = QPair<QToolButton*, QWidget*>; | ||||
41 | using WidgetMap = QMap<QString, Btn2Widget>; | ||||
42 | | ||||
43 | QWidget *m_toolBar; | ||||
44 | QStackedWidget *m_stack; | ||||
45 | WidgetMap m_map; | ||||
46 | }; | ||||
patrickelectric: Why this template is necessary ? | |||||
@tcanabrava Can you address this? Its your code xD (Now I'm sure xD) laysrodrigues: @tcanabrava Can you address this? Its your code xD (Now I'm sure xD) | |||||
it passes the type to the qobject_cast so I don't need to write qobject_cast<Blah>(m_map[s].second); every time, just .get<Blah>(s); tcanabrava: it passes the type to the qobject_cast so I don't need to write qobject_cast<Blah>(m_map[s]. | |||||
And where do you use the get function ? I can't find in this patch. patrickelectric: And where do you use the get function ? I can't find in this patch. | |||||
patrickelectric: Ok, sorry for that. | |||||
47 | | ||||
30 | class MainWindow : public KXmlGuiWindow | 48 | class MainWindow : public KXmlGuiWindow | ||
31 | { | 49 | { | ||
32 | Q_OBJECT | 50 | Q_OBJECT | ||
33 | 51 | | |||
34 | public: | 52 | public: | ||
35 | explicit MainWindow(QWidget *parent = nullptr); | 53 | explicit MainWindow(QWidget *parent = nullptr); | ||
36 | ~MainWindow(); | 54 | ~MainWindow(); | ||
37 | 55 | | |||
38 | private: | 56 | private: | ||
39 | Ui::MainWindow *ui; | 57 | Ui::MainWindow *ui; | ||
40 | QList<QUrl> m_openFiles; | 58 | QList<QUrl> m_openFiles; | ||
41 | KTextEditor::View *m_curr_editor_view; | 59 | KTextEditor::View *m_currEditorView; | ||
60 | LateralArea m_lateral; | ||||
61 | void setupLateralArea(); | ||||
42 | void initWidgets(); | 62 | void initWidgets(); | ||
43 | void setupActions(); | 63 | void setupActions(); | ||
44 | void openFile(); | 64 | void openFile(); | ||
45 | void newConnection(const QString& port, const QMap<QString, QVariant>& profile); | 65 | void newConnection(const QString& port, const QMap<QString, QVariant>& profile); | ||
46 | 66 | | |||
47 | signals: | 67 | signals: | ||
48 | void extruderCountChanged(int count); | 68 | void extruderCountChanged(int count); | ||
49 | }; | 69 | }; |
Thy this is necessary ?