source: src-qt4/life-preserver/LPMain.cpp @ 4019f37

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since 4019f37 was 4019f37, checked in by Ken Moore <ken@…>, 10 months ago

Commit my current work in progress for the new life preserver UI

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#include "LPMain.h"
2
3LPMain::LPMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::LPMain){
4  ui->setupUi(); //load the Qt-designer UI file
5  //Create the basic/advanced view options
6  viewBasic = new QRadioButton(tr("Basic"), ui->menuView);
7  viewAdvanced = new QRadioButton(tr("Advanced"), ui->menuView);
8  ui->menuView->addWidget(viewBasic);
9  ui->menuView->addWidget(viewAdvanced);
10  connect(viewBasic, SIGNAL(toggled()), this, SLOT(viewChanged()) );
11  //Now set the default view type
12  viewBasic->setChecked(true); //will automatically call the "viewChanged" function
13       
14  //Connect the UI to all the functions
15       
16}
17
18LPMain::~LPMain(){
19       
20}
21
22// ==============
23//      PUBLIC SLOTS
24// ==============
25void LPMain::updateUI(){
26  //Get the currently selected pool (if there is one)
27  QString cPool;
28  if(ui->combo_pools->currentIndex != -1){ cPool = ui->combo_pools_currentText(); }
29  //Get the list of managed pools
30  QStringList pools = LPBackend::listDatasets();
31  //Now put that list into the UI
32  ui->combo_pools->clear();
33  for(int i=0; i<pools.length(); i++){
34         
35  }
36  //Now set the currently selected pools
37  if(pools.length() > 0){
38    int index = pools.indexOf(cPool);
39    if(index < 0){ ui->combo_pools->setCurrentIndex(0); }
40    else{ ui->combo_pools->setCurrentIndex(index); }
41    poolSelected=true;
42  }else{
43    //No managed pools
44    ui->combo_pools->addItem("No Managed Pools!");
45    ui->combo_pools->setCurrentIndex(0);
46    poolSelected=false;
47  }
48  //Now update the interface appropriately
49  updateInterface();
50}
51
52// ==============
53//          PRIVATE
54// ==============
55
56
57// ==============
58//     PRIVATE SLOTS
59// ==============
60void LPMain::viewChanged(){
61  if(viewBasic->isChecked()){
62    ui->menuDisks->setVisible(false);
63    ui->menuSnapshots->setVisible(false);
64  }else{
65    ui->menuDisks->setVisible(true);
66    ui->menuSnapshots->setVisible(true);
67  }
68}
69
70void updateInterface(){
71  viewChanged();
72  ui->tabWidget->setEnabled(poolSelected);
73  ui->menuView->setVisible(poolSelected);       
74  ui->tool_configure->setVisible(poolSelected);
75  ui->tool_configBackups->setVisible(poolSelected);
76  ui->actionUnmanage_Pool->setEnabled(poolSelected);
77  ui->action_SaveKeyToUSB->setEnabled(poolSelected);
78  if(poolSelected){
79    POOLDATA = LPGUtils::loadPoolData(ui->combo_pools->currentText());
80    //Now list the status information
81         
82    //Now list the data restore options
83    QStringList
84  }else{
85    //No Pool selected
86    ui->menuDisks->setVisible(false); //make sure this is always invisible if nothing selected
87    ui->menuSnapshots->setVisible(false); //make sure this is always invisible if nothing selected
88  }
89
90}
Note: See TracBrowser for help on using the repository browser.