diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2018-10-12 17:25:04 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2018-10-12 17:25:04 +0200 |
commit | 777e20f67cca7ed7776863f3662547116597d1e4 (patch) | |
tree | b7760a5df2b120d75d2ff8e5f8af4a423c181e27 /src | |
parent | 69512ff6f286371d2846b84a809bbfbc9a7e7289 (diff) |
Some cleanup with help of Clang-Tidy and Clazy (part 3 of x)
Diffstat (limited to 'src')
-rw-r--r-- | src/imitatepass.cpp | 7 | ||||
-rw-r--r-- | src/imitatepass.h | 2 | ||||
-rw-r--r-- | src/keygendialog.cpp | 2 | ||||
-rw-r--r-- | src/keygendialog.h | 2 | ||||
-rw-r--r-- | src/qtpass.cpp | 3 | ||||
-rw-r--r-- | src/realpass.cpp | 3 | ||||
-rw-r--r-- | src/singleapplication.cpp | 6 | ||||
-rw-r--r-- | src/singleapplication.h | 2 | ||||
-rw-r--r-- | src/storemodel.cpp | 6 | ||||
-rw-r--r-- | src/trayicon.cpp | 2 | ||||
-rw-r--r-- | src/trayicon.h | 2 | ||||
-rw-r--r-- | src/usersdialog.cpp | 9 |
12 files changed, 25 insertions, 21 deletions
diff --git a/src/imitatepass.cpp b/src/imitatepass.cpp index 7998bf0f..a0b19d1e 100644 --- a/src/imitatepass.cpp +++ b/src/imitatepass.cpp @@ -1,6 +1,7 @@ #include "imitatepass.h" #include "qtpasssettings.h" #include <QDirIterator> +#include <utility> #ifdef QT_DEBUG #include "debughelper.h" @@ -222,7 +223,7 @@ bool ImitatePass::removeDir(const QString &dirName) { * This is stil quite experimental.. * @param dir */ -void ImitatePass::reencryptPath(QString dir) { +void ImitatePass::reencryptPath(const QString &dir) { emit statusMsg(tr("Re-encrypting from folder %1").arg(dir), 3000); emit startReencryptPath(); if (QtPassSettings::isAutoPull()) { @@ -395,7 +396,7 @@ void ImitatePass::Copy(const QString src, const QString dest, */ void ImitatePass::executeGpg(PROCESS id, const QStringList &args, QString input, bool readStdout, bool readStderr) { - executeWrapper(id, QtPassSettings::getGpgExecutable(), args, input, + executeWrapper(id, QtPassSettings::getGpgExecutable(), args, std::move(input), readStdout, readStderr); } /** @@ -404,7 +405,7 @@ void ImitatePass::executeGpg(PROCESS id, const QStringList &args, QString input, */ void ImitatePass::executeGit(PROCESS id, const QStringList &args, QString input, bool readStdout, bool readStderr) { - executeWrapper(id, QtPassSettings::getGitExecutable(), args, input, + executeWrapper(id, QtPassSettings::getGitExecutable(), args, std::move(input), readStdout, readStderr); } diff --git a/src/imitatepass.h b/src/imitatepass.h index 7c402aa6..b00c08bb 100644 --- a/src/imitatepass.h +++ b/src/imitatepass.h @@ -57,7 +57,7 @@ public: virtual void Remove(QString file, bool isDir = false) Q_DECL_OVERRIDE; virtual void Init(QString path, const QList<UserInfo> &list) Q_DECL_OVERRIDE; - void reencryptPath(QString dir); + void reencryptPath(const QString &dir); signals: void startReencryptPath(); void endReencryptPath(); diff --git a/src/keygendialog.cpp b/src/keygendialog.cpp index c626c58f..bde737f4 100644 --- a/src/keygendialog.cpp +++ b/src/keygendialog.cpp @@ -80,7 +80,7 @@ void KeygenDialog::on_name_textChanged(const QString &arg1) { * @param key * @param value */ -void KeygenDialog::replace(QString key, QString value) { +void KeygenDialog::replace(const QString &key, const QString &value) { QStringList clear; QString expert = ui->plainTextEdit->toPlainText(); QStringList lines = expert.split(QRegExp("[\r\n]"), QString::SkipEmptyParts); diff --git a/src/keygendialog.h b/src/keygendialog.h index 1ad0c0af..77af953b 100644 --- a/src/keygendialog.h +++ b/src/keygendialog.h @@ -32,7 +32,7 @@ private slots: private: Ui::KeygenDialog *ui; - void replace(QString, QString); + void replace(const QString &, const QString &); void done(int r); void no_protection(bool enable); ConfigDialog *dialog; diff --git a/src/qtpass.cpp b/src/qtpass.cpp index fda99cad..ad8880b5 100644 --- a/src/qtpass.cpp +++ b/src/qtpass.cpp @@ -7,6 +7,7 @@ #ifndef Q_OS_WIN #include <QInputDialog> #include <QLineEdit> +#include <utility> #else #define WIN32_LEAN_AND_MEAN /*_KILLING_MACHINE*/ #define WIN32_EXTRA_LEAN @@ -325,7 +326,7 @@ void QtPass::onKeyGenerationComplete(const QString &p_output, } void QtPass::passShowHandlerFinished(QString output) { - showInTextBrowser(output); + showInTextBrowser(std::move(output)); } void QtPass::showInTextBrowser(QString output, QString prefix, diff --git a/src/realpass.cpp b/src/realpass.cpp index bf420340..b91c05b7 100644 --- a/src/realpass.cpp +++ b/src/realpass.cpp @@ -3,6 +3,7 @@ #include <QDir> #include <QFileInfo> +#include <utility> using namespace Enums; @@ -176,6 +177,6 @@ void RealPass::Copy(const QString src, const QString dest, const bool force) { */ void RealPass::executePass(PROCESS id, const QStringList &args, QString input, bool readStdout, bool readStderr) { - executeWrapper(id, QtPassSettings::getPassExecutable(), args, input, + executeWrapper(id, QtPassSettings::getPassExecutable(), args, std::move(input), readStdout, readStderr); } diff --git a/src/singleapplication.cpp b/src/singleapplication.cpp index 5376585f..d7c75453 100644 --- a/src/singleapplication.cpp +++ b/src/singleapplication.cpp @@ -1,6 +1,6 @@ #include "singleapplication.h" #include <QLocalSocket> - +#include <utility> #ifdef QT_DEBUG #include "debughelper.h" #endif @@ -13,8 +13,8 @@ * @param uniqueKey */ SingleApplication::SingleApplication(int &argc, char *argv[], - const QString uniqueKey) - : QApplication(argc, argv), _uniqueKey(uniqueKey) { + const QString &uniqueKey) + : QApplication(argc, argv), _uniqueKey(std::move(uniqueKey)) { sharedMemory.setKey(_uniqueKey); if (sharedMemory.attach()) { _isRunning = true; diff --git a/src/singleapplication.h b/src/singleapplication.h index 59640979..53362044 100644 --- a/src/singleapplication.h +++ b/src/singleapplication.h @@ -14,7 +14,7 @@ class SingleApplication : public QApplication { Q_OBJECT public: - SingleApplication(int &argc, char *argv[], const QString uniqueKey); + SingleApplication(int &argc, char *argv[], const QString &uniqueKey); bool isRunning(); bool sendMessage(const QString &message); diff --git a/src/storemodel.cpp b/src/storemodel.cpp index 0f6dca0a..39c05c7a 100644 --- a/src/storemodel.cpp +++ b/src/storemodel.cpp @@ -4,6 +4,7 @@ #include <QDebug> #include <QMessageBox> #include <QMimeData> +#include <utility> QDataStream & operator<<(QDataStream &out, @@ -80,7 +81,7 @@ bool StoreModel::ShowThis(const QModelIndex index) const { void StoreModel::setModelAndStore(QFileSystemModel *sourceModel, QString passStore) { fs = sourceModel; - store = passStore; + store = std::move(passStore); } /** @@ -175,8 +176,7 @@ bool StoreModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, QDataStream stream(&encodedData, QIODevice::ReadOnly); dragAndDropInfoPasswordStore info; stream >> info; - if (data->hasFormat("application/vnd+qtpass.dragAndDropInfoPasswordStore") == - false) + if (!data->hasFormat("application/vnd+qtpass.dragAndDropInfoPasswordStore")) return false; if (column > 0) { diff --git a/src/trayicon.cpp b/src/trayicon.cpp index 99f80def..bc6972aa 100644 --- a/src/trayicon.cpp +++ b/src/trayicon.cpp @@ -128,6 +128,6 @@ void TrayIcon::iconActivated(QSystemTrayIcon::ActivationReason reason) { * @param msg * @param time */ -void TrayIcon::showMessage(QString title, QString msg, int time) { +void TrayIcon::showMessage(const QString &title, const QString &msg, int time) { sysTrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, time); } diff --git a/src/trayicon.h b/src/trayicon.h index de91d4a6..c42d9bde 100644 --- a/src/trayicon.h +++ b/src/trayicon.h @@ -16,7 +16,7 @@ class TrayIcon : public QWidget { public: explicit TrayIcon(QMainWindow *parent); - void showMessage(QString title, QString msg, int time); + void showMessage(const QString &title, const QString &msg, int time); void setVisible(bool visible); bool getIsAllocated(); diff --git a/src/usersdialog.cpp b/src/usersdialog.cpp index 34b28fb9..47ffd99b 100644 --- a/src/usersdialog.cpp +++ b/src/usersdialog.cpp @@ -6,6 +6,7 @@ #include <QMessageBox> #include <QRegExp> #include <QWidget> +#include <utility> #ifdef QT_DEBUG #include "debughelper.h" @@ -15,7 +16,7 @@ * @param parent */ UsersDialog::UsersDialog(QString dir, QWidget *parent) - : QDialog(parent), ui(new Ui::UsersDialog), m_dir(dir) { + : QDialog(parent), ui(new Ui::UsersDialog), m_dir(std::move(dir)) { ui->setupUi(this); @@ -28,7 +29,7 @@ UsersDialog::UsersDialog(QString dir, QWidget *parent) QList<UserInfo> secret_keys = QtPassSettings::getPass()->listKeys("", true); foreach (const UserInfo &sec, secret_keys) { - for (auto & user : users) + for (auto &user : users) if (sec.key_id == user.key_id) user.have_secret = true; } @@ -41,7 +42,7 @@ UsersDialog::UsersDialog(QString dir, QWidget *parent) if (!recipients.isEmpty()) selected_users = QtPassSettings::getPass()->listKeys(recipients); foreach (const UserInfo &sel, selected_users) { - for (auto & user : users) + for (auto &user : users) if (sel.key_id == user.key_id) user.enabled = true; } @@ -137,7 +138,7 @@ void UsersDialog::populateList(const QString &filter) { nameFilter.setCaseSensitivity(Qt::CaseInsensitive); ui->listWidget->clear(); if (!m_userList.isEmpty()) { - for (auto & user : m_userList) { + for (auto &user : m_userList) { if (filter.isEmpty() || nameFilter.exactMatch(user.name)) { if (!user.isValid() && !ui->checkBox->isChecked()) continue; |