src/mainwindow.h

Sun, 19 Jan 2020 02:54:48 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 19 Jan 2020 02:54:48 +0200
changeset 22
6da867fa5429
parent 16
aeb5f203b3eb
child 24
1a0faaaceb84
permissions
-rw-r--r--

commit work on GL rendering

#pragma once
#include <QMainWindow>
#include <QTranslator>
#include <QSettings>
#include <QKeySequence>
#include "documentmanager.h"
#include "libraries.h"
#include "uiutilities.h"

class MainWindow : public QMainWindow
{
	Q_OBJECT
public:
	MainWindow(QWidget *parent = nullptr);
	~MainWindow();
private slots:
	void newModel();
	void openModel();
	void openModelFromPath(const QString& path);
	void runSettingsEditor();
	void handleDocumentSplitterChange();
	void updateRecentlyOpenedDocumentsMenu();
	void openRecentFile();
protected:
	void changeEvent(QEvent* event) override;
	void closeEvent(QCloseEvent* event) override;
private:
	std::unique_ptr<class Ui_MainWindow> ui;
	DocumentManager documents;
	QMap<Model*, QWidget*> modelWidgets;
	QString currentLanguage = "en";
	QTranslator translator;
	QSettings settings;
	LibraryManager libraries;
	QByteArray documentSplitterState;
	uiutilities::KeySequenceMap defaultKeyboardShortcuts;
	static constexpr int maxRecentlyOpenedFiles = 10;
	QStringList recentlyOpenedFiles;
	void updateTitle();
	void saveSettings();
	void restoreSettings();
	void changeLanguage(QString localeCode);
	void addRecentlyOpenedFile(const QString& path);
	void openModelForEditing(const QString& modelName);
	static QString pathToTranslation(const QString& localeCode);
};

mercurial