mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
rbutil: Fix some more issues found by clazy.
Change-Id: I0a1a849ecea4b4666b08ccb050eb17918e90a258
This commit is contained in:
parent
7dffbd84af
commit
f53f1fbafa
10 changed files with 23 additions and 40 deletions
|
@ -80,7 +80,6 @@ class HttpGet : public QObject
|
||||||
signals:
|
signals:
|
||||||
void done(bool);
|
void done(bool);
|
||||||
void dataReadProgress(int, int);
|
void dataReadProgress(int, int);
|
||||||
void requestFinished(int, bool);
|
|
||||||
void headerFinished(void);
|
void headerFinished(void);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -36,10 +36,6 @@ class MsPackUtil : public ArchiveUtil
|
||||||
virtual bool extractArchive(const QString& dest, QString file = "");
|
virtual bool extractArchive(const QString& dest, QString file = "");
|
||||||
virtual QStringList files(void);
|
virtual QStringList files(void);
|
||||||
|
|
||||||
signals:
|
|
||||||
void logProgress(int, int);
|
|
||||||
void logItem(QString, int);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString errorStringMsPack(int error) const;
|
QString errorStringMsPack(int error) const;
|
||||||
struct mscab_decompressor* m_cabd;
|
struct mscab_decompressor* m_cabd;
|
||||||
|
|
|
@ -1053,11 +1053,11 @@ qint64 Utils::recursiveFolderSize(QString path)
|
||||||
{
|
{
|
||||||
qint64 size = 0;
|
qint64 size = 0;
|
||||||
QList<QFileInfo> items = QDir(path).entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
QList<QFileInfo> items = QDir(path).entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
for (auto item: items) {
|
for (const auto &item: qAsConst(items)) {
|
||||||
size += item.size();
|
size += item.size();
|
||||||
}
|
}
|
||||||
QList<QString> folders = QDir(path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
QList<QString> folders = QDir(path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
for (auto const& folder: folders) {
|
for (auto const& folder: qAsConst(folders)) {
|
||||||
size += recursiveFolderSize(path + "/" + folder);
|
size += recursiveFolderSize(path + "/" + folder);
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -40,10 +40,6 @@ class ZipUtil : public ArchiveUtil
|
||||||
qint64 totalUncompressedSize(unsigned int clustersize = 0);
|
qint64 totalUncompressedSize(unsigned int clustersize = 0);
|
||||||
virtual QStringList files(void);
|
virtual QStringList files(void);
|
||||||
|
|
||||||
signals:
|
|
||||||
void logProgress(int, int);
|
|
||||||
void logItem(QString, int);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QuaZipFileInfo> contentProperties();
|
QList<QuaZipFileInfo> contentProperties();
|
||||||
QuaZip* m_zip;
|
QuaZip* m_zip;
|
||||||
|
|
|
@ -600,7 +600,8 @@ void SelectiveInstallWidget::installThemes(void)
|
||||||
if(m_themesinstaller == nullptr)
|
if(m_themesinstaller == nullptr)
|
||||||
m_themesinstaller = new ThemesInstallWindow(this);
|
m_themesinstaller = new ThemesInstallWindow(this);
|
||||||
|
|
||||||
connect(m_themesinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
connect(m_themesinstaller, &ThemesInstallWindow::done,
|
||||||
|
this, &SelectiveInstallWidget::continueInstall);
|
||||||
m_themesinstaller->setLogger(m_logger);
|
m_themesinstaller->setLogger(m_logger);
|
||||||
m_themesinstaller->setModal(true);
|
m_themesinstaller->setModal(true);
|
||||||
m_themesinstaller->install();
|
m_themesinstaller->install();
|
||||||
|
|
|
@ -31,23 +31,23 @@ class ProgressLoggerGui :public QObject
|
||||||
public:
|
public:
|
||||||
ProgressLoggerGui(QWidget * parent);
|
ProgressLoggerGui(QWidget * parent);
|
||||||
|
|
||||||
virtual void setProgressValue(int value);
|
void setProgressValue(int value);
|
||||||
virtual void setProgressMax(int max);
|
void setProgressMax(int max);
|
||||||
virtual int getProgressMax();
|
int getProgressMax();
|
||||||
virtual void setProgressVisible(bool);
|
void setProgressVisible(bool);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void aborted();
|
void aborted();
|
||||||
void closed();
|
void closed();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void addItem(const QString &text, int flag); //! add a string to the list
|
void addItem(const QString &text, int flag); //! add a string to the list
|
||||||
virtual void setProgress(int, int); //! set progress bar
|
void setProgress(int, int); //! set progress bar
|
||||||
|
|
||||||
virtual void close();
|
void close();
|
||||||
virtual void show();
|
void show();
|
||||||
virtual void setRunning();
|
void setRunning();
|
||||||
virtual void setFinished();
|
void setFinished();
|
||||||
|
|
||||||
void saveErrorLog();
|
void saveErrorLog();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -279,11 +279,11 @@ void RbUtilQt::about()
|
||||||
licenses[":/docs/LICENSE.BZIP2"] = "<a id='bzip2'>bzip2 License</a>";
|
licenses[":/docs/LICENSE.BZIP2"] = "<a id='bzip2'>bzip2 License</a>";
|
||||||
licenses[":/docs/LICENSE.BSPATCH"] = "<a id='bspatch'>bspatch License</a>";
|
licenses[":/docs/LICENSE.BSPATCH"] = "<a id='bspatch'>bspatch License</a>";
|
||||||
|
|
||||||
for (auto const& key : licenses.keys()) {
|
for (auto it = licenses.keyBegin(); it != licenses.keyEnd(); ++it) {
|
||||||
QFile license(key);
|
QFile license(*it);
|
||||||
license.open(QIODevice::ReadOnly);
|
license.open(QIODevice::ReadOnly);
|
||||||
QTextStream s(&license);
|
QTextStream s(&license);
|
||||||
about.browserLicenses->insertHtml("<hr/><h2>" + licenses[key] + "</h2><br/>\n");
|
about.browserLicenses->insertHtml("<hr/><h2>" + licenses[*it] + "</h2><br/>\n");
|
||||||
about.browserLicenses->insertHtml("<pre>" + s.readAll() + "</pre>");
|
about.browserLicenses->insertHtml("<pre>" + s.readAll() + "</pre>");
|
||||||
license.close();
|
license.close();
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,7 @@ void RbUtilQt::downloadUpdateDone(bool error)
|
||||||
tr("<b>New Rockbox Utility version available.</b><br><br>"
|
tr("<b>New Rockbox Utility version available.</b><br><br>"
|
||||||
"You are currently using version %1. "
|
"You are currently using version %1. "
|
||||||
"Get version %2 at <a href='%3'>%3</a>")
|
"Get version %2 at <a href='%3'>%3</a>")
|
||||||
.arg(VERSION).arg(Utils::trimVersionString(foundVersion)).arg(url));
|
.arg(VERSION, Utils::trimVersionString(foundVersion), url));
|
||||||
ui.statusbar->showMessage(tr("New version of Rockbox Utility available."));
|
ui.statusbar->showMessage(tr("New version of Rockbox Utility available."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -72,8 +72,7 @@ QString Sysinfo::getInfo(Sysinfo::InfoType type)
|
||||||
.arg(QDir::toNativeSeparators(drives.at(i)))
|
.arg(QDir::toNativeSeparators(drives.at(i)))
|
||||||
.arg((double)Utils::filesystemFree(drives.at(i)) / (1<<30), 0, 'f', 2)
|
.arg((double)Utils::filesystemFree(drives.at(i)) / (1<<30), 0, 'f', 2)
|
||||||
.arg((double)Utils::filesystemTotal(drives.at(i)) / (1<<30), 0, 'f', 2)
|
.arg((double)Utils::filesystemTotal(drives.at(i)) / (1<<30), 0, 'f', 2)
|
||||||
.arg(Utils::filesystemName(drives.at(i)))
|
.arg(Utils::filesystemName(drives.at(i)), Utils::filesystemType(drives.at(i)));
|
||||||
.arg(Utils::filesystemType(drives.at(i)));
|
|
||||||
}
|
}
|
||||||
info += "</table>";
|
info += "</table>";
|
||||||
info += "<hr/>";
|
info += "<hr/>";
|
||||||
|
|
|
@ -44,7 +44,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
|
||||||
ui.themeDescription->setLayoutDirection(Qt::LeftToRight);
|
ui.themeDescription->setLayoutDirection(Qt::LeftToRight);
|
||||||
|
|
||||||
connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close);
|
connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close);
|
||||||
connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
|
connect(ui.buttonOk, &QAbstractButton::clicked, this, &ThemesInstallWindow::accept);
|
||||||
connect(ui.listThemes, &QListWidget::currentItemChanged,
|
connect(ui.listThemes, &QListWidget::currentItemChanged,
|
||||||
this, &ThemesInstallWindow::updateDetails);
|
this, &ThemesInstallWindow::updateDetails);
|
||||||
connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize);
|
connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize);
|
||||||
|
@ -94,19 +94,12 @@ void ThemesInstallWindow::downloadInfo()
|
||||||
LOG_INFO() << "Info URL:" << url;
|
LOG_INFO() << "Info URL:" << url;
|
||||||
getter->setFile(&themesInfo);
|
getter->setFile(&themesInfo);
|
||||||
|
|
||||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
connect(getter, &HttpGet::done, this, &ThemesInstallWindow::downloadDone);
|
||||||
connect(logger, &ProgressLoggerGui::aborted, getter, &HttpGet::abort);
|
connect(logger, &ProgressLoggerGui::aborted, getter, &HttpGet::abort);
|
||||||
getter->getFile(url);
|
getter->getFile(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ThemesInstallWindow::downloadDone(int id, bool error)
|
|
||||||
{
|
|
||||||
downloadDone(error);
|
|
||||||
LOG_INFO() << "Download" << id << "done, error:" << error;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThemesInstallWindow::downloadDone(bool error)
|
void ThemesInstallWindow::downloadDone(bool error)
|
||||||
{
|
{
|
||||||
LOG_INFO() << "Download done, error:" << error;
|
LOG_INFO() << "Download done, error:" << error;
|
||||||
|
@ -129,7 +122,7 @@ void ThemesInstallWindow::downloadDone(bool error)
|
||||||
.arg(getter->errorString()), LOGERROR);
|
.arg(getter->errorString()), LOGERROR);
|
||||||
getter->abort();
|
getter->abort();
|
||||||
logger->setFinished();
|
logger->setFinished();
|
||||||
disconnect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
disconnect(getter, &HttpGet::done, this, &ThemesInstallWindow::downloadDone);
|
||||||
connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close);
|
connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +369,7 @@ void ThemesInstallWindow::install()
|
||||||
}
|
}
|
||||||
connect(installer, &ZipInstaller::logItem, logger, &ProgressLoggerGui::addItem);
|
connect(installer, &ZipInstaller::logItem, logger, &ProgressLoggerGui::addItem);
|
||||||
connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress);
|
connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress);
|
||||||
connect(installer, SIGNAL(done(bool)), this, SIGNAL(done(bool)));
|
connect(installer, &ZipInstaller::done, this, &ThemesInstallWindow::done);
|
||||||
connect(logger, &ProgressLoggerGui::aborted, installer, &ZipInstaller::abort);
|
connect(logger, &ProgressLoggerGui::aborted, installer, &ZipInstaller::abort);
|
||||||
installer->install();
|
installer->install();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ class ThemesInstallWindow : public QDialog
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void downloadDone(bool);
|
void downloadDone(bool);
|
||||||
void downloadDone(int, bool);
|
|
||||||
void updateImage(bool);
|
void updateImage(bool);
|
||||||
void abort(void);
|
void abort(void);
|
||||||
void updateDetails(QListWidgetItem* cur, QListWidgetItem* prev);
|
void updateDetails(QListWidgetItem* cur, QListWidgetItem* prev);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue