1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "projectfiles.h"
24 ProjectFiles::ProjectFiles(QHash
<QString
, QString
>& settings
,
25 ProjectNode
* parent
): parentLink(parent
)
35 for(int i
= 0; i
< keys
.count(); i
++)
37 QString file
= settings
.value(keys
[i
], "");
38 if(file
!= "" && file
!= "-")
40 file
.replace("/.rockbox/", "");
41 children
.append(new ProjectFile(file
, this));
46 ProjectFiles::~ProjectFiles()
48 for(int i
= 0; i
< children
.count(); i
++)
52 ProjectNode
* ProjectFiles::parent() const
57 ProjectNode
* ProjectFiles::child(int row
) const
59 if(row
>= 0 && row
< children
.count())
65 int ProjectFiles::numChildren() const
67 return children
.count();
70 int ProjectFiles::row() const
72 return parentLink
->indexOf(const_cast<ProjectFiles
*>(this));
75 QVariant
ProjectFiles::data(int column
) const
78 return QObject::tr("Project Files");
83 Qt::ItemFlags
ProjectFiles::flags(int column
) const
86 return Qt::ItemIsEnabled
| Qt::ItemIsSelectable
;
91 void ProjectFiles::activated()
96 /* Project File functions */
97 ProjectFile::ProjectFile(QString file
, ProjectNode
* parent
) :
98 parentLink(parent
), file(file
)
103 ProjectFile::~ProjectFile()
108 QVariant
ProjectFile::data(int column
) const
116 Qt::ItemFlags
ProjectFile::flags(int column
) const
119 return Qt::ItemIsEnabled
| Qt::ItemIsSelectable
;
124 void ProjectFile::activated()