FactDev  0.1
mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 #include <QMainWindow>
5 #include <QMessageBox>
6 #include <QModelIndex>
7 #include <QTableView>
8 #include <QDir>
9 #include <QDesktopServices>
10 #include <QUrl>
11 
12 #include "utils/itemtype.h"
13 #include "utils/log.h"
14 #include "utils/hierarchicalsystem.h"
15 
16 #include "database/projectdatabase.h"
17 #include "database/billingdatabase.h"
18 #include "database/accessdatabase.h"
19 
20 #include "gui/widgets/popup.h"
21 #include "gui/widgets/customercontextualmenu.h"
22 
23 #include "gui/dialogs/messagebox.h"
24 #include "gui/dialogs/userdatadialog.h"
25 #include "gui/dialogs/dialogaddcustomer.h"
26 #include "gui/dialogs/addprojectdialog.h"
27 #include "gui/dialogs/addquotedialog.h"
28 #include "gui/dialogs/computeturnoverdialog.h"
29 #include "gui/dialogs/statisticsdialog.h"
30 #include "gui/docks/searchdock.h"
31 
32 
33 #include "exceptions/fileexception.h"
34 
35 #include "utils/pointers.h"
36 using namespace Gui::Dialogs;
37 
38 namespace Ui {
39 class MainWindow;
40 }
41 
45 namespace Gui {
46 
51 class MainWindow : public QMainWindow
52 {
53  Q_OBJECT
54 
55 public:
60  explicit MainWindow(QWidget *parent = 0);
61  ~MainWindow();
62 
67  int getCurrentCustomerId();
68 
73  int getCurrentProjectId();
74 
79  int getCurrentQuoteId();
80 
86  QString getCurrentCustomerName();
87 
93  QString getCurrentProjectName();
94 
100  int treeLevel();
106  QModelIndex rootTree();
112  void addDoc(bool isBilling);
113 
119  void resizeEvent(QResizeEvent *event);
120 
125  void responsiveCustomerTable();
130  void responsiveProjectTable();
131 
136  void responsiveBillingTable();
137 
144  bool isEasterEgg(const QString filter);
145 public slots:
149  void addCustomer();
153  void editCustomer();
158  void removeCustomer();
163  void archiveCustomer();
168  void addQuote();
173  void addBill();
177  void billingIsPaid();
182  void editUser();
187  void search(QString s);
192  void addProject();
196  void removeProject();
200  void editProject();
204  void aboutQt();
208  void aboutFact();
213  void aboutFactDev();
217  void aboutIcons();
221  void updateButtons();
222 
226  void editDoc();
230  void removeDoc();
231 
236  void copyDoc();
237 
242  void openPdf();
243 
248  void computeTurnover();
249 
253  void globalStatistics();
254 
258  void customerStatistics();
259 
263  void lockProject();
264 
268  void mergeDocks();
269 private slots:
275  void openContextualMenuTable(const QPoint point);
281  void openContextualMenuTree(const QPoint point);
285  void changeTree();
290  void changeCustomerTable();
295  void changeProjectsTable();
300  void changeDocsTable();
301 
306  void changeEasterEgg();
312  void customersTableToProjectsTable();
316  void backToCustomersTable();
320  void backToProjectsTable();
326  void projectsTableToDocsTable();
331  QModelIndex findParent();
332 
333 private:
337  void setupUi();
338 
343  void setupSignalsSlots();
348  void updateUI(QString filter="");
349 
356  void updateTableCustomers(QString filter="WHERE isArchived = 0"
357  , const int row = -1);
363  void updateTableProjects(const int pId = 0, const int row = -1);
364 
368  void updateTree(QString filter="WHERE isArchived = 0");
369 
373  void updateUser();
374 
381  void updateTableBillings(const int idProject, const int row = -1);
382 
386  void updateCostAndTurnover();
387 
394  void removeItem(QTableView* tbl, ::Utils::ItemType item);
395 
401  int getCurrentTableId(QTableView *tbl);
402 
403  Ui::MainWindow *ui;
404  Docks::SearchDock* _searchDock;
405 };
406 }
407 #endif // MAINWINDOW_H
The MainWindow class Main Window of the software.
Definition: mainwindow.h:51
The ItemType class Item type model.
Definition: itemtype.h:15
The SearchDock class Dock which contains search bar.
Definition: searchdock.h:16