FreeDebks  1.0.3
 All Classes Files Functions Variables Friends Pages
FdMainWindow.hpp
Go to the documentation of this file.
1 // --------------------------------------------------------------------
2 // Copyright © 2011-2013 Mathieu Schopfer
3 //
4 // This file is part of FreeDebks.
5 //
6 // FreeDebks is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // FreeDebks is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with FreeDebks. If not, see <http://www.gnu.org/licenses/>.
18 // --------------------------------------------------------------------
19 
20 #ifndef FDMAINWINDOW_H
21 #define FDMAINWINDOW_H
22 
23 #include "ui_FdMainWindow.h"
24 #include <QMessageBox>
25 #include <QDesktopServices>
26 #include <QWhatsThis>
27 #include "guiDefinitions.hpp"
28 
36 #define mainWindow FdMainWindow::instance()
37 
38 class FdMainWindow : public QMainWindow, private Ui::FdMainWindow
39 {
40 
41 Q_OBJECT
42 private:
43  static FdMainWindow* self;
44  TabRole mActiveTab;
45  QList<QAction*> mRecentOpenedFiles;
46  QList<QAction*> mContextMenuActionsEdit;
47  QList<QAction*> mContextMenuActionsCoa;
48  QList<QAction*> mContextMenuActionsJournal;
49  QList<QAction*> mContextMenuActionsResults;
50  QList<QAction*> mContextMenuActionsAccount;
51  QAction* createOpenRecentFileAction(QString file);
52  void updateOpenRecentFileActions(QString file);
53 
54 protected:
55  void closeEvent(QCloseEvent* event);
56 
57 public:
58  static FdMainWindow* instance() { return self; }
59  FdMainWindow(QWidget* parent = 0);
60  void enableSaveAction(bool value = true);
61  void enableRemoveAction(bool value = true);
62  void enableShowAccountAction(bool value = true);
63  void enableShowEntryAction(bool value = true);
64  QList<QAction*> getContextMenuActionsEdit() const;
65  QList<QAction*> getContextMenuActionsCoa() const;
66  QList<QAction*> getContextMenuActionsJournal() const;
67  QList<QAction*> getContextMenuActionsResults() const;
68  QList<QAction*> getContextMenuActionsAccount() const;
69  void setDockText(QString text = "");
70  void activeTabChanged(TabRole role = TabRole(0), QAction* redo = new QAction(0), QAction* undo = new QAction(0), bool windowModified = false);
71  void subwindowAboutToClose();
72 
73 private slots:
76  void open(QString filePath);
77  void openRecentFile();
95 
96 public slots:
97  void addSubWindow(FdSubWindow* subwindow);
99 };
100 
101 #endif // FDMAINWINDOW_H