settings: Create a new Song Metadata settings page

Move tagreader process settings to the new page.
This commit is contained in:
Jim Broadus 2021-05-15 22:06:49 -07:00 committed by John Maguire
parent 01be9f196a
commit cf88e47206
9 changed files with 194 additions and 65 deletions

View File

@ -368,6 +368,7 @@ set(SOURCES
ui/settingsdialog.cpp
ui/settingspage.cpp
ui/splash.cpp
ui/songmetadatasettingspage.cpp
ui/standarditemiconloader.cpp
ui/streamdetailsdialog.cpp
ui/systemtrayicon.cpp
@ -664,6 +665,7 @@ set(HEADERS
ui/settingscategory.h
ui/settingsdialog.h
ui/settingspage.h
ui/songmetadatasettingspage.h
ui/standarditemiconloader.h
ui/streamdetailsdialog.h
ui/systemtrayicon.h
@ -796,6 +798,7 @@ set(UI
ui/organiseerrordialog.ui
ui/playbacksettingspage.ui
ui/settingsdialog.ui
ui/songmetadatasettingspage.ui
ui/streamdetailsdialog.ui
ui/trackselectiondialog.ui

View File

@ -40,15 +40,6 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
connect(ui_->b_show_tray_icon_, SIGNAL(toggled(bool)),
SLOT(ShowTrayIconToggled(bool)));
connect(ui_->max_numprocs_tagclients, SIGNAL(valueChanged(int)),
SLOT(MaxNumProcsTagClientsChanged(int)));
ui_->max_numprocs_tagclients_value_label->setMinimumWidth(
QFontMetrics(ui_->max_numprocs_tagclients_value_label->font())
.width("WWW"));
// Limit max tag clients to number of CPU cores.
ui_->max_numprocs_tagclients->setMaximum(QThread::idealThreadCount());
ui_->doubleclick_addmode->setItemData(0, MainWindow::AddBehaviour_Append);
ui_->doubleclick_addmode->setItemData(1, MainWindow::AddBehaviour_Load);
ui_->doubleclick_addmode->setItemData(2, MainWindow::AddBehaviour_OpenInNew);
@ -181,12 +172,6 @@ void BehaviourSettingsPage::Load() {
.toInt()));
ui_->seek_step_sec->setValue(s.value("seek_step_sec", 10).toInt());
int max_numprocs_tagclients =
s.value("max_numprocs_tagclients", QThread::idealThreadCount()).toInt();
ui_->max_numprocs_tagclients->setValue(max_numprocs_tagclients);
ui_->max_numprocs_tagclients_value_label->setText(
QString::number(max_numprocs_tagclients));
if (s.value("play_count_short_duration", false).toBool()) {
ui_->b_play_count_short_duration->setChecked(true);
ui_->b_play_count_normal_duration->setChecked(false);
@ -298,7 +283,6 @@ void BehaviourSettingsPage::Save() {
s.setValue("stop_play_if_fail", ui_->stop_play_if_fail_->isChecked());
s.setValue("menu_previousmode", menu_previousmode);
s.setValue("seek_step_sec", ui_->seek_step_sec->value());
s.setValue("max_numprocs_tagclients", ui_->max_numprocs_tagclients->value());
if (ui_->b_play_count_short_duration->isChecked()) {
s.setValue("play_count_short_duration", true);
@ -337,7 +321,3 @@ void BehaviourSettingsPage::ShowTrayIconToggled(bool on) {
ui_->b_keep_running_->setChecked(on);
ui_->b_scroll_tray_icon_->setEnabled(on);
}
void BehaviourSettingsPage::MaxNumProcsTagClientsChanged(int value) {
ui_->max_numprocs_tagclients_value_label->setText(QString::number(value));
}

View File

@ -36,7 +36,6 @@ class BehaviourSettingsPage : public SettingsPage {
private slots:
void ShowTrayIconToggled(bool on);
void MaxNumProcsTagClientsChanged(int value);
private:
Ui_BehaviourSettingsPage* ui_;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>1081</height>
<width>602</width>
<height>1395</height>
</rect>
</property>
<property name="windowTitle">
@ -339,48 +339,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_max_tagclients">
<property name="title">
<string>Maximum number of child processes for tag handling (requires restart)</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="numprocs_tagclients_label">
<property name="text">
<string>Number of processes:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="max_numprocs_tagclients_value_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="max_numprocs_tagclients">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="value">
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_9">
<property name="title">

View File

@ -41,6 +41,7 @@
#include "playlist/playlistview.h"
#include "settingscategory.h"
#include "songinfo/songinfosettingspage.h"
#include "songmetadatasettingspage.h"
#include "transcoder/transcodersettingspage.h"
#include "ui_settingsdialog.h"
#include "widgets/groupediconview.h"
@ -108,6 +109,7 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams,
general->AddPage(Page_Playback, new PlaybackSettingsPage(this));
general->AddPage(Page_Behaviour, new BehaviourSettingsPage(this));
general->AddPage(Page_Library, new LibrarySettingsPage(this));
general->AddPage(Page_SongMetadata, new SongMetadataSettingsPage(this));
general->AddPage(Page_BackgroundStreams,
new BackgroundStreamsSettingsPage(this));
general->AddPage(Page_Proxy, new NetworkProxySettingsPage(this));

View File

@ -64,6 +64,7 @@ class SettingsDialog : public QDialog {
Page_Playback,
Page_Behaviour,
Page_Library,
Page_SongMetadata,
Page_BackgroundStreams,
Page_Proxy,
Page_Transcoding,

View File

@ -0,0 +1,68 @@
/* This file is part of Clementine.
Copyright 2021, Jim Broadus <jbroadus@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "songmetadatasettingspage.h"
#include <QSettings>
#include <QThread>
#include "core/player.h"
#include "ui/iconloader.h"
#include "ui_songmetadatasettingspage.h"
SongMetadataSettingsPage::SongMetadataSettingsPage(SettingsDialog* dialog)
: SettingsPage(dialog), ui_(new Ui_SongMetadataSettingsPage) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("view-media-lyrics", IconLoader::Base));
connect(ui_->max_numprocs_tagclients, SIGNAL(valueChanged(int)),
SLOT(MaxNumProcsTagClientsChanged(int)));
ui_->max_numprocs_tagclients_value_label->setMinimumWidth(
QFontMetrics(ui_->max_numprocs_tagclients_value_label->font())
.width("WWW"));
// Limit max tag clients to number of CPU cores.
ui_->max_numprocs_tagclients->setMaximum(QThread::idealThreadCount());
}
SongMetadataSettingsPage::~SongMetadataSettingsPage() { delete ui_; }
void SongMetadataSettingsPage::Load() {
QSettings s;
s.beginGroup(Player::kSettingsGroup);
int max_numprocs_tagclients =
s.value("max_numprocs_tagclients", QThread::idealThreadCount()).toInt();
ui_->max_numprocs_tagclients->setValue(max_numprocs_tagclients);
ui_->max_numprocs_tagclients_value_label->setText(
QString::number(max_numprocs_tagclients));
s.endGroup();
}
void SongMetadataSettingsPage::Save() {
QSettings s;
s.beginGroup(Player::kSettingsGroup);
s.setValue("max_numprocs_tagclients", ui_->max_numprocs_tagclients->value());
s.endGroup();
}
void SongMetadataSettingsPage::MaxNumProcsTagClientsChanged(int value) {
ui_->max_numprocs_tagclients_value_label->setText(QString::number(value));
}

View File

@ -0,0 +1,42 @@
/* This file is part of Clementine.
Copyright 2021, Jim Broadus <jbroadus@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SONGMETADATASETTINGSPAGE_H
#define SONGMETADATASETTINGSPAGE_H
#include "settingspage.h"
class Ui_SongMetadataSettingsPage;
class SongMetadataSettingsPage : public SettingsPage {
Q_OBJECT
public:
SongMetadataSettingsPage(SettingsDialog* dialog);
~SongMetadataSettingsPage();
void Load();
void Save();
private slots:
void MaxNumProcsTagClientsChanged(int value);
private:
Ui_SongMetadataSettingsPage* ui_;
};
#endif // SONGMETADATASETTINGSPAGE_H

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SongMetadataSettingsPage</class>
<widget class="QWidget" name="SongMetadataSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>602</width>
<height>1395</height>
</rect>
</property>
<property name="windowTitle">
<string>Song Metadata</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_max_tagclients">
<property name="title">
<string>Maximum number of child processes for tag handling (requires restart)</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="numprocs_tagclients_label">
<property name="text">
<string>Number of processes:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="max_numprocs_tagclients_value_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="max_numprocs_tagclients">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="value">
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>