diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-09-22 09:53:24 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-09-22 09:53:24 +0000 |
| commit | d5fcec54bb9565d8d48cc6c1e9b73b9015b10aa4 (patch) | |
| tree | ce4bc5ca056323b3ecf84be829dee986a08eb24f /src/plugins | |
| parent | 184e5b8f7d4d332b22abff25d541920e9e2d7662 (diff) | |
| download | qmmp-d5fcec54bb9565d8d48cc6c1e9b73b9015b10aa4.tar.gz qmmp-d5fcec54bb9565d8d48cc6c1e9b73b9015b10aa4.tar.bz2 qmmp-d5fcec54bb9565d8d48cc6c1e9b73b9015b10aa4.zip | |
qsui: added feature to override track background color (#1014)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9077 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/Ui/qsui/forms/qsuisettings.ui | 360 | ||||
| -rw-r--r-- | src/plugins/Ui/qsui/listwidgetdrawer.cpp | 37 | ||||
| -rw-r--r-- | src/plugins/Ui/qsui/listwidgetdrawer.h | 2 | ||||
| -rw-r--r-- | src/plugins/Ui/qsui/qsuisettings.cpp | 9 |
4 files changed, 294 insertions, 114 deletions
diff --git a/src/plugins/Ui/qsui/forms/qsuisettings.ui b/src/plugins/Ui/qsui/forms/qsuisettings.ui index b9d90c6aa..8cbac743c 100644 --- a/src/plugins/Ui/qsui/forms/qsuisettings.ui +++ b/src/plugins/Ui/qsui/forms/qsuisettings.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>463</width> - <height>483</height> + <width>497</width> + <height>529</height> </rect> </property> <property name="windowTitle"> @@ -184,7 +184,7 @@ <attribute name="title"> <string>Colors</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> + <layout class="QVBoxLayout" name="verticalLayout_8"> <item> <widget class="QGroupBox" name="groupBox_4"> <property name="title"> @@ -404,7 +404,7 @@ <property name="title"> <string>Playlist Colors</string> </property> - <layout class="QVBoxLayout" name="_2"> + <layout class="QVBoxLayout" name="verticalLayout_7"> <item> <widget class="QCheckBox" name="plSystemColorsCheckBox"> <property name="text"> @@ -421,11 +421,15 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout_2"> - <property name="margin"> - <number>0</number> - </property> - <item row="3" column="1"> - <widget class="ColorWidget" name="plGrBgColor"> + <item row="0" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Background #1:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="ColorWidget" name="plBg1Color"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -438,16 +442,39 @@ <height>20</height> </size> </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> <property name="frameShape"> <enum>QFrame::Box</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> + </widget> + </item> + <item row="0" column="2" rowspan="5" colspan="2"> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>43</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="4" colspan="2"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>Normal text:</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="ColorWidget" name="plHlColor"> + <item row="0" column="6"> + <widget class="ColorWidget" name="plTextNormalColor"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -471,17 +498,23 @@ </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Background #1:</string> + <item row="0" column="7" rowspan="5"> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - </widget> + <property name="sizeHint" stdset="0"> + <size> + <width>66</width> + <height>68</height> + </size> + </property> + </spacer> </item> - <item row="2" column="3"> - <widget class="QLabel" name="label_12"> + <item row="1" column="0"> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>Highlighted text:</string> + <string>Background #2:</string> </property> </widget> </item> @@ -510,17 +543,35 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_14"> + <item row="1" column="4" colspan="2"> + <widget class="QLabel" name="label_11"> <property name="text"> - <string>Group background:</string> + <string>Current text:</string> </property> </widget> </item> - <item row="3" column="3"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Group text:</string> + <item row="1" column="6"> + <widget class="ColorWidget" name="plTextCurrentColor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::Box</enum> </property> </widget> </item> @@ -531,15 +582,8 @@ </property> </widget> </item> - <item row="0" column="3"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>Normal text:</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="ColorWidget" name="plTextNormalColor"> + <item row="2" column="1"> + <widget class="ColorWidget" name="plHlColor"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -563,8 +607,15 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="ColorWidget" name="plBg1Color"> + <item row="2" column="4" colspan="2"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Highlighted text:</string> + </property> + </widget> + </item> + <item row="2" column="6"> + <widget class="ColorWidget" name="plTextHlCurrentColor"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -586,23 +637,20 @@ <property name="frameShape"> <enum>QFrame::Box</enum> </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> </widget> </item> - <item row="0" column="5" rowspan="4"> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>66</width> - <height>68</height> - </size> + <item row="3" column="0" rowspan="2"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>Splitter:</string> </property> - </spacer> + </widget> </item> - <item row="1" column="4"> - <widget class="ColorWidget" name="plTextCurrentColor"> + <item row="3" column="1" rowspan="2"> + <widget class="ColorWidget" name="plSplitterColor"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -621,39 +669,28 @@ <height>20</height> </size> </property> - <property name="frameShape"> - <enum>QFrame::Box</enum> - </property> - </widget> - </item> - <item row="0" column="2" rowspan="4"> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> + <property name="baseSize"> <size> - <width>40</width> - <height>43</height> + <width>20</width> + <height>20</height> </size> </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Background #2:</string> + <property name="frameShape"> + <enum>QFrame::Box</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> </property> </widget> </item> - <item row="1" column="3"> - <widget class="QLabel" name="label_11"> + <item row="4" column="4" colspan="2"> + <widget class="QLabel" name="label_15"> <property name="text"> - <string>Current text:</string> + <string>Group text:</string> </property> </widget> </item> - <item row="3" column="4"> + <item row="4" column="6"> <widget class="ColorWidget" name="plGrTextColor"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> @@ -675,8 +712,21 @@ </property> </widget> </item> - <item row="2" column="4"> - <widget class="ColorWidget" name="plTextHlCurrentColor"> + <item row="6" column="0"> + <widget class="QLabel" name="label_14"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Group background:</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="ColorWidget" name="plGrBgColor"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -689,12 +739,6 @@ <height>20</height> </size> </property> - <property name="maximumSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> <property name="frameShape"> <enum>QFrame::Box</enum> </property> @@ -703,15 +747,28 @@ </property> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_19"> + <item row="7" column="0" colspan="5"> + <widget class="QCheckBox" name="plOverrideCurrentBgCheckBox"> <property name="text"> - <string>Splitter:</string> + <string>Override current track background</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="ColorWidget" name="plSplitterColor"> + <item row="8" column="0"> + <widget class="QLabel" name="label_20"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Current track background:</string> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="ColorWidget" name="plCurrentTrackBgColor"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -724,25 +781,46 @@ <height>20</height> </size> </property> - <property name="maximumSize"> + <property name="frameShape"> + <enum>QFrame::Box</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + </widget> + </item> + <item row="5" column="0" colspan="8"> + <widget class="QCheckBox" name="plOverrideGroupBgCheckBox"> + <property name="text"> + <string>Override group background</string> + </property> + </widget> + </item> + <item row="6" column="4" colspan="4"> + <spacer name="horizontalSpacer_9"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> <size> - <width>20</width> + <width>110</width> <height>20</height> </size> </property> - <property name="baseSize"> + </spacer> + </item> + <item row="8" column="4" colspan="4"> + <spacer name="horizontalSpacer_10"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> <size> - <width>20</width> + <width>189</width> <height>20</height> </size> </property> - <property name="frameShape"> - <enum>QFrame::Box</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - </widget> + </spacer> </item> </layout> </widget> @@ -1068,12 +1146,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>154</x> - <y>220</y> + <x>180</x> + <y>377</y> </hint> <hint type="destinationlabel"> - <x>184</x> - <y>276</y> + <x>210</x> + <y>435</y> </hint> </hints> </connection> @@ -1084,12 +1162,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>152</x> - <y>332</y> + <x>178</x> + <y>280</y> </hint> <hint type="destinationlabel"> - <x>144</x> - <y>368</y> + <x>147</x> + <y>313</y> </hint> </hints> </connection> @@ -1104,8 +1182,8 @@ <y>49</y> </hint> <hint type="destinationlabel"> - <x>101</x> - <y>77</y> + <x>111</x> + <y>140</y> </hint> </hints> </connection> @@ -1125,5 +1203,69 @@ </hint> </hints> </connection> + <connection> + <sender>plOverrideGroupBgCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>label_14</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>135</x> + <y>334</y> + </hint> + <hint type="destinationlabel"> + <x>137</x> + <y>360</y> + </hint> + </hints> + </connection> + <connection> + <sender>plOverrideGroupBgCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>plGrBgColor</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>244</x> + <y>332</y> + </hint> + <hint type="destinationlabel"> + <x>255</x> + <y>361</y> + </hint> + </hints> + </connection> + <connection> + <sender>plOverrideCurrentBgCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>label_20</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>97</x> + <y>391</y> + </hint> + <hint type="destinationlabel"> + <x>94</x> + <y>413</y> + </hint> + </hints> + </connection> + <connection> + <sender>plOverrideCurrentBgCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>plCurrentTrackBgColor</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>231</x> + <y>389</y> + </hint> + <hint type="destinationlabel"> + <x>245</x> + <y>419</y> + </hint> + </hints> + </connection> </connections> </ui> diff --git a/src/plugins/Ui/qsui/listwidgetdrawer.cpp b/src/plugins/Ui/qsui/listwidgetdrawer.cpp index 3c046fde9..a0c6a81b0 100644 --- a/src/plugins/Ui/qsui/listwidgetdrawer.cpp +++ b/src/plugins/Ui/qsui/listwidgetdrawer.cpp @@ -88,10 +88,28 @@ void ListWidgetDrawer::readSettings() m_normal.setNamedColor(settings.value("pl_normal_text_color", m_normal.name()).toString()); m_current.setNamedColor(settings.value("pl_current_text_color",m_current.name()).toString()); m_highlighted.setNamedColor(settings.value("pl_hl_text_color",m_highlighted.name()).toString()); - m_group_bg.setNamedColor(settings.value("pl_group_bg", m_group_bg.name()).toString()); m_splitter.setNamedColor(settings.value("pl_splitter_color", m_splitter).toString()); - m_group_alt_bg = m_group_bg; m_group_text.setNamedColor(settings.value("pl_group_text", m_group_text.name()).toString()); + if(settings.value("pl_override_group_bg", false).toBool()) + { + m_group_bg.setNamedColor(settings.value("pl_group_bg", m_normal_bg.name()).toString()); + m_group_alt_bg = m_group_bg; + } + else + { + m_group_bg = m_normal_bg; + m_group_alt_bg = m_alternate; + } + if(settings.value("pl_override_current_bg", false).toBool()) + { + m_current_bg.setNamedColor(settings.value("pl_current_bg_color", m_normal_bg.name()).toString()); + m_current_alt_bg = m_current_bg; + } + else + { + m_current_bg = m_normal_bg; + m_current_alt_bg = m_alternate; + } } if (m_update) @@ -122,6 +140,8 @@ void ListWidgetDrawer::loadSystemColors() m_group_bg = m_normal_bg; m_group_alt_bg = m_alternate, m_group_text = m_normal; + m_current_bg = m_normal_bg; + m_current_alt_bg = m_alternate; } int ListWidgetDrawer::rowHeight() const @@ -239,6 +259,19 @@ void ListWidgetDrawer::drawBackground(QPainter *painter, ListWidgetRow *row, int painter->setPen(m_group_bg); } } + else if(row->flags & ListWidgetRow::CURRENT) + { + if(index % 2) + { + painter->setBrush(QBrush(m_current_alt_bg)); + painter->setPen(m_current_alt_bg); + } + else + { + painter->setBrush(QBrush(m_current_bg)); + painter->setPen(m_current_bg); + } + } else { if(index % 2) diff --git a/src/plugins/Ui/qsui/listwidgetdrawer.h b/src/plugins/Ui/qsui/listwidgetdrawer.h index 77412db45..0e34d297b 100644 --- a/src/plugins/Ui/qsui/listwidgetdrawer.h +++ b/src/plugins/Ui/qsui/listwidgetdrawer.h @@ -96,7 +96,7 @@ public: private: QColor m_normal, m_current, m_normal_bg, m_selected_bg, m_alternate, m_highlighted, m_splitter; - QColor m_group_bg, m_group_alt_bg, m_group_text; + QColor m_group_bg, m_group_alt_bg, m_group_text, m_current_bg, m_current_alt_bg; QFontMetrics *m_metrics; QFontMetrics *m_extra_metrics; QFontMetrics *m_bold_metrics; diff --git a/src/plugins/Ui/qsui/qsuisettings.cpp b/src/plugins/Ui/qsui/qsuisettings.cpp index 6a64fb328..c6f4b2f1d 100644 --- a/src/plugins/Ui/qsui/qsuisettings.cpp +++ b/src/plugins/Ui/qsui/qsuisettings.cpp @@ -184,7 +184,6 @@ void QSUISettings::readSettings() QString normal = palette().color(QPalette::Text).name(); QString current = palette().color(QPalette::Text).name(); QString highlighted = palette().color(QPalette::HighlightedText).name(); - QString group_bg = palette().color(QPalette::Base).name(); QString group_text = palette().color(QPalette::Text).name(); m_ui.plSystemColorsCheckBox->setChecked(settings.value("pl_system_colors", true).toBool()); m_ui.plBg1Color->setColor(settings.value("pl_bg1_color", normal_bg).toString()); @@ -193,9 +192,12 @@ void QSUISettings::readSettings() m_ui.plTextNormalColor->setColor(settings.value("pl_normal_text_color", normal).toString()); m_ui.plTextCurrentColor->setColor(settings.value("pl_current_text_color", current).toString()); m_ui.plTextHlCurrentColor->setColor(settings.value("pl_hl_text_color", highlighted).toString()); - m_ui.plGrBgColor->setColor(settings.value("pl_group_bg", group_bg).toString()); + m_ui.plGrBgColor->setColor(settings.value("pl_group_bg", normal_bg).toString()); m_ui.plSplitterColor->setColor(settings.value("pl_splitter_color", normal).toString()); m_ui.plGrTextColor->setColor(settings.value("pl_group_text", group_text).toString()); + m_ui.plCurrentTrackBgColor->setColor(settings.value("pl_current_bg_color", normal_bg).toString()); + m_ui.plOverrideGroupBgCheckBox->setChecked(settings.value("pl_override_group_bg", false).toBool()); + m_ui.plOverrideCurrentBgCheckBox->setChecked(settings.value("pl_override_current_bg", false).toBool()); //toolbar int index = m_ui.toolBarIconSizeComboBox->findData(settings.value("toolbar_icon_size", -1).toInt()); m_ui.toolBarIconSizeComboBox->setCurrentIndex(index > 0 ? index : 0); @@ -234,6 +236,9 @@ void QSUISettings::writeSettings() settings.setValue("pl_group_bg", m_ui.plGrBgColor->colorName()); settings.setValue("pl_splitter_color", m_ui.plSplitterColor->colorName()); settings.setValue("pl_group_text", m_ui.plGrTextColor->colorName()); + settings.setValue("pl_current_bg_color", m_ui.plCurrentTrackBgColor->colorName()); + settings.setValue("pl_override_group_bg", m_ui.plOverrideGroupBgCheckBox->isChecked()); + settings.setValue("pl_override_current_bg", m_ui.plOverrideCurrentBgCheckBox->isChecked()); settings.setValue("pl_font", m_ui.plFontLabel->font().toString()); settings.setValue("pl_tabs_font", m_ui.tabsFontLabel->font().toString()); settings.setValue("pl_header_font", m_ui.columnFontLabel->font().toString()); |
