This commit is contained in:
defnax 2025-07-17 17:27:36 +02:00 committed by GitHub
commit 8a27ed056f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 256 additions and 83 deletions

View file

@ -122,6 +122,8 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
ui->hashGroupBox->hide(); ui->hashGroupBox->hide();
mForumFontSizeHandler.registerFontSize(ui->forumMessage);
#ifndef ENABLE_GENERATE #ifndef ENABLE_GENERATE
ui->generateCheckBox->hide(); ui->generateCheckBox->hide();
ui->generateSpinBox->hide(); ui->generateSpinBox->hide();

View file

@ -26,6 +26,7 @@
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <retroshare/rsgxscircles.h> #include <retroshare/rsgxscircles.h>
#include "gui/common/HashBox.h" #include "gui/common/HashBox.h"
#include "util/FontSizeHandler.h"
namespace Ui { namespace Ui {
class CreateGxsForumMsg; class CreateGxsForumMsg;
@ -84,6 +85,8 @@ private:
UIStateHelper *mStateHelper; UIStateHelper *mStateHelper;
MessageFontSizeHandler mForumFontSizeHandler;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::CreateGxsForumMsg *ui; Ui::CreateGxsForumMsg *ui;
}; };

View file

@ -299,6 +299,9 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
connect(ui->nextUnreadButton, SIGNAL(clicked()), this, SLOT(nextUnreadMessage())); connect(ui->nextUnreadButton, SIGNAL(clicked()), this, SLOT(nextUnreadMessage()));
connect(ui->downloadButton, SIGNAL(clicked()), this, SLOT(downloadAllFiles())); connect(ui->downloadButton, SIGNAL(clicked()), this, SLOT(downloadAllFiles()));
connect(ui->zoomInButton, SIGNAL(clicked()), this, SLOT(zoom_In()));
connect(ui->zoomOutButton, SIGNAL(clicked()), this, SLOT(zoom_Out()));
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString))); connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
connect(ui->filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int))); connect(ui->filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
@ -380,6 +383,8 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
mFontSizeHandler.registerFontSize(ui->threadTreeWidget, 1.4f, [this](QAbstractItemView *view, int) { mFontSizeHandler.registerFontSize(ui->threadTreeWidget, 1.4f, [this](QAbstractItemView *view, int) {
mThreadModel->setFont(view->font()); mThreadModel->setFont(view->font());
}); });
mForumSizeHandler.registerFontSize(ui->postText);
} }
void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event) void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
@ -2099,3 +2104,14 @@ void GxsForumThreadWidget::showAuthorInPeople(const RsGxsForumMsg& msg)
MainWindow::showWindow(MainWindow::People); MainWindow::showWindow(MainWindow::People);
idDialog->navigate(RsGxsId(msg.mMeta.mAuthorId)); idDialog->navigate(RsGxsId(msg.mMeta.mAuthorId));
} }
void GxsForumThreadWidget::zoom_In()
{
ui->postText->zoomIn(1);
}
void GxsForumThreadWidget::zoom_Out()
{
ui->postText->zoomOut(1);
}

View file

@ -161,6 +161,9 @@ private slots:
void filterColumnChanged(int column); void filterColumnChanged(int column);
void filterItems(const QString &text); void filterItems(const QString &text);
void zoom_In();
void zoom_Out();
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
void expandSubtree(); void expandSubtree();
#endif #endif
@ -236,6 +239,7 @@ private:
QList<RsGxsMessageId> mSavedExpandedMessages; QList<RsGxsMessageId> mSavedExpandedMessages;
FontSizeHandler mFontSizeHandler; FontSizeHandler mFontSizeHandler;
ForumFontSizeHandler mForumSizeHandler;
Ui::GxsForumThreadWidget *ui; Ui::GxsForumThreadWidget *ui;
RsEventsHandlerId_t mEventHandlerId; RsEventsHandlerId_t mEventHandlerId;

View file

@ -302,6 +302,63 @@
</item> </item>
<item> <item>
<layout class="QGridLayout" name="postLayout"> <layout class="QGridLayout" name="postLayout">
<item row="0" column="9">
<widget class="Line" name="lineRight">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="15">
<widget class="QPushButton" name="expandButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="14">
<widget class="QToolButton" name="zoomInButton">
<property name="toolTip">
<string>Zoom in</string>
</property>
<property name="text">
<string>+</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/zoom-in.png</normaloff>:/icons/zoom-in.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="GxsIdLabel" name="by_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QToolButton" name="newmessageButton"> <widget class="QToolButton" name="newmessageButton">
<property name="maximumSize"> <property name="maximumSize">
@ -331,6 +388,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="7">
<widget class="QLabel" name="time_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QToolButton" name="previousButton"> <widget class="QToolButton" name="previousButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -369,6 +433,42 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5">
<widget class="QToolButton" name="downloadButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all files</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="Line" name="lineLeft">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="RSComboBox" name="versions_CB"/>
</item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QToolButton" name="nextButton"> <widget class="QToolButton" name="nextButton">
<property name="enabled"> <property name="enabled">
@ -433,70 +533,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5">
<widget class="QToolButton" name="downloadButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all files</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="Line" name="lineLeft">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="time_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="RSComboBox" name="versions_CB"/>
</item>
<item row="0" column="9">
<widget class="Line" name="lineRight">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QLabel" name="by_text_label">
<property name="text">
<string>By </string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="GxsIdLabel" name="by_label">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="12"> <item row="0" column="12">
<spacer name="postHSpacer"> <spacer name="postHSpacer">
<property name="orientation"> <property name="orientation">
@ -510,28 +546,26 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="13"> <item row="0" column="10">
<widget class="QPushButton" name="expandButton"> <widget class="QLabel" name="by_text_label">
<property name="maximumSize"> <property name="text">
<size> <string>By </string>
<width>24</width>
<height>24</height>
</size>
</property> </property>
<property name="focusPolicy"> </widget>
<enum>Qt::NoFocus</enum> </item>
<item row="0" column="13">
<widget class="QToolButton" name="zoomOutButton">
<property name="toolTip">
<string>Zoom out</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>-</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset> <normaloff>:/icons/zoom-out.png</normaloff>:/icons/zoom-out.png</iconset>
</property> </property>
<property name="checkable"> <property name="autoRaise">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>

View file

@ -383,5 +383,7 @@
<file>icons/filetype/dll.svg</file> <file>icons/filetype/dll.svg</file>
<file>icons/filetype/collection.svg</file> <file>icons/filetype/collection.svg</file>
<file>icons/filetype/patch.svg</file> <file>icons/filetype/patch.svg</file>
<file>icons/zoom-in.png</file>
<file>icons/zoom-out.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

@ -18,9 +18,12 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include <QFontDatabase>
#include "ForumPage.h" #include "ForumPage.h"
#include "util/misc.h" #include "util/misc.h"
#include "rsharesettings.h" #include "rsharesettings.h"
#include "gui/notifyqt.h"
ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags) ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags)
: ConfigPage(parent, flags) : ConfigPage(parent, flags)
@ -38,6 +41,14 @@ ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.minimumFontSize , SIGNAL(valueChanged(int)), this, SLOT(updateFonts())); connect(ui.minimumFontSize , SIGNAL(valueChanged(int)), this, SLOT(updateFonts()));
connect(ui.minimumContrast , SIGNAL(valueChanged(int)), this, SLOT(updateFonts())); connect(ui.minimumContrast , SIGNAL(valueChanged(int)), this, SLOT(updateFonts()));
// Font size
QFontDatabase db;
foreach(int size, db.standardSizes()) {
ui.minFontSize->addItem(QString::number(size), size);
}
connect(ui.minFontSize, SIGNAL(activated(QString)), this, SLOT(updateFonts())) ;
ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Forum) ; ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Forum) ;
} }
@ -61,6 +72,8 @@ void ForumPage::load()
whileBlocking(ui.minimumFontSize)->setValue(Settings->value("MinimumFontSize", 10).toInt()); whileBlocking(ui.minimumFontSize)->setValue(Settings->value("MinimumFontSize", 10).toInt());
whileBlocking(ui.minimumContrast)->setValue(Settings->value("MinimumContrast", 4.5).toDouble()); whileBlocking(ui.minimumContrast)->setValue(Settings->value("MinimumContrast", 4.5).toDouble());
Settings->endGroup(); Settings->endGroup();
whileBlocking(ui.minFontSize)->setCurrentIndex(ui.minFontSize->findData(Settings->getForumFontSize()));
ui.groupFrameSettingsWidget->loadSettings(GroupFrameSettings::Forum); ui.groupFrameSettingsWidget->loadSettings(GroupFrameSettings::Forum);
} }
@ -71,4 +84,7 @@ void ForumPage::updateFonts()
Settings->setValue("MinimumFontSize", ui.minimumFontSize->value()); Settings->setValue("MinimumFontSize", ui.minimumFontSize->value());
Settings->setValue("MinimumContrast", ui.minimumContrast->value()); Settings->setValue("MinimumContrast", ui.minimumContrast->value());
Settings->endGroup(); Settings->endGroup();
Settings->setForumFontSize(ui.minFontSize->currentData().toInt());
NotifyQt::getInstance()->notifySettingsChanged();
} }

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>507</width> <width>507</width>
<height>340</height> <height>406</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
@ -106,6 +106,67 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Fonts</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="minimumFontSizeHLayout">
<item>
<widget class="QLabel" name="minimumFontSizeLabel_2">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Minimum font size </string>
</property>
</widget>
</item>
<item>
<widget class="RSComboBox" name="minFontSize">
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>10</pointsize>
</font>
</property>
<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>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="tabsGroupBox"> <widget class="QGroupBox" name="tabsGroupBox">
<property name="title"> <property name="title">
<string>Tabs</string> <string>Tabs</string>
@ -117,7 +178,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -133,6 +194,11 @@
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget> <customwidget>
<class>GroupFrameSettingsWidget</class> <class>GroupFrameSettingsWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>

View file

@ -1222,6 +1222,22 @@ void RshareSettings::setMessageFontSize(int value)
setValueToGroup("Message", "FontSize", value); setValueToGroup("Message", "FontSize", value);
} }
int RshareSettings::getForumFontSize()
{
#if defined(Q_OS_DARWIN)
int defaultFontSize = 12;
#else
int defaultFontSize = 11;
#endif
return valueFromGroup("Forum", "FontSize", defaultFontSize).toInt();
}
void RshareSettings::setForumFontSize(int value)
{
setValueToGroup("Forum", "FontSize", value);
}
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
bool RshareSettings::getJsonApiEnabled() bool RshareSettings::getJsonApiEnabled()
{ {

View file

@ -349,6 +349,9 @@ public:
int getMessageFontSize(); int getMessageFontSize();
void setMessageFontSize(int value); void setMessageFontSize(int value);
int getForumFontSize();
void setForumFontSize(int value);
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
bool getJsonApiEnabled(); bool getJsonApiEnabled();
void setJsonApiEnabled(bool enabled); void setJsonApiEnabled(bool enabled);

View file

@ -136,6 +136,9 @@ int FontSizeHandlerBase::getFontSize()
case MESSAGE_FONT_SIZE: case MESSAGE_FONT_SIZE:
return Settings->getMessageFontSize(); return Settings->getMessageFontSize();
case FORUM_FONT_SIZE:
return Settings->getForumFontSize();
} }
return 0; return 0;

View file

@ -46,7 +46,8 @@ public:
protected: protected:
enum Type { enum Type {
FONT_SIZE, FONT_SIZE,
MESSAGE_FONT_SIZE MESSAGE_FONT_SIZE,
FORUM_FONT_SIZE
}; };
FontSizeHandlerBase(Type type); FontSizeHandlerBase(Type type);
@ -70,4 +71,11 @@ public:
MessageFontSizeHandler() : FontSizeHandlerBase(MESSAGE_FONT_SIZE) {} MessageFontSizeHandler() : FontSizeHandlerBase(MESSAGE_FONT_SIZE) {}
}; };
// Class to handle forum font size setting
class ForumFontSizeHandler : public FontSizeHandlerBase
{
public:
ForumFontSizeHandler() : FontSizeHandlerBase(FORUM_FONT_SIZE) {}
};
#endif // FONTSIZEHANDLER #endif // FONTSIZEHANDLER