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