!78 控制面板设置永不进入屏保一分钟后 显示透明窗口

Merge pull request !78 from liudunfa/tmp-debian
This commit is contained in:
杨敏 2024-04-23 02:09:31 +00:00 committed by Gitee
commit 7edab179ec
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 16 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#define KEY_THEMES "themes"
#define KEY_IDLE_ACTIVATION_ENABLED "idle-activation-enabled"
#define KEY_LOCK_ENABLED "lock-enabled"
#define KEY_IDLE_DELAY "idle-delay"
#define KEY_IMAGE_TRANSITION_EFFECT "image-transition-effect"
#define KEY_IMAGE_SWITCH_INTERVAL "image-switch-interval"
#define KEY_BACKGROUND "background"
@ -51,6 +52,7 @@ Configuration::Configuration(QObject *parent) : QObject(parent)
themes = gsettings->get(KEY_THEMES).toStringList();
idleActivationEnabled = gsettings->get(
KEY_IDLE_ACTIVATION_ENABLED).toBool();
idleDelay = gsettings->get(KEY_IDLE_DELAY).toInt();
lockEnabled = gsettings->get(KEY_LOCK_ENABLED).toBool();
imageSwitchInterval = gsettings->get(KEY_IMAGE_SWITCH_INTERVAL).toInt();
imageTSEffect = gsettings->get(KEY_IMAGE_TRANSITION_EFFECT).toInt();
@ -115,6 +117,9 @@ void Configuration::onConfigurationChanged(QString key)
imageTSEffect = gsettings->get(KEY_IMAGE_TRANSITION_EFFECT).toInt();
else if(key == KEY_IMAGE_SWITCH_INTERVAL)
imageSwitchInterval = gsettings->get(KEY_IMAGE_SWITCH_INTERVAL).toInt();
else if (key == KEY_IDLE_DELAY) {
idleDelay = gsettings->get(KEY_IDLE_DELAY).toInt();
}
}
/*
@ -204,6 +209,9 @@ QString Configuration::getBackground()
bool Configuration::xscreensaverActivatedWhenIdle()
{
if (idleDelay <= 0)
return false;
else
return idleActivationEnabled;
}

View File

@ -56,6 +56,7 @@ private:
QString background;
bool idleActivationEnabled;
bool lockEnabled;
int idleDelay;
int imageTSEffect;
int imageSwitchInterval;
static Configuration *instance_;

View File

@ -680,7 +680,7 @@ int FullBackgroundWidget::onSessionStatusChanged(uint status)
showScreensaver();
#else
if(configuration->xscreensaverActivatedWhenIdle() &&
configuration->lockWhenXScreensaverActivated())
configuration->lockWhenXScreensaverActivated() && idleDelay != -1)
{
//显示锁屏和屏保
showLockWidget();
@ -929,6 +929,7 @@ void FullBackgroundWidget::onConfigurationDelayChanged(QString key)
{
if(key == KEY_IDLE_DELAY){
idleDelay = settings_delay->get("idle-delay").toInt();
qDebug()<<"idleDelay="<<idleDelay;
}
}

View File

@ -238,9 +238,11 @@ int main(int argc, char *argv[])
if(parser.isSet(sessionIdleOption))
{
if(window->onSessionStatusChanged(SESSION_IDLE) == -1)
if(window->onSessionStatusChanged(SESSION_IDLE) == -1) {
window->close();
return 0;
}
}
if(parser.isSet(lscreensaverOption))
{