-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
WelcomeDialog.cpp
90 lines (81 loc) · 4.29 KB
/
WelcomeDialog.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
/***************************************************************
*
* WiFi Password Recovery
*
* Author: Flavio Collocola
* Copyright: (C) 2018-2019 EvolSoft (www.evolsoft.org)
*
* 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
* (at your option) 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 "WelcomeDialog.h"
#include "Version.h"
#include <wx/icon.h>
#include <wx/intl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/string.h>
BEGIN_EVENT_TABLE(WelcomeDialog, wxDialog)
EVT_CLOSE(WelcomeDialog::OnClose)
END_EVENT_TABLE()
WelcomeDialog::WelcomeDialog(wxWindow* parent, wxFileConfig* config){
wxBoxSizer* boxsizer, *descBoxSizer, *buttonBoxSizer;
wxButton* buttonClose;
wxButton* buttonDonate;
wxStaticLine* separator;
wxStaticText* title, *description;
Create(parent, wxID_ANY, wxT("WiFi Password Recovery"), wxDefaultPosition, wxSize(425, 305), wxDEFAULT_DIALOG_STYLE);
this->config = config;
SetIcon(wxICON(APP_ICON));
wxFont mainFont = wxFont();
mainFont.SetPointSize(8);
SetFont(mainFont);
title = new wxStaticText(this, wxID_ANY, wxString::Format(_("Thank you for using %s!"), wxT("WiFi Password Recovery")), wxDefaultPosition, wxDefaultSize, 0);
title->SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
separator = new wxStaticLine(this, wxID_ANY);
description = new wxStaticText(this, wxID_ANY, wxString::Format(_("Thank you for using %s. %s is a small utility to recover the passwords of the WiFi networks saved on your computer.\n\n"
"Unlike many other alterative programs, %s is totally free and even open source. Please consider "
"supporting this program with a small donation. Thank you!"), wxT("WiFi Password Recovery"), wxT("WiFi Password Recovery"), wxT("WiFi Password Recovery")), wxDefaultPosition, wxDefaultSize, 0);
buttonClose = new wxButton(this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
buttonDonate = new wxButton(this, wxID_ANY, _("Donate"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
showAgainCheckBox = new wxCheckBox(this, wxID_ANY, _("Don't show this message again"));
boxsizer = new wxBoxSizer(wxVERTICAL);
descBoxSizer = new wxBoxSizer(wxVERTICAL);
buttonBoxSizer = new wxBoxSizer(wxHORIZONTAL);
title->Wrap(GetSize().GetWidth());
boxsizer->Add(title, 0, wxLEFT | wxTOP | wxRIGHT, 8);
boxsizer->Add(separator, 0, wxEXPAND | wxALL, 10);
descBoxSizer->Add(description, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 2);
descBoxSizer->Add(showAgainCheckBox, 0, wxALL | wxALIGN_BOTTOM, 2);
boxsizer->Add(descBoxSizer, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 8);
buttonBoxSizer->Add(buttonDonate, 1, wxRIGHT | wxEXPAND, 6);
buttonBoxSizer->Add(buttonClose, 1, wxEXPAND, 0);
boxsizer->Add(buttonBoxSizer, 0, wxALL | wxALIGN_BOTTOM | wxALIGN_RIGHT, 8);
SetSizer(boxsizer);
Center();
buttonClose->Connect(wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &OnButtonCloseClick, NULL, this);
buttonDonate->Connect(wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &OnButtonDonateClick, NULL, this);
}
WelcomeDialog::~WelcomeDialog(){}
void WelcomeDialog::OnClose(wxCloseEvent& event){
config->Write(wxT("welcome_message"), !showAgainCheckBox->GetValue());
config->Flush();
event.Skip();
}
void WelcomeDialog::OnButtonCloseClick(wxCommandEvent& event){
Close();
}
void WelcomeDialog::OnButtonDonateClick(wxCommandEvent& event){
wxLaunchDefaultBrowser(wxT(WPR_DONATION_URL));
}