Fix various krazy2 warnings

Fix following krazy2 warning types:
[explicit], [endswithnewline], [doublequote_chars], [includes], [normalize],
[postfixop], [spelling]

See http://ebn.kde.org/krazy/reports/playground/base/kdeconnect-kde/index.html
for details.

SLOT/SIGNAL normalization done with Qt normalize utility:
https://github.com/qtproject/qtrepotools/tree/master/util/normalize

REVIEW: 124857
This commit is contained in:
Boris Egorov 2015-08-21 22:38:54 +06:00
parent ce354aae44
commit 1924173df2
31 changed files with 67 additions and 69 deletions

View file

@ -223,7 +223,7 @@ void LanLinkProvider::newConnection()
configureSocket(socket);
//This socket is still managed by us (and child of the QTcpServer), if
//it disconnects before we manage to pass it to a LanDeviceLink, it's
//our responsability to delete it. We do so with this connection.
//our responsibility to delete it. We do so with this connection.
connect(socket, SIGNAL(disconnected()),
socket, SLOT(deleteLater()));
connect(socket, SIGNAL(readyRead()),

View file

@ -37,7 +37,7 @@ class SocketLineReader
Q_OBJECT
public:
SocketLineReader(QTcpSocket* socket, QObject* parent = 0);
explicit SocketLineReader(QTcpSocket* socket, QObject* parent = 0);
QByteArray readLine() { return mPackages.dequeue(); }
qint64 write(const QByteArray& data) { return mSocket->write(data); }

View file

@ -18,10 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "uploadjob.h"
#include <qalgorithms.h>
#include <QtGlobal>
#include "uploadjob.h"
#include "core_debug.h"
UploadJob::UploadJob(const QSharedPointer<QIODevice>& source): KJob()

View file

@ -34,7 +34,7 @@ class UploadJob
{
Q_OBJECT
public:
UploadJob(const QSharedPointer<QIODevice>& source);
explicit UploadJob(const QSharedPointer<QIODevice>& source);
virtual void start();
QVariantMap getTransferInfo();

View file

@ -31,7 +31,6 @@
#include "backends/lan/lanlinkprovider.h"
#include "backends/loopback/loopbacklinkprovider.h"
#include "device.h"
#include "networkpackage.h"
#include "backends/devicelink.h"
#include "backends/linkprovider.h"

View file

@ -39,7 +39,7 @@ class KDECONNECTCORE_EXPORT Daemon
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.daemon")
public:
Daemon(QObject *parent);
explicit Daemon(QObject *parent);
~Daemon();
public Q_SLOTS:

View file

@ -140,7 +140,7 @@ void Device::reloadPlugins()
//If we don't find intersection with the received on one end and the sent on the other, we don't
//let the plugin stay
//Also, if no capabilities are specified on the other end, we don't apply this optimizaton, as
//we asume that the other client doesn't know about capabilities.
//we assume that the other client doesn't know about capabilities.
if (!m_incomingCapabilities.isEmpty() && !m_outgoingCapabilities.isEmpty()
&& (m_incomingCapabilities & outgoingInterfaces.toSet()).isEmpty()
&& (m_outgoingCapabilities & incomingInterfaces.toSet()).isEmpty()
@ -512,7 +512,7 @@ QString Device::iconForStatus(bool reachable, bool paired) const
QString status = (reachable? (paired? QStringLiteral("connected") : QStringLiteral("disconnected")) : QStringLiteral("trusted"));
QString type = type2str(deviceType);
return type+"-"+status;
return type+'-'+status;
}
void Device::setName(const QString &name)

View file

@ -27,7 +27,6 @@
#include <QDebug>
#include <QFileInfo>
#include <QUuid>
#include <QDebug>
#include <QDir>
#include <QStandardPaths>
#include <QCoreApplication>
@ -114,7 +113,7 @@ KdeConnectConfig::KdeConnectConfig()
QString KdeConnectConfig::name()
{
QString defaultName = qgetenv("USER") + "@" + QHostInfo::localHostName();
QString defaultName = qgetenv("USER") + '@' + QHostInfo::localHostName();
d->config->beginGroup("myself");
QString name = d->config->value("name", defaultName).toString();
d->config->endGroup();

View file

@ -52,7 +52,7 @@ public:
const static QCA::EncryptionAlgorithm EncryptionAlgorithm;
const static int ProtocolVersion;
NetworkPackage(const QString& type);
explicit NetworkPackage(const QString& type);
static void createIdentityPackage(NetworkPackage*);

View file

@ -42,7 +42,7 @@ class KDECONNECTINTERFACES_EXPORT DaemonDbusInterface
{
Q_OBJECT
public:
DaemonDbusInterface(QObject* parent = 0);
explicit DaemonDbusInterface(QObject* parent = 0);
virtual ~DaemonDbusInterface();
static QString activatedService();
@ -57,7 +57,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface
Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairingChangedProxy)
public:
DeviceDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit DeviceDbusInterface(const QString& deviceId, QObject* parent = 0);
virtual ~DeviceDbusInterface();
Q_SCRIPTABLE QString id() const;
@ -75,7 +75,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceBatteryDbusInterface
{
Q_OBJECT
public:
DeviceBatteryDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit DeviceBatteryDbusInterface(const QString& deviceId, QObject* parent = 0);
virtual ~DeviceBatteryDbusInterface();
};
@ -84,7 +84,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface
{
Q_OBJECT
public:
DeviceNotificationsDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit DeviceNotificationsDbusInterface(const QString& deviceId, QObject* parent = 0);
virtual ~DeviceNotificationsDbusInterface();
};
@ -102,7 +102,7 @@ class KDECONNECTINTERFACES_EXPORT SftpDbusInterface
{
Q_OBJECT
public:
SftpDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit SftpDbusInterface(const QString& deviceId, QObject* parent = 0);
virtual ~SftpDbusInterface();
};
@ -119,7 +119,7 @@ class KDECONNECTINTERFACES_EXPORT MprisDbusInterface
Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY propertiesChangedProxy)
Q_PROPERTY(int position READ position WRITE setPosition NOTIFY propertiesChangedProxy)
public:
MprisDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit MprisDbusInterface(const QString& deviceId, QObject* parent = 0);
virtual ~MprisDbusInterface();
Q_SIGNALS:
@ -131,7 +131,7 @@ class KDECONNECTINTERFACES_EXPORT RemoteControlDbusInterface
{
Q_OBJECT
public:
RemoteControlDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit RemoteControlDbusInterface(const QString& deviceId, QObject* parent = 0);
~RemoteControlDbusInterface() override;
};
@ -141,7 +141,7 @@ class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface
Q_OBJECT
Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked NOTIFY lockedChangedProxy)
public:
LockDeviceDbusInterface(const QString& deviceId, QObject* parent = 0);
explicit LockDeviceDbusInterface(const QString& deviceId, QObject* parent = 0);
virtual ~LockDeviceDbusInterface();
Q_SIGNALS:

View file

@ -57,7 +57,7 @@ public:
Q_FLAGS(StatusFilterFlags)
Q_ENUMS(StatusFilterFlag)
DevicesModel(QObject *parent = 0);
explicit DevicesModel(QObject *parent = 0);
virtual ~DevicesModel();
void setDisplayFilter(int flags);

View file

@ -30,7 +30,7 @@ class KDECONNECTINTERFACES_EXPORT DevicesSortProxyModel : public QSortFilterProx
{
Q_OBJECT
public:
DevicesSortProxyModel(DevicesModel* devicesModel = Q_NULLPTR);
explicit DevicesSortProxyModel(DevicesModel* devicesModel = Q_NULLPTR);
virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
virtual void setSourceModel(QAbstractItemModel *sourceModel);

View file

@ -21,10 +21,10 @@
**
****************************************************************************/
#include <QtGui/QtGui>
#include "modeltest.h"
#include <QtGui/QtGui>
Q_DECLARE_METATYPE(QModelIndex)
/*!
@ -34,28 +34,28 @@ ModelTest::ModelTest(QAbstractItemModel *_model, QObject *parent) : QObject(pare
{
Q_ASSERT(model);
connect(model, SIGNAL(columnsAboutToBeInserted(const QModelIndex &, int, int)),
connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex &, int, int)),
connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsRemoved(const QModelIndex &, int, int)),
connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests()));
connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests()));
connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
// Special checks for inserting/removing
@ -64,14 +64,14 @@ ModelTest::ModelTest(QAbstractItemModel *_model, QObject *parent) : QObject(pare
connect(model, SIGNAL(layoutChanged()),
this, SLOT(layoutChanged()));
connect(model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
this, SLOT(rowsAboutToBeInserted(const QModelIndex &, int, int)));
connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
this, SLOT(rowsInserted(const QModelIndex &, int, int)));
connect(model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
this, SLOT(rowsRemoved(const QModelIndex &, int, int)));
connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(rowsInserted(QModelIndex,int,int)));
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(rowsRemoved(QModelIndex,int,int)));
runAllTests();
}

View file

@ -33,7 +33,7 @@ class ModelTest : public QObject
Q_OBJECT
public:
ModelTest(QAbstractItemModel *model, QObject *parent = 0);
explicit ModelTest(QAbstractItemModel *model, QObject *parent = 0);
private Q_SLOTS:
void nonDestructiveBasicTest();

View file

@ -47,7 +47,7 @@ public:
DbusInterfaceRole,
};
NotificationsModel(QObject* parent = 0);
explicit NotificationsModel(QObject* parent = 0);
virtual ~NotificationsModel();
QString deviceId() const;

View file

@ -143,7 +143,7 @@ void KioKdeconnect::listDevice()
QVariantMap urls = urlreply.value();
for (QVariantMap::iterator it = urls.begin(); it != urls.end(); it++) {
for (QVariantMap::iterator it = urls.begin(); it != urls.end(); ++it) {
QString path = it.key();
QString name = it.value().toString();
@ -170,7 +170,7 @@ void KioKdeconnect::listDir(const QUrl &url)
{
qCDebug(KDECONNECT_KIO) << "Listing..." << url;
/// Url is not used here becuase all we could care about the url is the host, and that's already
/// Url is not used here because all we could care about the url is the host, and that's already
/// handled in @p setHost
Q_UNUSED(url);

View file

@ -27,7 +27,7 @@ class ProcessRunner : public QObject
Q_OBJECT
public:
ProcessRunner(QObject *parent = 0);
explicit ProcessRunner(QObject *parent = 0);
~ProcessRunner();
Q_INVOKABLE void runKdeconnectKCM();

View file

@ -1,11 +1,10 @@
#include "responsewaiter.h"
#include <QDBusPendingCall>
#include <QDBusPendingReply>
#include <QDebug>
#include <QCoreApplication>
#include "responsewaiter.h"
Q_DECLARE_METATYPE(QDBusPendingReply<>)
Q_DECLARE_METATYPE(QDBusPendingReply<QVariant>)
Q_DECLARE_METATYPE(QDBusPendingReply<bool>)

View file

@ -36,7 +36,7 @@ class DBusAsyncResponse : public QObject
Q_PROPERTY(bool autoDelete READ autodelete WRITE setAutodelete)
public:
DBusAsyncResponse(QObject* parent = 0);
explicit DBusAsyncResponse(QObject* parent = 0);
virtual ~DBusAsyncResponse() {};
Q_INVOKABLE void setPendingCall(QVariant e);

View file

@ -107,7 +107,7 @@ void Mounter::onPakcageReceived(const NetworkPackage& np)
const QString program = "sshfs";
QString path;
if (np.has("multiPaths")) path = "/";
if (np.has("multiPaths")) path = '/';
else path = np.get<QString>("path");
const QStringList arguments = QStringList()

View file

@ -28,7 +28,7 @@ class AutoClosingQFile : public QFile
Q_OBJECT
public:
AutoClosingQFile(const QString &name);
explicit AutoClosingQFile(const QString &name);
qint64 readData(char* data, qint64 maxlen) Q_DECL_OVERRIDE {
qint64 read = QFile::readData(data, maxlen);
if (read == -1 || read == bytesAvailable()) {