2010-06-08 21:30:28 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Robert Bieber
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef PROJECTMODEL_H
|
|
|
|
#define PROJECTMODEL_H
|
|
|
|
|
2010-06-14 06:20:07 +00:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QMap>
|
2010-06-08 21:30:28 +00:00
|
|
|
|
2010-06-09 21:37:15 +00:00
|
|
|
class EditorWindow;
|
2010-06-08 21:30:28 +00:00
|
|
|
|
2010-06-14 06:20:07 +00:00
|
|
|
class ProjectModel : public QAbstractListModel
|
2010-06-08 21:30:28 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2010-06-10 07:51:21 +00:00
|
|
|
static const int numColumns = 2;
|
2010-06-08 21:30:28 +00:00
|
|
|
|
2010-06-09 07:51:22 +00:00
|
|
|
static QString fileFilter()
|
|
|
|
{
|
|
|
|
return QObject::tr("Project Files (*.cfg);;All Files (*.*)");
|
|
|
|
}
|
|
|
|
|
2010-06-09 21:37:15 +00:00
|
|
|
ProjectModel(QString config, EditorWindow* mainWindow, QObject *parent = 0);
|
2010-06-08 21:30:28 +00:00
|
|
|
virtual ~ProjectModel();
|
|
|
|
|
2010-06-14 06:20:07 +00:00
|
|
|
int rowCount(const QModelIndex& parent) const;
|
2010-06-08 21:30:28 +00:00
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
|
2010-06-17 06:59:46 +00:00
|
|
|
QString getSetting(QString key, QString fallback = "")
|
|
|
|
{
|
|
|
|
return settings.value(key, fallback);
|
|
|
|
}
|
2010-06-15 06:54:58 +00:00
|
|
|
|
2010-06-21 20:11:58 +00:00
|
|
|
const QMap<QString, QString>& getSettings() const{ return settings; }
|
|
|
|
|
2010-06-08 21:30:28 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
2010-06-09 21:37:15 +00:00
|
|
|
void activated(const QModelIndex& index);
|
2010-06-08 21:30:28 +00:00
|
|
|
|
|
|
|
private:
|
2010-06-09 21:37:15 +00:00
|
|
|
EditorWindow* mainWindow;
|
2010-06-14 06:20:07 +00:00
|
|
|
QMap<QString, QString> settings;
|
|
|
|
QList<QString> files;
|
2010-06-08 21:30:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROJECTMODEL_H
|