forked from EnterpriseDB/stackbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstallationPage.cpp
97 lines (75 loc) · 2.96 KB
/
InstallationPage.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
/////////////////////////////////////////////////////////////////////////////
// Name: InstallationPage.h
// Purpose: Installation page of the wizard
// Author: Dave Page
// Created: 2007-02-13
// RCS-ID: $Id: InstallationPage.cpp,v 1.12 2010/06/03 10:45:11 sachin Exp $
// Copyright: (c) EnterpriseDB
// Licence: BSD Licence
/////////////////////////////////////////////////////////////////////////////
#include "StackBuilder.h"
// wxWindows headers
#include <wx/wx.h>
#include <wx/wizard.h>
// Application headers
#include "InstallationPage.h"
#include "CompletionPage.h"
#include "AppList.h"
BEGIN_EVENT_TABLE(InstallationPage, wxWizardPageSimple)
EVT_CHECKBOX(wxID_ANY, InstallationPage::OnSkipInstallationPressed)
EVT_WIZARD_PAGE_CHANGING(wxID_ANY, InstallationPage::OnWizardPageChanging)
END_EVENT_TABLE()
InstallationPage::InstallationPage(wxWizard *parent, AppList *applist)
: wxWizardPageSimple(parent)
{
skipInstallation = false;
m_applist = applist;
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add(0, 10);
wxStaticText *st = new wxStaticText(this, wxID_ANY, _("All the installation files have now been successfully downloaded."));
st->Wrap(400);
mainSizer->Add(st, 0, wxALL | wxFIXED_MINSIZE, 5);
mainSizer->SetItemMinSize(st, 400, 40);
st = new wxStaticText(this, wxID_ANY, _("Please click the \"Next\" button to start the installations."));
st->Wrap(400);
mainSizer->Add(st, 0, wxALL | wxFIXED_MINSIZE, 5);
mainSizer->SetItemMinSize(st, 400, 40);
st = new wxStaticText(this, wxID_ANY, _("Note: You must allow all installations to run to completion. If you are prompted to restart the computer, click \"No\" or \"Restart Later\" and manually restart your computer when all the installation have finished."));
st->Wrap(400);
mainSizer->Add(st, 0, wxALL | wxFIXED_MINSIZE, 5);
mainSizer->SetItemMinSize(st, 400, 80);
m_skipInstallation = new wxCheckBox(this, -1, _("Skip Installation"), wxDefaultPosition, wxDefaultSize);
mainSizer->Add(m_skipInstallation, 0, wxALL | wxALIGN_LEFT, 5);
SetSizer(mainSizer);
mainSizer->Fit(this);
}
void InstallationPage::OnSkipInstallationPressed(wxCommandEvent& WXUNUSED(event))
{
if (m_skipInstallation->IsChecked())
{
//Skip the installation
skipInstallation = true;
}
else
{
//Continue with the installation
skipInstallation = false;
}
}
void InstallationPage::OnWizardPageChanging(wxWizardEvent& event)
{
// If we're going backwards, just bail out
if (!event.GetDirection())
return;
((CompletionPage *)GetNext())->SetPageText(skipInstallation);
if (!skipInstallation)
{
if (!m_applist->InstallApps())
{
event.Veto();
return;
}
((CompletionPage *)GetNext())->ShowErrorWarning(m_applist->GetErrorCount());
}
((CompletionPage *)GetNext())->DisableBackButton();
}