Permalink
Browse files

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

  • Loading branch information...
1 parent a194d99 commit 4019f37cad3dbd71fc5234594d8efb9abb52e932 Ken Moore committed Sep 20, 2013
Showing with 7 additions and 65 deletions.
  1. +3 −2 src-qt4/life-preserver/LPGUtils.h
  2. +1 −63 src-qt4/life-preserver/LPMain.cpp
  3. +3 −0 src-qt4/life-preserver/lPreserve.qrc
@@ -11,7 +11,8 @@
class LPGUtils{
public:
-
-}
+ static LPDataset loadPoolData(QString zpool); //Load backend data into container
+
+};
#endif
@@ -52,68 +52,6 @@ void LPMain::updateUI(){
// ==============
// PRIVATE
// ==============
-LPDataset LPMain::loadPoolData(QString pool){
- //Load the current information for the given zpool
- qDebug() << "New Dataset: " << ds;
- LPDataset DSC;
- //List all the mountpoints in this dataset
- QStringList subsets = LPBackend::listDatasetSubsets(ds);
- QStringList lpsnaps = LPBackend::listLPSnapshots(ds);
- //populate the list of snapshots available for each mountpoint
- for(int i=0; i<subsets.length(); i++){
- //qDebug() << "Subset:" << subsets[i];
- QStringList snaps = LPBackend::listSnapshots(subsets[i]);
- //qDebug() << " - Snapshots:" << snaps;
- if(snaps.isEmpty()){
- //invalid subset - remove it from the list
- subsets.removeAt(i);
- i--;
- }else{
- QStringList subsnaps;
- //only list the valid snapshots that life preserver created
- for(int s=0; s<lpsnaps.length(); s++){
- int index = snaps.indexOf(lpsnaps[s]);
- if(index > -1){ subsnaps << lpsnaps[s]; snaps.removeAt(index); }
- }
- //Now list all the other available snapshots (no certain ordering)
- if(!snaps.isEmpty()){
- subsnaps << "--"; //so we know that this is a divider between the sections
- subsnaps << snaps;
- }
- DSC.subsetHash.insert(subsets[i],subsnaps); //add it to the internal container hash
- }
- }
- //Get the time for the latest life-preserver snapshot (and total number)
- //Find the index for the current list
- int ci = 0;
- while(ci < CLIST.length()){
- if(CLIST[ci].startsWith(ds+":::")){ break; }
- else{ ci++; }
- }
- if(CLIST.isEmpty()){ ci = -1; } //catch for empty list
- if(DSC.subsetHash.size() < 1){
- DSC.numberOfSnapshots = "0";
- DSC.latestSnapshot= "";
- }else{
- DSC.numberOfSnapshots = QString::number(lpsnaps.length());
- if(lpsnaps.isEmpty()){ DSC.latestSnapshot=""; }
- else if(ci > -1 && ci < CLIST.length()){
- QString sna = CLIST[ci].section(":::",1,1);
- if(sna != "-"){ DSC.latestSnapshot= sna; }
- else{ DSC.latestSnapshot = ""; }
- }else{ DSC.latestSnapshot=lpsnaps[0]; }
- }
- //List the replication status
- if(RLIST.contains(ds) && (ci > -1)){
- QString rep = CLIST[ci].section(":::",2,2);
- if(rep != "-"){ DSC.latestReplication = rep; }
- else{ DSC.latestReplication= tr("Enabled"); }
- }else{
- DSC.latestReplication= tr("Disabled");
- }
- //Return the dataset
- return DSC;
-}
// ==============
@@ -138,7 +76,7 @@ void updateInterface(){
ui->actionUnmanage_Pool->setEnabled(poolSelected);
ui->action_SaveKeyToUSB->setEnabled(poolSelected);
if(poolSelected){
- POOLDATA = loadPoolData(ui->combo_pools->currentText());
+ POOLDATA = LPGUtils::loadPoolData(ui->combo_pools->currentText());
//Now list the status information
//Now list the data restore options
@@ -1,5 +1,8 @@
<RCC>
<qresource>
+ <file>images/next.png</file>
+ <file>images/previous.png</file>
+ <file>images/view.png</file>
<file>images/camera_add.png</file>
<file>images/upload.png</file>
<file>images/key.png</file>

0 comments on commit 4019f37

Please sign in to comment.