[PC-BSD Commits] r20326 - pcbsd/branches/9.1/src-qt4/life-preserver

svn at pcbsd.org svn at pcbsd.org
Fri Nov 30 07:59:37 PST 2012


Author: kris
Date: 2012-11-30 15:59:37 +0000 (Fri, 30 Nov 2012)
New Revision: 20326

Modified:
   pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.cpp
   pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.h
Log:

MFC lifePreserver fixes to timers



Modified: pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.cpp
===================================================================
--- pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.cpp	2012-11-30 15:58:15 UTC (rev 20325)
+++ pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.cpp	2012-11-30 15:59:37 UTC (rev 20326)
@@ -76,11 +76,10 @@
    connect(actionRestore, SIGNAL( triggered(bool) ), this, SLOT(slotPushRestorePreserverClicked() ) );
 
    // Start monitoring for changes
-   QTimer::singleShot(2000, this, SLOT(slotScanPreserversForChanges() ) );
+   QTimer *traytimer = new QTimer(this);
+   connect(traytimer, SIGNAL(timeout()), this, SLOT(slotScanPreserversForChanges()));
+   traytimer->start(10000);
 
-   // Start our tray animation loop
-   QTimer::singleShot(1000, this, SLOT(slotTrayAnimation() ) );
-
    // See if we need to start a backup now
    QString cronscript = LIFEPRESERVERPATH + "/scripts/check-backups.sh &";
    system(cronscript.toLatin1());
@@ -95,21 +94,16 @@
    if ( failedBackups )
      setIcon = ":/images/images/tray-icon-failed.png";
 
-   if ( curActive ) {
-     aniStep++;
-     setIcon = ":/images/images/tray-icon-active" + tmp.setNum(aniStep) + ".png";
-     if ( aniStep == 16 )
-        aniStep = 0;
+   if ( curActive )
+     setIcon = ":/images/images/tray-icon-active7.png";
 
-     trayIcon->setIcon(QIcon(setIcon));
-     setWindowIcon(QIcon(setIcon));
-     QTimer::singleShot(150, this, SLOT(slotTrayAnimation() ) );
-   } else {
-     trayIcon->setIcon(QIcon(setIcon));
-     setWindowIcon(QIcon(setIcon));
-     QTimer::singleShot(10000, this, SLOT(slotTrayAnimation() ) );
-   }
+   if ( lastIcon == setIcon )
+      return;
 
+   trayIcon->setIcon(QIcon(setIcon));
+   setWindowIcon(QIcon(setIcon));
+   lastIcon = setIcon;
+
 }
 
 // Slot which brings up the restore widgets for a preserver
@@ -193,7 +187,7 @@
 
   trayIcon->setToolTip(tooltip);
 
-  QTimer::singleShot(6000, this, SLOT(slotScanPreserversForChanges() ) );
+  slotTrayAnimation();
 }
 
 // Slot which checks which preserver is currently highlighted

Modified: pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.h
===================================================================
--- pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.h	2012-11-30 15:58:15 UTC (rev 20325)
+++ pcbsd/branches/9.1/src-qt4/life-preserver/lifePreserverMain.h	2012-11-30 15:59:37 UTC (rev 20326)
@@ -73,6 +73,7 @@
    bool failedBackups;
    bool curActive;
    bool runAtStart;
+   QString lastIcon;
    int aniStep;
 
 signals:



More information about the Commits mailing list