2013-11-22 21:49:40 +00:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2013-11-22 21:49:40 +00:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2013-11-22 21:49:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pausemusic_config.h"
|
|
|
|
|
|
|
|
#include <KPluginFactory>
|
|
|
|
|
2023-07-21 11:42:38 +01:00
|
|
|
K_PLUGIN_CLASS(PauseMusicConfig)
|
2013-11-22 21:49:40 +00:00
|
|
|
|
2023-07-21 11:26:19 +01:00
|
|
|
PauseMusicConfig::PauseMusicConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
|
|
|
: KdeConnectPluginKcm(parent, data, args)
|
2013-11-22 21:49:40 +00:00
|
|
|
{
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.setupUi(widget());
|
2013-11-22 21:49:40 +00:00
|
|
|
|
2023-07-26 09:40:17 +01:00
|
|
|
connect(m_ui.rad_ringing, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
|
|
|
connect(m_ui.rad_talking, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
|
|
|
connect(m_ui.check_pause, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
|
|
|
connect(m_ui.check_mute, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
|
|
|
connect(m_ui.check_resume, &QCheckBox::toggled, this, &PauseMusicConfig::markAsChanged);
|
2013-11-22 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PauseMusicConfig::defaults()
|
|
|
|
{
|
|
|
|
KCModule::defaults();
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.rad_talking->setChecked(false);
|
|
|
|
m_ui.rad_ringing->setChecked(true);
|
|
|
|
m_ui.check_pause->setChecked(true);
|
|
|
|
m_ui.check_mute->setChecked(false);
|
|
|
|
m_ui.check_resume->setChecked(true);
|
2023-04-17 18:10:08 +01:00
|
|
|
markAsChanged();
|
2013-11-22 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PauseMusicConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
2019-10-27 17:08:51 +00:00
|
|
|
bool talking = config()->getBool(QStringLiteral("conditionTalking"), false);
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.rad_talking->setChecked(talking);
|
|
|
|
m_ui.rad_ringing->setChecked(!talking);
|
2014-09-17 15:41:48 +01:00
|
|
|
|
2019-10-27 17:08:51 +00:00
|
|
|
bool pause = config()->getBool(QStringLiteral("actionPause"), true);
|
|
|
|
bool mute = config()->getBool(QStringLiteral("actionMute"), false);
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.check_pause->setChecked(pause);
|
|
|
|
m_ui.check_mute->setChecked(mute);
|
2015-03-14 04:19:39 +00:00
|
|
|
|
2019-10-27 17:08:51 +00:00
|
|
|
const bool autoResume = config()->getBool(QStringLiteral("actionResume"), true);
|
2023-07-26 09:40:17 +01:00
|
|
|
m_ui.check_resume->setChecked(autoResume);
|
2013-11-22 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PauseMusicConfig::save()
|
|
|
|
{
|
2023-07-26 09:40:17 +01:00
|
|
|
config()->set(QStringLiteral("conditionTalking"), m_ui.rad_talking->isChecked());
|
|
|
|
config()->set(QStringLiteral("actionPause"), m_ui.check_pause->isChecked());
|
|
|
|
config()->set(QStringLiteral("actionMute"), m_ui.check_mute->isChecked());
|
|
|
|
config()->set(QStringLiteral("actionResume"), m_ui.check_resume->isChecked());
|
2013-11-22 21:49:40 +00:00
|
|
|
KCModule::save();
|
|
|
|
}
|
|
|
|
|
2023-07-26 09:15:11 +01:00
|
|
|
#include "moc_pausemusic_config.cpp"
|
2014-06-16 19:02:07 +01:00
|
|
|
#include "pausemusic_config.moc"
|