From 5374695df7da84d32e11a6bc822a186d8e2865d5 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Tue, 12 Nov 2024 14:07:26 +0100 Subject: [PATCH 1/5] add skin styles for Preferences, Track Properties & other dialogs, LateNight PaleMoon only * use skin stylesheet for preferences * use skin stylesheet for all dialogs spawned by non-GUI classes by using MixxxMainWindow's centralWidget() (#Skin) as parent, via mixxx::widgetHelper --- .../palemoon/buttons/btn__pref_checkbox.svg | 3 + .../buttons/btn__pref_checkbox_disabled.svg | 3 + .../buttons/btn__pref_checkmark_blue.svg | 4 + .../buttons/btn__pref_checkmark_grey.svg | 4 + .../palemoon/buttons/btn__pref_disabled.svg | 3 + .../buttons/btn__pref_radio_button_on.svg | 4 + .../buttons/btn__pref_spinbox_down.svg | 4 + .../palemoon/buttons/btn__pref_spinbox_up.svg | 4 + res/skins/LateNight/style.qss | 2 +- res/skins/LateNight/style_palemoon.qss | 710 +++++++++++++++++- src/broadcast/broadcastmanager.cpp | 7 +- src/controllers/dlgprefcontroller.cpp | 23 +- src/controllers/dlgprefcontroller.h | 12 +- src/controllers/dlgprefcontrollers.cpp | 13 +- src/controllers/dlgprefcontrollers.h | 3 + src/defs_urls.h | 2 + src/dialog/dlgabout.cpp | 10 +- src/dialog/dlgabout.h | 2 +- .../presets/effectchainpresetmanager.cpp | 23 +- src/errordialoghandler.cpp | 2 +- src/library/autodj/autodjfeature.cpp | 4 +- src/library/dlgtagfetcher.cpp | 7 +- src/library/dlgtagfetcher.h | 4 +- src/library/dlgtrackinfo.cpp | 9 +- src/library/dlgtrackinfo.h | 1 + src/library/dlgtrackinfomulti.cpp | 8 +- src/library/dlgtrackinfomulti.h | 4 +- src/library/export/trackexportdlg.cpp | 7 +- src/library/export/trackexportwizard.cpp | 4 +- src/library/export/trackexportwizard.h | 6 +- src/library/trackcollection.cpp | 15 +- src/library/trackset/baseplaylistfeature.cpp | 6 +- src/library/trackset/crate/cratefeature.cpp | 18 +- src/library/trackset/setlogfeature.cpp | 7 +- src/mixxxmainwindow.cpp | 95 ++- src/mixxxmainwindow.h | 1 + src/preferences/dialog/dlgpreferencepage.h | 4 + src/preferences/dialog/dlgpreferences.cpp | 151 ++-- src/preferences/dialog/dlgpreferences.h | 18 +- src/preferences/dialog/dlgprefsound.cpp | 4 +- src/skin/legacy/legacyskinparser.cpp | 14 +- src/util/file.cpp | 4 +- src/util/widgethelper.cpp | 23 + src/util/widgethelper.h | 13 +- src/widget/wtrackmenu.cpp | 22 +- src/widget/wtracktableview.cpp | 2 +- tools/qsscheck.py | 2 + 47 files changed, 1094 insertions(+), 197 deletions(-) create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_checkbox.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_checkbox_disabled.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_blue.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_grey.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_disabled.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_radio_button_on.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_down.svg create mode 100644 res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_up.svg diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_checkbox.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_checkbox.svg new file mode 100644 index 00000000000..acd3d0dd277 --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_checkbox.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_checkbox_disabled.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_checkbox_disabled.svg new file mode 100644 index 00000000000..d1cb55266ff --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_checkbox_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_blue.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_blue.svg new file mode 100644 index 00000000000..41f2a4a5c38 --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_blue.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_grey.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_grey.svg new file mode 100644 index 00000000000..8daf4871a74 --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_checkmark_grey.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_disabled.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_disabled.svg new file mode 100644 index 00000000000..8fdebbc714f --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_radio_button_on.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_radio_button_on.svg new file mode 100644 index 00000000000..7c3c214c8ee --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_radio_button_on.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_down.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_down.svg new file mode 100644 index 00000000000..717eadb488d --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_down.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_up.svg b/res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_up.svg new file mode 100644 index 00000000000..98d750c66cd --- /dev/null +++ b/res/skins/LateNight/palemoon/buttons/btn__pref_spinbox_up.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/skins/LateNight/style.qss b/res/skins/LateNight/style.qss index 6cccc0ca1fe..e6c9af848a0 100644 --- a/res/skins/LateNight/style.qss +++ b/res/skins/LateNight/style.qss @@ -100,7 +100,7 @@ QLabel#labelRecStatistics { /* It is difficult to achieve identical styles WMainMenuBar #MainMenu on Windows AND Linux because item and checkbox properties are rendered - slightly different. + slightly differently. For details see * default-menu-styles-linux.qss * default-menu-styles-windows.qss diff --git a/res/skins/LateNight/style_palemoon.qss b/res/skins/LateNight/style_palemoon.qss index aa9e5bcd129..477184ede67 100644 --- a/res/skins/LateNight/style_palemoon.qss +++ b/res/skins/LateNight/style_palemoon.qss @@ -2794,7 +2794,9 @@ WTrackTableViewHeader::down-arrow { WEffectSelector QAbstractScrollArea QScrollBar, WEffectChainPresetSelector QAbstractScrollArea QScrollBar, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar, -WSearchLineEdit QAbstractScrollArea QScrollBar { +WSearchLineEdit QAbstractScrollArea QScrollBar, +DlgPreferences QAbstractScrollArea QScrollBar, +#Skin QDialog QScrollBar { border: 0px solid #585858; background: #000; border-radius: 2px; @@ -2805,7 +2807,9 @@ WSearchLineEdit QAbstractScrollArea QScrollBar { WEffectSelector QAbstractScrollArea QScrollBar:horizontal, WEffectChainPresetSelector QAbstractScrollArea QScrollBar:horizontal, WEffectChainPresetSelector QAbstractScrollArea QScrollBar:horizontal, - WSearchLineEdit QAbstractScrollArea QScrollBar:horizontal { + WSearchLineEdit QAbstractScrollArea QScrollBar:horizontal, + DlgPreferences QAbstractScrollArea QScrollBar:horizontal, + #Skin QDialog QScrollBar:horizontal { min-width: 12px; height: 15px; border-top-left-radius: 0px; @@ -2816,7 +2820,9 @@ WSearchLineEdit QAbstractScrollArea QScrollBar { WEffectSelector QAbstractScrollArea QScrollBar:vertical, WEffectChainPresetSelector QAbstractScrollArea QScrollBar:vertical, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar:vertical, - WSearchLineEdit QAbstractScrollArea QScrollBar:vertical { + WSearchLineEdit QAbstractScrollArea QScrollBar:vertical, + DlgPreferences QAbstractScrollArea QScrollBar:vertical, + #Skin QDialog QScrollBar:vertical { min-height: 12px; width: 15px; border-top-left-radius: 0px; @@ -2834,7 +2840,9 @@ WSearchLineEdit QAbstractScrollArea QScrollBar { WEffectSelector QAbstractScrollArea QScrollBar::handle:horizontal, WEffectChainPresetSelector QAbstractScrollArea QScrollBar::handle:horizontal, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::handle:horizontal, - WSearchLineEdit QAbstractScrollArea QScrollBar::handle:horizontal { + WSearchLineEdit QAbstractScrollArea QScrollBar::handle:horizontal, + DlgPreferences QAbstractScrollArea QScrollBar::handle:horizontal, + #Skin QDialog QScrollBar::handle:horizontal { background-color: #333338; min-width: 25px; } @@ -2842,7 +2850,9 @@ WSearchLineEdit QAbstractScrollArea QScrollBar { WEffectSelector QAbstractScrollArea QScrollBar::handle:vertical, WEffectChainPresetSelector QAbstractScrollArea QScrollBar::handle:vertical, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::handle:vertical, - WSearchLineEdit QAbstractScrollArea QScrollBar::handle:vertical { + WSearchLineEdit QAbstractScrollArea QScrollBar::handle:vertical, + DlgPreferences QAbstractScrollArea QScrollBar::handle:vertical, + #Skin QDialog QScrollBar::handle:vertical { background-color: #333338; min-height: 25px; } @@ -2857,7 +2867,11 @@ WEffectChainPresetSelector QAbstractScrollArea QScrollBar::sub-page, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::add-page, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::sub-page, WSearchLineEdit QAbstractScrollArea QScrollBar::add-page, -WSearchLineEdit QAbstractScrollArea QScrollBar::sub-page { +WSearchLineEdit QAbstractScrollArea QScrollBar::sub-page, +DlgPreferences QAbstractScrollArea QScrollBar::add-page, +DlgPreferences QAbstractScrollArea QScrollBar::sub-page, +#Skin QDialog QScrollBar::add-page, +#Skin QDialog QScrollBar::sub-page { min-width: 15px; min-height: 15px; background-color: #000; @@ -2873,7 +2887,11 @@ WEffectChainPresetSelector QAbstractScrollArea QScrollBar::sub-line, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::add-line, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::sub-line, WSearchLineEdit QAbstractScrollArea QScrollBar::add-line, -WSearchLineEdit QAbstractScrollArea QScrollBar::sub-line { +WSearchLineEdit QAbstractScrollArea QScrollBar::sub-line, +DlgPreferences QAbstractScrollArea QScrollBar::add-line, +DlgPreferences QAbstractScrollArea QScrollBar::sub-line, +#Skin QDialog QScrollBar::add-line, +#Skin QDialog QScrollBar::sub-line { width: 0px; height: 0px; border: 0px; @@ -2884,7 +2902,9 @@ WSearchLineEdit QAbstractScrollArea QScrollBar::sub-line { WEffectSelector QAbstractScrollArea QScrollBar::corner, WEffectChainPresetSelector QAbstractScrollArea QScrollBar::corner, WEffectChainPresetButton QMenu QAbstractScrollArea QScrollBar::corner, -WSearchLineEdit QAbstractScrollArea QScrollBar::corner { +WSearchLineEdit QAbstractScrollArea QScrollBar::corner, +DlgPreferences QAbstractScrollArea QScrollBar::corner, +#Skin QDialog QScrollBar::corner { border: 0px; border: 0px; background-color: #1e1e1e; @@ -3249,3 +3269,677 @@ WSearchLineEdit::indicator:unchecked:selected { } /************** common styles for WEffectSelector ****************************** *************** QSpinBox, QMenu, QToolTip *************************************/ + + + +/************** styles for Track Properties & Preferences ********************** +*******************************************************************************/ +#Skin QDialog, +DlgPreferences, +DlgPreferencePage, +DlgPrefController { + /* This color is overwritten below but we need to set it + in order to allow DlgPreferences to update the tree icons + and the mapping icons when this stylesheet is (re)applied. + Let's pick yellow so we can easily spot widgets where color + needs to overwritten. */ + /* choose a notable color for debugging + color: yellow;*/ + /* use white to brighten link colors in preferences + as much as possible (link color is still set by Qt theme somehow ... */ + color: white; +} + +#Skin QDialog, +#Skin QDialog QTabWidget::pane, +DlgPreferences, +DlgPreferencePage, +/* child dialogs, eg. confirmations & warnings */ +DlgPreferences QDialog, +WTrackMenu QDialog, +DlgPreferences QAbstractScrollArea, +DlgPreferences QStackedWidget, +DlgPreferences QTabWidget::pane, +DlgPreferences QLabel, +DlgPreferences QCheckBox, +DlgPreferences QRadioButton, +DlgPreferences QCheckBox, +#DlgTrackInfo, +#DlgTrackInfoMulti, +#DlgTrackInfo QTabWidget::pane, +#DlgTrackInfoMulti QTabWidget::pane, +#DlgTrackInfo QLabel, +#DlgTrackInfo WStarRating, +#DlgTrackInfoMulti QLabel, +#DlgTrackInfoMulti WStarRating { + background: #262628; /* without ::pane it's rendered as #323232 */ + padding: 0px; + margin: 0px; + } + DlgPreferences, + #DlgTrackInfo, + #DlgTrackInfoMulti { + /* we need to set a border to get the bg color */ + border: 0px solid red; + } + +#Skin QDialog QTabWidget::pane, +#Skin QDialog QTabBar::tab:selected, +#Skin QDialog QGroupBox, +DlgPreferences QGroupBox, +DlgPreferences QTabWidget::pane, +DlgPreferences QTabBar::tab:selected, +#DlgTrackInfo QGroupBox, +#DlgTrackInfo QTabWidget::pane, +#DlgTrackInfoMulti QGroupBox, +#DlgTrackInfoMulti QTabWidget::pane, +#DlgTrackInfo QTabBar::tab:selected, +#DlgTrackInfoMulti QTabBar::tab:selected { + background: transparent; + border: 1px solid #55555c; + border-radius: 1px; + } + #Skin QDialog QTabWidget::pane, + DlgPreferences QTabWidget::pane, + #DlgTrackInfo QTabWidget::pane, + #DlgTrackInfoMulti QTabWidget::pane { + /* eliminate bottom border of tab */ + top: -1; + } + DlgAbout QTabWidget::pane { + padding: 0px; + } +DlgAbout creditsTab { + /* not applied */ + margin: 0px; + padding: 0px; + qproperty-layoutMargin: 0; + qproperty-layoutMargin: 0 0 0 0; + qproperty-layoutSpacing: 0px; +} + +/* the separator lines in some pref pages */ +DlgPreferences #line, +DlgPreferences #line_2 { + border: none; + background: #55555c; + min-height: 1px; + max-height: 1px; +} + + #Skin QDialog QGroupBox, + DlgPreferences QGroupBox { + margin-top: 0.6em; + padding-top: 0.2em; + } + /* Push Cancel button up */ + TrackExportDlg #cancelButton { + margin-bottom: 8px; + } + #Skin QDialog QGroupBox::title, + DlgPreferences QGroupBox::title { + color: #decec0; + /* font family and weight are not applied */ + font-family: "Open Sans Semibold"; + font-weight: 500; /* semi-bold */ + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0em 0.2em 0 0; + margin: 0px 0px 0px 0em; + } + +#Skin QDialog QTabBar::tab-bar, +DlgPreferences QTabBar::tab-bar { + bottom: 1px; +} +/* unselected tabs */ +#Skin QDialog QTabBar::tab, +DlgPreferences QTabBar::tab, +#DlgTrackInfo QTabBar::tab, +#DlgTrackInfoMulti QTabBar::tab { + background-color: #202020; + /* fake/restore hidden top border of tab pane */ + /* don't set a left/right border because these would cut off + the bottom border at the left/right, even with radious 0px */ + border-bottom: 1px solid #55555c; + border-radius: 2px; + border-bottom-right-radius: 0px; + border-bottom-left-radius: 0px; + padding: 4px 10px; + } + #Skin QDialog QTabBar::tab:selected, + DlgPreferences QTabBar::tab:selected, + #DlgTrackInfo QTabBar::tab:selected, + #DlgTrackInfoMulti QTabBar::tab:selected { + color: #decec0; + background-color: #262628; + border-bottom: 0px; + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; + } + #Skin QDialog QTabBar::tab:focus, + DlgPreferences QTabBar::tab:focus, + #DlgTrackInfo QTabBar::tab:focus, + #DlgTrackInfoMulti QTabBar::tab:focus { + color: white; + selection-background-color: blue; + outline: nones; + border: 1px solid #257b82; + border-bottom: 0px; + } + + + + +#Skin QDialog QTableView, /* Controls & Stats view in DlgDeveloperTols */ +#Skin QDialog QTableView::item, +#Skin QDialog QTextBrowser, /* Contributor list in DlgAbout */ +#Skin QDialog QTextEdit, /* Log view in DlgDeveloperTols */ +DlgPreferences QTreeWidget, +DlgPreferences QListView, +DlgPreferences QTableView, +/* we need to set this bg otherwise DlgPrefBroadcast + would still use the Qt the checkbox/mark. */ +/* TODO Unfortunately this overrides the 'status' colors returned by + BroadcastSettingsModel::data() */ +DlgPreferences QTableView::item, +DlgTagFetcher QTreeWidget, +DlgTagFetcher QTreeWidget::item, +WTrackMenu QDialog QListView, +/* space left of selected child item */ +DlgPreferences QTreeWidget::branch:closed:!has-children:!has-siblings:selected, +DlgPreferences QTreeWidget::branch:closed:!has-children:has-siblings:selected, +DlgPreferences QTreeWidget::branch:open:!has-children:!has-siblings:selected, +DlgPreferences QTreeWidget::branch:open:!has-children:has-siblings:selected { + border: 0px solid red; + border-image: none; + background-color: #202022; +} +DlgPreferences QTreeWidget { + show-decoration-selected: 0; +} +DlgPreferences QTreeWidget::indicator, +DlgPreferences QTreeWidget::indicator:selected:focus, +DlgPreferences QTreeWidget::indicator:selected:!focus, +DlgPreferences QTreeWidget::indicator:!selected:focus, +DlgPreferences QTreeWidget::indicator:!selected:!focus { + outline: none; + border: 1px solid red; + border-image: none; + background: none; + background-color: red; +} + +#Skin QDialog QTabBar::tab, +#Skin QDialog QLabel, +#Skin QDialog QPushButton, +#Skin QDialog QCheckBox, +#Skin QDialog QLineEdit, +#Skin QDialog QTextBrowser, +#Skin QDialog QTextEdit, +DlgPreferences QTabBar::tab, +#DlgTrackInfo QTabBar::tab, +#DlgTrackInfoMulti QTabBar::tab, +#Skin QDialog QTableView, +#Skin QDialog QHeaderView, +DlgPreferences QTreeWidget, +DlgPreferences QListView, +DlgPreferences QTableView, +/* we need to set this otherwise DlgPrefBroadcast + would still use the Qt the checkbox/mark. */ +DlgPreferences QTableView::item, +DlgPreferences QHeaderView, +DlgPreferences QLabel, +DlgPreferences QCheckBox, +DlgPreferences QRadioButton, +DlgPreferences QCheckBox, +DlgPreferences QLineEdit, +DlgPreferences QTextEdit, +DlgPreferences QSpinBox, +DlgPreferences QDoubleSpinBox, +DlgPreferences QTimeEdit, +DlgPreferences QPushButton, +DlgPreferences QToolButton, /* Library font selector '...' txt */ +DlgPreferences QComboBox, +DlgTagFetcher QLabel, +DlgTagFetcher QCheckBox, +DlgTagFetcher QPushButton, +DlgTagFetcher QTreeWidget, +DlgTagFetcher QHeaderView, +DlgTagFetcher QHeaderView::item, +WTrackMenu QDialog QLabel, +WTrackMenu QDialog QPushButton, +WTrackMenu QDialog QCheckBox, +WTrackMenu QDialog QListView, +#DlgTrackInfo QLabel, +#DlgTrackInfo WStarRating, +#DlgTrackInfoMulti QLabel, +#DlgTrackInfoMulti WStarRating, +#DlgTrackInfo QLineEdit, +#DlgTrackInfo QPlainTextEdit, +#DlgTrackInfo QSpinBox, +#DlgTrackInfo QDoubleSpinBox, +#DlgTrackInfoMulti QLineEdit, +#DlgTrackInfoMulti QPlainTextEdit, +#DlgTrackInfoMulti QSpinBox, +#DlgTrackInfoMulti QDoubleSpinBox, +#DlgTrackInfo QPushButton, +#DlgTrackInfoMulti QPushButton { + color: #c2b3a5; +} + +DlgPreferences QCheckBox:disabled, +DlgPreferences QLineEdit:disabled, +DlgPreferences QTextEdit:disabled, +DlgPreferences QSpinBox:disabled, +DlgPreferences QDoubleSpinBox:disabled, +DlgPreferences QTimeEdit:disabled, +DlgPreferences QTableView::item:disabled, +DlgPreferences QHeaderView:disabled, +DlgPreferences QHeaderView::item:disabled, +DlgTagFetcher QCheckBox:disabled, +#DlgTrackInfo QDoubleSpinBox:disabled, +#DlgTrackInfo QCheckBox:disabled { + color: #666; +} +DlgPreferences QTableView::item:selected, +DlgPreferences QListView::item:selected, +DlgPreferences QTreeWidget::item:selected, +DlgTagFetcher QTreeWidget::item:selected { + color: white; + background-color: #666669; + border: 0px; + border-image: none; + outline: none; +} + +#Skin QDialog QLineEdit, +DlgPreferences QLineEdit, +DlgPreferences QTextEdit, +DlgPreferences QSpinBox, +DlgPreferences QDoubleSpinBox, +DlgPreferences QTimeEdit, +/* these inherit styles from + WLibrary QLineEdit, + WLibrary QPlainTextEdit, + #LibraryBPMSpinBox + so override properties as required */ +#DlgTrackInfo QLineEdit, +#DlgTrackInfo QPlainTextEdit, +#DlgTrackInfo QSpinBox, +#DlgTrackInfo QDoubleSpinBox, +#DlgTrackInfoMulti QLineEdit, +#DlgTrackInfoMulti QPlainTextEdit, +#DlgTrackInfoMulti QSpinBox, +#DlgTrackInfoMulti QDoubleSpinBox { + /* Also used for border of CoverArtLabel?? */ + background-color: #1f1f1f; + border: 1px solid #44444b; + padding: 2px; + } + #DlgTrackInfo QPlainTextEdit, + #DlgTrackInfoMulti QPlainTextEdit { + padding: 0px; + } + DlgPreferences QLineEdit:focus, + DlgPreferences QTextEdit:focus, + DlgPreferences QSpinBox:focus, + DlgPreferences QDoubleSpinBox:focus, + DlgPreferences QTimeEdit:focus, + DlgPreferences QCheckBox:focus, + DlgTagFetcher QCheckBox:focus, + #DlgTrackInfo QLineEdit:focus, + #DlgTrackInfo QCheckBox:focus, + #DlgTrackInfo QPlainTextEdit:focus, + #DlgTrackInfo QDoubleSpinBox:focus, + #DlgTrackInfoMulti QCheckBox:focus, + #DlgTrackInfoMulti QLineEdit:focus, + #DlgTrackInfoMulti QPlainTextEdit:focus, + #DlgTrackInfoMulti QDoubleSpinBox:focus { + border: 1px solid #257b82; + } + DlgPreferences QLineEdit:disabled, + DlgPreferences QTextEdit:disabled, + DlgPreferences QSpinBox:disabled, + DlgPreferences QDoubleSpinBox:disabled, + DlgPreferences QTimeEdit:disabled, + #DlgTrackInfo QDoubleSpinBox:disabled { + background-color: #232324; + } + #DlgTrackInfo QCheckBox:disabled { + background-color: #262628; + } + +WEffectSelector, +WEffectChainPresetSelector, +DlgPreferences QComboBox { + /* By default (at least on Linux with xfce) there are scroll buttons + at the top and bottom of the item view. They are problematic because + they have an annoying default style (bright) and when hidden + (list at bottom -> top scroll button hidden) they are not hidden + completely but some small bar remains. + /* this hides them and re-enables vertical scrollbars */ + combobox-popup: 0; + /* side effects: + * the view is laid over the combobox but attached at top/bottom, + depending on screen space above/below + * the view doesn't auto-expand trying to show all items, + it defaults to shows 10 items max. + Fix: set max. visible items, will be clamped to screen size. + (set here or for DlgPreferences QComboBox QAbstractItemView) + (equivalent fix in c++: someComboBox->setMaxVisibleItems(100); ) */ + qproperty-maxVisibleItems: 100; +} + +/* same as WEffectSelector QAbstractItemView etc. */ +DlgPreferences QComboBox QAbstractItemView { + selection-color: #fff; + selection-background-color: #2c454f; + border-radius: 1px; + outline: none; + border: 1px solid #44444b; + padding: 2px; + max-height: 16000px; +} + +#DlgTrackInfo WCoverArtLabel, +#DlgTrackInfoMulti WCoverArtLabel { + border: 0px; +} + +#Skin QDialog QPushButton, +DlgPreferences QPushButton, +DlgPreferences QToolButton, +DlgPreferences QComboBox, +DlgPreferences QComboBox, +DlgTagFetcher QPushButton, +WTrackMenu QDialog QPushButton, +#DlgTrackInfo QPushButton, +#DlgTrackInfoMulti QPushButton { + outline: none; + border-width: 2px 2px 2px 2px; + border-image: url(skins:LateNight/palemoon/buttons/btn_embedded_library.svg) 2 2 2 2; + background-color: #2f2f32; + padding: 2px 4px; + } + + + #Skin QDialog QHeaderView, + DlgTagFetcher QHeaderView { + background-color: #2f2f32; + } + DlgTagFetcher QHeaderView::section {} + /* same as WTrackTableViewHeader::section */ + + DlgPreferences QPushButton:focus, + DlgPreferences QToolButton:focus, + DlgPreferences QComboBox:focus, + DlgTagFetcher QPushButton:focus, + #Skin QDialog QPushButton:focus, + #DlgTrackInfo QPushButton:focus, + #DlgTrackInfoMulti QPushButton:focus { + outline: none; + border-image: url(skins:LateNight/palemoon/buttons/btn_embedded_library_focus_blue.svg) 2 2 2 2; + } + DlgPreferences QPushButton:pressed, + DlgPreferences QToolButton:pressed, + DlgTagFetcher QPushButton:pressed, + #Skin QDialog QPushButton:pressed, + #DlgTrackInfo QPushButton:pressed, + #DlgTrackInfoMulti QPushButton:pressed { + outline: none; + border-image: url(skins:LateNight/palemoon/buttons/btn_embedded_library_active.svg) 2 2 2 2; + } + DlgPreferences QPushButton:disabled, + DlgPreferences QToolButton:disabled, + DlgPreferences QComboBox:disabled, + DlgTrackInfo QPushButton:disabled, + #Skin QDialog QPushButton:disabled, + #DlgTrackInfo QPushButton:disabled, + #DlgTrackInfoMulti QPushButton:disabled { + background-color: #2a2a2c; + color: #666; + border-image: url(skins:LateNight/palemoon/buttons/btn__pref_disabled.svg) 2 2 2 2; + } +DlgPreferences QToolButton { + /* font selector button is too tall and pushes font/line-height + spinboxes apart */ + padding: 0px; +} + +DlgPreferences QComboBox::drop-down { + border: 0px solid green; +} +DlgPreferences QComboBox::down-arrow, +#DlgTrackInfo #btnColorPicker::menu-indicator, +#DlgTrackInfoMulti #btnColorPicker::menu-indicator { + padding: 0px; + margin: 0px; + border: 0px; + image: url(skins:LateNight/palemoon/buttons/btn__fx_selector_down.svg); + width: 16px; + height: 24px; +} + +#Skin WSearchLineEdit QToolButton { + border: 0px; + background-color: transparent; +} + +DlgPreferences QSpinBox::up-button, +DlgPreferences QSpinBox::down-button, +DlgPreferences QDoubleSpinBox::up-button, +DlgPreferences QDoubleSpinBox::down-button, +DlgPreferences QTimeEdit::up-button, +DlgPreferences QTimeEdit::down-button, +#DlgTrackInfo QDoubleSpinBox::up-button, +#DlgTrackInfo QDoubleSpinBox::down-button { + border: 0; + /* height: 10px;*/ + /* width: 28px;*/ + margin-right: 3px; + } + DlgPreferences QSpinBox::up-button, + DlgPreferences QDoubleSpinBox::up-button, + DlgPreferences QTimeEdit::up-button, + #DlgTrackInfo QDoubleSpinBox::up-button { + image: url(skins:LateNight/palemoon/buttons/btn__pref_spinbox_up.svg) no-repeat; + } + DlgPreferences QSpinBox::down-button, + DlgPreferences QDoubleSpinBox::down-button, + DlgPreferences QTimeEdit::down-button, + #DlgTrackInfo QDoubleSpinBox::down-button { + image: url(skins:LateNight/palemoon/buttons/btn__pref_spinbox_down.svg) no-repeat; + } + /* add disabled icons */ + +DlgPreferences QCheckBox::indicator, +DlgPreferences QRadioButton::indicator, +DlgPreferences QTableView::indicator, +DlgTagFetcher QCheckBox::indicator, +#Skin QDialog QCheckBox::indicator, +#DlgTrackInfo QCheckBox::indicator, +#DlgTrackInfoMulti QCheckBox::indicator { + width: 0.8em; + height: 0.8em; + margin-top: 0.1em; /* align icon with text */ + /* this would also shift regular checkboxes */ + /* subcontrol-position: center center;*/ + } + DlgPreferences QTableView::indicator { + /* doesn't center checkbox */ + text-align: center; + subcontrol-origin: margin; + subcontrol-position: center center; + text-align: center; + /* this shifts content but also reveals blue 'selected' bg from Qt theme, + visible even if we set bg for ::item:selected */ + /* margin-left: 10px; */ + margin: 0px; + padding-left: 40px; + border: 0px solid blue; + } + + DlgPreferences QCheckBox::indicator:unchecked, + DlgPreferences QTableView::indicator:unchecked, + DlgTrackInfo QCheckBox::indicator:unchecked, + DlgTagFetcher QCheckBox::indicator:unchecked, + #Skin QDialog QCheckBox::indicator:unchecked, + #DlgTrackInfo QCheckBox::indicator:unchecked, + #DlgTrackInfoMulti QCheckBox::indicator:unchecked { +/* image: url(skins:LateNight/palemoon/buttons/btn__pref_checkbox.svg) no-repeat center center;*/ + image: url(skins:LateNight/palemoon/buttons/btn__pref_checkbox.svg); + } + DlgPreferences QCheckBox::indicator:disabled:unchecked, + DlgPreferences QTableView::indicator:disabled:unchecked, + DlgTrackInfo QCheckBox::indicator:disabled:unchecked, + #Skin QDialog QCheckBox::indicator:disabled:unchecked, + #DlgTrackInfo QCheckBox::indicator:disabled:unchecked, + #DlgTrackInfoMulti QCheckBox::indicator:disabled:unchecked { + image: url(skins:LateNight/palemoon/buttons/btn__pref_checkbox_disabled.svg) no-repeat center center; + } + DlgPreferences QCheckBox::indicator:checked, + DlgPreferences QTableView::indicator:checked, + DlgTrackInfo QCheckBox::indicator:checked, + DlgTagFetcher QCheckBox::indicator:checked, + #Skin QDialog QCheckBox::indicator:checked, + #DlgTrackInfo QCheckBox::indicator:checked, + #DlgTrackInfoMulti QCheckBox::indicator:checked { + image: url(skins:LateNight/palemoon/buttons/btn__pref_checkmark_blue.svg) no-repeat center center; + } + DlgPreferences QCheckBox::indicator:disabled:checked, + DlgPreferences QTableView::indicator:disabled:checked, + DlgTrackInfo QCheckBox::indicator:disabled:checked, + #Skin QDialog QCheckBox::indicator:disabled:checked, + #DlgTrackInfo QCheckBox::indicator:disabled:checked, + #DlgTrackInfoMulti QCheckBox::indicator:disabled:checked { + image: url(skins:LateNight/palemoon/buttons/btn__pref_checkmark_grey.svg) no-repeat center center; + } + + DlgPreferences QRadioButton::indicator:checked { + image: url(skins:LateNight/palemoon/buttons/btn__pref_radio_button_on.svg) center center; + } + DlgPreferences QRadioButton::indicator:unchecked { + image: url(skins:LateNight/palemoon/buttons/btn__lib_radio_button_off.svg) center center; + } + +/* Clear button in DlgDeveloperTools searchbars */ +#Skin QDialog WSearchLineEdit QToolButton:!focus, +DlgDeveloperTools WSearchLineEdit QToolButton:!focus { + image: url(skins:LateNight/palemoon/buttons/btn__lib_clear_search.svg); + } + #Skin QDialog WSearchLineEdit QToolButton:focus, + DlgDeveloperTools WSearchLineEdit QToolButton:focus { + image: url(skins:LateNight/palemoon/buttons/btn__lib_clear_search_focus.svg); + } + +DlgPreferences QSlider::groove:horizontal { + border: 1px solid #2f2f32; + border-radius: 2px; + background-color: #111115; + height: 3px; + } + DlgPreferences QSlider::groove:focus:horizontal { + border: 1px solid #4097BA; + } + DlgPreferences QSlider::groove:disabled:horizontal { + border: 1px solid #2f2f32; + border-radius: 2px; + background-color: #222228; + height: 3px; + } + DlgPreferences QSlider::sub-page:horizontal { + height: 4px; + background-color: #77777d; + margin: 1px; + } + DlgPreferences QSlider::sub-page:disabled:horizontal { + height: 4px; + background-color: #44444b; + margin: 1px; + } + DlgPreferences QSlider::handle:horizontal { + height: 18px; + width: 12px; + border: 1px solid #66666c; + border-radius: 2px; + background-color: #44444b; + /* make handle taller than slider groove */ + margin: -6px 0px; + } + DlgPreferences QSlider::handle:focus:horizontal { + border: 1px solid #4097BA; + } + +/* Progress bar in TrackExportDlg and library scanner dialog */ +#Skin QDialog QProgressBar { + background-color: #1f1f1f; + border: 1px solid #2f2f32; + border-radius: 2px; + /* padding for the actual bar/chunks */ + padding: 1px; + } + #Skin QDialog QProgressBar::chunk { + background-color: #4097BA; + width: 1px; + margin: 0px; + padding: 0px; + border-radius: 2px; + } + + + +/*********** scrollbars *********************************/ +/* same as WSearchLineEdit QAbstractScrollArea QScrollBar etc. */ + + +/* TODO Preferences + + * Pref Broadcasting: + * find a way to set the status colors in conn. profile table? + + * dialogs: + * style Ok / Yes / No buttons? orange, green, yellow + + * Library: directory list view + + * QComboBox views: + * frame + + * Treeview: + + * DlgPrefController + * checkboxes in mappings' 'Option' delegate + + * DlgTagFetcher: + * progress bar + + */ +/* trying to style link spans, not working */ +DlgPreferences a, +DlgPreferences a:link, +DlgPreferences a:hover, +DlgPreferences a:!visited, +DlgPreferences a:visited, +DlgPreferences a:visited:hover, +DlgPreferencePage a, +DlgPreferencePage a:link, +DlgPreferencePage a:hover, +DlgPreferencePage a:!visited, +DlgPreferencePage a:visited, +DlgPreferencePage a:visited:hover, +DlgPreferencePage QLabel a, +DlgPreferencePage QLabel a:link, +DlgPreferencePage QLabel a:hover, +DlgPreferencePage QLabel a:!visited, +DlgPreferencePage QLabel a:visited, +DlgPreferencePage QLabel a:visited:hover { + color: white; +} +WLibraryTextBrowser a, +WLibraryTextBrowser a:link, +WLibraryTextBrowser a:!visited, +WLibraryTextBrowser a:visited, +WLibraryTextBrowser a:hover { + color: red; +} diff --git a/src/broadcast/broadcastmanager.cpp b/src/broadcast/broadcastmanager.cpp index 6936761bf63..8ae787bd44b 100644 --- a/src/broadcast/broadcastmanager.cpp +++ b/src/broadcast/broadcastmanager.cpp @@ -9,6 +9,7 @@ #include "preferences/settingsmanager.h" #include "soundio/soundmanager.h" #include "util/logger.h" +#include "util/widgethelper.h" namespace { const mixxx::Logger kLogger("BroadcastManager"); @@ -102,8 +103,10 @@ void BroadcastManager::slotControlEnabled(double v) { if (!atLeastOneEnabled) { m_pBroadcastEnabled->set(false); emit broadcastEnabled(0.0); - QMessageBox::warning(nullptr, tr("Action failed"), - tr("Please enable at least one connection to use Live Broadcasting.")); + QMessageBox::warning( + mixxx::widgethelper::getSkinWidget(), + tr("Action failed"), + tr("Please enable at least one connection to use Live Broadcasting.")); return; } diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp index cc3b1547465..8df920e1a38 100644 --- a/src/controllers/dlgprefcontroller.cpp +++ b/src/controllers/dlgprefcontroller.cpp @@ -530,6 +530,11 @@ QString DlgPrefController::mappingFileLinks( return linkList.join("
"); } +void DlgPrefController::enumerateMappings() { + enumerateMappings(m_pControllerManager->getConfiguredMappingFileForDevice( + m_pController->getName())); +} + void DlgPrefController::enumerateMappings(const QString& selectedMappingPath) { m_ui.comboBoxMapping->blockSignals(true); QString currentMappingFilePath = mappingFilePathFromIndex(m_ui.comboBoxMapping->currentIndex()); @@ -537,12 +542,14 @@ void DlgPrefController::enumerateMappings(const QString& selectedMappingPath) { // qDebug() << "Enumerating mappings for controller" << m_pController->getName(); - // Check the text color of the palette for whether to use dark or light icons + // Check the text color of the palette for whether to use dark or light icons. + // For this to work with custom stylesheets we need to set the text color, eg.: + // DlgPrefController { color: yellow; } QDir iconsPath; if (!Color::isDimColor(palette().text().color())) { - iconsPath.setPath(":/images/preferences/light/"); + iconsPath.setPath(PREF_LIGHT_ICON_PATH); } else { - iconsPath.setPath(":/images/preferences/dark/"); + iconsPath.setPath(PREF_DARK_ICON_PATH); } // Insert a dummy item at the top to try to make it less confusing. @@ -829,7 +836,7 @@ bool DlgPrefController::saveMapping() { "Overwrite or save with a new name?"); QString overwriteCheckLabel = tr("Always overwrite during this session"); - QMessageBox overwriteMsgBox; + QMessageBox overwriteMsgBox(this); overwriteMsgBox.setIcon(QMessageBox::Question); overwriteMsgBox.setWindowTitle(overwriteTitle); overwriteMsgBox.setText(overwriteLabel.arg(mappingName)); @@ -885,7 +892,7 @@ bool DlgPrefController::saveMapping() { return true; } -QString DlgPrefController::askForMappingName(const QString& prefilledName) const { +QString DlgPrefController::askForMappingName(const QString& prefilledName) { QString saveMappingTitle = tr("Save user mapping"); QString saveMappingLabel = tr("Enter the name for saving the mapping to the user folder."); QString savingFailedTitle = tr("Saving mapping failed"); @@ -903,7 +910,7 @@ QString DlgPrefController::askForMappingName(const QString& prefilledName) const while (!validMappingName) { QString userDir = m_pUserDir; bool ok = false; - mappingName = QInputDialog::getText(nullptr, + mappingName = QInputDialog::getText(this, saveMappingTitle, saveMappingLabel, QLineEdit::Normal, @@ -916,7 +923,7 @@ QString DlgPrefController::askForMappingName(const QString& prefilledName) const return QString(); } if (mappingName.isEmpty()) { - QMessageBox::warning(nullptr, + QMessageBox::warning(this, savingFailedTitle, invalidNameLabel); continue; @@ -924,7 +931,7 @@ QString DlgPrefController::askForMappingName(const QString& prefilledName) const // While / is allowed for the display name we can't use it for the file name. QString newFilePath = mappingNameToPath(userDir, mappingName); if (QFile::exists(newFilePath)) { - QMessageBox::warning(nullptr, + QMessageBox::warning(this, savingFailedTitle, fileExistsLabel); continue; diff --git a/src/controllers/dlgprefcontroller.h b/src/controllers/dlgprefcontroller.h index 050e29fcd27..a8574a2090c 100644 --- a/src/controllers/dlgprefcontroller.h +++ b/src/controllers/dlgprefcontroller.h @@ -35,6 +35,13 @@ class DlgPrefController : public DlgPreferencePage { QUrl helpUrl() const override; void keyPressEvent(QKeyEvent* pEvent) override; + /// Reload the mappings in the dropdown dialog. + /// Convenience method to be called by DlgPrefControllers. + /// Used to rebuild the mappings list with dark/light icons + /// matching the current color palette. + void enumerateMappings(); + void enumerateMappings(const QString& selectedMappingPath); + public slots: /// Called when the preference dialog (not this page) is shown to the user. void slotUpdate() override; @@ -94,7 +101,7 @@ class DlgPrefController : public DlgPreferencePage { QString mappingSupportLinks(const std::shared_ptr pMapping) const; QString mappingFileLinks(const std::shared_ptr pMapping) const; QString mappingFilePathFromIndex(int index) const; - QString askForMappingName(const QString& prefilledName = QString()) const; + QString askForMappingName(const QString& prefilledName = QString()); void applyMappingChanges(); bool saveMapping(); void initTableView(QTableView* pTable); @@ -118,9 +125,6 @@ class DlgPrefController : public DlgPreferencePage { bool isDirty() const { return m_bDirty; } - - /// Reload the mappings in the dropdown dialog - void enumerateMappings(const QString& selectedMappingPath); MappingInfo enumerateMappingsFromEnumerator( QSharedPointer pMappingEnumerator, const QIcon& icon = QIcon()); diff --git a/src/controllers/dlgprefcontrollers.cpp b/src/controllers/dlgprefcontrollers.cpp index 6ee1e7109dc..0e17dcde157 100644 --- a/src/controllers/dlgprefcontrollers.cpp +++ b/src/controllers/dlgprefcontrollers.cpp @@ -244,9 +244,10 @@ void DlgPrefControllers::setupControllerWidgets() { }(); m_pDlgPreferences->addPageWidget( - DlgPreferences::PreferencesPage(pControllerDlg, pControllerTreeItem), - pController->getName(), - treeImage); + DlgPreferences::PreferencesPage(pControllerDlg, + pControllerTreeItem, + pController->getName(), + treeImage)); m_pControllersRootItem->addChild(pControllerTreeItem); m_controllerTreeItems.append(pControllerTreeItem); @@ -258,6 +259,12 @@ void DlgPrefControllers::setupControllerWidgets() { } } +void DlgPrefControllers::updateMappingIconsInControllerPages() { + for (auto page : std::as_const(m_controllerPages)) { + page->enumerateMappings(); + } +} + void DlgPrefControllers::slotHighlightDevice(DlgPrefController* pControllerDlg, bool enabled) { int controllerPageIndex = m_controllerPages.indexOf(pControllerDlg); if (controllerPageIndex < 0) { diff --git a/src/controllers/dlgprefcontrollers.h b/src/controllers/dlgprefcontrollers.h index b6dc74a42e8..318d50b1385 100644 --- a/src/controllers/dlgprefcontrollers.h +++ b/src/controllers/dlgprefcontrollers.h @@ -29,6 +29,9 @@ class DlgPrefControllers : public DlgPreferencePage, public Ui::DlgPrefControlle bool handleTreeItemClick(QTreeWidgetItem* clickedItem); QUrl helpUrl() const override; + /// Calls slotUpdate() of each controller page to update the mapping icons + void updateMappingIconsInControllerPages(); + public slots: /// Called when the preference dialog (not this page) is shown to the user. void slotUpdate() override; diff --git a/src/defs_urls.h b/src/defs_urls.h index 17e2b4a5dc3..c68dbd36d6c 100644 --- a/src/defs_urls.h +++ b/src/defs_urls.h @@ -11,6 +11,8 @@ // Icons used for the main window and dialogs #define MIXXX_ICON_PATH ":/images/icons/scalable/apps/mixxx.svg" #define MIXXX_LOGO_PATH ":/images/mixxx_logo.svg" +#define PREF_DARK_ICON_PATH ":/images/preferences/dark/" +#define PREF_LIGHT_ICON_PATH ":/images/preferences/light/" #define MIXXX_WEBSITE_URL "https://www.mixxx.org" #define MIXXX_WEBSITE_SHORT_URL "www.mixxx.org" diff --git a/src/dialog/dlgabout.cpp b/src/dialog/dlgabout.cpp index f31f86ef95d..f9406f0b9ea 100644 --- a/src/dialog/dlgabout.cpp +++ b/src/dialog/dlgabout.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "defs_urls.h" #include "moc_dlgabout.cpp" @@ -10,8 +11,8 @@ #include "util/desktophelper.h" #include "util/versionstore.h" -DlgAbout::DlgAbout() - : QDialog(nullptr), +DlgAbout::DlgAbout(QWidget* pParent) + : QDialog(pParent), Ui::DlgAboutDlg() { setupUi(this); setWindowIcon(QIcon(MIXXX_ICON_PATH)); @@ -422,6 +423,11 @@ DlgAbout::DlgAbout() specialThanks.join("
")); textBrowser->setHtml(sections.join("")); + // Apparenty a custm stylesheet is not applied before show(). In order to + // create the correct link color and pick the Donate icon matching the + // stylesheet we need to polsih manually. + style()->polish(this); + textWebsiteLink->setText( QString("%3") .arg(Color::blendColors(palette().link().color(), diff --git a/src/dialog/dlgabout.h b/src/dialog/dlgabout.h index b423b194eae..e563cd14d68 100644 --- a/src/dialog/dlgabout.h +++ b/src/dialog/dlgabout.h @@ -7,5 +7,5 @@ class DlgAbout : public QDialog, public Ui::DlgAboutDlg { Q_OBJECT public: - DlgAbout(); + DlgAbout(QWidget* pParent); }; diff --git a/src/effects/presets/effectchainpresetmanager.cpp b/src/effects/presets/effectchainpresetmanager.cpp index 9ed3a6e1592..eae12340232 100644 --- a/src/effects/presets/effectchainpresetmanager.cpp +++ b/src/effects/presets/effectchainpresetmanager.cpp @@ -14,6 +14,7 @@ #include "effects/presets/effectxmlelements.h" #include "moc_effectchainpresetmanager.cpp" #include "util/filename.h" +#include "util/widgethelper.h" #include "util/xml.h" namespace { @@ -108,7 +109,8 @@ EffectChainPresetPointer EffectChainPresetManager::quickEffectPresetAtIndex( } bool EffectChainPresetManager::importPreset() { - QStringList fileNames = QFileDialog::getOpenFileNames(nullptr, + QStringList fileNames = QFileDialog::getOpenFileNames( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Import effect chain preset"), QDir::homePath(), tr("Mixxx Effect Chain Presets") + QStringLiteral(" (*") + @@ -210,7 +212,7 @@ void EffectChainPresetManager::exportPreset(const QString& chainPresetName) { } QFileDialog saveFileDialog( - nullptr, + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Export effect chain preset"), QString(), tr("Mixxx Effect Chain Presets") + QStringLiteral(" (*") + @@ -227,7 +229,7 @@ void EffectChainPresetManager::exportPreset(const QString& chainPresetName) { QFile file(fileName); if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly)) { - QMessageBox msgBox; + QMessageBox msgBox(mixxx::widgethelper::getSkinWidget()); // parent to apply skin styles msgBox.setText(tr("Error exporting effect chain preset")); msgBox.setInformativeText( tr("Could not save effect chain preset \"%1\" to file \"%2\".") @@ -252,7 +254,7 @@ bool EffectChainPresetManager::renamePreset(const QString& oldName) { return false; } if (m_effectChainPresets.value(oldName)->isReadOnly()) { - QMessageBox msgBox; + QMessageBox msgBox(mixxx::widgethelper::getSkinWidget()); // parent to apply skin styles msgBox.setText(tr("Effect chain preset can not be renamed")); msgBox.setInformativeText( tr("Effect chain preset \"%1\" is read-only and can not be renamed.") @@ -268,7 +270,8 @@ bool EffectChainPresetManager::renamePreset(const QString& oldName) { while (newName.isEmpty() || m_effectChainPresets.contains(newName) || newName == kNoEffectString) { bool okay = false; - newName = QInputDialog::getText(nullptr, + newName = QInputDialog::getText( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Rename effect chain preset"), errorText + "\n" + tr("New name for effect chain preset") + QStringLiteral(" \"") + oldName + QStringLiteral("\""), @@ -311,7 +314,7 @@ bool EffectChainPresetManager::renamePreset(const QString& oldName) { QFile oldFile(directoryPath + kFolderDelimiter + mixxx::filename::sanitize(oldName) + kXmlFileExtension); if (!oldFile.remove()) { - QMessageBox msgBox; + QMessageBox msgBox(mixxx::widgethelper::getSkinWidget()); // parent to apply skin styles msgBox.setText(tr("Error removing old effect chain preset")); msgBox.setInformativeText( tr("Could not remove old effect chain preset \"%1\"") @@ -341,7 +344,7 @@ bool EffectChainPresetManager::deletePreset(const QString& chainPresetName) { return false; } if (m_effectChainPresets.value(chainPresetName)->isReadOnly()) { - QMessageBox msgBox; + QMessageBox msgBox(mixxx::widgethelper::getSkinWidget()); // parent to apply skin styles msgBox.setText(tr("Effect chain preset can not be deleted")); msgBox.setInformativeText( tr("Effect chain preset \"%1\" is read-only and can not be deleted.") @@ -350,7 +353,8 @@ bool EffectChainPresetManager::deletePreset(const QString& chainPresetName) { msgBox.exec(); return false; } - auto pressedButton = QMessageBox::question(nullptr, + auto pressedButton = QMessageBox::question( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Remove effect chain preset"), tr("Are you sure you want to delete the effect chain preset " "\"%1\"?") @@ -458,7 +462,8 @@ bool EffectChainPresetManager::savePreset(EffectChainPresetPointer pPreset) { } while (name.isEmpty() || m_effectChainPresets.contains(name) || name == kNoEffectString) { bool okay = false; - name = QInputDialog::getText(nullptr, + name = QInputDialog::getText( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Save preset for effect chain"), errorText + "\n" + tr("Name for new effect chain preset:"), QLineEdit::Normal, diff --git a/src/errordialoghandler.cpp b/src/errordialoghandler.cpp index 4874ee91611..7cb93ab88d6 100644 --- a/src/errordialoghandler.cpp +++ b/src/errordialoghandler.cpp @@ -152,7 +152,7 @@ void ErrorDialogHandler::errorDialog(ErrorDialogProperties* pProps) { return; } - QMessageBox* pMsgBox = new QMessageBox(); + QMessageBox* pMsgBox = new QMessageBox(mixxx::widgethelper::getSkinWidget()); pMsgBox->setIcon(props->m_icon); pMsgBox->setWindowTitle(props->m_title); pMsgBox->setText(props->m_text); diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 34478e0d961..db9e5e30c50 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -19,6 +19,7 @@ #include "util/clipboard.h" #include "util/defs.h" #include "util/dnd.h" +#include "util/widgethelper.h" #include "widget/wlibrary.h" #include "widget/wlibrarysidebar.h" @@ -200,7 +201,8 @@ void AutoDJFeature::activate() { } void AutoDJFeature::clear() { - QMessageBox::StandardButton btn = QMessageBox::question(nullptr, + QMessageBox::StandardButton btn = QMessageBox::question( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Confirmation Clear"), tr("Do you really want to remove all tracks from the Auto DJ queue?") + tr("This can not be undone."), diff --git a/src/library/dlgtagfetcher.cpp b/src/library/dlgtagfetcher.cpp index 59361de64b8..a6cd6efd44b 100644 --- a/src/library/dlgtagfetcher.cpp +++ b/src/library/dlgtagfetcher.cpp @@ -140,10 +140,13 @@ void updateOriginalTag(const Track& track, QTreeWidget* pParent) { } // anonymous namespace -DlgTagFetcher::DlgTagFetcher(UserSettingsPointer pConfig, const TrackModel* pTrackModel) +DlgTagFetcher::DlgTagFetcher( + QWidget* pParent, + UserSettingsPointer pConfig, + const TrackModel* pTrackModel) // No parent because otherwise it inherits the style parent's // style which can make it unreadable. Bug #673411 - : QDialog(nullptr), + : QDialog(pParent), m_pConfig(pConfig), m_pTrackModel(pTrackModel), m_tagFetcher(this), diff --git a/src/library/dlgtagfetcher.h b/src/library/dlgtagfetcher.h index f2698e740b6..16a3ee95125 100644 --- a/src/library/dlgtagfetcher.h +++ b/src/library/dlgtagfetcher.h @@ -25,7 +25,9 @@ class DlgTagFetcher : public QDialog, public Ui::DlgTagFetcher { public: // TODO: Remove dependency on TrackModel explicit DlgTagFetcher( - UserSettingsPointer pConfig, const TrackModel* pTrackModel = nullptr); + QWidget* pParent, + UserSettingsPointer pConfig, + const TrackModel* pTrackModel = nullptr); ~DlgTagFetcher() override = default; void init(); diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index c13d7eda46f..83c9770aa40 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -36,11 +36,10 @@ const QString kBpmPropertyName = QStringLiteral("bpm"); } // namespace DlgTrackInfo::DlgTrackInfo( + QWidget* pParent, UserSettingsPointer pUserSettings, const TrackModel* trackModel) - // No parent because otherwise it inherits the style parent's - // style which can make it unreadable. Bug #673411 - : QDialog(nullptr), + : QDialog(pParent), m_pUserSettings(std::move(pUserSettings)), m_pTrackModel(trackModel), m_tapFilter(this, kFilterLength, kMaxInterval), @@ -822,7 +821,9 @@ void DlgTrackInfo::slotTrackChanged(TrackId trackId) { void DlgTrackInfo::slotImportMetadataFromMusicBrainz() { if (!m_pDlgTagFetcher) { m_pDlgTagFetcher = std::make_unique( - m_pUserSettings, m_pTrackModel); + this, + m_pUserSettings, + m_pTrackModel); connect(m_pDlgTagFetcher.get(), &QDialog::finished, this, diff --git a/src/library/dlgtrackinfo.h b/src/library/dlgtrackinfo.h index c6404acd843..d788a0211f1 100644 --- a/src/library/dlgtrackinfo.h +++ b/src/library/dlgtrackinfo.h @@ -30,6 +30,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo { public: // TODO: Remove dependency on TrackModel explicit DlgTrackInfo( + QWidget* pParent, UserSettingsPointer pUserSettings, const TrackModel* trackModel = nullptr); ~DlgTrackInfo() override = default; diff --git a/src/library/dlgtrackinfomulti.cpp b/src/library/dlgtrackinfomulti.cpp index f7f47374861..ffb09b4f8e7 100644 --- a/src/library/dlgtrackinfomulti.cpp +++ b/src/library/dlgtrackinfomulti.cpp @@ -100,10 +100,10 @@ void setCommonValueOrVariousStringAndFormatFont(QLabel* pLabel, } // namespace -DlgTrackInfoMulti::DlgTrackInfoMulti(UserSettingsPointer pUserSettings) - // No parent because otherwise it inherits the style parent's - // style which can make it unreadable. Bug #673411 - : QDialog(nullptr), +DlgTrackInfoMulti::DlgTrackInfoMulti( + QWidget* pParent, + UserSettingsPointer pUserSettings) + : QDialog(pParent), m_pUserSettings(std::move(pUserSettings)), m_pWCoverArtMenu(make_parented(this)), m_pWCoverArtLabel(make_parented(this, m_pWCoverArtMenu)), diff --git a/src/library/dlgtrackinfomulti.h b/src/library/dlgtrackinfomulti.h index d733bda4788..c3f3215ce27 100644 --- a/src/library/dlgtrackinfomulti.h +++ b/src/library/dlgtrackinfomulti.h @@ -25,7 +25,9 @@ class WCoverArtLabel; class DlgTrackInfoMulti : public QDialog, public Ui::DlgTrackInfoMulti { Q_OBJECT public: - explicit DlgTrackInfoMulti(UserSettingsPointer pUserSettings); + explicit DlgTrackInfoMulti( + QWidget* pParent, + UserSettingsPointer pUserSettings); ~DlgTrackInfoMulti() override = default; void loadTracks(const QList& pTracks); diff --git a/src/library/export/trackexportdlg.cpp b/src/library/export/trackexportdlg.cpp index bfe85e9c254..1dff951b909 100644 --- a/src/library/export/trackexportdlg.cpp +++ b/src/library/export/trackexportdlg.cpp @@ -56,7 +56,7 @@ void TrackExportDlg::slotProgress(const QString& filename, int progress, int cou } else { statusLabel->setText(tr("Exporting %1").arg(filename)); } - exportProgress->setMinimum(0); + // TODO Set max in showEvent(), get const count from worker exportProgress->setMaximum(count); exportProgress->setValue(progress); } @@ -68,7 +68,8 @@ void TrackExportDlg::slotAskOverwriteMode( QMessageBox::Warning, tr("Overwrite Existing File?"), tr("\"%1\" already exists, overwrite?").arg(filename), - QMessageBox::Cancel); + QMessageBox::Cancel, + this); QPushButton* pSkip = question_box.addButton( tr("&Skip"), QMessageBox::NoRole); @@ -105,7 +106,7 @@ void TrackExportDlg::finish() { m_worker->wait(); if (!m_worker->errorMessage().isEmpty()) { QMessageBox::warning( - nullptr, + this, tr("Export Error"), m_worker->errorMessage(), QMessageBox::Ok, diff --git a/src/library/export/trackexportwizard.cpp b/src/library/export/trackexportwizard.cpp index 4c6a9e40cc3..29b8d9de476 100644 --- a/src/library/export/trackexportwizard.cpp +++ b/src/library/export/trackexportwizard.cpp @@ -4,6 +4,7 @@ #include #include "moc_trackexportwizard.cpp" +#include "util/widgethelper.h" void TrackExportWizard::exportTracks() { if (!selectDestinationDirectory()) { @@ -32,6 +33,7 @@ bool TrackExportWizard::selectDestinationDirectory() { ConfigValue(destDir)); m_worker.reset(new TrackExportWorker(destDir, m_tracks)); - m_dialog.reset(new TrackExportDlg(m_parent, m_pConfig, m_worker.data())); + m_dialog.reset(new TrackExportDlg( + mixxx::widgethelper::getSkinWidget(), m_pConfig, m_worker.data())); return true; } diff --git a/src/library/export/trackexportwizard.h b/src/library/export/trackexportwizard.h index 18dcf4b16bf..39de7f809ad 100644 --- a/src/library/export/trackexportwizard.h +++ b/src/library/export/trackexportwizard.h @@ -19,8 +19,9 @@ class TrackExportWizard : public QObject { Q_OBJECT public: - TrackExportWizard(QWidget* parent, UserSettingsPointer pConfig, const TrackPointerList& tracks) - : m_parent(parent), m_pConfig(pConfig), m_tracks(tracks) { + TrackExportWizard(UserSettingsPointer pConfig, const TrackPointerList& tracks) + : m_pConfig(pConfig), + m_tracks(tracks) { } virtual ~TrackExportWizard() { } @@ -31,7 +32,6 @@ class TrackExportWizard : public QObject { private: bool selectDestinationDirectory(); - QWidget* m_parent; UserSettingsPointer m_pConfig; TrackPointerList m_tracks; QScopedPointer m_dialog; diff --git a/src/library/trackcollection.cpp b/src/library/trackcollection.cpp index 011ef73e4ed..09cb286f7f0 100644 --- a/src/library/trackcollection.cpp +++ b/src/library/trackcollection.cpp @@ -8,6 +8,7 @@ #include "util/db/sqltransaction.h" #include "util/dnd.h" #include "util/logger.h" +#include "util/widgethelper.h" namespace { @@ -299,13 +300,13 @@ bool TrackCollection::hideTracks(const QList& trackIds) { "\"\n\n"; if (QMessageBox::question( - nullptr, - tr("Hiding tracks"), - tr("The selected tracks are in the following playlists:" - "%1" - "Hiding them will remove them from these playlists. Continue?") - .arg(playlistNamesSection), - QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) { + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles + tr("Hiding tracks"), + tr("The selected tracks are in the following playlists:" + "%1" + "Hiding them will remove them from these playlists. Continue?") + .arg(playlistNamesSection), + QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) { return false; } } diff --git a/src/library/trackset/baseplaylistfeature.cpp b/src/library/trackset/baseplaylistfeature.cpp index 71362d34885..541b319bfee 100644 --- a/src/library/trackset/baseplaylistfeature.cpp +++ b/src/library/trackset/baseplaylistfeature.cpp @@ -23,6 +23,7 @@ #include "util/assert.h" #include "util/defs.h" #include "util/file.h" +#include "util/widgethelper.h" #include "widget/wlibrary.h" #include "widget/wlibrarysidebar.h" #include "widget/wlibrarytextbrowser.h" @@ -425,7 +426,8 @@ void BasePlaylistFeature::slotDeletePlaylist() { return; } - QMessageBox::StandardButton btn = QMessageBox::question(nullptr, + QMessageBox::StandardButton btn = QMessageBox::question( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles, tr("Confirm Deletion"), tr("Do you really want to delete playlist %1?") .arg(m_playlistDao.getPlaylistName(playlistId)), @@ -645,7 +647,7 @@ void BasePlaylistFeature::slotExportTrackFiles() { return; } - TrackExportWizard track_export(nullptr, m_pConfig, tracks); + TrackExportWizard track_export(m_pConfig, tracks); track_export.exportTracks(); } diff --git a/src/library/trackset/crate/cratefeature.cpp b/src/library/trackset/crate/cratefeature.cpp index 4de07c8b02d..3c4928b38f4 100644 --- a/src/library/trackset/crate/cratefeature.cpp +++ b/src/library/trackset/crate/cratefeature.cpp @@ -23,6 +23,7 @@ #include "track/track.h" #include "util/defs.h" #include "util/file.h" +#include "util/widgethelper.h" #include "widget/wlibrary.h" #include "widget/wlibrarysidebar.h" #include "widget/wlibrarytextbrowser.h" @@ -444,7 +445,8 @@ void CrateFeature::slotDeleteCrate() { storePrevSiblingCrateId(crateId); } - QMessageBox::StandardButton btn = QMessageBox::question(nullptr, + QMessageBox::StandardButton btn = QMessageBox::question( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Confirm Deletion"), tr("Do you really want to delete crate %1?") .arg(crate.getName()), @@ -475,7 +477,8 @@ void CrateFeature::slotRenameCrate() { for (;;) { bool ok = false; auto newName = - QInputDialog::getText(nullptr, + QInputDialog::getText( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Rename Crate"), tr("Enter new name for crate:"), QLineEdit::Normal, @@ -486,13 +489,15 @@ void CrateFeature::slotRenameCrate() { return; } if (newName.isEmpty()) { - QMessageBox::warning(nullptr, + QMessageBox::warning( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Renaming Crate Failed"), tr("A crate cannot have a blank name.")); continue; } if (m_pTrackCollection->crates().readCrateByName(newName)) { - QMessageBox::warning(nullptr, + QMessageBox::warning( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Renaming Crate Failed"), tr("A crate by that name already exists.")); continue; @@ -732,7 +737,8 @@ void CrateFeature::slotCreateImportCrate() { } if (!m_pTrackCollection->insertCrate(crate, &lastCrateId)) { - QMessageBox::warning(nullptr, + QMessageBox::warning( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles tr("Crate Creation Failed"), tr("An unknown error occurred while creating crate: ") + crate.getName()); @@ -859,7 +865,7 @@ void CrateFeature::slotExportTrackFiles() { return; } - TrackExportWizard track_export(nullptr, m_pConfig, trackpointers); + TrackExportWizard track_export(m_pConfig, trackpointers); track_export.exportTracks(); } diff --git a/src/library/trackset/setlogfeature.cpp b/src/library/trackset/setlogfeature.cpp index 68d4bd80a78..76a7c42cbd0 100644 --- a/src/library/trackset/setlogfeature.cpp +++ b/src/library/trackset/setlogfeature.cpp @@ -15,6 +15,7 @@ #include "moc_setlogfeature.cpp" #include "track/track.h" #include "util/make_const_iterator.h" +#include "util/widgethelper.h" #include "widget/wlibrary.h" #include "widget/wlibrarysidebar.h" #include "widget/wtracktableview.h" @@ -538,7 +539,8 @@ void SetlogFeature::slotDeleteAllUnlockedChildPlaylists() { } QString year = m_lastRightClickedIndex.data().toString(); - QMessageBox::StandardButton btn = QMessageBox::question(nullptr, + QMessageBox::StandardButton btn = QMessageBox::question( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles, tr("Confirm Deletion"), //: %1 is the year //: + are used to make the text in between bold in the popup @@ -562,7 +564,8 @@ void SetlogFeature::slotDeleteAllUnlockedChildPlaylists() { } } // Double-check, this is a weighty decision - btn = QMessageBox::warning(nullptr, + btn = QMessageBox::warning( + mixxx::widgethelper::getSkinWidget(), // parent to apply skin styles, tr("Confirm Deletion"), //: %1 is the number of playlists to be deleted //: %2 is the year diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index 3d0edcef530..fec8cd9fdf7 100644 --- a/src/mixxxmainwindow.cpp +++ b/src/mixxxmainwindow.cpp @@ -321,13 +321,17 @@ void MixxxMainWindow::initialize() { tryParseAndSetDefaultStyleSheet(); - if (!loadConfiguredSkin()) { + if (loadConfiguredSkin()) { + // Note(ronso0) from here on it's safe to use m_pCentralWidget + // as parent for our dialogs. Other (also non-GUI) classes can use + // mixxx::widgethelper::getSkinWidget() which will return the + // skin widget or nullptr. + styleMenubarPreferencesAndDialogs(); + } else { reportCriticalErrorAndQuit( "default skin cannot be loaded - see mixxx trace for more information"); m_pCentralWidget = oldWidget; - //TODO (XXX) add dialog to warn user and launch skin choice page - } else { - m_pMenuBar->setStyleSheet(m_pCentralWidget->styleSheet()); + // TODO (XXX) add dialog to warn user and launch skin choice page } // Check direct rendering and warn user if they don't have it @@ -575,7 +579,7 @@ void MixxxMainWindow::alwaysHideMenuBarDlg() { "
") // line break for some extra margin to the checkbox .arg(hideBtnLabel, showBtnLabel); - QMessageBox msg; + QMessageBox msg(m_pCentralWidget); msg.setIcon(QMessageBox::Question); msg.setWindowTitle(title); msg.setText(desc); @@ -600,7 +604,7 @@ void MixxxMainWindow::alwaysHideMenuBarDlg() { QDialog::DialogCode MixxxMainWindow::soundDeviceErrorDlg( const QString &title, const QString &text, bool* retryClicked) { - QMessageBox msgBox; + QMessageBox msgBox(m_pCentralWidget); msgBox.setIcon(QMessageBox::Warning); msgBox.setWindowTitle(title); msgBox.setText(text); @@ -699,7 +703,7 @@ QDialog::DialogCode MixxxMainWindow::soundDeviceErrorMsgDlg( } QDialog::DialogCode MixxxMainWindow::noOutputDlg(bool* continueClicked) { - QMessageBox msgBox; + QMessageBox msgBox(m_pCentralWidget); msgBox.setIcon(QMessageBox::Warning); msgBox.setWindowTitle(tr("No Output Devices")); msgBox.setText( @@ -988,7 +992,8 @@ void MixxxMainWindow::slotFileLoadSongPlayer(int deck) { QString areYouSure = tr("Are you sure you want to load a new track?"); if (ControlObject::get(ConfigKey(group, "play")) > 0.0) { - int ret = QMessageBox::warning(this, + int ret = QMessageBox::warning( + m_pCentralWidget, VersionStore::applicationName(), deckWarningMessage + "\n" + areYouSure, QMessageBox::Yes | QMessageBox::No, @@ -1073,7 +1078,7 @@ void MixxxMainWindow::slotOptionsPreferences() { void MixxxMainWindow::slotNoVinylControlInputConfigured() { QMessageBox::StandardButton btn = QMessageBox::warning( - this, + m_pCentralWidget, VersionStore::applicationName(), tr("There is no input device selected for this vinyl control.\n" "Please select an input device in the sound hardware preferences first."), @@ -1087,7 +1092,7 @@ void MixxxMainWindow::slotNoVinylControlInputConfigured() { void MixxxMainWindow::slotNoDeckPassthroughInputConfigured() { QMessageBox::StandardButton btn = QMessageBox::warning( - this, + m_pCentralWidget, VersionStore::applicationName(), tr("There is no input device selected for this passthrough control.\n" "Please select an input device in the sound hardware preferences first."), @@ -1101,7 +1106,7 @@ void MixxxMainWindow::slotNoDeckPassthroughInputConfigured() { void MixxxMainWindow::slotNoMicrophoneInputConfigured() { QMessageBox::StandardButton btn = QMessageBox::question( - this, + m_pCentralWidget, VersionStore::applicationName(), tr("There is no input device selected for this microphone.\n" "Do you want to select an input device?"), @@ -1115,7 +1120,7 @@ void MixxxMainWindow::slotNoMicrophoneInputConfigured() { void MixxxMainWindow::slotNoAuxiliaryInputConfigured() { QMessageBox::StandardButton btn = QMessageBox::question( - this, + m_pCentralWidget, VersionStore::applicationName(), tr("There is no input device selected for this auxiliary.\n" "Do you want to select an input device?"), @@ -1128,13 +1133,13 @@ void MixxxMainWindow::slotNoAuxiliaryInputConfigured() { } void MixxxMainWindow::slotHelpAbout() { - DlgAbout* about = new DlgAbout; + DlgAbout* about = new DlgAbout(m_pCentralWidget); about->show(); } void MixxxMainWindow::slotShowKeywheel(bool toggle) { if (!m_pKeywheel) { - m_pKeywheel = make_parented(this, m_pCoreServices->getSettings()); + m_pKeywheel = make_parented(m_pCentralWidget, m_pCoreServices->getSettings()); // uncheck the menu item on window close connect(m_pKeywheel.get(), &DlgKeywheel::finished, @@ -1190,12 +1195,12 @@ void MixxxMainWindow::rebootMixxxView() { if (!loadConfiguredSkin()) { QMessageBox::critical(this, - tr("Error in skin file"), - tr("The selected skin cannot be loaded.")); + tr("Error in skin file"), + tr("The selected skin cannot be loaded.")); // m_pWidgetParent is NULL, we can't continue. return; } - m_pMenuBar->setStyleSheet(m_pCentralWidget->styleSheet()); + styleMenubarPreferencesAndDialogs(); setCentralWidget(m_pCentralWidget); #ifdef __LINUX__ @@ -1248,6 +1253,29 @@ void MixxxMainWindow::tryParseAndSetDefaultStyleSheet() { } } +void MixxxMainWindow::styleMenubarPreferencesAndDialogs() { + qWarning() << "################ styleMenubarPreferencesAndDialogs"; + Timer tg("setStyleSheets"); + tg.start(); + Timer t("sub"); + t.start(); + // TODO In some situations this took a long time: + // 3.5s with Core i7-8665u for PaleMoon stylesheet (~3700 lines) + // Duration seemed to depends in the stylesheet size, so I tried to extract + // relevant parts from skin stylesheet on the fly with regex: ~8 ms + m_pMenuBar->setStyleSheet(m_pCentralWidget->styleSheet()); + qWarning() << " ."; + qWarning() << " setStyle menubar" << t.elapsed(false).debugMillisWithUnit(); + qWarning() << " ."; + t.restart(true); + + m_pPrefDlg->setStyleSheet(m_pCentralWidget->styleSheet()); + qWarning() << " setStyle pref " << t.elapsed(false).debugMillisWithUnit(); + qWarning() << " ."; + qWarning() << "################################" << tg.elapsed(false).debugMillisWithUnit(); + qWarning() << " ."; +} + /// Catch ToolTip and WindowStateChange events bool MixxxMainWindow::eventFilter(QObject* obj, QEvent* event) { if (event->type() == QEvent::ToolTip) { @@ -1359,7 +1387,8 @@ void MixxxMainWindow::checkDirectRendering() { if (!factory->isOpenGlAvailable() && !factory->isOpenGlesAvailable() && pConfig->getValueString(ConfigKey("[Direct Rendering]", "Warned")) != QString("yes")) { - QMessageBox::warning(nullptr, + QMessageBox::warning( + m_pCentralWidget, tr("OpenGL Direct Rendering"), tr("Direct rendering is not enabled on your machine.

" "This means that the waveform displays will be very
" @@ -1395,28 +1424,34 @@ bool MixxxMainWindow::confirmExit() { } } if (playing) { - QMessageBox::StandardButton btn = QMessageBox::question(this, - tr("Confirm Exit"), - tr("A deck is currently playing. Exit Mixxx?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + QMessageBox::StandardButton btn = QMessageBox::question( + m_pCentralWidget, + tr("Confirm Exit"), + tr("A deck is currently playing. Exit Mixxx?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No); if (btn == QMessageBox::No) { return false; } } else if (playingSampler) { - QMessageBox::StandardButton btn = QMessageBox::question(this, - tr("Confirm Exit"), - tr("A sampler is currently playing. Exit Mixxx?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + QMessageBox::StandardButton btn = QMessageBox::question( + m_pCentralWidget, + tr("Confirm Exit"), + tr("A sampler is currently playing. Exit Mixxx?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No); if (btn == QMessageBox::No) { return false; } } if (m_pPrefDlg && m_pPrefDlg->isVisible()) { QMessageBox::StandardButton btn = QMessageBox::question( - this, tr("Confirm Exit"), - tr("The preferences window is still open.") + "
" + - tr("Discard any changes and exit Mixxx?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + m_pCentralWidget, + tr("Confirm Exit"), + tr("The preferences window is still open.") + "
" + + tr("Discard any changes and exit Mixxx?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No); if (btn == QMessageBox::No) { return false; } diff --git a/src/mixxxmainwindow.h b/src/mixxxmainwindow.h index 1c673578ce3..47884847165 100644 --- a/src/mixxxmainwindow.h +++ b/src/mixxxmainwindow.h @@ -108,6 +108,7 @@ class MixxxMainWindow : public QMainWindow { /// Load skin to a QWidget that we set as the central widget. bool loadConfiguredSkin(); void tryParseAndSetDefaultStyleSheet(); + void styleMenubarPreferencesAndDialogs(); bool confirmExit(); #ifndef __APPLE__ diff --git a/src/preferences/dialog/dlgpreferencepage.h b/src/preferences/dialog/dlgpreferencepage.h index fc6262f90d9..079fac26b33 100644 --- a/src/preferences/dialog/dlgpreferencepage.h +++ b/src/preferences/dialog/dlgpreferencepage.h @@ -73,6 +73,10 @@ class DlgPreferencePage : public QWidget { // Blend the palette colors for regular text and link text to get a color // that is more likely to be visible with dark OS themes. // https://github.com/mixxxdj/mixxx/issues/10170 + // Text color can be set with + // DlgPreferencePage { color: yellow; } + // (if external stylesheets are applied to DlgPreferences) + // No success so far with styling the links. m_pLinkColor = Color::blendColors(palette().link().color(), palette().text().color()) .name(); diff --git a/src/preferences/dialog/dlgpreferences.cpp b/src/preferences/dialog/dlgpreferences.cpp index 47b96b9fa06..477649c836c 100644 --- a/src/preferences/dialog/dlgpreferences.cpp +++ b/src/preferences/dialog/dlgpreferences.cpp @@ -9,6 +9,7 @@ #include #include "controllers/dlgprefcontrollers.h" +#include "defs_urls.h" #include "library/library.h" #include "library/trackcollectionmanager.h" #include "moc_dlgpreferences.cpp" @@ -91,19 +92,16 @@ DlgPreferences::DlgPreferences( } // Check the text color of the palette for whether to use dark or light icons - if (!Color::isDimColor(palette().text().color())) { - m_iconsPath.setPath(":/images/preferences/light/"); - } else { - m_iconsPath.setPath(":/images/preferences/dark/"); - } + // Icons will be updated when a new stylesheet is set. + selectIconsPath(); // Construct widgets for use in tabs. m_soundPage = PreferencesPage( new DlgPrefSound(this, pSoundManager, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)); - addPageWidget(m_soundPage, + new QTreeWidgetItem(contentsTreeWidget), tr("Sound Hardware"), "ic_preferences_soundhardware.svg"); + addPageWidget(m_soundPage); DlgPrefLibrary* plibraryPage = new DlgPrefLibrary(this, m_pConfig, pLibrary); connect(plibraryPage, @@ -111,27 +109,31 @@ DlgPreferences::DlgPreferences( pLibrary->trackCollectionManager(), &TrackCollectionManager::startLibraryScan); addPageWidget(PreferencesPage(plibraryPage, - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new QTreeWidgetItem(contentsTreeWidget), tr("Library"), - "ic_preferences_library.svg"); + "ic_preferences_library.svg")); QTreeWidgetItem* pControllerRootItem = - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type); + new QTreeWidgetItem(contentsTreeWidget); m_pControllersDlg = new DlgPrefControllers( - this, m_pConfig, pControllerManager, pControllerRootItem); - addPageWidget(PreferencesPage(m_pControllersDlg, - pControllerRootItem), + this, + m_pConfig, + pControllerManager, + pControllerRootItem); + addPageWidget(PreferencesPage( + m_pControllersDlg, + pControllerRootItem, tr("Controllers"), - "ic_preferences_controllers.svg"); + "ic_preferences_controllers.svg")); #ifdef __VINYLCONTROL__ // It's important for this to be before the connect for wsound. // TODO(rryan) determine why/if this is still true addPageWidget(PreferencesPage( - new DlgPrefVinyl(this, pVCManager, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefVinyl(this, pVCManager, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Vinyl Control"), - "ic_preferences_vinyl.svg"); + "ic_preferences_vinyl.svg")); #endif // __VINYLCONTROL__ DlgPrefInterface* pInterfacePage = new DlgPrefInterface(this, @@ -152,88 +154,88 @@ DlgPreferences::DlgPreferences( this, &DlgPreferences::menuBarAutoHideChanged, Qt::DirectConnection); - addPageWidget(PreferencesPage(pInterfacePage, - new QTreeWidgetItem( - contentsTreeWidget, QTreeWidgetItem::Type)), + addPageWidget(PreferencesPage( + pInterfacePage, + new QTreeWidgetItem(contentsTreeWidget), tr("Interface"), - "ic_preferences_interface.svg"); + "ic_preferences_interface.svg")); // ugly proxy for determining whether this is being instantiated for QML or legacy QWidgets GUI if (pSkinLoader) { addPageWidget(PreferencesPage( - new DlgPrefWaveform(this, m_pConfig, pLibrary), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefWaveform(this, m_pConfig, pLibrary), + new QTreeWidgetItem(contentsTreeWidget), tr("Waveforms"), - "ic_preferences_waveforms.svg"); + "ic_preferences_waveforms.svg")); } addPageWidget(PreferencesPage( - new DlgPrefColors(this, m_pConfig, pLibrary), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefColors(this, m_pConfig, pLibrary), + new QTreeWidgetItem(contentsTreeWidget), tr("Colors"), - "ic_preferences_colors.svg"); + "ic_preferences_colors.svg")); addPageWidget(PreferencesPage( - new DlgPrefDeck(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefDeck(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Decks"), - "ic_preferences_decks.svg"); + "ic_preferences_decks.svg")); addPageWidget(PreferencesPage( - new DlgPrefMixer(this, pEffectsManager, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefMixer(this, pEffectsManager, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Mixer"), - "ic_preferences_crossfader.svg"); + "ic_preferences_crossfader.svg")); addPageWidget(PreferencesPage( - new DlgPrefEffects(this, m_pConfig, pEffectsManager), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefEffects(this, m_pConfig, pEffectsManager), + new QTreeWidgetItem(contentsTreeWidget), tr("Effects"), - "ic_preferences_effects.svg"); + "ic_preferences_effects.svg")); addPageWidget(PreferencesPage( - new DlgPrefAutoDJ(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefAutoDJ(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Auto DJ"), - "ic_preferences_autodj.svg"); + "ic_preferences_autodj.svg")); #ifdef __BROADCAST__ addPageWidget(PreferencesPage( - new DlgPrefBroadcast(this, pSettingsManager->broadcastSettings()), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefBroadcast(this, pSettingsManager->broadcastSettings()), + new QTreeWidgetItem(contentsTreeWidget), tr("Live Broadcasting"), - "ic_preferences_broadcast.svg"); + "ic_preferences_broadcast.svg")); #endif // __BROADCAST__ addPageWidget(PreferencesPage( - new DlgPrefRecord(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefRecord(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Recording"), - "ic_preferences_recording.svg"); + "ic_preferences_recording.svg")); addPageWidget(PreferencesPage( - new DlgPrefBeats(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefBeats(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Beat Detection"), - "ic_preferences_bpmdetect.svg"); + "ic_preferences_bpmdetect.svg")); addPageWidget(PreferencesPage( - new DlgPrefKey(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefKey(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Key Detection"), - "ic_preferences_keydetect.svg"); + "ic_preferences_keydetect.svg")); addPageWidget(PreferencesPage( - new DlgPrefReplayGain(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefReplayGain(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Normalization"), - "ic_preferences_replaygain.svg"); + "ic_preferences_replaygain.svg")); #ifdef __MODPLUG__ addPageWidget(PreferencesPage( - new DlgPrefModplug(this, m_pConfig), - new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)), + new DlgPrefModplug(this, m_pConfig), + new QTreeWidgetItem(contentsTreeWidget), tr("Modplug Decoder"), - "ic_preferences_modplug.svg"); + "ic_preferences_modplug.svg")); #endif // __MODPLUG__ // Find accept and apply buttons @@ -293,7 +295,7 @@ void DlgPreferences::changePage(QTreeWidgetItem* pCurrent, QTreeWidgetItem* pPre return; } - for (PreferencesPage page : std::as_const(m_allPages)) { + for (const PreferencesPage& page : std::as_const(m_allPages)) { if (pCurrent == page.pTreeItem) { switchToPage(pCurrent->text(0), page.pDlg); break; @@ -315,6 +317,11 @@ bool DlgPreferences::eventFilter(QObject* o, QEvent* e) { if (e->type() == QEvent::Show) { onShow(); } + if (e->type() == QEvent::StyleChange) { + // The stylesheet has been changed or reloaded, + // update the tree icons to match the new palette. + updateTreeIcons(); + } // Standard event processing return QWidget::eventFilter(o, e); @@ -444,12 +451,10 @@ void DlgPreferences::slotButtonPressed(QAbstractButton* pButton) { } } -void DlgPreferences::addPageWidget(PreferencesPage page, - const QString& pageTitle, - const QString& iconFile) { +void DlgPreferences::addPageWidget(const PreferencesPage& page) { // Configure the tree button linked to the page - page.pTreeItem->setIcon(0, QIcon(m_iconsPath.filePath(iconFile))); - page.pTreeItem->setText(0, pageTitle); + page.pTreeItem->setIcon(0, QIcon(m_iconsPath.filePath(page.iconFileName))); + page.pTreeItem->setText(0, page.title); page.pTreeItem->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter); page.pTreeItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); @@ -477,6 +482,26 @@ void DlgPreferences::addPageWidget(PreferencesPage page, page.pDlg->sizeHint() + QSize(iframe, iframe)); } +void DlgPreferences::updateTreeIcons() { + selectIconsPath(); + for (const auto& page : std::as_const(m_allPages)) { + page.pTreeItem->setIcon(0, QIcon(m_iconsPath.filePath(page.iconFileName))); + } + // Update icons in controller mapping list + m_pControllersDlg->updateMappingIconsInControllerPages(); +} + +void DlgPreferences::selectIconsPath() { + // Check the text color of the palette for whether to use dark or light icons. + // For this to work with custom stylesheets we need to set the text color, eg.: + // DlgPreferences { color: yellow; } + if (!Color::isDimColor(palette().text().color())) { + m_iconsPath.setPath(PREF_LIGHT_ICON_PATH); + } else { + m_iconsPath.setPath(PREF_DARK_ICON_PATH); + } +} + DlgPreferencePage* DlgPreferences::currentPage() { QObject* pObject = pagesWidget->currentWidget(); for (int i = 0; i < 2; ++i) { diff --git a/src/preferences/dialog/dlgpreferences.h b/src/preferences/dialog/dlgpreferences.h index ad5f2185662..7bd7e4605c2 100644 --- a/src/preferences/dialog/dlgpreferences.h +++ b/src/preferences/dialog/dlgpreferences.h @@ -34,12 +34,20 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg { struct PreferencesPage { PreferencesPage() { } - PreferencesPage(DlgPreferencePage* pDlg, QTreeWidgetItem* pTreeItem) - : pDlg(pDlg), pTreeItem(pTreeItem) { + PreferencesPage(DlgPreferencePage* pDlg, + QTreeWidgetItem* pTreeItem, + const QString& pageTitle, + const QString& iconFile) + : pDlg(pDlg), + pTreeItem(pTreeItem), + title(pageTitle), + iconFileName(iconFile) { } DlgPreferencePage* pDlg; QTreeWidgetItem* pTreeItem; + QString title; + QString iconFileName; }; DlgPreferences( @@ -53,9 +61,7 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg { std::shared_ptr pLibrary); virtual ~DlgPreferences(); - void addPageWidget(PreferencesPage page, - const QString& pageTitle, - const QString& iconFile); + void addPageWidget(const PreferencesPage& page); void removePageWidget(DlgPreferencePage* pWidget); void expandTreeItem(QTreeWidgetItem* pItem); void switchToPage(const QString& pageTitle, DlgPreferencePage* pPage); @@ -90,6 +96,8 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg { QList m_allPages; void onShow(); void onHide(); + void updateTreeIcons(); + void selectIconsPath(); QRect getDefaultGeometry(); QAbstractButton* m_pApplyButton; diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index b785fb11583..1a75a9c4757 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -365,7 +365,7 @@ void DlgPrefSound::slotApply() { } if (status != SoundDeviceStatus::Ok) { QString error = m_pSoundManager->getLastErrorMessage(status); - QMessageBox::warning(nullptr, tr("Configuration error"), error); + QMessageBox::warning(this, tr("Configuration error"), error); } else { m_settingsModified = false; m_bLatencyChanged = false; @@ -780,7 +780,7 @@ void DlgPrefSound::updateKeylockMultithreading(bool enabled) { if (!enabled) { return; } - QMessageBox msg; + QMessageBox msg(this); msg.setIcon(QMessageBox::Warning); msg.setWindowTitle(tr("Are you sure?")); msg.setText( diff --git a/src/skin/legacy/legacyskinparser.cpp b/src/skin/legacy/legacyskinparser.cpp index a509f8c0fb9..63bb1f72c8e 100644 --- a/src/skin/legacy/legacyskinparser.cpp +++ b/src/skin/legacy/legacyskinparser.cpp @@ -29,6 +29,7 @@ #include "util/cmdlineargs.h" #include "util/timer.h" #include "util/valuetransformer.h" +#include "util/widgethelper.h" #include "util/xml.h" #include "waveform/vsyncthread.h" #include "waveform/waveformwidgetfactory.h" @@ -500,7 +501,11 @@ QList LegacySkinParser::parseNode(const QDomElement& node) { if (newStyle) { // New style skins are just a WidgetGroup at the root. - result.append(parseWidgetGroup(node)); + QWidget* skin = parseWidgetGroup(node); + // Set an object name so we can address child dialogs + // with the skin's stylesheet. + skin->setObjectName(mixxx::widgethelper::skinWidgetName()); + result.append(skin); } else { // From here on is loading for legacy skins only. QWidget* pOuterWidget = new QWidget(m_pParent); @@ -2293,13 +2298,6 @@ QString LegacySkinParser::getStyleFromNode(const QDomNode& node) { style = styleElement.text(); } - // Legacy fixes: In Mixxx <1.12.0 we used QGroupBox for WWidgetGroup. Some - // skin writers used QGroupBox for styling. In 1.12.0 onwards, we have - // switched to QFrame and there should be no reason we would ever use a - // QGroupBox in a skin. To support legacy skins, we rewrite QGroupBox - // selectors to use WWidgetGroup directly. - style = style.replace("QGroupBox", "WWidgetGroup"); - return style; } diff --git a/src/util/file.cpp b/src/util/file.cpp index 0fc19f36167..29e2630211a 100644 --- a/src/util/file.cpp +++ b/src/util/file.cpp @@ -4,6 +4,8 @@ #include // required for 'indexIn(QString &str, int pos) #include +#include "util/widgethelper.h" + namespace { const QRegularExpression kExtractExtensionRegex(R"(\(\*\.(.*)\)$)"); @@ -59,7 +61,7 @@ QString getFilePathWithVerifiedExtensionFromFileDialog( while (true) { fileLocation = QFileDialog::getSaveFileName( - nullptr, + mixxx::widgethelper::getSkinWidget(), caption, selectedDirectory, fileFilters, diff --git a/src/util/widgethelper.cpp b/src/util/widgethelper.cpp index 20210e6278b..06aa36b8f01 100644 --- a/src/util/widgethelper.cpp +++ b/src/util/widgethelper.cpp @@ -1,5 +1,7 @@ #include "util/widgethelper.h" +#include +#include #include #include @@ -48,6 +50,27 @@ QWindow* getWindow( return nullptr; } +QWidget* getSkinWidget() { + QWidget* pCentralWidget = nullptr; + QMainWindow* pMainWindow = nullptr; + const QWidgetList pwidgets = QApplication::topLevelWidgets(); + for (auto* pWidget : pwidgets) { + if ((pMainWindow = qobject_cast(pWidget))) { + // This fetches the #Skin widget + pCentralWidget = pMainWindow->centralWidget(); + break; + } + } + // We only want the 'Skin' widget, not the temporary LaunchImage + // Alt: avoid the literal object name, assumes the central widget + // can only be nullptr, 'Skin' or LaunchImage. + // if (pCentralWidget && qobject_cast(pCentralWidget) == nullptr) { + if (pCentralWidget && pCentralWidget->objectName() == skinWidgetName()) { + return pCentralWidget; + } + return nullptr; +} + void growListWidget(QListWidget& listWidget, const QWidget& parent) { // Try to display all files and the complete file locations to avoid // horizontal scrolling. diff --git a/src/util/widgethelper.h b/src/util/widgethelper.h index dad949b4a4a..1f3824d9575 100644 --- a/src/util/widgethelper.h +++ b/src/util/widgethelper.h @@ -25,8 +25,7 @@ QPoint mapPopupToScreen( /// Might return nullptr if no window could be determined. /// /// Adopted from windowForWidget() in qtbase/src/widgets/kernel/qapplication_p.h -QWindow* getWindow( - const QWidget& widget); +QWindow* getWindow(const QWidget& widget); /// Obtains the corresponding screen for the given widget. /// @@ -50,6 +49,16 @@ inline QScreen* getScreen( #endif } +/// Name for the central skin widget. Set by LegacySkinparser. +inline QString skinWidgetName() { + return QStringLiteral("Skin"); +} + +/// Try to get the QMainWindow's central 'Skin' widget. +/// This is a helper for various GUI or non-GUI classes to use 'Skin' as parent +/// for their dialogs so they inherit the skin's stylesheet. +QWidget* getSkinWidget(); + /// QSize for stretching a list widget attempting to show entire column void growListWidget(QListWidget& listWidget, const QWidget& parent); diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index dc229b53b3c..65c113ba856 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -1509,7 +1509,7 @@ void WTrackMenu::addSelectionToPlaylist(int iPlaylistId) { do { bool ok = false; - name = QInputDialog::getText(nullptr, + name = QInputDialog::getText(this, tr("Create New Playlist"), tr("Enter name for new playlist:"), QLineEdit::Normal, @@ -1520,11 +1520,11 @@ void WTrackMenu::addSelectionToPlaylist(int iPlaylistId) { return; } if (playlistDao.getPlaylistIdFromName(name) != -1) { - QMessageBox::warning(nullptr, + QMessageBox::warning(this, tr("Playlist Creation Failed"), tr("A playlist by that name already exists.")); } else if (name.isEmpty()) { - QMessageBox::warning(nullptr, + QMessageBox::warning(this, tr("Playlist Creation Failed"), tr("A playlist cannot have a blank name.")); } else { @@ -1533,7 +1533,7 @@ void WTrackMenu::addSelectionToPlaylist(int iPlaylistId) { } while (!validNameGiven); iPlaylistId = playlistDao.createPlaylist(name); //-1 is changed to the new playlist ID return from the DAO if (iPlaylistId == -1) { - QMessageBox::warning(nullptr, + QMessageBox::warning(this, tr("Playlist Creation Failed"), tr("An unknown error occurred while creating playlist: ") + name); return; @@ -2372,7 +2372,7 @@ void WTrackMenu::slotRemoveFromDisk() { // First, create the list view for the files to be deleted // NOTE(ronso0) We could also make this a table to allow showing // artist and title if file names don't suffice to identify tracks. - QListWidget* delListWidget = new QListWidget(); + QListWidget* delListWidget = new QListWidget(this); delListWidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)); delListWidget->setFocusPolicy(Qt::ClickFocus); @@ -2436,7 +2436,7 @@ void WTrackMenu::slotRemoveFromDisk() { delLayout->addWidget(delButtons); // Create and populate the dialog - QDialog dlgDelConfirm; + QDialog dlgDelConfirm(this); dlgDelConfirm.setModal(true); // just to be sure #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) dlgDelConfirm.setWindowTitle(tr("Delete Track Files")); @@ -2492,7 +2492,7 @@ void WTrackMenu::slotRemoveFromDisk() { if (s_showPurgeSuccessPopup) { // Show purge summary message - QMessageBox msgBoxPurgeTracks; + QMessageBox msgBoxPurgeTracks(this); msgBoxPurgeTracks.setIcon(QMessageBox::Information); QString msgTitle; QString msgText; @@ -2587,7 +2587,7 @@ void WTrackMenu::slotRemoveFromDisk() { notDeletedLayout->addWidget(notDeletedListWidget); notDeletedLayout->addWidget(notDeletedButtons); - QDialog dlgNotDeleted; + QDialog dlgNotDeleted(this); dlgNotDeleted.setModal(true); dlgNotDeleted.setWindowTitle(tr("Remaining Track File(s)")); dlgNotDeleted.setLayout(notDeletedLayout); @@ -2606,6 +2606,7 @@ void WTrackMenu::slotShowDlgTrackInfo() { // Use the batch editor. // Create a fresh dialog on invocation. m_pDlgTrackInfoMulti = std::make_unique( + this, m_pConfig); connect(m_pDlgTrackInfoMulti.get(), &QDialog::finished, @@ -2629,6 +2630,7 @@ void WTrackMenu::slotShowDlgTrackInfo() { // Use the single-track editor with Next/Prev buttons and DlgTagFetcher. // Create a fresh dialog on invocation. m_pDlgTrackInfo = std::make_unique( + this, m_pConfig, m_pTrackModel); connect(m_pDlgTrackInfo.get(), @@ -2662,7 +2664,9 @@ void WTrackMenu::slotShowDlgTagFetcher() { } // Create a fresh dialog on invocation m_pDlgTagFetcher = std::make_unique( - m_pConfig, m_pTrackModel); + this, + m_pConfig, + m_pTrackModel); connect(m_pDlgTagFetcher.get(), &QDialog::finished, this, diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index c5241fea0e5..b015508dc73 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -1258,7 +1258,7 @@ void WTrackTableView::hideOrRemoveSelectedTracks() { } } - QMessageBox msg; + QMessageBox msg(this); msg.setIcon(QMessageBox::Question); msg.setWindowTitle(title); msg.setText(message); diff --git a/tools/qsscheck.py b/tools/qsscheck.py index d570549f9e7..a02400624dd 100755 --- a/tools/qsscheck.py +++ b/tools/qsscheck.py @@ -23,6 +23,8 @@ CPP_OBJNAMES = [ "LibraryBPMButton", "LibraryPlayedCheckbox", + # and the main skin widget in legacyskinparser.cpp + "Skin", ] # List of Qt Widgets, generated with: From 6a61df9c024a2ba114c84cb47b77b359ee8e80b4 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Tue, 12 Nov 2024 14:18:25 +0100 Subject: [PATCH 2/5] Preferences: make icons match Palemoon --- res/images/preferences/light/ic_custom.svg | 2 +- res/images/preferences/light/ic_mixxx_symbolic.svg | 6 +++--- res/images/preferences/light/ic_none.svg | 2 +- res/images/preferences/light/ic_preferences_autodj.svg | 2 +- res/images/preferences/light/ic_preferences_bpmdetect.svg | 2 +- res/images/preferences/light/ic_preferences_broadcast.svg | 2 +- res/images/preferences/light/ic_preferences_colors.svg | 2 +- res/images/preferences/light/ic_preferences_controllers.svg | 2 +- res/images/preferences/light/ic_preferences_crossfader.svg | 2 +- res/images/preferences/light/ic_preferences_decks.svg | 2 +- res/images/preferences/light/ic_preferences_effects.svg | 4 ++-- res/images/preferences/light/ic_preferences_equalizers.svg | 4 ++-- res/images/preferences/light/ic_preferences_interface.svg | 2 +- res/images/preferences/light/ic_preferences_keydetect.svg | 4 ++-- res/images/preferences/light/ic_preferences_library.svg | 2 +- res/images/preferences/light/ic_preferences_lv2.svg | 2 +- .../preferences/light/ic_preferences_midicontrollers.svg | 4 ++-- res/images/preferences/light/ic_preferences_modplug.svg | 6 +++--- res/images/preferences/light/ic_preferences_recording.svg | 2 +- res/images/preferences/light/ic_preferences_replaygain.svg | 2 +- res/images/preferences/light/ic_preferences_sampler.svg | 2 +- .../preferences/light/ic_preferences_soundhardware.svg | 2 +- res/images/preferences/light/ic_preferences_vinyl.svg | 2 +- res/images/preferences/light/ic_preferences_waveforms.svg | 2 +- 24 files changed, 32 insertions(+), 32 deletions(-) diff --git a/res/images/preferences/light/ic_custom.svg b/res/images/preferences/light/ic_custom.svg index 0bb9cee123c..5b20732f9c3 100644 --- a/res/images/preferences/light/ic_custom.svg +++ b/res/images/preferences/light/ic_custom.svg @@ -1,5 +1,5 @@ - + diff --git a/res/images/preferences/light/ic_mixxx_symbolic.svg b/res/images/preferences/light/ic_mixxx_symbolic.svg index 968670f7d25..3c369ed369c 100644 --- a/res/images/preferences/light/ic_mixxx_symbolic.svg +++ b/res/images/preferences/light/ic_mixxx_symbolic.svg @@ -78,11 +78,11 @@ - + - + @@ -132,7 +132,7 @@ - + diff --git a/res/images/preferences/light/ic_none.svg b/res/images/preferences/light/ic_none.svg index 680b54637bd..86ac9bf1e0c 100644 --- a/res/images/preferences/light/ic_none.svg +++ b/res/images/preferences/light/ic_none.svg @@ -1,5 +1,5 @@ - + diff --git a/res/images/preferences/light/ic_preferences_autodj.svg b/res/images/preferences/light/ic_preferences_autodj.svg index 4d6b4af906b..6c9c077896a 100644 --- a/res/images/preferences/light/ic_preferences_autodj.svg +++ b/res/images/preferences/light/ic_preferences_autodj.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_bpmdetect.svg b/res/images/preferences/light/ic_preferences_bpmdetect.svg index 5566885dc8b..b4d2d81390f 100644 --- a/res/images/preferences/light/ic_preferences_bpmdetect.svg +++ b/res/images/preferences/light/ic_preferences_bpmdetect.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_broadcast.svg b/res/images/preferences/light/ic_preferences_broadcast.svg index eda9ab0123d..7117c8a2e99 100644 --- a/res/images/preferences/light/ic_preferences_broadcast.svg +++ b/res/images/preferences/light/ic_preferences_broadcast.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_colors.svg b/res/images/preferences/light/ic_preferences_colors.svg index 9421215b391..975ab0cb2ab 100644 --- a/res/images/preferences/light/ic_preferences_colors.svg +++ b/res/images/preferences/light/ic_preferences_colors.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_controllers.svg b/res/images/preferences/light/ic_preferences_controllers.svg index 8d36f4d0147..9cb620dc3ed 100644 --- a/res/images/preferences/light/ic_preferences_controllers.svg +++ b/res/images/preferences/light/ic_preferences_controllers.svg @@ -1,4 +1,4 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_crossfader.svg b/res/images/preferences/light/ic_preferences_crossfader.svg index 786128b9256..a0039778628 100644 --- a/res/images/preferences/light/ic_preferences_crossfader.svg +++ b/res/images/preferences/light/ic_preferences_crossfader.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_decks.svg b/res/images/preferences/light/ic_preferences_decks.svg index 79b874e6fd4..03dbd570659 100644 --- a/res/images/preferences/light/ic_preferences_decks.svg +++ b/res/images/preferences/light/ic_preferences_decks.svg @@ -1,4 +1,4 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_effects.svg b/res/images/preferences/light/ic_preferences_effects.svg index f3fb6af3872..2317cf42d69 100644 --- a/res/images/preferences/light/ic_preferences_effects.svg +++ b/res/images/preferences/light/ic_preferences_effects.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - - + + diff --git a/res/images/preferences/light/ic_preferences_equalizers.svg b/res/images/preferences/light/ic_preferences_equalizers.svg index b9371aad9b2..cd3253d2d40 100644 --- a/res/images/preferences/light/ic_preferences_equalizers.svg +++ b/res/images/preferences/light/ic_preferences_equalizers.svg @@ -1,7 +1,7 @@ Mixxx 1.12+ iconset - - + + diff --git a/res/images/preferences/light/ic_preferences_interface.svg b/res/images/preferences/light/ic_preferences_interface.svg index cfd48cb57e9..2aa678d48fe 100644 --- a/res/images/preferences/light/ic_preferences_interface.svg +++ b/res/images/preferences/light/ic_preferences_interface.svg @@ -6,7 +6,7 @@ - + diff --git a/res/images/preferences/light/ic_preferences_keydetect.svg b/res/images/preferences/light/ic_preferences_keydetect.svg index 9afb445fa68..d7e2773ba4c 100644 --- a/res/images/preferences/light/ic_preferences_keydetect.svg +++ b/res/images/preferences/light/ic_preferences_keydetect.svg @@ -1,8 +1,8 @@ Mixxx 1.12+ iconset - + - + diff --git a/res/images/preferences/light/ic_preferences_library.svg b/res/images/preferences/light/ic_preferences_library.svg index 34abdab3b34..d8c5800d755 100644 --- a/res/images/preferences/light/ic_preferences_library.svg +++ b/res/images/preferences/light/ic_preferences_library.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_lv2.svg b/res/images/preferences/light/ic_preferences_lv2.svg index 9742706279e..1d3654388bf 100644 --- a/res/images/preferences/light/ic_preferences_lv2.svg +++ b/res/images/preferences/light/ic_preferences_lv2.svg @@ -1,4 +1,4 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_midicontrollers.svg b/res/images/preferences/light/ic_preferences_midicontrollers.svg index 68f55cbdf9e..c3519128a00 100644 --- a/res/images/preferences/light/ic_preferences_midicontrollers.svg +++ b/res/images/preferences/light/ic_preferences_midicontrollers.svg @@ -1,7 +1,7 @@ Mixxx 1.12+ iconset - - + + diff --git a/res/images/preferences/light/ic_preferences_modplug.svg b/res/images/preferences/light/ic_preferences_modplug.svg index d684fe09bc4..92b4b283923 100644 --- a/res/images/preferences/light/ic_preferences_modplug.svg +++ b/res/images/preferences/light/ic_preferences_modplug.svg @@ -1,11 +1,11 @@ Mixxx 1.12+ iconset - + - + - + diff --git a/res/images/preferences/light/ic_preferences_recording.svg b/res/images/preferences/light/ic_preferences_recording.svg index 25fe3a23935..3df9e9cccba 100644 --- a/res/images/preferences/light/ic_preferences_recording.svg +++ b/res/images/preferences/light/ic_preferences_recording.svg @@ -1,4 +1,4 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_replaygain.svg b/res/images/preferences/light/ic_preferences_replaygain.svg index 08c8dfe67ef..ee6252083f4 100644 --- a/res/images/preferences/light/ic_preferences_replaygain.svg +++ b/res/images/preferences/light/ic_preferences_replaygain.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_sampler.svg b/res/images/preferences/light/ic_preferences_sampler.svg index e0766ac4490..99f43e0bbaf 100644 --- a/res/images/preferences/light/ic_preferences_sampler.svg +++ b/res/images/preferences/light/ic_preferences_sampler.svg @@ -1,4 +1,4 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_soundhardware.svg b/res/images/preferences/light/ic_preferences_soundhardware.svg index 67fafc3bb87..9692d004da1 100644 --- a/res/images/preferences/light/ic_preferences_soundhardware.svg +++ b/res/images/preferences/light/ic_preferences_soundhardware.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_vinyl.svg b/res/images/preferences/light/ic_preferences_vinyl.svg index 7f895e62b89..4357a37ebb7 100644 --- a/res/images/preferences/light/ic_preferences_vinyl.svg +++ b/res/images/preferences/light/ic_preferences_vinyl.svg @@ -1,6 +1,6 @@ Mixxx 1.12+ iconset - + diff --git a/res/images/preferences/light/ic_preferences_waveforms.svg b/res/images/preferences/light/ic_preferences_waveforms.svg index 409e43f0eb5..5b1931d99e2 100644 --- a/res/images/preferences/light/ic_preferences_waveforms.svg +++ b/res/images/preferences/light/ic_preferences_waveforms.svg @@ -1,4 +1,4 @@ Mixxx 1.12+ iconset - + From 8c361ea0f20eef8bec8d0abe8afb285713500890 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Wed, 13 Nov 2024 00:47:11 +0100 Subject: [PATCH 3/5] add helper extractRulesFromStylesheet() to accelerate skin re/load ... smaller stylesheets are applied faster, preceding QRegExp/string operations is super fast --- src/mixxxmainwindow.cpp | 19 +++++++++++--- src/skin/legacy/legacyskinparser.cpp | 39 ++++++++++++++++++++++++++++ src/skin/legacy/legacyskinparser.h | 5 ++++ src/skin/skinloader.cpp | 5 ++++ src/skin/skinloader.h | 3 +++ 5 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/mixxxmainwindow.cpp b/src/mixxxmainwindow.cpp index fec8cd9fdf7..b2e0745a68c 100644 --- a/src/mixxxmainwindow.cpp +++ b/src/mixxxmainwindow.cpp @@ -782,7 +782,11 @@ void MixxxMainWindow::createMenuBar() { m_pMenuBar = make_parented( this, m_pCoreServices->getSettings(), m_pCoreServices->getKeyboardConfig().get()); if (m_pCentralWidget) { - m_pMenuBar->setStyleSheet(m_pCentralWidget->styleSheet()); + const QString mainMenuStyle = + m_pSkinLoader->extractRulesFromStylesheet( + m_pCentralWidget->styleSheet(), + QStringList{QStringLiteral("#MainMenu")}); + m_pMenuBar->setStyleSheet(mainMenuStyle); } setMenuBar(m_pMenuBar); } @@ -1263,13 +1267,22 @@ void MixxxMainWindow::styleMenubarPreferencesAndDialogs() { // 3.5s with Core i7-8665u for PaleMoon stylesheet (~3700 lines) // Duration seemed to depends in the stylesheet size, so I tried to extract // relevant parts from skin stylesheet on the fly with regex: ~8 ms - m_pMenuBar->setStyleSheet(m_pCentralWidget->styleSheet()); + const QString mainMenuStyle = + m_pSkinLoader->extractRulesFromStylesheet( + m_pCentralWidget->styleSheet(), + QStringList{QStringLiteral("#MainMenu")}); + m_pMenuBar->setStyleSheet(mainMenuStyle); qWarning() << " ."; qWarning() << " setStyle menubar" << t.elapsed(false).debugMillisWithUnit(); qWarning() << " ."; t.restart(true); - m_pPrefDlg->setStyleSheet(m_pCentralWidget->styleSheet()); + const QString dlgPrefStyle = + m_pSkinLoader->extractRulesFromStylesheet( + m_pCentralWidget->styleSheet(), + QStringList{QStringLiteral("DlgPreferences"), + QStringLiteral("DlgPreferencePage")}); + m_pPrefDlg->setStyleSheet(dlgPrefStyle); qWarning() << " setStyle pref " << t.elapsed(false).debugMillisWithUnit(); qWarning() << " ."; qWarning() << "################################" << tg.elapsed(false).debugMillisWithUnit(); diff --git a/src/skin/legacy/legacyskinparser.cpp b/src/skin/legacy/legacyskinparser.cpp index 63bb1f72c8e..2e1716e8566 100644 --- a/src/skin/legacy/legacyskinparser.cpp +++ b/src/skin/legacy/legacyskinparser.cpp @@ -2630,6 +2630,45 @@ QString LegacySkinParser::stylesheetAbsIconPaths(QString& style) { return style.replace("url(skin:", "url(" + m_pContext->getSkinBasePath()); } +/// static +QString LegacySkinParser::extractRulesFromStylesheet( + const QString& styleSheet, + const QStringList& selectors) { + // First remove css comments so we can use a simple selector RegEx + QString st = styleSheet; // gcc warns when I use std::move: "redundant move" + static const QRegularExpression commRegEx("\\/\\*(.|[\\r\\n])*?\\*\\/"); + st.remove(commRegEx); + + QString extrStyle; + // Find all rules for any of the selectors + const QRegularExpression styleRegex( + QStringLiteral("((? getSkinSearchPaths() const; QList getSkins() const; + /// Relay to LegacySkinParser::extractRulesFromStylesheet + QString extractRulesFromStylesheet(const QString& styleSheet, + const QStringList& selectors) const; private slots: void slotNumMicsChanged(double numMics); From 30b21809996ba34d6011e6eb4f234298fcf68553 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sun, 17 Nov 2024 22:53:26 +0100 Subject: [PATCH 4/5] Preferences: update link color when stylesheet is applied --- src/controllers/dlgprefcontroller.cpp | 15 +++- src/controllers/dlgprefcontroller.h | 6 +- src/controllers/dlgprefcontrollers.cpp | 85 ++++++++++++---------- src/controllers/dlgprefcontrollers.h | 4 +- src/preferences/dialog/dlgprefdeck.cpp | 42 ++++++----- src/preferences/dialog/dlgprefdeck.h | 2 + src/preferences/dialog/dlgpreferencepage.h | 6 ++ src/preferences/dialog/dlgpreferences.cpp | 7 +- src/preferences/dialog/dlgpreferences.h | 2 +- src/preferences/dialog/dlgpreflibrary.cpp | 35 +++++---- src/preferences/dialog/dlgpreflibrary.h | 2 + src/preferences/dialog/dlgprefmodplug.cpp | 22 +++--- src/preferences/dialog/dlgprefmodplug.h | 2 + src/preferences/dialog/dlgprefsound.cpp | 49 ++++++++----- src/preferences/dialog/dlgprefsound.h | 2 + src/preferences/dialog/dlgprefvinyl.cpp | 20 +++-- src/preferences/dialog/dlgprefvinyl.h | 2 + 17 files changed, 184 insertions(+), 119 deletions(-) diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp index 8df920e1a38..ccf1cd70745 100644 --- a/src/controllers/dlgprefcontroller.cpp +++ b/src/controllers/dlgprefcontroller.cpp @@ -530,9 +530,18 @@ QString DlgPrefController::mappingFileLinks( return linkList.join("
"); } -void DlgPrefController::enumerateMappings() { - enumerateMappings(m_pControllerManager->getConfiguredMappingFileForDevice( - m_pController->getName())); +void DlgPrefController::updateMappingIconsAndColoredLinkTexts() { + // re-enumerating mappings is the easiest way to update the list icons + enumerateMappings(mappingFilePathFromIndex(m_ui.comboBoxMapping->currentIndex())); + + // Update the colored links + createLinkColor(); + // Note: this will show the links of the LOADED mapping, so when applying + // a stylesheet while the selected mapping hasn't been loaded, yet, the + // links will be wrong. + std::shared_ptr pMapping = m_pController->cloneMapping(); + m_ui.labelLoadedMappingSupportLinks->setText(mappingSupportLinks(pMapping)); + m_ui.labelLoadedMappingScriptFileLinks->setText(mappingFileLinks(pMapping)); } void DlgPrefController::enumerateMappings(const QString& selectedMappingPath) { diff --git a/src/controllers/dlgprefcontroller.h b/src/controllers/dlgprefcontroller.h index a8574a2090c..96936ac0d3a 100644 --- a/src/controllers/dlgprefcontroller.h +++ b/src/controllers/dlgprefcontroller.h @@ -35,12 +35,8 @@ class DlgPrefController : public DlgPreferencePage { QUrl helpUrl() const override; void keyPressEvent(QKeyEvent* pEvent) override; - /// Reload the mappings in the dropdown dialog. - /// Convenience method to be called by DlgPrefControllers. - /// Used to rebuild the mappings list with dark/light icons - /// matching the current color palette. - void enumerateMappings(); void enumerateMappings(const QString& selectedMappingPath); + void updateMappingIconsAndColoredLinkTexts(); public slots: /// Called when the preference dialog (not this page) is shown to the user. diff --git a/src/controllers/dlgprefcontrollers.cpp b/src/controllers/dlgprefcontrollers.cpp index 0e17dcde157..e0f53a75df5 100644 --- a/src/controllers/dlgprefcontrollers.cpp +++ b/src/controllers/dlgprefcontrollers.cpp @@ -29,8 +29,7 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences, m_pNumSamplers(make_parented( kAppGroup, QStringLiteral("num_samplers"), this)) { setupUi(this); - // Create text color for the cue mode link "?" to the manual - createLinkColor(); + setupControllerWidgets(); connect(btnOpenUserMappings, &QPushButton::clicked, this, [this]() { @@ -70,41 +69,7 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences, txt_midithrough->hide(); #endif - // Setting the description text here instead of in the ui file allows to paste - // a formatted link (text color is a more readable blend of text color and original link color). - txtMappingsOverview->setText(tr( - "Mixxx uses \"mappings\" to connect messages from your controller to " - "controls in Mixxx. If you do not see a mapping for your controller " - "in the \"Load Mapping\" menu when you click on your controller on the " - "left sidebar, you may be able to download one online from the %1. " - "Place the XML (.xml) and Javascript (.js) file(s) in the \"User Mapping " - "Folder\" then restart Mixxx. If you download a mapping in a ZIP file, " - "extract the XML and Javascript file(s) from the ZIP file to your " - "\"User Mapping Folder\" then restart Mixxx.") - .arg(coloredLinkString( - m_pLinkColor, - QStringLiteral("Mixxx Controller Forums"), - MIXXX_CONTROLLER_FORUMS_URL))); - - txtHardwareCompatibility->setText(coloredLinkString( - m_pLinkColor, - tr("Mixxx DJ Hardware Guide"), - MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL)); - - txtControllerForums->setText(coloredLinkString( - m_pLinkColor, - QStringLiteral("Mixxx Controller Forums"), - MIXXX_CONTROLLER_FORUMS_URL)); - - txtControllerMappingFormat->setText(coloredLinkString( - m_pLinkColor, - tr("MIDI Mapping File Format"), - MIXXX_WIKI_CONTROLLER_MAPPING_FORMAT_URL)); - - txtControllerScripting->setText(coloredLinkString( - m_pLinkColor, - tr("MIDI Scripting with Javascript"), - MIXXX_WIKI_MIDI_SCRIPTING_URL)); + updateColoredLinkTexts(); } DlgPrefControllers::~DlgPrefControllers() { @@ -259,12 +224,54 @@ void DlgPrefControllers::setupControllerWidgets() { } } -void DlgPrefControllers::updateMappingIconsInControllerPages() { +void DlgPrefControllers::updateMappingIconsAndColoredLinkTexts() { + updateColoredLinkTexts(); + for (auto page : std::as_const(m_controllerPages)) { - page->enumerateMappings(); + page->updateMappingIconsAndColoredLinkTexts(); } } +void DlgPrefControllers::updateColoredLinkTexts() { + // Setting the description text here instead of in the ui file allows to paste + // a formatted link (text color is a more readable blend of text color and original link color). + + createLinkColor(); + txtMappingsOverview->setText(tr( + "Mixxx uses \"mappings\" to connect messages from your controller to " + "controls in Mixxx. If you do not see a mapping for your controller " + "in the \"Load Mapping\" menu when you click on your controller on the " + "left sidebar, you may be able to download one online from the %1. " + "Place the XML (.xml) and Javascript (.js) file(s) in the \"User Mapping " + "Folder\" then restart Mixxx. If you download a mapping in a ZIP file, " + "extract the XML and Javascript file(s) from the ZIP file to your " + "\"User Mapping Folder\" then restart Mixxx.") + .arg(coloredLinkString( + m_pLinkColor, + QStringLiteral("Mixxx Controller Forums"), + MIXXX_CONTROLLER_FORUMS_URL))); + + txtHardwareCompatibility->setText(coloredLinkString( + m_pLinkColor, + tr("Mixxx DJ Hardware Guide"), + MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL)); + + txtControllerForums->setText(coloredLinkString( + m_pLinkColor, + QStringLiteral("Mixxx Controller Forums"), + MIXXX_CONTROLLER_FORUMS_URL)); + + txtControllerMappingFormat->setText(coloredLinkString( + m_pLinkColor, + tr("MIDI Mapping File Format"), + MIXXX_WIKI_CONTROLLER_MAPPING_FORMAT_URL)); + + txtControllerScripting->setText(coloredLinkString( + m_pLinkColor, + tr("MIDI Scripting with Javascript"), + MIXXX_WIKI_MIDI_SCRIPTING_URL)); +} + void DlgPrefControllers::slotHighlightDevice(DlgPrefController* pControllerDlg, bool enabled) { int controllerPageIndex = m_controllerPages.indexOf(pControllerDlg); if (controllerPageIndex < 0) { diff --git a/src/controllers/dlgprefcontrollers.h b/src/controllers/dlgprefcontrollers.h index 318d50b1385..e305bf205c0 100644 --- a/src/controllers/dlgprefcontrollers.h +++ b/src/controllers/dlgprefcontrollers.h @@ -29,8 +29,8 @@ class DlgPrefControllers : public DlgPreferencePage, public Ui::DlgPrefControlle bool handleTreeItemClick(QTreeWidgetItem* clickedItem); QUrl helpUrl() const override; - /// Calls slotUpdate() of each controller page to update the mapping icons - void updateMappingIconsInControllerPages(); + void updateMappingIconsAndColoredLinkTexts(); + void updateColoredLinkTexts() override; public slots: /// Called when the preference dialog (not this page) is shown to the user. diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp index b86c9972959..f58ea7f1a9f 100644 --- a/src/preferences/dialog/dlgprefdeck.cpp +++ b/src/preferences/dialog/dlgprefdeck.cpp @@ -41,8 +41,6 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent, UserSettingsPointer pConfig) m_iNumConfiguredDecks(0), m_iNumConfiguredSamplers(0) { setupUi(this); - // Create text color for the cue mode link "?" to the manual - createLinkColor(); m_pNumDecks->connectValueChanged(this, [=, this](double value) { slotNumDecksChanged(value); }); slotNumDecksChanged(m_pNumDecks->get(), true); @@ -291,21 +289,11 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent, UserSettingsPointer pConfig) pControl->set(static_cast(m_keyunlockMode)); } - // Cue Mode - // Add "(?)" with a manual link to the label - labelCueMode->setText(labelCueMode->text() + QChar(' ') + - coloredLinkString( - m_pLinkColor, - QStringLiteral("(?)"), - MIXXX_MANUAL_CUE_MODES_URL)); - - // Sync Mode - // Add "(?)" with a manual link to the label - labelSyncMode->setText(labelSyncMode->text() + QChar(' ') + - coloredLinkString( - m_pLinkColor, - QStringLiteral("(?)"), - MIXXX_MANUAL_SYNC_MODES_URL)); + // Store translated label texts + labelCueMode->setProperty(kOriginalText, labelCueMode->text()); + labelSyncMode->setProperty(kOriginalText, labelSyncMode->text()); + // Create text color manual links + updateColoredLinkTexts(); // Speed / Pitch reset configuration // Update "reset speed" and "reset pitch" check boxes @@ -506,6 +494,26 @@ void DlgPrefDeck::slotUpdate() { spinBoxPermanentRateFine->setValue(RateControl::getPermanentRateChangeFineAmount()); } +void DlgPrefDeck::updateColoredLinkTexts() { + createLinkColor(); + // Cue Mode + // Add "(?)" with a manual link to the label + labelCueMode->setText( + labelCueMode->property(kOriginalText).toString() + QChar(' ') + + coloredLinkString( + m_pLinkColor, + QStringLiteral("(?)"), + MIXXX_MANUAL_CUE_MODES_URL)); + // Sync Mode + // Add "(?)" with a manual link to the label + labelSyncMode->setText( + labelSyncMode->property(kOriginalText).toString() + QChar(' ') + + coloredLinkString( + m_pLinkColor, + QStringLiteral("(?)"), + MIXXX_MANUAL_SYNC_MODES_URL)); +} + void DlgPrefDeck::slotResetToDefaults() { // Track time display mode radioButtonRemaining->setChecked(true); diff --git a/src/preferences/dialog/dlgprefdeck.h b/src/preferences/dialog/dlgprefdeck.h index df64bd7af98..b4a2e86804a 100644 --- a/src/preferences/dialog/dlgprefdeck.h +++ b/src/preferences/dialog/dlgprefdeck.h @@ -95,6 +95,8 @@ class DlgPrefDeck : public DlgPreferencePage, public Ui::DlgPrefDeckDlg { void slotUpdateSpeedAutoReset(bool); void slotUpdatePitchAutoReset(bool); + void updateColoredLinkTexts() override; + private: // Because the CueDefault list is out of order, we have to set the combo // box using the user data, not the index. Returns the index of the item diff --git a/src/preferences/dialog/dlgpreferencepage.h b/src/preferences/dialog/dlgpreferencepage.h index 079fac26b33..081b98e5b94 100644 --- a/src/preferences/dialog/dlgpreferencepage.h +++ b/src/preferences/dialog/dlgpreferencepage.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -38,6 +39,8 @@ class DlgPreferencePage : public QWidget { QColor m_pLinkColor; + const char* kOriginalText = "originalText"; + public slots: /// Called when the preference dialog is shown to the user (not necessarily /// when this PreferencePage is shown to the user). At this point, the @@ -82,6 +85,9 @@ class DlgPreferencePage : public QWidget { .name(); } + virtual void updateColoredLinkTexts() { + } + private: template void setScrollSafeGuardForChildrenOfType(QObject* pObj); diff --git a/src/preferences/dialog/dlgpreferences.cpp b/src/preferences/dialog/dlgpreferences.cpp index 477649c836c..7b5af4dd8d6 100644 --- a/src/preferences/dialog/dlgpreferences.cpp +++ b/src/preferences/dialog/dlgpreferences.cpp @@ -320,7 +320,7 @@ bool DlgPreferences::eventFilter(QObject* o, QEvent* e) { if (e->type() == QEvent::StyleChange) { // The stylesheet has been changed or reloaded, // update the tree icons to match the new palette. - updateTreeIcons(); + updateTreeIconsAndColoredLinks(); } // Standard event processing @@ -482,13 +482,14 @@ void DlgPreferences::addPageWidget(const PreferencesPage& page) { page.pDlg->sizeHint() + QSize(iframe, iframe)); } -void DlgPreferences::updateTreeIcons() { +void DlgPreferences::updateTreeIconsAndColoredLinks() { selectIconsPath(); for (const auto& page : std::as_const(m_allPages)) { page.pTreeItem->setIcon(0, QIcon(m_iconsPath.filePath(page.iconFileName))); + page.pDlg->updateColoredLinkTexts(); } // Update icons in controller mapping list - m_pControllersDlg->updateMappingIconsInControllerPages(); + m_pControllersDlg->updateMappingIconsAndColoredLinkTexts(); } void DlgPreferences::selectIconsPath() { diff --git a/src/preferences/dialog/dlgpreferences.h b/src/preferences/dialog/dlgpreferences.h index 7bd7e4605c2..3d2c6c75161 100644 --- a/src/preferences/dialog/dlgpreferences.h +++ b/src/preferences/dialog/dlgpreferences.h @@ -96,7 +96,7 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg { QList m_allPages; void onShow(); void onHide(); - void updateTreeIcons(); + void updateTreeIconsAndColoredLinks(); void selectIconsPath(); QRect getDefaultGeometry(); diff --git a/src/preferences/dialog/dlgpreflibrary.cpp b/src/preferences/dialog/dlgpreflibrary.cpp index d25f6376c46..7071bb0dba6 100644 --- a/src/preferences/dialog/dlgpreflibrary.cpp +++ b/src/preferences/dialog/dlgpreflibrary.cpp @@ -132,26 +132,19 @@ DlgPrefLibrary::DlgPrefLibrary( #endif builtInFormats->setText(builtInFormatsStr); + // Store translated label texts + label_settingsManualLink->setProperty(kOriginalText, tr("See the manual for details")); + label_searchBpmFuzzyRangeInfo->setProperty( + kOriginalText, label_searchBpmFuzzyRangeInfo->text()); // Create text color manual links - createLinkColor(); - // Add link to the manual where configuration files are explained in detail - label_settingsManualLink->setText(coloredLinkString( - m_pLinkColor, - tr("See the manual for details"), - MIXXX_MANUAL_SETTINGS_DIRECTORY_URL)); + updateColoredLinkTexts(); + // TODO It seems this isnot required anymore with Qt 6.2.3 connect(label_settingsManualLink, &QLabel::linkActivated, [](const QString& url) { mixxx::DesktopHelper::openUrl(url); }); - - // Add link to the track search documentation - label_searchBpmFuzzyRangeInfo->setText( - label_searchBpmFuzzyRangeInfo->text() + QStringLiteral(" ") + - coloredLinkString(m_pLinkColor, - QStringLiteral("(?)"), - MIXXX_MANUAL_SETTINGS_DIRECTORY_URL)); connect(label_searchBpmFuzzyRangeInfo, &QLabel::linkActivated, [](const QString& url) { @@ -388,6 +381,22 @@ void DlgPrefLibrary::slotUpdate() { checkbox_played_track_color->setChecked(applyPlayedTrackColor); } +void DlgPrefLibrary::updateColoredLinkTexts() { + createLinkColor(); + // Add link to the manual where configuration files are explained in detail + label_settingsManualLink->setText(coloredLinkString( + m_pLinkColor, + label_settingsManualLink->property(kOriginalText).toString(), + MIXXX_MANUAL_SETTINGS_DIRECTORY_URL)); + // Add link to the track search documentation + label_searchBpmFuzzyRangeInfo->setText( + label_searchBpmFuzzyRangeInfo->property(kOriginalText).toString() + + QStringLiteral(" ") + + coloredLinkString(m_pLinkColor, + QStringLiteral("(?)"), + MIXXX_MANUAL_SETTINGS_DIRECTORY_URL)); +} + void DlgPrefLibrary::slotCancel() { // Undo any changes in the library font or row height. m_pLibrary->setFont(m_originalTrackTableFont); diff --git a/src/preferences/dialog/dlgpreflibrary.h b/src/preferences/dialog/dlgpreflibrary.h index ea5f75457b2..7b4ec32193a 100644 --- a/src/preferences/dialog/dlgpreflibrary.h +++ b/src/preferences/dialog/dlgpreflibrary.h @@ -38,6 +38,8 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg { QUrl helpUrl() const override; + void updateColoredLinkTexts() override; + public slots: // Common preference page slots. void slotUpdate() override; diff --git a/src/preferences/dialog/dlgprefmodplug.cpp b/src/preferences/dialog/dlgprefmodplug.cpp index 5643482bd9d..d7006723904 100644 --- a/src/preferences/dialog/dlgprefmodplug.cpp +++ b/src/preferences/dialog/dlgprefmodplug.cpp @@ -14,8 +14,6 @@ DlgPrefModplug::DlgPrefModplug(QWidget *parent, m_pUi(new Ui::DlgPrefModplug), m_pConfig(_config) { m_pUi->setupUi(this); - // Create text color for the OpenMTP manual link - createLinkColor(); m_pUi->advancedSettings->setVisible(m_pUi->showAdvanced->isChecked()); connect(m_pUi->memoryLimit, @@ -31,13 +29,7 @@ DlgPrefModplug::DlgPrefModplug(QWidget *parent, m_pUi->advancedSettings, &QWidget::setVisible); - m_pUi->modplugSettingsHint->setText( - tr("All settings take effect on next track load. Currently loaded tracks " - "are not affected. For an explanation of these settings, see the %1") - .arg(coloredLinkString( - m_pLinkColor, - "OpenMPT manual", - "http://wiki.openmpt.org/Manual:_Setup/Player"))); + updateColoredLinkTexts(); setScrollSafeGuardForAllInputWidgets(this); } @@ -211,3 +203,15 @@ void DlgPrefModplug::applySettings() { // apply modplug settings mixxx::SoundSourceModPlug::configure(bufferSizeLimit, settings); } + +void DlgPrefModplug::updateColoredLinkTexts() { + createLinkColor(); + + m_pUi->modplugSettingsHint->setText( + tr("All settings take effect on next track load. Currently loaded tracks " + "are not affected. For an explanation of these settings, see the %1") + .arg(coloredLinkString( + m_pLinkColor, + "OpenMPT manual", + "http://wiki.openmpt.org/Manual:_Setup/Player"))); +} diff --git a/src/preferences/dialog/dlgprefmodplug.h b/src/preferences/dialog/dlgprefmodplug.h index d484face220..6f01e111303 100644 --- a/src/preferences/dialog/dlgprefmodplug.h +++ b/src/preferences/dialog/dlgprefmodplug.h @@ -16,6 +16,8 @@ class DlgPrefModplug : public DlgPreferencePage { explicit DlgPrefModplug(QWidget* parent, UserSettingsPointer _config); virtual ~DlgPrefModplug(); + void updateColoredLinkTexts() override; + public slots: void slotApply() override; void slotUpdate() override; diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index 1a75a9c4757..a7ed8d803bd 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -284,31 +284,14 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, #ifdef __LINUX__ qDebug() << "RLimit Cur " << RLimit::getCurRtPrio(); qDebug() << "RLimit Max " << RLimit::getMaxRtPrio(); - - if (RLimit::isRtPrioAllowed()) { - realtimeHint->setText(tr("Realtime scheduling is enabled.")); - } else { - realtimeHint->setText( - tr("To enable Realtime scheduling (currently disabled), see the %1.") - .arg(coloredLinkString( - m_pLinkColor, - QStringLiteral("Mixxx Wiki"), - MIXXX_WIKI_AUDIO_LATENCY_URL))); - } #else // the limits warning is a Linux only thing realtimeHint->hide(); #endif // __LINUX__ - setScrollSafeGuardForAllInputWidgets(this); + updateColoredLinkTexts(); - hardwareGuide->setText( - tr("The %1 lists sound cards and controllers you may want to " - "consider for using Mixxx.") - .arg(coloredLinkString( - m_pLinkColor, - tr("Mixxx DJ Hardware Guide"), - MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL))); + setScrollSafeGuardForAllInputWidgets(this); } /// Slot called when the preferences dialog is opened. @@ -383,6 +366,34 @@ QUrl DlgPrefSound::helpUrl() const { return QUrl(MIXXX_MANUAL_SOUND_URL); } +void DlgPrefSound::updateColoredLinkTexts() { + createLinkColor(); + +#ifdef __LINUX__ + qDebug() << "RLimit Cur " << RLimit::getCurRtPrio(); + qDebug() << "RLimit Max " << RLimit::getMaxRtPrio(); + + if (RLimit::isRtPrioAllowed()) { + realtimeHint->setText(tr("Realtime scheduling is enabled.")); + } else { + realtimeHint->setText( + tr("To enable Realtime scheduling (currently disabled), see the %1.") + .arg(coloredLinkString( + m_pLinkColor, + QStringLiteral("Mixxx Wiki"), + MIXXX_WIKI_AUDIO_LATENCY_URL))); + } +#endif // __LINUX__ + + hardwareGuide->setText( + tr("The %1 lists sound cards and controllers you may want to " + "consider for using Mixxx.") + .arg(coloredLinkString( + m_pLinkColor, + tr("Mixxx DJ Hardware Guide"), + MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL))); +} + /// Initializes (and creates) all the path items. Each path item widget allows /// the user to input a sound device name and channel number given a description /// of what will be done with that info. Inputs and outputs are grouped by tab, diff --git a/src/preferences/dialog/dlgprefsound.h b/src/preferences/dialog/dlgprefsound.h index ef8b5f0c81c..7a865ac8f48 100644 --- a/src/preferences/dialog/dlgprefsound.h +++ b/src/preferences/dialog/dlgprefsound.h @@ -33,6 +33,8 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg { QUrl helpUrl() const override; + void updateColoredLinkTexts() override; + signals: void loadPaths(const SoundManagerConfig &config); void writePaths(SoundManagerConfig *config); diff --git a/src/preferences/dialog/dlgprefvinyl.cpp b/src/preferences/dialog/dlgprefvinyl.cpp index 18d4aff5b61..30b12e0155f 100644 --- a/src/preferences/dialog/dlgprefvinyl.cpp +++ b/src/preferences/dialog/dlgprefvinyl.cpp @@ -24,8 +24,6 @@ DlgPrefVinyl::DlgPrefVinyl( m_pNumDecks->connectValueChanged(this, &DlgPrefVinyl::slotNumDecksChanged); setupUi(this); - // Create text color for the Troubleshooting link - createLinkColor(); // Add per-deck vinyl selectors m_vcLabels = {VinylLabel1, @@ -80,12 +78,6 @@ DlgPrefVinyl::DlgPrefVinyl( signalQualityLayout->addWidget(widget); } - TroubleshootingLink->setText(coloredLinkString( - m_pLinkColor, - // QStringLiteral("Troubleshooting") fails to compile on Fedora 36 with GCC 12.0.x - "Troubleshooting", - MIXXX_MANUAL_VINYL_TROUBLESHOOTING_URL)); - connect(SliderVinylGain, &QSlider::sliderReleased, this, &DlgPrefVinyl::slotVinylGainApply); connect(SliderVinylGain, QOverload::of(&QSlider::valueChanged), @@ -96,6 +88,8 @@ DlgPrefVinyl::DlgPrefVinyl( setDeckWidgetsVisible(i, false); } + updateColoredLinkTexts(); + setScrollSafeGuardForAllInputWidgets(this); slotNumDecksChanged(m_pNumDecks->get()); @@ -297,6 +291,16 @@ QUrl DlgPrefVinyl::helpUrl() const { return QUrl(MIXXX_MANUAL_VINYL_URL); } +void DlgPrefVinyl::updateColoredLinkTexts() { + createLinkColor(); + + TroubleshootingLink->setText(coloredLinkString( + m_pLinkColor, + // QStringLiteral("Troubleshooting") fails to compile on Fedora 36 with GCC 12.0.x + "Troubleshooting", + MIXXX_MANUAL_VINYL_TROUBLESHOOTING_URL)); +} + void DlgPrefVinyl::setDeckWidgetsVisible(int deck, bool visible) { if (deck < 0 || deck > 3) { qWarning() << "Tried to set a vinyl preference widget visible that doesn't exist: " << deck; diff --git a/src/preferences/dialog/dlgprefvinyl.h b/src/preferences/dialog/dlgprefvinyl.h index ee7c1d3ca3e..14253dbcbf6 100644 --- a/src/preferences/dialog/dlgprefvinyl.h +++ b/src/preferences/dialog/dlgprefvinyl.h @@ -24,6 +24,8 @@ class DlgPrefVinyl : public DlgPreferencePage, Ui::DlgPrefVinylDlg { QUrl helpUrl() const override; + void updateColoredLinkTexts() override; + public slots: void slotUpdate() override; void slotApply() override; From c7035075a65ffc8762eef3b8ba328d904bc213a5 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sun, 24 Nov 2024 16:17:52 +0100 Subject: [PATCH 5/5] WIP avoid skin styles in Track Properties etc. --- res/skins/Deere/style.qss | 8 ++--- res/skins/LateNight/style_classic.qss | 4 +-- res/skins/Shade/style.qss | 44 ++++++++++++++++----------- res/skins/Shade/style_dark.qss | 6 ++-- res/skins/Tango/style.qss | 8 ++--- src/skin/legacy/legacyskinparser.cpp | 2 +- src/widget/wtrackmenu.cpp | 1 + 7 files changed, 41 insertions(+), 32 deletions(-) diff --git a/res/skins/Deere/style.qss b/res/skins/Deere/style.qss index 6b370309c3c..fcabef9e45a 100644 --- a/res/skins/Deere/style.qss +++ b/res/skins/Deere/style.qss @@ -280,8 +280,8 @@ WLibraryTextBrowser { } /* Table cell in edit mode */ -WLibrary QLineEdit, -WLibrary QPlainTextEdit, +WTrackTableView > QLineEdit, +WTrackTableView > QPlainTextEdit, WBeatSpinBox, /* Track label inline editor */ WTrackPropertyEditor, @@ -291,7 +291,7 @@ WTrackPropertyEditor, selection-color: #000; selection-background-color: #ccc; } -WLibrary QLineEdit, +WTrackTableView > QLineEdit, WTrackPropertyEditor, #LibraryBPMSpinBox { border: 1px solid #006596; @@ -847,7 +847,7 @@ WSearchLineEdit QAbstractScrollArea::corner, } #Mixxx, WWidget, -QToolTip, +#Skin QToolTip, WLabel, #LibraryFeatureControls QLabel, WNumber, WNumberPos, WPushButton, diff --git a/res/skins/LateNight/style_classic.qss b/res/skins/LateNight/style_classic.qss index d86a6b623f6..e7ad648246c 100644 --- a/res/skins/LateNight/style_classic.qss +++ b/res/skins/LateNight/style_classic.qss @@ -2225,8 +2225,8 @@ WLibrarySidebar { } /* Table cell in edit mode */ -WLibrary QLineEdit, -WLibrary QPlainTextEdit, +WTrackTableView > QLineEdit, +WTrackTableView > QPlainTextEdit, #LibraryBPMSpinBox, /* Track label inline editor in decks and samplers */ WTrackPropertyEditor, diff --git a/res/skins/Shade/style.qss b/res/skins/Shade/style.qss index 942fb8470ec..362c26678be 100644 --- a/res/skins/Shade/style.qss +++ b/res/skins/Shade/style.qss @@ -27,7 +27,7 @@ WTime, WTrackProperty, QSpinBox, WBeatSpinBox, -QToolTip, +#Skin QToolTip, WTrackTableViewHeader, WTrackTableViewHeader QMenu, WTrackTableViewHeader QMenu QCheckBox, @@ -97,22 +97,24 @@ WBeatSpinBox::down-button { #MainMenu QMenu, #MainMenu QMenu::item, #MainMenu QMenu QCheckBox, -QToolTip, +/*QToolTip:not(DlgTrackInfo QToolTip),*/ +WWidget > QToolTip, WLibrarySidebar QMenu, WLibrarySidebar QMenu::item, WTrackTableViewHeader QMenu, WTrackTableViewHeader QMenu QCheckBox, WLibraryTextBrowser QMenu, WTrackMenu, -WTrackMenu::item, -WTrackMenu QMenu, -WTrackMenu QMenu::item, +/*WTrackMenu::item,*/ +WTrackMenu > QMenu, +/*WTrackMenu QMenu::item,*/ WTrackMenu QMenu QCheckBox, -WTrackMenu WStarRating, -QLineEdit QMenu, -QLineEdit QMenu::item, -QPlainTextEdit QMenu, -QPlainTextEdit QMenu::item, +WTrackMenu > WStarRating, +/*WWidget QLineEdit QMenu,*/ +WTrackTableView QLineEdit QMenu, +/*WTrackTableView > QLineEdit QMenu::item,*/ +WTrackTableView > QPlainTextEdit QMenu, +WTrackTableView > QPlainTextEdit QMenu::item, WBeatSpinBox::up-button, WBeatSpinBox::down-button, WCueMenuPopup, @@ -126,8 +128,14 @@ WEffectSelector::indicator:unchecked, #fadeModeCombobox::item, #fadeModeCombobox::indicator:unchecked { color: #060613; - background-color: #aab2b7; + background-color: darkred; + } +WTrackMenu QMenu WStarRating, +#Skin > WStarRating { + color: #060613; + background-color: darkcyan; } + #MainMenu, #MainMenu::item, WBeatSpinBox, @@ -465,10 +473,10 @@ WCueMenuPopup QLabel { padding: 2px; } #CueColorPicker QPushButton, -WLibrary WColorPicker QPushButton { +#TrackColorMenu WColorPicker QPushButton { width: 38px; height: 20px; - border: 1px solid #060613; + border: 1px solid red; } /*################################################################ @@ -550,7 +558,7 @@ WLibrarySidebar::item:!selected:focus { /* This is for all cells including Played and Location */ WTrackTableView, /* This is for the BPM and play count cells */ -WTrackTableView QCheckBox:focus { +WTrackTableView > QCheckBox:focus { outline: 1px solid #c9c9c9; } /* This uses a custom qproperty to set the focus border @@ -567,8 +575,8 @@ WTrackTableView { } /* Table cell in edit mode */ - WLibrary QLineEdit, - WLibrary QPlainTextEdit, + WTrackTableView > QLineEdit, + WTrackTableView > QPlainTextEdit, /* Track label inline editor in decks and samplers */ WTrackPropertyEditor, #LibraryBPMSpinBox { @@ -577,7 +585,7 @@ WTrackTableView { selection-color: #000; selection-background-color: #ccc; } - WLibrary QLineEdit, + WTrackTableView > QLineEdit, #LibraryBPMSpinBox { border: 1px solid #656d75; } @@ -600,7 +608,7 @@ WTrackTableView { #LibraryBPMButton::indicator:unchecked:selected { image: url(skin:/btn/btn_lib_bpm_unlocked_black.svg); } - WLibrary > QCheckBox { + WTrackTableView > QCheckBox { text-align: right; alignment: right; } diff --git a/res/skins/Shade/style_dark.qss b/res/skins/Shade/style_dark.qss index bfb776cff53..82588fbab4b 100644 --- a/res/skins/Shade/style_dark.qss +++ b/res/skins/Shade/style_dark.qss @@ -196,7 +196,7 @@ WLibrarySidebar::item:focus { /* This is for all cells including Played and Location */ WTrackTableView, /* This is for the BPM and play count cells */ -WTrackTableView QCheckBox:focus { +WTrackTableView > QCheckBox:focus { outline: 1px solid #ccc; } /* This uses a custom qproperty to set the focus border @@ -213,8 +213,8 @@ WTrackTableView { } /* Table cell in edit mode */ - WLibrary QLineEdit, - WLibrary QPlainTextEdit, + WTrackTableView > QLineEdit, + WTrackTableView > QPlainTextEdit, /* Track label inline editor in decks and samplers */ WTrackPropertyEditor, #LibraryBPMSpinBox { diff --git a/res/skins/Tango/style.qss b/res/skins/Tango/style.qss index 6cc1bbe0558..a77fe128f88 100644 --- a/res/skins/Tango/style.qss +++ b/res/skins/Tango/style.qss @@ -2645,7 +2645,7 @@ WLibrarySidebar::item:focus { /* This is for all cells including Played and Location */ WTrackTableView, /* This is for the BPM cell */ -WTrackTableView QCheckBox:focus { +WTrackTableView > QCheckBox:focus { outline: 1px solid #fff; } /* This uses a custom qproperty to set the focus border @@ -2662,8 +2662,8 @@ WTrackTableView { } /* Table cell in edit mode */ - WLibrary QLineEdit, - WLibrary QPlainTextEdit, + WTrackTableView > QLineEdit, + WTrackTableView > QPlainTextEdit, /* Track label inline editor in decks and samplers */ WTrackPropertyEditor, #LibraryBPMSpinBox { @@ -2674,7 +2674,7 @@ WTrackTableView { border-width: 1px; border-style: solid; } - WLibrary QLineEdit, + WTrackTableView > QLineEdit, #LibraryBPMSpinBox { border-color: #555; } diff --git a/src/skin/legacy/legacyskinparser.cpp b/src/skin/legacy/legacyskinparser.cpp index 2e1716e8566..d5f2c48d994 100644 --- a/src/skin/legacy/legacyskinparser.cpp +++ b/src/skin/legacy/legacyskinparser.cpp @@ -503,7 +503,7 @@ QList LegacySkinParser::parseNode(const QDomElement& node) { // New style skins are just a WidgetGroup at the root. QWidget* skin = parseWidgetGroup(node); // Set an object name so we can address child dialogs - // with the skin's stylesheet. + // with the skin's stylesheet "Skin" skin->setObjectName(mixxx::widgethelper::skinWidgetName()); result.append(skin); } else { diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index 65c113ba856..7d8ef072a16 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -209,6 +209,7 @@ void WTrackMenu::createMenus() { if (featureIsEnabled(Feature::Color)) { m_pColorMenu = new QMenu(this); m_pColorMenu->setTitle(tr("Select Color")); + m_pColorMenu->setObjectName(QStringLiteral("TrackColorMenu")); } if (featureIsEnabled(Feature::Reset)) {