Skip to content

Commit

Permalink
Some minor adjustments to the new life preserver UI, and tray timers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Moore committed Aug 12, 2013
1 parent ddcd2e0 commit 5a3263d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
6 changes: 3 additions & 3 deletions life-preserver/LPTray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LPTray::LPTray() : QSystemTrayIcon(){
this->setContextMenu(menu);
//Setup the animated icon timer
timer = new QTimer();
timer->setInterval(300);
timer->setInterval(100);
connect(timer, SIGNAL(timeout()), this, SLOT(displayWorkingIcon()) );
//Setup initial icon for the tray
this->setIcon( QIcon(":/images/tray-icon-idle.png") );
Expand All @@ -42,7 +42,7 @@ void LPTray::parseLogMessage(QString log){
//Now decide what to do/show because of the log message
if(message.contains("creating snapshot")){
dev = message.section(" ",-1).simplified();
this->showMessage( "", QString(tr("Creating snapshot for %1")).arg(dev), QSystemTrayIcon::Information, 1000);
this->showMessage( "", QString(tr("Creating snapshot for %1")).arg(dev), QSystemTrayIcon::Information, 5000);
//Just set the standard idle icon
this->setIcon( QIcon(":/images/tray-icon-idle.png") );
// }else if(message.contains("pruning snapshot")){
Expand All @@ -51,7 +51,7 @@ void LPTray::parseLogMessage(QString log){
}else if(message.contains("finished replication")){
stopWorkingIcon();
dev = message.section(" ",-1).simplified();
this->showMessage( "", QString(tr("Finished replication for %1")).arg(dev), QSystemTrayIcon::Information, 1000);
this->showMessage( "", QString(tr("Finished replication for %1")).arg(dev), QSystemTrayIcon::Information, 5000);
}else{
//Just set the standard idle icon
this->setIcon( QIcon(":/images/tray-icon-idle.png") );
Expand Down
16 changes: 4 additions & 12 deletions life-preserver/mainUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ void mainUI::setupUI(){
//Initialize the Hash
updateHash();
//Update the display
qDebug() << "Update UI";
updateUI();
qDebug() << "Update Menus";
updateMenus();
qDebug() << "Done with setup";
}

// =================
Expand Down Expand Up @@ -92,19 +89,16 @@ void mainUI::updateUI(){

void mainUI::updateMenus(){
//Reset the button menu's to correspond to the selected dataset
qDebug() << "Get selected DS";
QString ds = getSelectedDS();
//Enable/disable the remove/config buttons if nothing selected
qDebug() << "Buttons";
if(ds.isEmpty()){
ui->tool_remove->setEnabled(false);
ui->tool_config->setEnabled(false);
ui->tool_remove->setVisible(false);
ui->tool_config->setVisible(false);
}else{
ui->tool_remove->setEnabled(true);
ui->tool_config->setEnabled(true);
ui->tool_remove->setVisible(true);
ui->tool_config->setVisible(true);
}
//check for a valid ds/snapshot combination
qDebug() << "check validity of DS:" << ds;
bool ok = !ds.isEmpty();
if(ok){ ok = HLIST.contains(ds); }
if(ok){ ok = (HLIST[ds].length() > 0); }
Expand All @@ -113,11 +107,9 @@ void mainUI::updateMenus(){
brMenu->clear();

if(ok){
qDebug() << "Reset Menu contents";
//Reset the Menu Contents
QStringList snaps = HLIST[ds];
for(int i=0; i<snaps.length(); i++){
qDebug() << "Add snapshot:" << snaps[i];
revMenu->addAction( new QAction(snaps[i], this) );
brMenu->addAction( new QAction(snaps[i], this) );
}
Expand Down
15 changes: 1 addition & 14 deletions life-preserver/mainUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="tool_remove">
<property name="statusTip">
Expand Down Expand Up @@ -126,7 +113,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand Down

0 comments on commit 5a3263d

Please sign in to comment.