Add ScreenSaver.
This commit is contained in:
@@ -37,7 +37,7 @@ 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 Network REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL Sql VirtualKeyboard Network REQUIRED Multimedia MultimediaWidgets)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
file(GLOB_RECURSE project_uis ./src/*.ui)
|
||||
@@ -78,11 +78,11 @@ endif()
|
||||
|
||||
if(UNIX AND USE_SHIMLIB)
|
||||
link_directories(/usr/local/lib64)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard Qt5::Network 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 Qt5::Network Qt5::Multimedia Qt5::MultimediaWidgets pthread usct_shim dmapi log4c cunit ctomat hdf5 matio m)
|
||||
elseif(UNIX)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard Qt5::Network pthread)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard Qt5::Network Qt5::Multimedia Qt5::MultimediaWidgets pthread)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard Qt5::Network)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL Qt5::Sql Qt5::VirtualKeyboard Qt5::Network Qt5::Multimedia Qt5::MultimediaWidgets)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@@ -125,6 +125,10 @@ if(UNIX)
|
||||
install(CODE "file(RENAME ${CMAKE_INSTALL_BINDIR}/libQt5VirtualKeyboard.so.5.12.0 ${CMAKE_INSTALL_BINDIR}/libQt5VirtualKeyboard.so.5)")
|
||||
install(CODE "file(COPY ${qt_LIB_DIR}/libQt5OpenGL.so.5.12.0 DESTINATION ${CMAKE_INSTALL_BINDIR})")
|
||||
install(CODE "file(RENAME ${CMAKE_INSTALL_BINDIR}/libQt5OpenGL.so.5.12.0 ${CMAKE_INSTALL_BINDIR}/libQt5OpenGL.so.5)")
|
||||
install(CODE "file(COPY ${qt_LIB_DIR}/libQt5Multimedia.so.5.12.0 DESTINATION ${CMAKE_INSTALL_BINDIR})")
|
||||
install(CODE "file(RENAME ${CMAKE_INSTALL_BINDIR}/libQt5Multimedia.so.5.12.0 ${CMAKE_INSTALL_BINDIR}/libQt5Multimedia.so.5)")
|
||||
install(CODE "file(COPY ${qt_LIB_DIR}/libQt5MultimediaWidgets.so.5.12.0 DESTINATION ${CMAKE_INSTALL_BINDIR})")
|
||||
install(CODE "file(RENAME ${CMAKE_INSTALL_BINDIR}/libQt5MultimediaWidgets.so.5.12.0 ${CMAKE_INSTALL_BINDIR}/libQt5MultimediaWidgets.so.5)")
|
||||
install(CODE "file(COPY ${qt_LIB_DIR}/libQt5Widgets.so.5.12.0 DESTINATION ${CMAKE_INSTALL_BINDIR})")
|
||||
install(CODE "file(RENAME ${CMAKE_INSTALL_BINDIR}/libQt5Widgets.so.5.12.0 ${CMAKE_INSTALL_BINDIR}/libQt5Widgets.so.5)")
|
||||
install(CODE "file(COPY ${qt_LIB_DIR}/libQt5Qml.so.5.12.0 DESTINATION ${CMAKE_INSTALL_BINDIR})")
|
||||
|
||||
@@ -70,5 +70,8 @@
|
||||
"worklistfilter": {
|
||||
"default": "Today",
|
||||
"lists": "Today;Recent3Days;ThisWeek;ThisMonth"
|
||||
},
|
||||
"screensaver": {
|
||||
"content": "screensaver.PNG;screensaver.mp4"
|
||||
}
|
||||
}
|
||||
@@ -88,5 +88,8 @@
|
||||
"worklistfilter": {
|
||||
"default": "Recent3Days",
|
||||
"lists": "Today;Recent3Days;ThisWeek;ThisMonth"
|
||||
},
|
||||
"screensaver": {
|
||||
"content": "screensaver.PNG;screensaver.mp4"
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,10 @@
|
||||
#include "network/GetIPDialog.h"
|
||||
#include "network/GetRouteDialog.h"
|
||||
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
#include "windows/LoginDialog.h"
|
||||
#include "screensaver/ScreenSaverWindow.h"
|
||||
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "shimlib/ShimLib.h"
|
||||
|
||||
@@ -36,6 +38,7 @@ namespace
|
||||
DialogManager::DialogManager()
|
||||
: QObject()
|
||||
, mFunctionDialog(nullptr)
|
||||
, mScreenSaverWindow(nullptr)
|
||||
, mOperationMessageDialog(nullptr)
|
||||
, mSyncDialog(nullptr)
|
||||
, mTopWidget(nullptr)
|
||||
@@ -52,6 +55,7 @@ void DialogManager::init(QWidget* aParent) {
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd,this,&DialogManager::invokeOperationEnd);
|
||||
MultyMessageDialogManager::getInstance()->setDialogParent(aParent);
|
||||
mTopWidget = aParent;
|
||||
mScreenSaverWindow = new ScreenSaverWindow();
|
||||
}
|
||||
|
||||
//得考虑多线程的问题
|
||||
@@ -84,12 +88,25 @@ void DialogManager::requestLogin(QWidget* aParent)
|
||||
if (!mFunctionDialog){
|
||||
mFunctionDialog = new LoginDialog(aParent);
|
||||
}
|
||||
setTopWidget(mFunctionDialog);
|
||||
mFunctionDialog->setWindowModality(Qt::WindowModal);
|
||||
mFunctionDialog->exec();
|
||||
while (QDialog::Accepted != mFunctionDialog->result())
|
||||
{
|
||||
mFunctionDialog->exec();
|
||||
}
|
||||
releaseTopWidget(mFunctionDialog);
|
||||
}
|
||||
|
||||
void DialogManager::requestScreenSaverPlay()
|
||||
{
|
||||
setFocusToTopDialog();
|
||||
mScreenSaverWindow->play();
|
||||
}
|
||||
|
||||
void DialogManager::requestScreenSaverStop(bool aIsStopLocker)
|
||||
{
|
||||
mScreenSaverWindow->stop(aIsStopLocker);
|
||||
}
|
||||
|
||||
int DialogManager::requestAddAccount(QSqlTableModel* model) {
|
||||
@@ -308,10 +325,12 @@ void DialogManager::raiseDeviceError(QObject *parent, QObject *msg) {
|
||||
dialog->showExitButton();
|
||||
setTopWidget(dialog);
|
||||
dialog->setWindowModality(Qt::WindowModal);
|
||||
mScreenSaverWindow->stop(true);
|
||||
dialog->showFullScreen ();
|
||||
dialog->exec();
|
||||
releaseTopWidget(dialog);
|
||||
dialog->deleteLater();
|
||||
mScreenSaverWindow->startLocker();
|
||||
}
|
||||
|
||||
// 扫描过程 dialog 只能为最底层,并且会被error dialog 清除!
|
||||
@@ -408,6 +427,7 @@ void DialogManager::clearMessageDialog() {
|
||||
|
||||
DialogManager::~DialogManager() {
|
||||
clearMessageDialog();
|
||||
delete mScreenSaverWindow;
|
||||
}
|
||||
|
||||
void DialogManager::raiseMultyMessageDialog(const QString& aMessage, MessageLevel aMessageLevel)
|
||||
|
||||
@@ -16,6 +16,7 @@ class GUIMessageDialog;
|
||||
class QSqlTableModel;
|
||||
class PatientInformation;
|
||||
class LoginDialog;
|
||||
class ScreenSaverWindow;
|
||||
|
||||
enum MessageLevel:unsigned int;
|
||||
|
||||
@@ -43,6 +44,8 @@ public:
|
||||
|
||||
void init(QWidget* aParent);
|
||||
void requestLogin(QWidget* aParent);
|
||||
void requestScreenSaverPlay();
|
||||
void requestScreenSaverStop(bool aIsStopLocker = false);
|
||||
int requestAddAccount(QSqlTableModel* model);
|
||||
int requestEditSelfAccount();
|
||||
int requestEditAdminAccount(const QMap<QString, QVariant>& values);
|
||||
@@ -78,6 +81,7 @@ private:
|
||||
|
||||
private:
|
||||
LoginDialog* mFunctionDialog;
|
||||
ScreenSaverWindow* mScreenSaverWindow;
|
||||
QPointer<GUIMessageDialog> mOperationMessageDialog;
|
||||
QPointer<GUIMessageDialog> mSyncDialog;
|
||||
QWidget* mTopWidget;
|
||||
|
||||
@@ -31,7 +31,8 @@ ADD_EVENT_VALUE(GlobalBannerMessage)\
|
||||
ADD_EVENT_VALUE(ReloadLanguage)\
|
||||
ADD_EVENT_VALUE(WarnStateFlagChange)\
|
||||
ADD_EVENT_VALUE(GUIErrorRaise)\
|
||||
ADD_EVENT_VALUE(DeviceInfoRaise)
|
||||
ADD_EVENT_VALUE(DeviceInfoRaise)\
|
||||
ADD_EVENT_VALUE(RequestScreenSaver)
|
||||
|
||||
enum GUIEvents {
|
||||
#define ADD_EVENT_VALUE(val) val,
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
#include "components/ULineEdit.h"
|
||||
#include "components/ListBox.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const int MINIMUM_LOCKTIME = 30;
|
||||
}
|
||||
|
||||
GeneralForm::GeneralForm(QWidget* aParent)
|
||||
: QWidget(aParent)
|
||||
, mLayout(new QVBoxLayout(this))
|
||||
@@ -86,8 +91,12 @@ GeneralForm::GeneralForm(QWidget* aParent)
|
||||
connect(lockTime, &QLineEdit::textChanged, [=](const QString& str)
|
||||
{
|
||||
//take effect
|
||||
JsonObject::Instance()->setLockScreenTimeout(str);
|
||||
Locker::getInstance()->setTimer(JsonObject::Instance()->lockerCount());
|
||||
int time = str.toInt();
|
||||
if (MINIMUM_LOCKTIME < time)
|
||||
{
|
||||
JsonObject::Instance()->setLockScreenTimeout(str);
|
||||
Locker::getInstance()->setTimer(str.toInt() * 1000);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -539,4 +539,7 @@ void JsonObject::setCompleteNotify(bool val) {
|
||||
setBool("general","CompleteNotify", val, true);
|
||||
}
|
||||
|
||||
|
||||
QStringList JsonObject::getScreenSaverInfomation()
|
||||
{
|
||||
return QString(getJsonString("screensaver", "content")).split(";");
|
||||
}
|
||||
|
||||
@@ -107,6 +107,8 @@ public:
|
||||
|
||||
QList<QStringList> getIpRouteList();
|
||||
void setIpRouteList(const QList<QStringList>& list);
|
||||
|
||||
QStringList getScreenSaverInfomation();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -73,9 +73,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
SQLHelper::Open();
|
||||
MainWindow w;
|
||||
DialogManager::Default()->init(&w);
|
||||
UserOperationLog::Default()->init();
|
||||
|
||||
//暂时为了调试关闭锁屏
|
||||
//Locker::getInstance()->setIsEnable(true);
|
||||
//Locker::getInstance()->start();
|
||||
//QObject::connect(TouchScreenSignalSender::getInstance(), SIGNAL(touchScreen()), Locker::getInstance(), SLOT(refreshTimer()));
|
||||
QList<Qt::GestureType> gestures;
|
||||
@@ -107,7 +109,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
w.requestLogin();
|
||||
|
||||
DialogManager::Default()->init(&w);
|
||||
DeviceManager::Default()->initDevice();
|
||||
|
||||
ret = a.exec();
|
||||
@@ -118,7 +119,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
w.showFullScreen();
|
||||
w.requestLogin();
|
||||
DialogManager::Default()->init(&w);
|
||||
|
||||
DeviceManager::Default()->initDevice();
|
||||
ret = a.exec();
|
||||
}
|
||||
|
||||
146
src/screensaver/ScreenSaverWindow.cpp
Normal file
146
src/screensaver/ScreenSaverWindow.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
#include "ScreenSaverWindow.h"
|
||||
|
||||
#include <QPropertyAnimation>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMediaPlaylist>
|
||||
#include <QVideoWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPixmap>
|
||||
#include <QLabel>
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
|
||||
#include "json/jsonobject.h"
|
||||
#include "utilities/Locker.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const QString SCREENSAVER_PATH = "./screensaver";
|
||||
const QStringList VEDIOSUFFIX_FILTER = QStringList() << "*.mp4" << "*.avi";
|
||||
const QStringList PHOTOSUFFIX_FILTER = QStringList() << "*.PNG" << "*.JPG";
|
||||
const int PHOTOPLAYED_TIME = 5000;
|
||||
}
|
||||
|
||||
ScreenSaverWindow::ScreenSaverWindow(QWidget *aParent)
|
||||
: QWidget(aParent)
|
||||
, mMediaPlayer(new QMediaPlayer(this))
|
||||
, mVideoWidget(new QVideoWidget(this))
|
||||
, mMultiMediaList()
|
||||
, mPhotoWidget(new QLabel(this))
|
||||
, mPhotoTimer(new QTimer(this))
|
||||
, mCurrentPlayIndex(0)
|
||||
, mIsPlaying(false)
|
||||
{
|
||||
setGeometry(QApplication::desktop()->screenGeometry());
|
||||
//this code must be first
|
||||
mMediaPlayer->setVideoOutput(mVideoWidget);
|
||||
|
||||
initializeMultimediaList();
|
||||
setWindowFlags( Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool | Qt::BypassWindowManagerHint);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->addWidget(mVideoWidget);
|
||||
layout->addWidget(mPhotoWidget);
|
||||
mPhotoWidget->setScaledContents(true);
|
||||
mPhotoWidget->hide();
|
||||
mVideoWidget->hide();
|
||||
mPhotoTimer->setSingleShot(true);
|
||||
connect(mPhotoTimer, &QTimer::timeout, this, &ScreenSaverWindow::playMultimedia);
|
||||
connect(mMediaPlayer, &QMediaPlayer::mediaStatusChanged, this, &ScreenSaverWindow::handleVideoStatusChanged);
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::initializeMultimediaList()
|
||||
{
|
||||
QDir screenSaverDir(SCREENSAVER_PATH);
|
||||
QStringList videoFileList = screenSaverDir.entryList(VEDIOSUFFIX_FILTER);
|
||||
QStringList photoFileList = screenSaverDir.entryList(PHOTOSUFFIX_FILTER);
|
||||
|
||||
foreach(QString multimediaInfo, JsonObject::Instance()->getScreenSaverInfomation())
|
||||
{
|
||||
if (videoFileList.contains(multimediaInfo))
|
||||
{
|
||||
mMultiMediaList << MultiMediaData(screenSaverDir.absoluteFilePath(multimediaInfo),MultiMediaType::Video);
|
||||
}
|
||||
else if (photoFileList.contains(multimediaInfo))
|
||||
{
|
||||
mMultiMediaList << MultiMediaData(screenSaverDir.absoluteFilePath(multimediaInfo),MultiMediaType::Photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::mousePressEvent(QMouseEvent* aEvent)
|
||||
{
|
||||
stop();
|
||||
QWidget::mousePressEvent(aEvent);
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::play()
|
||||
{
|
||||
if (mIsPlaying || mMultiMediaList.count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mIsPlaying = true;
|
||||
show();
|
||||
playMultimedia();
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::playMultimedia()
|
||||
{
|
||||
if (mMultiMediaList.count() <= mCurrentPlayIndex)
|
||||
{
|
||||
mCurrentPlayIndex = 0;
|
||||
}
|
||||
MultiMediaData data = mMultiMediaList.at(mCurrentPlayIndex);
|
||||
if (MultiMediaType::Video == data.MediaType)
|
||||
{
|
||||
mPhotoWidget->hide();
|
||||
mVideoWidget->show();
|
||||
mMediaPlayer->setMedia(QUrl::fromLocalFile(data.MediaPath));
|
||||
mMediaPlayer->play();
|
||||
}
|
||||
else if ( MultiMediaType::Photo == data.MediaType)
|
||||
{
|
||||
mVideoWidget->hide();
|
||||
mPhotoWidget->show();
|
||||
mPhotoWidget->setPixmap(data.MediaPath);
|
||||
mPhotoTimer->start(PHOTOPLAYED_TIME);
|
||||
}
|
||||
mCurrentPlayIndex++;
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::stop(bool aIsStopLocker)
|
||||
{
|
||||
if (aIsStopLocker)
|
||||
{
|
||||
Locker::getInstance()->stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
Locker::getInstance()->start();
|
||||
}
|
||||
if (!mIsPlaying)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mIsPlaying = false;
|
||||
mPhotoTimer->stop();
|
||||
mPhotoWidget->hide();
|
||||
mVideoWidget->hide();
|
||||
mCurrentPlayIndex = 0;
|
||||
hide();
|
||||
mMediaPlayer->stop();
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::handleVideoStatusChanged(QMediaPlayer::MediaStatus aStatus)
|
||||
{
|
||||
if (QMediaPlayer::EndOfMedia == aStatus)
|
||||
{
|
||||
playMultimedia();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSaverWindow::startLocker()
|
||||
{
|
||||
Locker::getInstance()->start();
|
||||
}
|
||||
54
src/screensaver/ScreenSaverWindow.h
Normal file
54
src/screensaver/ScreenSaverWindow.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef SCREENSAVERWINDOW_H
|
||||
#define SCREENSAVERWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMediaPlayer>
|
||||
|
||||
class QMediaPlayer;
|
||||
class QVideoWidget;
|
||||
class QLabel;
|
||||
|
||||
class ScreenSaverWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
enum MultiMediaType
|
||||
{
|
||||
Video,Photo
|
||||
};
|
||||
|
||||
struct MultiMediaData
|
||||
{
|
||||
MultiMediaData(const QString& aMediaPath, MultiMediaType aMediaType)
|
||||
{
|
||||
MediaPath = aMediaPath;
|
||||
MediaType = aMediaType;
|
||||
};
|
||||
QString MediaPath;
|
||||
MultiMediaType MediaType;
|
||||
};
|
||||
|
||||
public:
|
||||
explicit ScreenSaverWindow(QWidget *aParent = nullptr);
|
||||
void play();
|
||||
void stop(bool aIsStopLocker = false);
|
||||
void startLocker();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* aEvent);
|
||||
|
||||
private:
|
||||
void initializeMultimediaList();
|
||||
void handleVideoStatusChanged(QMediaPlayer::MediaStatus aStatus);
|
||||
void playMultimedia();
|
||||
|
||||
private:
|
||||
QMediaPlayer* mMediaPlayer;
|
||||
QVideoWidget* mVideoWidget;
|
||||
QList<MultiMediaData> mMultiMediaList;
|
||||
QLabel* mPhotoWidget;
|
||||
QTimer* mPhotoTimer;
|
||||
int mCurrentPlayIndex;
|
||||
bool mIsPlaying;
|
||||
};
|
||||
|
||||
#endif // SCREENSAVERWINDOW_H
|
||||
@@ -15,6 +15,7 @@ Locker::Locker()
|
||||
: QObject()
|
||||
, mScreenTimer(new QTimer(this))
|
||||
, mCounter(JsonObject::Instance()->lockerCount())
|
||||
, mIsEnable(false)
|
||||
{
|
||||
connect(mScreenTimer, SIGNAL(timeout()), this, SLOT(coverScreen()));
|
||||
}
|
||||
@@ -25,7 +26,19 @@ Locker::~Locker()
|
||||
|
||||
void Locker::start()
|
||||
{
|
||||
mScreenTimer->start(mCounter);
|
||||
if (mIsEnable)
|
||||
{
|
||||
mScreenTimer->start(mCounter);
|
||||
}
|
||||
}
|
||||
|
||||
void Locker::setIsEnable(bool aIsEnable)
|
||||
{
|
||||
mIsEnable = aIsEnable;
|
||||
if (!mIsEnable)
|
||||
{
|
||||
mScreenTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void Locker::coverScreen()
|
||||
@@ -37,7 +50,8 @@ void Locker::coverScreen()
|
||||
else
|
||||
{
|
||||
mScreenTimer->stop();
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestLogin, nullptr, nullptr);
|
||||
//EventCenter::Default()->triggerEvent(GUIEvents::RequestLogin, nullptr, nullptr);
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestScreenSaver, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
void Locker::setTimer(int aInterval)
|
||||
@@ -51,3 +65,8 @@ void Locker::refreshTimer()
|
||||
mScreenTimer->stop();
|
||||
mScreenTimer->start(mCounter);
|
||||
}
|
||||
|
||||
void Locker::stop()
|
||||
{
|
||||
mScreenTimer->stop();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ class Locker : public QObject
|
||||
public:
|
||||
static Locker* getInstance();
|
||||
void start();
|
||||
void stop();
|
||||
void setTimer(int aInterval);
|
||||
void setIsEnable(bool aIsEnable);
|
||||
|
||||
public slots:
|
||||
void refreshTimer();
|
||||
@@ -21,6 +23,7 @@ private:
|
||||
|
||||
QTimer* mScreenTimer;
|
||||
int mCounter;
|
||||
bool mIsEnable;
|
||||
};
|
||||
|
||||
#endif // LOCKER_H
|
||||
|
||||
@@ -29,7 +29,6 @@ MainWindow::MainWindow(QWidget* aParent)
|
||||
, mDebugMessageConsole(nullptr)
|
||||
, mTabWidget(new QTabWidget(this))
|
||||
, mAdminTabIndex(-1)
|
||||
, mLoginDialog(new LoginDialog(this))
|
||||
, mThread(nullptr)
|
||||
, mIsDebugMode(false)
|
||||
{
|
||||
@@ -45,6 +44,7 @@ MainWindow::MainWindow(QWidget* aParent)
|
||||
connect(DeviceManager::Default(), &DeviceManager::raiseGlobalError, this, &MainWindow::triggerError);
|
||||
connect(DeviceManager::Default(), &DeviceManager::raiseGlobalInfo, this, &MainWindow::triggerInfo);
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this, &MainWindow::reloadLanguage);
|
||||
connect(EventCenter::Default(), &EventCenter::RequestScreenSaver, this, &MainWindow::requestScreenSaver);
|
||||
GUIErrorHandle::Default()->init();
|
||||
mThread = QThread::create([]() {
|
||||
QThread::sleep(10);
|
||||
@@ -276,6 +276,11 @@ void MainWindow::requestLogin()
|
||||
QApplication::setActiveWindow(centralWidget());
|
||||
}
|
||||
|
||||
void MainWindow::requestScreenSaver()
|
||||
{
|
||||
DialogManager::Default()->requestScreenSaverPlay();
|
||||
}
|
||||
|
||||
void MainWindow::resetRoleLayout() {
|
||||
if (User::Current()->isAdmin())
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@ class QGestureEvent;
|
||||
class QSwipeGesture;
|
||||
class QPanGesture;
|
||||
class QDockWidget;
|
||||
class LoginDialog;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
@@ -31,6 +30,7 @@ public:
|
||||
void centerWidgetHide();
|
||||
void centerWidgetShow();
|
||||
void requestLogin();
|
||||
void requestScreenSaver();
|
||||
QTextEdit* getEdit();
|
||||
void debugConsoleOn();
|
||||
void grabGestures(const QList<Qt::GestureType>& aGestures);
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
QTextEdit* mDebugMessageConsole;
|
||||
QTabWidget* mTabWidget;
|
||||
int mAdminTabIndex;
|
||||
LoginDialog* mLoginDialog;
|
||||
QThread* mThread;
|
||||
bool mIsDebugMode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user