src/mainwindow.h

changeset 6
73e448b2943d
parent 5
593a658cba8e
child 7
68443f5be176
equal deleted inserted replaced
5:593a658cba8e 6:73e448b2943d
1 #pragma once 1 #pragma once
2 #include <QMainWindow> 2 #include <QMainWindow>
3 #include <QTranslator>
3 #include <memory> 4 #include <memory>
4 #include <vector> 5 #include <vector>
5 #include "documentmanager.h" 6 #include "documentmanager.h"
6 7
7 class MainWindow : public QMainWindow 8 class MainWindow : public QMainWindow
11 MainWindow(QWidget *parent = nullptr); 12 MainWindow(QWidget *parent = nullptr);
12 ~MainWindow(); 13 ~MainWindow();
13 private slots: 14 private slots:
14 void newModel(); 15 void newModel();
15 void openModel(); 16 void openModel();
17 void languageChangeRequested();
18 protected:
19 void changeEvent(QEvent* event);
16 private: 20 private:
17 std::unique_ptr<class Ui_MainWindow> ui; 21 std::unique_ptr<class Ui_MainWindow> ui;
18 DocumentManager documents; 22 DocumentManager documents;
19 QMap<Model*, QWidget*> modelWidgets; 23 QMap<Model*, QWidget*> modelWidgets;
20 QWidget* createWidgetForModel(Model* model); 24 QWidget* createWidgetForModel(Model* model);
21 QWidget* getWidgetForModel(Model* model); 25 QWidget* getWidgetForModel(Model* model);
26 void loadLocales();
22 void updateTabs(); 27 void updateTabs();
23 void updateTitle(); 28 void updateTitle();
29 void changeLanguage(const QString& localeCode);
30 static QString pathToTranslation(const QString& localeCode);
31 QString currentLanguage = "en";
32 QTranslator translator;
24 }; 33 };

mercurial