Changeset 9a67431


Ignore:
Timestamp:
08/22/13 12:59:33 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
33a568a
Parents:
69265de
Message:

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

Location:
src-qt4/life-preserver
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/LPBackend.cpp

    refffa15 r9a67431  
    204204//    Snapshop Management 
    205205// ================== 
    206 bool LPBackend::newSnapshot(QString dataset){ 
    207   QString cmd = "lpreserver mksnap "+dataset; 
     206bool LPBackend::newSnapshot(QString dataset, QString snapshotname){ 
     207  QString cmd = "lpreserver mksnap --replicate "+dataset+" "+snapshotname; 
    208208  int ret = system(cmd.toUtf8()); 
    209209    
  • src-qt4/life-preserver/LPBackend.h

    r96c5e841 r9a67431  
    2525        static bool datasetInfo(QString dataset, int& time, int& numToKeep); //get current settings for a dataset 
    2626        //Snapshop Management 
    27         static bool newSnapshot(QString dataset); 
     27        static bool newSnapshot(QString dataset, QString snapshotname); 
    2828        static bool removeSnapshot(QString dataset, QString snapshot); 
    2929        static bool revertSnapshot(QString dataset, QString snapshot); //revert to given snapshot 
  • src-qt4/life-preserver/lPreserve.qrc

    r96c5e841 r9a67431  
    11<RCC> 
    22  <qresource> 
     3    <file>images/camera_add.png</file> 
    34    <file>images/upload.png</file> 
    45    <file>images/key.png</file> 
  • src-qt4/life-preserver/mainUI.cpp

    r4a54eef r9a67431  
    276276} 
    277277 
     278void mainUI::on_tool_newsnapshot_clicked(){ 
     279  QString ds = getSelectedDS(); 
     280  if(ds.isEmpty()){return; } 
     281  //Get the new snapshot name from the user 
     282  bool ok; 
     283  QString name = QInputDialog::getText(this,tr("New Snapshot Name"), tr("Snapshot Name:"), QLineEdit::Normal, tr("Name"), &ok, 0, Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly | Qt::ImhDigitsOnly ); 
     284  if(!ok || name.isEmpty()){ return; } //cancelled 
     285  qDebug() << "Creating a new snapshot:" << ds << name; 
     286  //Now create the new snapshot 
     287  ok = LPBackend::newSnapshot(ds,name); 
     288  if( ok ){ 
     289    QMessageBox::information(this,tr("Success"), tr("The new snapshot has been created")); 
     290  }else{ 
     291    QMessageBox::warning(this,tr("Failure"), tr("The new snapshot could not be created")); 
     292  } 
     293  setupUI(); 
     294} 
    278295 
    279296// --- Menu Items Clicked 
  • src-qt4/life-preserver/mainUI.h

    r96c5e841 r9a67431  
    5757        void on_tool_config_clicked(); 
    5858        void on_tool_remove_clicked(); 
     59        void on_tool_newsnapshot_clicked(); 
    5960 
    6061        void slotRevertToSnapshot(QAction*); 
  • src-qt4/life-preserver/mainUI.ui

    r96c5e841 r9a67431  
    144144       </item> 
    145145       <item> 
     146        <widget class="QToolButton" name="tool_newsnapshot"> 
     147         <property name="statusTip"> 
     148          <string>Make a new snapshot immediately</string> 
     149         </property> 
     150         <property name="text"> 
     151          <string>...</string> 
     152         </property> 
     153         <property name="icon"> 
     154          <iconset resource="lPreserve.qrc"> 
     155           <normaloff>:/images/camera_add.png</normaloff>:/images/camera_add.png</iconset> 
     156         </property> 
     157        </widget> 
     158       </item> 
     159       <item> 
    146160        <widget class="QToolButton" name="tool_browse"> 
    147161         <property name="statusTip"> 
Note: See TracChangeset for help on using the changeset viewer.