Clementine-audio-player-Mac.../src/ui/settingsdialog.h

153 lines
4.0 KiB
C
Raw Normal View History

/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
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>
#include <QStyledItemDelegate>
2010-02-03 17:17:04 +01:00
2010-05-11 00:09:16 +02:00
#include "config.h"
#include "widgets/osd.h"
2010-02-03 17:17:04 +01:00
class QAbstractButton;
class QScrollArea;
class QTreeWidgetItem;
class Appearance;
class BackgroundStreams;
class GlobalSearch;
class GlobalShortcuts;
2010-02-03 17:17:04 +01:00
class LibraryDirectoryModel;
class SettingsPage;
class SongInfoView;
class Ui_SettingsDialog;
class GstEngine;
2010-02-03 17:17:04 +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
public:
SettingsDialog(Application* app, BackgroundStreams* streams,
QWidget* parent = nullptr);
2010-03-25 20:30:10 +01:00
~SettingsDialog();
2010-02-03 17:17:04 +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,
Page_Notifications,
Page_Library,
Page_Lastfm,
Page_SoundCloud,
Page_Spotify,
Page_Magnatune,
Page_DigitallyImported,
Page_BackgroundStreams,
Page_Proxy,
Page_Transcoding,
Page_Remote,
Page_Wiimotedev,
Page_Subsonic,
Page_Podcasts,
Page_GoogleDrive,
Page_Dropbox,
Page_Skydrive,
2013-02-12 13:54:19 +01:00
Page_Box,
Page_Seafile,
Amazon Cloud Drive support. Squashed commit of the following: commit 451a327fabb5f9aba077d93a33d75d8a6a288f5f Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:55:36 2015 +0100 Revert debug console changes. commit 52f643c3dc524a837f56268b6da4881187204165 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:49:28 2015 +0100 Revert extra logging commit 23645f9fea4caa65d93c2a0a5ad5e2a164c3b535 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:47:55 2015 +0100 How did you get there commit 8153388f19db17caf4286618922516b495a3f1d3 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:45:12 2015 +0100 Update copyright headers. commit fa9e279259604a16564287291180b69cbb22d74f Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:43:27 2015 +0100 Remove logging commit 47a405543c8f6924adb60fbc34ec7360c608a9ec Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:42:05 2015 +0100 Show login state correctly for Amazon. commit 748d88d993fb56ecd97e14b8e7c7b6c49f11c410 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:28:55 2015 +0100 Ensure Amazon is connected before serving URLs. commit 25ec9c65f4b0be4fc2df13cf941cf236f7cf6b46 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:22:28 2015 +0100 Refresh Amazon authorisation & follow changes. commit 27c1a37173a76e04341b87abe2ada8438d6ee59f Author: John Maguire <john.maguire@gmail.com> Date: Thu Mar 26 18:27:27 2015 +0100 Revert unneeded OAuthenticator change. commit 3594af5be12d979762719010535db8f5aaec0905 Author: John Maguire <john.maguire@gmail.com> Date: Thu Mar 26 16:52:19 2015 +0100 Initial support for Amazon Cloud Drive.
2015-03-27 14:56:08 +01:00
Page_InternetShow,
Page_AmazonCloudDrive,
};
enum Role { Role_IsSeparator = Qt::UserRole };
void SetGlobalShortcutManager(GlobalShortcuts* manager) {
manager_ = manager;
}
void SetSongInfoView(SongInfoView* view) { song_info_view_ = view; }
bool is_loading_settings() const { return loading_settings_; }
Application* app() const { return app_; }
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_; }
GlobalSearch* global_search() const { return global_search_; }
Appearance* appearance() const { return appearance_; }
2010-02-03 17:17:04 +01:00
void OpenAtPage(Page page);
// QDialog
void accept();
void reject();
// QWidget
void showEvent(QShowEvent* e);
2017-01-11 19:51:12 +01:00
signals:
void NotificationPreview(OSD::Behaviour, QString, QString);
void SetWiimotedevInterfaceActived(bool);
private slots:
void CurrentItemChanged(QTreeWidgetItem* item);
void DialogButtonClicked(QAbstractButton* button);
private:
struct PageData {
QTreeWidgetItem* item_;
QScrollArea* scroll_area_;
SettingsPage* page_;
};
QTreeWidgetItem* AddCategory(const QString& name);
2014-02-21 17:24:49 +01:00
void AddPage(Page id, SettingsPage* page, QTreeWidgetItem* parent = nullptr);
private:
Application* app_;
LibraryDirectoryModel* model_;
GlobalShortcuts* manager_;
const GstEngine* gst_engine_;
SongInfoView* song_info_view_;
BackgroundStreams* streams_;
GlobalSearch* global_search_;
Appearance* appearance_;
Ui_SettingsDialog* ui_;
bool loading_settings_;
QMap<Page, PageData> pages_;
2010-02-03 17:17:04 +01:00
};
#endif // SETTINGSDIALOG_H