diff options
Diffstat (limited to 'rbutil/rbutilqt/base/rockboxinfo.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/rockboxinfo.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/rockboxinfo.cpp b/rbutil/rbutilqt/base/rockboxinfo.cpp new file mode 100644 index 0000000000..f85c23b669 --- /dev/null +++ b/rbutil/rbutilqt/base/rockboxinfo.cpp | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id$ | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "rockboxinfo.h" | ||
21 | |||
22 | #include <QtCore> | ||
23 | #include <QDebug> | ||
24 | |||
25 | RockboxInfo::RockboxInfo(QString mountpoint) | ||
26 | { | ||
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; | ||
32 | |||
33 | if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) | ||
34 | return; | ||
35 | |||
36 | // read file contents | ||
37 | while (!file.atEnd()) | ||
38 | { | ||
39 | QString line = file.readLine(); | ||
40 | |||
41 | if(line.contains("Version:")) | ||
42 | { | ||
43 | m_version = line.remove("Version:").trimmed(); | ||
44 | } | ||
45 | else if(line.contains("Target: ")) | ||
46 | { | ||
47 | m_target = line.remove("Target: ").trimmed(); | ||
48 | } | ||
49 | else if(line.contains("Features:")) | ||
50 | { | ||
51 | m_features = line.remove("Features:").trimmed(); | ||
52 | } | ||
53 | else if(line.contains("Target id:")) | ||
54 | { | ||
55 | m_targetid = line.remove("Target id:").trimmed(); | ||
56 | } | ||
57 | else if(line.contains("Memory:")) | ||
58 | { | ||
59 | m_ram = line.remove("Memory:").trimmed().toInt(); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | file.close(); | ||
64 | m_success = true; | ||
65 | return; | ||
66 | } | ||
67 | |||