From 8e2e9ecbc3cfa30468ec2e9e29409efdfe694ca6 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Fri, 3 Oct 2014 23:17:52 +0200 Subject: [PATCH] Convert to the new signal-slot syntax --- src/danbooruclientview.cpp | 6 ++---- src/danbooruconnectwidget.cpp | 14 +++++--------- src/libdanbooru/danbooruservice.cpp | 17 ++++++----------- src/mainwindow.cpp | 3 +-- src/model/danboorupostdelegate.cpp | 6 ++---- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/danbooruclientview.cpp b/src/danbooruclientview.cpp index 64b4881..0189238 100644 --- a/src/danbooruclientview.cpp +++ b/src/danbooruclientview.cpp @@ -56,10 +56,8 @@ namespace Danbooru { // signal-slot connections - connect(m_delegate, SIGNAL(postDownloadRequested(QUrl)), this, - SLOT(slotHandleDownload(QUrl))); - connect(m_delegate, SIGNAL(postViewRequested(QUrl)), this, - SLOT(slotHandleView(QUrl))); + connect(m_delegate, &DanbooruPostDelegate::postDownloadRequested, this, &DanbooruClientView::slotHandleDownload); + connect(m_delegate, &DanbooruPostDelegate::postViewRequested, this, &DanbooruClientView::slotHandleView); // connect(m_listView, SIGNAL(clicked(const QModelIndex&)), parent(), // SLOT(displayInfo(const QModelIndex&)); diff --git a/src/danbooruconnectwidget.cpp b/src/danbooruconnectwidget.cpp index ed80077..19cbe9e 100644 --- a/src/danbooruconnectwidget.cpp +++ b/src/danbooruconnectwidget.cpp @@ -82,18 +82,14 @@ DanbooruConnectWidget::DanbooruConnectWidget(QVector< QUrl > urlList, Wallet::Asynchronous ); - connect(m_wallet, SIGNAL(walletOpened(bool)), this, - SLOT(checkWallet(bool))); + connect(m_wallet, &KWallet::Wallet::walletOpened, this, &DanbooruConnectWidget::checkWallet); - connect(danbooruUrlComboBox, SIGNAL(currentIndexChanged(int)), this, - SLOT(getWalletData())); + connect(danbooruUrlComboBox, static_cast(&KComboBox::currentIndexChanged), this, &DanbooruConnectWidget::getWalletData); - connect(anonCheckBox, SIGNAL(stateChanged(int)), this, - SLOT(toggleLineEdits())); + connect(anonCheckBox, &QCheckBox::stateChanged, this, &DanbooruConnectWidget::toggleLineEdits); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(closeButton, SIGNAL(clicked(bool)), this, - SLOT(emitRejected())); + connect(buttonBox, &KDialogButtonBox::accepted, this, &DanbooruConnectWidget::accept); + connect(closeButton, &KPushButton::clicked, this, &DanbooruConnectWidget::emitRejected); } diff --git a/src/libdanbooru/danbooruservice.cpp b/src/libdanbooru/danbooruservice.cpp index 28a4d04..f623d5b 100644 --- a/src/libdanbooru/danbooruservice.cpp +++ b/src/libdanbooru/danbooruservice.cpp @@ -95,8 +95,7 @@ void DanbooruService::getPostList(int page, QStringList tags, int limit) // This job can use JSON data job->setProperty("needsXML", false); - connect(job, SIGNAL(result(KJob*)), this, - SLOT(processPostList(KJob*))); + connect(job, &KIO::StoredTransferJob::result, this, &DanbooruService::processPostList); } @@ -117,7 +116,7 @@ void DanbooruService::getTagList(int limit, QString name) KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload, KIO::HideProgressInfo); - connect(job, SIGNAL(result(KJob*)), this, SLOT(processTagList(KJob*))); + connect(job, &KIO::StoredTransferJob::result, this, &DanbooruService::processTagList); } void DanbooruService::getPool(int poolId, int page) @@ -145,8 +144,7 @@ void DanbooruService::getPool(int poolId, int page) job->setProperty("needsXML", true); - connect(job, SIGNAL(result(KJob*)), this, - SLOT(processPostList(KJob*))); + connect(job, &KIO::StoredTransferJob::result, this, &DanbooruService::processPostList); } @@ -172,8 +170,7 @@ void DanbooruService::getPoolList(int page) // This job can use JSON data job->setProperty("needsXML", false); - connect(job, SIGNAL(result(KJob*)), this, - SLOT(processPoolList(KJob*))); + connect(job, &KIO::StoredTransferJob::result, this, &DanbooruService::processPoolList); } @@ -213,8 +210,7 @@ void DanbooruService::getRelatedTags(const QStringList& tags, KIO::HideProgressInfo ); - connect(job, SIGNAL(result(KJob*)), this, - SLOT(processRelatedTagList(KJob*))); + connect(job, &StoredTransferJob::result, this, &DanbooruService::processRelatedTagList); } @@ -400,8 +396,7 @@ void DanbooruService::processPostList(KJob* job) pixmapJob->setProperty("danbooruPost", variant); - connect(pixmapJob, SIGNAL(result(KJob*)), this, - SLOT(downloadThumbnail(KJob*))); + connect(pixmapJob, &StoredTransferJob::result, this, &DanbooruService::downloadThumbnail); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 482130e..4da422d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -83,8 +83,7 @@ namespace Danbooru { // actionCollection()->removeAction(actionCollection()->action("help_contents")); KStandardAction::quit(qApp, SLOT(close()), actionCollection()); - connect(connectAction, SIGNAL(triggered(bool)), this, - SLOT(connectToBoard())); + connect(connectAction, &QAction::triggered, this, &DanbooruMainWindow::connectToBoard); connect(fetch, SIGNAL(triggered(bool)), this, SLOT(downloadPosts())); } diff --git a/src/model/danboorupostdelegate.cpp b/src/model/danboorupostdelegate.cpp index 4d8e49b..cdfb99e 100644 --- a/src/model/danboorupostdelegate.cpp +++ b/src/model/danboorupostdelegate.cpp @@ -74,10 +74,8 @@ namespace Danbooru { // Signal-slot connections - connect(m_viewButton, SIGNAL(clicked()), this, - SLOT(viewButtonClicked())); - connect(m_downloadButton, SIGNAL(clicked()), this, - SLOT(downloadButtonClicked())); + connect(m_viewButton, &QPushButton::clicked, this, &DanbooruPostDelegate::viewButtonClicked); + connect(m_downloadButton, &QPushButton::clicked, this, &DanbooruPostDelegate::downloadButtonClicked); }