Skip to content

Commit

Permalink
Library: resize the Played checkbox and BPM lock with the library font
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jul 6, 2021
1 parent b5a8dcd commit 4b3494c
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 65 deletions.
3 changes: 3 additions & 0 deletions res/skins/LateNight/classic/buttons/btn_checkbox_played.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.
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_checkbox_played.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ WEffectSelector QAbstractScrollArea {
margin: 0;
}

WTrackTableView::indicator:checked,
WTrackTableView::indicator:unchecked,
WEffectSelector::checked, /* selected item */
WEffectSelector::indicator, /* checkbox, tick mark */
WEffectSelector::indicator:unchecked,
Expand Down
45 changes: 17 additions & 28 deletions res/skins/LateNight/style_classic.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2056,14 +2056,6 @@ WLibrary QLineEdit,
border: 1px solid #5E4507;
}

/* Entire BPM cell */
/* Lock icon at the left */
#LibraryBPMButton::indicator:checked {
image: url(skin:/classic/buttons/btn__lib_bpm_locked_orange.svg);
}
#LibraryBPMButton::indicator:unchecked {
image: url(skin:/classic/buttons/btn__lib_bpm_unlocked_grey.svg);
}
/* BPM value */
#LibraryBPMButton::item {
}
Expand Down Expand Up @@ -2430,21 +2422,34 @@ QLineEdit QMenu::item:disabled {

#MainMenu QMenu::indicator:checked,
#MainMenu QMenu::indicator:checked:selected {
image: url(skin:/classic/buttons/btn__menu_checkbox_checked.svg);
image: url(skin:/classic/buttons/btn_checkbox_mainmenu_checked.svg);
}
#MainMenu QMenu::indicator:unchecked,
#MainMenu QMenu::indicator:unchecked:selected {
image: url(skin:/classic/buttons/btn__menu_checkbox.svg);
image: url(skin:/classic/buttons/btn_checkbox_mainmenu.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:/classic/buttons/btn_checkbox_played.svg);
}
WTrackTableView::indicator:checked {
image: url(skin:/classic/buttons/btn_checkbox_played_checked.svg);
}
WLibrarySidebar QMenu::indicator:checked,
WTrackTableViewHeader QMenu::indicator:checked,
WTrackTableView::indicator:checked,
WTrackMenu QMenu QCheckBox::indicator:checked,
WEffectSelector::indicator:checked,
#fadeModeCombobox::indicator:checked {
image: url(skin:/classic/buttons/btn__lib_checkmark_orange.svg);
}
/* BPM lock button */
#LibraryBPMButton::indicator:checked {
image: url(skin:/classic/buttons/btn__lib_bpm_locked_orange.svg);
}
#LibraryBPMButton::indicator:unchecked {
image: url(skin:/classic/buttons/btn__lib_bpm_unlocked_grey.svg);
}
/* disabled menu item and checkbox */
WTrackMenu QMenu QCheckBox::indicator:disabled:unchecked,
WTrackMenu QMenu QCheckBox::indicator:disabled:checked,
Expand Down Expand Up @@ -2476,20 +2481,6 @@ QLineEdit QMenu::item:disabled {
image: url(skin:/classic/style/menu_arrow_white.svg);
}

/* 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;
}
WTrackTableView::indicator:unchecked {
border: 1px solid rgba(151,151,151,128);
}
#MainMenu QMenu::separator,
WLibrarySidebar QMenu::separator,
WTrackTableViewHeader QMenu::separator,
Expand All @@ -2508,8 +2499,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
42 changes: 15 additions & 27 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 All @@ -2517,14 +2505,6 @@ WLibrary QLineEdit,
border: 1px solid #2c454f;
}

/* Entire BPM cell */
/* Lock icon at the left */
#LibraryBPMButton::indicator:checked {
image: url(skin:/palemoon/buttons/btn__lib_bpm_locked_blue.svg);
}
#LibraryBPMButton::indicator:unchecked {
image: url(skin:/palemoon/buttons/btn__lib_bpm_unlocked_grey.svg);
}
/* BPM value */
#LibraryBPMButton::item {}
/* BPM spinbox in edit mode */
Expand Down Expand Up @@ -2915,19 +2895,29 @@ QLineEdit QMenu::item:disabled {

#MainMenu QMenu::indicator:checked,
#MainMenu QMenu::indicator:checked:selected {
image: url(skin:/palemoon/buttons/btn__menu_checkbox_checked.svg);
image: url(skin:/palemoon/buttons/btn_checkbox_mainmenu_checked.svg);
}
#MainMenu QMenu::indicator:unchecked,
#MainMenu QMenu::indicator:unchecked:selected {
image: url(skin:/palemoon/buttons/btn__menu_checkbox.svg);
image: url(skin:/palemoon/buttons/btn_checkbox_mainmenu.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_checkbox_played.svg);
}
/* BPM lock button */
#LibraryBPMButton::indicator:unchecked {
image: url(skin:/palemoon/buttons/btn__lib_bpm_unlocked_grey.svg);
}
#LibraryBPMButton::indicator:checked {
image: url(skin:/palemoon/buttons/btn__lib_bpm_locked_blue.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 +2953,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
6 changes: 2 additions & 4 deletions res/skins/default.qss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
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 set dynamically according to the library font */
}
/* 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. 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

0 comments on commit 4b3494c

Please sign in to comment.