src/mainwindow.h

Sat, 14 Dec 2019 23:00:01 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 14 Dec 2019 23:00:01 +0200
changeset 20
cef43609a374
parent 16
aeb5f203b3eb
child 24
1a0faaaceb84
permissions
-rw-r--r--

fixed build

#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