Settings for default tree & listwidget fonts

This commit is contained in:
defnax 2025-02-05 20:55:03 +01:00
parent 8fcc52b304
commit e14fc66ca3
14 changed files with 180 additions and 1 deletions

View file

@ -230,6 +230,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height(); int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height();
ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH)); ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH));
updateFontSize();
} }
ChatLobbyWidget::~ChatLobbyWidget() ChatLobbyWidget::~ChatLobbyWidget()
@ -1368,3 +1369,25 @@ int ChatLobbyWidget::getNumColVisible()
} }
return iNumColVis; return iNumColVis;
} }
void ChatLobbyWidget::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void ChatLobbyWidget::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui.lobbyTreeWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui.lobbyTreeWidget->setFont(newFont);
}
}

View file

@ -76,6 +76,8 @@ public:
uint unreadCount(); uint unreadCount();
virtual void showEvent(QShowEvent *) ;
signals: signals:
void unreadCountChanged(uint unreadCount); void unreadCountChanged(uint unreadCount);
@ -112,6 +114,7 @@ private slots:
void updateNotify(ChatLobbyId id, unsigned int count) ; void updateNotify(ChatLobbyId id, unsigned int count) ;
void idChooserCurrentIndexChanged(int index); void idChooserCurrentIndexChanged(int index);
void updateFontSize();
private: private:
void autoSubscribeLobby(QTreeWidgetItem *item); void autoSubscribeLobby(QTreeWidgetItem *item);

View file

@ -956,6 +956,10 @@ void IdDialog::showEvent(QShowEvent *s)
needUpdateCirclesOnNextShow = false; needUpdateCirclesOnNextShow = false;
MainPage::showEvent(s); MainPage::showEvent(s);
if (!s->spontaneous()) {
updateFontSize();
}
} }
void IdDialog::createExternalCircle() void IdDialog::createExternalCircle()
@ -2599,3 +2603,19 @@ void IdDialog::restoreExpandedCircleItems(const std::vector<bool>& expanded_root
restoreTopLevel(mExternalOtherCircleItem,1); restoreTopLevel(mExternalOtherCircleItem,1);
restoreTopLevel(mMyCircleItem,2); restoreTopLevel(mMyCircleItem,2);
} }
void IdDialog::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui->idTreeWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui->idTreeWidget->setFont(newFont);
ui->treeWidget_membership->setFont(newFont);
}
}

View file

@ -113,6 +113,8 @@ private slots:
static QString inviteMessage(); static QString inviteMessage();
void sendInvite(); void sendInvite();
void updateFontSize();
private: private:
void processSettings(bool load); void processSettings(bool load);
QString createUsageString(const RsIdentityUsage& u) const; QString createUsageString(const RsIdentityUsage& u) const;

View file

@ -67,6 +67,7 @@
#include "notifyqt.h" #include "notifyqt.h"
#include "common/UserNotify.h" #include "common/UserNotify.h"
#include "gui/ServicePermissionDialog.h" #include "gui/ServicePermissionDialog.h"
#include "gui/settings/rsharesettings.h"
#ifdef UNFINISHED #ifdef UNFINISHED
#include "unfinished/ApplicationWindow.h" #include "unfinished/ApplicationWindow.h"
@ -1022,6 +1023,7 @@ void SetForegroundWindowInternal(HWND hWnd)
/* Show the dialog. */ /* Show the dialog. */
raiseWindow(); raiseWindow();
/* Set the focus to the specified page. */ /* Set the focus to the specified page. */
_instance->ui->stackPages->setCurrentPage(page); _instance->ui->stackPages->setCurrentPage(page);
} }
@ -1819,6 +1821,31 @@ void MainWindow::setCompactStatusMode(bool compact)
//opModeStatus: TODO Show only ??? //opModeStatus: TODO Show only ???
} }
void MainWindow::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void MainWindow::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui->listWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
int iconHeight = fontMetrics.height()*1.5;
ui->listWidget->setFont(newFont);
ui->toolBarPage->setFont(newFont);
ui->listWidget->setIconSize(QSize(iconHeight, iconHeight));
}
}
Gui_InputDialogReturn MainWindow::guiInputDialog(const QString& windowTitle, const QString& labelText, QLineEdit::EchoMode textEchoMode, bool modal) Gui_InputDialogReturn MainWindow::guiInputDialog(const QString& windowTitle, const QString& labelText, QLineEdit::EchoMode textEchoMode, bool modal)
{ {

View file

@ -204,6 +204,8 @@ public:
static bool hiddenmode; static bool hiddenmode;
virtual void showEvent(QShowEvent *) ;
public slots: public slots:
void receiveNewArgs(QStringList args); void receiveNewArgs(QStringList args);
void displayErrorMessage(int,int,const QString&) ; void displayErrorMessage(int,int,const QString&) ;
@ -307,6 +309,7 @@ private slots:
void doQuit(); void doQuit();
void updateTrayCombine(); void updateTrayCombine();
void updateFontSize();
private: private:
void initStackedPage(); void initStackedPage();

View file

@ -1017,3 +1017,25 @@ void ChatLobbyDialog::setWindowed(bool windowed)
if (chatLobbyPage)// If not defined, we are on autosubscribe loop of lobby widget constructor. So don't recall it. if (chatLobbyPage)// If not defined, we are on autosubscribe loop of lobby widget constructor. So don't recall it.
showDialog(RS_CHAT_FOCUS); showDialog(RS_CHAT_FOCUS);
} }
void ChatLobbyDialog::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void ChatLobbyDialog::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui.participantsList->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui.participantsList->setFont(newFont);
}
}

View file

@ -54,6 +54,8 @@ public:
inline bool isWindowed() const { return dynamic_cast<PopupChatWindow*>(this->window()) != nullptr; } inline bool isWindowed() const { return dynamic_cast<PopupChatWindow*>(this->window()) != nullptr; }
virtual void showEvent(QShowEvent *) ;
public slots: public slots:
void leaveLobby() ; void leaveLobby() ;
private slots: private slots:
@ -64,6 +66,7 @@ private slots:
void showInPeopleTab(); void showInPeopleTab();
void toggleWindowed(){setWindowed(!isWindowed());} void toggleWindowed(){setWindowed(!isWindowed());}
void setWindowed(bool windowed); void setWindowed(bool windowed);
void updateFontSize();
signals: signals:
void typingEventReceived(ChatLobbyId) ; void typingEventReceived(ChatLobbyId) ;

View file

@ -55,6 +55,7 @@
#include "gui/connect/ConnectProgressDialog.h" #include "gui/connect/ConnectProgressDialog.h"
#include "gui/common/ElidedLabel.h" #include "gui/common/ElidedLabel.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/settings/rsharesettings.h"
#include "NewFriendList.h" #include "NewFriendList.h"
#include "ui_NewFriendList.h" #include "ui_NewFriendList.h"
@ -1693,3 +1694,27 @@ void NewFriendList::expandGroup(const RsNodeGroupId& gid)
QModelIndex index = mProxyModel->mapFromSource(mModel->getIndexOfGroup(gid)); QModelIndex index = mProxyModel->mapFromSource(mModel->getIndexOfGroup(gid));
ui->peerTreeWidget->setExpanded(index,true) ; ui->peerTreeWidget->setExpanded(index,true) ;
} }
void NewFriendList::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void NewFriendList::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui->peerTreeWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
int iconHeight = fontMetrics.height()*1.5;
ui->peerTreeWidget->setFont(newFont);
ui->peerTreeWidget->setIconSize(QSize(iconHeight, iconHeight));
}
}

View file

@ -54,6 +54,8 @@ public:
explicit NewFriendList(QWidget *parent = 0); explicit NewFriendList(QWidget *parent = 0);
~NewFriendList(); ~NewFriendList();
virtual void showEvent(QShowEvent *) ;
// Add a tool button to the tool area // Add a tool button to the tool area
void addToolButton(QToolButton *toolButton); void addToolButton(QToolButton *toolButton);
void processSettings(bool load); void processSettings(bool load);
@ -95,6 +97,7 @@ private slots:
void sortColumn(int col,Qt::SortOrder so); void sortColumn(int col,Qt::SortOrder so);
void itemExpanded(const QModelIndex&); void itemExpanded(const QModelIndex&);
void itemCollapsed(const QModelIndex&); void itemCollapsed(const QModelIndex&);
void updateFontSize();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);

View file

@ -193,6 +193,9 @@ void GxsGroupFrameDialog::showEvent(QShowEvent* /*event*/)
bool empty = mCachedGroupMetas.empty() || children==0; bool empty = mCachedGroupMetas.empty() || children==0;
updateDisplay( empty ); updateDisplay( empty );
updateFontSize();
} }
void GxsGroupFrameDialog::paintEvent(QPaintEvent *pe) void GxsGroupFrameDialog::paintEvent(QPaintEvent *pe)
@ -1274,3 +1277,19 @@ void GxsGroupFrameDialog::distantRequestGroupData()
checkRequestGroup(group_id) ; checkRequestGroup(group_id) ;
} }
void GxsGroupFrameDialog::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui->groupTreeWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui->groupTreeWidget->setFont(newFont);
}
}

View file

@ -110,6 +110,7 @@ protected:
void updateGroupStatisticsReal(const RsGxsGroupId &groupId); void updateGroupStatisticsReal(const RsGxsGroupId &groupId);
void updateMessageSummaryListReal(RsGxsGroupId groupId); void updateMessageSummaryListReal(RsGxsGroupId groupId);
void updateFontSize();
private slots: private slots:
void todo(); void todo();

View file

@ -1660,3 +1660,28 @@ void MessagesDialog::updateInterface()
ui.tabWidget->setTabIcon(0, FilesDefs::getIconFromQtResourcePath(":/icons/warning_yellow_128.png")); ui.tabWidget->setTabIcon(0, FilesDefs::getIconFromQtResourcePath(":/icons/warning_yellow_128.png"));
} }
} }
void MessagesDialog::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void MessagesDialog::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui.listWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui.listWidget->setFont(newFont);
ui.quickViewWidget->setFont(newFont);
ui.messageTreeWidget->setFont(newFont);
}
}

View file

@ -54,6 +54,7 @@ public:
// replaced by shortcut // replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ; // virtual void keyPressEvent(QKeyEvent *) ;
virtual void showEvent(QShowEvent *) ;
QColor textColorInbox() const { return mTextColorInbox; } QColor textColorInbox() const { return mTextColorInbox; }
@ -110,6 +111,8 @@ private slots:
void tabChanged(int tab); void tabChanged(int tab);
void tabCloseRequested(int tab); void tabCloseRequested(int tab);
void updateFontSize();
private: private:
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
void handleTagEvent_main_thread(std::shared_ptr<const RsEvent> event); void handleTagEvent_main_thread(std::shared_ptr<const RsEvent> event);