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
30 #include <X11/extensions/Xrandr.h>
33 #include "shopperList.h"
34 #include "shopperView.h"
35 #include "CatListModel.h"
43 class MainWindow
: public QMainWindow
48 MainWindow(Shopper::List
&l
);
49 MainWindow(QString file
);
52 void init_MainWindow(Shopper::List
*l
);
54 Shopper::List
*mylist
; // Main list that we're acting for
57 typedef enum _clear_list
{CLEAR_WANTED
,CLEAR_BOUGHT
} clear_list_mode
;
59 // Member UI helpers and components available to multiple methods
61 Shopper::ListView
*lv
;
66 /* Fullscreen mode is on (TRUE) or off (FALSE) */
69 Rotation rotation
; // X type
72 void create_list_view(Shopper::List
*);
75 void clear_list(clear_list_mode m
);
76 void set_state(Shopper::sState s
);
77 void save_filename(QString name
);
81 // Main UI action handlers
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();
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();
105 void on_action_help();
106 void on_action_about();
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
);
120 void writeSettings();
123 #endif //MAINWINDOW_H