-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.hpp
157 lines (109 loc) · 4.01 KB
/
home.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* home.hpp ---
*
* Copyright (C) 2010 Alp Eren Köse
*
* Author: Alp Eren Köse <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3, or
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*!
\file home.hpp
\date Thu Jul 15 13:23:44 2010
\brief HomeWidget Class Interface
*/
#if !defined ( _HOME_ )
#define _HOME_
#include <Wt/WContainerWidget>
#include <Wt/WDialog>
namespace Wt {
class WOverlayLoadingIndicator;
}
//! Home Page representation
/*!
Contains all the elements forming the Home page.
An instance exists for session life long, and each session having their own instance.
*/
class HomeWidget : public Wt::WContainerWidget
{
private:
//! Constructor.
/*!
Private to accept calls just from #Instance() function.
This way creation of HomeWidget objects with direct calls to constructor is rejected.
\param parent Parent container of HomeWidget instance
*/
HomeWidget( Wt::WContainerWidget* parent);
//! Pointer to the only instance of HomeWidget per session.
static HomeWidget* instance_;
Wt::WContainerWidget* parent_; /*!< Parent container of HomeWidget instance. */
//! 'Update PCI IDs' button declaration.
Wt::WPushButton *bPciIds_;
//! Triggered on 'Update PCI IDs' button click.
/*!
Called on #bPciIds_ button click event.
Downloads up-to-date 'pci.ids' file from http://pciids.sourceforge.net/v2.2/pci.ids
and updates the database with current PCI IDs.
*/
void bPciIds_Click();
//! Dialog window to display succes or failure of 'pci.ids' download.
Wt::WDialog *dialogDownload_;
//! Triggered on #dialogDownload_ close.
/*!
Depending on code value:
<ul>
<li>WDialog::Accepted\n
Succesful download of 'pci.ids' file, update PCI IDs calling the update_pci_ids() function.\n
Check whether update is successful and display #dialogPciIds_ dialog window.
<li>WDialog::Rejected\n
Download failure, do nothing.
</ul>
\param code #dialogDownload_ close status; WDialog::Accepted or WDialog::Rejected.
*/
void dialogDownload_Close( Wt::WDialog::DialogCode code );
//! Dialog window to display succes or failure of PCI IDs update.
Wt::WDialog *dialogPciIds_;
//! Triggered on #dialogPciIds_ close.
void dialogPci_Close( Wt::WDialog::DialogCode code );
//! Holds the proxy address string during session.
std::string settingsProxy_;
//! Reads the previously stored proxy address in server.
/*!
Reads the proxy address stored in '/tmp/proxy.harix' and puts it into #settingsProxy_ variable.
*/
void readProxyFile();
//! Region to edit proxy address.
Wt::WLineEdit* editProxy_;
//! Triggered on 'Save' button click for proxy address.
/*!
Stores the given proxy address in #editProxy_ to '/tmp/proxy.harix',
and displays #dialogWarn_ in case of failure.
*/
void changeProxy();
//! Dialog window to display failure of proxy address saving.
Wt::WDialog *dialogWarn_;
//! Triggered on #dialogWarn_ close.
void dialogWarn_Close( Wt::WDialog::DialogCode code );
Wt::WOverlayLoadingIndicator *loading_; /*!< Busy updating indicator while updating PCI IDs. */
public:
//! Retrieve an HomeWidget instance.
/*!
Ensures that there is only one instance of HomeWidget exists per session!
\param parent Parent container of HomeWidget instance
\return Pointer to an HomeWidget instance.
*/
static HomeWidget* Instance( WContainerWidget* parent = 0 );
};
#endif // _HOME_