From b16f04de0a68e2a23f9942b131b0f3bfbcf5e6d1 Mon Sep 17 00:00:00 2001 From: Zach Morris Date: Fri, 20 Dec 2024 18:52:27 -0800 Subject: [PATCH] Add Named_Logos (#17216) * Draft: Add Named_Logos * Allow selecting Content Logo as a thumbnail display * Increase pl_thumbnail_download index to 4 to match the 4 available thumb types --------- Co-authored-by: Rob Loach --- gfx/gfx_thumbnail_path.c | 2 +- intl/msg_hash_us.h | 4 ++ menu/cbs/menu_cbs_get_value.c | 2 + menu/cbs/menu_cbs_left.c | 6 +-- menu/cbs/menu_cbs_right.c | 18 ++++----- menu/menu_displaylist.c | 5 ++- menu/menu_setting.c | 14 ++++++- msg_hash.h | 1 + playlist.c | 4 +- playlist.h | 2 +- retroarch.cfg | 2 +- tasks/task_pl_thumbnail_download.c | 17 +++++---- ui/drivers/qt/qt_downloads.cpp | 5 +++ ui/drivers/qt/qt_playlist.cpp | 2 + ui/drivers/qt/qt_widgets.cpp | 1 + ui/drivers/ui_qt.cpp | 60 ++++++++++++++++++++++++++++++ ui/drivers/ui_qt.h | 6 +++ 17 files changed, 124 insertions(+), 27 deletions(-) diff --git a/gfx/gfx_thumbnail_path.c b/gfx/gfx_thumbnail_path.c index d7069519f6..f4dffcf493 100644 --- a/gfx/gfx_thumbnail_path.c +++ b/gfx/gfx_thumbnail_path.c @@ -67,7 +67,7 @@ static void gfx_thumbnail_fill_content_img(char *s, size_t len, const char *src, } /* Returns currently set thumbnail 'type' (Named_Snaps, - * Named_Titles, Named_Boxarts) for specified thumbnail + * Named_Titles, Named_Boxarts, Named_Logos) for specified thumbnail * identifier (right, left) */ static const char *gfx_thumbnail_get_type( settings_t *settings, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 47e184222a..c848e8d0df 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -12847,6 +12847,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN, "Title Screen" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_LOGO, + "Logo" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_ALL_PLAYLISTS, "All Playlists" diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index f6e59eac52..5c7123ec09 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1519,6 +1519,8 @@ static const char *get_playlist_thumbnail_mode_value(playlist_t *playlist, enum return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS); case PLAYLIST_THUMBNAIL_MODE_BOXARTS: return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS); + case PLAYLIST_THUMBNAIL_MODE_LOGOS: + return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_LOGOS); default: /* PLAYLIST_THUMBNAIL_MODE_DEFAULT */ break; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index a0df1fbe7b..c8971de5b0 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -504,7 +504,7 @@ static void playlist_thumbnail_mode_left(playlist_t *playlist, enum playlist_thu if (thumbnail_mode > PLAYLIST_THUMBNAIL_MODE_DEFAULT) thumbnail_mode = (enum playlist_thumbnail_mode)((unsigned)thumbnail_mode - 1); else if (wraparound) - thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_BOXARTS; + thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_LOGOS; playlist_set_thumbnail_mode(playlist, thumbnail_id, thumbnail_mode); playlist_write_file(playlist); @@ -1218,7 +1218,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, case FILE_TYPE_VIDEO_FONT: case MENU_SETTING_GROUP: case MENU_SETTINGS_CORE_INFO_NONE: - if ( + if ( string_ends_with_size(menu_label, "_tab", menu_lbl_len, STRLEN_CONST("_tab")) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)) @@ -1280,7 +1280,7 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs, if (type == MENU_SETTING_NO_ITEM) { - if ( + if ( string_ends_with_size(menu_label, "_tab", menu_lbl_len, STRLEN_CONST("_tab")) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 4a1b385d36..cac8d3f05a 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -259,7 +259,7 @@ static int action_right_scroll(unsigned type, const char *label, } } #ifdef HAVE_AUDIOMIXER - if (selection != menu_st->selection_ptr) + if (selection != menu_st->selection_ptr) audio_driver_mixer_play_scroll_sound(false); #endif @@ -287,11 +287,11 @@ static int action_right_mainmenu(unsigned type, const char *label, #ifdef HAVE_XMB struct menu_state *menu_st = menu_state_get_ptr(); const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx; - const char *menu_ident = (driver_ctx && driver_ctx->ident) - ? driver_ctx->ident + const char *menu_ident = (driver_ctx && driver_ctx->ident) + ? driver_ctx->ident : NULL; - size_t size = (driver_ctx && driver_ctx->list_get_size) - ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN) + size_t size = (driver_ctx && driver_ctx->list_get_size) + ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN) : 0; /* Tab switching functionality only applies * to XMB */ @@ -303,8 +303,8 @@ static int action_right_mainmenu(unsigned type, const char *label, bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable; if (driver_ctx) { - selection = (driver_ctx->list_get_selection) - ? driver_ctx->list_get_selection(menu_st->userdata) + selection = (driver_ctx->list_get_selection) + ? driver_ctx->list_get_selection(menu_st->userdata) : 0; if (driver_ctx->list_get_size) { @@ -613,7 +613,7 @@ static void playlist_thumbnail_mode_right(playlist_t *playlist, enum playlist_th enum playlist_thumbnail_mode thumbnail_mode = playlist_get_thumbnail_mode(playlist, thumbnail_id); - if (thumbnail_mode < PLAYLIST_THUMBNAIL_MODE_BOXARTS) + if (thumbnail_mode < PLAYLIST_THUMBNAIL_MODE_LOGOS) thumbnail_mode = (enum playlist_thumbnail_mode)((unsigned)thumbnail_mode + 1); else if (wraparound) thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT; @@ -1308,7 +1308,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, return 0; } } - + if (menu_cbs_init_bind_right_compare_label(cbs, label, lbl_len, menu_lbl, menu_lbl_len ) == 0) return 0; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 44bc6937e9..1814c27720 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6446,7 +6446,7 @@ static unsigned populate_playlist_thumbnail_mode_dropdown_list( : MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LEFT_THUMBNAIL_MODE; /* Loop over all thumbnail modes */ - for (i = 0; i <= (unsigned)PLAYLIST_THUMBNAIL_MODE_BOXARTS; i++) + for (i = 0; i <= (unsigned)PLAYLIST_THUMBNAIL_MODE_LOGOS; i++) { enum msg_hash_enums label_value; enum playlist_thumbnail_mode thumbnail_mode = @@ -6467,6 +6467,9 @@ static unsigned populate_playlist_thumbnail_mode_dropdown_list( case PLAYLIST_THUMBNAIL_MODE_BOXARTS: label_value = MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS; break; + case PLAYLIST_THUMBNAIL_MODE_LOGOS: + label_value = MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_LOGOS; + break; default: /* PLAYLIST_THUMBNAIL_MODE_DEFAULT */ label_value = MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_THUMBNAIL_MODE_DEFAULT; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index f520bdd98e..b601e6bf95 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3336,6 +3336,11 @@ static void setting_get_string_representation_uint_menu_thumbnails( msg_hash_to_str( MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS), len); break; + case 4: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_LOGOS), len); + break; } } @@ -3367,6 +3372,11 @@ static void setting_get_string_representation_uint_menu_left_thumbnails( msg_hash_to_str( MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS), len); break; + case 4: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_LOGOS), len); + break; } } @@ -20095,7 +20105,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_uint_menu_thumbnails; - menu_settings_list_current_add_range(list, list_info, 0, 3, 1, true, true); + menu_settings_list_current_add_range(list, list_info, 0, PLAYLIST_THUMBNAIL_MODE_LOGOS - 1, 1, true, true); (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_RADIO_BUTTONS; CONFIG_UINT( @@ -20112,7 +20122,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_uint_menu_left_thumbnails; - menu_settings_list_current_add_range(list, list_info, 0, 3, 1, true, true); + menu_settings_list_current_add_range(list, list_info, 0, PLAYLIST_THUMBNAIL_MODE_LOGOS - 1, 1, true, true); (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_RADIO_BUTTONS; CONFIG_UINT( diff --git a/msg_hash.h b/msg_hash.h index 4d848b9bef..cdbbf17be8 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -3882,6 +3882,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART, MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT, MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN, + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_LOGO, MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE, MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE, MENU_ENUM_LABEL_VALUE_QT_LOADING_CORE, diff --git a/playlist.c b/playlist.c index 592b065d13..88e3fc4556 100644 --- a/playlist.c +++ b/playlist.c @@ -2837,12 +2837,12 @@ static bool playlist_read_file(playlist_t *playlist) { /* Right thumbnail mode */ unsigned thumbnail_mode = string_to_unsigned(elem0); - if (thumbnail_mode <= PLAYLIST_THUMBNAIL_MODE_BOXARTS) + if (thumbnail_mode <= PLAYLIST_THUMBNAIL_MODE_LOGOS) playlist->right_thumbnail_mode = (enum playlist_thumbnail_mode)thumbnail_mode; /* Left thumbnail mode */ thumbnail_mode = string_to_unsigned(tok); - if (thumbnail_mode <= PLAYLIST_THUMBNAIL_MODE_BOXARTS) + if (thumbnail_mode <= PLAYLIST_THUMBNAIL_MODE_LOGOS) playlist->left_thumbnail_mode = (enum playlist_thumbnail_mode)thumbnail_mode; } free(elem0); diff --git a/playlist.h b/playlist.h index 9f55c9e9f5..ac7a62840e 100644 --- a/playlist.h +++ b/playlist.h @@ -62,7 +62,7 @@ enum playlist_thumbnail_mode PLAYLIST_THUMBNAIL_MODE_SCREENSHOTS, PLAYLIST_THUMBNAIL_MODE_TITLE_SCREENS, PLAYLIST_THUMBNAIL_MODE_BOXARTS, - PLAYLIST_THUMBNAIL_MODE_LOGO + PLAYLIST_THUMBNAIL_MODE_LOGOS }; enum playlist_thumbnail_match_mode diff --git a/retroarch.cfg b/retroarch.cfg index 64a520816d..7a9ac73fc3 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -732,7 +732,7 @@ # Dynamically load a new wallpaper depending on context. # menu_dynamic_wallpaper_enable = false -# Type of thumbnail to display. 0 = none, 1 = snaps, 2 = titles, 3 = boxarts +# Type of thumbnail to display. 0 = none, 1 = snaps, 2 = titles, 3 = boxarts, 4 = logos # menu_thumbnails = 0 # menu_left_thumbnails = 0 diff --git a/tasks/task_pl_thumbnail_download.c b/tasks/task_pl_thumbnail_download.c index 71b397e87a..7d6a6ea58d 100644 --- a/tasks/task_pl_thumbnail_download.c +++ b/tasks/task_pl_thumbnail_download.c @@ -92,8 +92,8 @@ typedef struct pl_entry_id /*********************/ /* Fetches the thumbnail subdirectory (Named_Snaps, - * Named_Titles, Named_Boxarts) corresponding to the - * specified 'type index' (1, 2, 3). + * Named_Titles, Named_Boxarts, Named_Logos) corresponding to the + * specified 'type index' (1, 2, 3, 4). * Returns true if 'type index' is valid */ static bool gfx_thumbnail_get_sub_directory( unsigned type_idx, const char **sub_directory) @@ -112,6 +112,9 @@ static bool gfx_thumbnail_get_sub_directory( case 3: *sub_directory = "Named_Boxarts"; return true; + case 4: + *sub_directory = "Named_Logos"; + return true; case 0: default: break; @@ -456,7 +459,7 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task) pl_thumb->http_task = NULL; /* Check whether all thumbnail types have been processed */ - if (pl_thumb->type_idx > 3) + if (pl_thumb->type_idx > 4) { next_flag = playlist_get_next_thumbnail_name_flag(pl_thumb->playlist,pl_thumb->list_index); if (next_flag == PLAYLIST_THUMBNAIL_FLAG_NONE) { @@ -469,8 +472,8 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task) pl_thumb->status = PL_THUMB_END; break; } else { - /* Increment the name flag to cover the 3 supported naming conventions. - * Side-effect: all combinations will be tried (3x3 requests for 1 playlist entry) + /* Increment the name flag to cover the 4 supported naming conventions. + * Side-effect: all combinations will be tried (4x4 requests for 1 playlist entry) * even if some files were already downloaded, but that may be useful if later on * different view priorities are implemented. */ pl_thumb->type_idx = 1; @@ -777,14 +780,14 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task) pl_thumb->http_task = NULL; /* Check whether all thumbnail types have been processed */ - if (pl_thumb->type_idx > 3) + if (pl_thumb->type_idx > 4) { pl_thumb->status = PL_THUMB_END; break; } /* Update progress */ - task_set_progress(task, ((pl_thumb->type_idx - 1) * 100) / 3); + task_set_progress(task, ((pl_thumb->type_idx - 1) * 100) / 4); /* Download current thumbnail */ if (pl_thumb) diff --git a/ui/drivers/qt/qt_downloads.cpp b/ui/drivers/qt/qt_downloads.cpp index 3d5cba2288..528821716a 100644 --- a/ui/drivers/qt/qt_downloads.cpp +++ b/ui/drivers/qt/qt_downloads.cpp @@ -844,6 +844,7 @@ void MainWindow::downloadNextPlaylistThumbnail( dir.mkpath(dirString + "/" + system + "/" + THUMBNAIL_BOXART); dir.mkpath(dirString + "/" + system + "/" + THUMBNAIL_SCREENSHOT); dir.mkpath(dirString + "/" + system + "/" + THUMBNAIL_TITLE); + dir.mkpath(dirString + "/" + system + "/" + THUMBNAIL_LOGO); m_playlistThumbnailDownloadFile.setFileName(fileName); @@ -921,6 +922,7 @@ void MainWindow::downloadPlaylistThumbnails(QString playlistPath) QHash hash; QHash hash2; QHash hash3; + QHash hash4; const QHash &itemHash = m_playlistModel->index(i, 0).data(PlaylistModel::HASH).value< QHash >(); hash["db_name"] = itemHash.value("db_name"); @@ -929,13 +931,16 @@ void MainWindow::downloadPlaylistThumbnails(QString playlistPath) hash2 = hash; hash3 = hash; + hash4 = hash; hash2["type"] = THUMBNAIL_SCREENSHOT; hash3["type"] = THUMBNAIL_TITLE; + hash4["type"] = THUMBNAIL_LOGO; m_pendingPlaylistThumbnails.append(hash); m_pendingPlaylistThumbnails.append(hash2); m_pendingPlaylistThumbnails.append(hash3); + m_pendingPlaylistThumbnails.append(hash4); } m_playlistThumbnailDownloadProgressDialog->setWindowModality(Qt::NonModal); diff --git a/ui/drivers/qt/qt_playlist.cpp b/ui/drivers/qt/qt_playlist.cpp index 9250630637..6cea123122 100644 --- a/ui/drivers/qt/qt_playlist.cpp +++ b/ui/drivers/qt/qt_playlist.cpp @@ -193,6 +193,8 @@ QString PlaylistModel::getCurrentTypeThumbnailPath(const QModelIndex &index) con return getThumbnailPath(index, THUMBNAIL_SCREENSHOT); case THUMBNAIL_TYPE_TITLE_SCREEN: return getThumbnailPath(index, THUMBNAIL_TITLE); + case THUMBNAIL_TYPE_LOGO: + return getThumbnailPath(index, THUMBNAIL_LOGO); default: break; } diff --git a/ui/drivers/qt/qt_widgets.cpp b/ui/drivers/qt/qt_widgets.cpp index d6ec17c688..9bf728f81e 100644 --- a/ui/drivers/qt/qt_widgets.cpp +++ b/ui/drivers/qt/qt_widgets.cpp @@ -1244,6 +1244,7 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos) m_pendingThumbnailDownloadTypes.append(THUMBNAIL_BOXART); m_pendingThumbnailDownloadTypes.append(THUMBNAIL_SCREENSHOT); m_pendingThumbnailDownloadTypes.append(THUMBNAIL_TITLE); + m_pendingThumbnailDownloadTypes.append(THUMBNAIL_LOGO); downloadThumbnail(system, title); } else diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp index f2fb1f9c92..a4f24f738b 100644 --- a/ui/drivers/ui_qt.cpp +++ b/ui/drivers/ui_qt.cpp @@ -1159,6 +1159,7 @@ MainWindow::MainWindow(QWidget *parent) : ,m_thumbnailPixmap(NULL) ,m_thumbnailPixmap2(NULL) ,m_thumbnailPixmap3(NULL) + ,m_thumbnailPixmap4(NULL) ,m_settings(NULL) ,m_viewOptionsDialog(NULL) ,m_coreInfoDialog(new CoreInfoDialog(this, NULL)) @@ -1239,6 +1240,7 @@ MainWindow::MainWindow(QWidget *parent) : QAction *thumbnailTypeBoxartAction = NULL; QAction *thumbnailTypeScreenshotAction = NULL; QAction *thumbnailTypeTitleAction = NULL; + QAction *thumbnailTypeLogoAction = NULL; QPushButton *viewTypePushButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW), m_zoomWidget); QMenu *viewTypeMenu = new QMenu(viewTypePushButton); QAction *viewTypeIconsAction = NULL; @@ -1271,6 +1273,8 @@ MainWindow::MainWindow(QWidget *parent) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT)); thumbnailTypeTitleAction = thumbnailTypeMenu->addAction( msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN)); + thumbnailTypeLogoAction = thumbnailTypeMenu->addAction( + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_LOGO)); thumbnailTypePushButton->setMenu(thumbnailTypeMenu); @@ -1509,6 +1513,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(thumbnailTypeBoxartAction, SIGNAL(triggered()), this, SLOT(onBoxartThumbnailClicked())); connect(thumbnailTypeScreenshotAction, SIGNAL(triggered()), this, SLOT(onScreenshotThumbnailClicked())); connect(thumbnailTypeTitleAction, SIGNAL(triggered()), this, SLOT(onTitleThumbnailClicked())); + connect(thumbnailTypeLogoAction, SIGNAL(triggered()), this, SLOT(onLogoThumbnailClicked())); connect(viewTypeIconsAction, SIGNAL(triggered()), this, SLOT(onIconViewClicked())); connect(viewTypeListAction, SIGNAL(triggered()), this, SLOT(onListViewClicked())); connect(m_dirModel, SIGNAL(directoryLoaded(const QString&)), this, SLOT(onFileSystemDirLoaded(const QString&))); @@ -1595,6 +1600,8 @@ MainWindow::~MainWindow() delete m_thumbnailPixmap2; if (m_thumbnailPixmap3) delete m_thumbnailPixmap3; + if (m_thumbnailPixmap4) + delete m_thumbnailPixmap4; if (m_proxyFileModel) delete m_proxyFileModel; } @@ -1718,6 +1725,11 @@ void MainWindow::onTitleThumbnailClicked() setCurrentThumbnailType(THUMBNAIL_TYPE_TITLE_SCREEN); } +void MainWindow::onLogoThumbnailClicked() +{ + setCurrentThumbnailType(THUMBNAIL_TYPE_LOGO); +} + void MainWindow::setIconViewZoom(int zoom_val) { m_zoomSlider->setValue(zoom_val); @@ -2251,6 +2263,22 @@ void MainWindow::onThumbnailDropped(const QImage &image, onResizeThumbnailThree(*m_thumbnailPixmap3, true); break; } + + case THUMBNAIL_TYPE_LOGO: + { + QString path = changeThumbnail(image, THUMBNAIL_LOGO); + + if (path.isNull()) + return; + + if (m_thumbnailPixmap4) + delete m_thumbnailPixmap4; + + m_thumbnailPixmap4 = new QPixmap(path); + + onResizeThumbnailFour(*m_thumbnailPixmap4, true); + break; + } } } @@ -3471,6 +3499,8 @@ void MainWindow::onCurrentItemChanged(const QHash &hash) delete m_thumbnailPixmap2; if (m_thumbnailPixmap3) delete m_thumbnailPixmap3; + if (m_thumbnailPixmap4) + delete m_thumbnailPixmap4; if (m_playlistModel->isSupportedImage(path)) { @@ -3478,6 +3508,7 @@ void MainWindow::onCurrentItemChanged(const QHash &hash) m_thumbnailPixmap = new QPixmap(path); m_thumbnailPixmap2 = new QPixmap(*m_thumbnailPixmap); m_thumbnailPixmap3 = new QPixmap(*m_thumbnailPixmap); + m_thumbnailPixmap4 = new QPixmap(*m_thumbnailPixmap); } else { @@ -3487,6 +3518,7 @@ void MainWindow::onCurrentItemChanged(const QHash &hash) m_thumbnailPixmap = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_BOXART + "/" + thumbnailName); m_thumbnailPixmap2 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_TITLE + "/" + thumbnailName); m_thumbnailPixmap3 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_SCREENSHOT + "/" + thumbnailName); + m_thumbnailPixmap4 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_LOGO + "/" + thumbnailName); if ( m_currentBrowser == BROWSER_TYPE_PLAYLISTS && !currentPlaylistIsSpecial()) @@ -3496,6 +3528,7 @@ void MainWindow::onCurrentItemChanged(const QHash &hash) onResizeThumbnailOne(*m_thumbnailPixmap, acceptDrop); onResizeThumbnailTwo(*m_thumbnailPixmap2, acceptDrop); onResizeThumbnailThree(*m_thumbnailPixmap3, acceptDrop); + onResizeThumbnailFour(*m_thumbnailPixmap4, acceptDrop); setCoreActions(); } @@ -3524,6 +3557,11 @@ void MainWindow::onResizeThumbnailThree(QPixmap &pixmap, bool acceptDrop) setThumbnail("thumbnail3", pixmap, acceptDrop); } +void MainWindow::onResizeThumbnailFour(QPixmap &pixmap, bool acceptDrop) +{ + setThumbnail("thumbnail4", pixmap, acceptDrop); +} + void MainWindow::setCurrentViewType(ViewType viewType) { m_viewType = viewType; @@ -3897,6 +3935,8 @@ QString MainWindow::getCurrentThumbnailTypeString() return QStringLiteral("screenshot"); case THUMBNAIL_TYPE_TITLE_SCREEN: return QStringLiteral("title"); + case THUMBNAIL_TYPE_LOGO: + return QStringLiteral("logo"); case THUMBNAIL_TYPE_BOXART: default: return QStringLiteral("boxart"); @@ -3913,6 +3953,8 @@ ThumbnailType MainWindow::getThumbnailTypeFromString(QString thumbnailType) return THUMBNAIL_TYPE_SCREENSHOT; else if (thumbnailType == "title") return THUMBNAIL_TYPE_TITLE_SCREEN; + else if (thumbnailType == "logo") + return THUMBNAIL_TYPE_LOGO; return THUMBNAIL_TYPE_BOXART; } @@ -4559,6 +4601,7 @@ static void* ui_companion_qt_init(void) QDockWidget *thumbnailDock = NULL; QDockWidget *thumbnail2Dock = NULL; QDockWidget *thumbnail3Dock = NULL; + QDockWidget *thumbnail4Dock = NULL; QDockWidget *browserAndPlaylistTabDock = NULL; QDockWidget *coreSelectionDock = NULL; QTabWidget *browserAndPlaylistTabWidget = NULL; @@ -4571,12 +4614,14 @@ static void* ui_companion_qt_init(void) ThumbnailWidget *thumbnailWidget = NULL; ThumbnailWidget *thumbnail2Widget = NULL; ThumbnailWidget *thumbnail3Widget = NULL; + ThumbnailWidget *thumbnail4Widget = NULL; QPushButton *browserDownloadsButton = NULL; QPushButton *browserUpButton = NULL; QPushButton *browserStartButton = NULL; ThumbnailLabel *thumbnail = NULL; ThumbnailLabel *thumbnail2 = NULL; ThumbnailLabel *thumbnail3 = NULL; + ThumbnailLabel *thumbnail4 = NULL; QAction *editSearchAction = NULL; QAction *loadCoreAction = NULL; QAction *unloadCoreAction = NULL; @@ -4726,9 +4771,13 @@ static void* ui_companion_qt_init(void) thumbnail3Widget = new ThumbnailWidget(THUMBNAIL_TYPE_SCREENSHOT); thumbnail3Widget->setObjectName("thumbnail3"); + thumbnail4Widget = new ThumbnailWidget(THUMBNAIL_TYPE_LOGO); + thumbnail4Widget->setObjectName("thumbnail4"); + QObject::connect(thumbnailWidget, SIGNAL(filesDropped(const QImage&, ThumbnailType)), mainwindow, SLOT(onThumbnailDropped(const QImage&, ThumbnailType))); QObject::connect(thumbnail2Widget, SIGNAL(filesDropped(const QImage&, ThumbnailType)), mainwindow, SLOT(onThumbnailDropped(const QImage&, ThumbnailType))); QObject::connect(thumbnail3Widget, SIGNAL(filesDropped(const QImage&, ThumbnailType)), mainwindow, SLOT(onThumbnailDropped(const QImage&, ThumbnailType))); + QObject::connect(thumbnail4Widget, SIGNAL(filesDropped(const QImage&, ThumbnailType)), mainwindow, SLOT(onThumbnailDropped(const QImage&, ThumbnailType))); thumbnailDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART), mainwindow); thumbnailDock->setObjectName("thumbnailDock"); @@ -4754,8 +4803,17 @@ static void* ui_companion_qt_init(void) mainwindow->addDockWidget(static_cast(thumbnail3Dock->property("default_area").toInt()), thumbnail3Dock); + thumbnail4Dock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_LOGO), mainwindow); + thumbnail4Dock->setObjectName("thumbnail4Dock"); + thumbnail4Dock->setProperty("default_area", Qt::RightDockWidgetArea); + thumbnail4Dock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_LOGO)); + thumbnail4Dock->setWidget(thumbnail4Widget); + + mainwindow->addDockWidget(static_cast(thumbnail4Dock->property("default_area").toInt()), thumbnail4Dock); + mainwindow->tabifyDockWidget(thumbnailDock, thumbnail2Dock); mainwindow->tabifyDockWidget(thumbnailDock, thumbnail3Dock); + mainwindow->tabifyDockWidget(thumbnailDock, thumbnail4Dock); /* when tabifying the dock widgets, the last tab added is selected by default, so we need to re-select the first tab */ thumbnailDock->raise(); @@ -4878,6 +4936,8 @@ static void* ui_companion_qt_init(void) mainwindow->setCurrentThumbnailType(THUMBNAIL_TYPE_SCREENSHOT); else if (thumbnailType == "title") mainwindow->setCurrentThumbnailType(THUMBNAIL_TYPE_TITLE_SCREEN); + else if (thumbnailType == "logo") + mainwindow->setCurrentThumbnailType(THUMBNAIL_TYPE_LOGO); else mainwindow->setCurrentThumbnailType(THUMBNAIL_TYPE_BOXART); } diff --git a/ui/drivers/ui_qt.h b/ui/drivers/ui_qt.h index 06bd74001f..5604bd72dc 100644 --- a/ui/drivers/ui_qt.h +++ b/ui/drivers/ui_qt.h @@ -68,6 +68,7 @@ extern "C" { #define THUMBNAIL_BOXART "Named_Boxarts" #define THUMBNAIL_SCREENSHOT "Named_Snaps" #define THUMBNAIL_TITLE "Named_Titles" +#define THUMBNAIL_LOGO "Named_Logos" class QApplication; class QCloseEvent; @@ -117,6 +118,7 @@ enum ThumbnailType THUMBNAIL_TYPE_BOXART, THUMBNAIL_TYPE_SCREENSHOT, THUMBNAIL_TYPE_TITLE_SCREEN, + THUMBNAIL_TYPE_LOGO, }; static inline double lerp(double x, double y, double a, double b, double d) @@ -411,6 +413,7 @@ signals: void thumbnailChanged(const QPixmap &pixmap); void thumbnail2Changed(const QPixmap &pixmap); void thumbnail3Changed(const QPixmap &pixmap); + void thumbnail4Changed(const QPixmap &pixmap); void gotLogMessage(const QString &msg); void gotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush); void gotReloadPlaylists(); @@ -443,6 +446,7 @@ public slots: void onResizeThumbnailOne(QPixmap &pixmap, bool acceptDrop); void onResizeThumbnailTwo(QPixmap &pixmap, bool acceptDrop); void onResizeThumbnailThree(QPixmap &pixmap, bool acceptDrop); + void onResizeThumbnailFour(QPixmap &pixmap, bool acceptDrop); void appendLogMessage(const QString &msg); void onGotLogMessage(const QString &msg); void onGotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush); @@ -457,6 +461,7 @@ public slots: void onBoxartThumbnailClicked(); void onScreenshotThumbnailClicked(); void onTitleThumbnailClicked(); + void onLogoThumbnailClicked(); void onTabWidgetIndexChanged(int index); void deleteCurrentPlaylistItem(); void onFileDropWidgetContextMenuRequested(const QPoint &pos); @@ -574,6 +579,7 @@ private: QPixmap *m_thumbnailPixmap; QPixmap *m_thumbnailPixmap2; QPixmap *m_thumbnailPixmap3; + QPixmap *m_thumbnailPixmap4; QSettings *m_settings; ViewOptionsDialog *m_viewOptionsDialog; CoreInfoDialog *m_coreInfoDialog;