Merge change ,debug window, logout
This commit is contained in:
45
src/main.cpp
45
src/main.cpp
@@ -6,6 +6,10 @@
|
||||
#include <src/db/SQLHelper.h>
|
||||
#include <QTextCodec>
|
||||
#include <QFontDatabase>
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
QString loadFontFromFile(QString path)
|
||||
{
|
||||
static QString font;
|
||||
@@ -49,22 +53,31 @@ int main(int argc, char* argv[])
|
||||
//a.installEventFilter(obj);
|
||||
InputObject* obj = new InputObject();
|
||||
a.installEventFilter(obj);
|
||||
SQLHelper::Open();
|
||||
MainWindow w;
|
||||
w.showFullScreen();
|
||||
SQLHelper::Open();
|
||||
MainWindow w;
|
||||
|
||||
|
||||
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();
|
||||
return a.exec();
|
||||
} else{
|
||||
w.showFullScreen();
|
||||
w.requestLogin();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
LoginWindow l;
|
||||
needLogin:
|
||||
l.showFullScreen();
|
||||
int rec = l.exec();
|
||||
if (rec != QDialog::Accepted) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// l.deleteLater();
|
||||
w.centerWidgetShow();
|
||||
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user