1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 12:02:48 +01:00

Added UI and QSettings support for playlist metadata and path types.

This commit is contained in:
Gavin Howard 2014-08-12 20:48:18 -06:00
parent ba3998e79b
commit 5b7819f14d
3 changed files with 90 additions and 1 deletions

View File

@ -134,6 +134,12 @@ class Playlist : public QAbstractListModel {
LastFM_Queued, // Track added to the queue for scrobbling LastFM_Queued, // Track added to the queue for scrobbling
}; };
enum Path {
Path_Automatic = 0, // Automatically select path type
Path_Absolute, // Always use absolute paths
Path_Relative, // Always use relative paths
};
static const char* kCddaMimeType; static const char* kCddaMimeType;
static const char* kRowsMimetype; static const char* kRowsMimetype;
static const char* kPlayNowMimetype; static const char* kPlayNowMimetype;

View File

@ -133,6 +133,20 @@ void BehaviourSettingsPage::Load() {
s.value("greyoutdeleted", false).toBool()); s.value("greyoutdeleted", false).toBool());
ui_->b_click_edit_inline_->setChecked( ui_->b_click_edit_inline_->setChecked(
s.value("click_edit_inline", true).toBool()); s.value("click_edit_inline", true).toBool());
Playlist::Path path = Playlist::Path(s.value("pathtype", Playlist::Path_Automatic).toInt());
switch(path) {
case Playlist::Path_Automatic:
ui_->b_automatic_path->setChecked(true);
break;
case Playlist::Path_Absolute:
ui_->b_absolute_path->setChecked(true);
break;
case Playlist::Path_Relative:
ui_->b_relative_path->setChecked(true);
break;
}
ui_->b_write_metadata->setChecked(s.value("writemetadata", true).toBool());
s.endGroup(); s.endGroup();
s.beginGroup(PlaylistTabBar::kSettingsGroup); s.beginGroup(PlaylistTabBar::kSettingsGroup);
@ -162,6 +176,14 @@ void BehaviourSettingsPage::Save() {
MainWindow::PlayBehaviour menu_playmode = MainWindow::PlayBehaviour( MainWindow::PlayBehaviour menu_playmode = MainWindow::PlayBehaviour(
ui_->menu_playmode->itemData(ui_->menu_playmode->currentIndex()).toInt()); ui_->menu_playmode->itemData(ui_->menu_playmode->currentIndex()).toInt());
Playlist::Path path = Playlist::Path_Automatic;
if (ui_->b_automatic_path->isChecked())
path = Playlist::Path_Automatic;
if (ui_->b_absolute_path->isChecked())
path = Playlist::Path_Absolute;
if (ui_->b_relative_path->isChecked())
path = Playlist::Path_Relative;
s.beginGroup(MainWindow::kSettingsGroup); s.beginGroup(MainWindow::kSettingsGroup);
s.setValue("showtray", ui_->b_show_tray_icon_->isChecked()); s.setValue("showtray", ui_->b_show_tray_icon_->isChecked());
s.setValue("keeprunning", ui_->b_keep_running_->isChecked()); s.setValue("keeprunning", ui_->b_keep_running_->isChecked());
@ -182,6 +204,8 @@ void BehaviourSettingsPage::Save() {
s.beginGroup(Playlist::kSettingsGroup); s.beginGroup(Playlist::kSettingsGroup);
s.setValue("greyoutdeleted", ui_->b_grey_out_deleted_->isChecked()); s.setValue("greyoutdeleted", ui_->b_grey_out_deleted_->isChecked());
s.setValue("click_edit_inline", ui_->b_click_edit_inline_->isChecked()); s.setValue("click_edit_inline", ui_->b_click_edit_inline_->isChecked());
s.setValue("pathtype", int(path));
s.setValue("writemetadata", ui_->b_write_metadata->isChecked());
s.endGroup(); s.endGroup();
s.beginGroup(PlaylistTabBar::kSettingsGroup); s.beginGroup(PlaylistTabBar::kSettingsGroup);

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>516</width> <width>516</width>
<height>561</height> <height>728</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -235,6 +235,65 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_9">
<property name="title">
<string>Playlist file paths should be</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="b_automatic_path">
<property name="text">
<string>Automatic</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="b_absolute_path">
<property name="text">
<string>Absolute</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="b_relative_path">
<property name="text">
<string>Relative</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="b_write_metadata">
<property name="text">
<string>Write Metadata</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">