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"
|
2015-03-14 04:19:39 +00:00
|
|
|
#include "ui_pausemusic_config.h"
|
2013-11-22 21:49:40 +00:00
|
|
|
|
|
|
|
#include <KPluginFactory>
|
|
|
|
|
|
|
|
K_PLUGIN_FACTORY(PauseMusicConfigFactory, registerPlugin<PauseMusicConfig>();)
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
PauseMusicConfig::PauseMusicConfig(QWidget *parent, const QVariantList &args)
|
2022-03-21 17:03:45 +00:00
|
|
|
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_pausemusic"))
|
2013-11-22 21:49:40 +00:00
|
|
|
, m_ui(new Ui::PauseMusicConfigUi())
|
|
|
|
{
|
|
|
|
m_ui->setupUi(this);
|
|
|
|
|
|
|
|
connect(m_ui->rad_ringing, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
|
|
|
connect(m_ui->rad_talking, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
2015-03-13 07:01:17 +00:00
|
|
|
connect(m_ui->check_pause, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
2014-01-23 20:08:23 +00:00
|
|
|
connect(m_ui->check_mute, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
2020-05-20 22:44:33 +01:00
|
|
|
connect(m_ui->check_resume, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
2013-11-22 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PauseMusicConfig::~PauseMusicConfig()
|
|
|
|
{
|
|
|
|
delete m_ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PauseMusicConfig::defaults()
|
|
|
|
{
|
|
|
|
KCModule::defaults();
|
|
|
|
m_ui->rad_talking->setChecked(false);
|
|
|
|
m_ui->rad_ringing->setChecked(true);
|
2014-09-17 15:41:48 +01:00
|
|
|
m_ui->check_pause->setChecked(true);
|
2014-01-23 20:08:23 +00:00
|
|
|
m_ui->check_mute->setChecked(false);
|
2020-05-20 22:44:33 +01:00
|
|
|
m_ui->check_resume->setChecked(true);
|
2013-11-22 21:49:40 +00:00
|
|
|
Q_EMIT changed(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PauseMusicConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
2019-10-27 17:08:51 +00:00
|
|
|
bool talking = config()->getBool(QStringLiteral("conditionTalking"), false);
|
2013-11-22 21:49:40 +00: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);
|
2014-09-17 15:41:48 +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);
|
2020-05-20 22:44:33 +01:00
|
|
|
m_ui->check_resume->setChecked(autoResume);
|
|
|
|
|
2013-11-22 21:49:40 +00:00
|
|
|
Q_EMIT changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PauseMusicConfig::save()
|
|
|
|
{
|
2016-11-26 14:38:08 +00: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());
|
2020-05-20 22:44:33 +01:00
|
|
|
config()->set(QStringLiteral("actionResume"), m_ui->check_resume->isChecked());
|
2013-11-22 21:49:40 +00:00
|
|
|
KCModule::save();
|
|
|
|
Q_EMIT changed(false);
|
|
|
|
}
|
|
|
|
|
2014-06-16 19:02:07 +01:00
|
|
|
#include "pausemusic_config.moc"
|