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