code format
This commit is contained in:
@@ -1,43 +1,45 @@
|
||||
/*
|
||||
QAD - Qt ADvanced
|
||||
QAD - Qt ADvanced
|
||||
|
||||
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EMAINWINDOW_H
|
||||
#define EMAINWINDOW_H
|
||||
|
||||
#include "qad_application_export.h"
|
||||
#include "ribbon.h"
|
||||
#include "session_manager.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QColorDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QRadioButton>
|
||||
#include <QSplitter>
|
||||
#include <QThread>
|
||||
#include <QTime>
|
||||
#include <QTranslator>
|
||||
#include <QUrl>
|
||||
#include <QInputDialog>
|
||||
#include <QClipboard>
|
||||
#include <QRadioButton>
|
||||
#include <QThread>
|
||||
#include <QColorDialog>
|
||||
#include <QTime>
|
||||
#include <QSplitter>
|
||||
#include "session_manager.h"
|
||||
#include "ribbon.h"
|
||||
#include "qad_application_export.h"
|
||||
|
||||
|
||||
class QAD_APPLICATION_EXPORT UAction: public QAction {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAction(int ind,const QString & text, QObject * parent): QAction(text, parent) {
|
||||
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)));
|
||||
@@ -50,16 +52,17 @@ public:
|
||||
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);}
|
||||
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);}
|
||||
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);
|
||||
@@ -67,55 +70,63 @@ signals:
|
||||
};
|
||||
|
||||
|
||||
class QAD_APPLICATION_EXPORT EMainWindow: public QMainWindow
|
||||
{
|
||||
class QAD_APPLICATION_EXPORT EMainWindow: public QMainWindow {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int maxRecentItems READ maxRecentItems WRITE setMaxRecentItems)
|
||||
|
||||
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;}
|
||||
virtual bool load(const QString & path) { return true; }
|
||||
virtual bool save(const QString & path) { return true; }
|
||||
|
||||
void addSeparator() {}
|
||||
void setRecentFiles(const QStringList & rl);
|
||||
QStringList recentFiles() const;
|
||||
void setRecentMenu(QMenu * m);
|
||||
|
||||
int maxRecentItems() const {return max_recent;}
|
||||
int maxRecentItems() const { return max_recent; }
|
||||
|
||||
protected:
|
||||
// Qt`s overloaded
|
||||
void showEvent(QShowEvent * );
|
||||
void closeEvent(QCloseEvent * );
|
||||
void showEvent(QShowEvent *);
|
||||
void closeEvent(QCloseEvent *);
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void changeEvent(QEvent * e);
|
||||
QMenu * createPopupMenu();
|
||||
void addToRecent(const QString & path);
|
||||
void prepareRecent();
|
||||
|
||||
void init(const QString & config) {session.setFile(config); initMenus(); initSession(); loadSession();} // unusable
|
||||
void init(const QString & config) {
|
||||
session.setFile(config);
|
||||
initMenus();
|
||||
initSession();
|
||||
loadSession();
|
||||
} // unusable
|
||||
void saveSession();
|
||||
void loadSession();
|
||||
virtual void savingSession(QPIConfig & conf) {}
|
||||
virtual void loadingSession(QPIConfig & conf) {}
|
||||
virtual QSize dockTabsIconSize() const {return iconSize();}
|
||||
virtual QString loadFilter() {return "All files(*)";}
|
||||
virtual QString saveFilter() {return "All files(*)";}
|
||||
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);}
|
||||
void setChanged(bool yes = true) {
|
||||
isChanged = yes;
|
||||
setWindowModified(yes);
|
||||
}
|
||||
|
||||
void initMenus();
|
||||
void initSession();
|
||||
|
||||
QAction action_show_all_tools, action_hide_all_tools, action_show_all_docks, action_hide_all_docks;
|
||||
QString file_name;
|
||||
QList<QTabBar * > tbars;
|
||||
QList<QDockWidget * > tdocks;
|
||||
QList<QAction * > actions_recent;
|
||||
QList<QTabBar *> tbars;
|
||||
QList<QDockWidget *> tdocks;
|
||||
QList<QAction *> actions_recent;
|
||||
QAction * action_clear_recent;
|
||||
QMenu * menu_recent;
|
||||
SessionManager session;
|
||||
@@ -124,24 +135,23 @@ protected:
|
||||
|
||||
private slots:
|
||||
void changedDock();
|
||||
void sessionLoading(QPIConfig & conf) {loadingSession(conf);}
|
||||
void sessionSaving(QPIConfig & conf) {savingSession(conf);}
|
||||
void sessionLoading(QPIConfig & conf) { loadingSession(conf); }
|
||||
void sessionSaving(QPIConfig & conf) { savingSession(conf); }
|
||||
void closeDock(int index);
|
||||
void recentTriggered();
|
||||
|
||||
public slots:
|
||||
void setMaxRecentItems(int mr);
|
||||
void changed() {setChanged(true);}
|
||||
void changed() { setChanged(true); }
|
||||
void newFile();
|
||||
void openFile();
|
||||
void openFiles();
|
||||
bool saveFile(bool ask);
|
||||
bool saveFile() {return saveFile(false);}
|
||||
bool saveFile() { return saveFile(false); }
|
||||
bool saveAsFile();
|
||||
void clearRecent();
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user