Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
more code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Skycoder42 committed Apr 28, 2018
1 parent dcb3e88 commit 9d18c7f
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 51 deletions.
2 changes: 1 addition & 1 deletion gui/dbmergerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DbMergerDialog : public QDialog

public:
explicit DbMergerDialog(QWidget *parent = nullptr);
~DbMergerDialog();
~DbMergerDialog() override;

static void merge(QWidget *parent = nullptr);

Expand Down
2 changes: 1 addition & 1 deletion gui/settingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public slots:
QHash<QString, QWidget*> _settingsWidgets;

explicit SettingsDialog(QWidget *parent = nullptr);
~SettingsDialog();
~SettingsDialog() override;

void createWidgets(QWidget *parent,
QFormLayout *layout,
Expand Down
2 changes: 1 addition & 1 deletion gui/traycontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TrayControl : public QObject

public:
explicit TrayControl(QObject *parent = nullptr);
~TrayControl();
~TrayControl() override;

void show();

Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/editpackageswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class EditPackagesWidget : public QWidget

public:
explicit EditPackagesWidget(QWidget *parent = nullptr);
~EditPackagesWidget();
~EditPackagesWidget() override;

QStringList packages() const;

Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/extrafilterswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void ExtraFiltersWidget::addFilter(const ExtraFilter &filter)
box->setCurrentIndex(filter.mode);
connect(box, QOverload<int>::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<FilterInfo::Mode>(index)));
});
_ui->treeWidget->setItemWidget(item, 1, box);
}
Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/extrafilterswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ExtraFiltersWidget : public QWidget

public:
explicit ExtraFiltersWidget(QWidget *parent = nullptr);
~ExtraFiltersWidget();
~ExtraFiltersWidget() override;

QList<ExtraFilter> extraFilters() const;

Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/filterswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FiltersWidget : public QWidget

public:
explicit FiltersWidget(QWidget *parent = nullptr);
~FiltersWidget();
~FiltersWidget() override;

QMap<QString, FilterInfo> filters() const;

Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/globalfilterwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GlobalFilterWidget : public QWidget

public:
explicit GlobalFilterWidget(QWidget *parent = nullptr);
~GlobalFilterWidget();
~GlobalFilterWidget() override;

FilterInfo::Mode mode() const;

Expand Down
9 changes: 6 additions & 3 deletions gui/widgets/unclearpackageswidget.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include <utility>

#include "unclearpackageswidget.h"
#include "ui_unclearpackageswidget.h"

#include <QPainter>
#include <QPushButton>
#include <QHeaderView>
#include <QMouseEvent>
#include <utility>

UnclearPackagesWidget::UnclearPackagesWidget(QWidget *parent) :
QWidget(parent),
Expand Down Expand Up @@ -72,9 +75,9 @@ void UnclearPackagesWidget::setPackages(UnclearHelper packages)



UnclearHelper::UnclearHelper(const QList<UnclearPackageInfo> &packages, const QList<UnclearPackageInfo> &ignored) :
sync(packages),
ignore(ignored)
UnclearHelper::UnclearHelper(QList<UnclearPackageInfo> packages, QList<UnclearPackageInfo> ignored) :
sync(std::move(packages)),
ignore(std::move(ignored))
{}


Expand Down
6 changes: 3 additions & 3 deletions gui/widgets/unclearpackageswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class UnclearDelegate : public QStyledItemDelegate
class UnclearHelper
{
public:
UnclearHelper(const QList<UnclearPackageInfo> &sync = {},
const QList<UnclearPackageInfo> &ignore = {});
UnclearHelper(QList<UnclearPackageInfo> sync = {},
QList<UnclearPackageInfo> ignore = {});

QList<UnclearPackageInfo> sync;
QList<UnclearPackageInfo> ignore;
Expand All @@ -61,7 +61,7 @@ class UnclearPackagesWidget : public QWidget
Q_ENUM(ExtraRoles)

explicit UnclearPackagesWidget(QWidget *parent = nullptr);
~UnclearPackagesWidget();
~UnclearPackagesWidget() override;

UnclearHelper packages() const;

Expand Down
2 changes: 1 addition & 1 deletion gui/wizard/databasewizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DatabaseWizard : public QWizard
Q_OBJECT
public:
explicit DatabaseWizard(QWidget *parent = nullptr);
~DatabaseWizard();
~DatabaseWizard() override;

static bool run();

Expand Down
2 changes: 1 addition & 1 deletion gui/wizard/dbpathpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DbPathPage : public QWizardPage

public:
explicit DbPathPage(QWidget *parent = nullptr);
~DbPathPage();
~DbPathPage() override;

void initializePage() override;
void cleanupPage() override;
Expand Down
2 changes: 1 addition & 1 deletion gui/wizard/dbselectionpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DbSelectionPage : public QWizardPage

public:
explicit DbSelectionPage(QWidget *parent = nullptr);
~DbSelectionPage();
~DbSelectionPage() override;

void cleanupPage() override;

Expand Down
7 changes: 4 additions & 3 deletions gui/wizard/dbwidgetpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
#include <QWizardPage>
#include <QMetaProperty>
#include <QVBoxLayout>
#include <utility>
#include <databasecontroller.h>

template <typename T>
class DbWidgetPage : public QWizardPage
{
public:
explicit DbWidgetPage(const QString &fieldName,
const QByteArray &dbProperty,
QByteArray dbProperty,
QWidget *parent = nullptr);

void initializePage() override;
Expand All @@ -27,10 +28,10 @@ class DbWidgetPage : public QWizardPage
};

template <typename T>
DbWidgetPage<T>::DbWidgetPage(const QString &fieldName, const QByteArray &dbProperty, QWidget *parent) :
DbWidgetPage<T>::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);
Expand Down
8 changes: 5 additions & 3 deletions lib/comboboxconfig.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "comboboxconfig.h"

#include <utility>

ComboboxConfig::ComboboxConfig(QStringList displayNames, QList<QVariant> 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)
{}

Expand Down
4 changes: 2 additions & 2 deletions lib/databasemerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ bool DatabaseMerger::mergeDb(QString dbPath)
if(!otherFile.open(QIODevice::ReadOnly))
throw DatabaseException(otherFile.errorString());

PackageDatabase pacDbCurrent = _js->deserializeFrom<PackageDatabase>(&currentFile);
PackageDatabase pacDbOther = _js->deserializeFrom<PackageDatabase>(&otherFile);
auto pacDbCurrent = _js->deserializeFrom<PackageDatabase>(&currentFile);
auto pacDbOther = _js->deserializeFrom<PackageDatabase>(&otherFile);
otherFile.close();

//packages: keep install on conflict
Expand Down
16 changes: 9 additions & 7 deletions lib/packagedatabase.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "packagedatabase.h"

#include <utility>

PackageInfo::PackageInfo(QString name, bool removed) :
name(name),
name(std::move(name)),
removed(removed)
{}

Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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)
{}

Expand Down
4 changes: 2 additions & 2 deletions lib/packagedatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 9 additions & 10 deletions lib/packagemanagerplugin.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "packagemanagerplugin.h"
#include <utility>

PackageManagerPlugin::PackageManagerPlugin(QObject *parent) :
QObject(parent)
{}

void PackageManagerPlugin::initialize()
{

}
void PackageManagerPlugin::initialize() {}

bool PackageManagerPlugin::startGuiInstall(const QStringList &packages)
{
Expand Down Expand Up @@ -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))
{}
2 changes: 1 addition & 1 deletion lib/syncedsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "pluginloader.h"
#include "syncedsettings.h"

SyncedSettings::SyncedSettings(){}
SyncedSettings::SyncedSettings() = default;

SyncedSettings::~SyncedSettings()
{
Expand Down
12 changes: 6 additions & 6 deletions plugins/pacdummy/pacdummyplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 9d18c7f

Please sign in to comment.