Changeset 559e01f


Ignore:
Timestamp:
09/10/13 10:40:47 (12 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:
fcd9065
Parents:
33f74f7
Message:

Clean up LPWatcher so that it now compiles in with life-preserver. It should be ready for drop-in testing within LPTray.

Location:
src-qt4/life-preserver
Files:
4 edited

Legend:

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

    r539d8eb r559e01f  
    1212 
    1313#include "mainUI.h" 
     14#include "LPWatcher.h" 
    1415 
    1516class LPTray : public QSystemTrayIcon{ 
  • src-qt4/life-preserver/LPWatcher.cpp

    r284b216 r559e01f  
    2626  FILE_LOG = "/var/log/lpreserver/lpreserver.log"; 
    2727  FILE_ERROR="/var/log/lpreserver/error.log"; 
    28   FILE_REPLICATION=""; 
     28  FILE_REPLICATION=""; //this is set automatically based on the log file outputs 
    2929 
    3030  //initialize the watcher and timer 
     
    168168void LPWatcher::readReplicationFile(bool quiet){ 
    169169  QString stat; 
    170   while( !SFStream->atEnd() ){  
    171     QString line = SFStream->readLine();  
     170  while( !RFSTREAM->atEnd() ){  
     171    QString line = RFSTREAM->readLine();  
    172172    if(line.contains("total estimated size")){ repTotK = line.section(" ",-1).simplified(); } //save the total size to replicate 
    173173    else if(line.startsWith("send from ")){} 
     
    227227} 
    228228 
     229double LPWatcher::displayToDoubleK(QString displayNumber){ 
     230  QStringList labels;  
     231    labels << "K" << "M" << "G" << "T" << "P" << "E"; 
     232  QString clab = displayNumber.right(1); //last character is the size label 
     233        displayNumber.chop(1); //remove the label from the number 
     234  double num = displayNumber.toDouble(); 
     235  //Now format the number properly 
     236  bool ok = false; 
     237  for(int i=0; i<labels.length(); i++){ 
     238    if(labels[i] == clab){ ok = true; break; } 
     239    else{ num = num*1024; } //get ready for the next size 
     240  } 
     241  if(!ok){ num = -1; } //could not determine the size 
     242  return num; 
     243} 
     244 
    229245// ------------------------------ 
    230246//    PRIVATE SLOTS 
  • src-qt4/life-preserver/LPWatcher.h

    r284b216 r559e01f  
    4545        void stopRepFileWatcher(); 
    4646 
     47        double displayToDoubleK(QString); // string->double conversion 
     48 
    4749private slots: 
    4850        void fileChanged(QString); //file system watcher saw a change 
  • src-qt4/life-preserver/life-preserver.pro

    r96c5e841 r559e01f  
    1010                LPWizard.h \ 
    1111                LPContainers.h \ 
    12                 LPConfig.h 
     12                LPConfig.h \ 
     13                LPWatcher.h 
    1314                 
    1415SOURCES += main.cpp \ 
     
    1718                LPBackend.cpp \ 
    1819                LPWizard.cpp \ 
    19                 LPConfig.cpp 
     20                LPConfig.cpp \ 
     21                LPWatcher.cpp 
    2022 
    2123RESOURCES += lPreserve.qrc 
Note: See TracChangeset for help on using the changeset viewer.