Ignore:
Timestamp:
09/11/13 14:07:34 (19 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, releng/10.1, releng/10.1.1
Children:
b5a7675c
Parents:
9599cf7
Message:

Get the new watcher class up to the same (or slightly more) functionality thatn the old implementation. Now to start adding the new checking for mirroring/resilvering and or zpool errors.

File:
1 edited

Legend:

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

    r8516ff2 rf698804  
    4141  //Start up the watcher 
    4242  watcher->start(); 
     43  updateTrayIcon(); 
     44  updateToolTip(); 
    4345} 
    4446 
     
    200202*/ 
    201203 
     204void LPTray::updateTrayIcon(){ 
     205  if( watcher->hasError() ){ 
     206    //Errors - show that attention is required 
     207    this->setIcon( QIcon(":/images/tray-icon-failed.png") ); 
     208  }else if( watcher->isRunning() ){ 
     209    //Show the working icon 
     210    this->setIcon( QIcon(":/images/tray-icon-active7.png") ); 
     211  }else{ 
     212    //Show the idle icon 
     213    this->setIcon( QIcon(":/images/tray-icon-idle.png") ); 
     214  } 
     215   
     216} 
     217 
     218void LPTray::updateToolTip(){ 
     219  QStringList info = watcher->getAllCurrentMessages(); 
     220  this->setToolTip( info.join("\n") );   
     221} 
     222 
    202223// =============== 
    203224//     PRIVATE SLOTS 
     
    205226void LPTray::watcherMessage(QString type){ 
    206227  qDebug() << "New Watcher Message:" << type; 
     228  QStringList info; 
     229  if(type=="message"){ 
     230    //Show the message pop-up 
     231    info << "time" << "message"; 
     232    info = watcher->getMessages(type,info); 
     233    if(!info.isEmpty()){ 
     234      this->showMessage( info[0], info[1], QSystemTrayIcon::Information, 5000); 
     235    } 
     236  }else if(type=="replication"){ 
     237    info << "id" << "time" << "message"; 
     238    info = watcher->getMessages(type,info); 
     239    if(info.isEmpty()){ return; } 
     240    if(info[0] == "STARTED"){ 
     241      this->showMessage( info[1], info[2], QSystemTrayIcon::Information, 5000); 
     242    }else if(info[0] == "RUNNING"){ 
     243      //don't show anything here - just let the tooltip update 
     244    }else if(info[0] == "FINISHED"){ 
     245      this->showMessage( info[1], info[2], QSystemTrayIcon::Information, 5000); 
     246    }else if(info[0] == "ERROR"){ 
     247      this->showMessage( info[1], info[2], QSystemTrayIcon::Warning, 5000); 
     248    } 
     249     
     250  }else if(type=="critical"){ 
     251           
     252  }else if(type=="mirror"){ 
     253           
     254  } 
     255  //Update the tray icon 
     256  updateTrayIcon(); 
     257  //Update the tooltip 
     258  updateToolTip(); 
    207259} 
    208260/* 
Note: See TracChangeset for help on using the changeset viewer.