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>();)
|
|
|
|
|
2017-09-03 20:39:44 +01:00
|
|
|
PauseMusicConfig::PauseMusicConfig(QWidget* parent, const QVariantList& args)
|
2016-11-26 14:38:08 +00:00
|
|
|
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_pausemusic_config"))
|
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();
|
2016-11-26 14:38:08 +00:00
|
|
|
bool talking = config()->get(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
|
|
|
|
2016-11-26 14:38:08 +00:00
|
|
|
bool pause = config()->get(QStringLiteral("actionPause"), true);
|
|
|
|
bool mute = config()->get(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
|
|
|
|
2020-05-20 22:44:33 +01:00
|
|
|
const bool autoResume = config()->get(QStringLiteral("actionResume"), true);
|
|
|
|
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"
|