Qmmp
/usr/src/RPM/BUILD/qmmp-0.11-svn/src/qmmpui/playlistheadermodel.h
00001 /***************************************************************************
00002  *   Copyright (C) 2015 by Ilya Kotov                                      *
00003  *   forkotov02@hotmail.ru                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
00019  ***************************************************************************/
00020 
00021 #ifndef PLAYLISTHEADERMODEL_H
00022 #define PLAYLISTHEADERMODEL_H
00023 
00024 #include <QObject>
00025 #include <QWidget>
00026 #include <QSettings>
00027 #include <QHash>
00028 #include <QVariant>
00029 #include "metadataformatter.h"
00030 
00031 class MetaDataHelper;
00032 
00037 class PlayListHeaderModel : public QObject
00038 {
00039     Q_OBJECT
00040 public:
00045     explicit PlayListHeaderModel(QObject *parent = 0);
00049     ~PlayListHeaderModel();
00054     void restoreSettings(const QString &groupName);
00059     void restoreSettings(QSettings *settings);
00064     void saveSettings(const QString &groupName);
00069     void saveSettings(QSettings *settings);
00073     bool isSettingsLoaded() const;
00080     void insert(int index, const QString &name, const QString &pattern);
00085     void remove(int index);
00089     void move(int from, int to);
00095     void execEdit(int index, QWidget *parent = 0);
00101     void execInsert(int index, QWidget *parent = 0);
00105     int count();
00109     const QString name(int index) const;
00113     const QString pattern(int index) const;
00120     void setData(int index, int key, const QVariant &data);
00126     const QVariant data(int index, int key) const;
00127 
00128 signals:
00133     void columnAdded(int index);
00138     void columnRemoved(int index);
00143     void columnChanged(int index);
00147     void columnMoved(int from, int to);
00151     void headerChanged();
00152 
00153 private:
00154     void updatePlayLists();
00155 
00156     struct ColumnHeader
00157     {
00158         QString name;
00159         QString pattern;
00160         QHash<int, QVariant> data;
00161     };
00162     QList<ColumnHeader> m_columns;
00163     bool m_settings_loaded;
00164     MetaDataHelper *m_helper;
00165 };
00166 
00167 #endif // COLUMNMANAGER_H
 All Classes Functions Variables Enumerations Enumerator