Use a nice apostroph
[kugel-rb.git] / rbutil / rbutilqt / base / rockboxinfo.cpp
blobf85c23b6690f96f584253311a19b8e9e8ba7dbaf
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();
45 else if(line.contains("Target: "))
47 m_target = line.remove("Target: ").trimmed();
49 else if(line.contains("Features:"))
51 m_features = line.remove("Features:").trimmed();
53 else if(line.contains("Target id:"))
55 m_targetid = line.remove("Target id:").trimmed();
57 else if(line.contains("Memory:"))
59 m_ram = line.remove("Memory:").trimmed().toInt();
63 file.close();
64 m_success = true;
65 return;