Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat(chat): add settings to alter the chat view's base font
Browse files Browse the repository at this point in the history
Defaults to GUI style font according to previous behavior.
  • Loading branch information
antis81 committed Jun 30, 2016
1 parent d408cb5 commit 8ba2054
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/persistence/settings.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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};
Expand Down
5 changes: 5 additions & 0 deletions src/persistence/settings.h
Expand Up @@ -21,6 +21,7 @@
#ifndef SETTINGS_HPP
#define SETTINGS_HPP

#include <QFont>
#include <QHash>
#include <QObject>
#include <QPixmap>
Expand Down Expand Up @@ -224,6 +225,9 @@ public slots:
void setGlobalAutoAcceptDir(const QString& dir);

// ChatView
const QFont& getChatMessageFont() const;
void setChatMessageFont(const QFont& font);

int getFirstColumnHandlePos() const;
void setFirstColumnHandlePos(const int pos);

Expand Down Expand Up @@ -415,6 +419,7 @@ private slots:
bool showSystemTray;

// ChatView
QFont chatMessageFont;
MarkdownType markdownPreference;
int firstColumnHandlePos;
int secondColumnHandlePosFromRight;
Expand Down

0 comments on commit 8ba2054

Please sign in to comment.