Qmmp
qmmpuisettings.h
1 /***************************************************************************
2  * Copyright (C) 2012-2019 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef QMMPUISETTINGS_H
22 #define QMMPUISETTINGS_H
23 
24 #include <QObject>
25 #include <QStringList>
26 #include "playlistheadermodel.h"
27 #include "metadataformatter.h"
28 #include "qmmpui_export.h"
29 
30 class QTimer;
31 class MetaDataHelper;
32 
36 class QMMPUI_EXPORT QmmpUiSettings : public QObject
37 {
38  Q_OBJECT
39 public:
45  explicit QmmpUiSettings(QObject *parent = 0);
49  virtual ~QmmpUiSettings();
53  bool convertUnderscore() const;
57  bool convertTwenty() const;
61  bool useMetaData() const;
65  const QString groupFormat() const;
69  bool isRepeatableList() const;
73  bool isShuffle() const;
77  bool isGroupsEnabled() const;
81  bool isRepeatableTrack() const;
85  bool isNoPlayListAdvance() const;
90  void setConvertUnderscore(bool enabled);
95  void setConvertTwenty(bool enabled);
100  void setGroupFormat(const QString &groupFormat);
105  void setUseMetaData(bool enabled);
109  bool resumeOnStartup() const;
114  void setResumeOnStartup(bool enabled);
119  void setUseClipboard(bool enabled);
123  bool useClipboard() const;
127  QStringList restrictFilters() const;
131  void setRestrictFilters(const QString &filters);
135  QStringList excludeFilters() const;
140  void setExcludeFilters(const QString &filters);
145  bool useDefaultPlayList() const;
149  QString defaultPlayListName() const;
155  void setDefaultPlayList(const QString &name, bool enabled = true);
160  void setAutoSavePlayList(bool enabled);
166  bool autoSavePlayList() const;
171  void setClearPreviousPlayList(bool enabled);
177  bool clearPreviousPlayList() const;
182  bool readMetaDataForPlayLists() const;
187  void setReadMetaDataForPlayLists(bool enabled);
191  static QmmpUiSettings* instance();
192 
193 signals:
198  void repeatableListChanged(bool state);
203  void shuffleChanged(bool state);
208  void groupsChanged(bool state);
213  void repeatableTrackChanged(bool enabled);
219  void noPlayListAdvanceChanged(bool enabled);
220 
221 public slots:
226  void setRepeatableList(bool r);
231  void setShuffle(bool s);
236  void setGroupsEnabled(bool enabled);
241  void setRepeatableTrack(bool enabled);
247  void setNoPlayListAdvance(bool enabled);
248 
249 private slots:
253  void sync();
254 
255 
256 private:
257  static QmmpUiSettings* m_instance;
258  //playlist
259  QString m_group_format;
260  bool m_convertUnderscore, m_convertTwenty;
261  bool m_useMetaData;
262  bool m_autosave_playlist;
263  bool m_repeate_list;
264  bool m_shuffle;
265  bool m_groups_enabled;
266  bool m_repeat_track;
267  bool m_no_pl_advance;
268  bool m_clear_prev_playlist;
269  bool m_read_metadata_for_playlist;
270  //general
271  bool m_resume_on_startup;
272  QStringList m_exclude_filters, m_restrict_filters;
273  //default playlist
274  bool m_use_default_pl;
275  QString m_default_pl_name;
276  //url dialog
277  bool m_use_clipboard;
278  //timer
279  QTimer *m_timer;
280  //formatters
281  MetaDataHelper *m_helper;
282 };
283 
284 #endif // QMMPUISETTINGS_H
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition: qmmpuisettings.h:36