mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-17 11:10:31 +01:00
Add automatically search for album cover to context settings
This commit is contained in:
parent
dc80459c59
commit
e7e77ed86b
@ -264,15 +264,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
// Initialise the UI
|
// Initialise the UI
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
connect(app_->current_albumcover_loader(), SIGNAL(AlbumCoverLoaded(Song, AlbumCoverLoaderResult)), SLOT(AlbumCoverLoaded(Song, AlbumCoverLoaderResult)));
|
|
||||||
album_cover_choice_controller_->Init(app);
|
album_cover_choice_controller_->Init(app);
|
||||||
connect(album_cover_choice_controller_->cover_from_file_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromFile()));
|
|
||||||
connect(album_cover_choice_controller_->cover_to_file_action(), SIGNAL(triggered()), this, SLOT(SaveCoverToFile()));
|
|
||||||
connect(album_cover_choice_controller_->cover_from_url_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromURL()));
|
|
||||||
connect(album_cover_choice_controller_->search_for_cover_action(), SIGNAL(triggered()), this, SLOT(SearchForCover()));
|
|
||||||
connect(album_cover_choice_controller_->unset_cover_action(), SIGNAL(triggered()), this, SLOT(UnsetCover()));
|
|
||||||
connect(album_cover_choice_controller_->show_cover_action(), SIGNAL(triggered()), this, SLOT(ShowCover()));
|
|
||||||
connect(album_cover_choice_controller_->search_cover_auto_action(), SIGNAL(triggered()), this, SLOT(SearchCoverAutomatically()));
|
|
||||||
|
|
||||||
ui_->multi_loading_indicator->SetTaskManager(app_->task_manager());
|
ui_->multi_loading_indicator->SetTaskManager(app_->task_manager());
|
||||||
context_view_->Init(app_, collection_view_->view(), album_cover_choice_controller_);
|
context_view_->Init(app_, collection_view_->view(), album_cover_choice_controller_);
|
||||||
@ -429,7 +421,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
connect(ui_->action_auto_complete_tags, SIGNAL(triggered()), SLOT(AutoCompleteTags()));
|
connect(ui_->action_auto_complete_tags, SIGNAL(triggered()), SLOT(AutoCompleteTags()));
|
||||||
#endif
|
#endif
|
||||||
connect(ui_->action_settings, SIGNAL(triggered()), SLOT(OpenSettingsDialog()));
|
connect(ui_->action_settings, SIGNAL(triggered()), SLOT(OpenSettingsDialog()));
|
||||||
connect(ui_->action_toggle_show_sidebar, SIGNAL(toggled(bool)), ui_->sidebar_layout, SLOT(setVisible(bool)));
|
connect(ui_->action_toggle_show_sidebar, SIGNAL(toggled(bool)), SLOT(ToggleSidebar(bool)));
|
||||||
connect(ui_->action_about_strawberry, SIGNAL(triggered()), SLOT(ShowAboutDialog()));
|
connect(ui_->action_about_strawberry, SIGNAL(triggered()), SLOT(ShowAboutDialog()));
|
||||||
connect(ui_->action_about_qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(ui_->action_about_qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
connect(ui_->action_shuffle, SIGNAL(triggered()), app_->playlist_manager(), SLOT(ShuffleCurrent()));
|
connect(ui_->action_shuffle, SIGNAL(triggered()), app_->playlist_manager(), SLOT(ShuffleCurrent()));
|
||||||
@ -549,6 +541,16 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
connect(app_->task_manager(), SIGNAL(PauseCollectionWatchers()), app_->collection(), SLOT(PauseWatcher()));
|
connect(app_->task_manager(), SIGNAL(PauseCollectionWatchers()), app_->collection(), SLOT(PauseWatcher()));
|
||||||
connect(app_->task_manager(), SIGNAL(ResumeCollectionWatchers()), app_->collection(), SLOT(ResumeWatcher()));
|
connect(app_->task_manager(), SIGNAL(ResumeCollectionWatchers()), app_->collection(), SLOT(ResumeWatcher()));
|
||||||
|
|
||||||
|
connect(app_->current_albumcover_loader(), SIGNAL(AlbumCoverLoaded(Song, AlbumCoverLoaderResult)), SLOT(AlbumCoverLoaded(Song, AlbumCoverLoaderResult)));
|
||||||
|
connect(album_cover_choice_controller_->cover_from_file_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromFile()));
|
||||||
|
connect(album_cover_choice_controller_->cover_to_file_action(), SIGNAL(triggered()), this, SLOT(SaveCoverToFile()));
|
||||||
|
connect(album_cover_choice_controller_->cover_from_url_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromURL()));
|
||||||
|
connect(album_cover_choice_controller_->search_for_cover_action(), SIGNAL(triggered()), this, SLOT(SearchForCover()));
|
||||||
|
connect(album_cover_choice_controller_->unset_cover_action(), SIGNAL(triggered()), this, SLOT(UnsetCover()));
|
||||||
|
connect(album_cover_choice_controller_->show_cover_action(), SIGNAL(triggered()), this, SLOT(ShowCover()));
|
||||||
|
connect(album_cover_choice_controller_->search_cover_auto_action(), SIGNAL(triggered()), this, SLOT(SearchCoverAutomatically()));
|
||||||
|
connect(album_cover_choice_controller_->search_cover_auto_action(), SIGNAL(toggled(bool)), SLOT(ToggleSearchCoverAuto(bool)));
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
// Devices connections
|
// Devices connections
|
||||||
connect(device_view_->view(), SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
connect(device_view_->view(), SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
||||||
@ -804,10 +806,10 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
if (tab_mode == FancyTabWidget::Mode_None) tab_mode = default_mode;
|
if (tab_mode == FancyTabWidget::Mode_None) tab_mode = default_mode;
|
||||||
ui_->tabs->SetMode(tab_mode);
|
ui_->tabs->SetMode(tab_mode);
|
||||||
|
|
||||||
file_view_->SetPath(settings_.value("file_path", QDir::homePath()).toString());
|
|
||||||
|
|
||||||
TabSwitched();
|
TabSwitched();
|
||||||
|
|
||||||
|
file_view_->SetPath(settings_.value("file_path", QDir::homePath()).toString());
|
||||||
|
|
||||||
// Users often collapse one side of the splitter by mistake and don't know how to restore it. This must be set after the state is restored above.
|
// Users often collapse one side of the splitter by mistake and don't know how to restore it. This must be set after the state is restored above.
|
||||||
ui_->splitter->setChildrenCollapsible(false);
|
ui_->splitter->setChildrenCollapsible(false);
|
||||||
|
|
||||||
@ -822,10 +824,10 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
#ifdef Q_OS_MACOS // Always show mainwindow on startup if on macos
|
#ifdef Q_OS_MACOS // Always show mainwindow on startup if on macos
|
||||||
show();
|
show();
|
||||||
#else
|
#else
|
||||||
QSettings settings;
|
QSettings s;
|
||||||
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
||||||
StartupBehaviour behaviour = StartupBehaviour(settings.value("startupbehaviour", Startup_Remember).toInt());
|
StartupBehaviour behaviour = StartupBehaviour(s.value("startupbehaviour", Startup_Remember).toInt());
|
||||||
settings.endGroup();
|
s.endGroup();
|
||||||
bool hidden = settings_.value("hidden", false).toBool();
|
bool hidden = settings_.value("hidden", false).toBool();
|
||||||
if (hidden && (!QSystemTrayIcon::isSystemTrayAvailable() || !tray_icon_ || !tray_icon_->IsVisible())) {
|
if (hidden && (!QSystemTrayIcon::isSystemTrayAvailable() || !tray_icon_ || !tray_icon_->IsVisible())) {
|
||||||
hidden = false;
|
hidden = false;
|
||||||
@ -847,6 +849,10 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool show_sidebar = settings_.value("show_sidebar", true).toBool();
|
||||||
|
ui_->sidebar_layout->setVisible(show_sidebar);
|
||||||
|
ui_->action_toggle_show_sidebar->setChecked(show_sidebar);
|
||||||
|
|
||||||
QShortcut *close_window_shortcut = new QShortcut(this);
|
QShortcut *close_window_shortcut = new QShortcut(this);
|
||||||
close_window_shortcut->setKey(Qt::CTRL + Qt::Key_W);
|
close_window_shortcut->setKey(Qt::CTRL + Qt::Key_W);
|
||||||
connect(close_window_shortcut, SIGNAL(activated()), SLOT(SetHiddenInTray()));
|
connect(close_window_shortcut, SIGNAL(activated()), SLOT(SetHiddenInTray()));
|
||||||
@ -871,35 +877,28 @@ MainWindow::~MainWindow() {
|
|||||||
|
|
||||||
void MainWindow::ReloadSettings() {
|
void MainWindow::ReloadSettings() {
|
||||||
|
|
||||||
QSettings settings;
|
QSettings s;
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
||||||
bool showtrayicon = settings.value("showtrayicon", QSystemTrayIcon::isSystemTrayAvailable()).toBool();
|
bool showtrayicon = s.value("showtrayicon", QSystemTrayIcon::isSystemTrayAvailable()).toBool();
|
||||||
settings.endGroup();
|
s.endGroup();
|
||||||
if (tray_icon_) tray_icon_->SetVisible(showtrayicon);
|
if (tray_icon_) tray_icon_->SetVisible(showtrayicon);
|
||||||
if ((!showtrayicon || !QSystemTrayIcon::isSystemTrayAvailable()) && !isVisible()) show();
|
if ((!showtrayicon || !QSystemTrayIcon::isSystemTrayAvailable()) && !isVisible()) show();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
||||||
playing_widget_ = settings.value("playing_widget", true).toBool();
|
playing_widget_ = s.value("playing_widget", true).toBool();
|
||||||
if (playing_widget_ != ui_->widget_playing->IsEnabled()) TabSwitched();
|
if (playing_widget_ != ui_->widget_playing->IsEnabled()) TabSwitched();
|
||||||
doubleclick_addmode_ = BehaviourSettingsPage::AddBehaviour(settings.value("doubleclick_addmode", BehaviourSettingsPage::AddBehaviour_Append).toInt());
|
doubleclick_addmode_ = BehaviourSettingsPage::AddBehaviour(s.value("doubleclick_addmode", BehaviourSettingsPage::AddBehaviour_Append).toInt());
|
||||||
doubleclick_playmode_ = BehaviourSettingsPage::PlayBehaviour(settings.value("doubleclick_playmode", BehaviourSettingsPage::PlayBehaviour_IfStopped).toInt());
|
doubleclick_playmode_ = BehaviourSettingsPage::PlayBehaviour(s.value("doubleclick_playmode", BehaviourSettingsPage::PlayBehaviour_IfStopped).toInt());
|
||||||
doubleclick_playlist_addmode_ = BehaviourSettingsPage::PlaylistAddBehaviour(settings.value("doubleclick_playlist_addmode", BehaviourSettingsPage::PlaylistAddBehaviour_Play).toInt());
|
doubleclick_playlist_addmode_ = BehaviourSettingsPage::PlaylistAddBehaviour(s.value("doubleclick_playlist_addmode", BehaviourSettingsPage::PlaylistAddBehaviour_Play).toInt());
|
||||||
menu_playmode_ = BehaviourSettingsPage::PlayBehaviour(settings.value("menu_playmode", BehaviourSettingsPage::PlayBehaviour_IfStopped).toInt());
|
menu_playmode_ = BehaviourSettingsPage::PlayBehaviour(s.value("menu_playmode", BehaviourSettingsPage::PlayBehaviour_IfStopped).toInt());
|
||||||
settings.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(kSettingsGroup);
|
s.beginGroup(BackendSettingsPage::kSettingsGroup);
|
||||||
bool show_sidebar = settings_.value("show_sidebar", true).toBool();
|
bool volume_control = s.value("volume_control", true).toBool();
|
||||||
ui_->sidebar_layout->setVisible(show_sidebar);
|
s.endGroup();
|
||||||
ui_->action_toggle_show_sidebar->setChecked(show_sidebar);
|
|
||||||
album_cover_choice_controller_->search_cover_auto_action()->setChecked(settings.value("search_for_cover_auto", true).toBool());
|
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
settings.beginGroup(BackendSettingsPage::kSettingsGroup);
|
|
||||||
bool volume_control = settings.value("volume_control", true).toBool();
|
|
||||||
settings.endGroup();
|
|
||||||
if (volume_control != ui_->volume->isEnabled()) {
|
if (volume_control != ui_->volume->isEnabled()) {
|
||||||
ui_->volume->SetEnabled(volume_control);
|
ui_->volume->SetEnabled(volume_control);
|
||||||
if (volume_control) {
|
if (volume_control) {
|
||||||
@ -912,10 +911,12 @@ void MainWindow::ReloadSettings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
album_cover_choice_controller_->search_cover_auto_action()->setChecked(settings_.value("search_for_cover_auto", true).toBool());
|
||||||
|
|
||||||
#ifdef HAVE_SUBSONIC
|
#ifdef HAVE_SUBSONIC
|
||||||
settings.beginGroup(SubsonicSettingsPage::kSettingsGroup);
|
s.beginGroup(SubsonicSettingsPage::kSettingsGroup);
|
||||||
bool enable_subsonic = settings.value("enabled", false).toBool();
|
bool enable_subsonic = s.value("enabled", false).toBool();
|
||||||
settings.endGroup();
|
s.endGroup();
|
||||||
if (enable_subsonic)
|
if (enable_subsonic)
|
||||||
ui_->tabs->EnableTab(subsonic_view_);
|
ui_->tabs->EnableTab(subsonic_view_);
|
||||||
else
|
else
|
||||||
@ -923,9 +924,9 @@ void MainWindow::ReloadSettings() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TIDAL
|
#ifdef HAVE_TIDAL
|
||||||
settings.beginGroup(TidalSettingsPage::kSettingsGroup);
|
s.beginGroup(TidalSettingsPage::kSettingsGroup);
|
||||||
bool enable_tidal = settings.value("enabled", false).toBool();
|
bool enable_tidal = s.value("enabled", false).toBool();
|
||||||
settings.endGroup();
|
s.endGroup();
|
||||||
if (enable_tidal)
|
if (enable_tidal)
|
||||||
ui_->tabs->EnableTab(tidal_view_);
|
ui_->tabs->EnableTab(tidal_view_);
|
||||||
else
|
else
|
||||||
@ -977,11 +978,8 @@ void MainWindow::SaveSettings() {
|
|||||||
ui_->playlist->view()->SaveSettings();
|
ui_->playlist->view()->SaveSettings();
|
||||||
app_->scrobbler()->WriteCache();
|
app_->scrobbler()->WriteCache();
|
||||||
|
|
||||||
QSettings s;
|
settings_.setValue("show_sidebar", ui_->action_toggle_show_sidebar->isChecked());
|
||||||
s.beginGroup(kSettingsGroup);
|
settings_.setValue("search_for_cover_auto", album_cover_choice_controller_->search_cover_auto_action()->isChecked());
|
||||||
s.setValue("show_sidebar", ui_->action_toggle_show_sidebar->isChecked());
|
|
||||||
s.setValue("search_for_cover_auto", album_cover_choice_controller_->search_cover_auto_action()->isChecked());
|
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,7 +1162,7 @@ void MainWindow::TrackSkipped(PlaylistItemPtr item) {
|
|||||||
|
|
||||||
void MainWindow::TabSwitched() {
|
void MainWindow::TabSwitched() {
|
||||||
|
|
||||||
if (playing_widget_ && (ui_->tabs->tabBar()->tabData(ui_->tabs->currentIndex()).toString().toLower() != "context" || !context_view_->album_enabled())) {
|
if (playing_widget_ && ui_->sidebar_layout->isVisible() && (ui_->tabs->tabBar()->tabData(ui_->tabs->currentIndex()).toString().toLower() != "context" || !context_view_->album_enabled())) {
|
||||||
ui_->widget_playing->SetEnabled();
|
ui_->widget_playing->SetEnabled();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1173,6 +1171,18 @@ void MainWindow::TabSwitched() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ToggleSidebar(const bool checked) {
|
||||||
|
|
||||||
|
ui_->sidebar_layout->setVisible(checked);
|
||||||
|
TabSwitched();
|
||||||
|
settings_.setValue("show_sidebar", checked);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ToggleSearchCoverAuto(const bool checked) {
|
||||||
|
settings_.setValue("search_for_cover_auto", checked);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::SaveGeometry() {
|
void MainWindow::SaveGeometry() {
|
||||||
|
|
||||||
if (!initialised_) return;
|
if (!initialised_) return;
|
||||||
@ -1896,7 +1906,7 @@ void MainWindow::EditValue() {
|
|||||||
void MainWindow::AddFile() {
|
void MainWindow::AddFile() {
|
||||||
|
|
||||||
// Last used directory
|
// Last used directory
|
||||||
QString directory =settings_.value("add_media_path", QDir::currentPath()).toString();
|
QString directory = settings_.value("add_media_path", QDir::currentPath()).toString();
|
||||||
|
|
||||||
PlaylistParser parser(app_->collection_backend());
|
PlaylistParser parser(app_->collection_backend());
|
||||||
|
|
||||||
@ -1923,7 +1933,7 @@ void MainWindow::AddFile() {
|
|||||||
void MainWindow::AddFolder() {
|
void MainWindow::AddFolder() {
|
||||||
|
|
||||||
// Last used directory
|
// Last used directory
|
||||||
QString directory =settings_.value("add_folder_path", QDir::currentPath()).toString();
|
QString directory = settings_.value("add_folder_path", QDir::currentPath()).toString();
|
||||||
|
|
||||||
// Show dialog
|
// Show dialog
|
||||||
directory = QFileDialog::getExistingDirectory(this, tr("Add folder"), directory);
|
directory = QFileDialog::getExistingDirectory(this, tr("Add folder"), directory);
|
||||||
|
@ -232,6 +232,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
|
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
|
||||||
|
|
||||||
void TabSwitched();
|
void TabSwitched();
|
||||||
|
void ToggleSidebar(const bool checked);
|
||||||
|
void ToggleSearchCoverAuto(const bool checked);
|
||||||
void SaveGeometry();
|
void SaveGeometry();
|
||||||
void SavePlaybackStatus();
|
void SavePlaybackStatus();
|
||||||
void LoadPlaybackStatus();
|
void LoadPlaybackStatus();
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
|
#include "core/mainwindow.h"
|
||||||
#include "settingspage.h"
|
#include "settingspage.h"
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include "contextsettingspage.h"
|
#include "contextsettingspage.h"
|
||||||
@ -46,20 +47,14 @@
|
|||||||
const char *ContextSettingsPage::kSettingsGroup = "Context";
|
const char *ContextSettingsPage::kSettingsGroup = "Context";
|
||||||
const char *ContextSettingsPage::kSettingsTitleFmt = "TitleFmt";
|
const char *ContextSettingsPage::kSettingsTitleFmt = "TitleFmt";
|
||||||
const char *ContextSettingsPage::kSettingsSummaryFmt = "SummaryFmt";
|
const char *ContextSettingsPage::kSettingsSummaryFmt = "SummaryFmt";
|
||||||
const char *ContextSettingsPage::kSettingsGroupLabels[ContextSettingsOrder::NELEMS] = {
|
|
||||||
"Technical Data",
|
|
||||||
"Engine and Device",
|
|
||||||
"Albums by Artist",
|
|
||||||
"Song Lyrics",
|
|
||||||
"Album",
|
|
||||||
"Automatically search for song lyrics",
|
|
||||||
};
|
|
||||||
const char *ContextSettingsPage::kSettingsGroupEnable[ContextSettingsOrder::NELEMS] = {
|
const char *ContextSettingsPage::kSettingsGroupEnable[ContextSettingsOrder::NELEMS] = {
|
||||||
"TechnicalDataEnable",
|
"AlbumEnable",
|
||||||
"EngineAndDeviceEnable",
|
"EngineAndDeviceEnable",
|
||||||
|
"TechnicalDataEnable",
|
||||||
"AlbumsByArtistEnable",
|
"AlbumsByArtistEnable",
|
||||||
"SongLyricsEnable",
|
"SongLyricsEnable",
|
||||||
"AlbumEnable",
|
"SearchCoverEnable",
|
||||||
"SearchLyricsEnable",
|
"SearchLyricsEnable",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,12 +65,13 @@ ContextSettingsPage::ContextSettingsPage(SettingsDialog* dialog) : SettingsPage(
|
|||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
setWindowIcon(IconLoader::Load("view-choose"));
|
setWindowIcon(IconLoader::Load("view-choose"));
|
||||||
|
|
||||||
checkboxes[ContextSettingsOrder::ALBUM] = ui_->checkbox_album;
|
checkboxes_[ContextSettingsOrder::ALBUM] = ui_->checkbox_album;
|
||||||
checkboxes[ContextSettingsOrder::TECHNICAL_DATA] = ui_->checkbox_technical_data;
|
checkboxes_[ContextSettingsOrder::ENGINE_AND_DEVICE] = ui_->checkbox_engine_device;
|
||||||
checkboxes[ContextSettingsOrder::ENGINE_AND_DEVICE] = ui_->checkbox_engine_device;
|
checkboxes_[ContextSettingsOrder::TECHNICAL_DATA] = ui_->checkbox_technical_data;
|
||||||
checkboxes[ContextSettingsOrder::ALBUMS_BY_ARTIST] = ui_->checkbox_albums;
|
checkboxes_[ContextSettingsOrder::ALBUMS_BY_ARTIST] = ui_->checkbox_albums;
|
||||||
checkboxes[ContextSettingsOrder::SONG_LYRICS] = ui_->checkbox_song_lyrics;
|
checkboxes_[ContextSettingsOrder::SONG_LYRICS] = ui_->checkbox_song_lyrics;
|
||||||
checkboxes[ContextSettingsOrder::SEARCH_LYRICS] = ui_->checkbox_search_lyrics;
|
checkboxes_[ContextSettingsOrder::SEARCH_COVER] = ui_->checkbox_search_cover;
|
||||||
|
checkboxes_[ContextSettingsOrder::SEARCH_LYRICS] = ui_->checkbox_search_lyrics;
|
||||||
|
|
||||||
// Create and populate the helper menus
|
// Create and populate the helper menus
|
||||||
QMenu *menu = new QMenu(this);
|
QMenu *menu = new QMenu(this);
|
||||||
@ -133,8 +129,9 @@ void ContextSettingsPage::Load() {
|
|||||||
s.beginGroup(ContextSettingsPage::kSettingsGroup);
|
s.beginGroup(ContextSettingsPage::kSettingsGroup);
|
||||||
ui_->context_custom_text1->setText(s.value(kSettingsTitleFmt, "%title% - %artist%").toString());
|
ui_->context_custom_text1->setText(s.value(kSettingsTitleFmt, "%title% - %artist%").toString());
|
||||||
ui_->context_custom_text2->setText(s.value(kSettingsSummaryFmt, "%album%").toString());
|
ui_->context_custom_text2->setText(s.value(kSettingsSummaryFmt, "%album%").toString());
|
||||||
|
|
||||||
for (int i = 0 ; i < ContextSettingsOrder::NELEMS ; ++i) {
|
for (int i = 0 ; i < ContextSettingsOrder::NELEMS ; ++i) {
|
||||||
checkboxes[i]->setChecked(s.value(kSettingsGroupEnable[i], i != ContextSettingsOrder::ALBUMS_BY_ARTIST).toBool());
|
checkboxes_[i]->setChecked(s.value(kSettingsGroupEnable[i], i != ContextSettingsOrder::ALBUMS_BY_ARTIST).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fonts
|
// Fonts
|
||||||
@ -153,6 +150,10 @@ void ContextSettingsPage::Load() {
|
|||||||
|
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
|
s.beginGroup(MainWindow::kSettingsGroup);
|
||||||
|
ui_->checkbox_search_cover->setChecked(s.value("search_for_cover_auto", true).toBool());
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextSettingsPage::Save() {
|
void ContextSettingsPage::Save() {
|
||||||
@ -163,7 +164,7 @@ void ContextSettingsPage::Save() {
|
|||||||
s.setValue(kSettingsTitleFmt, ui_->context_custom_text1->text());
|
s.setValue(kSettingsTitleFmt, ui_->context_custom_text1->text());
|
||||||
s.setValue(kSettingsSummaryFmt, ui_->context_custom_text2->text());
|
s.setValue(kSettingsSummaryFmt, ui_->context_custom_text2->text());
|
||||||
for (int i = 0; i < ContextSettingsOrder::NELEMS; ++i) {
|
for (int i = 0; i < ContextSettingsOrder::NELEMS; ++i) {
|
||||||
s.setValue(kSettingsGroupEnable[i], checkboxes[i]->isChecked());
|
s.setValue(kSettingsGroupEnable[i], checkboxes_[i]->isChecked());
|
||||||
}
|
}
|
||||||
s.setValue("font_headline", ui_->font_headline->currentFont().family());
|
s.setValue("font_headline", ui_->font_headline->currentFont().family());
|
||||||
s.setValue("font_normal", ui_->font_normal->currentFont().family());
|
s.setValue("font_normal", ui_->font_normal->currentFont().family());
|
||||||
@ -171,6 +172,10 @@ void ContextSettingsPage::Save() {
|
|||||||
s.setValue("font_size_normal", ui_->font_size_normal->value());
|
s.setValue("font_size_normal", ui_->font_size_normal->value());
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
|
s.beginGroup(MainWindow::kSettingsGroup);
|
||||||
|
s.setValue("search_for_cover_auto", ui_->checkbox_search_cover->isChecked());
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextSettingsPage::InsertVariableFirstLine(QAction* action) {
|
void ContextSettingsPage::InsertVariableFirstLine(QAction* action) {
|
||||||
|
@ -43,11 +43,12 @@ public:
|
|||||||
~ContextSettingsPage();
|
~ContextSettingsPage();
|
||||||
|
|
||||||
enum ContextSettingsOrder {
|
enum ContextSettingsOrder {
|
||||||
TECHNICAL_DATA,
|
ALBUM,
|
||||||
ENGINE_AND_DEVICE,
|
ENGINE_AND_DEVICE,
|
||||||
|
TECHNICAL_DATA,
|
||||||
ALBUMS_BY_ARTIST,
|
ALBUMS_BY_ARTIST,
|
||||||
SONG_LYRICS,
|
SONG_LYRICS,
|
||||||
ALBUM,
|
SEARCH_COVER,
|
||||||
SEARCH_LYRICS,
|
SEARCH_LYRICS,
|
||||||
NELEMS
|
NELEMS
|
||||||
};
|
};
|
||||||
@ -55,7 +56,6 @@ public:
|
|||||||
static const char *kSettingsGroup;
|
static const char *kSettingsGroup;
|
||||||
static const char *kSettingsTitleFmt;
|
static const char *kSettingsTitleFmt;
|
||||||
static const char *kSettingsSummaryFmt;
|
static const char *kSettingsSummaryFmt;
|
||||||
static const char *kSettingsGroupLabels[ContextSettingsOrder::NELEMS];
|
|
||||||
static const char *kSettingsGroupEnable[ContextSettingsOrder::NELEMS];
|
static const char *kSettingsGroupEnable[ContextSettingsOrder::NELEMS];
|
||||||
static const qreal kDefaultFontSizeHeadline;
|
static const qreal kDefaultFontSizeHeadline;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_ContextSettingsPage *ui_;
|
Ui_ContextSettingsPage *ui_;
|
||||||
QCheckBox *checkboxes[ContextSettingsOrder::NELEMS];
|
QCheckBox *checkboxes_[ContextSettingsOrder::NELEMS];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTEXTSETTINGSPAGE_H
|
#endif // CONTEXTSETTINGSPAGE_H
|
||||||
|
@ -196,6 +196,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkbox_search_cover">
|
||||||
|
<property name="text">
|
||||||
|
<string>Automatically search for album cover</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkbox_search_lyrics">
|
<widget class="QCheckBox" name="checkbox_search_lyrics">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Loading…
Reference in New Issue
Block a user