Fix bug, about application collapse by
db can't connect
This commit is contained in:
43
src/main.cpp
43
src/main.cpp
@@ -18,6 +18,7 @@
|
||||
#include "src/utilities/LanguageSwitcher.h"
|
||||
#include "utilities/TouchScreenSignalSender.h"
|
||||
#include "keyboard/KeyboardManager.h"
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
|
||||
QString loadFontFromFile(QString path)
|
||||
{
|
||||
@@ -74,14 +75,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
a.setStyleSheet(QLatin1String(file.readAll()));
|
||||
}
|
||||
|
||||
|
||||
bool sqlConnected= SQLHelper::Open();
|
||||
if (!sqlConnected)
|
||||
{
|
||||
//TODO: 数据库连接失败错误
|
||||
exit(-99);
|
||||
}
|
||||
AppGlobalValues::setDBconnected(false);
|
||||
MainWindow w;
|
||||
DialogManager::Default()->init(&w);
|
||||
UserOperationLog::Default()->init();
|
||||
@@ -98,37 +92,10 @@ int main(int argc, char* argv[])
|
||||
KeyboardManager::getInstance();
|
||||
UserOperationLog::cleanHistoryLog();
|
||||
|
||||
if (app_args.contains("-d"))
|
||||
//if (true)
|
||||
{
|
||||
w.showFullScreen();
|
||||
DeviceManager::Default()->initDevice();
|
||||
|
||||
w.debugConsoleOn();
|
||||
w.showFullScreen();
|
||||
|
||||
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();
|
||||
|
||||
DeviceManager::Default()->initDevice();
|
||||
|
||||
ret = a.exec();
|
||||
thread.terminate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
w.showFullScreen();
|
||||
DeviceManager::Default()->initDevice();
|
||||
|
||||
ret = a.exec();
|
||||
}
|
||||
ret = a.exec();
|
||||
DeviceManager::Default()->close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user