From 61fa0a0807f02c7b331dcec4d56dfb05fd328be9 Mon Sep 17 00:00:00 2001 From: Tatsuya79 Date: Mon, 1 Apr 2019 21:31:46 +0200 Subject: [PATCH 1/2] Move thumbnail type selection to grid footer. --- intl/msg_hash_pt_br.h | 2 +- intl/msg_hash_us.h | 2 +- ui/drivers/qt/ui_qt_window.cpp | 34 +++++++++++++++++++++++++++++ ui/drivers/qt/viewoptionsdialog.cpp | 20 ----------------- ui/drivers/qt/viewoptionsdialog.h | 2 -- ui/drivers/ui_qt.h | 3 +++ 6 files changed, 39 insertions(+), 24 deletions(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 01c28608ff..887df7ba7b 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7773,7 +7773,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE, - "Tipo de visualização de miniatura de ícones:" + "Miniatura" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 750eafe636..154d5ca8c6 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -8087,7 +8087,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE, - "Icon view thumbnail type:" + "Thumbnail" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT, diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index f79df2c354..74a617d864 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -366,6 +366,11 @@ MainWindow::MainWindow(QWidget *parent) : QToolButton *searchResetButton = NULL; QHBoxLayout *zoomLayout = new QHBoxLayout(); QLabel *zoomLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ZOOM), m_zoomWidget); + QPushButton *thumbnailTypePushButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE), m_zoomWidget); + QMenu *thumbnailTypeMenu = new QMenu(thumbnailTypePushButton); + QAction *thumbnailTypeBoxartAction = NULL; + QAction *thumbnailTypeScreenshotAction = NULL; + QAction *thumbnailTypeTitleAction = 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; @@ -386,6 +391,15 @@ MainWindow::MainWindow(QWidget *parent) : m_gridProgressWidget = new QWidget(); gridProgressLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PROGRESS), m_gridProgressWidget); + thumbnailTypePushButton->setObjectName("thumbnailTypePushButton"); + thumbnailTypePushButton->setFlat(true); + + thumbnailTypeBoxartAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART)); + thumbnailTypeScreenshotAction = thumbnailTypeMenu->addAction(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)); + + thumbnailTypePushButton->setMenu(thumbnailTypeMenu); + viewTypePushButton->setObjectName("viewTypePushButton"); viewTypePushButton->setFlat(true); @@ -444,6 +458,7 @@ MainWindow::MainWindow(QWidget *parent) : gridFooterLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred)); gridFooterLayout->addWidget(m_gridProgressWidget); gridFooterLayout->addWidget(m_zoomWidget); + gridFooterLayout->addWidget(thumbnailTypePushButton); gridFooterLayout->addWidget(viewTypePushButton); static_cast(m_playlistViewsAndFooter->layout())->addLayout(gridFooterLayout); @@ -613,6 +628,9 @@ MainWindow::MainWindow(QWidget *parent) : connect(m_listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPlaylistWidgetContextMenuRequested(const QPoint&))); connect(m_launchWithComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLaunchWithComboBoxIndexChanged(int))); connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(onZoomValueChanged(int))); + connect(thumbnailTypeBoxartAction, SIGNAL(triggered()), this, SLOT(onBoxartThumbnailClicked())); + connect(thumbnailTypeScreenshotAction, SIGNAL(triggered()), this, SLOT(onScreenshotThumbnailClicked())); + connect(thumbnailTypeTitleAction, SIGNAL(triggered()), this, SLOT(onTitleThumbnailClicked())); 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&))); @@ -830,6 +848,21 @@ void MainWindow::onListViewClicked() setCurrentViewType(VIEW_TYPE_LIST); } +void MainWindow::onBoxartThumbnailClicked() +{ + setCurrentThumbnailType(THUMBNAIL_TYPE_BOXART); +} + +void MainWindow::onScreenshotThumbnailClicked() +{ + setCurrentThumbnailType(THUMBNAIL_TYPE_SCREENSHOT); +} + +void MainWindow::onTitleThumbnailClicked() +{ + setCurrentThumbnailType(THUMBNAIL_TYPE_TITLE_SCREEN); +} + void MainWindow::setIconViewZoom(int zoomValue) { m_zoomSlider->setValue(zoomValue); @@ -2986,6 +3019,7 @@ void MainWindow::closeEvent(QCloseEvent *event) m_settings->setValue("view_type", getCurrentViewTypeString()); m_settings->setValue("file_browser_table_headers", m_fileTableView->horizontalHeader()->saveState()); m_settings->setValue("icon_view_zoom", m_lastZoomSliderValue); + m_settings->setValue("icon_view_thumbnail_type", getCurrentThumbnailTypeString()); QMainWindow::closeEvent(event); } diff --git a/ui/drivers/qt/viewoptionsdialog.cpp b/ui/drivers/qt/viewoptionsdialog.cpp index 52404998c7..2bb2cc7731 100644 --- a/ui/drivers/qt/viewoptionsdialog.cpp +++ b/ui/drivers/qt/viewoptionsdialog.cpp @@ -221,7 +221,6 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) : ,m_saveLastTabCheckBox(new QCheckBox(this)) ,m_showHiddenFilesCheckBox(new QCheckBox(this)) ,m_themeComboBox(new QComboBox(this)) - ,m_thumbnailComboBox(new QComboBox(this)) ,m_thumbnailCacheSpinBox(new QSpinBox(this)) ,m_startupPlaylistComboBox(new QComboBox(this)) ,m_highlightColorPushButton(new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CHOOSE), this)) @@ -239,10 +238,6 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) : m_themeComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_DARK), MainWindow::THEME_DARK); m_themeComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_CUSTOM), MainWindow::THEME_CUSTOM); - m_thumbnailComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART), THUMBNAIL_TYPE_BOXART); - m_thumbnailComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT), THUMBNAIL_TYPE_SCREENSHOT); - m_thumbnailComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN), THUMBNAIL_TYPE_TITLE_SCREEN); - m_thumbnailCacheSpinBox->setSuffix(" MB"); m_thumbnailCacheSpinBox->setRange(0, 99999); @@ -260,7 +255,6 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) : /* form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT), m_allPlaylistsListMaxCountSpinBox); */ /* form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT), m_allPlaylistsGridMaxCountSpinBox); */ form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST), m_startupPlaylistComboBox); - form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE), m_thumbnailComboBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT), m_thumbnailCacheSpinBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME), m_themeComboBox); form->addRow(m_highlightColorLabel, m_highlightColorPushButton); @@ -274,16 +268,9 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) : loadViewOptions(); connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThemeComboBoxIndexChanged(int))); - connect(m_thumbnailComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThumbnailComboBoxIndexChanged(int))); connect(m_highlightColorPushButton, SIGNAL(clicked()), this, SLOT(onHighlightColorChoose())); } -void ViewOptionsWidget::onThumbnailComboBoxIndexChanged(int index) -{ - ThumbnailType type = static_cast(m_thumbnailComboBox->currentData().value()); - m_mainwindow->setCurrentThumbnailType(type); -} - void ViewOptionsWidget::onThemeComboBoxIndexChanged(int) { MainWindow::Theme theme = static_cast(m_themeComboBox->currentData(Qt::UserRole).toInt()); @@ -342,7 +329,6 @@ void ViewOptionsWidget::loadViewOptions() QVector > playlists = m_mainwindow->getPlaylists(); QString initialPlaylist = m_settings->value("initial_playlist", m_mainwindow->getSpecialPlaylistPath(SPECIAL_PLAYLIST_HISTORY)).toString(); int themeIndex = 0; - int thumbnailIndex = 0; int playlistIndex = 0; int i; @@ -360,11 +346,6 @@ void ViewOptionsWidget::loadViewOptions() if (m_themeComboBox->count() > themeIndex) m_themeComboBox->setCurrentIndex(themeIndex); - thumbnailIndex = m_thumbnailComboBox->findData(m_mainwindow->getThumbnailTypeFromString(m_settings->value("icon_view_thumbnail_type", "boxart").toString())); - - if (m_thumbnailComboBox->count() > thumbnailIndex) - m_thumbnailComboBox->setCurrentIndex(thumbnailIndex); - if (highlightColor.isValid()) { m_highlightColor = highlightColor; @@ -415,7 +396,6 @@ void ViewOptionsWidget::saveViewOptions() /* m_settings->setValue("all_playlists_list_max_count", m_allPlaylistsListMaxCountSpinBox->value()); */ /* m_settings->setValue("all_playlists_grid_max_count", m_allPlaylistsGridMaxCountSpinBox->value()); */ m_settings->setValue("initial_playlist", m_startupPlaylistComboBox->currentData(Qt::UserRole).toString()); - m_settings->setValue("icon_view_thumbnail_type", m_mainwindow->getCurrentThumbnailTypeString()); m_settings->setValue("thumbnail_cache_limit", m_thumbnailCacheSpinBox->value()); if (!m_mainwindow->customThemeString().isEmpty()) diff --git a/ui/drivers/qt/viewoptionsdialog.h b/ui/drivers/qt/viewoptionsdialog.h index 7116a50f25..6f7afd6b2f 100644 --- a/ui/drivers/qt/viewoptionsdialog.h +++ b/ui/drivers/qt/viewoptionsdialog.h @@ -31,7 +31,6 @@ public slots: void saveViewOptions(); private slots: void onThemeComboBoxIndexChanged(int index); - void onThumbnailComboBoxIndexChanged(int index); void onHighlightColorChoose(); private: void showOrHideHighlightColor(); @@ -43,7 +42,6 @@ private: QCheckBox *m_saveLastTabCheckBox; QCheckBox *m_showHiddenFilesCheckBox; QComboBox *m_themeComboBox; - QComboBox *m_thumbnailComboBox; QSpinBox *m_thumbnailCacheSpinBox; QComboBox *m_startupPlaylistComboBox; QPushButton *m_highlightColorPushButton; diff --git a/ui/drivers/ui_qt.h b/ui/drivers/ui_qt.h index c7183c3397..d0f1e8e919 100644 --- a/ui/drivers/ui_qt.h +++ b/ui/drivers/ui_qt.h @@ -447,6 +447,9 @@ public slots: void showWelcomeScreen(); void onIconViewClicked(); void onListViewClicked(); + void onBoxartThumbnailClicked(); + void onScreenshotThumbnailClicked(); + void onTitleThumbnailClicked(); void onTabWidgetIndexChanged(int index); void deleteCurrentPlaylistItem(); void onFileDropWidgetContextMenuRequested(const QPoint &pos); From e7373a9cc2b593c2e68d7d5af56ea11e0985d2c0 Mon Sep 17 00:00:00 2001 From: Tatsuya79 Date: Tue, 2 Apr 2019 01:49:30 +0200 Subject: [PATCH 2/2] dark theme pushbutton indicator fix --- ui/drivers/qt/ui_qt_themes.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/drivers/qt/ui_qt_themes.h b/ui/drivers/qt/ui_qt_themes.h index 95b8ad0da7..c72531e39a 100644 --- a/ui/drivers/qt/ui_qt_themes.h +++ b/ui/drivers/qt/ui_qt_themes.h @@ -326,6 +326,11 @@ static const QString qt_theme_dark_stylesheet = QStringLiteral(R"( QPushButton[flat="true"] { background-color:transparent; } + QPushButton[flat="true"]::menu-indicator { + position:relative; + bottom:4px; + right:4px; + } QRadioButton::indicator { width:18px; height:18px;