Skip to content

Commit

Permalink
use new connect syntax
Browse files Browse the repository at this point in the history
mainly done using clazy and old-style-connect check

close #5426

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Feb 23, 2023
1 parent 1335a98 commit a5aac28
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 92 deletions.
2 changes: 1 addition & 1 deletion shell_integration/dolphin/ownclouddolphinactionplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class OwncloudDolphinPluginAction : public KAbstractFileItemActionPlugin
});
}
});
QTimer::singleShot(100, &loop, SLOT(quit())); // add a timeout to be sure we don't freeze dolphin
QTimer::singleShot(100, &loop, &QEventLoop::quit); // add a timeout to be sure we don't freeze dolphin
helper->sendCommand(QByteArray("GET_MENU_ITEMS:" + files + "\n"));
loop.exec(QEventLoop::ExcludeUserInputEvents);
disconnect(con);
Expand Down
4 changes: 2 additions & 2 deletions src/3rdparty/kmessagewidget/kmessagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)

// Note: when changing the value 500, also update KMessageWidgetTest
timeLine = new QTimeLine(500, q);
QObject::connect(timeLine, SIGNAL(valueChanged(qreal)), q, SLOT(slotTimeLineChanged(qreal)));
QObject::connect(timeLine, SIGNAL(finished()), q, SLOT(slotTimeLineFinished()));
QObject::connect(timeLine, &QTimeLine::valueChanged, q, [this] (qreal value) { slotTimeLineChanged(value); });
QObject::connect(timeLine, &QTimeLine::finished, q, [this] () { slotTimeLineFinished(); });

content = new QFrame(q);
content->setObjectName(QStringLiteral("contentWidget"));
Expand Down
4 changes: 2 additions & 2 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool Application::configVersionMigration()

box.exec();
if (box.clickedButton() != continueBtn) {
QTimer::singleShot(0, qApp, SLOT(quit()));
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return false;
}

Expand Down Expand Up @@ -379,7 +379,7 @@ Application::Application(int &argc, char **argv)
"file at %1. Please make sure the file can be accessed by your system account.")
.arg(ConfigFile().configFile()),
tr("Quit %1").arg(Theme::instance()->appNameGUI()));
QTimer::singleShot(0, qApp, SLOT(quit()));
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/gui/cloudproviders/cloudprovidermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ void on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user
void CloudProviderManager::registerSignals()
{
OCC::FolderMan *folderManager = OCC::FolderMan::instance();
connect(folderManager, SIGNAL(folderListChanged(const Folder::Map &)), SLOT(slotFolderListChanged(const Folder::Map &)));
connect(folderManager, &OCC::FolderMan::folderListChanged,
this, &CloudProviderManager::slotFolderListChanged);
slotFolderListChanged(folderManager->map());
}

Expand Down
8 changes: 4 additions & 4 deletions src/gui/cloudproviders/cloudproviderwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, int
action_group = getActionGroup();
cloud_providers_account_exporter_set_action_group (_cloudProviderAccount, action_group);

connect(ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, ProgressInfo)), this, SLOT(slotUpdateProgress(QString, ProgressInfo)));
connect(_folder, SIGNAL(syncStarted()), this, SLOT(slotSyncStarted()));
connect(_folder, SIGNAL(syncFinished(SyncResult)), this, SLOT(slotSyncFinished(const SyncResult)));
connect(_folder, SIGNAL(syncPausedChanged(Folder*,bool)), this, SLOT(slotSyncPausedChanged(Folder*, bool)));
connect(ProgressDispatcher::instance(), &ProgressDispatcher::progressInfo, this, &CloudProviderWrapper::slotUpdateProgress);
connect(_folder, &Folder::syncStarted, this, &CloudProviderWrapper::slotSyncStarted);
connect(_folder, &Folder::syncFinished, this, &CloudProviderWrapper::slotSyncFinished);
connect(_folder, &Folder::syncPausedChanged, this, &CloudProviderWrapper::slotSyncPausedChanged);

_paused = _folder->syncPaused();
updatePauseStatus();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/remotewipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ void RemoteWipe::startCheckJobWithAppPassword(QString pwd){
QUrlQuery arguments(QString("token=%1").arg(_appPassword));
requestBody->setData(arguments.query(QUrl::FullyEncoded).toLatin1());
_networkReplyCheck = _networkManager.post(request, requestBody);
QObject::connect(&_networkManager, SIGNAL(sslErrors(QNetworkReply *, QList<QSslError>)),
_account.data(), SLOT(slotHandleSslErrors(QNetworkReply *, QList<QSslError>)));
QObject::connect(&_networkManager, &QNetworkAccessManager::sslErrors,
_account.data(), &Account::slotHandleSslErrors);
QObject::connect(_networkReplyCheck, &QNetworkReply::finished, this,
&RemoteWipe::checkJobSlot);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/wizard/slideshow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void SlideShow::setCurrentSlide(int index)
_animation->setDuration(SlideDuration);
_animation->setEasingCurve(QEasingCurve::OutCubic);
_animation->setStartValue(static_cast<qreal>(_currentIndex));
connect(_animation.data(), SIGNAL(valueChanged(QVariant)), this, SLOT(update()));
connect(_animation.data(), &QVariantAnimation::valueChanged, this, qOverload<>(&SlideShow::update));
}
_animation->setEndValue(static_cast<qreal>(index));
_animation->start(QAbstractAnimation::DeleteWhenStopped);
Expand Down
8 changes: 4 additions & 4 deletions src/libsync/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ void Account::setCredentials(AbstractCredentials *cred)
if (proxy.type() != QNetworkProxy::DefaultProxy) {
_am->setProxy(proxy);
}
connect(_am.data(), SIGNAL(sslErrors(QNetworkReply *, QList<QSslError>)),
SLOT(slotHandleSslErrors(QNetworkReply *, QList<QSslError>)));
connect(_am.data(), &QNetworkAccessManager::sslErrors,
this, &Account::slotHandleSslErrors);
connect(_am.data(), &QNetworkAccessManager::proxyAuthenticationRequired,
this, &Account::proxyAuthenticationRequired);
connect(_credentials.data(), &AbstractCredentials::fetched,
Expand Down Expand Up @@ -376,8 +376,8 @@ void Account::resetNetworkAccessManager()
_am->setCookieJar(jar); // takes ownership of the old cookie jar
_am->setProxy(proxy); // Remember proxy (issue #2108)

connect(_am.data(), SIGNAL(sslErrors(QNetworkReply *, QList<QSslError>)),
SLOT(slotHandleSslErrors(QNetworkReply *, QList<QSslError>)));
connect(_am.data(), &QNetworkAccessManager::sslErrors,
this, &Account::slotHandleSslErrors);
connect(_am.data(), &QNetworkAccessManager::proxyAuthenticationRequired,
this, &Account::proxyAuthenticationRequired);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/owncloudpropagator.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
Q_ARG(PropagatorJob::AbortType, PropagatorJob::AbortType::Asynchronous));

// Give asynchronous abort 5000 msec to finish on its own
QTimer::singleShot(5000, this, SLOT(abortTimeout()));
QTimer::singleShot(5000, this, &OwncloudPropagator::abortTimeout);
} else {
// No root job, call emitFinished
emitFinished(SyncFileItem::NormalError);
Expand Down
2 changes: 1 addition & 1 deletion test/syncenginetestutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class FakeFolder
void execUntilItemCompleted(const QString &relativePath);

bool execUntilFinished() {
QSignalSpy spy(_syncEngine.get(), SIGNAL(finished(bool)));
QSignalSpy spy(_syncEngine.get(), &OCC::SyncEngine::finished);
bool ok = spy.wait(3600000);
Q_ASSERT(ok && "Sync timed out");
return spy[0][0].toBool();
Expand Down
12 changes: 6 additions & 6 deletions test/testchecksumvalidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ using namespace OCC::Utility;
_expectedType = "Adler32";
vali->setChecksumType(_expectedType);

connect(vali, SIGNAL(done(QByteArray,QByteArray)), SLOT(slotUpValidated(QByteArray,QByteArray)));
connect(vali, &ComputeChecksum::done, this, &TestChecksumValidator::slotUpValidated);

auto file = new QFile(_testfile, vali);
file->open(QIODevice::ReadOnly);
Expand All @@ -134,7 +134,7 @@ using namespace OCC::Utility;
vali->start(_testfile);

QEventLoop loop;
connect(vali, SIGNAL(done(QByteArray,QByteArray)), &loop, SLOT(quit()), Qt::QueuedConnection);
connect(vali, &ComputeChecksum::done, &loop, &QEventLoop::quit, Qt::QueuedConnection);
loop.exec();

delete vali;
Expand All @@ -146,15 +146,15 @@ using namespace OCC::Utility;
auto *vali = new ComputeChecksum(this);
_expectedType = OCC::checkSumMD5C;
vali->setChecksumType(_expectedType);
connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray)));
connect(vali, &ComputeChecksum::done, this, &TestChecksumValidator::slotUpValidated);

auto file = new QFile(_testfile, vali);
file->open(QIODevice::ReadOnly);
_expected = calcMd5(file);
vali->start(_testfile);

QEventLoop loop;
connect(vali, SIGNAL(done(QByteArray,QByteArray)), &loop, SLOT(quit()), Qt::QueuedConnection);
connect(vali, &ComputeChecksum::done, &loop, &QEventLoop::quit, Qt::QueuedConnection);
loop.exec();

delete vali;
Expand All @@ -165,7 +165,7 @@ using namespace OCC::Utility;
auto *vali = new ComputeChecksum(this);
_expectedType = OCC::checkSumSHA1C;
vali->setChecksumType(_expectedType);
connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray)));
connect(vali, &ComputeChecksum::done, this, &TestChecksumValidator::slotUpValidated);

auto file = new QFile(_testfile, vali);
file->open(QIODevice::ReadOnly);
Expand All @@ -174,7 +174,7 @@ using namespace OCC::Utility;
vali->start(_testfile);

QEventLoop loop;
connect(vali, SIGNAL(done(QByteArray,QByteArray)), &loop, SLOT(quit()), Qt::QueuedConnection);
connect(vali, &ComputeChecksum::done, &loop, &QEventLoop::quit, Qt::QueuedConnection);
loop.exec();

delete vali;
Expand Down
6 changes: 3 additions & 3 deletions test/testdownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private slots:
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
fakeFolder.syncEngine().setIgnoreHiddenFiles(true);
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
QSignalSpy completeSpy(&fakeFolder.syncEngine(), &SyncEngine::itemCompleted);
auto size = 30 * 1000 * 1000;
fakeFolder.remoteModifier().insert("A/a0", size);

Expand Down Expand Up @@ -96,7 +96,7 @@ private slots:

FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
fakeFolder.syncEngine().setIgnoreHiddenFiles(true);
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
QSignalSpy completeSpy(&fakeFolder.syncEngine(), &SyncEngine::itemCompleted);
auto size = 3'500'000;
fakeFolder.remoteModifier().insert("A/broken", size);

Expand Down Expand Up @@ -236,7 +236,7 @@ private slots:
resendActual = 0;
resendExpected = 10;

QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
QSignalSpy completeSpy(&fakeFolder.syncEngine(), &SyncEngine::itemCompleted);
QVERIFY(!fakeFolder.syncOnce());
QCOMPARE(resendActual, 4); // the 4th fails because it only resends 3 times
QCOMPARE(getItem(completeSpy, "A/resendme")->_status, SyncFileItem::NormalError);
Expand Down
2 changes: 1 addition & 1 deletion test/testfolderwatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class TestFolderWatcher : public QObject

_watcher.reset(new FolderWatcher);
_watcher->init(_rootPath);
_pathChangedSpy.reset(new QSignalSpy(_watcher.data(), SIGNAL(pathChanged(QString))));
_pathChangedSpy.reset(new QSignalSpy(_watcher.data(), &FolderWatcher::pathChanged));
}

int countFolders(const QString &path)
Expand Down
4 changes: 2 additions & 2 deletions test/testsyncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ private slots:

void abortAfterFailedMkdir() {
FakeFolder fakeFolder{FileInfo{}};
QSignalSpy finishedSpy(&fakeFolder.syncEngine(), SIGNAL(finished(bool)));
QSignalSpy finishedSpy(&fakeFolder.syncEngine(), &SyncEngine::finished);
fakeFolder.serverErrorPaths().append("NewFolder");
fakeFolder.localModifier().mkdir("NewFolder");
// This should be aborted and would otherwise fail in FileInfo::create.
Expand All @@ -355,7 +355,7 @@ private slots:
* etag stored in the database yet. */
void testDirEtagAfterIncompleteSync() {
FakeFolder fakeFolder{FileInfo{}};
QSignalSpy finishedSpy(&fakeFolder.syncEngine(), SIGNAL(finished(bool)));
QSignalSpy finishedSpy(&fakeFolder.syncEngine(), &SyncEngine::finished);
fakeFolder.serverErrorPaths().append("NewFolder/foo");
fakeFolder.remoteModifier().mkdir("NewFolder");
fakeFolder.remoteModifier().insert("NewFolder/foo");
Expand Down
2 changes: 1 addition & 1 deletion test/testsyncfilestatustracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class StatusPushSpy : public QSignalSpy
SyncEngine &_syncEngine;
public:
StatusPushSpy(SyncEngine &syncEngine)
: QSignalSpy(&syncEngine.syncFileStatusTracker(), SIGNAL(fileStatusChanged(const QString&, SyncFileStatus)))
: QSignalSpy(&syncEngine.syncFileStatusTracker(), &SyncFileStatusTracker::fileStatusChanged)
, _syncEngine(syncEngine)
{ }

Expand Down
Loading

0 comments on commit a5aac28

Please sign in to comment.