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 {
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2011-10-30 17:51:43 +01:00
|
|
|
SettingsItemDelegate(QObject* parent);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
QSize sizeHint(const QStyleOptionViewItem& option,
|
|
|
|
const QModelIndex& index) const;
|
2011-10-30 17:51:43 +01:00
|
|
|
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
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
|
|
|
SettingsDialog(Application* app, BackgroundStreams* streams,
|
2014-02-10 16:03:54 +01:00
|
|
|
QWidget* parent = nullptr);
|
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,
|
2014-03-26 21:33:27 +01:00
|
|
|
Page_SoundCloud,
|
2012-12-05 10:36:22 +01:00
|
|
|
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_Dropbox,
|
2012-12-12 18:34:15 +01:00
|
|
|
Page_Skydrive,
|
2013-02-12 13:54:19 +01:00
|
|
|
Page_Box,
|
2014-10-15 20:44:09 +02:00
|
|
|
Page_Seafile,
|
2015-03-27 14:56:08 +01:00
|
|
|
Page_InternetShow,
|
|
|
|
Page_AmazonCloudDrive,
|
2010-06-09 00:56:31 +02:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
enum Role { Role_IsSeparator = Qt::UserRole };
|
2011-10-30 17:51:43 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
void SetGlobalShortcutManager(GlobalShortcuts* manager) {
|
|
|
|
manager_ = manager;
|
|
|
|
}
|
2011-08-14 01:07:10 +02:00
|
|
|
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);
|
|
|
|
|
2017-01-11 19:51:12 +01:00
|
|
|
signals:
|
2011-08-14 01:07:10 +02:00
|
|
|
void NotificationPreview(OSD::Behaviour, QString, QString);
|
|
|
|
void SetWiimotedevInterfaceActived(bool);
|
2010-12-03 14:53:43 +01:00
|
|
|
|
2014-02-07 16:34:20 +01: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
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2011-08-14 01:07:10 +02:00
|
|
|
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);
|
2014-02-21 17:24:49 +01:00
|
|
|
void AddPage(Page id, SettingsPage* page, QTreeWidgetItem* parent = nullptr);
|
2010-08-31 22:35:11 +02:00
|
|
|
|
2014-02-07 16:34:20 +01: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
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // SETTINGSDIALOG_H
|