/
installpage.cpp
108 lines (87 loc) · 2.77 KB
/
installpage.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
#include "installpage.h"
#include <QtGui>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "../backup/Utilities.h" // dbgout()
InstallPage::InstallPage(DataCabinet *cab)
: m_cabinet(cab)
, m_isRemoving(false)
, m_isMajorUpdate(false)
, m_isMinorUpdate(false)
, m_box(NULL)
, m_rb1(NULL)
, m_rb2(NULL)
{
cab->isUpdateInstallation(m_isMajorUpdate,m_isMinorUpdate);
m_label = new QLabel();
m_label->setWordWrap(true);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(m_label);
if( m_isMajorUpdate )
m_label->setText("the installer is now ready for replacing the needed files on your hard disk.");
else if( m_isMinorUpdate )
m_label->setText("the installer is now ready for copying the needed files onto your hard disk.");
else
{
m_label->setText("the installer is now ready for modifying the installation on your hard disk.");
// layout->addSpacerItem(new QSpacerItem(10,10,QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding));
layout->addWidget(new QLabel());
m_rb2 = new QRadioButton("repair current installation");
layout->addWidget(m_rb2);
m_rb1 = new QRadioButton("remove software from disk");
layout->addWidget(m_rb1);
m_rb2->setChecked(true);
// layout->addWidget(new QLabel());
m_box = new QCheckBox("show maintenance protocol");
layout->addWidget(m_box);
}
layout->addWidget(new QLabel());
m_bar = new QProgressBar;
m_bar->setMinimum(0);
m_bar->setMaximum(100);
layout->addWidget(m_bar);
setLayout(layout);
}
void InstallPage::setProgress(int progress)
{
dbgout(QString("...progress=")+QString::number(progress),3);
m_bar->setValue(progress);
qApp->processEvents();
}
void InstallPage::initializePage()
{
if( m_isMajorUpdate )
setTitle("Ready For Upgrading "+m_cabinet->getProperty(ePropWindowTitle));
else if( m_isMinorUpdate )
setTitle("Ready For Installing "+m_cabinet->getProperty(ePropWindowTitle));
else
setTitle("Ready For Modifying "+m_cabinet->getProperty(ePropWindowTitle));
}
bool InstallPage::validatePage()
{
if( m_rb2 && m_rb2->isChecked() )
{
m_isMinorUpdate = true;
m_isRemoving = false;
}
else
m_isRemoving = !m_isMajorUpdate && !m_isMinorUpdate;
if( m_box && m_box->isChecked() )
{
setDbgWindow(NULL,1);
dbgVisible(true);
}
m_cabinet->setProgressHandler(this);
if( m_isMajorUpdate || m_isRemoving )
{
m_cabinet->undoInstallation();
m_bar->setValue(0);
}
if( m_isMajorUpdate || m_isMinorUpdate )
{
m_cabinet->scanFile();
m_cabinet->closeFile();
}
m_cabinet->setProgressHandler(NULL);
return true;
}