MPEGPlayer: Skip to next file when there is a problem with a video file in all-play...
[kugel-rb.git] / rbutil / rbutilqt / base / rockboxinfo.cpp
blob6bfffc1b2392e29ecb3adff077df72ea8f429713
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "rockboxinfo.h"
22 #include <QtCore>
23 #include <QDebug>
25 RockboxInfo::RockboxInfo(QString mountpoint)
27 qDebug() << "[RockboxInfo] trying to find rockbox-info at" << mountpoint;
28 QFile file(mountpoint + "/.rockbox/rockbox-info.txt");
29 m_success = false;
30 if(!file.exists())
31 return;
33 if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
34 return;
36 // read file contents
37 while (!file.atEnd())
39 QString line = file.readLine();
41 if(line.contains("Version:"))
43 m_version = line.remove("Version:").trimmed();
44 if(m_version.startsWith("r")) {
45 m_revision = m_version;
46 m_revision.remove("r").replace(QRegExp("-.+$"), "");
47 m_release = "";
49 else {
50 m_release = m_version;
51 m_revision = "";
54 else if(line.contains("Target: "))
56 m_target = line.remove("Target: ").trimmed();
58 else if(line.contains("Features:"))
60 m_features = line.remove("Features:").trimmed();
62 else if(line.contains("Target id:"))
64 m_targetid = line.remove("Target id:").trimmed();
66 else if(line.contains("Memory:"))
68 m_ram = line.remove("Memory:").trimmed().toInt();
72 file.close();
73 m_success = true;
74 return;