source: src-qt4/life-preserver/LPWizard.cpp @ 2a5e337

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since 2a5e337 was 2a5e337, checked in by Kris Moore <kris@…>, 12 months ago

Replace old life-preserver utility with our new one which uses ZFS snapshots / replication

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#include "LPWizard.h"
2#include "ui_LPWizard.h"
3
4LPWizard::LPWizard(QWidget *parent = 0) : QWizard(parent), ui(new Ui::LPWizard){
5  //Initialize the graphical items
6  ui->setupUi(this);  //load the mainUI.ui file
7  cancelled = true; //Make sure this is always set by default
8  connect(this,SIGNAL(accepted()), this,SLOT(slotFinished()) );
9  connect(this,SIGNAL(rejected()),this,SLOT(slotCancelled()) );
10}
11
12LPWizard::~LPWizard(){
13       
14}
15
16void LPWizard::setDataset(QString ds){
17  ui->label_dataset->setText(ds);
18}
19       
20void LPWizard::slotFinished(){
21  qDebug() << "Wizard Finished";
22  cancelled = false; //use the values from the UI
23  //Now load the information from the UI
24  enableReplication = ui->groupReplicate->isChecked();
25  if(enableReplication){
26    remotePort = ui->spinPort->value();
27    if(ui->radioSYNC->isChecked()){ 
28      remoteTime = -1;
29    }else{
30      remoteTime = ui->time_replicate->time().hour();
31    }
32    remoteHost = ui->lineHostName->text();
33    remoteUser = ui->lineUserName->text();
34    remoteDataset = ui->lineRemoteDataset->text();
35  }
36  if(ui->radioDaily->isChecked()){ localTime = ui->timeEdit->time().hour(); }
37  else if( ui->radio10Min->isChecked()){ localTime = -10; }
38  else if( ui->radio30Min->isChecked()){ localTime = -30; }
39  else if( ui->radio5Min->isChecked()){ localTime = -5; }
40  else{ localTime = -60; } //hourly
41  if( ui->radioKeepTotal->isChecked() ){
42    totalSnapshots = ui->spin_keepTotal->value();
43  }else{
44    if(localTime >0){ totalSnapshots = ui->spin_keepDays->value(); }
45    else{ totalSnapshots = ui->spin_keepDays->value() * (1440/(-localTime)); } //convert to number of snapshots a day
46  }
47  //Now close the UI
48  this->close();
49}
50
51void LPWizard::slotCancelled(){
52  qDebug() << "Wizard Cancelled";
53  cancelled = true; //just to make sure
54  this->close();
55}
Note: See TracBrowser for help on using the repository browser.