Qmmp
qmmpuisettings.h
1 /***************************************************************************
2  * Copyright (C) 2012-2020 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 = nullptr);
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;
89  bool isPlayListTransitionEnabled() const;
94  void setConvertUnderscore(bool enabled);
99  void setConvertTwenty(bool enabled);
104  void setGroupFormat(const QString &groupFormat);
109  void setUseMetaData(bool enabled);
113  bool resumeOnStartup() const;
118  void setResumeOnStartup(bool enabled);
123  void setUseClipboard(bool enabled);
127  bool useClipboard() const;
131  QStringList restrictFilters() const;
135  void setRestrictFilters(const QString &filters);
139  QStringList excludeFilters() const;
144  void setExcludeFilters(const QString &filters);
149  bool useDefaultPlayList() const;
153  QString defaultPlayListName() const;
159  void setDefaultPlayList(const QString &name, bool enabled = true);
164  void setAutoSavePlayList(bool enabled);
170  bool autoSavePlayList() const;
175  void setClearPreviousPlayList(bool enabled);
181  bool clearPreviousPlayList() const;
186  bool readMetaDataForPlayLists() const;
191  void setReadMetaDataForPlayLists(bool enabled);
195  static QmmpUiSettings* instance();
196 
197 signals:
202  void repeatableListChanged(bool state);
207  void shuffleChanged(bool state);
212  void groupsChanged(bool state);
217  void repeatableTrackChanged(bool enabled);
223  void noPlayListAdvanceChanged(bool enabled);
228  void playListTransitionChanged(bool enabled) const;
229 
230 public slots:
235  void setRepeatableList(bool r);
240  void setShuffle(bool s);
245  void setGroupsEnabled(bool enabled);
250  void setRepeatableTrack(bool enabled);
256  void setNoPlayListAdvance(bool enabled);
261  void setPlayListTransitionEnabled(bool enabled);
262 
263 private slots:
267  void sync();
268 
269 
270 private:
271  static QmmpUiSettings* m_instance;
272  //playlist
273  QString m_group_format;
274  bool m_convertUnderscore, m_convertTwenty;
275  bool m_useMetaData;
276  bool m_autosave_playlist;
277  bool m_repeate_list;
278  bool m_shuffle;
279  bool m_groups_enabled;
280  bool m_repeat_track;
281  bool m_no_pl_advance;
282  bool m_clear_prev_playlist;
283  bool m_read_metadata_for_playlist;
284  bool m_transit_between_playlists;
285  //general
286  bool m_resume_on_startup;
287  QStringList m_exclude_filters, m_restrict_filters;
288  //default playlist
289  bool m_use_default_pl;
290  QString m_default_pl_name;
291  //url dialog
292  bool m_use_clipboard;
293  //timer
294  QTimer *m_timer;
295  //formatters
296  MetaDataHelper *m_helper;
297 };
298 
299 #endif // QMMPUISETTINGS_H
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition: qmmpuisettings.h:36