Commit dc3feb69 authored by Volker Krause's avatar Volker Krause

Port to new connect syntax

parent 546879d3
...@@ -71,12 +71,12 @@ ProviderPrivate::ProviderPrivate(Provider *qq) ...@@ -71,12 +71,12 @@ ProviderPrivate::ProviderPrivate(Provider *qq)
, encouragementInterval(-1) , encouragementInterval(-1)
{ {
submissionTimer.setSingleShot(true); submissionTimer.setSingleShot(true);
QObject::connect(&submissionTimer, SIGNAL(timeout()), q, SLOT(submit())); QObject::connect(&submissionTimer, &QTimer::timeout, q, &Provider::submit);
startTime.start(); startTime.start();
encouragementTimer.setSingleShot(true); encouragementTimer.setSingleShot(true);
QObject::connect(&encouragementTimer, SIGNAL(timeout()), q, SLOT(emitShowEncouragementMessage())); QObject::connect(&encouragementTimer, &QTimer::timeout, q, [this]() { emitShowEncouragementMessage(); });
} }
ProviderPrivate::~ProviderPrivate() ProviderPrivate::~ProviderPrivate()
...@@ -399,7 +399,7 @@ Provider::Provider(QObject *parent) : ...@@ -399,7 +399,7 @@ Provider::Provider(QObject *parent) :
{ {
qCDebug(Log); qCDebug(Log);
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, [this]() { d->aboutToQuit(); });
auto domain = QCoreApplication::organizationDomain().split(QLatin1Char('.')); auto domain = QCoreApplication::organizationDomain().split(QLatin1Char('.'));
std::reverse(domain.begin(), domain.end()); std::reverse(domain.begin(), domain.end());
...@@ -636,7 +636,7 @@ void ProviderPrivate::submit(const QUrl &url) ...@@ -636,7 +636,7 @@ void ProviderPrivate::submit(const QUrl &url)
request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json")); request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING))); request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING)));
auto reply = networkAccessManager->post(request, jsonData(telemetryMode)); auto reply = networkAccessManager->post(request, jsonData(telemetryMode));
QObject::connect(reply, SIGNAL(finished()), q, SLOT(submitFinished())); QObject::connect(reply, &QNetworkReply::finished, q, [this]() { submitFinished(); });
} }
void ProviderPrivate::submitProbe(const QUrl &url) void ProviderPrivate::submitProbe(const QUrl &url)
...@@ -644,7 +644,7 @@ void ProviderPrivate::submitProbe(const QUrl &url) ...@@ -644,7 +644,7 @@ void ProviderPrivate::submitProbe(const QUrl &url)
QNetworkRequest request(url); QNetworkRequest request(url);
request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING))); request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING)));
auto reply = networkAccessManager->get(request); auto reply = networkAccessManager->get(request);
QObject::connect(reply, SIGNAL(finished()), q, SLOT(submitProbeFinished())); QObject::connect(reply, &QNetworkReply::finished, q, [this]() { submitProbeFinished(); });
} }
void ProviderPrivate::submitProbeFinished() void ProviderPrivate::submitProbeFinished()
......
...@@ -265,10 +265,6 @@ Q_SIGNALS: ...@@ -265,10 +265,6 @@ Q_SIGNALS:
private: private:
friend class ProviderPrivate; friend class ProviderPrivate;
ProviderPrivate * const d; ProviderPrivate * const d;
Q_PRIVATE_SLOT(d, void aboutToQuit())
Q_PRIVATE_SLOT(d, void submitFinished())
Q_PRIVATE_SLOT(d, void submitProbeFinished())
Q_PRIVATE_SLOT(d, void emitShowEncouragementMessage())
// for UI // for UI
Q_PRIVATE_SLOT(d, QByteArray jsonData(KUserFeedback::Provider::TelemetryMode)) Q_PRIVATE_SLOT(d, QByteArray jsonData(KUserFeedback::Provider::TelemetryMode))
// for testing // for testing
......
...@@ -35,12 +35,13 @@ class SelectionRatioSourcePrivate : public AbstractDataSourcePrivate ...@@ -35,12 +35,13 @@ class SelectionRatioSourcePrivate : public AbstractDataSourcePrivate
{ {
public: public:
SelectionRatioSourcePrivate(); SelectionRatioSourcePrivate();
~SelectionRatioSourcePrivate();
void selectionChanged(); void selectionChanged();
QString selectedValue() const; QString selectedValue() const;
QItemSelectionModel *model; QItemSelectionModel *model;
std::unique_ptr<QObject> monitor; QMetaObject::Connection monitorConnection;
QString description; QString description;
QString previousValue; QString previousValue;
QTime lastChangeTime; QTime lastChangeTime;
...@@ -49,20 +50,6 @@ public: ...@@ -49,20 +50,6 @@ public:
int role; int role;
}; };
class SelectionMonitor : public QObject
{
Q_OBJECT
public:
explicit SelectionMonitor(SelectionRatioSourcePrivate *d) : m_receiver(d) {}
public Q_SLOTS:
void selectionChanged()
{
m_receiver->selectionChanged();
}
private:
SelectionRatioSourcePrivate *m_receiver;
};
} }
SelectionRatioSourcePrivate::SelectionRatioSourcePrivate() SelectionRatioSourcePrivate::SelectionRatioSourcePrivate()
...@@ -71,6 +58,11 @@ SelectionRatioSourcePrivate::SelectionRatioSourcePrivate() ...@@ -71,6 +58,11 @@ SelectionRatioSourcePrivate::SelectionRatioSourcePrivate()
{ {
} }
SelectionRatioSourcePrivate::~SelectionRatioSourcePrivate()
{
QObject::disconnect(monitorConnection);
}
void SelectionRatioSourcePrivate::selectionChanged() void SelectionRatioSourcePrivate::selectionChanged()
{ {
if (!previousValue.isEmpty() && lastChangeTime.elapsed() > 1000) { if (!previousValue.isEmpty() && lastChangeTime.elapsed() > 1000) {
...@@ -99,8 +91,10 @@ SelectionRatioSource::SelectionRatioSource(QItemSelectionModel* selectionModel, ...@@ -99,8 +91,10 @@ SelectionRatioSource::SelectionRatioSource(QItemSelectionModel* selectionModel,
d->model = selectionModel; d->model = selectionModel;
Q_ASSERT(selectionModel); Q_ASSERT(selectionModel);
d->monitor.reset(new SelectionMonitor(d)); d->monitorConnection = QObject::connect(selectionModel, &QItemSelectionModel::selectionChanged, [this]() {
QObject::connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), d->monitor.get(), SLOT(selectionChanged())); Q_D(SelectionRatioSource);
d->selectionChanged();
});
d->lastChangeTime.start(); d->lastChangeTime.start();
d->selectionChanged(); d->selectionChanged();
} }
...@@ -179,5 +173,3 @@ void SelectionRatioSource::reset(QSettings* settings) ...@@ -179,5 +173,3 @@ void SelectionRatioSource::reset(QSettings* settings)
d->ratioSet.clear(); d->ratioSet.clear();
settings->remove(QString()); settings->remove(QString());
} }
#include "selectionratiosource.moc"
...@@ -32,12 +32,12 @@ AuditLogBrowserDialog::AuditLogBrowserDialog(QWidget *parent) ...@@ -32,12 +32,12 @@ AuditLogBrowserDialog::AuditLogBrowserDialog(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->logEntryBox, SIGNAL(activated(int)), this, SLOT(logEntrySelected())); connect(ui->logEntryBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &AuditLogBrowserDialog::logEntrySelected);
auto clearButton = ui->buttonBox->button(QDialogButtonBox::Discard); auto clearButton = ui->buttonBox->button(QDialogButtonBox::Discard);
Q_ASSERT(clearButton); Q_ASSERT(clearButton);
clearButton->setText(tr("Delete Log")); clearButton->setText(tr("Delete Log"));
connect(clearButton, SIGNAL(clicked()), this, SLOT(close())); connect(clearButton, &QPushButton::clicked, this, &AuditLogBrowserDialog::close);
setEnabled(false); setEnabled(false);
} }
...@@ -54,7 +54,7 @@ void AuditLogBrowserDialog::setUiController(AuditLogUiController *controller) ...@@ -54,7 +54,7 @@ void AuditLogBrowserDialog::setUiController(AuditLogUiController *controller)
logEntrySelected(); logEntrySelected();
auto clearButton = ui->buttonBox->button(QDialogButtonBox::Discard); auto clearButton = ui->buttonBox->button(QDialogButtonBox::Discard);
connect(clearButton, SIGNAL(clicked()), controller, SLOT(clear())); connect(clearButton, &QPushButton::clicked, controller, &AuditLogUiController::clear);
setEnabled(true); setEnabled(true);
} }
......
...@@ -51,7 +51,7 @@ FeedbackConfigDialog::~FeedbackConfigDialog() ...@@ -51,7 +51,7 @@ FeedbackConfigDialog::~FeedbackConfigDialog()
void FeedbackConfigDialog::setFeedbackProvider(Provider* provider) void FeedbackConfigDialog::setFeedbackProvider(Provider* provider)
{ {
d->ui->configWidget->setFeedbackProvider(provider); d->ui->configWidget->setFeedbackProvider(provider);
connect(d->ui->configWidget, SIGNAL(configurationChanged()), this, SLOT(updateButtonState())); connect(d->ui->configWidget, &FeedbackConfigWidget::configurationChanged, this, [this]() { d->updateButtonState(); });
d->updateButtonState(); d->updateButtonState();
} }
......
...@@ -51,7 +51,6 @@ public: ...@@ -51,7 +51,6 @@ public:
void accept() override; void accept() override;
private: private:
Q_PRIVATE_SLOT(d, void updateButtonState())
std::unique_ptr<FeedbackConfigDialogPrivate> d; std::unique_ptr<FeedbackConfigDialogPrivate> d;
}; };
......
...@@ -107,15 +107,15 @@ FeedbackConfigWidget::FeedbackConfigWidget(QWidget* parent) ...@@ -107,15 +107,15 @@ FeedbackConfigWidget::FeedbackConfigWidget(QWidget* parent)
d->ui->setupUi(this); d->ui->setupUi(this);
d->ui->noTelemetryLabel->setText(d->controller->telemetryModeDescription(Provider::NoTelemetry)); d->ui->noTelemetryLabel->setText(d->controller->telemetryModeDescription(Provider::NoTelemetry));
connect(d->ui->telemetrySlider, SIGNAL(valueChanged(int)), this, SLOT(telemetrySliderChanged())); connect(d->ui->telemetrySlider, &QSlider::valueChanged, this, [this]() { d->telemetrySliderChanged(); });
connect(d->ui->telemetrySlider, SIGNAL(valueChanged(int)), this, SIGNAL(configurationChanged())); connect(d->ui->telemetrySlider, &QSlider::valueChanged, this, &FeedbackConfigWidget::configurationChanged);
connect(d->ui->surveySlider, SIGNAL(valueChanged(int)), this, SLOT(surveySliderChanged())); connect(d->ui->surveySlider, &QSlider::valueChanged, this, [this]() { d->surveySliderChanged(); });
connect(d->ui->surveySlider, SIGNAL(valueChanged(int)), this, SIGNAL(configurationChanged())); connect(d->ui->surveySlider, &QSlider::valueChanged, this, &FeedbackConfigWidget::configurationChanged);
d->ui->rawTelemetryButton->setParent(d->ui->telemetryDetails); d->ui->rawTelemetryButton->setParent(d->ui->telemetryDetails);
d->ui->rawTelemetryButton->setIcon(style()->standardPixmap(QStyle::SP_DialogHelpButton)); d->ui->rawTelemetryButton->setIcon(style()->standardPixmap(QStyle::SP_DialogHelpButton));
d->ui->telemetryDetails->installEventFilter(this); d->ui->telemetryDetails->installEventFilter(this);
connect(d->ui->rawTelemetryButton, SIGNAL(toggled(bool)), this, SLOT(telemetrySliderChanged())); connect(d->ui->rawTelemetryButton, &QAbstractButton::toggled, this, [this]() { d->telemetrySliderChanged(); });
d->auditLogController = new AuditLogUiController(this); d->auditLogController = new AuditLogUiController(this);
d->ui->auditLogLabel->setVisible(d->auditLogController->hasLogEntries()); d->ui->auditLogLabel->setVisible(d->auditLogController->hasLogEntries());
......
...@@ -73,8 +73,6 @@ protected: ...@@ -73,8 +73,6 @@ protected:
///@endcond ///@endcond
private: private:
Q_PRIVATE_SLOT(d, void telemetrySliderChanged())
Q_PRIVATE_SLOT(d, void surveySliderChanged())
std::unique_ptr<FeedbackConfigWidgetPrivate> d; std::unique_ptr<FeedbackConfigWidgetPrivate> d;
}; };
......
...@@ -175,8 +175,8 @@ NotificationPopup::NotificationPopup(QWidget* parent) ...@@ -175,8 +175,8 @@ NotificationPopup::NotificationPopup(QWidget* parent)
d->ui->frame->setAutoFillBackground(true); d->ui->frame->setAutoFillBackground(true);
d->ui->closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); d->ui->closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
connect(d->ui->actionButton, SIGNAL(clicked()), this, SLOT(action())); connect(d->ui->actionButton, &QPushButton::clicked, this, [this]() { d->action(); });
connect(d->ui->closeButton, SIGNAL(clicked()), this, SLOT(hidePopup())); connect(d->ui->closeButton, &QPushButton::clicked, this, [this]() { d->hidePopup(); });
parent->installEventFilter(this); parent->installEventFilter(this);
setVisible(false); setVisible(false);
...@@ -190,8 +190,8 @@ void NotificationPopup::setFeedbackProvider(Provider* provider) ...@@ -190,8 +190,8 @@ void NotificationPopup::setFeedbackProvider(Provider* provider)
{ {
Q_ASSERT(provider); Q_ASSERT(provider);
d->provider = provider; d->provider = provider;
connect(provider, SIGNAL(showEncouragementMessage()), this, SLOT(showEncouragement())); connect(provider, &Provider::showEncouragementMessage, this, [this]() { d->showEncouragement(); });
connect(provider, SIGNAL(surveyAvailable(KUserFeedback::SurveyInfo)), this, SLOT(surveyAvailable(KUserFeedback::SurveyInfo))); connect(provider, &Provider::surveyAvailable, this, [this](const SurveyInfo &info) { d->surveyAvailable(info); });
} }
void NotificationPopup::keyReleaseEvent(QKeyEvent* event) void NotificationPopup::keyReleaseEvent(QKeyEvent* event)
......
...@@ -57,10 +57,6 @@ protected: ...@@ -57,10 +57,6 @@ protected:
///@endcond ///@endcond
private: private:
Q_PRIVATE_SLOT(d, void showEncouragement())
Q_PRIVATE_SLOT(d, void surveyAvailable(const KUserFeedback::SurveyInfo &info))
Q_PRIVATE_SLOT(d, void hidePopup())
Q_PRIVATE_SLOT(d, void action())
std::unique_ptr<NotificationPopupPrivate> d; std::unique_ptr<NotificationPopupPrivate> d;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment