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

wpPartitions::wpPartitions(QWidget *parent) : QWizardPage(parent)
{
  setupUi(this);
  backend = Backend::instance();
  connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete()));
  listWidget->setItemDelegate(new ListDelegate(this));
}

void wpPartitions::initializePage()
{
  listWidget->clear();
  listWidget->addItem(new ListItem(tr("Manual partitioning"), tr("You will have to do the partitioning with a partition-manager manually. This way you have more possibilities to adjust the installation to your needs. The automatic partitioning lacks several features and is only a (computer generated) list of some possible options."), "partitionmanager", "manual"));
  listWidget->addItem(new ListItem(tr("Already partitioned"), tr("If you have already partitioned for the installation and don't want to start a partition manager then select this."), "drive-harddisk", "already"));
  listWidget->setCurrentRow(0);
  clearPage();
}

void wpPartitions::clearPage()
{
}

void wpPartitions::receivedDataLine(QString data, QString line)
{
  if(data == "install_choice")
  {
    listWidget->addItem(new ListItem(line, line, "tools-wizard", line.section(" ",0,0)));
  }
}

void wpPartitions::updateComplete()
{
  emit completeChanged();
}

bool wpPartitions::isComplete() const
{
  if(!listWidget->currentItem()) return false;
  return true;
}

bool wpPartitions::validatePage()
{
  if(!isComplete()) return false;
//   backend->cfg("install_choice", listWidget->currentItem()->data(ListItem::ItemData).toString());
  return true;
}

int wpPartitions::nextId() const
{
  if(listWidget->currentItem())
  {
    QString choice = listWidget->currentItem()->data(ListItem::ItemData).toString();
    if(choice == "manual")
      return MainWizard::Page_PartManSel;
    else if(choice == "already")
      return MainWizard::Page_RootPartition;
  }
}