Lock and setting json about
This commit is contained in:
59
src/main.cpp
59
src/main.cpp
@@ -10,7 +10,10 @@
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include "log/UserOperationLog.h"
|
||||
|
||||
#include <QTranslator>
|
||||
#include "json/jsonobject.h"
|
||||
#include "locker.h"
|
||||
#include "languageswitcher.h"
|
||||
QString loadFontFromFile(QString path)
|
||||
{
|
||||
static QString font;
|
||||
@@ -57,32 +60,42 @@ int main(int argc, char* argv[])
|
||||
SQLHelper::Open();
|
||||
MainWindow w;
|
||||
UserOperationLog::Default()->init();
|
||||
QObject::connect(obj, SIGNAL(touchScreen()), &w, SLOT(refreshTimer()));
|
||||
|
||||
Locker::Instance()->start();
|
||||
QObject::connect(obj, SIGNAL(touchScreen()), Locker::Instance(), SLOT(refreshTimer()));
|
||||
|
||||
|
||||
//multi-language suppport
|
||||
QTranslator translator;
|
||||
LanguageSwitcher::Instance()->setTranslator(&translator);
|
||||
LanguageSwitcher::Instance()->setDefaultLanguage(JsonObject::Instance()->defaultLanguage());
|
||||
a.installTranslator(&translator);
|
||||
|
||||
|
||||
QStringList app_args = a.arguments();
|
||||
if (app_args.contains("-d"))
|
||||
{
|
||||
w.debugConsoleOn();
|
||||
qInstallMessageHandler(MainWindow::QMessageOutput);
|
||||
QThread thread;
|
||||
StdOutRedirector redir;
|
||||
redir.setOutputTF(w.getEdit());
|
||||
QTimer Timer;
|
||||
redir.moveToThread(&thread);
|
||||
QObject::connect(&Timer, SIGNAL(timeout()), &redir, SLOT(readOutsToTF()));
|
||||
fflush(stdout);
|
||||
Timer.start(1000);
|
||||
thread.start();
|
||||
w.showFullScreen();
|
||||
w.requestLogin();
|
||||
int ret = a.exec();
|
||||
thread.terminate();
|
||||
return ret;
|
||||
} else{
|
||||
w.showFullScreen();
|
||||
w.requestLogin();
|
||||
return a.exec();
|
||||
{
|
||||
w.debugConsoleOn();
|
||||
qInstallMessageHandler(MainWindow::QMessageOutput);
|
||||
QThread thread;
|
||||
StdOutRedirector redir;
|
||||
redir.setOutputTF(w.getEdit());
|
||||
QTimer Timer;
|
||||
redir.moveToThread(&thread);
|
||||
QObject::connect(&Timer, SIGNAL(timeout()), &redir, SLOT(readOutsToTF()));
|
||||
fflush(stdout);
|
||||
Timer.start(1000);
|
||||
thread.start();
|
||||
w.showFullScreen();
|
||||
w.requestLogin();
|
||||
int ret = a.exec();
|
||||
thread.terminate();
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
w.showFullScreen();
|
||||
w.requestLogin();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user