Add a quick change menu to the playlist container.

This commit is contained in:
Gavin Howard 2014-08-15 15:37:31 -06:00
parent c026b599b4
commit 1cddc696ae
6 changed files with 73 additions and 10 deletions

View File

@ -48,7 +48,8 @@ PlaylistContainer::PlaylistContainer(QWidget* parent)
tab_bar_visible_(false),
tab_bar_animation_(new QTimeLine(500, this)),
no_matches_label_(nullptr),
filter_timer_(new QTimer(this)) {
filter_timer_(new QTimer(this)),
path_(Playlist::Path_Automatic) {
ui_->setupUi(this);
no_matches_label_ = new QLabel(ui_->playlist);

View File

@ -21,6 +21,8 @@
#include <QWidget>
#include <QSettings>
#include "playlist.h"
class Ui_PlaylistContainer;
class LineEditInterface;
@ -114,6 +116,8 @@ signals:
QLabel* no_matches_label_;
QTimer* filter_timer_;
Playlist::Path path_;
};
#endif // PLAYLISTCONTAINER_H

View File

@ -24,7 +24,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -36,7 +45,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -104,6 +122,36 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="file_path_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>File Paths:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="file_path_box">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">

View File

@ -50,8 +50,6 @@ PlaylistManager::PlaylistManager(Application* app, QObject* parent)
connect(app_->player(), SIGNAL(Paused()), SLOT(SetActivePaused()));
connect(app_->player(), SIGNAL(Playing()), SLOT(SetActivePlaying()));
connect(app_->player(), SIGNAL(Stopped()), SLOT(SetActiveStopped()));
settings_.beginGroup(Playlist::kSettingsGroup);
}
PlaylistManager::~PlaylistManager() {
@ -198,7 +196,10 @@ void PlaylistManager::ItemsLoadedForSavePlaylist(QFutureWatcher<Song>* watcher,
}
void PlaylistManager::SaveWithUI(int id, const QString& suggested_filename) {
QString filename = settings_.value("last_save_playlist").toString();
QSettings settings;
settings.beginGroup(Playlist::kSettingsGroup);
QString filename = settings.value("last_save_playlist").toString();
settings.endGroup();
// We want to use the playlist tab name as a default filename, but in the
// same directory as the last saved file.
@ -223,9 +224,13 @@ void PlaylistManager::SaveWithUI(int id, const QString& suggested_filename) {
nullptr, tr("Save playlist", "Title of the playlist save dialog."),
filename, parser()->filters(), &default_filter);
if (filename.isNull()) return;
if (filename.isNull()) {
settings.endGroup();
return;
}
settings_.setValue("last_save_playlist", filename);
settings.setValue("last_save_playlist", filename);
settings.endGroup();
Save(id == -1 ? current_id() : id, filename);
}

View File

@ -253,8 +253,6 @@ class PlaylistManager : public PlaylistManagerInterface {
PlaylistParser* parser_;
PlaylistContainer* playlist_container_;
QSettings settings_;
// key = id
QMap<int, Data> playlists_;

View File

@ -281,6 +281,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="b_quickchange_menu">
<property name="text">
<string>Show Quick Change Menu</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="b_write_metadata">
<property name="text">