mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-20 05:11:02 -04:00
Merge cdf205ac8a
into f3150e9d42
This commit is contained in:
commit
8a27ed056f
14 changed files with 256 additions and 83 deletions
|
@ -122,6 +122,8 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
|
|||
|
||||
ui->hashGroupBox->hide();
|
||||
|
||||
mForumFontSizeHandler.registerFontSize(ui->forumMessage);
|
||||
|
||||
#ifndef ENABLE_GENERATE
|
||||
ui->generateCheckBox->hide();
|
||||
ui->generateSpinBox->hide();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <retroshare/rsgxsforums.h>
|
||||
#include <retroshare/rsgxscircles.h>
|
||||
#include "gui/common/HashBox.h"
|
||||
#include "util/FontSizeHandler.h"
|
||||
|
||||
namespace Ui {
|
||||
class CreateGxsForumMsg;
|
||||
|
@ -84,6 +85,8 @@ private:
|
|||
|
||||
UIStateHelper *mStateHelper;
|
||||
|
||||
MessageFontSizeHandler mForumFontSizeHandler;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateGxsForumMsg *ui;
|
||||
};
|
||||
|
|
|
@ -299,6 +299,9 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||
connect(ui->nextUnreadButton, SIGNAL(clicked()), this, SLOT(nextUnreadMessage()));
|
||||
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(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) {
|
||||
mThreadModel->setFont(view->font());
|
||||
});
|
||||
|
||||
mForumSizeHandler.registerFontSize(ui->postText);
|
||||
}
|
||||
|
||||
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);
|
||||
idDialog->navigate(RsGxsId(msg.mMeta.mAuthorId));
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::zoom_In()
|
||||
{
|
||||
ui->postText->zoomIn(1);
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::zoom_Out()
|
||||
{
|
||||
ui->postText->zoomOut(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,9 @@ private slots:
|
|||
void filterColumnChanged(int column);
|
||||
void filterItems(const QString &text);
|
||||
|
||||
void zoom_In();
|
||||
void zoom_Out();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
void expandSubtree();
|
||||
#endif
|
||||
|
@ -236,6 +239,7 @@ private:
|
|||
QList<RsGxsMessageId> mSavedExpandedMessages;
|
||||
|
||||
FontSizeHandler mFontSizeHandler;
|
||||
ForumFontSizeHandler mForumSizeHandler;
|
||||
|
||||
Ui::GxsForumThreadWidget *ui;
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
|
|
|
@ -302,6 +302,63 @@
|
|||
</item>
|
||||
<item>
|
||||
<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">
|
||||
<widget class="QToolButton" name="newmessageButton">
|
||||
<property name="maximumSize">
|
||||
|
@ -331,6 +388,13 @@
|
|||
</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="2">
|
||||
<widget class="QToolButton" name="previousButton">
|
||||
<property name="sizePolicy">
|
||||
|
@ -369,6 +433,42 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="QToolButton" name="nextButton">
|
||||
<property name="enabled">
|
||||
|
@ -433,70 +533,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<spacer name="postHSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -510,28 +546,26 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="13">
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
<item row="0" column="10">
|
||||
<widget class="QLabel" name="by_text_label">
|
||||
<property name="text">
|
||||
<string>By </string>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="13">
|
||||
<widget class="QToolButton" name="zoomOutButton">
|
||||
<property name="toolTip">
|
||||
<string>Zoom out</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/zoom-out.png</normaloff>:/icons/zoom-out.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
|
@ -383,5 +383,7 @@
|
|||
<file>icons/filetype/dll.svg</file>
|
||||
<file>icons/filetype/collection.svg</file>
|
||||
<file>icons/filetype/patch.svg</file>
|
||||
<file>icons/zoom-in.png</file>
|
||||
<file>icons/zoom-out.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
retroshare-gui/src/gui/icons/zoom-in.png
Normal file
BIN
retroshare-gui/src/gui/icons/zoom-in.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
retroshare-gui/src/gui/icons/zoom-out.png
Normal file
BIN
retroshare-gui/src/gui/icons/zoom-out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -18,9 +18,12 @@
|
|||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QFontDatabase>
|
||||
|
||||
#include "ForumPage.h"
|
||||
#include "util/misc.h"
|
||||
#include "rsharesettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags 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.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) ;
|
||||
}
|
||||
|
||||
|
@ -61,6 +72,8 @@ void ForumPage::load()
|
|||
whileBlocking(ui.minimumFontSize)->setValue(Settings->value("MinimumFontSize", 10).toInt());
|
||||
whileBlocking(ui.minimumContrast)->setValue(Settings->value("MinimumContrast", 4.5).toDouble());
|
||||
Settings->endGroup();
|
||||
whileBlocking(ui.minFontSize)->setCurrentIndex(ui.minFontSize->findData(Settings->getForumFontSize()));
|
||||
|
||||
|
||||
ui.groupFrameSettingsWidget->loadSettings(GroupFrameSettings::Forum);
|
||||
}
|
||||
|
@ -71,4 +84,7 @@ void ForumPage::updateFonts()
|
|||
Settings->setValue("MinimumFontSize", ui.minimumFontSize->value());
|
||||
Settings->setValue("MinimumContrast", ui.minimumContrast->value());
|
||||
Settings->endGroup();
|
||||
Settings->setForumFontSize(ui.minFontSize->currentData().toInt());
|
||||
|
||||
NotifyQt::getInstance()->notifySettingsChanged();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>507</width>
|
||||
<height>340</height>
|
||||
<height>406</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
|
@ -106,6 +106,67 @@
|
|||
</widget>
|
||||
</item>
|
||||
<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">
|
||||
<property name="title">
|
||||
<string>Tabs</string>
|
||||
|
@ -117,7 +178,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -133,6 +194,11 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RSComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/common/RSComboBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GroupFrameSettingsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
|
|
|
@ -1222,6 +1222,22 @@ void RshareSettings::setMessageFontSize(int 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
|
||||
bool RshareSettings::getJsonApiEnabled()
|
||||
{
|
||||
|
|
|
@ -349,6 +349,9 @@ public:
|
|||
int getMessageFontSize();
|
||||
void setMessageFontSize(int value);
|
||||
|
||||
int getForumFontSize();
|
||||
void setForumFontSize(int value);
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
bool getJsonApiEnabled();
|
||||
void setJsonApiEnabled(bool enabled);
|
||||
|
|
|
@ -136,6 +136,9 @@ int FontSizeHandlerBase::getFontSize()
|
|||
|
||||
case MESSAGE_FONT_SIZE:
|
||||
return Settings->getMessageFontSize();
|
||||
|
||||
case FORUM_FONT_SIZE:
|
||||
return Settings->getForumFontSize();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -46,7 +46,8 @@ public:
|
|||
protected:
|
||||
enum Type {
|
||||
FONT_SIZE,
|
||||
MESSAGE_FONT_SIZE
|
||||
MESSAGE_FONT_SIZE,
|
||||
FORUM_FONT_SIZE
|
||||
};
|
||||
|
||||
FontSizeHandlerBase(Type type);
|
||||
|
@ -70,4 +71,11 @@ public:
|
|||
MessageFontSizeHandler() : FontSizeHandlerBase(MESSAGE_FONT_SIZE) {}
|
||||
};
|
||||
|
||||
// Class to handle forum font size setting
|
||||
class ForumFontSizeHandler : public FontSizeHandlerBase
|
||||
{
|
||||
public:
|
||||
ForumFontSizeHandler() : FontSizeHandlerBase(FORUM_FONT_SIZE) {}
|
||||
};
|
||||
|
||||
#endif // FONTSIZEHANDLER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue