Skip to content
Browse files

Merge branch 'master' of github.com:pcbsd/pcbsd

  • Loading branch information...
2 parents 7c0c657 + fcd9065 commit 03429d8eabff483d240efe70c5e63ed07900a3c0 @kmoore134 kmoore134 committed
View
1 src-qt4/life-preserver/LPTray.h
@@ -11,6 +11,7 @@
#include <QTextStream>
#include "mainUI.h"
+#include "LPWatcher.h"
class LPTray : public QSystemTrayIcon{
Q_OBJECT
View
22 src-qt4/life-preserver/LPWatcher.cpp
@@ -25,7 +25,7 @@ LPWatcher::LPWatcher() : QObject(){
//Initialize the path variables
FILE_LOG = "/var/log/lpreserver/lpreserver.log";
FILE_ERROR="/var/log/lpreserver/error.log";
- FILE_REPLICATION="";
+ FILE_REPLICATION=""; //this is set automatically based on the log file outputs
//initialize the watcher and timer
watcher = new QFileSystemWatcher(this);
@@ -167,8 +167,8 @@ void LPWatcher::readLogFile(bool quiet){
void LPWatcher::readReplicationFile(bool quiet){
QString stat;
- while( !SFStream->atEnd() ){
- QString line = SFStream->readLine();
+ while( !RFSTREAM->atEnd() ){
+ QString line = RFSTREAM->readLine();
if(line.contains("total estimated size")){ repTotK = line.section(" ",-1).simplified(); } //save the total size to replicate
else if(line.startsWith("send from ")){}
else if(line.startsWith("TIME ")){}
@@ -226,6 +226,22 @@ void LPWatcher::stopRepFileWatcher(){
lastSize.clear();
}
+double LPWatcher::displayToDoubleK(QString displayNumber){
+ QStringList labels;
+ labels << "K" << "M" << "G" << "T" << "P" << "E";
+ QString clab = displayNumber.right(1); //last character is the size label
+ displayNumber.chop(1); //remove the label from the number
+ double num = displayNumber.toDouble();
+ //Now format the number properly
+ bool ok = false;
+ for(int i=0; i<labels.length(); i++){
+ if(labels[i] == clab){ ok = true; break; }
+ else{ num = num*1024; } //get ready for the next size
+ }
+ if(!ok){ num = -1; } //could not determine the size
+ return num;
+}
+
// ------------------------------
// PRIVATE SLOTS
// ------------------------------
View
4 src-qt4/life-preserver/LPWatcher.h
@@ -44,6 +44,8 @@ public slots:
void startRepFileWatcher();
void stopRepFileWatcher();
+ double displayToDoubleK(QString); // string->double conversion
+
private slots:
void fileChanged(QString); //file system watcher saw a change
void checkErrorFile(); //check for serious system error file
@@ -54,4 +56,4 @@ private slots:
void NotificationMessageAvailable();
};
-#endif
+#endif
View
6 src-qt4/life-preserver/life-preserver.pro
@@ -9,14 +9,16 @@ HEADERS += LPTray.h \
LPBackend.h \
LPWizard.h \
LPContainers.h \
- LPConfig.h
+ LPConfig.h \
+ LPWatcher.h
SOURCES += main.cpp \
LPTray.cpp \
mainUI.cpp \
LPBackend.cpp \
LPWizard.cpp \
- LPConfig.cpp
+ LPConfig.cpp \
+ LPWatcher.cpp
RESOURCES += lPreserve.qrc

0 comments on commit 03429d8

Please sign in to comment.
Something went wrong with that request. Please try again.