mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-16 05:23:07 -04:00
Added set and get of font size on RshareSettings
This commit is contained in:
parent
95ea588c9f
commit
cab91819d6
retroshare-gui/src/gui/settings
@ -362,20 +362,12 @@ void AppearancePage::load()
|
||||
whileBlocking(ui.checkBoxShowToasterDisable)->setChecked(Settings->valueFromGroup("StatusBar", "ShowToaster", QVariant(true)).toBool());
|
||||
whileBlocking(ui.checkBoxShowSystrayOnStatus)->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool());
|
||||
|
||||
Settings->beginGroup(QString("File"));
|
||||
#if defined(Q_OS_DARWIN)
|
||||
whileBlocking(ui.minimumFontSize_SB)->setValue( Settings->value("MinimumFontSize", 13 ).toInt());
|
||||
#else
|
||||
whileBlocking(ui.minimumFontSize_SB)->setValue( Settings->value("MinimumFontSize", 11 ).toInt());
|
||||
#endif
|
||||
Settings->endGroup();
|
||||
whileBlocking(ui.minimumFontSize_SB)->setValue(Settings->getFontSize());
|
||||
}
|
||||
|
||||
void AppearancePage::updateFontSize()
|
||||
{
|
||||
Settings->beginGroup(QString("File"));
|
||||
Settings->setValue("MinimumFontSize", ui.minimumFontSize_SB->value());
|
||||
Settings->endGroup();
|
||||
|
||||
Settings->setFontSize(ui.minimumFontSize_SB->value());
|
||||
|
||||
NotifyQt::getInstance()->notifySettingsChanged();
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,7 @@
|
||||
<item>
|
||||
<widget class="QSpinBox" name="minimumFontSize_SB">
|
||||
<property name="minimum">
|
||||
<number>11</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
|
@ -18,6 +18,8 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QFontDatabase>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "rsharesettings.h"
|
||||
#include "retroshare/rsmsgs.h"
|
||||
@ -28,6 +30,7 @@
|
||||
#include <algorithm>
|
||||
#include "NewTag.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
@ -48,14 +51,20 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
|
||||
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
|
||||
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
|
||||
|
||||
|
||||
// Font size
|
||||
QFontDatabase db;
|
||||
foreach(int size, db.standardSizes()) {
|
||||
ui.minimumFontSize->addItem(QString::number(size), size);
|
||||
}
|
||||
|
||||
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantMsgsComboBoxChanged(int)));
|
||||
|
||||
connect(ui.setMsgToReadOnActivate,SIGNAL(toggled(bool)), this,SLOT(updateMsgToReadOnActivate()));
|
||||
connect(ui.loadEmbeddedImages, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmbededImages() ));
|
||||
connect(ui.openComboBox, SIGNAL(currentIndexChanged(int)),this,SLOT(updateMsgOpen() ));
|
||||
connect(ui.emoticonscheckBox, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmoticons() ));
|
||||
connect(ui.minimumFontSize_SB, SIGNAL(valueChanged(int)), this, SLOT(updateFontSize())) ;
|
||||
connect(ui.minimumFontSize, SIGNAL(activated(QString)), this, SLOT(updateFontSize())) ;
|
||||
|
||||
mTagEventHandlerId = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mTagEventHandlerId, RsEventType::MAIL_TAG );
|
||||
@ -117,17 +126,11 @@ void MessagePage::updateMsgTags()
|
||||
void
|
||||
MessagePage::load()
|
||||
{
|
||||
Settings->beginGroup(QString("Messages"));
|
||||
whileBlocking(ui.setMsgToReadOnActivate)->setChecked(Settings->getMsgSetToReadOnActivate());
|
||||
whileBlocking(ui.loadEmbeddedImages)->setChecked(Settings->getMsgLoadEmbeddedImages());
|
||||
whileBlocking(ui.openComboBox)->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
|
||||
whileBlocking(ui.emoticonscheckBox)->setChecked(Settings->value("Emoticons", true).toBool());
|
||||
#if defined(Q_OS_DARWIN)
|
||||
whileBlocking(ui.minimumFontSize_SB)->setValue( Settings->value("MinimumFontSize", 13 ).toInt());
|
||||
#else
|
||||
whileBlocking(ui.minimumFontSize_SB)->setValue( Settings->value("MinimumFontSize", 12 ).toInt());
|
||||
#endif
|
||||
Settings->endGroup();
|
||||
whileBlocking(ui.minimumFontSize)->setCurrentIndex(ui.minimumFontSize->findData(Settings->getMessageFontSize()));
|
||||
|
||||
// state of filter combobox
|
||||
|
||||
@ -306,8 +309,7 @@ void MessagePage::currentRowChangedTag(int row)
|
||||
|
||||
void MessagePage::updateFontSize()
|
||||
{
|
||||
Settings->beginGroup(QString("Messages"));
|
||||
Settings->setValue("MinimumFontSize", ui.minimumFontSize_SB->value());
|
||||
Settings->endGroup();
|
||||
}
|
||||
Settings->setMessageFontSize(ui.minimumFontSize->currentData().toInt());
|
||||
|
||||
NotifyQt::getInstance()->notifySettingsChanged();
|
||||
}
|
||||
|
@ -203,12 +203,21 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="minimumFontSize_SB">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
<widget class="RSComboBox" name="minimumFontSize">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>MS Sans Serif</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Font size</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1190,6 +1190,38 @@ void RshareSettings::setPageAlreadyDisplayed(const QString& page_name,bool b)
|
||||
return setValueToGroup("PageAlreadyDisplayed",page_name,b);
|
||||
}
|
||||
|
||||
int RshareSettings::getFontSize()
|
||||
{
|
||||
#if defined(Q_OS_DARWIN)
|
||||
int defaultFontSize = 13;
|
||||
#else
|
||||
int defaultFontSize = 9;
|
||||
#endif
|
||||
|
||||
return value("FontSize", defaultFontSize).toInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setFontSize(int value)
|
||||
{
|
||||
setValue("FontSize", value);
|
||||
}
|
||||
|
||||
int RshareSettings::getMessageFontSize()
|
||||
{
|
||||
#if defined(Q_OS_DARWIN)
|
||||
int defaultFontSize = 12;
|
||||
#else
|
||||
int defaultFontSize = 9;
|
||||
#endif
|
||||
|
||||
return valueFromGroup("Message", "FontSize", defaultFontSize).toInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setMessageFontSize(int value)
|
||||
{
|
||||
setValueToGroup("Message", "FontSize", value);
|
||||
}
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
bool RshareSettings::getJsonApiEnabled()
|
||||
{
|
||||
|
@ -343,6 +343,12 @@ public:
|
||||
bool getPageAlreadyDisplayed(const QString& page_code) ;
|
||||
void setPageAlreadyDisplayed(const QString& page_code,bool b) ;
|
||||
|
||||
int getFontSize();
|
||||
void setFontSize(int value);
|
||||
|
||||
int getMessageFontSize();
|
||||
void setMessageFontSize(int value);
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
bool getJsonApiEnabled();
|
||||
void setJsonApiEnabled(bool enabled);
|
||||
|
Loading…
x
Reference in New Issue
Block a user