1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 12:28:31 +01:00

Config dialog

This commit is contained in:
David Sansome 2010-02-03 16:17:04 +00:00
parent b4313e3410
commit eb6a836b53
20 changed files with 718 additions and 136 deletions

View File

@ -53,5 +53,7 @@
<file>somafm.png</file>
<file>refresh.png</file>
<file>web.png</file>
<file>library.png</file>
<file>media-playback-start-32.png</file>
</qresource>
</RCC>

BIN
data/library.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -2,7 +2,7 @@
#include "librarybackend.h"
#include "libraryitem.h"
#include "songmimedata.h"
#include "libraryconfig.h"
#include "librarydirectorymodel.h"
#include <QStringList>
#include <QUrl>
@ -15,9 +15,9 @@ Library::Library(EngineBase* engine, QObject* parent)
engine_(engine),
backend_(new BackgroundThread<LibraryBackend>(this)),
watcher_(new BackgroundThread<LibraryWatcher>(this)),
dir_model_(new LibraryDirectoryModel(this)),
artist_icon_(":artist.png"),
album_icon_(":album.png"),
config_(new LibraryConfig)
album_icon_(":album.png")
{
root_->lazy_loaded = true;
@ -28,7 +28,6 @@ Library::Library(EngineBase* engine, QObject* parent)
Library::~Library() {
delete root_;
delete config_;
}
void Library::StartThreads() {
@ -44,7 +43,7 @@ void Library::BackendInitialised() {
connect(backend_->Worker().get(), SIGNAL(Error(QString)), SIGNAL(Error(QString)));
connect(backend_->Worker().get(), SIGNAL(TotalSongCountUpdated(int)), SIGNAL(TotalSongCountUpdated(int)));
config_->SetBackend(backend_->Worker());
dir_model_->SetBackend(backend_->Worker());
if (--waiting_for_threads_ == 0)
Initialise();
@ -496,10 +495,6 @@ SongList Library::GetChildSongs(const QModelIndex& index) const {
return ret;
}
void Library::ShowConfig() {
config_->show();
}
void Library::SetFilterAge(int age) {
query_options_.max_age = age;
Reset();

View File

@ -13,7 +13,7 @@
#include "libraryitem.h"
#include "simpletreemodel.h"
class LibraryConfig;
class LibraryDirectoryModel;
class Library : public SimpleTreeModel<LibraryItem> {
Q_OBJECT
@ -30,6 +30,8 @@ class Library : public SimpleTreeModel<LibraryItem> {
void StartThreads();
LibraryDirectoryModel* GetDirectoryModel() const { return dir_model_; }
// Get information about the library
void GetChildSongs(LibraryItem* item, QList<QUrl>* urls, SongList* songs) const;
SongList GetChildSongs(const QModelIndex& index) const;
@ -49,8 +51,6 @@ class Library : public SimpleTreeModel<LibraryItem> {
void ScanFinished();
public slots:
void ShowConfig();
void SetFilterAge(int age);
void SetFilterText(const QString& text);
@ -89,6 +89,7 @@ class Library : public SimpleTreeModel<LibraryItem> {
EngineBase* engine_;
BackgroundThread<LibraryBackend>* backend_;
BackgroundThread<LibraryWatcher>* watcher_;
LibraryDirectoryModel* dir_model_;
int waiting_for_threads_;
@ -101,8 +102,6 @@ class Library : public SimpleTreeModel<LibraryItem> {
QIcon artist_icon_;
QIcon album_icon_;
LibraryConfig* config_;
};
#endif // LIBRARY_H

View File

@ -1,5 +1,5 @@
#include "libraryconfig.h"
#include "librarybackend.h"
#include "librarydirectorymodel.h"
#include <QFileDialog>
#include <QSettings>
@ -8,24 +8,28 @@
const char* LibraryConfig::kSettingsGroup = "LibraryConfig";
LibraryConfig::LibraryConfig(QWidget* parent)
: QDialog(parent),
dir_icon_(":folder.png")
: QWidget(parent),
model_(NULL)
{
ui_.setupUi(this);
connect(ui_.add, SIGNAL(clicked()), SLOT(Add()));
connect(ui_.remove, SIGNAL(clicked()), SLOT(Remove()));
connect(ui_.list, SIGNAL(currentRowChanged(int)), SLOT(CurrentRowChanged(int)));
}
void LibraryConfig::SetBackend(boost::shared_ptr<LibraryBackend> backend) {
backend_ = backend;
void LibraryConfig::SetModel(LibraryDirectoryModel *model) {
model_ = model;
ui_.list->setModel(model_);
connect(backend_.get(), SIGNAL(DirectoriesDiscovered(DirectoryList)), SLOT(DirectoriesDiscovered(DirectoryList)));
connect(backend_.get(), SIGNAL(DirectoriesDeleted(DirectoryList)), SLOT(DirectoriesDeleted(DirectoryList)));
connect(ui_.list->selectionModel(),
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
SLOT(CurrentRowChanged(QModelIndex)));
ui_.list->setEnabled(true);
ui_.add->setEnabled(true);
if (model_->IsBackendReady())
BackendReady();
else
connect(model_, SIGNAL(BackendReady()), SLOT(BackendReady()));
}
void LibraryConfig::Add() {
@ -36,41 +40,22 @@ void LibraryConfig::Add() {
path = QFileDialog::getExistingDirectory(this, "Add directory...", path);
if (!path.isNull()) {
backend_->AddDirectory(path);
model_->AddDirectory(path);
}
settings.setValue("last_path", path);
}
void LibraryConfig::Remove() {
QListWidgetItem* item = ui_.list->currentItem();
if (item == NULL)
return;
Directory dir;
dir.path = item->text();
dir.id = item->type();
backend_->RemoveDirectory(dir);
model_->RemoveDirectory(ui_.list->currentIndex());
}
void LibraryConfig::DirectoriesDiscovered(const DirectoryList& list) {
foreach (const Directory& dir, list) {
new QListWidgetItem(dir_icon_, dir.path, ui_.list, dir.id);
}
void LibraryConfig::CurrentRowChanged(const QModelIndex& index) {
ui_.remove->setEnabled(index.isValid());
}
void LibraryConfig::DirectoriesDeleted(const DirectoryList& list) {
foreach (const Directory& dir, list) {
for (int i=0 ; i<ui_.list->count() ; ++i) {
if (ui_.list->item(i)->type() == dir.id) {
delete ui_.list->takeItem(i);
break;
}
}
}
}
void LibraryConfig::CurrentRowChanged(int row) {
ui_.remove->setEnabled(row != -1);
void LibraryConfig::BackendReady() {
ui_.list->setEnabled(true);
ui_.add->setEnabled(true);
ui_.remove->setEnabled(true);
}

View File

@ -1,39 +1,32 @@
#ifndef LIBRARYCONFIG_H
#define LIBRARYCONFIG_H
#include <QDialog>
#include <boost/shared_ptr.hpp>
#include <QWidget>
#include "ui_libraryconfig.h"
#include "directory.h"
class LibraryBackend;
class LibraryDirectoryModel;
class LibraryConfig : public QDialog {
class LibraryConfig : public QWidget {
Q_OBJECT
public:
LibraryConfig(QWidget* parent = 0);
void SetBackend(boost::shared_ptr<LibraryBackend> backend);
void SetModel(LibraryDirectoryModel* model);
private slots:
void Add();
void Remove();
void BackendReady();
void DirectoriesDiscovered(const DirectoryList&);
void DirectoriesDeleted(const DirectoryList&);
void CurrentRowChanged(int);
void CurrentRowChanged(const QModelIndex& index);
private:
static const char* kSettingsGroup;
Ui::LibraryConfig ui_;
QIcon dir_icon_;
boost::shared_ptr<LibraryBackend> backend_;
LibraryDirectoryModel* model_;
};
#endif // LIBRARYCONFIG_H

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LibraryConfig</class>
<widget class="QDialog" name="LibraryConfig">
<widget class="QWidget" name="LibraryConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>489</width>
<height>273</height>
<height>232</height>
</rect>
</property>
<property name="windowTitle">
<string>Music Library</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
@ -24,7 +24,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="list">
<widget class="QListView" name="list">
<property name="enabled">
<bool>false</bool>
</property>
@ -88,59 +88,15 @@
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>list</tabstop>
<tabstop>add</tabstop>
<tabstop>remove</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../data/data.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>LibraryConfig</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>272</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>LibraryConfig</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>272</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

View File

@ -0,0 +1,11 @@
#include "libraryconfigdialog.h"
LibraryConfigDialog::LibraryConfigDialog(QWidget *parent)
: QDialog(parent)
{
ui_.setupUi(this);
}
void LibraryConfigDialog::SetModel(LibraryDirectoryModel* model) {
ui_.config->SetModel(model);
}

21
src/libraryconfigdialog.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef LIBRARYCONFIGDIALOG_H
#define LIBRARYCONFIGDIALOG_H
#include <QDialog>
#include "ui_libraryconfigdialog.h"
class LibraryDirectoryModel;
class LibraryConfigDialog : public QDialog {
Q_OBJECT
public:
LibraryConfigDialog(QWidget* parent = 0);
void SetModel(LibraryDirectoryModel* model);
private:
Ui::LibraryConfigDialog ui_;
};
#endif // LIBRARYCONFIGDIALOG_H

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LibraryConfigDialog</class>
<widget class="QDialog" name="LibraryConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Music Library</string>
</property>
<property name="windowIcon">
<iconset resource="../data/data.qrc">
<normaloff>:/library.png</normaloff>:/library.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="LibraryConfig" name="config" native="true"/>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LibraryConfig</class>
<extends>QWidget</extends>
<header>libraryconfig.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../data/data.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>LibraryConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>LibraryConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,55 @@
#include "librarydirectorymodel.h"
#include "librarybackend.h"
LibraryDirectoryModel::LibraryDirectoryModel(QObject* parent)
: QStandardItemModel(parent),
dir_icon_(":folder.png")
{
}
void LibraryDirectoryModel::SetBackend(boost::shared_ptr<LibraryBackend> backend) {
backend_ = backend;
connect(backend_.get(), SIGNAL(DirectoriesDiscovered(DirectoryList)), SLOT(DirectoriesDiscovered(DirectoryList)));
connect(backend_.get(), SIGNAL(DirectoriesDeleted(DirectoryList)), SLOT(DirectoriesDeleted(DirectoryList)));
emit BackendReady();
}
void LibraryDirectoryModel::DirectoriesDiscovered(const DirectoryList &directories) {
foreach (const Directory& dir, directories) {
QStandardItem* item = new QStandardItem(dir.path);
item->setData(dir.id, kIdRole);
item->setIcon(dir_icon_);
appendRow(item);
}
}
void LibraryDirectoryModel::DirectoriesDeleted(const DirectoryList &directories) {
foreach (const Directory& dir, directories) {
for (int i=0 ; i<rowCount() ; ++i) {
if (item(i, 0)->data(kIdRole).toInt() == dir.id) {
removeRow(i);
break;
}
}
}
}
void LibraryDirectoryModel::AddDirectory(const QString& path) {
if (!backend_)
return;
backend_->AddDirectory(path);
}
void LibraryDirectoryModel::RemoveDirectory(const QModelIndex& index) {
if (!backend_ || !index.isValid())
return;
Directory dir;
dir.path = index.data().toString();
dir.id = index.data(kIdRole).toInt();
backend_->RemoveDirectory(dir);
}

View File

@ -0,0 +1,41 @@
#ifndef LIBRARYDIRECTORYMODEL_H
#define LIBRARYDIRECTORYMODEL_H
#include <QStandardItemModel>
#include <QIcon>
#include <boost/shared_ptr.hpp>
#include "directory.h"
class LibraryBackend;
class LibraryDirectoryModel : public QStandardItemModel {
Q_OBJECT
public:
LibraryDirectoryModel(QObject* parent = 0);
void SetBackend(boost::shared_ptr<LibraryBackend> backend);
bool IsBackendReady() const { return backend_; }
// To be called by GUIs
void AddDirectory(const QString& path);
void RemoveDirectory(const QModelIndex& index);
signals:
void BackendReady();
private slots:
// To be called by the backend
void DirectoriesDiscovered(const DirectoryList& directories);
void DirectoriesDeleted(const DirectoryList& directories);
private:
static const int kIdRole = Qt::UserRole + 1;
QIcon dir_icon_;
boost::shared_ptr<LibraryBackend> backend_;
};
#endif // LIBRARYDIRECTORYMODEL_H

View File

@ -12,6 +12,8 @@
#include "trackslider.h"
#include "edittagdialog.h"
#include "multiloadingindicator.h"
#include "settingsdialog.h"
#include "libraryconfigdialog.h"
#include "qxtglobalshortcut.h"
@ -38,6 +40,8 @@ MainWindow::MainWindow(QWidget *parent)
track_slider_(new TrackSlider(this)),
edit_tag_dialog_(new EditTagDialog(this)),
multi_loading_indicator_(new MultiLoadingIndicator(this)),
settings_dialog_(new SettingsDialog(this)),
library_config_dialog_(new LibraryConfigDialog(this)),
radio_model_(new RadioModel(this)),
playlist_(new Playlist(this)),
player_(new Player(playlist_, radio_model_->GetLastFMService(), this)),
@ -70,6 +74,8 @@ MainWindow::MainWindow(QWidget *parent)
ui_.library_view->setModel(library_sort_model_);
ui_.library_view->SetLibrary(library_);
library_config_dialog_->SetModel(library_->GetDirectoryModel());
settings_dialog_->SetLibraryDirectoryModel(library_->GetDirectoryModel());
ui_.radio_view->setModel(radio_model_);
@ -89,6 +95,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui_.action_love, SIGNAL(triggered()), SLOT(Love()));
connect(ui_.action_clear_playlist, SIGNAL(triggered()), playlist_, SLOT(Clear()));
connect(ui_.action_edit_track, SIGNAL(triggered()), SLOT(EditTracks()));
connect(ui_.action_configure, SIGNAL(triggered()), settings_dialog_, SLOT(show()));
// Give actions to buttons
ui_.forward_button->setDefaultAction(ui_.action_next_track);
@ -135,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent)
// Library connections
connect(library_, SIGNAL(Error(QString)), SLOT(ReportError(QString)));
connect(ui_.library_view, SIGNAL(doubleClicked(QModelIndex)), SLOT(LibraryDoubleClick(QModelIndex)));
connect(ui_.library_view, SIGNAL(ShowConfigDialog()), library_, SLOT(ShowConfig()));
connect(ui_.library_view, SIGNAL(ShowConfigDialog()), library_config_dialog_, SLOT(show()));
connect(library_, SIGNAL(TotalSongCountUpdated(int)), ui_.library_view, SLOT(TotalSongCountUpdated(int)));
connect(library_, SIGNAL(ScanStarted()), SLOT(LibraryScanStarted()));
connect(library_, SIGNAL(ScanFinished()), SLOT(LibraryScanFinished()));
@ -171,7 +178,7 @@ MainWindow::MainWindow(QWidget *parent)
QMenu* library_menu = new QMenu(this);
library_menu->addActions(filter_age_group->actions());
library_menu->addSeparator();
library_menu->addAction("Configure library...", library_, SLOT(ShowConfig()));
library_menu->addAction("Configure library...", library_config_dialog_, SLOT(show()));
ui_.library_options->setMenu(library_menu);
// Playlist menu

View File

@ -9,7 +9,7 @@
class Playlist;
class Player;
class Library;
class LibraryConfig;
class LibraryConfigDialog;
class RadioModel;
class Song;
class RadioItem;
@ -17,6 +17,7 @@ class OSD;
class TrackSlider;
class EditTagDialog;
class MultiLoadingIndicator;
class SettingsDialog;
class QSortFilterProxyModel;
class SystemTrayIcon;
@ -80,6 +81,8 @@ class MainWindow : public QMainWindow {
TrackSlider* track_slider_;
EditTagDialog* edit_tag_dialog_;
MultiLoadingIndicator* multi_loading_indicator_;
SettingsDialog* settings_dialog_;
LibraryConfigDialog* library_config_dialog_;
RadioModel* radio_model_;
Playlist* playlist_;

View File

@ -14,7 +14,7 @@
<string>Clementine</string>
</property>
<property name="windowIcon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<widget class="QWidget" name="centralWidget">
@ -294,7 +294,7 @@
<item>
<widget class="QToolButton" name="library_filter_clear">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
</property>
<property name="iconSize">
@ -314,7 +314,7 @@
<item>
<widget class="QToolButton" name="library_options">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/configure.png</normaloff>:/configure.png</iconset>
</property>
<property name="iconSize">
@ -428,9 +428,55 @@
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>804</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuMusic">
<property name="title">
<string>Music</string>
</property>
<addaction name="action_previous_track"/>
<addaction name="action_play_pause"/>
<addaction name="action_stop"/>
<addaction name="action_next_track"/>
<addaction name="separator"/>
<addaction name="action_love"/>
<addaction name="action_ban"/>
<addaction name="separator"/>
<addaction name="action_quit"/>
</widget>
<widget class="QMenu" name="menuPlaylist">
<property name="title">
<string>Playlist</string>
</property>
<addaction name="action_clear_playlist"/>
</widget>
<widget class="QMenu" name="menuSettings">
<property name="title">
<string>Settings</string>
</property>
<addaction name="action_configure"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="action_about"/>
</widget>
<addaction name="menuMusic"/>
<addaction name="menuPlaylist"/>
<addaction name="menuSettings"/>
<addaction name="menuHelp"/>
</widget>
<action name="action_previous_track">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/media-skip-backward.png</normaloff>:/media-skip-backward.png</iconset>
</property>
<property name="text">
@ -439,7 +485,7 @@
</action>
<action name="action_play_pause">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/media-playback-start.png</normaloff>:/media-playback-start.png</iconset>
</property>
<property name="text">
@ -451,7 +497,7 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/media-playback-stop.png</normaloff>:/media-playback-stop.png</iconset>
</property>
<property name="text">
@ -460,7 +506,7 @@
</action>
<action name="action_next_track">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/media-skip-forward.png</normaloff>:/media-skip-forward.png</iconset>
</property>
<property name="text">
@ -469,7 +515,7 @@
</action>
<action name="action_quit">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/exit.png</normaloff>:/exit.png</iconset>
</property>
<property name="text">
@ -481,7 +527,7 @@
</action>
<action name="action_stop_after_this_track">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/media-playback-stop.png</normaloff>:/media-playback-stop.png</iconset>
</property>
<property name="text">
@ -547,7 +593,7 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/last.fm/love.png</normaloff>:/last.fm/love.png</iconset>
</property>
<property name="text">
@ -559,7 +605,7 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/last.fm/ban.png</normaloff>:/last.fm/ban.png</iconset>
</property>
<property name="text">
@ -568,7 +614,7 @@
</action>
<action name="action_clear_playlist">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/clear-list.png</normaloff>:/clear-list.png</iconset>
</property>
<property name="text">
@ -580,13 +626,27 @@
</action>
<action name="action_edit_track">
<property name="icon">
<iconset>
<iconset resource="../data/data.qrc">
<normaloff>:/edit-track.png</normaloff>:/edit-track.png</iconset>
</property>
<property name="text">
<string>Edit track information...</string>
</property>
</action>
<action name="action_configure">
<property name="icon">
<iconset resource="../data/data.qrc">
<normaloff>:/configure.png</normaloff>:/configure.png</iconset>
</property>
<property name="text">
<string>Configure Clementine...</string>
</property>
</action>
<action name="action_about">
<property name="text">
<string>About Clementine...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
@ -623,6 +683,8 @@
<header>radioview.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../data/data.qrc"/>
</resources>
<connections/>
</ui>

20
src/settingsdialog.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
SettingsDialog::SettingsDialog(QWidget* parent)
: QDialog(parent)
{
ui_.setupUi(this);
connect(ui_.list, SIGNAL(currentTextChanged(QString)), SLOT(CurrentTextChanged(QString)));
ui_.list->setCurrentRow(0);
}
void SettingsDialog::CurrentTextChanged(const QString &text) {
ui_.title->setText("<b>" + text + "</b>");
}
void SettingsDialog::SetLibraryDirectoryModel(LibraryDirectoryModel* model) {
ui_.library_config->SetModel(model);
}

25
src/settingsdialog.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include "ui_settingsdialog.h"
class LibraryDirectoryModel;
class SettingsDialog : public QDialog {
Q_OBJECT
public:
SettingsDialog(QWidget* parent = 0);
void SetLibraryDirectoryModel(LibraryDirectoryModel* model);
private slots:
void CurrentTextChanged(const QString& text);
private:
Ui::SettingsDialog ui_;
};
#endif // SETTINGSDIALOG_H

311
src/settingsdialog.ui Normal file
View File

@ -0,0 +1,311 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialog</class>
<widget class="QDialog" name="SettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>708</width>
<height>549</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QListWidget" name="list">
<property name="maximumSize">
<size>
<width>180</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="spacing">
<number>2</number>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="selectionRectVisible">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Playback</string>
</property>
<property name="icon">
<iconset resource="../data/data.qrc">
<normaloff>:/media-playback-start-32.png</normaloff>:/media-playback-start-32.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Music Library</string>
</property>
<property name="icon">
<iconset resource="../data/data.qrc">
<normaloff>:/library.png</normaloff>:/library.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Last.fm</string>
</property>
<property name="icon">
<iconset resource="../data/data.qrc">
<normaloff>:/last.fm/as.png</normaloff>:/last.fm/as.png</iconset>
</property>
</item>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="title"/>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Fadeout</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>No fadeout</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>Fadeout</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Fadeout duration</string>
</property>
<property name="indent">
<number>22</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="suffix">
<string>ms</string>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="value">
<number>2000</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</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>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>groupBox</zorder>
<zorder>verticalSpacer</zorder>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="LibraryConfig" name="library_config" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3"/>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LibraryConfig</class>
<extends>QWidget</extends>
<header>libraryconfig.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>list</tabstop>
<tabstop>radioButton</tabstop>
<tabstop>radioButton_2</tabstop>
<tabstop>spinBox</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../data/data.qrc"/>
</resources>
<connections>
<connection>
<sender>list</sender>
<signal>currentRowChanged(int)</signal>
<receiver>stackedWidget</receiver>
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel">
<x>82</x>
<y>72</y>
</hint>
<hint type="destinationlabel">
<x>307</x>
<y>96</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButton_2</sender>
<signal>toggled(bool)</signal>
<receiver>spinBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>272</x>
<y>108</y>
</hint>
<hint type="destinationlabel">
<x>369</x>
<y>132</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButton_2</sender>
<signal>toggled(bool)</signal>
<receiver>label</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>108</y>
</hint>
<hint type="destinationlabel">
<x>264</x>
<y>131</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>518</x>
<y>524</y>
</hint>
<hint type="destinationlabel">
<x>521</x>
<y>545</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>324</x>
<y>521</y>
</hint>
<hint type="destinationlabel">
<x>322</x>
<y>549</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -48,7 +48,10 @@ SOURCES += main.cpp \
edittagdialog.cpp \
lineedit.cpp \
multiloadingindicator.cpp \
somafmservice.cpp
somafmservice.cpp \
settingsdialog.cpp \
librarydirectorymodel.cpp \
libraryconfigdialog.cpp
HEADERS += mainwindow.h \
player.h \
library.h \
@ -97,7 +100,10 @@ HEADERS += mainwindow.h \
edittagdialog.h \
lineedit.h \
multiloadingindicator.h \
somafmservice.h
somafmservice.h \
settingsdialog.h \
librarydirectorymodel.h \
libraryconfigdialog.h
FORMS += mainwindow.ui \
libraryconfig.ui \
fileview.ui \
@ -105,7 +111,9 @@ FORMS += mainwindow.ui \
lastfmstationdialog.ui \
trackslider.ui \
edittagdialog.ui \
multiloadingindicator.ui
multiloadingindicator.ui \
settingsdialog.ui \
libraryconfigdialog.ui
RESOURCES += ../data/data.qrc
OTHER_FILES += ../data/schema.sql \
../data/mainwindow.css