2020-10-06 04:40:12 +03:00
|
|
|
/*
|
|
|
|
This file is part of Fernschreiber.
|
|
|
|
|
|
|
|
Fernschreiber is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Fernschreiber is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "appsettings.h"
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
#define LOG(x) qDebug() << "[AppSettings]" << x
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
const QString KEY_SEND_BY_ENTER("sendByEnter");
|
2020-10-09 18:09:29 +03:00
|
|
|
const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages");
|
2020-10-06 04:40:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings")
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AppSettings::getSendByEnter() const
|
|
|
|
{
|
|
|
|
return settings.value(KEY_SEND_BY_ENTER, false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppSettings::setSendByEnter(bool sendByEnter)
|
|
|
|
{
|
|
|
|
if (getSendByEnter() != sendByEnter) {
|
|
|
|
LOG(KEY_SEND_BY_ENTER << sendByEnter);
|
|
|
|
settings.setValue(KEY_SEND_BY_ENTER, sendByEnter);
|
|
|
|
emit sendByEnterChanged();
|
|
|
|
}
|
|
|
|
}
|
2020-10-09 18:09:29 +03:00
|
|
|
|
|
|
|
bool AppSettings::showStickersAsImages() const
|
|
|
|
{
|
|
|
|
return settings.value(KEY_SHOW_STICKERS_AS_IMAGES, true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppSettings::setShowStickersAsImages(bool showAsImages)
|
|
|
|
{
|
|
|
|
if (showStickersAsImages() != showAsImages) {
|
|
|
|
LOG(KEY_SHOW_STICKERS_AS_IMAGES << showAsImages);
|
|
|
|
settings.setValue(KEY_SHOW_STICKERS_AS_IMAGES, showAsImages);
|
|
|
|
emit showStickersAsImagesChanged();
|
|
|
|
}
|
|
|
|
}
|