-
Notifications
You must be signed in to change notification settings - Fork 4
/
about.cpp
234 lines (147 loc) · 5.31 KB
/
about.cpp
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/**
* -----------------------------------------------------
* File about.cpp
* Authors David Ordnung, Impact
* License GPLv3
* Web http://dordnung.de, http://gugyclan.eu
* -----------------------------------------------------
*
* Copyright (C) 2013-2017 David Ordnung, Impact
*
* 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 of the License, 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. If not, see <http://www.gnu.org/licenses/>
*/
// Include Project
#include "about.h"
#include "main.h"
#include "update.h"
#include "taskbar.h"
#include "log.h"
#include "calladmin-client.h"
// WX
#include <wx/version.h>
// Curl
#include <curl/curlver.h>
// About Panel
AboutPanel* about = NULL;
// Button ID's for about Panel
enum
{
wxID_UpdateAbout = wxID_HIGHEST+300,
wxID_DownloadAbout,
};
// Button Events for about Panel
BEGIN_EVENT_TABLE(AboutPanel, wxPanel)
EVT_BUTTON(wxID_UpdateAbout, AboutPanel::OnUpdate)
EVT_BUTTON(wxID_DownloadAbout, AboutPanel::OnDownload)
END_EVENT_TABLE()
// Create about Panel
AboutPanel::AboutPanel(wxNotebook* note) : wxPanel(note, wxID_ANY)
{
// Set about Panel
about = this;
// Border and Center
wxSizerFlags flags;
wxStaticText* text;
// Border and Centre
flags.Border(wxALL, 10);
flags.Centre();
// Create Box
sizerTop = new wxBoxSizer(wxVERTICAL);
// Call Admin
text = new wxStaticText(this, wxID_ANY, "The Call Admin Project");
text->SetFont(wxFont(28, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
// Add it
sizerTop->Add(text, 0, wxALL &~ wxBOTTOM | wxALIGN_CENTRE_HORIZONTAL, 10);
// By
text = new wxStaticText(this, wxID_ANY, "Copyright (C) David Ordnung and Impact 2013");
text->SetFont(wxFont(13, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
// Add it
sizerTop->Add(text, 0, wxALL &~ wxTOP | wxALIGN_CENTRE_HORIZONTAL, 10);
// Banner
#if defined(__WXMSW__)
sizerTop->Add(new wxStaticBitmap(this, wxID_ANY, wxBitmap(wxImage("calladmin_banner", wxBITMAP_TYPE_RESOURCE))), flags);
#else
sizerTop->Add(new wxStaticBitmap(this, wxID_ANY, wxBitmap(wxImage(getAppPath("resources/calladmin_banner.bmp")))), flags);
#endif
// Box for Current Version
wxSizer* const sizerVersion = new wxBoxSizer(wxHORIZONTAL);
// Your Version
text = new wxStaticText(this, wxID_ANY, "Your version: " + version);
text->SetFont(wxFont(15, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
// Add it
sizerVersion->Add(text, 0, wxRIGHT | wxLEFT | wxALIGN_CENTRE_HORIZONTAL, 20);
// Current Version
currentText = new wxStaticText(this, wxID_ANY, "Current version: " + version);
currentText->SetFont(wxFont(15, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
currentText->SetForegroundColour(wxColour(34, 139, 34));
// Add it
sizerVersion->Add(currentText, 0, wxLEFT | wxALIGN_CENTRE_HORIZONTAL, 20);
// Add box
sizerTop->Add(sizerVersion, 0, wxALL | wxALIGN_CENTRE_HORIZONTAL, 5);
// Box for Credits
wxSizer* const sizerCredits = new wxBoxSizer(wxHORIZONTAL);
// WX
text = new wxStaticText(this, wxID_ANY, (wxString)wxVERSION_STRING);
text->SetFont(wxFont(12, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
// Add it
sizerCredits->Add(text, 0, wxALL | wxALIGN_CENTRE_HORIZONTAL, 10);
// Curl
text = new wxStaticText(this, wxID_ANY, "CURL " + (wxString)LIBCURL_VERSION);
text->SetFont(wxFont(12, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
// Add it
sizerCredits->Add(text, 0, wxALL | wxALIGN_CENTRE_HORIZONTAL, 10);
// OSW
text = new wxStaticText(this, wxID_ANY, "OpenSteamWorks 2013/27/5");
text->SetFont(wxFont(12, FONT_FAMILY, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
// Add it
sizerCredits->Add(text, 0, wxALL | wxALIGN_CENTRE_HORIZONTAL, 10);
// Add box
sizerTop->Add(sizerCredits, 0, wxALL | wxALIGN_CENTRE_HORIZONTAL, 5);
wxSizer* const sizerBtns = new wxBoxSizer(wxHORIZONTAL);
// Buttons
sizerBtns->Add(new wxButton(this, wxID_UpdateAbout, "Check For Update"), flags.Border(wxALL &~ wxRIGHT, 5));
downloadButton = new wxButton(this, wxID_DownloadAbout, "Download Update");
downloadButton->Enable(false);
sizerBtns->Add(downloadButton, flags.Border(wxALL &~ wxLEFT, 5));
// Add Buttons to Box
sizerTop->Add(sizerBtns, flags.Align(wxALIGN_CENTER_HORIZONTAL));
// Auto Size
SetSizerAndFit(sizerTop, true);
}
// Button Event -> Check for Update
void AboutPanel::OnUpdate(wxCommandEvent& WXUNUSED(event))
{
// Log Action
LogAction("Check for a new Update");
checkUpdate();
}
// Button Event -> Download Update
void AboutPanel::OnDownload(wxCommandEvent& WXUNUSED(event))
{
// Log Action
LogAction("Download new Update");
// Open Update Dialog
if (update_dialog == NULL && update_thread == NULL)
{
new UpdateDialog();
}
else
{
// Update already running
if (m_taskBarIcon != NULL)
{
m_taskBarIcon->ShowMessage("Update running", "Update is already running", this);
}
}
}