Skip to content

Commit

Permalink
Added option to flip playlist header rows
Browse files Browse the repository at this point in the history
- Top menu > Options > Playlist > Album header > Flip header rows
- Playlist context menu > Appearance > Headers > Flip header rows
  • Loading branch information
TT-ReBORN committed Mar 30, 2024
1 parent cef4173 commit 5be39d6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
4 changes: 3 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-config-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 22-12-2017 * //
// * Last change: 21-03-2024 * //
// * Last change: 30-03-2024 * //
/////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -952,6 +952,7 @@ class ConfigDefaults {
use_compact_header: false,
auto_collapse: false,
hyperlinksCtrlClick: false,
headerFlipRows: false,
show_disc_header: true,
show_group_info: true,
showWeblinks: true,
Expand Down Expand Up @@ -1003,6 +1004,7 @@ class ConfigDefaults {
use_compact_header: 'Values: true, false - Options > Playlist > Album header > Compact header',
auto_collapse: 'Values: true, false - Options > Playlist > Album header > Auto collapse and expand',
hyperlinksCtrlClick: 'Values: true, false - Options > Playlist > Album header > Ctrl+click to follow hyperlinks',
headerFlipRows: 'Values: true, false - Options > Playlist > Album header > Flip header rows',
show_disc_header: 'Values: true, false - Options > Playlist > Album header > Show disc sub-header',
show_group_info: 'Values: true, false - Options > Playlist > Album header > Show group info',
showWeblinks: 'Values: true, false - Options > Playlist > Album header > Show weblinks in context menu',
Expand Down
6 changes: 3 additions & 3 deletions profile/georgia-reborn/scripts/Base/gr-main-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 22-12-2017 * //
// * Last change: 25-03-2024 * //
// * Last change: 30-03-2024 * //
/////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -1313,8 +1313,8 @@ class Hyperlink {
switch (this.type) {
case 'update': RunCmd('https://github.com/TT-ReBORN/Georgia-ReBORN/releases'); break;
case 'date': query = grSet.showPlaylistFullDate ? `"${grTF.date}" IS ${this.text}` : `"$year(%date%)" IS ${this.text}`; break;
case 'artist': query = `Artist HAS "${this.text.replace(/"/g, '')}" OR Album Artist HAS "${this.text.replace(/"/g, '')}" OR ARTISTFILTER HAS "${this.text.replace(/"/g, '')}"`; break;
case 'album': query = `Album HAS "${this.text.replace(/"/g, '')}"`; break;
case 'artist': query = grSet.headerFlipRows ? `Album HAS "${this.text.replace(/"/g, '')}"` : `Artist HAS "${this.text.replace(/"/g, '')}" OR Album Artist HAS "${this.text.replace(/"/g, '')}" OR ARTISTFILTER HAS "${this.text.replace(/"/g, '')}"`; break;
case 'album': query = grSet.headerFlipRows ? `Artist HAS "${this.text.replace(/"/g, '')}" OR Album Artist HAS "${this.text.replace(/"/g, '')}" OR ARTISTFILTER HAS "${this.text.replace(/"/g, '')}"` : `Album HAS "${this.text.replace(/"/g, '')}"`; break;
case 'label': query = `Label HAS "${this.text.replace(/"/g, '')}" OR Publisher HAS "${this.text.replace(/"/g, '')}"`; break;
default: query = `${this.type} IS "${this.text}"`; break;
}
Expand Down
7 changes: 6 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 22-12-2017 * //
// * Last change: 21-03-2024 * //
// * Last change: 30-03-2024 * //
/////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -2116,6 +2116,11 @@ class TopMenuOptions {
playlistAlbumMenu.addSeparator();
playlistAlbumMenu.addToggleItem('Ctrl+click to follow hyperlinks', grSet, 'hyperlinksCtrlClick');
playlistAlbumMenu.addSeparator();
playlistAlbumMenu.addToggleItem('Flip header rows', grSet, 'headerFlipRows', () => {
grm.ui.initPlaylist();
pl.call.on_size(grm.ui.ww, grm.ui.wh);
});
playlistAlbumMenu.addSeparator();
playlistAlbumMenu.addToggleItem('Show disc sub-header', plSet, 'show_disc_header', () => { grm.ui.updatePlaylist(); });
playlistAlbumMenu.addToggleItem('Show group info', plSet, 'show_group_info', () => { grm.ui.updatePlaylist(); });
playlistAlbumMenu.addToggleItem('Show bit depth and sample rate always', grCfg.settings, 'playlistShowBitSampleAlways', () => { grm.ui.updatePlaylist(); });
Expand Down
4 changes: 3 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 22-12-2017 * //
// * Last change: 21-03-2024 * //
// * Last change: 30-03-2024 * //
/////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -513,6 +513,7 @@ grSet.addProperties({
showPlaylistHistory: ['Georgia-ReBORN - 10. Playlist: Show playlist history', true], // Show Playlist history
autoHidePlman: ['Georgia-ReBORN - 10. Playlist: Auto hide playlist manager', true], // Playlist Automatic Playlist Manager Hide
hyperlinksCtrlClick: ['Georgia-ReBORN - 10. Playlist: Ctrl+click to follow hyperlinks', false], // true: Clicking on hyperlinks only works if CTRL key is held down
headerFlipRows: ['Georgia-ReBORN - 10. Playlist: Flip header rows', false], // true: Playlist header title and subtitle rows will be reversed
showWeblinks: ['Georgia-ReBORN - 10. Playlist: Show weblinks', true], // Show weblinks in context menu
showPlaylistFullDate: ['Georgia-ReBORN - 10. Playlist: Show full date', false], // Playlist show full date YYYY-MM-DD
showPlaylistRatingGrid: ['Georgia-ReBORN - 10. Playlist: Show rating grid', false], // Show rating grid in playlist rows
Expand Down Expand Up @@ -1131,6 +1132,7 @@ class ThemeSettingsManager {
this._setSetting(plSet, 'use_compact_header', grCfg.themePlaylist, 'use_compact_header', false);
this._setSetting(plSet, 'auto_collapse', grCfg.themePlaylist, 'auto_collapse', false);
this._setSetting(grSet, 'hyperlinksCtrlClick', grCfg.themePlaylist, 'hyperlinksCtrlClick', false);
this._setSetting(grSet, 'headerFlipRows', grCfg.themePlaylist, 'headerFlipRows', false);
this._setSetting(plSet, 'show_disc_header', grCfg.themePlaylist, 'show_disc_header', true);
this._setSetting(plSet, 'show_group_info', grCfg.themePlaylist, 'show_group_info', true);
this._setSetting(grSet, 'showWeblinks', grCfg.themePlaylist, 'showWeblinks', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 22-12-2017 * //
// * Last change: 21-02-2024 * //
// * Last change: 30-03-2024 * //
/////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -575,7 +575,7 @@ class PlaylistHeader extends PlaylistBaseHeader {
// * ARTIST * //
if (this.grouping_handler.get_title_query()) {
const artist_text_format = Stringformat.v_align_far | Stringformat.trim_ellipsis_char | Stringformat.no_wrap;
let artist_text = $(this.grouping_handler.get_title_query(), this.metadb);
let artist_text = grSet.headerFlipRows ? $(this.grouping_handler.get_sub_title_query(), this.metadb) : $(this.grouping_handler.get_title_query(), this.metadb);

if (!artist_text && is_radio) {
artist_text = 'Radio Stream';
Expand Down Expand Up @@ -610,7 +610,7 @@ class PlaylistHeader extends PlaylistBaseHeader {

// * ALBUM * //
if (this.grouping_handler.get_sub_title_query()) {
const album_text = $(this.grouping_handler.get_sub_title_query(), this.metadb);
const album_text = grSet.headerFlipRows ? $(this.grouping_handler.get_title_query(), this.metadb) : $(this.grouping_handler.get_sub_title_query(), this.metadb);

if (album_text) {
const album_h = part_h;
Expand Down Expand Up @@ -1035,7 +1035,7 @@ class PlaylistHeader extends PlaylistBaseHeader {
}

// * Artist
const albumArtist = '%album artist%';
const albumArtist = grSet.headerFlipRows ? this.grouping_handler.get_sub_title_query() : this.grouping_handler.get_title_query();
const is_radio = this.metadb.RawPath.startsWith('http');
let artist_text = [];
let artist_x = left_pad;
Expand Down Expand Up @@ -1078,7 +1078,7 @@ class PlaylistHeader extends PlaylistBaseHeader {

// * Album
const album_y = part_h * (!plSet.show_group_info ? 1.5 : 1) + ((RES._4K || RES._QHD && headerFontSize === 17 ? 5 : 4) * (!plSet.show_group_info ? 2 : 1));
const album_text = $(this.grouping_handler.get_sub_title_query(), this.metadb);
const album_text = grSet.headerFlipRows ? $(this.grouping_handler.get_title_query(), this.metadb) : $(this.grouping_handler.get_sub_title_query(), this.metadb);

if (album_text) {
this.hyperlinks.album = new Hyperlink(album_text, pl.font.album, 'album', left_pad, album_y, this.w - left_pad * 2, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 22-12-2017 * //
// * Last change: 22-02-2024 * //
// * Last change: 30-03-2024 * //
/////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -1420,6 +1420,12 @@ class Playlist extends BaseList {
this.scroll_to_focused_or_now_playing();
}, { is_checked: plSet.show_group_info });

appear_header.appendItem('Flip header rows', () => {
grSet.headerFlipRows = !grSet.headerFlipRows;
this.initialize_list();
this.scroll_to_focused_or_now_playing();
}, { is_checked: grSet.headerFlipRows });

const art = new ContextMenu('Album art');
appear_header.append(art);

Expand Down

0 comments on commit 5be39d6

Please sign in to comment.