1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(chat): add settings to alter the chat view's base font

Defaults to GUI style font according to previous behavior.
This commit is contained in:
Nils Fenner 2016-06-28 13:03:58 +02:00
parent d408cb5184
commit 8ba2054190
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
2 changed files with 30 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "src/core/corestructs.h"
#include "src/core/core.h"
#include "src/widget/gui.h"
#include "src/widget/style.h"
#include "src/persistence/profilelocker.h"
#include "src/persistence/settingsserializer.h"
#include "src/nexus.h"
@ -224,6 +225,12 @@ void Settings::loadGlobal()
}
s.endGroup();
s.beginGroup("Chat");
{
chatMessageFont = s.value("chatMessageFont", Style::getFont(Style::Big)).value<QFont>();
}
s.endGroup();
s.beginGroup("State");
windowGeometry = s.value("windowGeometry", QByteArray()).toByteArray();
windowState = s.value("windowState", QByteArray()).toByteArray();
@ -454,6 +461,12 @@ void Settings::saveGlobal()
s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled);
s.endGroup();
s.beginGroup("Chat");
{
s.setValue("chatMessageFont", chatMessageFont);
}
s.endGroup();
s.beginGroup("State");
s.setValue("windowGeometry", windowGeometry);
s.setValue("windowState", windowState);
@ -1134,6 +1147,18 @@ void Settings::setGlobalAutoAcceptDir(const QString& newValue)
globalAutoAcceptDir = newValue;
}
const QFont& Settings::getChatMessageFont() const
{
QMutexLocker locker(&bigLock);
return chatMessageFont;
}
void Settings::setChatMessageFont(const QFont& font)
{
QMutexLocker locker(&bigLock);
chatMessageFont = font;
}
void Settings::setWidgetData(const QString& uniqueName, const QByteArray& data)
{
QMutexLocker locker{&bigLock};

View File

@ -21,6 +21,7 @@
#ifndef SETTINGS_HPP
#define SETTINGS_HPP
#include <QFont>
#include <QHash>
#include <QObject>
#include <QPixmap>
@ -224,6 +225,9 @@ public:
void setGlobalAutoAcceptDir(const QString& dir);
// ChatView
const QFont& getChatMessageFont() const;
void setChatMessageFont(const QFont& font);
int getFirstColumnHandlePos() const;
void setFirstColumnHandlePos(const int pos);
@ -415,6 +419,7 @@ private:
bool showSystemTray;
// ChatView
QFont chatMessageFont;
MarkdownType markdownPreference;
int firstColumnHandlePos;
int secondColumnHandlePosFromRight;