]> vaikene.ee Git - evaf/blob - src/apps/PswGen/GUI/gui.h
d3c89d4abf0e54d0c7b609b3bf9f3b97fadd4b27
[evaf] / src / apps / PswGen / GUI / gui.h
1 /**
2 * @file PswGen/GUI/gui.h
3 * @brief GUI for the PswGen 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 __PSWGEN_GUI_GUI_H
21 #define __PSWGEN_GUI_GUI_H
22
23 #include <Plugins/iPlugin>
24
25 #include <QObject>
26 #include <QString>
27
28 class QLineEdit;
29 class QSpinBox;
30 class QPushButton;
31
32 namespace eVaf {
33 namespace PswGen {
34 struct iGenerator;
35 struct iStorage;
36 namespace GUI {
37
38 /**
39 * Graphical User Interface for the PswGen application.
40 *
41 * This module adds a GUI window to the pswGen application using the SdiWindow module.
42 */
43 class Module : public Plugins::iPlugin
44 {
45 Q_OBJECT
46 Q_INTERFACES(eVaf::Plugins::iPlugin)
47
48 public:
49
50 Module();
51
52 virtual ~Module();
53
54 virtual bool init(const QString & args);
55
56 virtual void done();
57
58 virtual bool isReady() const { return mReady; }
59
60
61 private slots:
62
63 /// Master password or name changed
64 void textChanged(QString const &);
65
66 /// 'Generate' button clicked
67 void generateClicked();
68
69 /// 'Copy' button clicked
70 void copyClicked();
71
72
73 private: // Members
74
75 static int const DefaultPasswordLength;
76
77 /// Flag indicating that the module is ready
78 bool mReady;
79
80 /// The iGenerator interface
81 eVaf::PswGen::iGenerator * mGenerator;
82
83 /// The iStorage interface (can be null)
84 eVaf::PswGen::iStorage * mStorage;
85
86 /// Widgets on the screen
87 QLineEdit * wName;
88 QLineEdit * wMasterPassword;
89 QSpinBox * wLength;
90 QLineEdit * wPassword;
91 QPushButton * wGenerate;
92 QPushButton * wCopy;
93
94 };
95
96 } // namespace eVaf::PswGen::GUI
97 } // namespace eVaf::PswGen
98 } // namespace eVaf
99
100 #endif // gui.h