~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/ui/settingsdialog.h

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#define SETTINGSDIALOG_H
20
20
 
21
21
#include <QDialog>
22
 
#include <QMap>
23
 
#include <QUrl>
 
22
#include <QStyledItemDelegate>
24
23
 
25
24
#include "config.h"
 
25
#include "widgets/osd.h"
26
26
 
27
 
class QBoxLayout;
28
 
class QCheckBox;
29
 
class QSlider;
 
27
class QScrollArea;
 
28
class QTreeWidgetItem;
30
29
 
31
30
class BackgroundStreams;
 
31
class GlobalSearch;
32
32
class GlobalShortcuts;
33
33
class LibraryDirectoryModel;
34
 
class OSDPretty;
 
34
class SettingsPage;
35
35
class SongInfoView;
36
36
class Ui_SettingsDialog;
37
37
 
38
 
#ifdef HAVE_LIBLASTFM
39
 
  class LastFMConfig;
40
 
#endif
41
 
#ifdef HAVE_WIIMOTEDEV
42
 
  class WiimotedevShortcutsConfig;
43
 
#endif
44
 
#ifdef HAVE_REMOTE
45
 
  class RemoteConfig;
46
 
#endif
47
 
 
48
38
class GstEngine;
49
39
 
 
40
 
 
41
class SettingsItemDelegate : public QStyledItemDelegate {
 
42
public:
 
43
  SettingsItemDelegate(QObject* parent);
 
44
 
 
45
  QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
 
46
  void paint(QPainter* painter, const QStyleOptionViewItem& option,
 
47
             const QModelIndex& index) const;
 
48
};
 
49
 
 
50
 
50
51
class SettingsDialog : public QDialog {
51
52
  Q_OBJECT
52
53
 
53
 
 public:
 
54
public:
54
55
  SettingsDialog(BackgroundStreams* streams, QWidget* parent = 0);
55
56
  ~SettingsDialog();
56
57
 
57
58
  enum Page {
58
 
    Page_Playback = 0,
 
59
    Page_Playback,
59
60
    Page_Behaviour,
60
61
    Page_SongInformation,
61
62
    Page_GlobalShortcuts,
 
63
    Page_GlobalSearch,
62
64
    Page_Notifications,
63
65
    Page_Library,
64
 
#ifdef HAVE_LIBLASTFM
65
66
    Page_Lastfm,
66
 
#endif
 
67
    Page_Grooveshark,
 
68
    Page_Spotify,
67
69
    Page_Magnatune,
 
70
    Page_DigitallyImported,
68
71
    Page_BackgroundStreams,
69
72
    Page_Proxy,
70
 
#ifdef HAVE_REMOTE
 
73
    Page_Transcoding,
71
74
    Page_Remote,
72
 
#endif
73
 
#ifdef HAVE_WIIMOTEDEV
74
75
    Page_Wiimotedev,
75
 
#endif
76
 
  };
77
 
 
78
 
  void SetLibraryDirectoryModel(LibraryDirectoryModel* model);
79
 
  void SetGlobalShortcutManager(GlobalShortcuts* manager);
 
76
  };
 
77
 
 
78
  enum Role {
 
79
    Role_IsSeparator = Qt::UserRole
 
80
  };
 
81
 
 
82
  void SetLibraryDirectoryModel(LibraryDirectoryModel* model) { model_ = model; }
 
83
  void SetGlobalShortcutManager(GlobalShortcuts* manager) { manager_ = manager; }
80
84
  void SetGstEngine(const GstEngine* engine) { gst_engine_ = engine; }
81
 
  void SetSongInfoView(SongInfoView* view);
 
85
  void SetSongInfoView(SongInfoView* view) { song_info_view_ = view; }
 
86
  void SetGlobalSearch(GlobalSearch* global_search) { global_search_ = global_search; }
 
87
 
 
88
  bool is_loading_settings() const { return loading_settings_; }
 
89
 
 
90
  LibraryDirectoryModel* library_directory_model() const { return model_; }
 
91
  GlobalShortcuts* global_shortcuts_manager() const { return manager_; }
 
92
  const GstEngine* gst_engine() const { return gst_engine_; }
 
93
  SongInfoView* song_info_view() const { return song_info_view_; }
 
94
  BackgroundStreams* background_streams() const { return streams_; }
 
95
  GlobalSearch* global_search() const { return global_search_; }
82
96
 
83
97
  void OpenAtPage(Page page);
84
98
 
87
101
 
88
102
  // QWidget
89
103
  void showEvent(QShowEvent* e);
90
 
  void hideEvent(QHideEvent *);
91
 
 
92
 
 private:
93
 
  void AddStream(const QString& name);
94
 
  void AddStreams();
95
 
  void LoadStreams();
96
 
 
97
 
 private slots:
98
 
  void CurrentTextChanged(const QString& text);
99
 
  void NotificationTypeChanged();
100
 
  void ValidationComplete(bool success);
101
 
 
102
 
  void PrettyOpacityChanged(int value);
103
 
  void PrettyColorPresetChanged(int index);
104
 
  void ChooseBgColor();
105
 
  void ChooseFgColor();
106
 
 
107
 
  void UpdatePopupVisible();
108
 
  void ShowTrayIconToggled(bool on);
109
 
  void GstPluginChanged(int index);
110
 
  void FadingOptionsChanged();
111
 
  void RgPreampChanged(int value);
112
 
 
113
 
  void SongInfoFontSizeChanged(double value);
114
 
 
115
 
  // Background streams.
116
 
  void EnableStream(bool enabled);
117
 
  void StreamVolumeChanged(int value);
118
 
 
119
 
 private:
120
 
#ifdef HAVE_LIBLASTFM
121
 
  LastFMConfig* lastfm_config_;
122
 
#endif
123
 
#ifdef HAVE_WIIMOTEDEV
124
 
  WiimotedevShortcutsConfig* wiimotedev_config_;
125
 
#endif
126
 
#ifdef HAVE_REMOTE
127
 
  RemoteConfig* remote_config_;
128
 
#endif
 
104
 
 
105
signals:
 
106
  void NotificationPreview(OSD::Behaviour, QString, QString);
 
107
  void SetWiimotedevInterfaceActived(bool);
 
108
 
 
109
private slots:
 
110
  void CurrentItemChanged(QTreeWidgetItem* item);
 
111
 
 
112
private:
 
113
  struct PageData {
 
114
    QTreeWidgetItem* item_;
 
115
    QScrollArea* scroll_area_;
 
116
    SettingsPage* page_;
 
117
  };
 
118
 
 
119
  QTreeWidgetItem* AddCategory(const QString& name);
 
120
  void AddPage(Page id, SettingsPage* page, QTreeWidgetItem* parent = NULL);
 
121
 
 
122
private:
 
123
  LibraryDirectoryModel* model_;
 
124
  GlobalShortcuts* manager_;
129
125
  const GstEngine* gst_engine_;
 
126
  SongInfoView* song_info_view_;
 
127
  BackgroundStreams* streams_;
 
128
  GlobalSearch* global_search_;
130
129
 
131
130
  Ui_SettingsDialog* ui_;
132
131
  bool loading_settings_;
133
132
 
134
 
  OSDPretty* pretty_popup_;
135
 
 
136
 
  QMap<QString, QString> language_map_;
137
 
 
138
 
  BackgroundStreams* streams_;
139
 
 
140
 
#ifdef HAVE_WIIMOTEDEV
141
 
 signals:
142
 
  void SetWiimotedevInterfaceActived(bool);
143
 
#endif
 
133
  QMap<Page, PageData> pages_;
144
134
};
145
135
 
146
136
#endif // SETTINGSDIALOG_H