]> vaikene.ee Git - evaf/blob - src/apps/FileFinder/GUI/gui.h
Added the FileFinder application.
[evaf] / src / apps / FileFinder / GUI / gui.h
1 /**
2 * @file FileFinder/GUI/gui.h
3 * @brief GUI for the FileFinder application
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #ifndef __FILEFINDER_GUI_GUI_H
21 # define __FILEFINDER_GUI_GUI_H
22
23 #include <Plugins/iPlugin>
24
25 #include <QObject>
26 #include <QString>
27 #include <QModelIndex>
28 #include <QWidget>
29
30 class QWidget;
31 class QCheckBox;
32 class QComboBox;
33 class QPushButton;
34 class QListWidget;
35 class QAction;
36
37 namespace eVaf {
38 namespace SdiWindow {
39 struct iSdiWindow;
40 } // namespace eVaf::SdiWindow
41 namespace FileFinder {
42 struct iFileFinder;
43 namespace GUI {
44
45 namespace Internal {
46
47 /**
48 * Main widget for the FileFinder window
49 */
50 class MainWidget : public QWidget
51 {
52 Q_OBJECT
53
54 public:
55
56 MainWidget(QWidget * parent = 0)
57 : QWidget(parent)
58 {}
59
60 virtual void keyPressEvent(QKeyEvent * e);
61
62
63 signals:
64
65 /**
66 * Request to close the windows/application
67 */
68 void quit();
69
70 };
71
72 } // namespace eVaf::FileFinder::GUI::Internal
73
74 /**
75 * Graphical User Interface for the FileFinder application.
76 *
77 * This module adds a GUI window to the FileFinder application using the SdiWindow module.
78 */
79 class Module : public Plugins::iPlugin
80 {
81 Q_OBJECT
82 Q_INTERFACES(eVaf::Plugins::iPlugin)
83
84 public:
85
86 Module();
87
88 virtual ~Module();
89
90 virtual bool init(QString const & args);
91
92 virtual void done();
93
94 virtual bool isReady() const { return mReady; }
95
96
97 private slots:
98
99 void browseDirectory();
100
101 void find();
102
103 void found(QString const & file, QString const & dir);
104
105 void finished(bool);
106
107 void currentRowChanged(int currentRow);
108
109 void openFile(QModelIndex const & index = QModelIndex());
110
111 void openDirectory();
112
113
114 private: // Members
115
116 /// Flag indicating that the module is ready
117 bool mReady;
118
119 /// The iFileFinder interface
120 eVaf::FileFinder::iFileFinder * mFinder;
121
122 /// Actions
123 QAction * mOpenFileAction;
124 QAction * mOpenDirectoryAction;
125
126 /// Widgets on the screen
127 Internal::MainWidget * wMain;
128 QComboBox * wDirectory;
129 QCheckBox * wRecursive;
130 QComboBox * wIncludeNames;
131 QComboBox * wExcludeNames;
132 QComboBox * wIncludeContent;
133 QComboBox * wExcludeContent;
134 QListWidget * wResults;
135 QPushButton * wFind;
136
137
138 private: // Methods
139
140 void createWidgets();
141
142 void createActions();
143
144 void saveHistory();
145
146 void loadHistory();
147
148 };
149
150 } // namespace eVaf::FileFinder::GUI
151 } // namespace eVaf::FileFinder
152 } // namespace eVaf
153
154 #endif // gui.h