Qmmp
playlistheadermodel.h
1 /***************************************************************************
2  * Copyright (C) 2015-2018 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 PLAYLISTHEADERMODEL_H
22 #define PLAYLISTHEADERMODEL_H
23 
24 #include <QObject>
25 #include <QWidget>
26 #include <QSettings>
27 #include <QHash>
28 #include <QVariant>
29 #include "metadataformatter.h"
30 #include "qmmpui_export.h"
31 
32 class MetaDataHelper;
33 
38 class QMMPUI_EXPORT PlayListHeaderModel : public QObject
39 {
40  Q_OBJECT
41 public:
46  explicit PlayListHeaderModel(QObject *parent = 0);
55  void restoreSettings(const QString &groupName);
60  void restoreSettings(QSettings *settings);
65  void saveSettings(const QString &groupName);
70  void saveSettings(QSettings *settings);
74  bool isSettingsLoaded() const;
81  void insert(int index, const QString &name, const QString &pattern);
86  void remove(int index);
90  void move(int from, int to);
96  void execEdit(int index, QWidget *parent = 0);
102  void execInsert(int index, QWidget *parent = 0);
106  int count();
110  const QString name(int index) const;
114  const QString pattern(int index) const;
121  void setData(int index, int key, const QVariant &data);
127  const QVariant data(int index, int key) const;
128 
129 signals:
134  void columnAdded(int index);
139  void columnRemoved(int index);
144  void columnChanged(int index);
148  void columnMoved(int from, int to);
152  void headerChanged();
153 
154 private:
155  void updatePlayLists();
156 
157  struct ColumnHeader
158  {
159  QString name;
160  QString pattern;
161  QHash<int, QVariant> data;
162  };
163  QList<ColumnHeader> m_columns;
164  bool m_settings_loaded;
165  MetaDataHelper *m_helper;
166 };
167 
168 #endif // COLUMNMANAGER_H
Helper class that provides access to playlist column configuration.
Definition: playlistheadermodel.h:38