aboutsummaryrefslogtreecommitdiffstats
path: root/installer/qinstallergui.cpp
blob: ca2c6d73c04a1da407e0a37df10d7f959790b8e3 (plain)
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact:  Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file.  Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/

#include "qinstallergui.h"

#include "qinstaller.h"
#include "private/qobject_p.h"

#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QProcess>
#include <QtCore/QRegExp>
#include <QtCore/QTimer>

#include <QtGui/QApplication>
#include <QtGui/QCheckBox>
#include <QtGui/QFileDialog>
#include <QtGui/QGridLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMessageBox>
#include <QtGui/QProgressBar>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include <QtGui/QTextEdit>
#include <QtGui/QTreeWidget>
#include <QtGui/QTreeView>
#include <QtGui/QVBoxLayout>


QT_BEGIN_NAMESPACE

////////////////////////////////////////////////////////////////////
//
// QInstallerGui
//
////////////////////////////////////////////////////////////////////

QInstallerGui::QInstallerGui(QInstaller *installer, QWidget *parent)
  : QWizard(parent)
{
    #ifndef Q_WS_MAC
    setWizardStyle(QWizard::ModernStyle);
    #endif
    setOption(QWizard::IndependentPages);
    connect(button(QWizard::CancelButton), SIGNAL(clicked()),
        this, SLOT(cancelButtonClicked()));

    connect(this, SIGNAL(interrupted()),
        installer, SLOT(interrupt()));
    connect(installer, SIGNAL(installationFinished()),
        this, SLOT(showFinishedPage()));
    connect(installer, SIGNAL(warning(QString)),
        this, SLOT(showWarning(QString)));
}

void QInstallerGui::cancelButtonClicked()
{
    QInstallerPage *page = qobject_cast<QInstallerPage *>(currentPage());
    qDebug() << "CANCEL CLICKED" << currentPage() << page;
    if (page && page->isInterruptible()) {
        QMessageBox::StandardButton bt = QMessageBox::warning(this,
            tr("Warning"),
            tr("Do you want to abort the installation process?"),
                QMessageBox::Yes | QMessageBox::No);
        if (bt == QMessageBox::Yes)
            emit interrupted();
    } else {
        QMessageBox::StandardButton bt = QMessageBox::warning(this,
            tr("Warning"),
            tr("Do you want to abort the installer application?"),
                QMessageBox::Yes | QMessageBox::No);
        if (bt == QMessageBox::Yes)
            QDialog::reject();
    }
}

void QInstallerGui::reject()
{}

void QInstallerGui::showFinishedPage()
{
    qDebug() << "SHOW FINISHED PAGE";
    next();
}

void QInstallerGui::showWarning(const QString &msg)
{
    QMessageBox::warning(this, tr("Warning"), msg);
}


////////////////////////////////////////////////////////////////////
//
// QInstallerPage
//
////////////////////////////////////////////////////////////////////

QInstallerPage::QInstallerPage(QInstaller *installer)
  : m_installer(installer), m_fresh(true)
{
    setSubTitle(QString(" ")); // otherwise the colors will screw up

}

QInstaller *QInstallerPage::installer() const
{
    return m_installer;
}

QPixmap QInstallerPage::watermarkPixmap() const
{
    return QPixmap(m_installer->value("WatermarkPixmap"));
}

QPixmap QInstallerPage::logoPixmap() const
{
    return QPixmap(m_installer->value("LogoPixmap"));
}

QString QInstallerPage::productName() const
{
    return m_installer->value("ProductName");
}

void QInstallerPage::insertWidget(QWidget *widget, const QString &siblingName, int offset)
{
    QWidget *sibling = findChild<QWidget *>(siblingName);
    QWidget *parent = sibling ? sibling->parentWidget() : 0;
    QLayout *layout = parent ? parent->layout() : 0;
    QBoxLayout *blayout = qobject_cast<QBoxLayout *>(layout);
    //qDebug() << "FOUND: " << sibling << parent << layout << blayout;
    if (blayout) {
        int index = blayout->indexOf(sibling) + offset;
        blayout->insertWidget(index, widget);
    }
}

QWidget *QInstallerPage::findWidget(const QString &objectName) const
{
    return findChild<QWidget *>(objectName);
}

void QInstallerPage::setVisible(bool visible)
{   
    QWizardPage::setVisible(visible);
    qApp->processEvents();
    //qDebug() << "VISIBLE: " << visible << objectName() << installer(); 
    if (m_fresh && !visible) {
        //qDebug() << "SUPRESSED...";
        m_fresh = false;
        return;
    }
    if (visible)
        entering();
    else
        leaving();
}

int QInstallerPage::nextId() const
{
    //qDebug() << "NEXTID";
    return QWizardPage::nextId();
}


////////////////////////////////////////////////////////////////////
//
// QInstallerIntroductionPage
//
////////////////////////////////////////////////////////////////////

QInstallerIntroductionPage::QInstallerIntroductionPage(QInstaller *installer)
  : QInstallerPage(installer)
{
    setObjectName("IntroductionPage");
    setTitle(tr("Setup - %1").arg(productName()));
    setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
    setSubTitle(QString());

    QLabel *msgLabel = new QLabel(this);
    msgLabel->setObjectName("MessageLabel");
    msgLabel->setWordWrap(true);
    msgLabel->setText(QInstaller::tr("Welcome to the %1 Setup Wizard.")
        .arg(productName()));

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(msgLabel);
    setLayout(layout);
}


////////////////////////////////////////////////////////////////////
//
// QInstallerLicenseAgreementPage
//
////////////////////////////////////////////////////////////////////

QInstallerLicenseAgreementPage::QInstallerLicenseAgreementPage(QInstaller *installer)
  : QInstallerPage(installer)
{
    setObjectName("LicenseAgreementPage");
    setTitle(tr("License Agreement"));
    QString msg = tr("Please read the following License Agreement. "
        "You must accept the terms of this agreement "
        "before continuing with the installation.");
    setPixmap(QWizard::LogoPixmap, logoPixmap());
    setPixmap(QWizard::WatermarkPixmap, QPixmap());

    QTextEdit *textEdit = new QTextEdit(this);
    textEdit->setObjectName("LicenseText");
    QFile file(":/resources/license.txt");
    file.open(QIODevice::ReadOnly);
    textEdit->setText(file.readAll());

    m_acceptRadioButton = new QRadioButton(tr("I accept the agreement"), this);
    m_rejectRadioButton = new QRadioButton(tr("I do not accept the agreement"), this);

    QLabel *msgLabel = new QLabel(msg, this);
    msgLabel->setObjectName("MessageLabel");
    msgLabel->setWordWrap(true);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(msgLabel);
    layout->addWidget(textEdit);
        QHBoxLayout *hlayout = new QHBoxLayout;
        hlayout->addWidget(new QLabel(tr("Do you accept this License?")));
            QVBoxLayout *vlayout = new QVBoxLayout;
            vlayout->addWidget(m_acceptRadioButton);
            vlayout->addWidget(m_rejectRadioButton);
        hlayout->addLayout(vlayout);
    layout->addLayout(hlayout);
    setLayout(layout);
    connect(m_acceptRadioButton, SIGNAL(toggled(bool)),
        this, SIGNAL(completeChanged()));
    connect(m_rejectRadioButton, SIGNAL(toggled(bool)),
        this, SIGNAL(completeChanged()));
}

bool QInstallerLicenseAgreementPage::isComplete() const
{
    return m_acceptRadioButton->isChecked();
}


////////////////////////////////////////////////////////////////////
//
// QInstallerComponentSelectionPage
//
////////////////////////////////////////////////////////////////////

static QString niceSizeText(const QString &str)
{
    qint64 size = str.toInt();
    QString msg = QInstallerComponentSelectionPage::tr(
        "This component will occupy approximately %1 %2 on your harddisk.");
    if (size < 10000)
        return msg.arg(size).arg("Bytes");
    if (size < 1024 * 10000)
        return msg.arg(size / 1024).arg("kBytes");
    return msg.arg(size / 1024 / 1024).arg("MBytes");
}

class QInstallerComponentSelectionPage::Private : public QObject
{
    Q_OBJECT

public:
    Private(QInstallerComponentSelectionPage *q_, QInstaller *installer)
      : q(q_), m_installer(installer)
    {
        m_treeView = new QTreeWidget(q);
        m_treeView->setObjectName("TreeView");
        m_treeView->setMouseTracking(true);
        m_treeView->header()->hide();

        for (int i = 0; i != installer->componentCount(); ++i) {
            QInstallerComponent *component = installer->component(i);
            QTreeWidgetItem *item = new QTreeWidgetItem(m_treeView);
            item->setText(0, component->value("Name"));
            item->setToolTip(0, component->value("Description"));
            item->setToolTip(1, niceSizeText(component->value("UncompressedSize")));
            //QString current = component->value("CurrentState");
            QString suggested = component->value("SuggestedState");
            if (suggested == "Uninstalled") {
                item->setCheckState(0, Qt::Unchecked);
            } else if (suggested == "AlwaysInstalled") {
                item->setCheckState(0, Qt::PartiallyChecked);
                item->setFlags(item->flags() & ~Qt::ItemIsUserCheckable);
            } else { //if (suggested == "Installed")
                item->setCheckState(0, Qt::Checked);
            }
        }
        
        m_descriptionLabel = new QLabel(q);
        m_descriptionLabel->setWordWrap(true);

        m_sizeLabel = new QLabel(q);
        m_sizeLabel->setWordWrap(true);

        QVBoxLayout *layout = new QVBoxLayout(q);
        //layout->addWidget(msgLabel);
            QHBoxLayout *hlayout = new QHBoxLayout;
            hlayout->addWidget(m_treeView, 3);
                QVBoxLayout *vlayout = new QVBoxLayout;
                vlayout->addWidget(m_descriptionLabel);
                vlayout->addWidget(m_sizeLabel);
                vlayout->addSpacerItem(new QSpacerItem(1, 1,
                    QSizePolicy::MinimumExpanding, 
                    QSizePolicy::MinimumExpanding));
            hlayout->addLayout(vlayout, 2);
        layout->addLayout(hlayout);
        q->setLayout(layout);

        connect(m_treeView,
            SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
    }

public slots:
    void currentItemChanged(QTreeWidgetItem *item, QTreeWidgetItem *)
    {
        m_descriptionLabel->setText(item->toolTip(0));
        m_sizeLabel->setText(item->toolTip(1));
    }

public:
    QInstallerComponentSelectionPage *q;
    QInstaller *m_installer;
    QTreeWidget *m_treeView;
    QLabel *m_descriptionLabel;
    QLabel *m_sizeLabel;
};

 
QInstallerComponentSelectionPage::QInstallerComponentSelectionPage
    (QInstaller *installer)
  : QInstallerPage(installer), d(new Private(this, installer))
{
    setObjectName("ComponentSelectionPage");
    setTitle(tr("Select Components"));
    QString msg = tr("Please select the components you want to install.");
    setSubTitle(msg);
    setPixmap(QWizard::LogoPixmap, logoPixmap());
    setPixmap(QWizard::WatermarkPixmap, QPixmap());
}

QInstallerComponentSelectionPage::~QInstallerComponentSelectionPage()
{
    delete d;
}

void QInstallerComponentSelectionPage::leaving()
{
    int n = d->m_treeView->topLevelItemCount();
    for (int i = 0; i != n; ++i) {
        QTreeWidgetItem *item = d->m_treeView->topLevelItem(i);
        QInstallerComponent *component = installer()->component(i);
        if (item->checkState(0) == Qt::Unchecked)
            component->setValue("WantedState", "Uninstalled");
        else 
            component->setValue("WantedState", "Installed");
    }
}


////////////////////////////////////////////////////////////////////
//
// QInstallerTargetDirectoryPage
//
////////////////////////////////////////////////////////////////////

QInstallerTargetDirectoryPage::QInstallerTargetDirectoryPage(QInstaller *installer)
  : QInstallerPage(installer)
{
    setObjectName("TargetDirectoryPage");
    setTitle(tr("Installation Directory"));
    setPixmap(QWizard::LogoPixmap, logoPixmap());
    setPixmap(QWizard::WatermarkPixmap, QPixmap());

    QLabel *msgLabel = new QLabel(this);
    msgLabel->setText(QInstaller::tr("Please specify the directory where %1 "
        "will be installed.").arg(productName()));
    msgLabel->setWordWrap(true);
    msgLabel->setObjectName("MessageLabel");

    m_lineEdit = new QLineEdit(this);
    m_lineEdit->setObjectName("LineEdit");

    QPushButton *browseButton = new QPushButton(this);
    browseButton->setObjectName("BrowseButton");
    browseButton->setText("Browse...");
    browseButton->setIcon(QIcon(logoPixmap()));

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(msgLabel);
        QHBoxLayout *hlayout = new QHBoxLayout;
        hlayout->addWidget(m_lineEdit);
        hlayout->addWidget(browseButton);
    layout->addLayout(hlayout);
    setLayout(layout);

    QString targetDir = installer->value("TargetDir");
    //targetDir = QDir::currentPath();
    if (targetDir.isEmpty())
        targetDir = QDir::homePath() + QDir::separator() + productName();
    m_lineEdit->setText(targetDir);

    connect(browseButton, SIGNAL(clicked()),
        this, SLOT(dirRequested()));
    connect(m_lineEdit, SIGNAL(textChanged(QString)),
        this, SIGNAL(completeChanged()));
}

QString QInstallerTargetDirectoryPage::targetDir() const
{
    return m_lineEdit->text();
}

void QInstallerTargetDirectoryPage::setTargetDir(const QString &dirName)
{
    m_lineEdit->setText(dirName);
}

void QInstallerTargetDirectoryPage::entering()
{
    connect(wizard(), SIGNAL(customButtonClicked(int)),
            this, SLOT(targetDirSelected()));
}

void QInstallerTargetDirectoryPage::leaving()
{
    installer()->setValue("TargetDir", targetDir());
    disconnect(wizard(), SIGNAL(customButtonClicked(int)),
               this, SLOT(targetDirSelected()));
}

void QInstallerTargetDirectoryPage::targetDirSelected()
{
    //qDebug() << "TARGET DIRECTORY";
    QDir dir(targetDir());
    if (dir.exists() && dir.isReadable()) {
        QMessageBox::StandardButton bt = QMessageBox::warning(this,
            tr("Warning"),
            tr("The directory you slected exists already.\n"
               "Do you want to continue?"),
                QMessageBox::Yes | QMessageBox::No);
        if (bt == QMessageBox::Yes)
            wizard()->next();
        return;
    }
    dir.cdUp();
    if (dir.exists() && dir.isReadable()) {
        wizard()->next();
        return;
    }
    wizard()->next();
}

void QInstallerTargetDirectoryPage::dirRequested()
{
    //qDebug() << "DIR REQUESTED";
    QString newDirName = QFileDialog::getExistingDirectory(this,
        tr("Select Installation Directory"), targetDir()
        /*, Options options = ShowDirsOnly*/);
    if (newDirName.isEmpty() || newDirName == targetDir())
        return;
    m_lineEdit->setText(newDirName);
}


////////////////////////////////////////////////////////////////////
//
// QInstallerReadyForInstallationPage
//
////////////////////////////////////////////////////////////////////

QInstallerReadyForInstallationPage::
    QInstallerReadyForInstallationPage(QInstaller *installer)
  : QInstallerPage(installer)
{
    setObjectName("ReadyForInstallationPage");
    setTitle(tr("Ready to Install"));
    setCommitPage(true);
    setButtonText(QWizard::CommitButton, tr("Install"));

    QLabel *msgLabel = new QLabel(this);
    msgLabel->setObjectName("MessageLabel");
    msgLabel->setText(QInstaller::tr("Setup is now ready to begin installing %1 "
        "on your computer.").arg(productName()));

    QLayout *layout = new QVBoxLayout(this);
    layout->addWidget(msgLabel);
    setLayout(layout);
}


////////////////////////////////////////////////////////////////////
//
// QInstallerPerformInstallationPage
//
////////////////////////////////////////////////////////////////////

QInstallerPerformInstallationPage::QInstallerPerformInstallationPage(QInstaller *gui)
  : QInstallerPage(gui)
{
    setObjectName("InstallationPage");
    setTitle(tr("Installing %1").arg(installer()->value("ProductName")));
    setCommitPage(true);

    m_progressBar = new QProgressBar(this);
    m_progressBar->setObjectName("ProgressBar");
    m_progressBar->setRange(1, 100);

    m_progressLabel = new QLabel(this);
    m_progressLabel->setObjectName("ProgressLabel");
    
    m_updateTimer = new QTimer(this);
    connect(m_updateTimer, SIGNAL(timeout()),
            this, SLOT(updateProgress()));
    m_updateTimer->setInterval(50);

    QLayout *layout = new QVBoxLayout(this);
    layout->addWidget(m_progressBar);
    layout->addWidget(m_progressLabel);
    setLayout(layout);

    connect(installer(), SIGNAL(installationStarted()),
            this, SLOT(installationStarted()));
    connect(installer(), SIGNAL(installationFinished()),
            this, SLOT(installationFinished()));
}

void QInstallerPerformInstallationPage::initializePage()
{
    QWizardPage::initializePage();
    QTimer::singleShot(30, installer(), SLOT(runInstaller()));
}

// FIXME: remove function
bool QInstallerPerformInstallationPage::isComplete() const
{
    return true;
}

void QInstallerPerformInstallationPage::installationStarted()
{
    qDebug() << "INSTALLATION STARTED";
    m_updateTimer->start();
    updateProgress();
}

void QInstallerPerformInstallationPage::installationFinished()
{
    qDebug() << "INSTALLATION FINISHED";
    m_updateTimer->stop();
    updateProgress();
}

void QInstallerPerformInstallationPage::updateProgress()
{
    int progress = installer()->installationProgress();
    if (progress != m_progressBar->value())
        m_progressBar->setValue(progress);
    QString progressText = installer()->installationProgressText();
    if (progressText != m_progressLabel->text())
        m_progressLabel->setText(progressText);
}


////////////////////////////////////////////////////////////////////
//
// QInstallerPerformUninstallationPage
//
////////////////////////////////////////////////////////////////////

QInstallerPerformUninstallationPage::QInstallerPerformUninstallationPage
        (QInstaller *gui)
  : QInstallerPage(gui)
{
    setObjectName("UninstallationPage");
    setTitle(tr("Uninstalling %1").arg(installer()->value("ProductName")));
    setCommitPage(true);

    m_progressBar = new QProgressBar(this);
    m_progressBar->setObjectName("ProgressBar");
    m_progressBar->setRange(1, 100);

    m_progressLabel = new QLabel(this);
    m_progressLabel->setObjectName("ProgressLabel");
    
    m_updateTimer = new QTimer(this);
    connect(m_updateTimer, SIGNAL(timeout()),
            this, SLOT(updateProgress()));
    m_updateTimer->setInterval(50);

    QLayout *layout = new QVBoxLayout(this);
    layout->addWidget(m_progressBar);
    layout->addWidget(m_progressLabel);
    setLayout(layout);

    connect(installer(), SIGNAL(uninstallationStarted()),
            this, SLOT(uninstallationStarted()));
    connect(installer(), SIGNAL(uninstallationFinished()),
            this, SLOT(uninstallationFinished()));
}

void QInstallerPerformUninstallationPage::initializePage()
{
    QWizardPage::initializePage();
    QTimer::singleShot(30, installer(), SLOT(runUninstaller()));
}

// FIXME: remove function
bool QInstallerPerformUninstallationPage::isComplete() const
{
    return true;
}

void QInstallerPerformUninstallationPage::uninstallationStarted()
{
    m_updateTimer->start();
    updateProgress();
}

void QInstallerPerformUninstallationPage::uninstallationFinished()
{
    m_updateTimer->stop();
    updateProgress();
}

void QInstallerPerformUninstallationPage::updateProgress()
{
    int progress = installer()->installationProgress();
    if (progress != m_progressBar->value())
        m_progressBar->setValue(progress);
    QString progressText = installer()->installationProgressText();
    if (progressText != m_progressLabel->text())
        m_progressLabel->setText(progressText);
}


////////////////////////////////////////////////////////////////////
//
// QInstallerFinishedPage
//
////////////////////////////////////////////////////////////////////

QInstallerFinishedPage::QInstallerFinishedPage(QInstaller *installer)
  : QInstallerPage(installer)
{
    setObjectName("FinishedPage");
    setTitle(tr("Completing the %1 Setup Wizard").arg(productName()));
    setPixmap(QWizard::WatermarkPixmap, watermarkPixmap());
    setSubTitle(QString());

    QLabel *msgLabel = new QLabel(this);
    msgLabel->setObjectName("MessageLabel");
    msgLabel->setWordWrap(true);
    msgLabel->setText(tr("Click Finish to exit the Setup Wizard"));

    m_runItCheckBox = new QCheckBox(this);
    m_runItCheckBox->setObjectName("RunItCheckBox");
    m_runItCheckBox->setChecked(true);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(msgLabel);
    if (m_runItCheckBox)
        layout->addWidget(m_runItCheckBox);
    setLayout(layout);
}

void QInstallerFinishedPage::entering()
{
    qDebug() << "FINISHED ENTERING: ";
    connect(wizard()->button(QWizard::FinishButton), SIGNAL(clicked()),
        this, SLOT(handleFinishClicked()));
    if (installer()->status() == QInstaller::InstallerSucceeded) {
        m_runItCheckBox->show();
        m_runItCheckBox->setText(tr("Run %1 now.").arg(productName()));
    } else {
        setTitle(tr("The %1 Setup Wizard failed").arg(productName()));
        m_runItCheckBox->hide();
        m_runItCheckBox->setChecked(false);
    }
}

void QInstallerFinishedPage::leaving()
{
    disconnect(wizard(), SIGNAL(customButtonClicked(int)),
        this, SLOT(handleFinishClicked()));
}

void QInstallerFinishedPage::handleFinishClicked()
{
    if (!m_runItCheckBox->isChecked())
        return;
    QString program = installer()->value("RunProgram");
    if (program.isEmpty())
        return;
    program = installer()->replaceVariables(program);
    qDebug() << "STARTING " << program;
    QProcess *process = new QProcess;
    process->start(program);
    process->waitForFinished();
}

#include "qinstallergui.moc"

QT_END_NAMESPACE