Permalink
Browse files

Get the configuration UI plugged into the new main UI. Pretty much ev…

…erything is done now. Just need to test and make minor improvements as necessary.
  • Loading branch information...
Ken Moore
Ken Moore committed Oct 17, 2013
1 parent b66d0f2 commit 4774e2c4d7f5650aee571b66cd1d373c9df297d5
Showing with 47 additions and 25 deletions.
  1. +30 −9 lp-gui/LPMain.cpp
  2. +1 −1 lp-gui/LPMain.h
  3. +16 −15 lp-gui/LPMain.ui
View
@@ -28,7 +28,6 @@ LPMain::LPMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::LPMain){
connect(ui->check_hidden, SIGNAL(stateChanged(int)), this, SLOT(setFileVisibility()) );
connect(ui->push_restore, SIGNAL(clicked()), this, SLOT(restoreFiles()) );
connect(ui->push_configure, SIGNAL(clicked()), this, SLOT(openConfigGUI()) );
- connect(ui->push_configBackups, SIGNAL(clicked()), this, SLOT(openBackupGUI()) );
//Connect the Menu buttons
connect(ui->menuManage_Pool, SIGNAL(triggered(QAction*)), this, SLOT(menuAddPool(QAction*)) );
connect(ui->menuUnmanage_Pool, SIGNAL(triggered(QAction*)), this, SLOT(menuRemovePool(QAction*)) );
@@ -145,7 +144,6 @@ void LPMain::updateTabs(){
ui->menuDisks->setEnabled(poolSelected);
ui->menuSnapshots->setEnabled(poolSelected);
ui->push_configure->setVisible(poolSelected);
- ui->push_configBackups->setVisible(poolSelected);
ui->action_SaveKeyToUSB->setEnabled(poolSelected);
if(poolSelected){
POOLDATA = LPGUtils::loadPoolData(ui->combo_pools->currentText());
@@ -313,12 +311,35 @@ void LPMain::restoreFiles(){
void LPMain::openConfigGUI(){
qDebug() << "Open Configuration UI";
-
-}
-
-void LPMain::openBackupGUI(){
- qDebug() << "Open Backup UI";
-
+ QString ds = ui->combo_pools->currentText();
+ if(ds.isEmpty()){ return; }
+ LPConfig CFG(this);
+ CFG.loadDataset(ds, LPBackend::listReplicationTargets().contains(ds));
+ CFG.exec();
+ //Now check for return values and update appropriately
+ bool change = false;
+ if(CFG.localChanged){
+ ui->statusbar->showMessage(QString(tr("Configuring dataset: %1")).arg(ds),0);
+ LPBackend::setupDataset(ds, CFG.localSchedule, CFG.localSnapshots);
+ ui->statusbar->clearMessage();
+ change = true;
+ }
+ if(CFG.remoteChanged){
+ change = true;
+ if(CFG.isReplicated){
+ ui->statusbar->showMessage(QString(tr("Configuring replication: %1")).arg(ds),0);
+ LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
+ QMessageBox::information(this,tr("Reminder"),tr("Don't forget to save your SSH key to a USB stick so that you can restore your system from the remote host later!!"));
+ }else{
+ ui->statusbar->showMessage(QString(tr("Removing replication: %1")).arg(ds),0);
+ LPBackend::removeReplication(ds);
+ }
+ ui->statusbar->clearMessage();
+ }
+ //Now update the UI if appropriate
+ if(change){
+ updateTabs();
+ }
}
// -----------------------------------------------
@@ -445,7 +466,7 @@ void LPMain::menuExtractHomeDir(){
bool ok = LPGUtils::checkPackageUserPath(filePath, &username);
if(!ok){
QMessageBox::warning(this,tr("User Missing"),QString(tr("The user (%1) does not exist on this system. Please create this user first and then try again.")).arg(username) );
- //return;
+ return;
}
//Now extract the package
ok = LPGUtils::extractHomeDirPackage(filePath);
View
@@ -19,6 +19,7 @@
#include "LPContainers.h"
#include "LPGUtils.h"
#include "LPWizard.h"
+#include "LPConfig.h"
namespace Ui{
class LPMain;
@@ -53,7 +54,6 @@ private slots:
void setFileVisibility();
void restoreFiles();
void openConfigGUI();
- void openBackupGUI();
// -- Menu Actions --
//File Menu
void menuAddPool(QAction*);
View
@@ -23,6 +23,9 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="tool_refresh">
+ <property name="statusTip">
+ <string>Refresh the UI</string>
+ </property>
<property name="text">
<string>...</string>
</property>
@@ -64,7 +67,7 @@
<item>
<widget class="QPushButton" name="push_configure">
<property name="statusTip">
- <string>Configure local data backup schedules</string>
+ <string>Configure snapshot and replication schedules</string>
</property>
<property name="text">
<string>Configure</string>
@@ -75,20 +78,6 @@
</property>
</widget>
</item>
- <item>
- <widget class="QPushButton" name="push_configBackups">
- <property name="statusTip">
- <string>Configure off-disk data backup solutions</string>
- </property>
- <property name="text">
- <string>Backups</string>
- </property>
- <property name="icon">
- <iconset resource="lPreserve.qrc">
- <normaloff>:/images/drive-removable-media.png</normaloff>:/images/drive-removable-media.png</iconset>
- </property>
- </widget>
- </item>
</layout>
</item>
<item>
@@ -265,6 +254,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="push_prevsnap">
+ <property name="statusTip">
+ <string>Select the previous (older) snapshot</string>
+ </property>
<property name="text">
<string/>
</property>
@@ -306,6 +298,9 @@
</item>
<item>
<widget class="QPushButton" name="push_nextsnap">
+ <property name="statusTip">
+ <string>Select the next (more recent) snapshot</string>
+ </property>
<property name="text">
<string/>
</property>
@@ -331,6 +326,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="check_hidden">
+ <property name="statusTip">
+ <string>Display any hidden files/folders</string>
+ </property>
<property name="text">
<string>Show Hidden Files</string>
</property>
@@ -351,6 +349,9 @@
</item>
<item>
<widget class="QPushButton" name="push_restore">
+ <property name="statusTip">
+ <string>Restore the selected file/folder to the live system.</string>
+ </property>
<property name="text">
<string>Restore</string>
</property>

0 comments on commit 4774e2c

Please sign in to comment.