|
|
|
@ -32,6 +32,7 @@
@@ -32,6 +32,7 @@
|
|
|
|
|
#include <QCommandLineParser> |
|
|
|
|
#include <QDateTime> |
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QDir> |
|
|
|
|
#include <QFile> |
|
|
|
|
#include <QFontDatabase> |
|
|
|
|
#include <QMutexLocker> |
|
|
|
@ -127,8 +128,28 @@ int main(int argc, char *argv[])
@@ -127,8 +128,28 @@ int main(int argc, char *argv[])
|
|
|
|
|
sodium_init(); // For the auto-updater
|
|
|
|
|
|
|
|
|
|
#ifdef LOG_TO_FILE |
|
|
|
|
QString logFileDir = Settings::getInstance().getSettingsDirPath(); |
|
|
|
|
logFileStream.reset(new QTextStream); |
|
|
|
|
logFileFile.reset(new QFile(Settings::getInstance().getSettingsDirPath()+"qtox.log")); |
|
|
|
|
logFileFile.reset(new QFile(logFileDir + "qtox.log")); |
|
|
|
|
|
|
|
|
|
// Trim log file if over 1MB
|
|
|
|
|
if (logFileFile->size() > 1000000) { |
|
|
|
|
qDebug() << "Log file over 1MB, rotating..."; |
|
|
|
|
|
|
|
|
|
QDir dir (logFileDir); |
|
|
|
|
|
|
|
|
|
// Check if log.1 already exists, and if so, delete it
|
|
|
|
|
if (dir.remove(logFileDir + "qtox.log.1")) |
|
|
|
|
qDebug() << "Removed log successfully"; |
|
|
|
|
else |
|
|
|
|
qDebug() << "Unable to remove old log file"; |
|
|
|
|
|
|
|
|
|
dir.rename(logFileDir + "qtox.log", logFileDir + "qtox.log.1"); |
|
|
|
|
|
|
|
|
|
// Return to original log file path
|
|
|
|
|
logFileFile->setFileName(logFileDir + "qtox.log"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (logFileFile->open(QIODevice::Append)) |
|
|
|
|
{ |
|
|
|
|
logFileStream->setDevice(logFileFile.get()); |
|
|
|
@ -247,6 +268,6 @@ int main(int argc, char *argv[])
@@ -247,6 +268,6 @@ int main(int argc, char *argv[])
|
|
|
|
|
Nexus::destroyInstance(); |
|
|
|
|
CameraSource::destroyInstance(); |
|
|
|
|
Settings::destroyInstance(); |
|
|
|
|
qDebug() << "Clean exit with status"<<errorcode; |
|
|
|
|
qDebug() << "Clean exit with status" << errorcode; |
|
|
|
|
return errorcode; |
|
|
|
|
} |
|
|
|
|