summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/base
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2022-04-16 14:13:59 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2022-04-17 23:21:19 +0200
commit8c55ce62b9e65533619870d1e5b72612a1a16406 (patch)
treea39beb02600048177920f3b888fed5b5f3fe66be /utils/rbutilqt/base
parent1af92e5ff84bcb05d264d65d2904c4d9fe8f0d98 (diff)
downloadrockbox-8c55ce62b9e65533619870d1e5b72612a1a16406.tar.gz
rockbox-8c55ce62b9e65533619870d1e5b72612a1a16406.zip
rbutil: Move bootloader file check to base class.
Avoid constructing the bootloader file path in the caller. Pass filename list and mountpoint separately so it can directly fall back to the mountpoint. Change some functions to use references instead of creating temporary objects. Change-Id: I09c9d755553a32de3d02a42a8ce1fcb94f831b2a
Diffstat (limited to 'utils/rbutilqt/base')
-rw-r--r--utils/rbutilqt/base/bootloaderinstallbase.cpp25
-rw-r--r--utils/rbutilqt/base/bootloaderinstallbase.h8
2 files changed, 20 insertions, 13 deletions
diff --git a/utils/rbutilqt/base/bootloaderinstallbase.cpp b/utils/rbutilqt/base/bootloaderinstallbase.cpp
index 36a15c9e1a..b49a9b933b 100644
--- a/utils/rbutilqt/base/bootloaderinstallbase.cpp
+++ b/utils/rbutilqt/base/bootloaderinstallbase.cpp
@@ -203,21 +203,28 @@ void BootloaderInstallBase::checkRemount()
203 203
204//! @brief set list of possible bootloader files and pick the existing one. 204//! @brief set list of possible bootloader files and pick the existing one.
205//! @param sl list of possible bootloader files. 205//! @param sl list of possible bootloader files.
206void BootloaderInstallBase::setBlFile(QStringList sl) 206void BootloaderInstallBase::setBlFile(const QString& mountpoint, const QStringList& sl)
207{ 207{
208 // figue which of the possible bootloader filenames is correct. 208 if(sl.size() == 0) {
209 for(int a = 0; a < sl.size(); a++) { 209 m_blfile = mountpoint;
210 if(!Utils::resolvePathCase(sl.at(a)).isEmpty()) {
211 m_blfile = sl.at(a);
212 }
213 } 210 }
214 if(m_blfile.isEmpty() && sl.size() > 0) { 211 else {
215 m_blfile = sl.at(0); 212 for(int a = 0; a < sl.size(); a++) {
213 QString filename = mountpoint + sl.at(a);
214 if(!Utils::resolvePathCase(filename).isEmpty()) {
215 m_blfile = filename;
216 break;
217 }
218 }
219 // figue which of the possible bootloader filenames is correct.
220 if(m_blfile.isEmpty() && sl.size() > 0) {
221 m_blfile = mountpoint + sl.at(0);
222 }
216 } 223 }
217} 224}
218 225
219 226
220bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) 227bool BootloaderInstallBase::setOfFile(QString& of, const QStringList& blfile)
221{ 228{
222 bool found = false; 229 bool found = false;
223 ArchiveUtil *util = nullptr; 230 ArchiveUtil *util = nullptr;
diff --git a/utils/rbutilqt/base/bootloaderinstallbase.h b/utils/rbutilqt/base/bootloaderinstallbase.h
index 567b4e9093..32ca637288 100644
--- a/utils/rbutilqt/base/bootloaderinstallbase.h
+++ b/utils/rbutilqt/base/bootloaderinstallbase.h
@@ -55,17 +55,17 @@ class BootloaderInstallBase : public QObject
55 bool backup(QString to); 55 bool backup(QString to);
56 56
57 //! set the different filenames and paths 57 //! set the different filenames and paths
58 void setBlFile(QStringList f); 58 void setBlFile(const QString& mountpoint, const QStringList& f);
59 void setBlUrl(QUrl u) 59 void setBlUrl(QUrl u)
60 { m_blurl = u; } 60 { m_blurl = u; }
61 void setLogfile(QString f) 61 void setLogfile(const QString& f)
62 { m_logfile = f; } 62 { m_logfile = f; }
63 bool setOfFile(QString of, QStringList blfile); 63 bool setOfFile(QString& of, const QStringList& blfile);
64 64
65 //! returns a port Install Hint or empty if there is none 65 //! returns a port Install Hint or empty if there is none
66 //! static and in the base class, so the installer classes dont need to 66 //! static and in the base class, so the installer classes dont need to
67 // be modified for new targets 67 // be modified for new targets
68 static QString postinstallHints(QString model); 68 static QString postinstallHints(const QString& model);
69 69
70 protected slots: 70 protected slots:
71 void downloadBlFinish(QNetworkReply::NetworkError error); 71 void downloadBlFinish(QNetworkReply::NetworkError error);