Move thumbnail type selection to grid footer.

This commit is contained in:
Tatsuya79 2019-04-01 21:31:46 +02:00
parent 3fda353fbc
commit 61fa0a0807
6 changed files with 39 additions and 24 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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<QVBoxLayout*>(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);
}

View File

@ -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<ThumbnailType>(m_thumbnailComboBox->currentData().value<int>());
m_mainwindow->setCurrentThumbnailType(type);
}
void ViewOptionsWidget::onThemeComboBoxIndexChanged(int)
{
MainWindow::Theme theme = static_cast<MainWindow::Theme>(m_themeComboBox->currentData(Qt::UserRole).toInt());
@ -342,7 +329,6 @@ void ViewOptionsWidget::loadViewOptions()
QVector<QPair<QString, QString> > 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())

View File

@ -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;

View File

@ -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);