File indexing completed on 2024-05-26 04:48:41

0001 /*
0002     SnoreNotify is a Notification Framework based on Qt
0003     Copyright (C) 2015  Hannah von Reth <vonreth@kde.org>
0004 
0005     SnoreNotify is free software: you can redistribute it and/or modify
0006     it under the terms of the GNU Lesser General Public License as published by
0007     the Free Software Foundation, either version 3 of the License, or
0008     (at your option) any later version.
0009 
0010     SnoreNotify is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013     GNU Lesser General Public License for more details.
0014 
0015     You should have received a copy of the GNU Lesser General Public License
0016     along with SnoreNotify.  If not, see <http://www.gnu.org/licenses/>.
0017 */
0018 #include "pushoversettings.h"
0019 #include "pushoverconstants.h"
0020 
0021 #include "plugins/plugins.h"
0022 
0023 #include <QLabel>
0024 #include <QLineEdit>
0025 
0026 PushoverSettings::PushoverSettings(Snore::SnorePlugin *plugin, QWidget *parent) :
0027     Snore::PluginSettingsWidget(plugin, parent),
0028     m_keyLineEdit(new QLineEdit(this)),
0029     m_soundLineEdit(new QLineEdit(this)),
0030     m_deviceLineEdit(new QLineEdit(this))
0031 {
0032     addRow(tr("User Key:"), m_keyLineEdit, tr("The user key which can be found on your account page at <a href=\"https://pushover.net\">Pushover.net</a>."));
0033     addRow(tr("Sound:"), m_soundLineEdit, tr("The pushover sound that is played when a notification is received."));
0034     addRow(tr("Devices:"), m_deviceLineEdit, tr("The devices that are to receive the notifications."));
0035     addRow(QString(), new QLabel(tr("If you don't have an account yet please register at <a href=\"https://pushover.net\">Pushover.net</a>"), this));
0036 }
0037 
0038 PushoverSettings::~PushoverSettings()
0039 {
0040 }
0041 
0042 void PushoverSettings::load()
0043 {
0044     m_keyLineEdit->setText(settingsValue(PushoverConstants::UserKey).toString());
0045     m_soundLineEdit->setText(settingsValue(PushoverConstants::Sound).toString());
0046     m_deviceLineEdit->setText(settingsValue(PushoverConstants::Devices).toString());
0047 }
0048 
0049 void PushoverSettings::save()
0050 {
0051     setSettingsValue(PushoverConstants::UserKey, m_keyLineEdit->text());
0052     setSettingsValue(PushoverConstants::Sound, m_soundLineEdit->text());
0053     setSettingsValue(PushoverConstants::Devices, m_deviceLineEdit->text());
0054 }