Lock and setting json about
This commit is contained in:
@@ -5,30 +5,40 @@ set(CMAKE_CXX_STANDARD 11)
|
|||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -pthread")
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -pthread")
|
||||||
|
|
||||||
file(GLOB_RECURSE project_headers ./src/*.h)
|
file(GLOB_RECURSE project_headers ./src/*.h)
|
||||||
file(GLOB_RECURSE project_cpps ./src/*.cpp)
|
file(GLOB_RECURSE project_cpps ./src/*.cpp)
|
||||||
file(GLOB_RECURSE project_cxx ./src/*.cxx)
|
file(GLOB_RECURSE project_cxx ./src/*.cxx)
|
||||||
file(GLOB_RECURSE project_cc ./src/*.cc)
|
file(GLOB_RECURSE project_cc ./src/*.cc)
|
||||||
set(USE_SHIMLIB ON)
|
|
||||||
|
set(USE_SHIMLIB OFF)
|
||||||
if(UNIX AND USE_SHIMLIB)
|
if(UNIX AND USE_SHIMLIB)
|
||||||
file(GLOB_RECURSE project_c ./src/json/*.c)
|
file(GLOB_RECURSE project_c ./src/json/*.c)
|
||||||
else()
|
else()
|
||||||
file(GLOB_RECURSE project_c ./src/*.c)
|
file(GLOB_RECURSE project_c ./src/*.c)
|
||||||
endif()
|
endif()
|
||||||
include_directories(./src/)
|
include_directories(./src/)
|
||||||
|
|
||||||
|
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_headers})
|
||||||
|
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_cpps})
|
||||||
|
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_cxx})
|
||||||
|
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_cc})
|
||||||
|
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_c})
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL Sql VirtualKeyboard REQUIRED)
|
find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL Sql VirtualKeyboard REQUIRED)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
file(GLOB project_uis ./src/*.ui)
|
file(GLOB project_uis ./src/*.ui)
|
||||||
qt5_wrap_ui(ui_FILES ${project_uis})
|
qt5_wrap_ui(ui_FILES ${project_uis})
|
||||||
file(GLOB project_res ./src/*.qrc)
|
file(GLOB project_res ./src/*.qrc)
|
||||||
add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES})
|
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES} )
|
||||||
if(UNIX AND USE_SHIMLIB)
|
if(UNIX AND USE_SHIMLIB)
|
||||||
link_directories(/usr/local/lib64)
|
link_directories(/usr/local/lib64)
|
||||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard pthread usct_shim dmapi log4c cunit ctomat hdf5 matio m)
|
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard pthread usct_shim dmapi log4c cunit ctomat hdf5 matio m)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard)
|
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ bool InputObject::eventFilter(QObject* obj, QEvent* event)
|
|||||||
if (event->type() == QEvent::MouseButtonPress)
|
if (event->type() == QEvent::MouseButtonPress)
|
||||||
{
|
{
|
||||||
emit touchScreen();
|
emit touchScreen();
|
||||||
|
|
||||||
qDebug() << "touchScreen()";
|
qDebug() << "touchScreen()";
|
||||||
}
|
}
|
||||||
//mouse button release means setfocus is useless
|
//mouse button release means setfocus is useless
|
||||||
@@ -165,17 +166,26 @@ void InputObject::ShowPanel() {
|
|||||||
|
|
||||||
this->showFullScreen();
|
this->showFullScreen();
|
||||||
this->setVisible(true);
|
this->setVisible(true);
|
||||||
|
const DWORD currentThread = GetCurrentThreadId();
|
||||||
|
qDebug() << "currentThread" << currentThread;
|
||||||
|
|
||||||
this->activateWindow(); //it is quite important!!!
|
this->activateWindow(); //it is quite important!!!
|
||||||
|
while (QApplication::activeWindow() != this)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
}
|
||||||
|
|
||||||
if (curLine) {
|
if (curLine) {
|
||||||
ui->lineEdit->setText(curLine->text());
|
ui->lineEdit->setText(curLine->text());
|
||||||
ui->lineEdit->setEchoMode(curLine->echoMode());
|
ui->lineEdit->setEchoMode(curLine->echoMode());
|
||||||
ui->lineEdit->setInputMethodHints(Qt::InputMethodHint::ImhNoAutoUppercase);
|
ui->lineEdit->setInputMethodHints(Qt::InputMethodHint::ImhNoAutoUppercase);
|
||||||
|
//ui->lineEdit->setFocus(Qt::MouseFocusReason);
|
||||||
ui->lineEdit->setFocus();
|
ui->lineEdit->setFocus();
|
||||||
while (QGuiApplication::focusObject() != ui->lineEdit)
|
|
||||||
{
|
//while (QGuiApplication::focusObject() != ui->lineEdit)
|
||||||
qApp->processEvents();
|
//{
|
||||||
}
|
// qApp->processEvents();
|
||||||
|
//}
|
||||||
|
|
||||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||||
QApplication::sendEvent(ui->lineEdit, &event);
|
QApplication::sendEvent(ui->lineEdit, &event);
|
||||||
|
|||||||
106
src/generalform.cpp
Normal file
106
src/generalform.cpp
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#include "generalform.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QEvent>
|
||||||
|
#include "json/jsonobject.h"
|
||||||
|
#include "SelectDialog.h"
|
||||||
|
|
||||||
|
#include "locker.h"
|
||||||
|
#include "languageswitcher.h"
|
||||||
|
|
||||||
|
GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
layout = new QVBoxLayout(this);
|
||||||
|
QWidget* lanHeader = new QWidget(this);
|
||||||
|
layout->addWidget(lanHeader);
|
||||||
|
|
||||||
|
QHBoxLayout* lanHeaderLayout = new QHBoxLayout(lanHeader);
|
||||||
|
lanHeaderLayout->addWidget(new QLabel(tr("Language")));
|
||||||
|
QPushButton* btnLan = new QPushButton(lanHeader);
|
||||||
|
lanHeaderLayout->addWidget(btnLan);
|
||||||
|
lanHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||||
|
|
||||||
|
QWidget* instHeader = new QWidget(this);
|
||||||
|
layout->addWidget(instHeader);
|
||||||
|
QHBoxLayout* instHeaderLayout = new QHBoxLayout(instHeader);
|
||||||
|
instHeaderLayout->addWidget(new QLabel(tr("Institution Name")));
|
||||||
|
QLineEdit* instName = new QLineEdit(instHeader);
|
||||||
|
instName->setMaximumSize(QSize(300, 32768));
|
||||||
|
instHeaderLayout->addWidget(instName);
|
||||||
|
instHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed));
|
||||||
|
instHeaderLayout->addWidget(new QLabel(tr("Institution Addr")));
|
||||||
|
QLineEdit* instAddr = new QLineEdit(instHeader);
|
||||||
|
instHeaderLayout->addWidget(instAddr);
|
||||||
|
instAddr->setMaximumSize(QSize(300, 32768));
|
||||||
|
instHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||||
|
|
||||||
|
QWidget* lockHeader = new QWidget(this);
|
||||||
|
layout->addWidget(lockHeader);
|
||||||
|
QHBoxLayout* lockHeaderLayout = new QHBoxLayout(lockHeader);
|
||||||
|
lockHeaderLayout->addWidget(new QLabel(tr("Lock Screen Timeout")));
|
||||||
|
QLineEdit* lockTime = new QLineEdit(lockHeader);
|
||||||
|
lockTime->setMaximumSize(QSize(300, 32768));
|
||||||
|
lockHeaderLayout->addWidget(lockTime);
|
||||||
|
lockHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||||
|
|
||||||
|
//...
|
||||||
|
layout->addSpacerItem(new QSpacerItem(20, 300, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||||
|
|
||||||
|
//init
|
||||||
|
btnLan->setText(JsonObject::Instance()->defaultLanguage());
|
||||||
|
instName->setText(JsonObject::Instance()->institutionName());
|
||||||
|
instAddr->setText(JsonObject::Instance()->institutionAddr());
|
||||||
|
lockTime->setText(JsonObject::Instance()->lockScreenTimeout());
|
||||||
|
|
||||||
|
//connection
|
||||||
|
connect(instName, &QLineEdit::textChanged, [=](QString str)
|
||||||
|
{
|
||||||
|
JsonObject::Instance()->setInstitutionName(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(instAddr, &QLineEdit::textChanged, [=](QString str)
|
||||||
|
{
|
||||||
|
JsonObject::Instance()->setInstitutionAddr(str);
|
||||||
|
});
|
||||||
|
connect(lockTime, &QLineEdit::textChanged, [=](QString str)
|
||||||
|
{
|
||||||
|
//take effect
|
||||||
|
JsonObject::Instance()->setLockScreenTimeout(str);
|
||||||
|
Locker::Instance()->setTimer(JsonObject::Instance()->lockerCount());
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(btnLan, &QPushButton::clicked, [=]() {
|
||||||
|
if (!dialog) {
|
||||||
|
dialog = new SelectDialog(this);
|
||||||
|
dialog->setWindowModality(Qt::WindowModal);
|
||||||
|
}
|
||||||
|
dialog->setAvailableDates(JsonObject::Instance()->language());
|
||||||
|
dialog->setSelectedValue(JsonObject::Instance()->defaultLanguage());
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
QString lan = dialog->getSelectedValue();
|
||||||
|
|
||||||
|
//take effect
|
||||||
|
JsonObject::Instance()->setDefaultLanguage(lan);
|
||||||
|
LanguageSwitcher::Instance()->setDefaultLanguage(lan);
|
||||||
|
|
||||||
|
btnLan->setText(JsonObject::Instance()->defaultLanguage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralForm::changeEvent(QEvent* event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
qDebug() << "change language";
|
||||||
|
|
||||||
|
}
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
26
src/generalform.h
Normal file
26
src/generalform.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef GENERALFORM_H
|
||||||
|
#define GENERALFORM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
class QPushButton;
|
||||||
|
class QVBoxLayout;
|
||||||
|
class SelectDialog;
|
||||||
|
|
||||||
|
class GeneralForm : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit GeneralForm(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
protected:
|
||||||
|
void changeEvent(QEvent* event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVBoxLayout* layout = nullptr;
|
||||||
|
SelectDialog* dialog = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GENERALFORM_H
|
||||||
52
src/locker.cpp
Normal file
52
src/locker.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#include "locker.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include "appvals/AppGlobalValues.h"
|
||||||
|
#include <src/event/EventCenter.h>
|
||||||
|
#include "json/jsonobject.h"
|
||||||
|
Locker* Locker::locker = Q_NULLPTR;
|
||||||
|
|
||||||
|
Locker* Locker::Instance()
|
||||||
|
{
|
||||||
|
if (locker == Q_NULLPTR)
|
||||||
|
{
|
||||||
|
locker = new Locker();
|
||||||
|
}
|
||||||
|
return locker;
|
||||||
|
}
|
||||||
|
Locker::Locker()
|
||||||
|
{
|
||||||
|
counter = JsonObject::Instance()->lockerCount();
|
||||||
|
screenTimer = new QTimer(this);
|
||||||
|
connect(screenTimer, SIGNAL(timeout()), this, SLOT(coverScreen()));
|
||||||
|
}
|
||||||
|
Locker::~Locker() {}
|
||||||
|
|
||||||
|
void Locker::start()
|
||||||
|
{
|
||||||
|
screenTimer->start(counter);
|
||||||
|
}
|
||||||
|
void Locker::coverScreen()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (AppGlobalValues::InProcessing().toBool()) {
|
||||||
|
refreshTimer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screenTimer->stop();
|
||||||
|
EventCenter::Default()->triggerEvent(GUIEvents::RequestLogin, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Locker::setTimer(int interval)
|
||||||
|
{
|
||||||
|
this->counter = interval;
|
||||||
|
screenTimer->stop();
|
||||||
|
screenTimer->start(this->counter);
|
||||||
|
|
||||||
|
}
|
||||||
|
void Locker::refreshTimer()
|
||||||
|
{
|
||||||
|
screenTimer->stop();
|
||||||
|
screenTimer->start(counter);
|
||||||
|
}
|
||||||
28
src/locker.h
Normal file
28
src/locker.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef LOCKER_H
|
||||||
|
#define LOCKER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class QTimer;
|
||||||
|
class Locker : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static Locker* Instance();
|
||||||
|
void start();
|
||||||
|
void setTimer(int interval);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void refreshTimer();
|
||||||
|
void coverScreen();
|
||||||
|
private:
|
||||||
|
Locker();
|
||||||
|
~Locker();
|
||||||
|
|
||||||
|
QTimer* screenTimer = nullptr;
|
||||||
|
int counter = 30000;
|
||||||
|
|
||||||
|
static Locker* locker;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOCKER_H
|
||||||
59
src/main.cpp
59
src/main.cpp
@@ -10,7 +10,10 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "log/UserOperationLog.h"
|
#include "log/UserOperationLog.h"
|
||||||
|
#include <QTranslator>
|
||||||
|
#include "json/jsonobject.h"
|
||||||
|
#include "locker.h"
|
||||||
|
#include "languageswitcher.h"
|
||||||
QString loadFontFromFile(QString path)
|
QString loadFontFromFile(QString path)
|
||||||
{
|
{
|
||||||
static QString font;
|
static QString font;
|
||||||
@@ -57,32 +60,42 @@ int main(int argc, char* argv[])
|
|||||||
SQLHelper::Open();
|
SQLHelper::Open();
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
UserOperationLog::Default()->init();
|
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();
|
QStringList app_args = a.arguments();
|
||||||
if (app_args.contains("-d"))
|
if (app_args.contains("-d"))
|
||||||
{
|
{
|
||||||
w.debugConsoleOn();
|
w.debugConsoleOn();
|
||||||
qInstallMessageHandler(MainWindow::QMessageOutput);
|
qInstallMessageHandler(MainWindow::QMessageOutput);
|
||||||
QThread thread;
|
QThread thread;
|
||||||
StdOutRedirector redir;
|
StdOutRedirector redir;
|
||||||
redir.setOutputTF(w.getEdit());
|
redir.setOutputTF(w.getEdit());
|
||||||
QTimer Timer;
|
QTimer Timer;
|
||||||
redir.moveToThread(&thread);
|
redir.moveToThread(&thread);
|
||||||
QObject::connect(&Timer, SIGNAL(timeout()), &redir, SLOT(readOutsToTF()));
|
QObject::connect(&Timer, SIGNAL(timeout()), &redir, SLOT(readOutsToTF()));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
Timer.start(1000);
|
Timer.start(1000);
|
||||||
thread.start();
|
thread.start();
|
||||||
w.showFullScreen();
|
w.showFullScreen();
|
||||||
w.requestLogin();
|
w.requestLogin();
|
||||||
int ret = a.exec();
|
int ret = a.exec();
|
||||||
thread.terminate();
|
thread.terminate();
|
||||||
return ret;
|
return ret;
|
||||||
} else{
|
}
|
||||||
w.showFullScreen();
|
else {
|
||||||
w.requestLogin();
|
w.showFullScreen();
|
||||||
return a.exec();
|
w.requestLogin();
|
||||||
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include <qtabwidget.h>
|
#include <qtabwidget.h>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
@@ -15,6 +15,10 @@
|
|||||||
#include "models/User.h"
|
#include "models/User.h"
|
||||||
#include "AdminSettingForm.h"
|
#include "AdminSettingForm.h"
|
||||||
#include "appvals/AppGlobalValues.h"
|
#include "appvals/AppGlobalValues.h"
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::QMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
void MainWindow::QMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||||
@@ -206,9 +210,12 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
}
|
}
|
||||||
msgDialog->hideExitButton();
|
msgDialog->hideExitButton();
|
||||||
msgDialog->startLoading();
|
msgDialog->startLoading();
|
||||||
|
AppGlobalValues::setInProcessing(true);
|
||||||
// msgDialog->showFullScreen();
|
// msgDialog->showFullScreen();
|
||||||
if (msgDialog->isHidden())msgDialog->show();
|
if (msgDialog->isHidden()){
|
||||||
});
|
msgDialog->show();
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationProgress, [=](QObject*, QObject* msg) {
|
connect(EventCenter::Default(), &EventCenter::InvokeOperationProgress, [=](QObject*, QObject* msg) {
|
||||||
if (!msgDialog) msgDialog = new GUIMessageDialog(this);
|
if (!msgDialog) msgDialog = new GUIMessageDialog(this);
|
||||||
if (msg)
|
if (msg)
|
||||||
@@ -227,15 +234,9 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
if (!msgDialog->isHidden())msgDialog->accept();
|
if (!msgDialog->isHidden())msgDialog->accept();
|
||||||
delete msgDialog;
|
delete msgDialog;
|
||||||
msgDialog = nullptr;
|
msgDialog = nullptr;
|
||||||
});
|
AppGlobalValues::setInProcessing(false);
|
||||||
connect(EventCenter::Default(), &EventCenter::RequestLogin, [=](QObject*, QObject* msg) {
|
|
||||||
this->requestLogin();
|
|
||||||
});
|
});
|
||||||
DeviceManager::Default()->initDevice();
|
|
||||||
centerWidgetHide();
|
centerWidgetHide();
|
||||||
screenTimer = new QTimer(this);
|
|
||||||
connect(screenTimer, SIGNAL(timeout()), this, SLOT(coverScreen()));
|
|
||||||
screenTimer->start(counter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@@ -243,26 +244,16 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
delete ui;
|
||||||
delete redir;
|
delete redir;
|
||||||
}
|
}
|
||||||
|
void MainWindow::changeEvent(QEvent* event)
|
||||||
void MainWindow::coverScreen()
|
|
||||||
{
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
if (AppGlobalValues::InProcessing().toBool()) {
|
|
||||||
refreshTimer();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
screenTimer->stop();
|
ui->retranslateUi(this);
|
||||||
requestLogin();
|
|
||||||
qDebug() << "coverScreen()";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget::changeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshTimer()
|
|
||||||
{
|
|
||||||
screenTimer->stop();
|
|
||||||
screenTimer->start(counter);
|
|
||||||
}
|
|
||||||
void MainWindow::centerWidgetHide() {
|
void MainWindow::centerWidgetHide() {
|
||||||
ui->centralWidget->setVisible(false);
|
ui->centralWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,15 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "StdOutRedirector.h"
|
#include "StdOutRedirector.h"
|
||||||
|
#include "json/cJSON.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
class GUIMessageDialog;
|
class GUIMessageDialog;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -23,19 +27,21 @@ public:
|
|||||||
void requestLogin();
|
void requestLogin();
|
||||||
QTextEdit* getEdit();
|
QTextEdit* getEdit();
|
||||||
void debugConsoleOn();
|
void debugConsoleOn();
|
||||||
public slots:
|
|
||||||
void coverScreen();
|
protected:
|
||||||
void refreshTimer();
|
void changeEvent(QEvent* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTimer* screenTimer = nullptr;
|
|
||||||
int counter = 30000;
|
cJSON* json_root = nullptr;
|
||||||
|
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
GUIMessageDialog* msgDialog = nullptr;
|
GUIMessageDialog* msgDialog = nullptr;
|
||||||
StdOutRedirector* redir = nullptr;
|
StdOutRedirector* redir = nullptr;
|
||||||
QTextEdit* console = nullptr;
|
QTextEdit* console = nullptr;
|
||||||
QTabWidget* tab= nullptr;
|
bool m_bLoaded = false;
|
||||||
int admin_tab_index = -1;
|
QTabWidget* tab = nullptr;
|
||||||
|
int admin_tab_index = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user