changeable toolbar icon size
This commit is contained in:
parent
682489a233
commit
fd1355e3c0
@ -347,8 +347,20 @@ void FeedMessageViewer::initializeViews() {
|
|||||||
|
|
||||||
void FeedMessageViewer::refreshVisualProperties() {
|
void FeedMessageViewer::refreshVisualProperties() {
|
||||||
const Qt::ToolButtonStyle button_style =
|
const Qt::ToolButtonStyle button_style =
|
||||||
static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::ToolbarStyle)).toInt());
|
static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(GROUP(GUI),
|
||||||
|
SETTING(GUI::ToolbarStyle)).toInt());
|
||||||
|
|
||||||
m_toolBarFeeds->setToolButtonStyle(button_style);
|
m_toolBarFeeds->setToolButtonStyle(button_style);
|
||||||
m_toolBarMessages->setToolButtonStyle(button_style);
|
m_toolBarMessages->setToolButtonStyle(button_style);
|
||||||
|
|
||||||
|
const int icon_size = qApp->settings()->value(GROUP(GUI), SETTING(GUI::ToolbarIconSize)).toInt();
|
||||||
|
|
||||||
|
if (icon_size > 0) {
|
||||||
|
m_toolBarFeeds->setIconSize({ icon_size, icon_size });
|
||||||
|
m_toolBarMessages->setIconSize({ icon_size, icon_size });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_toolBarFeeds->setIconSize({ qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize),
|
||||||
|
qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize) });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,16 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
|
|||||||
connect(m_ui->m_cmbSelectToolBar, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_ui->m_stackedToolbars,
|
connect(m_ui->m_cmbSelectToolBar, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_ui->m_stackedToolbars,
|
||||||
&QStackedWidget::setCurrentIndex);
|
&QStackedWidget::setCurrentIndex);
|
||||||
connect(m_ui->m_gbCustomSkinColors, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings);
|
connect(m_ui->m_gbCustomSkinColors, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||||
|
connect(m_ui->m_spinToolbarIconSize, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsGui::dirtifySettings);
|
||||||
|
|
||||||
|
connect(m_ui->m_spinToolbarIconSize, QOverload<int>::of(&QSpinBox::valueChanged), this, [=](int value) {
|
||||||
|
if (value <= 0) {
|
||||||
|
m_ui->m_spinToolbarIconSize->setSuffix(QSL(" px ") + tr("= default icon size"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_ui->m_spinToolbarIconSize->setSuffix(QSL(" px"));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsGui::~SettingsGui() {
|
SettingsGui::~SettingsGui() {
|
||||||
@ -193,6 +203,7 @@ void SettingsGui::loadSettings() {
|
|||||||
m_ui->m_checkHideTabBarIfOneTabVisible->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool());
|
m_ui->m_checkHideTabBarIfOneTabVisible->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool());
|
||||||
|
|
||||||
// Load toolbar button style.
|
// Load toolbar button style.
|
||||||
|
m_ui->m_spinToolbarIconSize->setValue(settings()->value(GROUP(GUI), SETTING(GUI::ToolbarIconSize)).toInt());
|
||||||
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Icon only"), Qt::ToolButtonStyle::ToolButtonIconOnly);
|
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Icon only"), Qt::ToolButtonStyle::ToolButtonIconOnly);
|
||||||
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Text only"), Qt::ToolButtonStyle::ToolButtonTextOnly);
|
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Text only"), Qt::ToolButtonStyle::ToolButtonTextOnly);
|
||||||
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Text beside icon"), Qt::ToolButtonStyle::ToolButtonTextBesideIcon);
|
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Text beside icon"), Qt::ToolButtonStyle::ToolButtonTextBesideIcon);
|
||||||
@ -279,6 +290,8 @@ void SettingsGui::saveSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save toolbar.
|
// Save toolbar.
|
||||||
|
settings()->setValue(GROUP(GUI), GUI::ToolbarIconSize, m_ui->m_spinToolbarIconSize->value());
|
||||||
|
|
||||||
settings()->setValue(GROUP(GUI), GUI::ToolbarStyle,
|
settings()->setValue(GROUP(GUI), GUI::ToolbarStyle,
|
||||||
m_ui->m_cmbToolbarButtonStyle->itemData(m_ui->m_cmbToolbarButtonStyle->currentIndex()));
|
m_ui->m_cmbToolbarButtonStyle->itemData(m_ui->m_cmbToolbarButtonStyle->currentIndex()));
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="m_cmbToolbarButtonStyle"/>
|
<widget class="QComboBox" name="m_cmbToolbarButtonStyle"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="m_cmbSelectToolBar">
|
<widget class="QComboBox" name="m_cmbSelectToolBar">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -292,7 +292,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QStackedWidget" name="m_stackedToolbars">
|
<widget class="QStackedWidget" name="m_stackedToolbars">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
@ -365,23 +365,46 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Toolbar button style</string>
|
<string>Button style</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>m_cmbToolbarButtonStyle</cstring>
|
<cstring>m_cmbToolbarButtonStyle</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select toolbar to edit</string>
|
<string>Toolbar editor</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>m_cmbSelectToolBar</cstring>
|
<cstring>m_cmbSelectToolBar</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="m_spinToolbarIconSize">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Icon size</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_spinToolbarIconSize</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -414,11 +437,13 @@
|
|||||||
<tabstop>m_checkNewTabDoubleClick</tabstop>
|
<tabstop>m_checkNewTabDoubleClick</tabstop>
|
||||||
<tabstop>m_checkHideTabBarIfOneTabVisible</tabstop>
|
<tabstop>m_checkHideTabBarIfOneTabVisible</tabstop>
|
||||||
<tabstop>m_cmbToolbarButtonStyle</tabstop>
|
<tabstop>m_cmbToolbarButtonStyle</tabstop>
|
||||||
|
<tabstop>m_spinToolbarIconSize</tabstop>
|
||||||
<tabstop>m_cmbSelectToolBar</tabstop>
|
<tabstop>m_cmbSelectToolBar</tabstop>
|
||||||
<tabstop>m_cmbIconTheme</tabstop>
|
<tabstop>m_cmbIconTheme</tabstop>
|
||||||
<tabstop>m_cmbStyles</tabstop>
|
<tabstop>m_cmbStyles</tabstop>
|
||||||
<tabstop>m_checkForceDarkFusion</tabstop>
|
<tabstop>m_checkForceDarkFusion</tabstop>
|
||||||
<tabstop>m_treeSkins</tabstop>
|
<tabstop>m_treeSkins</tabstop>
|
||||||
|
<tabstop>m_gbCustomSkinColors</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -158,6 +158,9 @@ DVALUE(QList<QVariant>) GUI::SplitterMessagesVerticalDef = {};
|
|||||||
DKEY GUI::SplitterMessagesHorizontal = "splitter_messages_horizontal";
|
DKEY GUI::SplitterMessagesHorizontal = "splitter_messages_horizontal";
|
||||||
DVALUE(QList<QVariant>) GUI::SplitterMessagesHorizontalDef = {};
|
DVALUE(QList<QVariant>) GUI::SplitterMessagesHorizontalDef = {};
|
||||||
|
|
||||||
|
DKEY GUI::ToolbarIconSize = "toolbar_icon_size";
|
||||||
|
DVALUE(int) GUI::ToolbarIconSizeDef = 0;
|
||||||
|
|
||||||
DKEY GUI::ToolbarStyle = "toolbar_style";
|
DKEY GUI::ToolbarStyle = "toolbar_style";
|
||||||
DVALUE(Qt::ToolButtonStyle) GUI::ToolbarStyleDef = Qt::ToolButtonIconOnly;
|
DVALUE(Qt::ToolButtonStyle) GUI::ToolbarStyleDef = Qt::ToolButtonIconOnly;
|
||||||
|
|
||||||
|
@ -184,6 +184,9 @@ namespace GUI {
|
|||||||
KEY SplitterMessagesHorizontal;
|
KEY SplitterMessagesHorizontal;
|
||||||
VALUE(QList<QVariant>) SplitterMessagesHorizontalDef;
|
VALUE(QList<QVariant>) SplitterMessagesHorizontalDef;
|
||||||
|
|
||||||
|
KEY ToolbarIconSize;
|
||||||
|
VALUE(int) ToolbarIconSizeDef;
|
||||||
|
|
||||||
KEY ToolbarStyle;
|
KEY ToolbarStyle;
|
||||||
VALUE(Qt::ToolButtonStyle) ToolbarStyleDef;
|
VALUE(Qt::ToolButtonStyle) ToolbarStyleDef;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user