2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2010-02-03 17:17:04 +01:00
|
|
|
#ifndef SETTINGSDIALOG_H
|
|
|
|
#define SETTINGSDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2011-10-30 17:51:43 +01:00
|
|
|
#include <QStyledItemDelegate>
|
2010-02-03 17:17:04 +01:00
|
|
|
|
2010-05-11 00:09:16 +02:00
|
|
|
#include "config.h"
|
2011-05-22 23:15:11 +02:00
|
|
|
#include "widgets/osd.h"
|
2010-02-03 17:17:04 +01:00
|
|
|
|
2013-03-25 02:44:35 +01:00
|
|
|
class QAbstractButton;
|
2011-08-14 16:41:47 +02:00
|
|
|
class QScrollArea;
|
2011-10-30 17:51:43 +01:00
|
|
|
class QTreeWidgetItem;
|
2011-08-14 16:41:47 +02:00
|
|
|
|
2012-01-09 21:15:42 +01:00
|
|
|
class Appearance;
|
2010-12-03 14:53:43 +01:00
|
|
|
class BackgroundStreams;
|
2011-10-30 19:52:38 +01:00
|
|
|
class GlobalSearch;
|
2010-06-23 18:27:23 +02:00
|
|
|
class GlobalShortcuts;
|
2010-02-03 17:17:04 +01:00
|
|
|
class LibraryDirectoryModel;
|
2011-08-14 01:07:10 +02:00
|
|
|
class SettingsPage;
|
2010-10-10 18:46:35 +02:00
|
|
|
class SongInfoView;
|
2010-06-09 00:56:31 +02:00
|
|
|
class Ui_SettingsDialog;
|
|
|
|
|
2010-08-27 15:57:39 +02:00
|
|
|
class GstEngine;
|
2010-02-03 17:17:04 +01:00
|
|
|
|
2011-10-30 17:51:43 +01:00
|
|
|
|
|
|
|
class SettingsItemDelegate : public QStyledItemDelegate {
|
|
|
|
public:
|
|
|
|
SettingsItemDelegate(QObject* parent);
|
|
|
|
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
|
|
void paint(QPainter* painter, const QStyleOptionViewItem& option,
|
|
|
|
const QModelIndex& index) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-03 17:17:04 +01:00
|
|
|
class SettingsDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
public:
|
2012-03-09 16:25:49 +01:00
|
|
|
SettingsDialog(Application* app, BackgroundStreams* streams, QWidget* parent = 0);
|
2010-03-25 20:30:10 +01:00
|
|
|
~SettingsDialog();
|
2010-02-03 17:17:04 +01:00
|
|
|
|
2012-12-05 10:36:22 +01:00
|
|
|
enum Page {
|
|
|
|
Page_Playback,
|
|
|
|
Page_Behaviour,
|
|
|
|
Page_SongInformation,
|
|
|
|
Page_GlobalShortcuts,
|
|
|
|
Page_GlobalSearch,
|
|
|
|
Page_Appearance,
|
2012-12-31 23:37:39 +01:00
|
|
|
Page_NetworkRemote,
|
2012-12-05 10:36:22 +01:00
|
|
|
Page_Notifications,
|
|
|
|
Page_Library,
|
|
|
|
Page_Lastfm,
|
|
|
|
Page_Grooveshark,
|
|
|
|
Page_Spotify,
|
|
|
|
Page_Magnatune,
|
|
|
|
Page_DigitallyImported,
|
|
|
|
Page_BackgroundStreams,
|
|
|
|
Page_Proxy,
|
|
|
|
Page_Transcoding,
|
|
|
|
Page_Remote,
|
|
|
|
Page_Wiimotedev,
|
2011-12-06 00:10:25 +01:00
|
|
|
Page_Subsonic,
|
2012-12-05 10:36:22 +01:00
|
|
|
Page_Podcasts,
|
|
|
|
Page_GoogleDrive,
|
|
|
|
Page_UbuntuOne,
|
|
|
|
Page_Dropbox,
|
2012-12-12 18:34:15 +01:00
|
|
|
Page_Skydrive,
|
2013-02-12 13:54:19 +01:00
|
|
|
Page_Box,
|
2010-06-09 00:56:31 +02:00
|
|
|
};
|
|
|
|
|
2011-10-30 17:51:43 +01:00
|
|
|
enum Role {
|
|
|
|
Role_IsSeparator = Qt::UserRole
|
|
|
|
};
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
void SetGlobalShortcutManager(GlobalShortcuts* manager) { manager_ = manager; }
|
|
|
|
void SetSongInfoView(SongInfoView* view) { song_info_view_ = view; }
|
|
|
|
|
|
|
|
bool is_loading_settings() const { return loading_settings_; }
|
|
|
|
|
2012-03-09 16:25:49 +01:00
|
|
|
Application* app() const { return app_; }
|
2011-08-14 01:07:10 +02:00
|
|
|
LibraryDirectoryModel* library_directory_model() const { return model_; }
|
|
|
|
GlobalShortcuts* global_shortcuts_manager() const { return manager_; }
|
|
|
|
const GstEngine* gst_engine() const { return gst_engine_; }
|
|
|
|
SongInfoView* song_info_view() const { return song_info_view_; }
|
|
|
|
BackgroundStreams* background_streams() const { return streams_; }
|
2011-10-30 19:52:38 +01:00
|
|
|
GlobalSearch* global_search() const { return global_search_; }
|
2012-01-09 21:15:42 +01:00
|
|
|
Appearance* appearance() const { return appearance_; }
|
2010-02-03 17:17:04 +01:00
|
|
|
|
2010-06-09 00:56:31 +02:00
|
|
|
void OpenAtPage(Page page);
|
|
|
|
|
2010-02-03 17:51:56 +01:00
|
|
|
// QDialog
|
|
|
|
void accept();
|
2012-01-09 21:15:42 +01:00
|
|
|
void reject();
|
2010-02-03 17:51:56 +01:00
|
|
|
|
|
|
|
// QWidget
|
|
|
|
void showEvent(QShowEvent* e);
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
signals:
|
|
|
|
void NotificationPreview(OSD::Behaviour, QString, QString);
|
|
|
|
void SetWiimotedevInterfaceActived(bool);
|
2010-12-03 14:53:43 +01:00
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
private slots:
|
2011-10-30 17:51:43 +01:00
|
|
|
void CurrentItemChanged(QTreeWidgetItem* item);
|
2013-03-25 02:44:35 +01:00
|
|
|
void DialogButtonClicked(QAbstractButton* button);
|
2010-08-27 15:57:39 +02:00
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
private:
|
|
|
|
struct PageData {
|
2011-10-30 17:51:43 +01:00
|
|
|
QTreeWidgetItem* item_;
|
2011-08-14 16:41:47 +02:00
|
|
|
QScrollArea* scroll_area_;
|
2011-08-14 01:07:10 +02:00
|
|
|
SettingsPage* page_;
|
|
|
|
};
|
2010-08-02 21:02:21 +02:00
|
|
|
|
2011-10-30 17:51:43 +01:00
|
|
|
QTreeWidgetItem* AddCategory(const QString& name);
|
|
|
|
void AddPage(Page id, SettingsPage* page, QTreeWidgetItem* parent = NULL);
|
2010-08-31 22:35:11 +02:00
|
|
|
|
2013-03-25 02:44:35 +01:00
|
|
|
void Save();
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
private:
|
2012-03-09 16:25:49 +01:00
|
|
|
Application* app_;
|
2011-08-14 01:07:10 +02:00
|
|
|
LibraryDirectoryModel* model_;
|
|
|
|
GlobalShortcuts* manager_;
|
|
|
|
const GstEngine* gst_engine_;
|
|
|
|
SongInfoView* song_info_view_;
|
2010-12-03 14:53:43 +01:00
|
|
|
BackgroundStreams* streams_;
|
2011-10-30 19:52:38 +01:00
|
|
|
GlobalSearch* global_search_;
|
2012-01-09 21:15:42 +01:00
|
|
|
Appearance* appearance_;
|
2010-12-03 14:53:43 +01:00
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
Ui_SettingsDialog* ui_;
|
|
|
|
bool loading_settings_;
|
|
|
|
|
|
|
|
QMap<Page, PageData> pages_;
|
2010-02-03 17:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SETTINGSDIALOG_H
|