Merge pull request #10277 from Tatsuya79/master

qt: expose dropped thumbnail size limit
This commit is contained in:
Autechre 2020-03-14 02:40:01 +01:00 committed by GitHub
commit 5dc3f40451
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 2 deletions

View File

@ -9048,6 +9048,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT,
"Thumbnail cache limit:"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_DROP_SIZE_LIMIT,
"Drag-n-drop Thumbnail size limit:"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS,
"Download All Thumbnails"

View File

@ -2471,6 +2471,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST,
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE,
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT,
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_DROP_SIZE_LIMIT,
MENU_ENUM_LABEL_VALUE_QT_MENU_TOOLS,
MENU_ENUM_LABEL_VALUE_QT_MENU_HELP,
MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER,

View File

@ -1316,9 +1316,9 @@ QString MainWindow::changeThumbnail(const QImage &image, QString type)
if (m_settings->contains("thumbnail_max_size"))
{
int size = m_settings->value("thumbnail_max_size", 512).toInt();
int size = m_settings->value("thumbnail_max_size", 0).toInt();
if (size != 0)
if (size != 0 && (image.height() > size || image.width() > size))
scaledImage = image.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}

View File

@ -302,6 +302,7 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) :
,m_showHiddenFilesCheckBox(new QCheckBox(this))
,m_themeComboBox(new QComboBox(this))
,m_thumbnailCacheSpinBox(new QSpinBox(this))
,m_thumbnailDropSizeSpinBox(new QSpinBox(this))
,m_startupPlaylistComboBox(new QComboBox(this))
,m_highlightColorPushButton(new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CHOOSE), this))
,m_highlightColor()
@ -320,6 +321,9 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) :
m_thumbnailCacheSpinBox->setSuffix(" MB");
m_thumbnailCacheSpinBox->setRange(0, 99999);
m_thumbnailDropSizeSpinBox->setSuffix(" px");
m_thumbnailDropSizeSpinBox->setRange(0, 99999);
/* m_allPlaylistsListMaxCountSpinBox->setRange(0, 99999); */
/* m_allPlaylistsGridMaxCountSpinBox->setRange(0, 99999); */
@ -336,6 +340,7 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) :
/* 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_CACHE_LIMIT), m_thumbnailCacheSpinBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_DROP_SIZE_LIMIT), m_thumbnailDropSizeSpinBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME), m_themeComboBox);
form->addRow(m_highlightColorLabel, m_highlightColorPushButton);
@ -420,6 +425,7 @@ void ViewOptionsWidget::loadViewOptions()
/* m_allPlaylistsListMaxCountSpinBox->setValue(m_settings->value("all_playlists_list_max_count", 0).toInt()); */
/* m_allPlaylistsGridMaxCountSpinBox->setValue(m_settings->value("all_playlists_grid_max_count", 5000).toInt()); */
m_thumbnailCacheSpinBox->setValue(m_settings->value("thumbnail_cache_limit", 512).toInt());
m_thumbnailDropSizeSpinBox->setValue(m_settings->value("thumbnail_max_size", 0).toInt());
themeIndex = m_themeComboBox->findData(m_mainwindow->getThemeFromString(m_settings->value("theme", "default").toString()));
@ -477,6 +483,7 @@ void ViewOptionsWidget::saveViewOptions()
/* 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("thumbnail_cache_limit", m_thumbnailCacheSpinBox->value());
m_settings->setValue("thumbnail_max_size", m_thumbnailDropSizeSpinBox->value());
if (!m_mainwindow->customThemeString().isEmpty())
m_settings->setValue("custom_theme", m_customThemePath);

View File

@ -43,6 +43,7 @@ private:
QCheckBox *m_showHiddenFilesCheckBox;
QComboBox *m_themeComboBox;
QSpinBox *m_thumbnailCacheSpinBox;
QSpinBox *m_thumbnailDropSizeSpinBox;
QComboBox *m_startupPlaylistComboBox;
QPushButton *m_highlightColorPushButton;
QColor m_highlightColor;