Ignore:
Timestamp:
02/28/14 13:53:11 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
1b87cd2
Parents:
0130b27
Message:

Finish updating the main Life preserver GUI to reflect the new scheduling options in lpreserver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPConfig.cpp

    rb22b3a5 r194a5d3  
    5353  // - local settings 
    5454  if(localSchedule == -5){ //5 minutes 
    55     ui->combo_local_schedule->setCurrentIndex(4);          
     55    ui->combo_local_schedule->setCurrentIndex(5);          
    5656  }else if(localSchedule == -10){ //10 minutes 
    57     ui->combo_local_schedule->setCurrentIndex(3);        
     57    ui->combo_local_schedule->setCurrentIndex(4);        
    5858  }else if(localSchedule == -30){ //30 minutes 
    59     ui->combo_local_schedule->setCurrentIndex(2);          
     59    ui->combo_local_schedule->setCurrentIndex(3);          
     60  }else if(localSchedule == -60){ //assume hourly 
     61    ui->combo_local_schedule->setCurrentIndex(2);         
    6062  }else if(localSchedule > 0 && localSchedule < 24){ //daily @ hour 
     63    ui->combo_local_schedule->setCurrentIndex(1); 
     64    ui->time_local_daily->setTime( QTime(localSchedule, 0) ); 
     65  }else{ //assume auto 
     66    localSchedule = -999; //just to make sure it does not match anything else 
    6167    ui->combo_local_schedule->setCurrentIndex(0); 
    62     ui->time_local_daily->setTime( QTime(localSchedule, 0) ); 
    63   }else{ //assume hourly 
    64     localSchedule = -60; 
    65     ui->combo_local_schedule->setCurrentIndex(1);          
    6668  } 
    6769  setLocalKeepNumber(); 
     
    7476  ui->spinPort->setValue(remotePort); 
    7577  if(remoteFreq >=0 && remoteFreq < 24){ 
    76     ui->radioRepTime->setChecked(true); 
     78    ui->combo_remote_schedule->setCurrentIndex(1); //Daily @ 
    7779    ui->time_replicate->setTime( QTime(remoteFreq,0) ); 
     80  }else if(remoteFreq == -60){ 
     81    ui->combo_remote_schedule->setCurrentIndex(2); //Hourly 
     82  }else if(remoteFreq == -30){ 
     83    ui->combo_remote_schedule->setCurrentIndex(3); // 30 minutes 
     84  }else if(remoteFreq == -10){ 
     85    ui->combo_remote_schedule->setCurrentIndex(4); // 10 minutes 
    7886  }else{ 
    79     ui->radioSYNC->setChecked(true); 
    80   } 
    81    
     87    remoteFreq = -999; //just to make sure it is the "other" case 
     88    ui->combo_remote_schedule->setCurrentIndex(0); // Sync 
     89  } 
     90  //Now update the visibility of items appropriately 
     91  on_combo_local_schedule_currentIndexChanged(ui->combo_local_schedule->currentIndex()); 
     92  on_combo_remote_schedule_currentIndexChanged(ui->combo_remote_schedule->currentIndex()); 
    8293} 
    8394 
     
    90101  int nSchedule; 
    91102  int schint = ui->combo_local_schedule->currentIndex(); 
    92   if(schint == 0){ nSchedule = ui->time_local_daily->time().hour(); } //daily @ hour 
    93   else if(schint == 1){ nSchedule = -60; } //hourly 
    94   else if(schint == 2){ nSchedule = -30; } //30 min 
    95   else if(schint == 3){ nSchedule = -10; } //10 min 
     103  if(schint == 0){ nSchedule = -999; } //Auto 
     104  if(schint == 1){ nSchedule = ui->time_local_daily->time().hour(); } //daily @ hour 
     105  else if(schint == 2){ nSchedule = -60; } //hourly 
     106  else if(schint == 3){ nSchedule = -30; } //30 min 
     107  else if(schint == 4){ nSchedule = -10; } //10 min 
    96108  else{ nSchedule = -5; } //5 min 
    97109  int nTotSnaps; 
    98   if( ui->combo_local_keepunits->currentIndex() == 0 && (schint != 0) ){ //days 
     110  if( ui->combo_local_keepunits->currentIndex() == 0 && (schint != 1) ){ //days 
    99111    int numperday = 1440/(-nSchedule); 
    100112    nTotSnaps = numperday * ui->spin_local_numkeep->value(); 
     
    119131  if( tmp != remoteDataset ){ remoteChanged = true; remoteDataset = tmp; } 
    120132  if( ui->spinPort->value() != remotePort){ remoteChanged = true; remotePort = ui->spinPort->value(); updateSSHKey=true;} 
    121   int nFreq = -1; 
    122   if(ui->radioRepTime->isChecked()){ 
    123     nFreq = ui->time_replicate->time().hour(); 
    124   } 
    125   if(nFreq < 0){ 
    126     if( remoteFreq >= 0 && remoteFreq < 24){remoteChanged = true; remoteFreq = nFreq;} 
     133   
     134  int nFreq = ui->combo_remote_schedule->currentIndex(); 
     135  if(nFreq == 0){ 
     136    nFreq = -999; //Sync 
     137  }else if(nFreq==1){ 
     138    nFreq = ui->time_replicate->time().hour(); //Daily @ 
     139  }else if(nFreq==2){ 
     140    nFreq = -60; //Hourly 
     141  }else if(nFreq==3){ 
     142    nFreq = -30; //30 minutes 
    127143  }else{ 
    128     if( nFreq != remoteFreq ){ remoteChanged = true; remoteFreq = nFreq; } 
    129   } 
     144    nFreq = -10; //10 minutes 
     145  } 
     146  if( nFreq != remoteFreq ){ remoteChanged = true; remoteFreq = nFreq; } 
     147 
    130148  if(updateSSHKey){ 
    131149    //Prompt for the SSH key generation 
     
    169187void LPConfig::on_combo_local_schedule_currentIndexChanged(int index){ 
    170188  //Adjust whether the daily time box is visible 
    171   ui->time_local_daily->setVisible( (index == 0) ); 
     189  ui->time_local_daily->setVisible( (index == 1) ); 
     190  //Show the Number to keep options if applicable 
     191  ui->spin_local_numkeep->setVisible( (index!=0) ); 
     192  ui->label_local_keep->setVisible( (index!=0) ); 
     193  ui->combo_local_keepunits->setVisible( (index!=0) ); 
     194} 
     195 
     196void LPConfig::on_combo_remote_schedule_currentIndexChanged(int index){ 
     197  //Adjust whether the daily time box is visible 
     198  ui->time_replicate->setVisible( (index == 1) ); 
    172199} 
    173200 
Note: See TracChangeset for help on using the changeset viewer.