Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library: resize the Played checkbox and BPM lock with the library font #4050

Merged
merged 1 commit into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions res/skins/Deere/icon/ic_library_checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions res/skins/Deere/icon/ic_library_checkbox_checked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 4 additions & 8 deletions res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,11 @@ WLibrary QLineEdit,
}

/* checkbox in library "Played" column */
WTrackTableView::indicator:checked {
image: url(skin:/../Deere/icon/ic_library_checkmark.svg);
border: 1px solid #ff6600;
}
WTrackTableView::indicator:unchecked {
border: 1px solid rgba(151,151,151,128);
image: url(skin:/../Deere/icon/ic_library_checkbox.svg);
}
WTrackTableView::indicator:checked {
image: url(skin:/../Deere/icon/ic_library_checkbox_checked.svg);
}

/* focused BPM cell in the library "BPM" column */
Expand Down Expand Up @@ -2122,7 +2121,6 @@ WTrackMenu QMenu QCheckBox::indicator:disabled {
background-color: #333;
}
WLibrarySidebar QMenu::indicator:checked,
WTrackTableView::indicator:checked,
WTrackMenu QMenu QCheckBox::indicator:checked {
image: url(skin:/../Deere/icon/ic_library_checkmark_orange.svg);
}
Expand Down Expand Up @@ -2158,8 +2156,6 @@ WLibrarySidebar QMenu::indicator:unchecked,
WLibrarySidebar QMenu::indicator:unchecked:selected,
WTrackTableViewHeader QMenu::indicator:unchecked,
WTrackTableViewHeader QMenu::indicator:unchecked:selected,
WTrackTableView::indicator:unchecked,
WTrackTableView::indicator:unchecked:selected,
WEffectSelector::indicator:unchecked,
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked,
Expand Down
3 changes: 3 additions & 0 deletions res/skins/LateNight/classic/buttons/btn__lib_checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/skins/LateNight/palemoon/buttons/btn__lib_checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ WEffectSelector QAbstractScrollArea {
margin: 2px;
}
WEffectSelector::down-arrow,
#fadeModeCombobox::down-arrow {
#fadeModeCombobox::down-arrow,
WTrackTableView::indicator {
border: 0;
padding: 0;
margin: 0;
Expand Down
15 changes: 3 additions & 12 deletions res/skins/LateNight/style_classic.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2438,8 +2438,6 @@ QLineEdit QMenu::item:disabled {
}

WLibrarySidebar QMenu::indicator:checked,
WTrackTableViewHeader QMenu::indicator:checked,
WTrackTableView::indicator:checked,
WTrackMenu QMenu QCheckBox::indicator:checked,
WEffectSelector::indicator:checked,
#fadeModeCombobox::indicator:checked {
Expand Down Expand Up @@ -2478,18 +2476,13 @@ QLineEdit QMenu::item:disabled {

/* This is the only way to select the 'Played' checkbox.
Note that this also selects the BPM lock. */
WTrackTableView::indicator {
/* border is added to size defined in style.qss */
border: 1px solid transparent;
margin: 0px;
padding: 0px;
}
WTrackTableView::indicator:checked {
border: 1px solid #ff6600;
image: url(skin:/classic/buttons/btn__lib_checkbox_checked.svg);
}
WTrackTableView::indicator:unchecked {
border: 1px solid rgba(151,151,151,128);
image: url(skin:/classic/buttons/btn__lib_checkbox.svg);
}

#MainMenu QMenu::separator,
WLibrarySidebar QMenu::separator,
WTrackTableViewHeader QMenu::separator,
Expand All @@ -2508,8 +2501,6 @@ WLibrarySidebar QMenu::indicator:unchecked,
WLibrarySidebar QMenu::indicator:unchecked:selected,
WTrackTableViewHeader QMenu::indicator:unchecked,
WTrackTableViewHeader QMenu::indicator:unchecked:selected,
WTrackTableView::indicator:unchecked,
WTrackTableView::indicator:unchecked:selected,
WEffectSelector::indicator:unchecked,
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked,
Expand Down
23 changes: 6 additions & 17 deletions res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2496,18 +2496,6 @@ WTrackTableView {
qproperty-focusBorderColor: #fff;
}

/* This is the only way to select the 'Played' checkbox.
Note that this also selects the BPM lock. */
WTrackTableView::indicator {
/* border is added to configured size */
border: 1px solid transparent;
margin: 0px;
padding: 0px;
}
WTrackTableView::indicator:unchecked {
border: 1px solid rgba(151,151,151,128);
}

/* Table cell in edit mode */
WLibrary QLineEdit,
#LibraryBPMSpinBox {
Expand Down Expand Up @@ -2922,12 +2910,15 @@ QLineEdit QMenu::item:disabled {
image: url(skin:/palemoon/buttons/btn__menu_checkbox.svg);
}

/* This is the only way to select the 'Played' checkbox.
Note that this also selects the BPM lock, so style that afterwards. */
WTrackTableView::indicator:unchecked {
image: url(skin:/palemoon/buttons/btn__lib_checkbox.svg);
}
WLibrarySidebar QMenu::indicator:checked,
WTrackTableViewHeader QMenu::indicator:checked,
WTrackTableView::indicator:checked,
WTrackMenu QMenu QCheckBox::indicator:checked,
WEffectSelector::indicator:checked,
#fadeModeCombobox::indicator:checked {
WTrackMenu QMenu QCheckBox::indicator:checked {
image: url(skin:/palemoon/buttons/btn__lib_checkmark_blue.svg);
}
WEffectSelector::indicator:checked,
Expand Down Expand Up @@ -2963,8 +2954,6 @@ WLibrarySidebar QMenu::indicator:unchecked,
WLibrarySidebar QMenu::indicator:unchecked:selected,
WTrackTableViewHeader QMenu::indicator:unchecked,
WTrackTableViewHeader QMenu::indicator:unchecked:selected,
WTrackTableView::indicator:unchecked,
WTrackTableView::indicator:unchecked:selected,
WEffectSelector::indicator:unchecked,
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked,
Expand Down
4 changes: 4 additions & 0 deletions res/skins/Shade/btn/btn_lib_checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions res/skins/Shade/btn/btn_lib_checkbox_checked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 5 additions & 9 deletions res/skins/Shade/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,13 @@ WTrackTableView {
WTrackTableView::indicator {
margin: 0px;
padding: 0px;
color: #cfcfcf;
border: 1px solid transparent;
border: 0px;
}
WTrackTableView::indicator:checked {
image: url(skin:/btn/btn_lib_checkmark.svg) no-repeat center center;
border: 1px solid #ff6600;
WTrackTableView::indicator:unchecked {
image: url(skin:/btn/btn_lib_checkbox.svg);
}
WTrackTableView::indicator:unchecked {
border: 1px solid rgba(151,151,151,128);
WTrackTableView::indicator:checked {
image: url(skin:/btn/btn_lib_checkbox_checked.svg);
}

/* explicitly remove icons from unchecked items otherwise
Expand All @@ -566,8 +564,6 @@ WLibrarySidebar QMenu::indicator:unchecked,
WLibrarySidebar QMenu::indicator:unchecked:selected,
WTrackTableViewHeader QMenu::indicator:unchecked,
WTrackTableViewHeader QMenu::indicator:unchecked:selected,
WTrackTableView::indicator:unchecked,
WTrackTableView::indicator:unchecked:selected,
WEffectSelector::indicator:unchecked,
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked,
Expand Down
4 changes: 4 additions & 0 deletions res/skins/Tango/buttons/btn_lib_checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions res/skins/Tango/buttons/btn_lib_checkbox_checked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 2 additions & 14 deletions res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2902,21 +2902,11 @@ QPushButton#pushButtonRepeatPlaylist:!checked {
}*/

/* checkbox in library "Played" column */
WTrackTableView::indicator {
margin: 0px;
padding: 0px;
color: #cfcfcf;
/* border is added to size defined above */
border: 1px solid rgba(151,151,151,128);
}
WTrackTableView::indicator:hover {
border: 1px solid #888;
}
WTrackTableView::indicator:checked {
image: url(skin:/../Tango/buttons/btn_lib_checkmark.svg);
image: url(skin:/../Tango/buttons/btn_lib_checkbox_checked.svg);
}
WTrackTableView::indicator:unchecked {
background: none;
image: url(skin:/../Tango/buttons/btn_lib_checkbox.svg);
}

WLibrary QSpinBox {
Expand Down Expand Up @@ -2977,8 +2967,6 @@ WLibrarySidebar QMenu::indicator:unchecked,
WLibrarySidebar QMenu::indicator:unchecked:selected,
WTrackTableViewHeader QMenu::indicator:unchecked,
WTrackTableViewHeader QMenu::indicator:unchecked:selected,
WTrackTableView::indicator:unchecked,
WTrackTableView::indicator:unchecked:selected,
WEffectSelector::indicator:unchecked,
WEffectSelector::indicator:unchecked:selected,
#fadeModeCombobox::indicator:unchecked,
Expand Down
7 changes: 3 additions & 4 deletions res/skins/default.qss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
image: url(:/images/library/ic_library_preview_play.svg);
}

/* These library table indicators are scaled with the library font:
checkbox next to the 'Played' counter */
/* 'Played' checkbox */
WTrackTableView::indicator,
/* BPM lock icon */
#LibraryBPMButton::indicator {
width: 0.5em;
height: 0.5em;
/* The indicator size is dynamically adjusted in c++ to match the size
of the library font: width/height = 0.7em*/
}
/* Style the library BPM Button with a default image */
QPushButton#LibraryBPMButton {
Expand Down
11 changes: 11 additions & 0 deletions src/widget/wlibrarytableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ void WLibraryTableView::setTrackTableFont(const QFont& font) {
setFont(font);
QFontMetrics metrics(font);
verticalHeader()->setMinimumSectionSize(metrics.height());
// Resize the 'Played' checkbox and the BPM lock icon.
// Note: this works well for library font sizes up to ~200% of the original
// system font's size (that set with Qt5 Settings respectively). Above that,
// the indicators start to overlap the item text because the painter rectangle
// is not resized (also depending on the system font size).
setStyleSheet(QStringLiteral(
"WTrackTableView::indicator,"
"#LibraryBPMButton::indicator {"
"height: %1px;"
"width: %1px;}")
.arg(metrics.height() * 0.7));
}

void WLibraryTableView::setTrackTableRowHeight(int rowHeight) {
Expand Down