Make icon size for small tabbar configurable too
This commit is contained in:
@@ -75,6 +75,7 @@ const char *AppearanceSettingsPage::kTabBarSystemColor= "tab_system_color";
|
|||||||
const char *AppearanceSettingsPage::kTabBarGradient = "tab_gradient";
|
const char *AppearanceSettingsPage::kTabBarGradient = "tab_gradient";
|
||||||
const char *AppearanceSettingsPage::kTabBarColor = "tab_color";
|
const char *AppearanceSettingsPage::kTabBarColor = "tab_color";
|
||||||
|
|
||||||
|
const char *AppearanceSettingsPage::kIconSizeTabbarSmallMode = "icon_size_tabbar_small_mode";
|
||||||
const char *AppearanceSettingsPage::kIconSizeTabbarLargeMode = "icon_size_tabbar_large_mode";
|
const char *AppearanceSettingsPage::kIconSizeTabbarLargeMode = "icon_size_tabbar_large_mode";
|
||||||
const char *AppearanceSettingsPage::kIconSizePlayControlButtons = "icon_size_play_control_buttons";
|
const char *AppearanceSettingsPage::kIconSizePlayControlButtons = "icon_size_play_control_buttons";
|
||||||
const char *AppearanceSettingsPage::kIconSizePlaylistButtons = "icon_size_playlist_buttons";
|
const char *AppearanceSettingsPage::kIconSizePlaylistButtons = "icon_size_playlist_buttons";
|
||||||
@@ -196,7 +197,8 @@ void AppearanceSettingsPage::Load() {
|
|||||||
ui_->checkbox_background_image_keep_aspect_ratio->setEnabled(ui_->checkbox_background_image_stretch->isChecked());
|
ui_->checkbox_background_image_keep_aspect_ratio->setEnabled(ui_->checkbox_background_image_stretch->isChecked());
|
||||||
ui_->checkbox_background_image_do_not_cut->setEnabled(ui_->checkbox_background_image_stretch->isChecked() && ui_->checkbox_background_image_keep_aspect_ratio->isChecked());
|
ui_->checkbox_background_image_do_not_cut->setEnabled(ui_->checkbox_background_image_stretch->isChecked() && ui_->checkbox_background_image_keep_aspect_ratio->isChecked());
|
||||||
|
|
||||||
ui_->spinbox_icon_size_tabbar_large_mode->setValue(s.value(kIconSizeTabbarLargeMode, 32).toInt());
|
ui_->spinbox_icon_size_tabbar_small_mode->setValue(s.value(kIconSizeTabbarSmallMode, 32).toInt());
|
||||||
|
ui_->spinbox_icon_size_tabbar_large_mode->setValue(s.value(kIconSizeTabbarLargeMode, 40).toInt());
|
||||||
ui_->spinbox_icon_size_play_control_buttons->setValue(s.value(kIconSizePlayControlButtons, 32).toInt());
|
ui_->spinbox_icon_size_play_control_buttons->setValue(s.value(kIconSizePlayControlButtons, 32).toInt());
|
||||||
ui_->spinbox_icon_size_playlist_buttons->setValue(s.value(kIconSizePlaylistButtons, 20).toInt());
|
ui_->spinbox_icon_size_playlist_buttons->setValue(s.value(kIconSizePlaylistButtons, 20).toInt());
|
||||||
ui_->spinbox_icon_size_left_panel_buttons->setValue(s.value(kIconSizeLeftPanelButtons, 22).toInt());
|
ui_->spinbox_icon_size_left_panel_buttons->setValue(s.value(kIconSizeLeftPanelButtons, 22).toInt());
|
||||||
@@ -264,6 +266,7 @@ void AppearanceSettingsPage::Save() {
|
|||||||
s.setValue(kTabBarGradient, ui_->tabbar_gradient->isChecked());
|
s.setValue(kTabBarGradient, ui_->tabbar_gradient->isChecked());
|
||||||
s.setValue(kTabBarColor, current_tabbar_bg_color_);
|
s.setValue(kTabBarColor, current_tabbar_bg_color_);
|
||||||
|
|
||||||
|
s.setValue(kIconSizeTabbarSmallMode, ui_->spinbox_icon_size_tabbar_small_mode->value());
|
||||||
s.setValue(kIconSizeTabbarLargeMode, ui_->spinbox_icon_size_tabbar_large_mode->value());
|
s.setValue(kIconSizeTabbarLargeMode, ui_->spinbox_icon_size_tabbar_large_mode->value());
|
||||||
s.setValue(kIconSizePlayControlButtons, ui_->spinbox_icon_size_play_control_buttons->value());
|
s.setValue(kIconSizePlayControlButtons, ui_->spinbox_icon_size_play_control_buttons->value());
|
||||||
s.setValue(kIconSizePlaylistButtons, ui_->spinbox_icon_size_playlist_buttons->value());
|
s.setValue(kIconSizePlaylistButtons, ui_->spinbox_icon_size_playlist_buttons->value());
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class AppearanceSettingsPage : public SettingsPage {
|
|||||||
static const char *kTabBarGradient;
|
static const char *kTabBarGradient;
|
||||||
static const char *kTabBarColor;
|
static const char *kTabBarColor;
|
||||||
|
|
||||||
|
static const char *kIconSizeTabbarSmallMode;
|
||||||
static const char *kIconSizeTabbarLargeMode;
|
static const char *kIconSizeTabbarLargeMode;
|
||||||
static const char *kIconSizePlayControlButtons;
|
static const char *kIconSizePlayControlButtons;
|
||||||
static const char *kIconSizePlaylistButtons;
|
static const char *kIconSizePlaylistButtons;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>674</width>
|
<width>674</width>
|
||||||
<height>896</height>
|
<height>1030</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -442,7 +442,7 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_groupbox_icon_sizes">
|
<layout class="QHBoxLayout" name="layout_groupbox_icon_sizes">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="layout_icon_sizes">
|
<layout class="QGridLayout" name="layout_icon_sizes">
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_icon_size_playlist_buttons">
|
<widget class="QLabel" name="label_icon_size_playlist_buttons">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Playlist buttons</string>
|
<string>Playlist buttons</string>
|
||||||
@@ -450,23 +450,20 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_icon_size_tabbar_large_mode">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tabbar large mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_icon_size_play_control_buttons">
|
<widget class="QLabel" name="label_icon_size_play_control_buttons">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Play control buttons</string>
|
<string>Play control buttons</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="spinbox_icon_size_configure_buttons">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>16</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>64</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinbox_icon_size_play_control_buttons">
|
<widget class="QSpinBox" name="spinbox_icon_size_play_control_buttons">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
@@ -476,7 +473,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QSpinBox" name="spinbox_icon_size_left_panel_buttons">
|
<widget class="QSpinBox" name="spinbox_icon_size_left_panel_buttons">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
@@ -486,7 +483,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_icon_size_configure_buttons">
|
||||||
|
<property name="text">
|
||||||
|
<string>Configure buttons</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
<widget class="QSpinBox" name="spinbox_icon_size_playlist_buttons">
|
<widget class="QSpinBox" name="spinbox_icon_size_playlist_buttons">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
@@ -496,29 +500,42 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="1">
|
||||||
<widget class="QLabel" name="label_icon_size_configure_buttons">
|
<widget class="QSpinBox" name="spinbox_icon_size_configure_buttons">
|
||||||
<property name="text">
|
<property name="minimum">
|
||||||
<string>Configure buttons</string>
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>64</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_icon_size_left_panel_buttons">
|
<widget class="QLabel" name="label_icon_size_left_panel_buttons">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Files, playlists and queue buttons</string>
|
<string>Files, playlists and queue buttons</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinbox_icon_size_tabbar_large_mode">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>64</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_icon_size_tabbar_large_mode">
|
<widget class="QLabel" name="label_icon_size_tabbar_small_mode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tabbar large mode</string>
|
<string>Tabbar small mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="spinbox_icon_size_tabbar_large_mode">
|
<widget class="QSpinBox" name="spinbox_icon_size_tabbar_small_mode">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>16</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -57,8 +57,11 @@
|
|||||||
#include "core/stylehelper.h"
|
#include "core/stylehelper.h"
|
||||||
#include "settings/appearancesettingspage.h"
|
#include "settings/appearancesettingspage.h"
|
||||||
|
|
||||||
const int FancyTabWidget::IconSize_LargeSidebar = 32;
|
const int FancyTabWidget::IconSize_LargeSidebar = 40;
|
||||||
const int FancyTabWidget::IconSize_SmallSidebar = 22;
|
const int FancyTabWidget::IconSize_SmallSidebar = 32;
|
||||||
|
const int FancyTabWidget::IconSize_PlainSidebar = 22;
|
||||||
|
const int FancyTabWidget::IconSize_TabsSidebar = 22;
|
||||||
|
const int FancyTabWidget::IconSize_IconsSidebar = 22;
|
||||||
const int FancyTabWidget::TabSize_LargeSidebarWidth = 70;
|
const int FancyTabWidget::TabSize_LargeSidebarWidth = 70;
|
||||||
|
|
||||||
class FancyTabBar: public QTabBar {
|
class FancyTabBar: public QTabBar {
|
||||||
@@ -129,7 +132,7 @@ class FancyTabBar: public QTabBar {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs) {
|
if (tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs) {
|
||||||
size = QSize(FancyTabWidget::IconSize_SmallSidebar + 10, FancyTabWidget::IconSize_SmallSidebar + 10);
|
size = QSize(FancyTabWidget::IconSize_IconsSidebar + 10, FancyTabWidget::IconSize_IconsSidebar + 10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QFont bold_font(font());
|
QFont bold_font(font());
|
||||||
@@ -140,12 +143,16 @@ class FancyTabBar: public QTabBar {
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
if (tabWidget->mode() == FancyTabWidget::Mode_Tabs) {
|
if (tabWidget->mode() == FancyTabWidget::Mode_Tabs) {
|
||||||
w = FancyTabWidget::IconSize_SmallSidebar + rect.width() + 10;
|
w = FancyTabWidget::IconSize_TabsSidebar + rect.width() + 10;
|
||||||
h = std::max(FancyTabWidget::IconSize_SmallSidebar, rect.height()) + 15;
|
h = std::max(FancyTabWidget::IconSize_TabsSidebar, rect.height()) + 15;
|
||||||
}
|
}
|
||||||
else {
|
else if (tabWidget->mode() == FancyTabWidget::Mode_SmallSidebar) {
|
||||||
w = std::max(FancyTabWidget::IconSize_SmallSidebar, rect.height()) + 15;
|
w = std::max(tabWidget->iconsize_smallsidebar(), rect.height()) + 15;
|
||||||
h = FancyTabWidget::IconSize_SmallSidebar + rect.width() + 20;
|
h = tabWidget->iconsize_smallsidebar() + rect.width() + 20;
|
||||||
|
}
|
||||||
|
else if (tabWidget->mode() == FancyTabWidget::Mode_PlainSidebar) {
|
||||||
|
w = std::max(FancyTabWidget::IconSize_PlainSidebar, rect.height()) + 15;
|
||||||
|
h = FancyTabWidget::IconSize_PlainSidebar + rect.width() + 20;
|
||||||
}
|
}
|
||||||
size = QSize(w, h);
|
size = QSize(w, h);
|
||||||
}
|
}
|
||||||
@@ -280,14 +287,13 @@ class FancyTabBar: public QTabBar {
|
|||||||
if (verticalTextTabs) {
|
if (verticalTextTabs) {
|
||||||
m = QTransform::fromTranslate(tabrect.left(), tabrect.bottom());
|
m = QTransform::fromTranslate(tabrect.left(), tabrect.bottom());
|
||||||
m.rotate(-90);
|
m.rotate(-90);
|
||||||
textFlags = Qt::AlignLeft | Qt::AlignVCenter;
|
textFlags = Qt::AlignVCenter;
|
||||||
iconFlags = Qt::AlignLeft | Qt::AlignVCenter;
|
iconFlags = Qt::AlignVCenter;
|
||||||
|
|
||||||
tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size());
|
tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size());
|
||||||
|
|
||||||
tabrectText = tabrectLabel;
|
tabrectText = tabrectLabel;
|
||||||
tabrectText.translate(FancyTabWidget::IconSize_SmallSidebar + 8, -2);
|
tabrectText.translate(tabWidget->iconsize_smallsidebar() + 8, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m = QTransform::fromTranslate(tabrect.left(), tabrect.top());
|
m = QTransform::fromTranslate(tabrect.left(), tabrect.top());
|
||||||
@@ -319,18 +325,19 @@ class FancyTabBar: public QTabBar {
|
|||||||
|
|
||||||
// Draw the icon
|
// Draw the icon
|
||||||
QRect tabrectIcon;
|
QRect tabrectIcon;
|
||||||
const int PADDING = 5;
|
|
||||||
if (verticalTextTabs) {
|
if (verticalTextTabs) {
|
||||||
tabrectIcon = tabrectLabel;
|
tabrectIcon = tabrectLabel;
|
||||||
tabrectIcon.setSize(QSize(FancyTabWidget::IconSize_SmallSidebar, FancyTabWidget::IconSize_SmallSidebar));
|
tabrectIcon.setSize(QSize(tabWidget->iconsize_smallsidebar(), tabWidget->iconsize_smallsidebar()));
|
||||||
tabrectIcon.translate(PADDING, PADDING);
|
// Center the icon
|
||||||
|
const int moveRight = (QTabBar::width() - tabWidget->iconsize_smallsidebar()) / 2;
|
||||||
|
tabrectIcon.translate(5, moveRight);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tabrectIcon = tabrectLabel;
|
tabrectIcon = tabrectLabel;
|
||||||
tabrectIcon.setSize(QSize(tabWidget->iconsize_largesidebar(), tabWidget->iconsize_largesidebar()));
|
tabrectIcon.setSize(QSize(tabWidget->iconsize_largesidebar(), tabWidget->iconsize_largesidebar()));
|
||||||
// Center the icon
|
// Center the icon
|
||||||
const int moveRight = (QTabBar::width() - tabWidget->iconsize_largesidebar() -1) / 2;
|
const int moveRight = (QTabBar::width() - tabWidget->iconsize_largesidebar() -1) / 2;
|
||||||
tabrectIcon.translate(moveRight, PADDING);
|
tabrectIcon.translate(moveRight, 5);
|
||||||
}
|
}
|
||||||
tabIcon(index).paint(&p, tabrectIcon, iconFlags);
|
tabIcon(index).paint(&p, tabrectIcon, iconFlags);
|
||||||
p.restore();
|
p.restore();
|
||||||
@@ -357,9 +364,6 @@ class TabData : public QObject {
|
|||||||
layout->addWidget(widget_view_);
|
layout->addWidget(widget_view_);
|
||||||
page_->setLayout(layout);
|
page_->setLayout(layout);
|
||||||
}
|
}
|
||||||
~TabData() override {
|
|
||||||
//delete page_;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *widget_view() { return widget_view_; }
|
QWidget *widget_view() { return widget_view_; }
|
||||||
QString name() { return name_; }
|
QString name() { return name_; }
|
||||||
@@ -422,6 +426,7 @@ FancyTabWidget::FancyTabWidget(QWidget* parent) : QTabWidget(parent),
|
|||||||
bottom_widget_(nullptr),
|
bottom_widget_(nullptr),
|
||||||
bg_color_system_(true),
|
bg_color_system_(true),
|
||||||
bg_gradient_(true),
|
bg_gradient_(true),
|
||||||
|
iconsize_smallsidebar_(FancyTabWidget::IconSize_SmallSidebar),
|
||||||
iconsize_largesidebar_(FancyTabWidget::IconSize_LargeSidebar)
|
iconsize_largesidebar_(FancyTabWidget::IconSize_LargeSidebar)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -489,7 +494,8 @@ void FancyTabWidget::ReloadSettings() {
|
|||||||
bg_color_system_ = s.value(AppearanceSettingsPage::kTabBarSystemColor, false).toBool();
|
bg_color_system_ = s.value(AppearanceSettingsPage::kTabBarSystemColor, false).toBool();
|
||||||
bg_gradient_ = s.value(AppearanceSettingsPage::kTabBarGradient, true).toBool();
|
bg_gradient_ = s.value(AppearanceSettingsPage::kTabBarGradient, true).toBool();
|
||||||
bg_color_ = s.value(AppearanceSettingsPage::kTabBarColor, StyleHelper::highlightColor()).value<QColor>();
|
bg_color_ = s.value(AppearanceSettingsPage::kTabBarColor, StyleHelper::highlightColor()).value<QColor>();
|
||||||
iconsize_largesidebar_ = s.value(AppearanceSettingsPage::kIconSizeTabbarLargeMode, FancyTabWidget::IconSize_LargeSidebar).toInt();;
|
iconsize_smallsidebar_ = s.value(AppearanceSettingsPage::kIconSizeTabbarSmallMode, FancyTabWidget::IconSize_SmallSidebar).toInt();
|
||||||
|
iconsize_largesidebar_ = s.value(AppearanceSettingsPage::kIconSizeTabbarLargeMode, FancyTabWidget::IconSize_LargeSidebar).toInt();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|||||||
@@ -74,8 +74,12 @@ class FancyTabWidget : public QTabWidget {
|
|||||||
static const int TabSize_LargeSidebarWidth;
|
static const int TabSize_LargeSidebarWidth;
|
||||||
static const int IconSize_LargeSidebar;
|
static const int IconSize_LargeSidebar;
|
||||||
static const int IconSize_SmallSidebar;
|
static const int IconSize_SmallSidebar;
|
||||||
|
static const int IconSize_PlainSidebar;
|
||||||
|
static const int IconSize_TabsSidebar;
|
||||||
|
static const int IconSize_IconsSidebar;
|
||||||
|
|
||||||
Mode mode() const { return mode_; }
|
Mode mode() const { return mode_; }
|
||||||
|
int iconsize_smallsidebar() const { return iconsize_smallsidebar_; }
|
||||||
int iconsize_largesidebar() const { return iconsize_largesidebar_; }
|
int iconsize_largesidebar() const { return iconsize_largesidebar_; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -109,6 +113,7 @@ class FancyTabWidget : public QTabWidget {
|
|||||||
bool bg_color_system_;
|
bool bg_color_system_;
|
||||||
bool bg_gradient_;
|
bool bg_gradient_;
|
||||||
QColor bg_color_;
|
QColor bg_color_;
|
||||||
|
int iconsize_smallsidebar_;
|
||||||
int iconsize_largesidebar_;
|
int iconsize_largesidebar_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user