git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
110 lines
3.0 KiB
C++
110 lines
3.0 KiB
C++
#ifndef EMAINWINDOW_H
|
|
#define EMAINWINDOW_H
|
|
|
|
#include <QTranslator>
|
|
#include <QUrl>
|
|
#include <QDesktopWidget>
|
|
#include <QInputDialog>
|
|
#include <QClipboard>
|
|
#include <QRadioButton>
|
|
#include <QThread>
|
|
#include <QColorDialog>
|
|
#include <QTime>
|
|
#include <QSplitter>
|
|
#include "session_manager.h"
|
|
#include "ribbon.h"
|
|
|
|
class UAction: public QAction {
|
|
Q_OBJECT
|
|
public:
|
|
UAction(int ind,const QString & text, QObject * parent): QAction(text, parent) {
|
|
index = ind;
|
|
connect(this, SIGNAL(triggered()), this, SLOT(triggered()));
|
|
connect(this, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
|
connect(this, SIGNAL(hovered()), this, SLOT(hovered()));
|
|
}
|
|
UAction(int ind, const QIcon & icon, const QString & text, QObject * parent): QAction(icon, text, parent) {
|
|
index = ind;
|
|
connect(this, SIGNAL(triggered()), this, SLOT(triggered()));
|
|
connect(this, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
|
connect(this, SIGNAL(hovered()), this, SLOT(hovered()));
|
|
}
|
|
public slots:
|
|
void show() {setVisible(true);}
|
|
void hide() {setVisible(false);}
|
|
void setCheckedTrue() {setChecked(true);}
|
|
void setCheckedFalse() {setChecked(false);}
|
|
private:
|
|
int index;
|
|
private slots:
|
|
void triggered() {emit itriggered(this, index);}
|
|
void toggled(bool t) {emit itoggled(t, this, index);}
|
|
void hovered() {emit ihovered(this);}
|
|
signals:
|
|
void itriggered(QAction *, int);
|
|
void itoggled(bool, QAction *, int);
|
|
void ihovered(QAction * action);
|
|
};
|
|
|
|
|
|
class EMainWindow: public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
EMainWindow(QWidget * parent = 0);
|
|
~EMainWindow();
|
|
|
|
virtual void reset(bool full = false) {}
|
|
virtual bool load(const QString & path) {return true;}
|
|
virtual bool save(const QString & path) {return true;}
|
|
|
|
void addSeparator() {}
|
|
|
|
protected:
|
|
// Qt`s overloaded
|
|
void showEvent(QShowEvent * );
|
|
void closeEvent(QCloseEvent * );
|
|
bool eventFilter(QObject * o, QEvent * e);
|
|
void timerEvent(QTimerEvent * e);
|
|
QMenu * createPopupMenu();
|
|
|
|
void init(const QString & config) {session.setFile(config); initMenus(); initSession(); loadSession();}
|
|
void initMenus();
|
|
void initSession();
|
|
virtual void saveSession();
|
|
virtual void loadSession();
|
|
virtual QSize dockTabsIconSIze() const {return iconSize();}
|
|
virtual QString loadFilter() {return "All files(*)";}
|
|
virtual QString saveFilter() {return "All files(*)";}
|
|
|
|
bool checkSave();
|
|
void setChanged(bool yes = true) {isChanged = yes; setWindowModified(yes);}
|
|
|
|
QAction action_show_all_tools, action_hide_all_tools, action_show_all_docks, action_hide_all_docks;
|
|
QString file_name, title_src;
|
|
QList<QTabBar * > tbars;
|
|
QList<QDockWidget * > tdocks;
|
|
SessionManager session;
|
|
bool isChanged, first_show;
|
|
int tid;
|
|
|
|
private slots:
|
|
void changedDock();
|
|
void changedDockClose(QObject * bar);
|
|
void closeDock(int index);
|
|
virtual void sessionLoading(QPIConfig & conf) {}
|
|
virtual void sessionSaving(QPIConfig & conf) {}
|
|
|
|
public slots:
|
|
void changed() {setChanged(true);}
|
|
void newFile();
|
|
void openFile();
|
|
bool saveFile(bool ask = false);
|
|
bool saveAsFile();
|
|
|
|
signals:
|
|
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|