diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2008-05-11 18:22:42 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2008-05-11 18:22:42 +0000 |
commit | d24eb9e461ca1d25a83d825d355710ebdbe509b5 (patch) | |
tree | 117e5f9e22aa0d4de63f32d27e86e0d471a683e5 | |
parent | 9c54187678281077b8700c1c107f54a0b40d7050 (diff) | |
download | rockbox-d24eb9e461ca1d25a83d825d355710ebdbe509b5.tar.gz rockbox-d24eb9e461ca1d25a83d825d355710ebdbe509b5.zip |
rbutil: improve the backup function.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17463 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | rbutil/rbutilqt/install.cpp | 69 | ||||
-rw-r--r-- | rbutil/rbutilqt/install.h | 9 | ||||
-rw-r--r-- | rbutil/rbutilqt/installfrm.ui | 101 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 40 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.h | 1 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbzip.cpp | 14 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbzip.h | 11 | ||||
-rw-r--r-- | rbutil/rbutilqt/utils.cpp | 23 | ||||
-rw-r--r-- | rbutil/rbutilqt/utils.h | 1 |
9 files changed, 203 insertions, 66 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index 4461a6a633..e9f1f61837 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp | |||
@@ -20,15 +20,31 @@ | |||
20 | #include "install.h" | 20 | #include "install.h" |
21 | #include "ui_installfrm.h" | 21 | #include "ui_installfrm.h" |
22 | #include "rbzip.h" | 22 | #include "rbzip.h" |
23 | #include "utils.h" | ||
23 | 24 | ||
24 | Install::Install(QWidget *parent) : QDialog(parent) | 25 | Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent) |
25 | { | 26 | { |
27 | settings = sett; | ||
26 | ui.setupUi(this); | 28 | ui.setupUi(this); |
27 | 29 | ||
28 | connect(ui.radioCurrent, SIGNAL(toggled(bool)), this, SLOT(setCached(bool))); | 30 | connect(ui.radioCurrent, SIGNAL(toggled(bool)), this, SLOT(setCached(bool))); |
29 | connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool))); | 31 | connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool))); |
30 | connect(ui.radioCurrent, SIGNAL(toggled(bool)), this, SLOT(setDetailsCurrent(bool))); | 32 | connect(ui.radioCurrent, SIGNAL(toggled(bool)), this, SLOT(setDetailsCurrent(bool))); |
31 | connect(ui.radioArchived, SIGNAL(toggled(bool)), this, SLOT(setDetailsArchived(bool))); | 33 | connect(ui.radioArchived, SIGNAL(toggled(bool)), this, SLOT(setDetailsArchived(bool))); |
34 | connect(ui.changeBackup,SIGNAL(pressed()),this,SLOT(changeBackupPath())); | ||
35 | |||
36 | //! check if rockbox is already installed | ||
37 | QString version = installedVersion(settings->mountpoint()); | ||
38 | |||
39 | if(version != "") | ||
40 | { | ||
41 | ui.Backupgroup->show(); | ||
42 | ui.backupLocation->setText(settings->mountpoint() + ".backup/rockbox-backup-"+version+".zip"); | ||
43 | } | ||
44 | else | ||
45 | { | ||
46 | ui.Backupgroup->hide(); | ||
47 | } | ||
32 | } | 48 | } |
33 | 49 | ||
34 | 50 | ||
@@ -84,17 +100,32 @@ void Install::accept() | |||
84 | } | 100 | } |
85 | settings->sync(); | 101 | settings->sync(); |
86 | 102 | ||
87 | //! check if rockbox is already installed | 103 | //! check if we should backup |
88 | if(QDir(settings->mountpoint() + "/.rockbox").exists()) | 104 | if(ui.backup->isChecked()) |
89 | { | 105 | { |
90 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), | 106 | logger->addItem(tr("Beginning Backup..."),LOGINFO); |
91 | tr("Rockbox installation detected. Do you want to backup first?"), | 107 | QString backupName = ui.backupLocation->text(); |
92 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) | 108 | |
109 | //! create dir, if it doesnt exist | ||
110 | QFileInfo backupFile(backupName); | ||
111 | if(!QDir(backupFile.path()).exists()) | ||
112 | { | ||
113 | QDir a; | ||
114 | a.mkpath(backupFile.path()); | ||
115 | } | ||
116 | |||
117 | //! create backup | ||
118 | RbZip backup; | ||
119 | connect(&backup,SIGNAL(zipProgress(int,int)),this,SLOT(updateDataReadProgress(int,int))); | ||
120 | if(backup.createZip(backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok) | ||
121 | { | ||
122 | logger->addItem(tr("Backup successfull"),LOGOK); | ||
123 | } | ||
124 | else | ||
93 | { | 125 | { |
94 | QString backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",settings->mountpoint()); | 126 | logger->addItem(tr("Backup failed!"),LOGERROR); |
95 | logger->show(); | 127 | logger->abort(); |
96 | RbZip backup; | 128 | return; |
97 | backup.createZip(backupName,settings->mountpoint() + "/.rockbox",logger); | ||
98 | } | 129 | } |
99 | } | 130 | } |
100 | 131 | ||
@@ -116,6 +147,19 @@ void Install::accept() | |||
116 | 147 | ||
117 | } | 148 | } |
118 | 149 | ||
150 | void Install::changeBackupPath() | ||
151 | { | ||
152 | ui.backupLocation->setText(QFileDialog::getSaveFileName(this,"Select Backup Filename",ui.backupLocation->text())); | ||
153 | } | ||
154 | |||
155 | void Install::updateDataReadProgress(int read, int total) | ||
156 | { | ||
157 | logger->setProgressMax(total); | ||
158 | logger->setProgressValue(read); | ||
159 | //qDebug() << "progress:" << read << "/" << total; | ||
160 | |||
161 | } | ||
162 | |||
119 | // Zip installer has finished | 163 | // Zip installer has finished |
120 | void Install::done(bool error) | 164 | void Install::done(bool error) |
121 | { | 165 | { |
@@ -216,7 +260,4 @@ void Install::setVersionStrings(QMap<QString, QString> ver) | |||
216 | qDebug() << "Install::setVersionStrings" << version; | 260 | qDebug() << "Install::setVersionStrings" << version; |
217 | } | 261 | } |
218 | 262 | ||
219 | void Install::setSettings(RbSettings *sett) | 263 | |
220 | { | ||
221 | settings = sett; | ||
222 | } | ||
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h index db4c06ced4..9c4705697e 100644 --- a/rbutil/rbutilqt/install.h +++ b/rbutil/rbutilqt/install.h | |||
@@ -31,14 +31,15 @@ class Install : public QDialog | |||
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | Install(QWidget *parent = 0); | 34 | Install(RbSettings* sett,QWidget *parent = 0); |
35 | void setSettings(RbSettings* sett); | ||
36 | void setVersionStrings(QMap<QString, QString>); | 35 | void setVersionStrings(QMap<QString, QString>); |
37 | 36 | ||
38 | public slots: | 37 | public slots: |
39 | void accept(void); | 38 | void accept(void); |
40 | 39 | void updateDataReadProgress(int read, int total); | |
41 | private: | 40 | void changeBackupPath(); |
41 | |||
42 | private: | ||
42 | Ui::InstallFrm ui; | 43 | Ui::InstallFrm ui; |
43 | ProgressLoggerGui* logger; | 44 | ProgressLoggerGui* logger; |
44 | RbSettings* settings; | 45 | RbSettings* settings; |
diff --git a/rbutil/rbutilqt/installfrm.ui b/rbutil/rbutilqt/installfrm.ui index f46e8ae69e..6a2a541f64 100644 --- a/rbutil/rbutilqt/installfrm.ui +++ b/rbutil/rbutilqt/installfrm.ui | |||
@@ -16,7 +16,7 @@ | |||
16 | <string>Install Rockbox</string> | 16 | <string>Install Rockbox</string> |
17 | </property> | 17 | </property> |
18 | <layout class="QGridLayout" > | 18 | <layout class="QGridLayout" > |
19 | <item rowspan="6" row="0" column="0" > | 19 | <item rowspan="9" row="0" column="0" > |
20 | <widget class="QLabel" name="label" > | 20 | <widget class="QLabel" name="label" > |
21 | <property name="text" > | 21 | <property name="text" > |
22 | <string/> | 22 | <string/> |
@@ -98,35 +98,12 @@ | |||
98 | </layout> | 98 | </layout> |
99 | </widget> | 99 | </widget> |
100 | </item> | 100 | </item> |
101 | <item row="3" column="1" colspan="2" > | 101 | <item row="8" column="1" > |
102 | <widget class="QCheckBox" name="checkBoxCache" > | ||
103 | <property name="toolTip" > | ||
104 | <string>Rockbox Utility stores copies of Rockbox it has downloaded on the local hard disk to save network traffic. If your local copy is no longer working, tick this box to download a fresh copy.</string> | ||
105 | </property> | ||
106 | <property name="text" > | ||
107 | <string>&Don't use locally cached copy</string> | ||
108 | </property> | ||
109 | </widget> | ||
110 | </item> | ||
111 | <item row="4" column="3" > | ||
112 | <spacer> | ||
113 | <property name="orientation" > | ||
114 | <enum>Qt::Vertical</enum> | ||
115 | </property> | ||
116 | <property name="sizeHint" > | ||
117 | <size> | ||
118 | <width>20</width> | ||
119 | <height>40</height> | ||
120 | </size> | ||
121 | </property> | ||
122 | </spacer> | ||
123 | </item> | ||
124 | <item row="5" column="1" > | ||
125 | <spacer> | 102 | <spacer> |
126 | <property name="orientation" > | 103 | <property name="orientation" > |
127 | <enum>Qt::Horizontal</enum> | 104 | <enum>Qt::Horizontal</enum> |
128 | </property> | 105 | </property> |
129 | <property name="sizeHint" > | 106 | <property name="sizeHint" stdset="0" > |
130 | <size> | 107 | <size> |
131 | <width>40</width> | 108 | <width>40</width> |
132 | <height>20</height> | 109 | <height>20</height> |
@@ -134,7 +111,7 @@ | |||
134 | </property> | 111 | </property> |
135 | </spacer> | 112 | </spacer> |
136 | </item> | 113 | </item> |
137 | <item row="5" column="2" colspan="2" > | 114 | <item row="8" column="2" colspan="2" > |
138 | <layout class="QHBoxLayout" > | 115 | <layout class="QHBoxLayout" > |
139 | <item> | 116 | <item> |
140 | <widget class="QPushButton" name="buttonOk" > | 117 | <widget class="QPushButton" name="buttonOk" > |
@@ -142,7 +119,8 @@ | |||
142 | <string>&Install</string> | 119 | <string>&Install</string> |
143 | </property> | 120 | </property> |
144 | <property name="icon" > | 121 | <property name="icon" > |
145 | <iconset resource="rbutilqt.qrc" >:/icons/go-next.png</iconset> | 122 | <iconset resource="rbutilqt.qrc" > |
123 | <normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset> | ||
146 | </property> | 124 | </property> |
147 | </widget> | 125 | </widget> |
148 | </item> | 126 | </item> |
@@ -152,12 +130,77 @@ | |||
152 | <string>&Cancel</string> | 130 | <string>&Cancel</string> |
153 | </property> | 131 | </property> |
154 | <property name="icon" > | 132 | <property name="icon" > |
155 | <iconset resource="rbutilqt.qrc" >:/icons/process-stop.png</iconset> | 133 | <iconset resource="rbutilqt.qrc" > |
134 | <normaloff>:/icons/process-stop.png</normaloff>:/icons/process-stop.png</iconset> | ||
156 | </property> | 135 | </property> |
157 | </widget> | 136 | </widget> |
158 | </item> | 137 | </item> |
159 | </layout> | 138 | </layout> |
160 | </item> | 139 | </item> |
140 | <item row="7" column="2" > | ||
141 | <spacer> | ||
142 | <property name="orientation" > | ||
143 | <enum>Qt::Vertical</enum> | ||
144 | </property> | ||
145 | <property name="sizeHint" stdset="0" > | ||
146 | <size> | ||
147 | <width>20</width> | ||
148 | <height>40</height> | ||
149 | </size> | ||
150 | </property> | ||
151 | </spacer> | ||
152 | </item> | ||
153 | <item row="3" column="1" colspan="3" > | ||
154 | <widget class="QGroupBox" name="Backupgroup" > | ||
155 | <property name="title" > | ||
156 | <string>Backup</string> | ||
157 | </property> | ||
158 | <layout class="QGridLayout" name="gridLayout" > | ||
159 | <item row="0" column="0" colspan="2" > | ||
160 | <widget class="QCheckBox" name="backup" > | ||
161 | <property name="text" > | ||
162 | <string>Backup before installing</string> | ||
163 | </property> | ||
164 | </widget> | ||
165 | </item> | ||
166 | <item row="1" column="0" > | ||
167 | <widget class="QLabel" name="label_3" > | ||
168 | <property name="text" > | ||
169 | <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> | ||
170 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
171 | p, li { white-space: pre-wrap; } | ||
172 | </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> | ||
173 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Backup Location:</span></p></body></html></string> | ||
174 | </property> | ||
175 | </widget> | ||
176 | </item> | ||
177 | <item row="1" column="1" > | ||
178 | <widget class="QLabel" name="backupLocation" > | ||
179 | <property name="text" > | ||
180 | <string>Backup location</string> | ||
181 | </property> | ||
182 | </widget> | ||
183 | </item> | ||
184 | <item row="1" column="2" > | ||
185 | <widget class="QPushButton" name="changeBackup" > | ||
186 | <property name="text" > | ||
187 | <string>Change</string> | ||
188 | </property> | ||
189 | </widget> | ||
190 | </item> | ||
191 | </layout> | ||
192 | </widget> | ||
193 | </item> | ||
194 | <item row="5" column="1" > | ||
195 | <widget class="QCheckBox" name="checkBoxCache" > | ||
196 | <property name="toolTip" > | ||
197 | <string>Rockbox Utility stores copies of Rockbox it has downloaded on the local hard disk to save network traffic. If your local copy is no longer working, tick this box to download a fresh copy.</string> | ||
198 | </property> | ||
199 | <property name="text" > | ||
200 | <string>&Don't use locally cached copy</string> | ||
201 | </property> | ||
202 | </widget> | ||
203 | </item> | ||
161 | </layout> | 204 | </layout> |
162 | </widget> | 205 | </widget> |
163 | <resources> | 206 | <resources> |
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index f9fbd48568..187e369d32 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -465,16 +465,37 @@ bool RbUtilQt::installAuto() | |||
465 | QString myversion = "r" + versmap.value("bleed_rev"); | 465 | QString myversion = "r" + versmap.value("bleed_rev"); |
466 | 466 | ||
467 | //! check if rockbox is already installed | 467 | //! check if rockbox is already installed |
468 | if(QDir(settings->mountpoint() + "/.rockbox").exists()) | 468 | QString rbVersion = installedVersion(settings->mountpoint()); |
469 | if(rbVersion != "") | ||
469 | { | 470 | { |
470 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), | 471 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), |
471 | tr("Rockbox installation detected. Do you want to backup first?"), | 472 | tr("Rockbox installation detected. Do you want to backup first?"), |
472 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) | 473 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
473 | { | 474 | { |
474 | QString backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",settings->mountpoint()); | 475 | logger->addItem(tr("Beginning Backup..."),LOGINFO); |
475 | logger->show(); | 476 | QString backupName = settings->mountpoint() + ".backup/rockbox-backup-"+rbVersion+".zip"; |
477 | |||
478 | //! create dir, if it doesnt exist | ||
479 | QFileInfo backupFile(backupName); | ||
480 | if(!QDir(backupFile.path()).exists()) | ||
481 | { | ||
482 | QDir a; | ||
483 | a.mkpath(backupFile.path()); | ||
484 | } | ||
485 | |||
486 | //! create backup | ||
476 | RbZip backup; | 487 | RbZip backup; |
477 | backup.createZip(backupName,settings->mountpoint() + "/.rockbox",logger); | 488 | connect(&backup,SIGNAL(zipProgress(int,int)),this,SLOT(updateDataReadProgress(int,int))); |
489 | if(backup.createZip(backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok) | ||
490 | { | ||
491 | logger->addItem(tr("Backup successfull"),LOGOK); | ||
492 | } | ||
493 | else | ||
494 | { | ||
495 | logger->addItem(tr("Backup failed!"),LOGERROR); | ||
496 | logger->abort(); | ||
497 | return false; | ||
498 | } | ||
478 | } | 499 | } |
479 | } | 500 | } |
480 | 501 | ||
@@ -493,10 +514,17 @@ bool RbUtilQt::installAuto() | |||
493 | return true; | 514 | return true; |
494 | } | 515 | } |
495 | 516 | ||
517 | void RbUtilQt::updateDataReadProgress(int read, int total) | ||
518 | { | ||
519 | logger->setProgressMax(total); | ||
520 | logger->setProgressValue(read); | ||
521 | //qDebug() << "progress:" << read << "/" << total; | ||
522 | |||
523 | } | ||
524 | |||
496 | void RbUtilQt::install() | 525 | void RbUtilQt::install() |
497 | { | 526 | { |
498 | Install *installWindow = new Install(this); | 527 | Install *installWindow = new Install(settings,this); |
499 | installWindow->setSettings(settings); | ||
500 | 528 | ||
501 | buildInfo.open(); | 529 | buildInfo.open(); |
502 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 530 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h index 76d05c1175..8de5ea0113 100644 --- a/rbutil/rbutilqt/rbutilqt.h +++ b/rbutil/rbutilqt/rbutilqt.h | |||
@@ -107,6 +107,7 @@ class RbUtilQt : public QMainWindow | |||
107 | void updateInfo(void); | 107 | void updateInfo(void); |
108 | void updateTabs(int); | 108 | void updateTabs(int); |
109 | 109 | ||
110 | void updateDataReadProgress(int read, int total); | ||
110 | }; | 111 | }; |
111 | 112 | ||
112 | #endif | 113 | #endif |
diff --git a/rbutil/rbutilqt/rbzip.cpp b/rbutil/rbutilqt/rbzip.cpp index 23abef89b9..def838dec4 100644 --- a/rbutil/rbutilqt/rbzip.cpp +++ b/rbutil/rbutilqt/rbzip.cpp | |||
@@ -21,14 +21,12 @@ | |||
21 | #include <QtCore> | 21 | #include <QtCore> |
22 | 22 | ||
23 | 23 | ||
24 | Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface *dp) | 24 | Zip::ErrorCode RbZip::createZip(QString zip,QString dir) |
25 | { | 25 | { |
26 | m_logger = dp; | ||
27 | Zip::ErrorCode error = Ok; | 26 | Zip::ErrorCode error = Ok; |
28 | m_curEntry = 1; | 27 | m_curEntry = 1; |
29 | int numEntrys=0; | 28 | m_numEntrys=0; |
30 | 29 | ||
31 | m_logger->addItem(tr("Creating Backup: %1").arg(zip),LOGINFO); | ||
32 | QCoreApplication::processEvents(); | 30 | QCoreApplication::processEvents(); |
33 | 31 | ||
34 | // get number of entrys in dir | 32 | // get number of entrys in dir |
@@ -36,10 +34,10 @@ Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface | |||
36 | while (it.hasNext()) | 34 | while (it.hasNext()) |
37 | { | 35 | { |
38 | it.next(); | 36 | it.next(); |
39 | numEntrys++; | 37 | m_numEntrys++; |
40 | QCoreApplication::processEvents(); | 38 | QCoreApplication::processEvents(); |
41 | } | 39 | } |
42 | m_logger->setProgressMax(numEntrys); | 40 | |
43 | 41 | ||
44 | //! create zip | 42 | //! create zip |
45 | error = Zip::createArchive(zip); | 43 | error = Zip::createArchive(zip); |
@@ -54,13 +52,13 @@ Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface | |||
54 | //! close zip | 52 | //! close zip |
55 | error = Zip::closeArchive(); | 53 | error = Zip::closeArchive(); |
56 | 54 | ||
57 | return error; | 55 | return error; |
58 | } | 56 | } |
59 | 57 | ||
60 | void RbZip::progress() | 58 | void RbZip::progress() |
61 | { | 59 | { |
62 | m_curEntry++; | 60 | m_curEntry++; |
63 | m_logger->setProgressValue(m_curEntry); | 61 | emit zipProgress(m_curEntry,m_numEntrys); |
64 | QCoreApplication::processEvents(); // update UI | 62 | QCoreApplication::processEvents(); // update UI |
65 | } | 63 | } |
66 | 64 | ||
diff --git a/rbutil/rbutilqt/rbzip.h b/rbutil/rbutilqt/rbzip.h index faf3ce7f4c..da535fdfda 100644 --- a/rbutil/rbutilqt/rbzip.h +++ b/rbutil/rbutilqt/rbzip.h | |||
@@ -23,19 +23,20 @@ | |||
23 | #include <QtCore> | 23 | #include <QtCore> |
24 | #include "zip/zip.h" | 24 | #include "zip/zip.h" |
25 | 25 | ||
26 | #include "progressloggerinterface.h" | ||
27 | |||
28 | class RbZip : public QObject, public Zip | 26 | class RbZip : public QObject, public Zip |
29 | { | 27 | { |
30 | Q_OBJECT | 28 | Q_OBJECT |
31 | public: | 29 | public: |
32 | Zip::ErrorCode createZip(QString zip,QString dir,ProgressloggerInterface *dp); | 30 | Zip::ErrorCode createZip(QString zip,QString dir); |
33 | 31 | ||
34 | virtual void progress(); | 32 | virtual void progress(); |
35 | 33 | ||
34 | signals: | ||
35 | void zipProgress(int, int); | ||
36 | |||
36 | private: | 37 | private: |
37 | int m_curEntry; | 38 | int m_curEntry; |
38 | ProgressloggerInterface *m_logger; | 39 | int m_numEntrys; |
39 | }; | 40 | }; |
40 | 41 | ||
41 | #endif | 42 | #endif |
diff --git a/rbutil/rbutilqt/utils.cpp b/rbutil/rbutilqt/utils.cpp index 4fc863677c..a552b5cd5e 100644 --- a/rbutil/rbutilqt/utils.cpp +++ b/rbutil/rbutilqt/utils.cpp | |||
@@ -134,3 +134,26 @@ QUrl systemProxy(void) | |||
134 | return QUrl(""); | 134 | return QUrl(""); |
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | |||
138 | QString installedVersion(QString mountpoint) | ||
139 | { | ||
140 | // read rockbox-info.txt | ||
141 | QFile info(mountpoint +"/.rockbox/rockbox-info.txt"); | ||
142 | if(!info.open(QIODevice::ReadOnly)) | ||
143 | { | ||
144 | return ""; | ||
145 | } | ||
146 | |||
147 | QString target, features,version; | ||
148 | while (!info.atEnd()) { | ||
149 | QString line = info.readLine(); | ||
150 | |||
151 | if(line.contains("Version:")) | ||
152 | { | ||
153 | return line.remove("Version:").trimmed(); | ||
154 | } | ||
155 | } | ||
156 | info.close(); | ||
157 | return ""; | ||
158 | } | ||
159 | |||
diff --git a/rbutil/rbutilqt/utils.h b/rbutil/rbutilqt/utils.h index 8ca782fc05..9b0b026921 100644 --- a/rbutil/rbutilqt/utils.h +++ b/rbutil/rbutilqt/utils.h | |||
@@ -28,6 +28,7 @@ bool recRmdir( const QString &dirName ); | |||
28 | QString resolvePathCase(QString path); | 28 | QString resolvePathCase(QString path); |
29 | 29 | ||
30 | QUrl systemProxy(void); | 30 | QUrl systemProxy(void); |
31 | QString installedVersion(QString mountpoint); | ||
31 | 32 | ||
32 | #endif | 33 | #endif |
33 | 34 | ||