2013-08-21 18:16:26 +00:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QSettings>
|
|
|
|
#include "backend.h"
|
|
|
|
#include "settings.h"
|
|
|
|
|
2014-09-18 19:36:17 +00:00
|
|
|
class MyTabWidget;
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
class DocumentTab
|
|
|
|
{
|
|
|
|
public:
|
2014-09-18 19:36:17 +00:00
|
|
|
DocumentTab() { m_tab = 0; }
|
2014-04-07 09:28:04 +00:00
|
|
|
virtual bool Quit() = 0;
|
2014-09-18 19:36:17 +00:00
|
|
|
virtual QWidget *GetWidget() = 0;
|
|
|
|
void SetTabWidget(MyTabWidget *tab) { m_tab = tab; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void OnModified(bool modified);
|
|
|
|
void SetTabName(const QString& name);
|
|
|
|
MyTabWidget *m_tab;
|
2014-04-07 09:28:04 +00:00
|
|
|
};
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
class MyTabWidget : public QTabWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
MyTabWidget();
|
2014-04-07 09:28:04 +00:00
|
|
|
bool CloseTab(int index);
|
2014-09-18 19:36:17 +00:00
|
|
|
void SetTabModified(DocumentTab *tab, bool mod);
|
|
|
|
void SetTabName(DocumentTab *tab, const QString& name);
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnCloseTab(int index);
|
|
|
|
};
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainWindow(Backend *backend);
|
|
|
|
void center();
|
|
|
|
void ReadSettings();
|
|
|
|
void WriteSettings();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
protected:
|
2014-09-18 19:36:17 +00:00
|
|
|
void AddTab(DocumentTab *tab, const QString& title);
|
2014-04-07 09:28:04 +00:00
|
|
|
bool Quit();
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
private slots:
|
|
|
|
void OnQuit();
|
|
|
|
void OnAbout();
|
2014-02-09 01:17:14 +00:00
|
|
|
void OnAboutQt();
|
2013-08-21 18:16:26 +00:00
|
|
|
void OnLoadDesc();
|
|
|
|
void OnNewRegTab();
|
2014-04-07 09:28:04 +00:00
|
|
|
void OnNewRegEdit();
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
private:
|
2014-04-07 09:28:04 +00:00
|
|
|
MyTabWidget *m_tab;
|
2013-08-21 18:16:26 +00:00
|
|
|
Backend *m_backend;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|