The class declaration should be the first header in the cc file for
[shopper.git] / src / ui / mainwindow.h
blob4d221ef4ac9e3e343a5ed355ff4f19e8384550d7
1 /* Shopper
2 * Copyright (C) 2009 David Greaves
4 * This software is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
9 * This software is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA
21 #ifndef MAINWINDOW_H
22 #define MAINWINDOW_H
24 #include <QtGui>
26 #define XRANDR 1
27 #ifdef XRANDR
28 #include <X11/X.h>
29 #include <X11/Xlib.h>
30 #include <X11/extensions/Xrandr.h>
31 #endif
33 #include "shopperList.h"
34 #include "ListView.h"
35 #include "CatListModel.h"
37 QT_BEGIN_NAMESPACE
38 class QAction;
39 class QMenu;
40 class QTextEdit;
41 QT_END_NAMESPACE
43 class MainWindow : public QMainWindow
45 Q_OBJECT
47 public:
48 MainWindow(QString file);
49 void timerEvent(QTimerEvent *event);
51 protected:
52 void loadList();
54 Shopper::List *mylist; // Main list that we're acting for
56 // Member UI helpers and components available to multiple methods
57 QComboBox *catCombo;
58 Shopper::ListView *lv;
59 QString filename;
60 QAction *nextAct;
61 QToolBar *buttonBar;
62 QToolBar *buttonBar2;
63 int timerId;
64 int fontsize;
66 /* Fullscreen mode is on (TRUE) or off (FALSE) */
67 bool full_screen;
68 bool has_rotation;
69 Rotation rotation; // X type
71 // Gui layout
72 void create_list_view(Shopper::List*);
76 protected slots:
77 // Main UI action handlers
78 // Dialog initiators
79 void on_action_add_item();
80 void on_action_manage_category();
82 // Change current category
83 void on_action_next();
84 void on_action_prev();
86 // List state manipulation
87 void on_action_clear_wanted();
88 void on_action_clear_bought();
89 void on_action_fullList();
90 void on_action_whatsLeft();
91 void on_action_makingList();
93 // File handling
94 void on_action_file_new();
95 void on_action_file_open();
96 void on_action_file_save();
97 void on_action_file_saveas();
98 void on_action_preferences();
99 void on_action_file_quit();
101 // Help
102 void on_action_help();
103 void on_action_about();
105 //Signal handlers:
106 void keyPressEvent ( QKeyEvent * event );
107 bool on_signal_window_closed();
108 void on_action_rotate();
109 void closeEvent(QCloseEvent *event);
111 // Update UI on data change
112 void cat_selected(int i);
113 void stateChanged();
115 private:
116 void readSettings();
117 void writeSettings();
120 #endif //MAINWINDOW_H