From 575533f902657faa7f2a3b8b889b1da90458a57f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Jul 2017 16:30:45 -0400 Subject: Get the keyboard shortcut for "LockScreen" (case-insensitive) working, and fix some connection warnings. --- src-qt5/core/lumina-desktop-unified/LSession.cpp | 2 ++ .../lumina-desktop-unified/src-events/LShortcutEvents.cpp | 9 +++++---- .../src-screensaver/LScreenSaver.cpp | 2 +- .../src-screensaver/SSBaseWidget.cpp | 14 +++++++------- .../src-screensaver/animations/BaseAnimGroup.cpp | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src-qt5/core') diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 2155a8b7..8ab1b303 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -29,6 +29,7 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu //Initialize the global objects to null pointers qRegisterMetaType< Qt::Key >("Qt::Key"); qRegisterMetaType< NativeWindow::Property >("NativeWindow::Property"); + qRegisterMetaType< QList< NativeWindow::Property > >("QList"); mediaObj = 0; //private object used for playing login/logout chimes if(this->isPrimaryProcess()){ @@ -222,6 +223,7 @@ void LSession::setupGlobalConnections(){ connect(Lumina::SHORTCUTS, SIGNAL(StartLogout()), this, SLOT(StartLogout()) ); connect(Lumina::SHORTCUTS, SIGNAL(StartReboot()), this, SLOT(StartReboot()) ); connect(Lumina::SHORTCUTS, SIGNAL(StartShutdown()), this, SLOT(StartShutdown()) ); + connect(Lumina::SHORTCUTS, SIGNAL(LockSession()), Lumina::SS, SLOT(LockScreenNow()) ); //Root window connections connect(Lumina::ROOTWIN, SIGNAL(RegisterVirtualRoot(WId)), Lumina::NWS, SLOT(RegisterVirtualRoot(WId)) ); diff --git a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp index 1b78da21..3d50112c 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp @@ -139,11 +139,11 @@ QString LShortcutEvents::keylistToString(){ void LShortcutEvents::evaluateShortcutAction(QString action){ qDebug() << "Found Shortcut Action:" << action; evaluated = true; - if(action.startsWith("Exec=")){ - emit LaunchApplication(action.section("=",1,-1)); + if(action.startsWith("Exec:")){ + emit LaunchApplication(action.section(":",1,-1)); return; - }else if(action.startsWith("Launch=")){ - emit LaunchStandardApplication(action.section("=",1,-1)); + }else if(action.startsWith("Launch:")){ + emit LaunchStandardApplication(action.section(":",1,-1)); } //Specific Internal actions action = action.toLower(); @@ -152,6 +152,7 @@ void LShortcutEvents::evaluateShortcutAction(QString action){ else if(action=="reboot"){ emit StartReboot(); } else if(action=="shutdown"){ emit StartShutdown(); } else if(action=="show_leave_options"){ emit OpenLeaveDialog(); } + else if(action=="lockscreen"){ emit LockSession(); } } diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp index 9f280a47..bfcfa54d 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp @@ -8,7 +8,7 @@ #include #include -#define DEBUG 1 +#define DEBUG 0 LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::WindowStaysOnTopHint){ starttimer = new QTimer(this); diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp index 943fe0a1..b31ef793 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp @@ -25,7 +25,7 @@ SSBaseWidget::SSBaseWidget(QWidget *parent, QSettings *set) : QWidget(parent){ SSBaseWidget::~SSBaseWidget(){ if(ANIM!=0){ this->stopPainting(); } } - + void SSBaseWidget::setPlugin(QString plug){ plug = plug.toLower(); if(validPlugs.contains(plug) || plug=="random"){ plugType = plug; } @@ -38,12 +38,12 @@ void SSBaseWidget::setPlugin(QString plug){ void SSBaseWidget::startPainting(){ cplug = plugType; //free up any old animation instance - if(ANIM!=0){ + if(ANIM!=0){ ANIM->stop(); ANIM->clear(); - delete ANIM; ANIM = 0; - } + delete ANIM; ANIM = 0; + } //If a random plugin - grab one of the known plugins - if(cplug=="random"){ + if(cplug=="random"){ QStringList valid = BaseAnimGroup::KnownAnimations(); valid.removeAll("none"); //they want a screensaver - remove the "none" option from the valid list if(valid.isEmpty()){ cplug = "none"; } //no known plugins @@ -67,9 +67,9 @@ void SSBaseWidget::startPainting(){ } //Now start the animation(s) if(ANIM!=0){ - if(ANIM->animationCount()>0){ + if(ANIM->animationCount()>0){ if(DEBUG){ qDebug() << " - Starting SS Plugin:" << cplug << ANIM->animationCount() << ANIM->duration() << ANIM->loopCount(); } - ANIM->start(); + ANIM->start(); } } } diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp index cda9797b..017eaf9f 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.cpp @@ -31,5 +31,5 @@ BaseAnimGroup* BaseAnimGroup::NewAnimation(QString type, QWidget *parent, QSetti } QStringList BaseAnimGroup::KnownAnimations(){ - return (QStringList() << "text"); + return (QStringList() << "fireflies" << "grav" << "text"); } -- cgit