summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-21 10:51:51 +0100
committerJonathan Bauer2011-03-21 10:51:51 +0100
commit635b5c64f3107d4c01ae314fb75e02c571b51c54 (patch)
tree4d2a3a679a569f9133ca8d3d5f5159b393accde3
parentdebug modes. -D now needs an arg: 0 for regular terminal output, 1 for debug ... (diff)
downloadfbgui-635b5c64f3107d4c01ae314fb75e02c571b51c54.tar.gz
fbgui-635b5c64f3107d4c01ae314fb75e02c571b51c54.tar.xz
fbgui-635b5c64f3107d4c01ae314fb75e02c571b51c54.zip
transformed c syntax comments to c++ convention...
-rw-r--r--src/downloadManager.cpp46
-rw-r--r--src/downloadManager.h25
-rw-r--r--src/fbgui.cpp44
-rw-r--r--src/fbgui.h11
-rw-r--r--src/javascriptInterface.cpp14
-rw-r--r--src/javascriptInterface.h13
-rw-r--r--src/loggerEngine.cpp30
-rw-r--r--src/loggerEngine.h14
-rw-r--r--src/main.cpp9
-rw-r--r--src/sysInfo.cpp4
-rw-r--r--src/sysInfo.h10
-rwxr-xr-xsrc/testApp.sh2
12 files changed, 115 insertions, 107 deletions
diff --git a/src/downloadManager.cpp b/src/downloadManager.cpp
index 4602c9d..9b4c162 100644
--- a/src/downloadManager.cpp
+++ b/src/downloadManager.cpp
@@ -3,16 +3,16 @@
int downloadManager::downloaded = 0;
// ----------------------------------------------------------------------------------------
-downloadManager::downloadManager()
-{
+downloadManager::downloadManager(){
qxtLog->debug() << "Initializing download manager...";
checkDownloadDirectory();
qnam = new QNetworkAccessManager();
dip = false;
}
// ----------------------------------------------------------------------------------------
-void downloadManager::checkDownloadDirectory(){
- /* check if downloadPath exists, if not create it. */
+void downloadManager::checkDownloadDirectory()
+{
+ // check if downloadPath exists, if not create it.
downloadDir = QDir(downloadPath);
if (!downloadDir.exists()){
qxtLog->debug() << "Download directory: " << downloadDir.path() << " doesn't exist.";
@@ -22,13 +22,12 @@ void downloadManager::checkDownloadDirectory(){
}
else {
qxtLog->debug() << "Failed to create directory: " << downloadDir.path();
- emit notify(QString("Failed to create download directory!"));
- /* try to save to /tmp/fbgui */
+ // try to save to /tmp/fbgui
downloadDir.setPath(QDir::tempPath () + "/fbgui");
if (!downloadDir.exists()){
QDir::current().mkdir(QDir::tempPath () + "/fbgui");
if (!downloadDir.exists()){
- /* TODO: dont exit, this shouldn't happen anyway (right?) */
+ // TODO: dont exit, this shouldn't happen anyway (right?)
qxtLog->debug() << "Fatal, no target for downloads. Exiting...";
exit(EXIT_FAILURE);
}
@@ -56,14 +55,14 @@ void downloadManager::processDownloadRequest(QUrl& url)
qxtLog->debug() << "No URL specified for download.";
return;
}
- /* if download in progress, enqueue file and return. */
+ // if download in progress, enqueue file and return.
if (dip){
dlQ.enqueue(url);
qxtLog->debug() << "Download in progress! Queued:" << url.toString()
<< "(" << dlQ.size() << " in queue)";
return;
}
- /* no running downloads: enqueue and start next download. */
+ // no running downloads: enqueue and start next download.
dlQ.enqueue(url);
qxtLog->debug() << "Enqueueing:" << url.toString();
startNextDownload();
@@ -79,14 +78,14 @@ void downloadManager::startNextDownload()
qxtLog->debug() << "Starting next download: " << dlQ.head().toString()
<< " (" << dlQ.size() - 1 << " in queue.)";
- /* dequeue next URL to download. */
+ // dequeue next URL to download.
QUrl url = dlQ.dequeue();
- /* get filename from URL. */
+ // get filename from URL.
QString tmp = url.path();
tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1);
- /* check if filename exists on target file system */
+ // check if filename exists on target file system
if (downloadDir.exists(tmp)){
qxtLog->debug() << "File already exists: " << downloadDir.absoluteFilePath(tmp);
outfile.setFileName(QString(downloadDir.absolutePath() + "/" + tmp + ".\%1").arg(downloaded));
@@ -95,13 +94,13 @@ void downloadManager::startNextDownload()
outfile.setFileName(downloadDir.absoluteFilePath(tmp));
qxtLog->debug() << "Saving to: " << outfile.fileName();
- /* try to open for writing */
+ // try to open for writing
if (!outfile.open(QIODevice::WriteOnly)){
qxtLog->debug() << "No write access to " << outfile.fileName() << " . Skipping download...";
return;
}
- /* send the request for the file */
+ // send the request for the file
QNetworkRequest request(url);
currentDownload = qnam->get(request);
lastProgress = 0;
@@ -117,8 +116,9 @@ void downloadManager::startNextDownload()
// ----------------------------------------------------------------------------------------
// Private slots to process downloads
// ----------------------------------------------------------------------------------------
-void downloadManager::processMetaInfo(){
- /* fetch filesize from header & filename from url (for now) */
+void downloadManager::processMetaInfo()
+{
+ // fetch filesize from header & filename from URL (for now)
const QByteArray cltag = "Content-Length";
QByteArray clinfo = currentDownload->rawHeader(cltag);
QFileInfo fi(outfile);
@@ -127,14 +127,14 @@ void downloadManager::processMetaInfo(){
// ----------------------------------------------------------------------------------------
void downloadManager::downloadReady()
{
- /* data ready, save it */
+ // data ready, save it
outfile.write(currentDownload->readAll());
}
// ----------------------------------------------------------------------------------------
void downloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
{
if (bytesIn > bytesTotal) return;
- /* calculate current speed */
+ // calculate current speed
double speed = bytesIn * 1000 / dltime.elapsed();
QString unit;
if (speed < 1024) {
@@ -148,7 +148,7 @@ void downloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
speed /= 1024*1024;
unit = "MB/s";
}
- /* update progress only if difference higher than the updateInterval setting */
+ // update progress only if difference higher than the updateInterval setting
currentProgress = ((bytesIn * 100) / bytesTotal);
if (currentProgress - lastProgress >= updateInterval){
lastProgress = currentProgress;
@@ -161,7 +161,7 @@ void downloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
// ----------------------------------------------------------------------------------------
void downloadManager::downloadFinished()
{
- /* check for errors */
+ // check for errors
if (currentDownload->error()){
currentDownload->deleteLater();
outfile.remove();
@@ -171,7 +171,7 @@ void downloadManager::downloadFinished()
emit notify(QString("Download failed! HTTP Status Code: %1").arg(statusCode));
}
else{
- /* end download */
+ // end download
currentDownload->deleteLater();
outfile.close();
downloaded++;
@@ -180,7 +180,7 @@ void downloadManager::downloadFinished()
emit notify(QString("Successfully downloaded %1").arg(currentDownload->url().toString()));
}
dip = false;
- /* process next in queue */
+ // process next in queue
if (dlQ.isEmpty()){
emit downloadQueueEmpty();
qxtLog->debug() << "Download manager ready. (2)";
@@ -188,7 +188,7 @@ void downloadManager::downloadFinished()
}
startNextDownload();
}
-/* ----------------------------------------------------------------------------------------
+/********************************************************************************************************
*
** dead code: Header filename fetching & renaming **
diff --git a/src/downloadManager.h b/src/downloadManager.h
index afd0da3..8e11313 100644
--- a/src/downloadManager.h
+++ b/src/downloadManager.h
@@ -35,36 +35,45 @@ public:
downloadManager();
private:
+ // checks for valid download directory, ran once in constructor
void checkDownloadDirectory();
+ // private control function for queueing mechanism.
void processDownloadRequest(QUrl& url);
+
+ // base objects for downloading
QNetworkAccessManager* qnam;
QQueue<QUrl> dlQ;
QNetworkReply* currentDownload;
QFile outfile;
QDir downloadDir;
- QString currentTargetFilename;
+ // download progress variables
QTime dltime;
int currentProgress, lastProgress;
-
+ // download in progress flag
bool dip;
+ // static counter
static int downloaded;
-
signals:
- void finished();
- void downloadInfo(QString filename, double filesize);
- void notify(QString msg);
- void updateProgress(int percent, double speed, QString unit);
+ // notify sends a message to the javascript interface.
+ void notify(const QString& msg);
+ // downloadInfo sends static information (name, size) to the interface.
+ void downloadInfo(const QString& filename, const double& filesize);
+ // updateProgress sends download progress information to the interface.
+ void updateProgress(const int& percent, const double& speed, const QString& unit);
+ // signal emitted when download queue is empty.
void downloadQueueEmpty();
public slots:
+ // public slots to receive download requests.
void downloadFile(QUrl& fileUrl);
void downloadFile(QString& fileUrl);
private slots:
+ // private slots to manage the downloading process
void startNextDownload();
- void downloadReady();
void processMetaInfo();
+ void downloadReady();
void downloadProgress(qint64 bytesIn, qint64 bytesTotal);
void downloadFinished();
};
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index b4c55aa..e43d36e 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -14,9 +14,9 @@ int updateInterval = DEFAULT_UPDATE_INTERVAL;
int debugMode = -1;
//-------------------------------------------------------------------------------------------
-fbgui::fbgui(){
-
- /* setup basic debug */
+fbgui::fbgui()
+{
+ // setup basic debug
qxtLog->disableLoggerEngine("DEFAULT");
qxtLog->enableLogLevels(QxtLogger::DebugLevel);
if (debugMode == 0){
@@ -26,44 +26,45 @@ fbgui::fbgui(){
qxtLog->debug() << "Initializing fbgui...";
}
- /* base of the gui */
+ // base of the gui
createActions();
checkHost();
_webView = new QWebView(this);
_webView->load(baseURL);
- /* debug console split or normal browser */
+ // debug console split or normal browser
if (debugMode == 1)
setupDebugSplit();
else
setCentralWidget(_webView);
- /* initialize javascript interface */
+ // initialize javascript interface
javascriptInterface* jsi = new javascriptInterface(_webView->page()->mainFrame());
QObject::connect(jsi, SIGNAL(quitFbgui()), this, SLOT(close()));
QObject::connect(_webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
jsi, SLOT(attachToDOM()));
- /* initialize download manager */
+ // initialize download manager
downloadManager* dm = new downloadManager();
- QObject::connect(dm, SIGNAL(downloadInfo(QString, double)),
- jsi, SLOT(downloadInfo(QString, double)));
+ QObject::connect(dm, SIGNAL(downloadInfo(const QString&, const double&)),
+ jsi, SLOT(downloadInfo(const QString&, const double&)));
QObject::connect(dm, SIGNAL(notify(QString)),
jsi, SLOT(notify(QString)));
QObject::connect(jsi, SIGNAL(requestFile(QString&)), dm, SLOT(downloadFile(QString&)));
- QObject::connect(dm, SIGNAL(updateProgress(int, double, QString)),
- jsi, SLOT(updateProgressBar(int, double, QString)));
+ QObject::connect(dm, SIGNAL(updateProgress(const int&, const double&, const QString&)),
+ jsi, SLOT(updateProgressBar(const int&, const double&, const QString&)));
QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(callbackOnDlQueueFinished()));
- /* set properties */
+ // set properties
setWindowTitle("fbgui");
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
showFullScreen();
}
//-------------------------------------------------------------------------------------------
-void fbgui::createActions(){
- /* CTRL + X to kill the gui */
+void fbgui::createActions()
+{
+ // CTRL + X to kill the gui
_quit = new QAction(tr("&quit"), this);
_quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
this->addAction(_quit);
@@ -71,7 +72,8 @@ void fbgui::createActions(){
}
//-------------------------------------------------------------------------------------------
-void fbgui::setupDebugSplit(){
+void fbgui::setupDebugSplit()
+{
_debugConsole = new QTextEdit(this);
_debugConsole->setWindowFlags(Qt::FramelessWindowHint);
QPalette pal;
@@ -79,15 +81,15 @@ void fbgui::setupDebugSplit(){
_debugConsole->setPalette(pal);
_debugConsole->setTextColor(Qt::cyan);
_debugConsole->insertPlainText("Debug console initialized.\n");
- /* enable custom logger engine */
+ // enable custom logger engine
qxtLog->addLoggerEngine("fb_logger", new loggerEngine_fb(_debugConsole));
qxtLog->initLoggerEngine("fb_logger");
qxtLog->setMinimumLevel("fb_logger", QxtLogger::DebugLevel);
- /* display browser and debug in a splitter */
+ // display browser and debug in a splitter
_splitter = new QSplitter(Qt::Vertical, this);
_splitter->addWidget(_webView);
_splitter->addWidget(_debugConsole);
- /* CTRL + D toggles debug window */
+ // CTRL + D toggles debug window
_toggleDebug = new QAction(tr("&toggleDebug"), this);
_toggleDebug->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
addAction(_toggleDebug);
@@ -95,14 +97,16 @@ void fbgui::setupDebugSplit(){
setCentralWidget(_splitter);
}
//-------------------------------------------------------------------------------------------
-void fbgui::toggleDebug(){
+void fbgui::toggleDebug()
+{
if (_debugConsole->isVisible())
_debugConsole->hide();
else
_debugConsole->show();
}
//-------------------------------------------------------------------------------------------
-void fbgui::checkHost() const{
+void fbgui::checkHost() const
+{
// TODO instead of closing app, show error page from qrc
QHostInfo hostInfo = QHostInfo::fromName(baseURL.host());
if (hostInfo.error() != QHostInfo::NoError){
diff --git a/src/fbgui.h b/src/fbgui.h
index ca5420d..2d06afe 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -23,14 +23,14 @@
#include <QxtCore>
-/* Internal default settings */
+// Internal default settings
#define DEFAULT_URL "http://www.google.com"
#define DEFAULT_DOWNLOAD_DIR "/tmp/fbgui/downloads"
#define DEFAULT_CONFIG_PATH "/etc/fbgui.conf"
#define DEFAULT_UPDATE_INTERVAL 1;
-/* global settings */
+// Global settings
extern QString binPath;
extern QString downloadPath;
extern QUrl baseURL;
@@ -45,21 +45,22 @@ public:
fbgui();
private:
- /* setup procedures */
+ // setup procedures
void setupDebugSplit();
void createActions();
void checkHost() const;
- /* widgets constituing the gui */
+ // widgets constituing the gui
QWebView* _webView;
QSplitter* _splitter;
QTextEdit* _debugConsole;
- /* action list */
+ // action list
QAction* _quit;
QAction* _toggleDebug;
private slots:
+ // slots for processing actions
void toggleDebug();
};
diff --git a/src/javascriptInterface.cpp b/src/javascriptInterface.cpp
index 1a9b470..c70347c 100644
--- a/src/javascriptInterface.cpp
+++ b/src/javascriptInterface.cpp
@@ -3,8 +3,7 @@
#include "sysInfo.h"
//-------------------------------------------------------------------------------------------------------
-javascriptInterface::javascriptInterface(QWebFrame *parent)
-{
+javascriptInterface::javascriptInterface(QWebFrame *parent){
qxtLog->debug() << "Initializing javascript interface...";
//TODO: check for better way to use evaluateJavaScript()
_parent = parent;
@@ -12,7 +11,7 @@ javascriptInterface::javascriptInterface(QWebFrame *parent)
//-------------------------------------------------------------------------------------------------------
javascriptInterface::~javascriptInterface() {}
//-------------------------------------------------------------------------------------------------------
-QString javascriptInterface::getSysInfo(QString info){
+QString javascriptInterface::getSysInfo(const QString& info){
sysInfo si;
return si.getInfo(info);
}
@@ -22,7 +21,7 @@ void javascriptInterface::attachToDOM(){
}
//-------------------------------------------------------------------------------------------------------
void javascriptInterface::startDownload(QString filename){
- /* ignore if empty filename */
+ // ignore if empty filename
if (filename.isEmpty()){
_parent->evaluateJavaScript("alert(\"No filename!\")");
return;
@@ -30,19 +29,18 @@ void javascriptInterface::startDownload(QString filename){
emit requestFile(filename);
}
//-------------------------------------------------------------------------------------------------------
-void javascriptInterface::downloadInfo(QString filename, double filesize){
+void javascriptInterface::downloadInfo(const QString& filename, const double& filesize){
QString code = QString("downloadInfo('\%1', \%2)").arg(filename).arg(filesize);
_parent->evaluateJavaScript(code);
}
//-------------------------------------------------------------------------------------------------------
-void javascriptInterface::notify(QString msg){
+void javascriptInterface::notify(const QString& msg){
QString code = QString("notify('\%1')").arg(msg);
_parent->evaluateJavaScript(code);
- return;
}
//-------------------------------------------------------------------------------------------------------
-void javascriptInterface::updateProgressBar(int percent, double speed, QString unit){
+void javascriptInterface::updateProgressBar(const int& percent, const double& speed, const QString& unit){
if (percent == 0) return;
QString code = QString("updateProgress(\%1, \%2, '\%3')").arg(percent).arg(speed).arg(unit);
_parent->evaluateJavaScript(code);
diff --git a/src/javascriptInterface.h b/src/javascriptInterface.h
index 5c6f1cf..a139780 100644
--- a/src/javascriptInterface.h
+++ b/src/javascriptInterface.h
@@ -20,7 +20,8 @@
#include "fbgui.h"
-class javascriptInterface : public QObject{
+class javascriptInterface : public QObject
+{
Q_OBJECT
private:
QWebFrame* _parent;
@@ -39,11 +40,11 @@ public slots:
void startDownload(QString filename);
void setCallbackOnDlQueueFinished(QString fctOnDownloadsFinished);
void callbackOnDlQueueFinished();
- void updateProgressBar(int percent, double speed, QString unit);
- void downloadInfo(QString filename, double filesize);
- void notify(QString msg);
- QString getSysInfo(QString info);
+ void updateProgressBar(const int& percent, const double& speed, const QString& unit);
+ void downloadInfo(const QString& filename, const double& filesize);
+ void notify(const QString& msg);
+ QString getSysInfo(const QString& info);
void quit();
};
-#endif /* JAVASCRIPTINTERFACE_H_ */
+#endif // JAVASCRIPTINTERFACE_H_
diff --git a/src/loggerEngine.cpp b/src/loggerEngine.cpp
index 004c268..9121af5 100644
--- a/src/loggerEngine.cpp
+++ b/src/loggerEngine.cpp
@@ -1,8 +1,8 @@
#include "loggerEngine.h"
-/*****************************************************************************************************
- Custom Logger Engine for debugging on framebuffer
-*****************************************************************************************************/
+// --------------------------------------------------------------------------------------------------
+// Custom Logger Engine for debugging on framebuffer
+//---------------------------------------------------------------------------------------------------
loggerEngine_fb::loggerEngine_fb(QTextEdit *parent) : QxtLoggerEngine(){
// TODO: silly parent storing ... to change!
_debugConsole = parent;
@@ -28,8 +28,7 @@ bool loggerEngine_fb::isInitialized() const{
}
void loggerEngine_fb::writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> & msgs){
- /* TODO: handle different log levels */
- /* write the messages to the debug console */
+ // TODO: handle different log levels
if (msgs.isEmpty()) return;
Q_FOREACH(const QVariant& out, msgs)
{
@@ -37,14 +36,14 @@ void loggerEngine_fb::writeFormatted(QxtLogger::LogLevel level, const QList<QVar
_debugConsole->insertPlainText(out.toString());
}
_debugConsole->insertPlainText(QString("\n"));
- /* move to end of the document */
+ // autoscroll
QTextCursor c = _debugConsole->textCursor();
c.movePosition(QTextCursor::End);
_debugConsole->setTextCursor(c);
}
-/*****************************************************************************************************
- Modified QxtBasicSTDLoggerEngine
-*****************************************************************************************************/
+//---------------------------------------------------------------------------------------------------
+// Modified QxtBasicSTDLoggerEngine
+//---------------------------------------------------------------------------------------------------
loggerEngine_std::loggerEngine_std() : QxtBasicSTDLoggerEngine(){}
loggerEngine_std::~loggerEngine_std(){}
@@ -63,15 +62,6 @@ void loggerEngine_std::writeToStdErr(const QString& str_level, const QList<QVari
*errstream << endl;
}
void loggerEngine_std::writeToStdOut(const QString& level, const QList<QVariant> & msgs){
- if (msgs.isEmpty()) return;
- QString header = '[' + QTime::currentTime().toString("hh:mm:ss.zzz") + "] [" + level + "] ";
- QTextStream* outstream = stdOutStream();
- Q_ASSERT(outstream);
- *outstream << header;
- Q_FOREACH(const QVariant& out, msgs){
- if (!out.isNull()){
- *outstream << out.toString();
- }
- }
- *outstream << endl;
+ // reimplementing this is needed for compiling,
+ // we only need write to std::err, so this function is not needed
}
diff --git a/src/loggerEngine.h b/src/loggerEngine.h
index 7b75112..be1ac87 100644
--- a/src/loggerEngine.h
+++ b/src/loggerEngine.h
@@ -20,7 +20,9 @@
#include <QxtCore>
#include <QTime>
#include <QTextEdit>
-
+//---------------------------------------------------------------------------------------------------
+// custom engine feeding the debug console widget
+//---------------------------------------------------------------------------------------------------
class loggerEngine_fb : public QxtLoggerEngine {
public:
loggerEngine_fb(QTextEdit* parent);
@@ -28,20 +30,24 @@ public:
QTextEdit *_debugConsole;
bool _initialized;
+ // reimplemented virtual functions of QxtLoggerEngine
void initLoggerEngine();
void killLoggerEngine();
void writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> & messages);
-
void setLogLevelEnabled(QxtLogger::LogLevels level, bool enable = true);
bool isInitialized() const;
+
};
-/*********************************************************************************************/
+//---------------------------------------------------------------------------------------------------
+// minor changes to QxtBasicSTDLoggerEngine
+//---------------------------------------------------------------------------------------------------
class loggerEngine_std : public QxtBasicSTDLoggerEngine {
public:
loggerEngine_std();
~loggerEngine_std();
+ // reimplemented virtual functions of QxtBasicSTDLoggerEngineqqq
void writeToStdOut(const QString& level, const QList<QVariant> &msgs);
void writeToStdErr(const QString& str_level, const QList<QVariant> &msgs);
};
-#endif /* LOGGERENGINE_H_ */
+#endif // LOGGERENGINE_H_
diff --git a/src/main.cpp b/src/main.cpp
index f415206..c5269a7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,14 +25,13 @@ int main(int argc, char *argv[])
QApplication app(argc, argv, QApplication::GuiServer);
app.setOrganizationName("team_projekt_2011");
app.setApplicationName("prebootGUI");
- app.setObjectName("test");
binPath = QApplication::applicationDirPath();
QTranslator translator;
translator.load(":" + QLocale::system().name());
app.installTranslator(&translator);
- /* parse command line arguments */
+ // parse command line arguments
QMap<QString, QString> clOpts;
int longIndex = 0;
static const char *optString = "u:d:c:D:h";
@@ -75,7 +74,7 @@ int main(int argc, char *argv[])
else
debugMode = -1;
- /* look for config file */
+ // look for config file
QString configFilePath;
QFileInfo confInfo;
if (clOpts.contains("configFile"))
@@ -93,7 +92,7 @@ int main(int argc, char *argv[])
}
}
- /* read the config file */
+ // read the config file
QSettings confFileSettings(configFilePath, QSettings::IniFormat);
confFileSettings.setIniCodec("UTF-8");
@@ -107,7 +106,7 @@ int main(int argc, char *argv[])
baseURL = DEFAULT_URL;
}
- /* setting directory for downloads*/
+ // setting directory for downloads
if (clOpts.contains("downloadDir")){
downloadPath = clOpts.value("downloadDir");
}
diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp
index 81e39f8..ff114e8 100644
--- a/src/sysInfo.cpp
+++ b/src/sysInfo.cpp
@@ -7,7 +7,7 @@ sysInfo::sysInfo(){
// ------------------------------------------------------------------------------------------------
sysInfo::~sysInfo(){}
// ------------------------------------------------------------------------------------------------
-QString sysInfo::getInfo(QString& infoName){
+QString sysInfo::getInfo(const QString& infoName){
qxtLog->debug() << "[sysInfo] requested " << infoName;
if (infoName == QString("mac"))
return getMACAddress();
@@ -22,7 +22,7 @@ QString sysInfo::getInfo(QString& infoName){
}
// ------------------------------------------------------------------------------------------------
QString sysInfo::getMACAddress(){
- /* Returns MAC address of eth0 for now. */
+ // Returns MAC address of eth0 for now
QNetworkInterface qni = QNetworkInterface::interfaceFromName(QString("eth0"));
if (!qni.isValid()){
qxtLog->debug() << "No interface matching \"eth0\" found.";
diff --git a/src/sysInfo.h b/src/sysInfo.h
index 49a37b8..4e6988e 100644
--- a/src/sysInfo.h
+++ b/src/sysInfo.h
@@ -22,15 +22,15 @@
#include <qjson/serializer.h>
class sysInfo {
- public:
- sysInfo();
+public:
+ sysInfo();
~sysInfo();
- QString getInfo(QString& infoName);
+ // public access. infoName
+ QString getInfo(const QString& infoName);
- private:
+private:
QJson::Serializer serializer;
-
QByteArray getNames();
QString getMACAddress();
QString getIPAddress();
diff --git a/src/testApp.sh b/src/testApp.sh
index 890122d..61f7c2d 100755
--- a/src/testApp.sh
+++ b/src/testApp.sh
@@ -11,7 +11,7 @@ script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
working_path=`dirname "$script_path"`
display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}')
# Start QT's virtual framebuffer with proper displayID
-/usr/local/Trolltech/Qt-4.7.2/bin/qvfb -width 800 -height 600 -qwsdisplay :$display_id &
+/usr/local/Trolltech/Qt-4.7.1/bin/qvfb -width 1024 -height 768 -qwsdisplay :$display_id &
sleep 0.1
# Start fbgui.
$working_path/fbgui -display QVFb:$display_id $@