summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp1
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.cpp4
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallfile.cpp20
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallmi4.cpp14
-rw-r--r--rbutil/rbutilqt/base/encoders.cpp2
-rw-r--r--rbutil/rbutilqt/base/rockboxinfo.cpp67
-rw-r--r--rbutil/rbutilqt/base/rockboxinfo.h49
-rw-r--r--rbutil/rbutilqt/base/ttsexes.cpp2
-rw-r--r--rbutil/rbutilqt/base/ttsfestival.cpp4
-rw-r--r--rbutil/rbutilqt/base/uninstall.cpp2
-rw-r--r--rbutil/rbutilqt/base/utils.cpp63
-rw-r--r--rbutil/rbutilqt/base/utils.h28
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp1
-rw-r--r--rbutil/rbutilqt/base/zipinstaller.cpp2
-rw-r--r--rbutil/rbutilqt/configure.cpp4
-rw-r--r--rbutil/rbutilqt/installwindow.cpp3
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp3
-rw-r--r--rbutil/rbutilqt/rbutilqt.pri2
-rw-r--r--rbutil/rbutilqt/sysinfo.cpp2
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.cpp2
20 files changed, 170 insertions, 105 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 98d24c3369..f233f0c3fd 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -54,6 +54,7 @@
54 54
55#include "system.h" 55#include "system.h"
56#include "utils.h" 56#include "utils.h"
57#include "rockboxinfo.h"
57 58
58Autodetection::Autodetection(QObject* parent): QObject(parent) 59Autodetection::Autodetection(QObject* parent): QObject(parent)
59{ 60{
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
index f6fb33dcd4..6a2db76392 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
@@ -114,7 +114,7 @@ bool BootloaderInstallBase::backup(QString to)
114 } 114 }
115 QString tofile = to + "/" + QFileInfo(m_blfile).fileName(); 115 QString tofile = to + "/" + QFileInfo(m_blfile).fileName();
116 qDebug() << "[BootloaderInstallBase] trying to backup" << m_blfile << "to" << tofile; 116 qDebug() << "[BootloaderInstallBase] trying to backup" << m_blfile << "to" << tofile;
117 if(!QFile::copy(resolvePathCase(m_blfile), tofile)) { 117 if(!QFile::copy(Utils::resolvePathCase(m_blfile), tofile)) {
118 emit logItem(tr("Creating backup copy failed."), LOGERROR); 118 emit logItem(tr("Creating backup copy failed."), LOGERROR);
119 return false; 119 return false;
120 } 120 }
@@ -247,7 +247,7 @@ void BootloaderInstallBase::setBlFile(QStringList sl)
247{ 247{
248 // figue which of the possible bootloader filenames is correct. 248 // figue which of the possible bootloader filenames is correct.
249 for(int a = 0; a < sl.size(); a++) { 249 for(int a = 0; a < sl.size(); a++) {
250 if(!resolvePathCase(sl.at(a)).isEmpty()) { 250 if(!Utils::resolvePathCase(sl.at(a)).isEmpty()) {
251 m_blfile = sl.at(a); 251 m_blfile = sl.at(a);
252 } 252 }
253 } 253 }
diff --git a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp
index 2e7061036d..7649f50e2a 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp
@@ -45,16 +45,16 @@ void BootloaderInstallFile::installStage2(void)
45 QCoreApplication::processEvents(); 45 QCoreApplication::processEvents();
46 46
47 // if an old bootloader is present (Gigabeat) move it out of the way. 47 // if an old bootloader is present (Gigabeat) move it out of the way.
48 QString fwfile(resolvePathCase(m_blfile)); 48 QString fwfile(Utils::resolvePathCase(m_blfile));
49 if(!fwfile.isEmpty()) { 49 if(!fwfile.isEmpty()) {
50 QString moved = resolvePathCase(m_blfile) + ".ORIG"; 50 QString moved = Utils::resolvePathCase(m_blfile) + ".ORIG";
51 qDebug() << "[BootloaderInstallFile] renaming" << fwfile << "to" << moved; 51 qDebug() << "[BootloaderInstallFile] renaming" << fwfile << "to" << moved;
52 QFile::rename(fwfile, moved); 52 QFile::rename(fwfile, moved);
53 } 53 }
54 54
55 // if no old file found resolve path without basename 55 // if no old file found resolve path without basename
56 QFileInfo fi(m_blfile); 56 QFileInfo fi(m_blfile);
57 QString absPath = resolvePathCase(fi.absolutePath()); 57 QString absPath = Utils::resolvePathCase(fi.absolutePath());
58 58
59 // if it's not possible to locate the base path try to create it 59 // if it's not possible to locate the base path try to create it
60 if(absPath.isEmpty()) { 60 if(absPath.isEmpty()) {
@@ -67,10 +67,10 @@ void BootloaderInstallFile::installStage2(void)
67 QString basePath = pathElements.join("/"); 67 QString basePath = pathElements.join("/");
68 68
69 // check for base and bail out if not found. Otherwise create folder. 69 // check for base and bail out if not found. Otherwise create folder.
70 absPath = resolvePathCase(basePath); 70 absPath = Utils::resolvePathCase(basePath);
71 QDir d(absPath); 71 QDir d(absPath);
72 d.mkpath(lastElement); 72 d.mkpath(lastElement);
73 absPath = resolvePathCase(fi.absolutePath()); 73 absPath = Utils::resolvePathCase(fi.absolutePath());
74 74
75 if(absPath.isEmpty()) { 75 if(absPath.isEmpty()) {
76 emit logItem(tr("Error accessing output folder"), LOGERROR); 76 emit logItem(tr("Error accessing output folder"), LOGERROR);
@@ -98,13 +98,13 @@ bool BootloaderInstallFile::uninstall(void)
98 qDebug() << "[BootloaderInstallFile] Uninstalling bootloader"; 98 qDebug() << "[BootloaderInstallFile] Uninstalling bootloader";
99 emit logItem(tr("Removing Rockbox bootloader"), LOGINFO); 99 emit logItem(tr("Removing Rockbox bootloader"), LOGINFO);
100 // check if a .ORIG file is present, and allow moving it back. 100 // check if a .ORIG file is present, and allow moving it back.
101 QString origbl = resolvePathCase(m_blfile + ".ORIG"); 101 QString origbl = Utils::resolvePathCase(m_blfile + ".ORIG");
102 if(origbl.isEmpty()) { 102 if(origbl.isEmpty()) {
103 emit logItem(tr("No original firmware file found."), LOGERROR); 103 emit logItem(tr("No original firmware file found."), LOGERROR);
104 emit done(true); 104 emit done(true);
105 return false; 105 return false;
106 } 106 }
107 QString fwfile = resolvePathCase(m_blfile); 107 QString fwfile = Utils::resolvePathCase(m_blfile);
108 if(!QFile::remove(fwfile)) { 108 if(!QFile::remove(fwfile)) {
109 emit logItem(tr("Can't remove Rockbox bootloader file."), LOGERROR); 109 emit logItem(tr("Can't remove Rockbox bootloader file."), LOGERROR);
110 emit done(true); 110 emit done(true);
@@ -128,10 +128,10 @@ bool BootloaderInstallFile::uninstall(void)
128BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void) 128BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
129{ 129{
130 qDebug() << "[BootloaderInstallFile] checking installed bootloader"; 130 qDebug() << "[BootloaderInstallFile] checking installed bootloader";
131 if(!resolvePathCase(m_blfile).isEmpty() 131 if(!Utils::resolvePathCase(m_blfile).isEmpty()
132 && !resolvePathCase(m_blfile + ".ORIG").isEmpty()) 132 && !Utils::resolvePathCase(m_blfile + ".ORIG").isEmpty())
133 return BootloaderRockbox; 133 return BootloaderRockbox;
134 else if(!resolvePathCase(m_blfile).isEmpty()) 134 else if(!Utils::resolvePathCase(m_blfile).isEmpty())
135 return BootloaderOther; 135 return BootloaderOther;
136 else 136 else
137 return BootloaderUnknown; 137 return BootloaderUnknown;
diff --git a/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp b/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp
index 936ad175c3..859ed2ca04 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp
@@ -44,9 +44,9 @@ void BootloaderInstallMi4::installStage2(void)
44 QCoreApplication::processEvents(); 44 QCoreApplication::processEvents();
45 45
46 // move old bootloader out of the way 46 // move old bootloader out of the way
47 QString fwfile(resolvePathCase(m_blfile)); 47 QString fwfile(Utils::resolvePathCase(m_blfile));
48 QFile oldbl(fwfile); 48 QFile oldbl(fwfile);
49 QString moved = QFileInfo(resolvePathCase(m_blfile)).absolutePath() 49 QString moved = QFileInfo(Utils::resolvePathCase(m_blfile)).absolutePath()
50 + "/OF.mi4"; 50 + "/OF.mi4";
51 if(!QFileInfo(moved).exists()) { 51 if(!QFileInfo(moved).exists()) {
52 qDebug() << "[BootloaderInstallMi4] renaming" << fwfile << "to" << moved; 52 qDebug() << "[BootloaderInstallMi4] renaming" << fwfile << "to" << moved;
@@ -83,20 +83,20 @@ bool BootloaderInstallMi4::uninstall(void)
83 83
84 // check if OF file present 84 // check if OF file present
85 emit logItem(tr("Checking for original firmware file"), LOGINFO); 85 emit logItem(tr("Checking for original firmware file"), LOGINFO);
86 QString original = QFileInfo(resolvePathCase(m_blfile)).absolutePath() 86 QString original = QFileInfo(Utils::resolvePathCase(m_blfile)).absolutePath()
87 + "/OF.mi4"; 87 + "/OF.mi4";
88 88
89 if(resolvePathCase(original).isEmpty()) { 89 if(Utils::resolvePathCase(original).isEmpty()) {
90 emit logItem(tr("Error finding original firmware file"), LOGERROR); 90 emit logItem(tr("Error finding original firmware file"), LOGERROR);
91 return false; 91 return false;
92 } 92 }
93 93
94 // finally remove RB bootloader 94 // finally remove RB bootloader
95 QString resolved = resolvePathCase(m_blfile); 95 QString resolved = Utils::resolvePathCase(m_blfile);
96 QFile blfile(resolved); 96 QFile blfile(resolved);
97 blfile.remove(); 97 blfile.remove();
98 98
99 QFile::rename(resolvePathCase(original), m_blfile); 99 QFile::rename(Utils::resolvePathCase(original), m_blfile);
100 emit logItem(tr("Rockbox bootloader successful removed"), LOGINFO); 100 emit logItem(tr("Rockbox bootloader successful removed"), LOGINFO);
101 logInstall(LogRemove); 101 logInstall(LogRemove);
102 emit done(false); 102 emit done(false);
@@ -114,7 +114,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
114 114
115 // make sure to resolve case to prevent case issues 115 // make sure to resolve case to prevent case issues
116 QString resolved; 116 QString resolved;
117 resolved = resolvePathCase(m_blfile); 117 resolved = Utils::resolvePathCase(m_blfile);
118 if(resolved.isEmpty()) { 118 if(resolved.isEmpty()) {
119 qDebug() << "[BootloaderInstallMi4] installed: BootloaderNone"; 119 qDebug() << "[BootloaderInstallMi4] installed: BootloaderNone";
120 return BootloaderNone; 120 return BootloaderNone;
diff --git a/rbutil/rbutilqt/base/encoders.cpp b/rbutil/rbutilqt/base/encoders.cpp
index 7f4163a34f..3b9e1432ed 100644
--- a/rbutil/rbutilqt/base/encoders.cpp
+++ b/rbutil/rbutilqt/base/encoders.cpp
@@ -89,7 +89,7 @@ EncExes::EncExes(QString name,QObject *parent) : EncBase(parent)
89void EncExes::generateSettings() 89void EncExes::generateSettings()
90{ 90{
91 QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString(); 91 QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString();
92 if(exepath == "") exepath = findExecutable(m_name); 92 if(exepath == "") exepath = Utils::findExecutable(m_name);
93 93
94 insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING, 94 insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,
95 tr("Path to Encoder:"),exepath,EncTtsSetting::eBROWSEBTN)); 95 tr("Path to Encoder:"),exepath,EncTtsSetting::eBROWSEBTN));
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
25RockboxInfo::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
diff --git a/rbutil/rbutilqt/base/rockboxinfo.h b/rbutil/rbutilqt/base/rockboxinfo.h
new file mode 100644
index 0000000000..4d704f8f72
--- /dev/null
+++ b/rbutil/rbutilqt/base/rockboxinfo.h
@@ -0,0 +1,49 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#ifndef ROCKBOXINFO_H
24#define ROCKBOXINFO_H
25
26#include <QString>
27
28class RockboxInfo
29{
30public:
31 RockboxInfo(QString mountpoint);
32
33 QString version() {return m_version;}
34 QString features(){return m_features;}
35 QString targetID() {return m_targetid;}
36 QString target() {return m_target;}
37 int ram() { return m_ram; }
38 bool success() { return m_success; }
39private:
40 QString m_version;
41 QString m_features;
42 QString m_targetid;
43 QString m_target;
44 int m_ram;
45 bool m_success;
46};
47
48#endif
49
diff --git a/rbutil/rbutilqt/base/ttsexes.cpp b/rbutil/rbutilqt/base/ttsexes.cpp
index 05ed23b41d..bd14e2a9ee 100644
--- a/rbutil/rbutilqt/base/ttsexes.cpp
+++ b/rbutil/rbutilqt/base/ttsexes.cpp
@@ -34,7 +34,7 @@ TTSExes::TTSExes(QString name,QObject* parent) : TTSBase(parent)
34void TTSExes::generateSettings() 34void TTSExes::generateSettings()
35{ 35{
36 QString exepath =RbSettings::subValue(m_name,RbSettings::TtsPath).toString(); 36 QString exepath =RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
37 if(exepath == "") exepath = findExecutable(m_name); 37 if(exepath == "") exepath = Utils::findExecutable(m_name);
38 38
39 insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING, 39 insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,
40 tr("Path to TTS engine:"),exepath,EncTtsSetting::eBROWSEBTN)); 40 tr("Path to TTS engine:"),exepath,EncTtsSetting::eBROWSEBTN));
diff --git a/rbutil/rbutilqt/base/ttsfestival.cpp b/rbutil/rbutilqt/base/ttsfestival.cpp
index be67b67bd2..7cad16d3dd 100644
--- a/rbutil/rbutilqt/base/ttsfestival.cpp
+++ b/rbutil/rbutilqt/base/ttsfestival.cpp
@@ -32,7 +32,7 @@ void TTSFestival::generateSettings()
32 // server path 32 // server path
33 QString exepath = RbSettings::subValue("festival-server", 33 QString exepath = RbSettings::subValue("festival-server",
34 RbSettings::TtsPath).toString(); 34 RbSettings::TtsPath).toString();
35 if(exepath == "" ) exepath = findExecutable("festival"); 35 if(exepath == "" ) exepath = Utils::findExecutable("festival");
36 insertSetting(eSERVERPATH,new EncTtsSetting(this, 36 insertSetting(eSERVERPATH,new EncTtsSetting(this,
37 EncTtsSetting::eSTRING, "Path to Festival server:", 37 EncTtsSetting::eSTRING, "Path to Festival server:",
38 exepath,EncTtsSetting::eBROWSEBTN)); 38 exepath,EncTtsSetting::eBROWSEBTN));
@@ -40,7 +40,7 @@ void TTSFestival::generateSettings()
40 // client path 40 // client path
41 QString clientpath = RbSettings::subValue("festival-client", 41 QString clientpath = RbSettings::subValue("festival-client",
42 RbSettings::TtsPath).toString(); 42 RbSettings::TtsPath).toString();
43 if(clientpath == "" ) clientpath = findExecutable("festival_client"); 43 if(clientpath == "" ) clientpath = Utils::findExecutable("festival_client");
44 insertSetting(eCLIENTPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING, 44 insertSetting(eCLIENTPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,
45 tr("Path to Festival client:"), 45 tr("Path to Festival client:"),
46 clientpath,EncTtsSetting::eBROWSEBTN)); 46 clientpath,EncTtsSetting::eBROWSEBTN));
diff --git a/rbutil/rbutilqt/base/uninstall.cpp b/rbutil/rbutilqt/base/uninstall.cpp
index 15ada35c5e..2f3b3c767f 100644
--- a/rbutil/rbutilqt/base/uninstall.cpp
+++ b/rbutil/rbutilqt/base/uninstall.cpp
@@ -32,7 +32,7 @@ void Uninstaller::deleteAll(ProgressloggerInterface* dp)
32 QString rbdir(m_mountpoint + ".rockbox/"); 32 QString rbdir(m_mountpoint + ".rockbox/");
33 m_dp->addItem(tr("Starting Uninstallation"),LOGINFO); 33 m_dp->addItem(tr("Starting Uninstallation"),LOGINFO);
34 m_dp->setProgressMax(0); 34 m_dp->setProgressMax(0);
35 recRmdir(rbdir); 35 Utils::recursiveRmdir(rbdir);
36 m_dp->setProgressMax(1); 36 m_dp->setProgressMax(1);
37 m_dp->setProgressValue(1); 37 m_dp->setProgressValue(1);
38 m_dp->addItem(tr("Finished Uninstallation"),LOGOK); 38 m_dp->addItem(tr("Finished Uninstallation"),LOGOK);
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 623dfebe2f..767b3c1c52 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -18,6 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "utils.h" 20#include "utils.h"
21#include "rockboxinfo.h"
21#include "system.h" 22#include "system.h"
22#include "rbsettings.h" 23#include "rbsettings.h"
23#include "systeminfo.h" 24#include "systeminfo.h"
@@ -41,7 +42,7 @@
41#endif 42#endif
42 43
43// recursive function to delete a dir with files 44// recursive function to delete a dir with files
44bool recRmdir( const QString &dirName ) 45bool Utils::recursiveRmdir( const QString &dirName )
45{ 46{
46 QString dirN = dirName; 47 QString dirN = dirName;
47 QDir dir(dirN); 48 QDir dir(dirN);
@@ -54,19 +55,21 @@ bool recRmdir( const QString &dirName )
54 curItem = dirN + "/" + name; 55 curItem = dirN + "/" + name;
55 fileInfo.setFile(curItem); 56 fileInfo.setFile(curItem);
56 if(fileInfo.isDir()) // is directory 57 if(fileInfo.isDir()) // is directory
57 recRmdir(curItem); // call recRmdir() recursively for deleting subdirectory 58 recursiveRmdir(curItem); // call recRmdir() recursively for
59 // deleting subdirectory
58 else // is file 60 else // is file
59 QFile::remove(curItem); // ok, delete file 61 QFile::remove(curItem); // ok, delete file
60 } 62 }
61 dir.cdUp(); 63 dir.cdUp();
62 return dir.rmdir(dirN); // delete empty dir and return if (now empty) dir-removing was successfull 64 return dir.rmdir(dirN); // delete empty dir and return if (now empty)
65 // dir-removing was successfull
63} 66}
64 67
65 68
66//! @brief resolves the given path, ignoring case. 69//! @brief resolves the given path, ignoring case.
67//! @param path absolute path to resolve. 70//! @param path absolute path to resolve.
68//! @return returns exact casing of path, empty string if path not found. 71//! @return returns exact casing of path, empty string if path not found.
69QString resolvePathCase(QString path) 72QString Utils::resolvePathCase(QString path)
70{ 73{
71 QStringList elems; 74 QStringList elems;
72 QString realpath; 75 QString realpath;
@@ -110,7 +113,7 @@ QString resolvePathCase(QString path)
110//! @brief figure the free disk space on a filesystem 113//! @brief figure the free disk space on a filesystem
111//! @param path path on the filesystem to check 114//! @param path path on the filesystem to check
112//! @return size in bytes 115//! @return size in bytes
113qulonglong filesystemFree(QString path) 116qulonglong Utils::filesystemFree(QString path)
114{ 117{
115 qlonglong size = 0; 118 qlonglong size = 0;
116#if defined(Q_OS_LINUX) || defined(Q_OS_MACX) 119#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
@@ -135,7 +138,7 @@ qulonglong filesystemFree(QString path)
135} 138}
136 139
137//! \brief searches for a Executable in the Environement Path 140//! \brief searches for a Executable in the Environement Path
138QString findExecutable(QString name) 141QString Utils::findExecutable(QString name)
139{ 142{
140 QString exepath; 143 QString exepath;
141 //try autodetect tts 144 //try autodetect tts
@@ -167,7 +170,7 @@ QString findExecutable(QString name)
167 * @param permission if it should check for permission 170 * @param permission if it should check for permission
168 * @return string with error messages if problems occurred, empty strings if none. 171 * @return string with error messages if problems occurred, empty strings if none.
169 */ 172 */
170QString check(bool permission) 173QString Utils::checkEnvironment(bool permission)
171{ 174{
172 QString text = ""; 175 QString text = "";
173 176
@@ -201,47 +204,3 @@ QString check(bool permission)
201 return text; 204 return text;
202} 205}
203 206
204
205RockboxInfo::RockboxInfo(QString mountpoint)
206{
207 qDebug() << "[RockboxInfo] trying to find rockbox-info at" << mountpoint;
208 QFile file(mountpoint + "/.rockbox/rockbox-info.txt");
209 m_success = false;
210 if(!file.exists())
211 return;
212
213 if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
214 return;
215
216 // read file contents
217 while (!file.atEnd())
218 {
219 QString line = file.readLine();
220
221 if(line.contains("Version:"))
222 {
223 m_version = line.remove("Version:").trimmed();
224 }
225 else if(line.contains("Target: "))
226 {
227 m_target = line.remove("Target: ").trimmed();
228 }
229 else if(line.contains("Features:"))
230 {
231 m_features = line.remove("Features:").trimmed();
232 }
233 else if(line.contains("Target id:"))
234 {
235 m_targetid = line.remove("Target id:").trimmed();
236 }
237 else if(line.contains("Memory:"))
238 {
239 m_ram = line.remove("Memory:").trimmed().toInt();
240 }
241 }
242
243 file.close();
244 m_success = true;
245 return;
246}
247
diff --git a/rbutil/rbutilqt/base/utils.h b/rbutil/rbutilqt/base/utils.h
index ba1989b3c3..cdc3d3be5b 100644
--- a/rbutil/rbutilqt/base/utils.h
+++ b/rbutil/rbutilqt/base/utils.h
@@ -26,30 +26,14 @@
26#include <QString> 26#include <QString>
27#include <QUrl> 27#include <QUrl>
28 28
29bool recRmdir( const QString &dirName ); 29class Utils
30QString resolvePathCase(QString path);
31qulonglong filesystemFree(QString path);
32QString findExecutable(QString name);
33QString check(bool permission);
34
35class RockboxInfo
36{ 30{
37public: 31public:
38 RockboxInfo(QString mountpoint); 32 static bool recursiveRmdir(const QString &dirName);
39 33 static QString resolvePathCase(QString path);
40 QString version() {return m_version;} 34 static qulonglong filesystemFree(QString path);
41 QString features(){return m_features;} 35 static QString findExecutable(QString name);
42 QString targetID() {return m_targetid;} 36 static QString checkEnvironment(bool permission);
43 QString target() {return m_target;}
44 int ram() { return m_ram; }
45 bool success() { return m_success; }
46private:
47 QString m_version;
48 QString m_features;
49 QString m_targetid;
50 QString m_target;
51 int m_ram;
52 bool m_success;
53}; 37};
54 38
55#endif 39#endif
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index ccdf6f7f9a..208cd1eeb8 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -19,6 +19,7 @@
19 19
20#include "voicefile.h" 20#include "voicefile.h"
21#include "utils.h" 21#include "utils.h"
22#include "rockboxinfo.h"
22#include "rbsettings.h" 23#include "rbsettings.h"
23#include "systeminfo.h" 24#include "systeminfo.h"
24 25
diff --git a/rbutil/rbutilqt/base/zipinstaller.cpp b/rbutil/rbutilqt/base/zipinstaller.cpp
index 6a59cdad02..1822d3c9ed 100644
--- a/rbutil/rbutilqt/base/zipinstaller.cpp
+++ b/rbutil/rbutilqt/base/zipinstaller.cpp
@@ -148,7 +148,7 @@ void ZipInstaller::downloadDone(bool error)
148 // check for free space. Make sure after installation will still be 148 // check for free space. Make sure after installation will still be
149 // some room for operating (also includes calculation mistakes due to 149 // some room for operating (also includes calculation mistakes due to
150 // cluster sizes on the player). 150 // cluster sizes on the player).
151 if(filesystemFree(m_mountpoint) < (uz.totalSize() + 1000000)) { 151 if(Utils::filesystemFree(m_mountpoint) < (uz.totalSize() + 1000000)) {
152 emit logItem(tr("Not enough disk space! Aborting."), LOGERROR); 152 emit logItem(tr("Not enough disk space! Aborting."), LOGERROR);
153 emit logProgress(1, 1); 153 emit logProgress(1, 1);
154 emit done(true); 154 emit done(true);
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 3411717398..7ed74f1b9e 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -756,8 +756,8 @@ void Config::testTts()
756 } 756 }
757 tts->stop(); 757 tts->stop();
758#if defined(Q_OS_LINUX) 758#if defined(Q_OS_LINUX)
759 QString exe = findExecutable("aplay"); 759 QString exe = Utils::findExecutable("aplay");
760 if(exe == "") exe = findExecutable("play"); 760 if(exe == "") exe = Utils::findExecutable("play");
761 if(exe != "") 761 if(exe != "")
762 { 762 {
763 QProcess::execute(exe+" "+filename); 763 QProcess::execute(exe+" "+filename);
diff --git a/rbutil/rbutilqt/installwindow.cpp b/rbutil/rbutilqt/installwindow.cpp
index 9eae0ce09f..7b12303b96 100644
--- a/rbutil/rbutilqt/installwindow.cpp
+++ b/rbutil/rbutilqt/installwindow.cpp
@@ -25,6 +25,7 @@
25#include "serverinfo.h" 25#include "serverinfo.h"
26#include "systeminfo.h" 26#include "systeminfo.h"
27#include "utils.h" 27#include "utils.h"
28#include "rockboxinfo.h"
28 29
29InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) 30InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent)
30{ 31{
@@ -168,7 +169,7 @@ void InstallWindow::accept()
168 169
169 RbSettings::sync(); 170 RbSettings::sync();
170 171
171 QString warning = check(false); 172 QString warning = Utils::checkEnvironment(false);
172 if(!warning.isEmpty()) 173 if(!warning.isEmpty())
173 { 174 {
174 if(QMessageBox::warning(this, tr("Really continue?"), warning, 175 if(QMessageBox::warning(this, tr("Really continue?"), warning,
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 575b381e3b..56d66115c1 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -31,6 +31,7 @@
31#include "themesinstallwindow.h" 31#include "themesinstallwindow.h"
32#include "uninstallwindow.h" 32#include "uninstallwindow.h"
33#include "utils.h" 33#include "utils.h"
34#include "rockboxinfo.h"
34#include "rbzip.h" 35#include "rbzip.h"
35#include "sysinfo.h" 36#include "sysinfo.h"
36#include "system.h" 37#include "system.h"
@@ -556,7 +557,7 @@ bool RbUtilQt::installAuto()
556 file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString()); 557 file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
557 558
558 // check installed Version and Target 559 // check installed Version and Target
559 QString warning = check(false); 560 QString warning = Utils::checkEnvironment(false);
560 if(!warning.isEmpty()) 561 if(!warning.isEmpty())
561 { 562 {
562 if(QMessageBox::warning(this, tr("Really continue?"), warning, 563 if(QMessageBox::warning(this, tr("Really continue?"), warning,
diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri
index c3a16a9b57..53742570df 100644
--- a/rbutil/rbutilqt/rbutilqt.pri
+++ b/rbutil/rbutilqt/rbutilqt.pri
@@ -67,6 +67,7 @@ SOURCES += \
67 base/bootloaderinstallchinachip.cpp \ 67 base/bootloaderinstallchinachip.cpp \
68 base/bootloaderinstallams.cpp \ 68 base/bootloaderinstallams.cpp \
69 base/bootloaderinstalltcc.cpp \ 69 base/bootloaderinstalltcc.cpp \
70 base/rockboxinfo.cpp \
70 ../../tools/mkboot.c \ 71 ../../tools/mkboot.c \
71 ../../tools/iriver.c \ 72 ../../tools/iriver.c \
72 73
@@ -132,6 +133,7 @@ HEADERS += \
132 base/bootloaderinstallchinachip.h \ 133 base/bootloaderinstallchinachip.h \
133 base/bootloaderinstallams.h \ 134 base/bootloaderinstallams.h \
134 base/bootloaderinstalltcc.h \ 135 base/bootloaderinstalltcc.h \
136 base/rockboxinfo.h \
135 ../../tools/mkboot.h \ 137 ../../tools/mkboot.h \
136 ../../tools/iriver.h \ 138 ../../tools/iriver.h \
137 139
diff --git a/rbutil/rbutilqt/sysinfo.cpp b/rbutil/rbutilqt/sysinfo.cpp
index 65818df068..a9fa5999b7 100644
--- a/rbutil/rbutilqt/sysinfo.cpp
+++ b/rbutil/rbutilqt/sysinfo.cpp
@@ -65,7 +65,7 @@ QString Sysinfo::getInfo()
65 for(int i = 0; i < drives.size(); i++) { 65 for(int i = 0; i < drives.size(); i++) {
66 info += tr("%1, %2 MiB available") 66 info += tr("%1, %2 MiB available")
67 .arg(QDir::toNativeSeparators(drives.at(i))) 67 .arg(QDir::toNativeSeparators(drives.at(i)))
68 .arg(filesystemFree(drives.at(i)) / (1024*1024)); 68 .arg(Utils::filesystemFree(drives.at(i)) / (1024*1024));
69 if(i + 1 < drives.size()) 69 if(i + 1 < drives.size())
70 info += "<br/>"; 70 info += "<br/>";
71 } 71 }
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp
index 4c75d431fb..0f7ecef065 100644
--- a/rbutil/rbutilqt/themesinstallwindow.cpp
+++ b/rbutil/rbutilqt/themesinstallwindow.cpp
@@ -50,7 +50,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
50ThemesInstallWindow::~ThemesInstallWindow() 50ThemesInstallWindow::~ThemesInstallWindow()
51{ 51{
52 if(infocachedir!="") 52 if(infocachedir!="")
53 recRmdir(infocachedir); 53 Utils::recursiveRmdir(infocachedir);
54} 54}
55 55
56 56