diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-09-30 15:27:57 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-11-04 10:07:47 +0300 |
commit | d3cae4df15598bf4797cd7fc03aced50bb5a25a1 (patch) | |
tree | d5889d6dc6bb99702eeec61337ba0544e94ff071 | |
parent | 07f4848b5ee0cdc9407d9a0de4d30ca5e03403e0 (diff) |
Remove unused code blocks and functions
Results analyzed using cppcheck tools.
Also add Q_DECL_OVERRIDE to overwrited functions.
Change-Id: Iab5eb43206af0050c1dd84efb7ed860ab9594496
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
-rw-r--r-- | src/libs/installer/aspectratiolabel.h | 6 | ||||
-rw-r--r-- | src/libs/installer/component_p.cpp | 10 | ||||
-rw-r--r-- | src/libs/installer/component_p.h | 3 | ||||
-rw-r--r-- | src/libs/installer/componentselectionpage_p.cpp | 16 | ||||
-rw-r--r-- | src/libs/installer/componentselectionpage_p.h | 1 | ||||
-rw-r--r-- | src/libs/installer/fileutils.cpp | 24 | ||||
-rw-r--r-- | src/libs/installer/fileutils.h | 7 | ||||
-rw-r--r-- | src/libs/installer/metadatajob.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/packagemanagergui.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/repository.cpp | 10 | ||||
-rw-r--r-- | src/libs/installer/repository.h | 3 | ||||
-rw-r--r-- | tools/archivegen/archive.cpp | 22 | ||||
-rw-r--r-- | tools/binarycreator/rcc/rccmain.cpp | 7 | ||||
-rw-r--r-- | tools/common/repositorygen.cpp | 4 |
15 files changed, 24 insertions, 95 deletions
diff --git a/src/libs/installer/aspectratiolabel.h b/src/libs/installer/aspectratiolabel.h index 28fc5aea4..6fbc774a2 100644 --- a/src/libs/installer/aspectratiolabel.h +++ b/src/libs/installer/aspectratiolabel.h @@ -44,12 +44,12 @@ class INSTALLER_EXPORT AspectRatioLabel : public QLabel public: explicit AspectRatioLabel(QWidget *parent = nullptr); - int heightForWidth(int w) const; - QSize sizeHint() const; + int heightForWidth(int w) const Q_DECL_OVERRIDE; + QSize sizeHint() const Q_DECL_OVERRIDE; public slots: void setPixmap (const QPixmap &pixmap); - void resizeEvent(QResizeEvent *event); + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; private: QPixmap scaledPixmap() const; diff --git a/src/libs/installer/component_p.cpp b/src/libs/installer/component_p.cpp index 7c107cac2..8533d8e4c 100644 --- a/src/libs/installer/component_p.cpp +++ b/src/libs/installer/component_p.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -187,14 +187,6 @@ void ComponentModelHelper::setCheckable(bool checkable) } /*! - Returns whether the component is selectable by the user. The default value is \c true. -*/ -bool ComponentModelHelper::isSelectable() const -{ - return (flags() & Qt::ItemIsSelectable) != 0; -} - -/*! Sets whether the component is selectable. If \a selectable is \c true, the component can be selected by the user; otherwise, the user cannot select the component. */ diff --git a/src/libs/installer/component_p.h b/src/libs/installer/component_p.h index 05b169d4b..c14d53e70 100644 --- a/src/libs/installer/component_p.h +++ b/src/libs/installer/component_p.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -129,7 +129,6 @@ public: bool isCheckable() const; void setCheckable(bool checkable); - bool isSelectable() const; void setSelectable(bool selectable); bool isExpandedByDefault() const; diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp index c5117e9cb..e1ca0a3a1 100644 --- a/src/libs/installer/componentselectionpage_p.cpp +++ b/src/libs/installer/componentselectionpage_p.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -231,8 +231,6 @@ void ComponentSelectionPagePrivate::setupCategoryLayout() QCheckBox *checkBox = new QCheckBox; checkBox->setObjectName(repository.displayname()); checkBox->setChecked(repository.isEnabled()); - connect(checkBox, &QCheckBox::stateChanged, this, - &ComponentSelectionPagePrivate::checkboxStateChanged); checkBox->setText(repository.displayname()); checkBox->setToolTip(repository.tooltip()); categoryLayout->addWidget(checkBox); @@ -350,18 +348,6 @@ void ComponentSelectionPagePrivate::deselectAll() m_currentModel->setCheckedState(ComponentModel::AllUnchecked); } -void ComponentSelectionPagePrivate::checkboxStateChanged() -{ - QList<QCheckBox*> checkboxes = m_categoryGroupBox->findChildren<QCheckBox *>(); - bool enableFetchButton = false; - foreach (QCheckBox *checkbox, checkboxes) { - if (checkbox->isChecked()) { - enableFetchButton = true; - break; - } - } -} - void ComponentSelectionPagePrivate::enableRepositoryCategory(const QString &repositoryName, bool enable) { QMap<QString, RepositoryCategory> organizedRepositoryCategories = m_core->settings().organizedRepositoryCategories(); diff --git a/src/libs/installer/componentselectionpage_p.h b/src/libs/installer/componentselectionpage_p.h index bce13246b..37f808286 100644 --- a/src/libs/installer/componentselectionpage_p.h +++ b/src/libs/installer/componentselectionpage_p.h @@ -74,7 +74,6 @@ public slots: void currentSelectedChanged(const QModelIndex ¤t); void selectAll(); void deselectAll(); - void checkboxStateChanged(); void enableRepositoryCategory(const QString &repositoryName, bool enable); void updateWidgetVisibility(bool show); void fetchRepositoryCategories(); diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp index d0dd342a8..61891832e 100644 --- a/src/libs/installer/fileutils.cpp +++ b/src/libs/installer/fileutils.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -97,28 +97,6 @@ void TempDirDeleter::add(const QStringList &paths) m_paths += paths.toSet(); } -void TempDirDeleter::releaseAll() -{ - m_paths.clear(); -} - -void TempDirDeleter::release(const QString &path) -{ - m_paths.remove(path); -} - -void TempDirDeleter::passAndReleaseAll(TempDirDeleter &tdd) -{ - tdd.m_paths = m_paths; - releaseAll(); -} - -void TempDirDeleter::passAndRelease(TempDirDeleter &tdd, const QString &path) -{ - tdd.add(path); - release(path); -} - void TempDirDeleter::releaseAndDeleteAll() { foreach (const QString &path, m_paths) diff --git a/src/libs/installer/fileutils.h b/src/libs/installer/fileutils.h index 24b033e98..78241d3ce 100644 --- a/src/libs/installer/fileutils.h +++ b/src/libs/installer/fileutils.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -59,11 +59,6 @@ public: void add(const QString &path); void add(const QStringList &paths); - void releaseAll(); - void release(const QString &path); - void passAndReleaseAll(TempDirDeleter &tdd); - void passAndRelease(TempDirDeleter &tdd, const QString &path); - void releaseAndDeleteAll(); void releaseAndDelete(const QString &path); diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp index a15dd8848..bd5fc7f74 100644 --- a/src/libs/installer/metadatajob.cpp +++ b/src/libs/installer/metadatajob.cpp @@ -291,8 +291,6 @@ void MetadataJob::unzipRepositoryTaskFinished() m_unzipRepositoryitems.append(item); } else { //Repository is not valid, remove it - Repository repository; - repository.setUrl(QUrl(task->archive())); Settings &s = m_core->settings(); QSet<Repository> temporaries = s.temporaryRepositories(); foreach (Repository repository, temporaries) { diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 715374f65..eb866e436 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -1195,7 +1195,7 @@ class VerboseWriterAdminOutput : public VerboseWriterOutput public: VerboseWriterAdminOutput(PackageManagerCore *core) : m_core(core) {} - virtual bool write(const QString &fileName, QIODevice::OpenMode openMode, const QByteArray &data) + virtual bool write(const QString &fileName, QIODevice::OpenMode openMode, const QByteArray &data) Q_DECL_OVERRIDE { bool gainedAdminRights = false; diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 52719922a..ffacbb6a2 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -123,7 +123,7 @@ public: return m_widget; } - bool isComplete() const + bool isComplete() const Q_DECL_OVERRIDE { return m_widget->property("complete").toBool(); } diff --git a/src/libs/installer/repository.cpp b/src/libs/installer/repository.cpp index 3957ce5aa..7e7f95354 100644 --- a/src/libs/installer/repository.cpp +++ b/src/libs/installer/repository.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -225,14 +225,6 @@ bool Repository::isCompressed() const } /*! - Sets this repository to \a compressed state to know weather the repository - needs to be uncompressed before use. -*/ -void Repository::setCompressed(bool compressed) -{ - m_compressed = compressed; -} -/*! Compares the values of this repository to \a other and returns true if they are equal (same server, default state, enabled state as well as username and password). \sa operator!=() */ diff --git a/src/libs/installer/repository.h b/src/libs/installer/repository.h index 546cddc97..3f28e4d99 100644 --- a/src/libs/installer/repository.h +++ b/src/libs/installer/repository.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -68,7 +68,6 @@ public: void setCategoryName(const QString &categoryname); bool isCompressed() const; - void setCompressed(bool compressed); bool operator==(const Repository &other) const; bool operator!=(const Repository &other) const; diff --git a/tools/archivegen/archive.cpp b/tools/archivegen/archive.cpp index d31e8fdc3..e1a40a880 100644 --- a/tools/archivegen/archive.cpp +++ b/tools/archivegen/archive.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -41,15 +41,15 @@ using namespace QInstaller; class FailOnErrorCallback : public Lib7z::UpdateCallback { - HRESULT OpenFileError(const wchar_t*, DWORD) { + HRESULT OpenFileError(const wchar_t*, DWORD) Q_DECL_OVERRIDE { return S_FALSE; } - HRESULT CanNotFindError(const wchar_t*, DWORD) { + HRESULT CanNotFindError(const wchar_t*, DWORD) Q_DECL_OVERRIDE { return S_FALSE; } - HRESULT OpenResult(const wchar_t*, HRESULT result, const wchar_t*) { + HRESULT OpenResult(const wchar_t*, HRESULT result, const wchar_t*) Q_DECL_OVERRIDE { return result; } }; @@ -62,12 +62,12 @@ public: } private: - HRESULT SetTotal(UInt64 size) { + HRESULT SetTotal(UInt64 size) Q_DECL_OVERRIDE { m_PercentPrinter.SetTotal(size); return S_OK; } - HRESULT SetCompleted(const UInt64 *size) { + HRESULT SetCompleted(const UInt64 *size) Q_DECL_OVERRIDE { if (size) { m_PercentPrinter.SetRatio(*size); m_PercentPrinter.PrintRatio(); @@ -75,7 +75,7 @@ private: return S_OK; } - HRESULT OpenResult(const wchar_t *file, HRESULT result, const wchar_t*) { + HRESULT OpenResult(const wchar_t *file, HRESULT result, const wchar_t*) Q_DECL_OVERRIDE { if (result != S_OK) { printBlock(QCoreApplication::translate("archivegen", "Cannot update file \"%1\". " "Unsupported archive.").arg(QDir::toNativeSeparators(QString::fromWCharArray(file))), Q_NULLPTR); @@ -83,17 +83,17 @@ private: return result; } - HRESULT OpenFileError(const wchar_t *file, DWORD) { + HRESULT OpenFileError(const wchar_t *file, DWORD) Q_DECL_OVERRIDE { printBlock(QCoreApplication::translate("archivegen", "Cannot open file "), file); return S_FALSE; } - HRESULT CanNotFindError(const wchar_t *file, DWORD) { + HRESULT CanNotFindError(const wchar_t *file, DWORD) Q_DECL_OVERRIDE { printBlock(QCoreApplication::translate("archivegen", "Cannot find file "), file); return S_FALSE; } - HRESULT StartArchive(const wchar_t *name, bool) { + HRESULT StartArchive(const wchar_t *name, bool) Q_DECL_OVERRIDE { printLine(QCoreApplication::translate("archivegen", "Create archive.")); if (name) { m_PercentPrinter.PrintNewLine(); @@ -102,7 +102,7 @@ private: return S_OK; } - HRESULT FinishArchive() { + HRESULT FinishArchive() Q_DECL_OVERRIDE { m_PercentPrinter.PrintNewLine(); printLine(QCoreApplication::translate("archivegen", "Finished archive.")); return S_OK; diff --git a/tools/binarycreator/rcc/rccmain.cpp b/tools/binarycreator/rcc/rccmain.cpp index 74e9fca77..8c33997dd 100644 --- a/tools/binarycreator/rcc/rccmain.cpp +++ b/tools/binarycreator/rcc/rccmain.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -76,11 +76,6 @@ void dumpRecursive(const QDir &dir, QTextStream &out) int createProject(const QString &outFileName) { - QDir currentDir = QDir::current(); - QString currentDirName = currentDir.dirName(); - if (currentDirName.isEmpty()) - currentDirName = QLatin1String("root"); - QFile file; bool isOk = false; if (outFileName.isEmpty()) { diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 6f17ad5ac..5a6c0bf83 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -682,13 +682,10 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr const QHash<QString, QString> &versionMapping, bool createSplitMetadata, bool createUnifiedMetadata) { QDomDocument doc; - QDomElement root; // use existing Updates.xml, if any QFile existingUpdatesXml(QFileInfo(QDir(repoDir), QLatin1String("Updates.xml")).absoluteFilePath()); if (!existingUpdatesXml.open(QIODevice::ReadOnly) || !doc.setContent(&existingUpdatesXml)) { qDebug() << "Cannot find Updates.xml"; - } else { - root = doc.documentElement(); } existingUpdatesXml.close(); @@ -726,7 +723,6 @@ QStringList QInstallerTools::unifyMetadata(const QStringList &entryList, const Q // Compress all metadata from repository to one single 7z const QString metadataFilename = QDateTime::currentDateTime(). toString(QLatin1String("yyyy-MM-dd-hhmm")) + QLatin1String("_meta.7z"); - QDateTime dateTime = QDateTime::currentDateTime(); const QString tmpTarget = repoDir + QDir::separator() + metadataFilename; Lib7z::createArchive(tmpTarget, absPaths, Lib7z::TmpFile::No); |