Permalink
Browse files

Remove the new life-preserver UI from the project tree - it is in the…

… main pcbsd/src-qt4 tree now with additional updates.
  • Loading branch information...
1 parent 4ce4b86 commit 98f9597da698292baf07dffe3bd86eda758dd86f Ken Moore committed Aug 28, 2013
Showing with 0 additions and 11,107 deletions.
  1. +0 −305 life-preserver/LPBackend.cpp
  2. +0 −37 life-preserver/LPBackend.h
  3. +0 −165 life-preserver/LPConfig.cpp
  4. +0 −39 life-preserver/LPConfig.h
  5. +0 −384 life-preserver/LPConfig.ui
  6. +0 −31 life-preserver/LPContainers.h
  7. +0 −229 life-preserver/LPTray.cpp
  8. +0 −48 life-preserver/LPTray.h
  9. +0 −55 life-preserver/LPWizard.cpp
  10. +0 −33 life-preserver/LPWizard.h
  11. +0 −627 life-preserver/LPWizard.ui
  12. +0 −125 life-preserver/i18n/LifePreserver_af.ts
  13. +0 −125 life-preserver/i18n/LifePreserver_ar.ts
  14. +0 −125 life-preserver/i18n/LifePreserver_az.ts
  15. +0 −125 life-preserver/i18n/LifePreserver_bg.ts
  16. +0 −125 life-preserver/i18n/LifePreserver_bn.ts
  17. +0 −125 life-preserver/i18n/LifePreserver_bs.ts
  18. +0 −125 life-preserver/i18n/LifePreserver_ca.ts
  19. +0 −125 life-preserver/i18n/LifePreserver_cs.ts
  20. +0 −125 life-preserver/i18n/LifePreserver_cy.ts
  21. +0 −125 life-preserver/i18n/LifePreserver_da.ts
  22. +0 −125 life-preserver/i18n/LifePreserver_de.ts
  23. +0 −125 life-preserver/i18n/LifePreserver_el.ts
  24. +0 −125 life-preserver/i18n/LifePreserver_en_GB.ts
  25. +0 −125 life-preserver/i18n/LifePreserver_en_US.ts
  26. +0 −125 life-preserver/i18n/LifePreserver_en_ZA.ts
  27. +0 −125 life-preserver/i18n/LifePreserver_es.ts
  28. +0 −125 life-preserver/i18n/LifePreserver_et.ts
  29. +0 −125 life-preserver/i18n/LifePreserver_eu.ts
  30. +0 −125 life-preserver/i18n/LifePreserver_fa.ts
  31. +0 −125 life-preserver/i18n/LifePreserver_fi.ts
  32. +0 −125 life-preserver/i18n/LifePreserver_fr.ts
  33. +0 −125 life-preserver/i18n/LifePreserver_fr_CA.ts
  34. +0 −125 life-preserver/i18n/LifePreserver_fur.ts
  35. +0 −125 life-preserver/i18n/LifePreserver_gl.ts
  36. +0 −125 life-preserver/i18n/LifePreserver_he.ts
  37. +0 −125 life-preserver/i18n/LifePreserver_hi.ts
  38. +0 −125 life-preserver/i18n/LifePreserver_hr.ts
  39. +0 −125 life-preserver/i18n/LifePreserver_hu.ts
  40. +0 −125 life-preserver/i18n/LifePreserver_id.ts
  41. +0 −125 life-preserver/i18n/LifePreserver_is.ts
  42. +0 −125 life-preserver/i18n/LifePreserver_it.ts
  43. +0 −125 life-preserver/i18n/LifePreserver_ja.ts
  44. +0 −125 life-preserver/i18n/LifePreserver_ka.ts
  45. +0 −125 life-preserver/i18n/LifePreserver_ko.ts
  46. +0 −125 life-preserver/i18n/LifePreserver_lt.ts
  47. +0 −125 life-preserver/i18n/LifePreserver_lv.ts
  48. +0 −125 life-preserver/i18n/LifePreserver_mk.ts
  49. +0 −125 life-preserver/i18n/LifePreserver_mn.ts
  50. +0 −125 life-preserver/i18n/LifePreserver_ms.ts
  51. +0 −125 life-preserver/i18n/LifePreserver_mt.ts
  52. +0 −125 life-preserver/i18n/LifePreserver_nb.ts
  53. +0 −125 life-preserver/i18n/LifePreserver_ne.ts
  54. +0 −125 life-preserver/i18n/LifePreserver_nl.ts
  55. +0 −125 life-preserver/i18n/LifePreserver_pa.ts
  56. +0 −125 life-preserver/i18n/LifePreserver_pl.ts
  57. +0 −125 life-preserver/i18n/LifePreserver_pt.ts
  58. +0 −125 life-preserver/i18n/LifePreserver_pt_BR.ts
  59. +0 −125 life-preserver/i18n/LifePreserver_ro.ts
  60. +0 −125 life-preserver/i18n/LifePreserver_ru.ts
  61. +0 −125 life-preserver/i18n/LifePreserver_sa.ts
  62. +0 −125 life-preserver/i18n/LifePreserver_sk.ts
  63. +0 −125 life-preserver/i18n/LifePreserver_sl.ts
  64. +0 −125 life-preserver/i18n/LifePreserver_sr.ts
  65. +0 −125 life-preserver/i18n/LifePreserver_sv.ts
  66. +0 −125 life-preserver/i18n/LifePreserver_sw.ts
  67. +0 −125 life-preserver/i18n/LifePreserver_ta.ts
  68. +0 −125 life-preserver/i18n/LifePreserver_tg.ts
  69. +0 −125 life-preserver/i18n/LifePreserver_th.ts
  70. +0 −125 life-preserver/i18n/LifePreserver_tr.ts
  71. +0 −125 life-preserver/i18n/LifePreserver_uk.ts
  72. +0 −125 life-preserver/i18n/LifePreserver_uz.ts
  73. +0 −125 life-preserver/i18n/LifePreserver_vi.ts
  74. +0 −125 life-preserver/i18n/LifePreserver_zh_CN.ts
  75. +0 −125 life-preserver/i18n/LifePreserver_zh_HK.ts
  76. +0 −125 life-preserver/i18n/LifePreserver_zh_TW.ts
  77. +0 −125 life-preserver/i18n/LifePreserver_zu.ts
  78. +0 −4 life-preserver/images/.directory
  79. BIN life-preserver/images/application-exit.png
  80. BIN life-preserver/images/backup-failed.png
  81. BIN life-preserver/images/backup-ok.png
  82. BIN life-preserver/images/configure.png
  83. BIN life-preserver/images/copy.png
  84. BIN life-preserver/images/drive-removable-media.png
  85. BIN life-preserver/images/folder.png
  86. BIN life-preserver/images/lifepreserver.png
  87. BIN life-preserver/images/list-add.png
  88. BIN life-preserver/images/list-remove.png
  89. BIN life-preserver/images/network-wired.png
  90. BIN life-preserver/images/system-run.png
  91. BIN life-preserver/images/tray-icon-active1.png
  92. BIN life-preserver/images/tray-icon-active10.png
  93. BIN life-preserver/images/tray-icon-active11.png
  94. BIN life-preserver/images/tray-icon-active12.png
  95. BIN life-preserver/images/tray-icon-active13.png
  96. BIN life-preserver/images/tray-icon-active14.png
  97. BIN life-preserver/images/tray-icon-active15.png
  98. BIN life-preserver/images/tray-icon-active16.png
  99. BIN life-preserver/images/tray-icon-active2.png
  100. BIN life-preserver/images/tray-icon-active3.png
  101. BIN life-preserver/images/tray-icon-active4.png
  102. BIN life-preserver/images/tray-icon-active5.png
  103. BIN life-preserver/images/tray-icon-active6.png
  104. BIN life-preserver/images/tray-icon-active7.png
  105. BIN life-preserver/images/tray-icon-active8.png
  106. BIN life-preserver/images/tray-icon-active9.png
  107. BIN life-preserver/images/tray-icon-failed.png
  108. BIN life-preserver/images/tray-icon-idle.png
  109. +0 −34 life-preserver/lPreserve.qrc
  110. +0 −111 life-preserver/life-preserver.pro
  111. +0 −102 life-preserver/lifepreserver.desktop
  112. +0 −40 life-preserver/main.cpp
  113. +0 −350 life-preserver/mainUI.cpp
  114. +0 −64 life-preserver/mainUI.h
  115. +0 −199 life-preserver/mainUI.ui
@@ -1,305 +0,0 @@
-#include "LPBackend.h"
-
-// ==============
-// Informational
-// ==============
-QStringList LPBackend::listPossibleDatasets(){
- QString cmd = "zpool list -H -o name";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output (one dataset per line - no headers)
- QStringList list;
- for(int i=0; i<out.length(); i++){
- QString ds = out[i].section("/",0,0).simplified();
- if(!ds.isEmpty()){ list << ds; }
- }
- list.removeDuplicates();
- return list;
-}
-
-QStringList LPBackend::listDatasets(){
- QString cmd = "lpreserver listcron";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output
- QStringList list;
- for(int i=2; i<out.length(); i++){ //skip the first two lines (headers)
- QString ds = out[i].section(" - ",0,0).simplified();
- if(!ds.isEmpty()){ list << ds; }
- }
- return list;
-}
-
-QStringList LPBackend::listDatasetSubsets(QString dataset){
- QString cmd = "zfs list -H -t filesystem -o name,mountpoint,mounted";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output (one dataset per line - no headers)
- QStringList list;
- for(int i=0; i<out.length(); i++){
- if(out[i].startsWith(dataset+"/")){
- if(out[i].section("\t",2,2,QString::SectionSkipEmpty).simplified() == "yes"){
- QString ds = out[i].section("\t",1,1).simplified(); //save the mountpoint
- if(!ds.isEmpty()){ list << ds; }
- }
- }
- }
- list.removeDuplicates();
- return list;
-}
-
-QStringList LPBackend::listSnapshots(QString dsmountpoint){
- //List all the snapshots available for the given dataset mountpoint
- QDir dir(dsmountpoint+"/.zfs/snapshot");
- QStringList list;
- if(dir.exists()){
- list = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed);
- }
- return list;
-}
-
-QStringList LPBackend::listLPSnapshots(QString dataset){
- QString cmd = "lpreserver listsnap "+dataset;
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output
- QStringList list;
- for(int i=out.length()-1; i>=0; i--){ //go in reverse order for proper time format (newest first)
- if(out[i].startsWith(dataset+"@")){
- QString snap = out[i].section("@",1,3).section(" ",0,0).simplified();;
- if(!snap.isEmpty()){ list << snap; }
- }
- }
- return list;
-}
-
-QStringList LPBackend::listReplicationTargets(){
- QString cmd = "lpreserver replicate list";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output
- QStringList list;
- for(int i=0; i<out.length(); i++){
- if(out[i].contains("->")){
- QString ds = out[i].section("->",0,0).simplified();
- if(!ds.isEmpty()){ list << ds; }
- }
- }
- return list;
-}
-
-QStringList LPBackend::listCurrentStatus(){
- QString cmd = "lpreserver status";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- QStringList list;
- //Now process the output
- for(int i=2; i<out.length(); i++){ //first 2 lines are headers
- //Format: <dataset>:::<lastsnapshot | NONE>:::<lastreplication | NONE>
- QString ds = out[i].section(" - ",0,0).simplified();
- QString snap = out[i].section(" - ",1,1).simplified();
- QString rep = out[i].section(" - ",2,2).simplified();
- if(snap == "NONE"){ snap = "-"; }
- if(rep == "NONE"){ rep = "-"; }
- list << ds +":::"+ snap+":::"+rep;
- }
- return list;
-}
-
-// ==================
-// Dataset Management
-// ==================
-bool LPBackend::setupDataset(QString dataset, int time, int numToKeep){
- //Configure inputs
- QString freq;
- if(time == -30){ freq = "30min"; }
- else if(time == -10){ freq = "10min"; }
- else if(time == -5){ freq = "5min"; }
- else if(time >= 0 && time < 24){ freq = "daily@"+QString::number(time); }
- else{ freq = "hourly"; }
-
- //Create the command
- QString cmd = "lpreserver cronsnap "+dataset+" start "+freq+" "+QString::number(numToKeep);
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-bool LPBackend::removeDataset(QString dataset){
- QString cmd = "lpreserver cronsnap "+dataset+" stop";
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-bool LPBackend::datasetInfo(QString dataset, int& time, int& numToKeep){
- QString cmd = "lpreserver listcron";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output
- bool ok = false;
- for(int i=0; i<out.length(); i++){
- if(out[i].section(" - ",0,0).simplified() == dataset){
- //Get time schedule (in integer format)
- QString sch = out[i].section(" - ",1,1).simplified();
- if(sch.startsWith("daily@")){ time = sch.section("@",1,1).simplified().toInt(); }
- else if(sch=="5min"){time = -5;}
- else if(sch=="10min"){time = -10;}
- else if(sch=="30min"){time = -30;}
- else{ time = -60; } //hourly
- //Get total snapshots
- numToKeep = out[i].section("- total:",1,1).simplified().toInt();
- ok=true;
- break;
- }
- }
- //qDebug() << "lpreserver cronsnap:\n" << out << QString::number(time) << QString::number(numToKeep);
- return ok;
-}
-
-// ==================
-// Snapshop Management
-// ==================
-bool LPBackend::newSnapshot(QString dataset){
- QString cmd = "lpreserver mksnap "+dataset;
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-bool LPBackend::removeSnapshot(QString dataset, QString snapshot){
- QString cmd = "lpreserver rmsnap "+dataset +" "+snapshot;
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-bool LPBackend::revertSnapshot(QString dataset, QString snapshot){
- QString cmd = "lpreserver revertsnap "+dataset +" "+snapshot;
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-QString LPBackend::revertSnapshotFile(QString dsmountpoint, QString snapshot, QString filepath){
- //Copy the given file from the snapshot back into the main dataset
- // -- filepath: full path to the file in the snapshot directory
-
- //Check that the file path is complete and the file exists
- if(!QFile::exists(filepath)){
- //invalid file given
- return "";
- }
- //Generate the new file path
- QString newfilepath = filepath.replace(dsmountpoint+"/.zfs/snapshot/"+snapshot, dsmountpoint);
- if( QFile::exists(newfilepath) ){
- //get the file extension
- QString filename = newfilepath.section("/",-1);
- QString ext = filename.section(".",-1);
- if( !ext.isEmpty() && !filename.startsWith("."+ext) && ext!=filename){
- newfilepath.chop(ext.length()+1);
- newfilepath.append("-reversion."+ext);
- int i=1;
- //append a number to the end if a reversion file already exists
- while(QFile::exists(newfilepath)){
- newfilepath.chop(ext.length()+1);
- newfilepath.append(QString::number(i)+"."+ext);
- i ++;
- }
- }else{
- //File without an extension - just append a number
- newfilepath.append("-reversion");
- int i=1;
- QString npath = newfilepath;
- while(QFile::exists(npath)){
- npath = newfilepath.append(QString::number(i));
- i++;
- }
- newfilepath = npath;
- }
- }
- //perform the copy
- bool ok = QFile::copy(filepath,newfilepath);
- //return the path to the new file if the copy was successful
- if(ok){
- //reset the permissions on the reverted file to match the original
- QFile::setPermissions(newfilepath, QFile::permissions(filepath));
- return newfilepath;
- }else{ return ""; }
-}
-
-// ==================
-// Replication Management
-// ==================
-bool LPBackend::setupReplication(QString dataset, QString remotehost, QString user, int port, QString remotedataset, int time){
- QString stime = "sync"; //synchronize on snapshot creation (default)
- if(time >= 0 || time < 24){ stime = QString::number(time); } //daily at a particular hour (24 hour notation)
-
- QString cmd = "lpreserver replicate add "+remotehost+" "+user+" "+ QString::number(port)+" "+dataset+" "+remotedataset+" "+stime;
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-bool LPBackend::removeReplication(QString dataset){
- QString cmd = "lpreserver replicate remove "+dataset;
- int ret = system(cmd.toUtf8());
- return (ret == 0);
-}
-
-bool LPBackend::replicationInfo(QString dataset, QString& remotehost, QString& user, int& port, QString& remotedataset, int& time){
- QString cmd = "lpreserver replicate list";
- //Need output, so run this in a QProcess
- QProcess *proc = new QProcess;
- proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
- proc->waitForFinished();
- QStringList out = QString(proc->readAllStandardOutput()).split("\n");
- delete proc;
- //Now process the output
- bool ok = false;
- for(int i=0; i<out.length(); i++){
- if(out[i].contains("->") && out[i].startsWith(dataset)){
- QString data = out[i].section("->",1,1);
- user = data.section("@",0,0);
- remotehost = data.section("@",1,1).section("[",0,0);
- port = data.section("[",1,1).section("]",0,0).toInt();
- remotedataset = data.section(":",1,1).section(" Time",0,0);
- QString synchro = data.section("Time:",1,1).simplified();
- if(synchro == "sync"){ time = -1; }
- else{ time = synchro.toInt(); }
- ok = true;
- break;
- }
- }
- return ok;
-}
@@ -1,37 +0,0 @@
-#ifndef _LP_BACKEND_H
-#define _LP_BACKEND_H
-
-#include <QProcess>
-#include <QString>
-#include <QStringList>
-#include <QDebug>
-#include <QDir>
-
-//Class of static functions for using the "lpreserver" backend
-class LPBackend{
-
-public:
- //Informational
- static QStringList listPossibleDatasets(); //list all possible datasets on the system
- static QStringList listDatasets(); //list all current lifepreserver datasets
- static QStringList listDatasetSubsets(QString dataset); //list all subsets of the main dataset
- static QStringList listSnapshots(QString dsmountpoint); //list all snapshots for a particular dataset mountpoint
- static QStringList listLPSnapshots(QString dataset); //list all snapshots created by life preserver
- static QStringList listReplicationTargets(); //list all datasets with replication enabled
- static QStringList listCurrentStatus(); //list the current snapshot/replication status
- //Dataset Management
- static bool setupDataset(QString dataset, int time, int numToKeep); //add or configure dataset
- 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 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);
- //Replication Management
- static bool setupReplication(QString dataset, QString remotehost, QString user, int port, QString remotedataset, int time);
- static bool removeReplication(QString dataset);
- static bool replicationInfo(QString dataset, QString& remotehost, QString& user, int& port, QString& remotedataset, int& time);
-
-};
-#endif
Oops, something went wrong.

0 comments on commit 98f9597

Please sign in to comment.