Added a Notify class
[shopper.git] / src / ui / mainwindow.h
blobf364d8b5437ec685fec944f1d465877a9b3ed71d
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 "shopperView.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(Shopper::List &l);
49 MainWindow(QString file);
51 protected:
52 void init_MainWindow(Shopper::List *l);
54 Shopper::List *mylist; // Main list that we're acting for
56 // types
57 typedef enum _clear_list {CLEAR_WANTED,CLEAR_BOUGHT} clear_list_mode;
59 // Member UI helpers and components available to multiple methods
60 QComboBox *catCombo;
61 Shopper::ListView *lv;
62 QString filename;
63 QAction *nextAct;
64 QToolBar *buttonBar;
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*);
74 // Data manipulators
75 void clear_list(clear_list_mode m);
76 void set_state(Shopper::sState s);
77 void save_filename(QString name);
80 protected slots:
81 // Main UI action handlers
82 // Dialog initiators
83 void on_action_add_item();
84 void on_action_manage_category();
86 // Change current category
87 void on_action_next();
88 void on_action_prev();
90 // List state manipulation
91 void on_action_clear_wanted();
92 void on_action_clear_bought();
93 void on_action_fullList();
94 void on_action_whatsLeft();
95 void on_action_makingList();
97 // File handling
98 void on_action_file_new();
99 void on_action_file_open();
100 void on_action_file_save();
101 void on_action_file_saveas();
102 void on_action_file_quit();
104 // Help
105 void on_action_help();
106 void on_action_about();
108 //Signal handlers:
109 bool on_key_pressed();
110 bool on_signal_window_closed();
111 void on_action_fullscreen();
112 void on_action_rotate();
113 void closeEvent(QCloseEvent *event);
115 // Update UI on data change
116 void cat_selected(int i);
118 private:
119 void readSettings();
120 void writeSettings();
123 #endif //MAINWINDOW_H