Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a new button to the life-preserver for creating a snapshot right …

…then
  • Loading branch information...
commit 9a67431fe24481935c967aad718f3406b4d5106d 1 parent 69265de
@beanpole135 beanpole135 authored
View
4 src-qt4/life-preserver/LPBackend.cpp
@@ -203,8 +203,8 @@ bool LPBackend::datasetInfo(QString dataset, int& time, int& numToKeep){
// ==================
// Snapshop Management
// ==================
-bool LPBackend::newSnapshot(QString dataset){
- QString cmd = "lpreserver mksnap "+dataset;
+bool LPBackend::newSnapshot(QString dataset, QString snapshotname){
+ QString cmd = "lpreserver mksnap --replicate "+dataset+" "+snapshotname;
int ret = system(cmd.toUtf8());
return (ret == 0);
View
2  src-qt4/life-preserver/LPBackend.h
@@ -24,7 +24,7 @@ class LPBackend{
static bool removeDataset(QString dataset);
static bool datasetInfo(QString dataset, int& time, int& numToKeep); //get current settings for a dataset
//Snapshop Management
- static bool newSnapshot(QString dataset);
+ static bool newSnapshot(QString dataset, QString snapshotname);
static bool removeSnapshot(QString dataset, QString snapshot);
static bool revertSnapshot(QString dataset, QString snapshot); //revert to given snapshot
static QString revertSnapshotFile(QString dataset, QString snapshot, QString filepath);
View
BIN  src-qt4/life-preserver/images/camera_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  src-qt4/life-preserver/lPreserve.qrc
@@ -1,5 +1,6 @@
<RCC>
<qresource>
+ <file>images/camera_add.png</file>
<file>images/upload.png</file>
<file>images/key.png</file>
<file>images/lifepreserver.png</file>
View
17 src-qt4/life-preserver/mainUI.cpp
@@ -275,6 +275,23 @@ void mainUI::on_tool_remove_clicked(){
setupUI();
}
+void mainUI::on_tool_newsnapshot_clicked(){
+ QString ds = getSelectedDS();
+ if(ds.isEmpty()){return; }
+ //Get the new snapshot name from the user
+ bool ok;
+ QString name = QInputDialog::getText(this,tr("New Snapshot Name"), tr("Snapshot Name:"), QLineEdit::Normal, tr("Name"), &ok, 0, Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly | Qt::ImhDigitsOnly );
+ if(!ok || name.isEmpty()){ return; } //cancelled
+ qDebug() << "Creating a new snapshot:" << ds << name;
+ //Now create the new snapshot
+ ok = LPBackend::newSnapshot(ds,name);
+ if( ok ){
+ QMessageBox::information(this,tr("Success"), tr("The new snapshot has been created"));
+ }else{
+ QMessageBox::warning(this,tr("Failure"), tr("The new snapshot could not be created"));
+ }
+ setupUI();
+}
// --- Menu Items Clicked
void mainUI::slotRevertToSnapshot(QAction *act){
View
1  src-qt4/life-preserver/mainUI.h
@@ -56,6 +56,7 @@ private slots:
void on_treeWidget_itemSelectionChanged();
void on_tool_config_clicked();
void on_tool_remove_clicked();
+ void on_tool_newsnapshot_clicked();
void slotRevertToSnapshot(QAction*);
void slotBrowseSnapshot(QAction*);
View
14 src-qt4/life-preserver/mainUI.ui
@@ -143,6 +143,20 @@
</spacer>
</item>
<item>
+ <widget class="QToolButton" name="tool_newsnapshot">
+ <property name="statusTip">
+ <string>Make a new snapshot immediately</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset resource="lPreserve.qrc">
+ <normaloff>:/images/camera_add.png</normaloff>:/images/camera_add.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QToolButton" name="tool_browse">
<property name="statusTip">
<string>Browse a snapshot and safely recover that version of a file</string>
Please sign in to comment.
Something went wrong with that request. Please try again.