Qmmp
Loading...
Searching...
No Matches
playlistheadermodel.h
1/***************************************************************************
2 * Copyright (C) 2015-2022 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
32class MetaDataHelper;
33
38class QMMPUI_EXPORT PlayListHeaderModel : public QObject
39{
40 Q_OBJECT
41public:
46 explicit PlayListHeaderModel(QObject *parent = nullptr);
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 = nullptr);
102 void execInsert(int index, QWidget *parent = nullptr);
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
129signals:
134 void columnAdded(int index);
139 void columnRemoved(int index);
144 void columnChanged(int index);
148 void columnMoved(int from, int to);
153
154private:
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 = false;
165 MetaDataHelper *m_helper;
166};
167
168#endif // COLUMNMANAGER_H
Helper class that provides access to playlist column configuration.
Definition playlistheadermodel.h:39
PlayListHeaderModel(QObject *parent=nullptr)
void setData(int index, int key, const QVariant &data)
void remove(int index)
void restoreSettings(const QString &groupName)
void restoreSettings(QSettings *settings)
const QString pattern(int index) const
void saveSettings(QSettings *settings)
void execEdit(int index, QWidget *parent=nullptr)
void move(int from, int to)
const QVariant data(int index, int key) const
void columnAdded(int index)
void insert(int index, const QString &name, const QString &pattern)
bool isSettingsLoaded() const
void execInsert(int index, QWidget *parent=nullptr)
void columnMoved(int from, int to)
void columnChanged(int index)
void columnRemoved(int index)
const QString name(int index) const
void saveSettings(const QString &groupName)