mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
added auto accept settings
This commit is contained in:
parent
2d3cb18f58
commit
e10e0087a4
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "settings.h"
|
||||
#include "smileypack.h"
|
||||
#include "src/corestructs.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
|
@ -151,6 +152,11 @@ void Settings::load()
|
|||
typingNotification = s.value("typingNotification", false).toBool();
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("AutoAccept");
|
||||
for (auto& key : s.childKeys())
|
||||
autoAccept[key] = s.value(key).toString();
|
||||
s.endGroup();
|
||||
|
||||
// try to set a smiley pack if none is selected
|
||||
if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty())
|
||||
smileyPack = SmileyPack::listSmileyPacks()[0].second;
|
||||
|
@ -258,6 +264,11 @@ void Settings::save(QString path)
|
|||
s.beginGroup("Privacy");
|
||||
s.setValue("typingNotification", typingNotification);
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("AutoAccept");
|
||||
for (auto& id : autoAccept.keys())
|
||||
s.setValue(id, autoAccept.value(id));
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
QString Settings::getSettingsDirPath()
|
||||
|
@ -480,6 +491,16 @@ void Settings::setAutoAwayTime(int newValue)
|
|||
autoAwayTime = newValue;
|
||||
}
|
||||
|
||||
QString Settings::getAutoAcceptDir(const QString& id) const
|
||||
{
|
||||
return autoAccept.value(id.left(TOX_ID_PUBLIC_KEY_LENGTH));
|
||||
}
|
||||
|
||||
void Settings::setAutoAcceptDir(const QString&id, const QString& dir)
|
||||
{
|
||||
autoAccept[id.left(TOX_ID_PUBLIC_KEY_LENGTH)] = dir;
|
||||
}
|
||||
|
||||
void Settings::setWidgetData(const QString& uniqueName, const QByteArray& data)
|
||||
{
|
||||
widgetSettings[uniqueName] = data;
|
||||
|
|
|
@ -125,6 +125,9 @@ public:
|
|||
int getEmojiFontPointSize() const;
|
||||
void setEmojiFontPointSize(int value);
|
||||
|
||||
QString getAutoAcceptDir(const QString& id) const;
|
||||
void setAutoAcceptDir(const QString&id, const QString& dir);
|
||||
|
||||
// ChatView
|
||||
int getFirstColumnHandlePos() const;
|
||||
void setFirstColumnHandlePos(const int pos);
|
||||
|
@ -197,6 +200,7 @@ private:
|
|||
int autoAwayTime;
|
||||
|
||||
QHash<QString, QByteArray> widgetSettings;
|
||||
QHash<QString, QString> autoAccept;
|
||||
|
||||
// GUI
|
||||
bool enableSmoothAnimation;
|
||||
|
|
Loading…
Reference in New Issue
Block a user