summaryrefslogtreecommitdiff
path: root/wizard/summary.cpp
blob: b09f2c121ce95023ffeb2fd8b7a3ff22cf495b01 (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
#include <QtGui>
#include "summary.h"
#include "../listdelegate.h"
#include "../listitem.h"

wpSummary::wpSummary(QWidget *parent) : QWizardPage(parent)
{
  setComplete(true);
  setupUi(this);
  backend = Backend::instance();
//   connect(backend, SIGNAL(processExited()), this, SLOT(WeAreDone()));
  listWidget->setItemDelegate(new ListDelegate(this));
  setCommitPage(true);
  setButtonText(QWizard::CommitButton, tr("Start Installation"));
//   QListWidgetItem *item = new ListItem("Start", "Let's go!", "dialog-ok");
//   listWidget->addItem(item);
}

void wpSummary::initializePage()
{
  listWidget->clear();
  listWidget->addItem(new ListItem(tr("Installation type"), tr("HD install"), "acritoxinstaller"));
  QStringList hdMapList = backend->cfg("hdmap").split("\n");
  for (QStringList::Iterator it = hdMapList.begin(); it != hdMapList.end(); ++it)
  {
    QString line = *it;
    QString device = line.section(":",0,0);
    QString mountpoint = line.section(":",1,1);
    QString filesystem = line.section(":",2,2);
    QString automount = line.section(":",3,3);
    QString title = tr("%1 will be used as %2").arg(device).arg(mountpoint);
    QString description;
    if(filesystem.length()) description = QString("<li>") + tr("It will be formatted with %1").arg(filesystem) + QString("</li>");
    if(automount == "auto") description += QString("<li>") + tr("It will be mounted automatically on boot") + QString("</li>");
    listWidget->addItem(new ListItem(title, "<ul>" + description + "</ul>", "drive-harddisk"));
  }
  listWidget->addItem(new ListItem(tr("Bootloader"), tr("%1 will be installed to %2").arg(backend->cfg("bootloader")).arg(backend->cfg("bootloader_target")), "system-run"));
}

void wpSummary::cleanupPage()
{
  initializePage();
}

// void wpSummary::()
// {
//   QListWidgetItem *item = new ListItem("Finished.", "The backend has finished its job.", "dialog-ok");
//   listWidget->addItem(item);
//   setComplete(true);
// }

void wpSummary::setComplete(bool c)
{
  complete = c;
  emit completeChanged();
}

bool wpSummary::isComplete() const
{
  return complete;
}

bool wpSummary::validatePage()
{
  return complete;
}