diff --git a/gui/dbmergerdialog.h b/gui/dbmergerdialog.h index d564964..ac0caab 100644 --- a/gui/dbmergerdialog.h +++ b/gui/dbmergerdialog.h @@ -14,7 +14,7 @@ class DbMergerDialog : public QDialog public: explicit DbMergerDialog(QWidget *parent = nullptr); - ~DbMergerDialog(); + ~DbMergerDialog() override; static void merge(QWidget *parent = nullptr); diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index d304ba9..cef4900 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -24,7 +24,7 @@ public slots: QHash _settingsWidgets; explicit SettingsDialog(QWidget *parent = nullptr); - ~SettingsDialog(); + ~SettingsDialog() override; void createWidgets(QWidget *parent, QFormLayout *layout, diff --git a/gui/traycontrol.h b/gui/traycontrol.h index 6ec9f94..a87bd7a 100644 --- a/gui/traycontrol.h +++ b/gui/traycontrol.h @@ -14,7 +14,7 @@ class TrayControl : public QObject public: explicit TrayControl(QObject *parent = nullptr); - ~TrayControl(); + ~TrayControl() override; void show(); diff --git a/gui/widgets/editpackageswidget.h b/gui/widgets/editpackageswidget.h index 5ef0bd3..162b8aa 100644 --- a/gui/widgets/editpackageswidget.h +++ b/gui/widgets/editpackageswidget.h @@ -28,7 +28,7 @@ class EditPackagesWidget : public QWidget public: explicit EditPackagesWidget(QWidget *parent = nullptr); - ~EditPackagesWidget(); + ~EditPackagesWidget() override; QStringList packages() const; diff --git a/gui/widgets/extrafilterswidget.cpp b/gui/widgets/extrafilterswidget.cpp index 1ef10d5..aecf8ca 100644 --- a/gui/widgets/extrafilterswidget.cpp +++ b/gui/widgets/extrafilterswidget.cpp @@ -85,7 +85,7 @@ void ExtraFiltersWidget::addFilter(const ExtraFilter &filter) box->setCurrentIndex(filter.mode); connect(box, QOverload::of(&QComboBox::currentIndexChanged), this, [item](int index){ - item->setData(1, Qt::UserRole, QVariant::fromValue((FilterInfo::Mode)index)); + item->setData(1, Qt::UserRole, QVariant::fromValue(static_cast(index))); }); _ui->treeWidget->setItemWidget(item, 1, box); } diff --git a/gui/widgets/extrafilterswidget.h b/gui/widgets/extrafilterswidget.h index 28ebaf9..e51fa29 100644 --- a/gui/widgets/extrafilterswidget.h +++ b/gui/widgets/extrafilterswidget.h @@ -17,7 +17,7 @@ class ExtraFiltersWidget : public QWidget public: explicit ExtraFiltersWidget(QWidget *parent = nullptr); - ~ExtraFiltersWidget(); + ~ExtraFiltersWidget() override; QList extraFilters() const; diff --git a/gui/widgets/filterswidget.h b/gui/widgets/filterswidget.h index 918c0eb..e32fc7c 100644 --- a/gui/widgets/filterswidget.h +++ b/gui/widgets/filterswidget.h @@ -42,7 +42,7 @@ class FiltersWidget : public QWidget public: explicit FiltersWidget(QWidget *parent = nullptr); - ~FiltersWidget(); + ~FiltersWidget() override; QMap filters() const; diff --git a/gui/widgets/globalfilterwidget.h b/gui/widgets/globalfilterwidget.h index ed33d0f..b679537 100644 --- a/gui/widgets/globalfilterwidget.h +++ b/gui/widgets/globalfilterwidget.h @@ -16,7 +16,7 @@ class GlobalFilterWidget : public QWidget public: explicit GlobalFilterWidget(QWidget *parent = nullptr); - ~GlobalFilterWidget(); + ~GlobalFilterWidget() override; FilterInfo::Mode mode() const; diff --git a/gui/widgets/unclearpackageswidget.cpp b/gui/widgets/unclearpackageswidget.cpp index f62532a..57a8a6b 100644 --- a/gui/widgets/unclearpackageswidget.cpp +++ b/gui/widgets/unclearpackageswidget.cpp @@ -1,3 +1,5 @@ +#include + #include "unclearpackageswidget.h" #include "ui_unclearpackageswidget.h" @@ -5,6 +7,7 @@ #include #include #include +#include UnclearPackagesWidget::UnclearPackagesWidget(QWidget *parent) : QWidget(parent), @@ -72,9 +75,9 @@ void UnclearPackagesWidget::setPackages(UnclearHelper packages) -UnclearHelper::UnclearHelper(const QList &packages, const QList &ignored) : - sync(packages), - ignore(ignored) +UnclearHelper::UnclearHelper(QList packages, QList ignored) : + sync(std::move(packages)), + ignore(std::move(ignored)) {} diff --git a/gui/widgets/unclearpackageswidget.h b/gui/widgets/unclearpackageswidget.h index 5e9d0d1..8221e8f 100644 --- a/gui/widgets/unclearpackageswidget.h +++ b/gui/widgets/unclearpackageswidget.h @@ -40,8 +40,8 @@ class UnclearDelegate : public QStyledItemDelegate class UnclearHelper { public: - UnclearHelper(const QList &sync = {}, - const QList &ignore = {}); + UnclearHelper(QList sync = {}, + QList ignore = {}); QList sync; QList ignore; @@ -61,7 +61,7 @@ class UnclearPackagesWidget : public QWidget Q_ENUM(ExtraRoles) explicit UnclearPackagesWidget(QWidget *parent = nullptr); - ~UnclearPackagesWidget(); + ~UnclearPackagesWidget() override; UnclearHelper packages() const; diff --git a/gui/wizard/databasewizard.h b/gui/wizard/databasewizard.h index 1cfd67c..ead3f7b 100644 --- a/gui/wizard/databasewizard.h +++ b/gui/wizard/databasewizard.h @@ -8,7 +8,7 @@ class DatabaseWizard : public QWizard Q_OBJECT public: explicit DatabaseWizard(QWidget *parent = nullptr); - ~DatabaseWizard(); + ~DatabaseWizard() override; static bool run(); diff --git a/gui/wizard/dbpathpage.h b/gui/wizard/dbpathpage.h index 33c281e..e565590 100644 --- a/gui/wizard/dbpathpage.h +++ b/gui/wizard/dbpathpage.h @@ -13,7 +13,7 @@ class DbPathPage : public QWizardPage public: explicit DbPathPage(QWidget *parent = nullptr); - ~DbPathPage(); + ~DbPathPage() override; void initializePage() override; void cleanupPage() override; diff --git a/gui/wizard/dbselectionpage.h b/gui/wizard/dbselectionpage.h index e615181..d1e0823 100644 --- a/gui/wizard/dbselectionpage.h +++ b/gui/wizard/dbselectionpage.h @@ -13,7 +13,7 @@ class DbSelectionPage : public QWizardPage public: explicit DbSelectionPage(QWidget *parent = nullptr); - ~DbSelectionPage(); + ~DbSelectionPage() override; void cleanupPage() override; diff --git a/gui/wizard/dbwidgetpage.h b/gui/wizard/dbwidgetpage.h index eae1983..b5c50a8 100644 --- a/gui/wizard/dbwidgetpage.h +++ b/gui/wizard/dbwidgetpage.h @@ -4,6 +4,7 @@ #include #include #include +#include #include template @@ -11,7 +12,7 @@ class DbWidgetPage : public QWizardPage { public: explicit DbWidgetPage(const QString &fieldName, - const QByteArray &dbProperty, + QByteArray dbProperty, QWidget *parent = nullptr); void initializePage() override; @@ -27,10 +28,10 @@ class DbWidgetPage : public QWizardPage }; template -DbWidgetPage::DbWidgetPage(const QString &fieldName, const QByteArray &dbProperty, QWidget *parent) : +DbWidgetPage::DbWidgetPage(const QString &fieldName, QByteArray dbProperty, QWidget *parent) : QWizardPage(parent), widget(new T(this)), - _dbProperty(dbProperty) + _dbProperty(std::move(dbProperty)) { setLayout(new QVBoxLayout(this)); layout()->addWidget(widget); diff --git a/lib/comboboxconfig.cpp b/lib/comboboxconfig.cpp index 72ec4cb..388a087 100644 --- a/lib/comboboxconfig.cpp +++ b/lib/comboboxconfig.cpp @@ -1,9 +1,11 @@ #include "comboboxconfig.h" +#include + ComboboxConfig::ComboboxConfig(QStringList displayNames, QList values, QVariant defaultValue, bool editable) : - displayNames(displayNames), - values(values), - defaultValue(defaultValue), + displayNames(std::move(displayNames)), + values(std::move(values)), + defaultValue(std::move(defaultValue)), editable(editable) {} diff --git a/lib/databasemerger.cpp b/lib/databasemerger.cpp index bc4fe8c..adf7884 100644 --- a/lib/databasemerger.cpp +++ b/lib/databasemerger.cpp @@ -23,8 +23,8 @@ bool DatabaseMerger::mergeDb(QString dbPath) if(!otherFile.open(QIODevice::ReadOnly)) throw DatabaseException(otherFile.errorString()); - PackageDatabase pacDbCurrent = _js->deserializeFrom(¤tFile); - PackageDatabase pacDbOther = _js->deserializeFrom(&otherFile); + auto pacDbCurrent = _js->deserializeFrom(¤tFile); + auto pacDbOther = _js->deserializeFrom(&otherFile); otherFile.close(); //packages: keep install on conflict diff --git a/lib/packagedatabase.cpp b/lib/packagedatabase.cpp index d39287b..1dcb2c2 100644 --- a/lib/packagedatabase.cpp +++ b/lib/packagedatabase.cpp @@ -1,7 +1,9 @@ #include "packagedatabase.h" +#include + PackageInfo::PackageInfo(QString name, bool removed) : - name(name), + name(std::move(name)), removed(removed) {} @@ -23,8 +25,8 @@ bool PackageInfo::equals(const PackageInfo &other) const UnclearPackageInfo::UnclearPackageInfo(QString name, QString hostName, QStringList filterNames) : PackageInfo(name), - hostName(hostName), - filterNames(filterNames) + hostName(std::move(hostName)), + filterNames(std::move(filterNames)) {} bool UnclearPackageInfo::operator ==(const UnclearPackageInfo &other) const @@ -39,9 +41,9 @@ bool UnclearPackageInfo::equals(const UnclearPackageInfo &other) const filterNames == other.filterNames; } -FilterInfo::FilterInfo(const QString &name, const QString &plugin) : - name(name), - plugin(plugin), +FilterInfo::FilterInfo(QString name, QString plugin) : + name(std::move(name)), + plugin(std::move(plugin)), mode(Ask), pluginFilters(), regex() @@ -62,7 +64,7 @@ bool FilterInfo::equals(const FilterInfo &other) const } ExtraFilter::ExtraFilter(QString regex, FilterInfo::Mode mode) : - regex(regex), + regex(std::move(regex)), mode(mode) {} diff --git a/lib/packagedatabase.h b/lib/packagedatabase.h index 561cc4b..cd04bca 100644 --- a/lib/packagedatabase.h +++ b/lib/packagedatabase.h @@ -59,8 +59,8 @@ class LIBPAXCHANGE_SHARED_EXPORT FilterInfo Q_ENUM(Mode) public: - FilterInfo(const QString &name = QString(), - const QString &plugin = QString()); + FilterInfo(QString name = QString(), + QString plugin = QString()); QString name; QString plugin; diff --git a/lib/packagemanagerplugin.cpp b/lib/packagemanagerplugin.cpp index 8b8cbfb..5ce462d 100644 --- a/lib/packagemanagerplugin.cpp +++ b/lib/packagemanagerplugin.cpp @@ -1,12 +1,11 @@ #include "packagemanagerplugin.h" +#include + PackageManagerPlugin::PackageManagerPlugin(QObject *parent) : QObject(parent) {} -void PackageManagerPlugin::initialize() -{ - -} +void PackageManagerPlugin::initialize() {} bool PackageManagerPlugin::startGuiInstall(const QStringList &packages) { @@ -36,11 +35,11 @@ void PackageManagerPlugin::forwardedArguments(QStringList args) } PackageManagerPlugin::SettingsInfo::SettingsInfo(QString displayName, QString description, QString settingsKeys, int type, QVariant defaultValue, QByteArray widgetClassName, QVariantMap widgetProperties) : - displayName(displayName), - description(description), - settingsKeys(settingsKeys), + displayName(std::move(displayName)), + description(std::move(description)), + settingsKeys(std::move(settingsKeys)), type(type), - defaultValue(defaultValue), - widgetClassName(widgetClassName), - widgetProperties(widgetProperties) + defaultValue(std::move(defaultValue)), + widgetClassName(std::move(widgetClassName)), + widgetProperties(std::move(widgetProperties)) {} diff --git a/lib/syncedsettings.cpp b/lib/syncedsettings.cpp index 6f31a06..cb9853e 100644 --- a/lib/syncedsettings.cpp +++ b/lib/syncedsettings.cpp @@ -3,7 +3,7 @@ #include "pluginloader.h" #include "syncedsettings.h" -SyncedSettings::SyncedSettings(){} +SyncedSettings::SyncedSettings() = default; SyncedSettings::~SyncedSettings() { diff --git a/plugins/pacdummy/pacdummyplugin.cpp b/plugins/pacdummy/pacdummyplugin.cpp index 176ac43..f699b67 100644 --- a/plugins/pacdummy/pacdummyplugin.cpp +++ b/plugins/pacdummy/pacdummyplugin.cpp @@ -95,9 +95,9 @@ QString PacDummyPlugin::installationCmd(const QStringList &packages) bool stateChanged = false; for (auto package : packages) { - for(int i = 0; i < _pacList.size(); i++){ - if(_pacList[i].name == package){ - _pacList[i].installed = true; + for(auto &pkg : _pacList){ + if(pkg.name == package){ + pkg.installed = true; stateChanged = true; } } @@ -136,9 +136,9 @@ QString PacDummyPlugin::uninstallationCmd(const QStringList &packages) bool stateChanged = false; for (auto package : packages) { - for(int i = 0; i < _pacList.size(); i++){ - if(_pacList[i].name == package){ - _pacList[i].installed = false; + for(auto &pkg : _pacList){ + if(pkg.name == package){ + pkg.installed = false; stateChanged = true; } }