diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.cpp b/retroshare-gui/src/gui/ChatLobbyWidget.cpp index 9682bc4c5..75894fea1 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.cpp +++ b/retroshare-gui/src/gui/ChatLobbyWidget.cpp @@ -230,6 +230,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags) int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height(); ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH)); + updateFontSize(); } ChatLobbyWidget::~ChatLobbyWidget() @@ -1368,3 +1369,25 @@ int ChatLobbyWidget::getNumColVisible() } 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); + } +} diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.h b/retroshare-gui/src/gui/ChatLobbyWidget.h index a5055788e..ce451fe04 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.h +++ b/retroshare-gui/src/gui/ChatLobbyWidget.h @@ -76,6 +76,8 @@ public: uint unreadCount(); + virtual void showEvent(QShowEvent *) ; + signals: void unreadCountChanged(uint unreadCount); @@ -112,6 +114,7 @@ private slots: void updateNotify(ChatLobbyId id, unsigned int count) ; void idChooserCurrentIndexChanged(int index); + void updateFontSize(); private: void autoSubscribeLobby(QTreeWidgetItem *item); diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 032acaa2d..8a099aac8 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -956,6 +956,10 @@ void IdDialog::showEvent(QShowEvent *s) needUpdateCirclesOnNextShow = false; MainPage::showEvent(s); + + if (!s->spontaneous()) { + updateFontSize(); + } } void IdDialog::createExternalCircle() @@ -2599,3 +2603,19 @@ void IdDialog::restoreExpandedCircleItems(const std::vector& expanded_root restoreTopLevel(mExternalOtherCircleItem,1); 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); + } +} diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index 403b3a437..ea6095d63 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -113,6 +113,8 @@ private slots: static QString inviteMessage(); void sendInvite(); + void updateFontSize(); + private: void processSettings(bool load); QString createUsageString(const RsIdentityUsage& u) const; diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index b1e4b1e69..0eb5b69c9 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -67,6 +67,7 @@ #include "notifyqt.h" #include "common/UserNotify.h" #include "gui/ServicePermissionDialog.h" +#include "gui/settings/rsharesettings.h" #ifdef UNFINISHED #include "unfinished/ApplicationWindow.h" @@ -1022,6 +1023,7 @@ void SetForegroundWindowInternal(HWND hWnd) /* Show the dialog. */ raiseWindow(); + /* Set the focus to the specified page. */ _instance->ui->stackPages->setCurrentPage(page); } @@ -1819,6 +1821,31 @@ void MainWindow::setCompactStatusMode(bool compact) //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) { diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index a7f3013f1..99219de42 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -204,6 +204,8 @@ public: static bool hiddenmode; + virtual void showEvent(QShowEvent *) ; + public slots: void receiveNewArgs(QStringList args); void displayErrorMessage(int,int,const QString&) ; @@ -307,6 +309,7 @@ private slots: void doQuit(); void updateTrayCombine(); + void updateFontSize(); private: void initStackedPage(); diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 3b92883e8..56feb5f2f 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -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. 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); + } +} diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index 065abacee..7df0f01b9 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h @@ -54,6 +54,8 @@ public: inline bool isWindowed() const { return dynamic_cast(this->window()) != nullptr; } + virtual void showEvent(QShowEvent *) ; + public slots: void leaveLobby() ; private slots: @@ -64,6 +66,7 @@ private slots: void showInPeopleTab(); void toggleWindowed(){setWindowed(!isWindowed());} void setWindowed(bool windowed); + void updateFontSize(); signals: void typingEventReceived(ChatLobbyId) ; diff --git a/retroshare-gui/src/gui/common/NewFriendList.cpp b/retroshare-gui/src/gui/common/NewFriendList.cpp index 6acb8da9a..9e5039f76 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.cpp +++ b/retroshare-gui/src/gui/common/NewFriendList.cpp @@ -55,6 +55,7 @@ #include "gui/connect/ConnectProgressDialog.h" #include "gui/common/ElidedLabel.h" #include "gui/notifyqt.h" +#include "gui/settings/rsharesettings.h" #include "NewFriendList.h" #include "ui_NewFriendList.h" @@ -1693,3 +1694,27 @@ void NewFriendList::expandGroup(const RsNodeGroupId& gid) QModelIndex index = mProxyModel->mapFromSource(mModel->getIndexOfGroup(gid)); 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)); + } +} diff --git a/retroshare-gui/src/gui/common/NewFriendList.h b/retroshare-gui/src/gui/common/NewFriendList.h index 7424bcfcf..4679b7804 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.h +++ b/retroshare-gui/src/gui/common/NewFriendList.h @@ -54,6 +54,8 @@ public: explicit NewFriendList(QWidget *parent = 0); ~NewFriendList(); + virtual void showEvent(QShowEvent *) ; + // Add a tool button to the tool area void addToolButton(QToolButton *toolButton); void processSettings(bool load); @@ -95,6 +97,7 @@ private slots: void sortColumn(int col,Qt::SortOrder so); void itemExpanded(const QModelIndex&); void itemCollapsed(const QModelIndex&); + void updateFontSize(); protected: void changeEvent(QEvent *e); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 069c51b79..a4789b7d9 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -193,6 +193,9 @@ void GxsGroupFrameDialog::showEvent(QShowEvent* /*event*/) bool empty = mCachedGroupMetas.empty() || children==0; updateDisplay( empty ); + + updateFontSize(); + } void GxsGroupFrameDialog::paintEvent(QPaintEvent *pe) @@ -1274,3 +1277,19 @@ void GxsGroupFrameDialog::distantRequestGroupData() 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); + } +} + + diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 81bba553d..a70e6c890 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -110,7 +110,8 @@ protected: void updateGroupStatisticsReal(const RsGxsGroupId &groupId); void updateMessageSummaryListReal(RsGxsGroupId groupId); - + void updateFontSize(); + private slots: void todo(); diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index 85611b585..5cf408267 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -1660,3 +1660,28 @@ void MessagesDialog::updateInterface() 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); + } +} + diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.h b/retroshare-gui/src/gui/msgs/MessagesDialog.h index 1d10137c2..753f910dd 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.h +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.h @@ -54,6 +54,7 @@ public: // replaced by shortcut // virtual void keyPressEvent(QKeyEvent *) ; + virtual void showEvent(QShowEvent *) ; QColor textColorInbox() const { return mTextColorInbox; } @@ -110,6 +111,8 @@ private slots: void tabChanged(int tab); void tabCloseRequested(int tab); + void updateFontSize(); + private: void handleEvent_main_thread(std::shared_ptr event); void handleTagEvent_main_thread(std::shared_ptr event);