aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2016-06-27 22:34:13 +0300
committerOrgad Shaneh <orgads@gmail.com>2016-06-28 12:54:02 +0000
commit847637708f398af968d2163c907dbe3b93587699 (patch)
treebc98545456c854f2f30c04cd7ed987795ab8c42b
parent4d9f79964dc0eb1c24c84c753942f0c73488a414 (diff)
Tests: Use Qt5-style connects
The heavy lifting was done by clazy. Change-Id: If3332a2b4a6d011d2cb74996f5dd750452093f31 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp2
-rw-r--r--tests/auto/valgrind/callgrind/modeltest.cpp8
-rw-r--r--tests/manual/debugger/qquick1/myplugin/mytype.cpp2
-rw-r--r--tests/manual/debugger/qquick1/myplugin/mytype.h3
-rw-r--r--tests/manual/debugger/qquick2/myplugin/mytype.cpp2
-rw-r--r--tests/manual/debugger/qquick2/myplugin/mytype.h3
-rw-r--r--tests/manual/debugger/simple/simple_test_app.cpp19
-rw-r--r--tests/manual/debugger/spacy path/app with space.cpp4
-rw-r--r--tests/manual/debugger/spacy-file/app with space.cpp4
-rw-r--r--tests/manual/fakevim/main.cpp26
-rw-r--r--tests/manual/pluginview/plugindialog.h3
-rw-r--r--tests/manual/process/mainwindow.cpp6
-rw-r--r--tests/manual/process/mainwindow.h3
-rw-r--r--tests/manual/ssh/errorhandling/main.cpp11
-rw-r--r--tests/manual/ssh/remoteprocess/remoteprocesstest.cpp49
-rw-r--r--tests/manual/ssh/remoteprocess/remoteprocesstest.h13
-rw-r--r--tests/manual/ssh/sftp/sftptest.cpp28
-rw-r--r--tests/manual/ssh/sftp/sftptest.h19
-rw-r--r--tests/manual/ssh/sftpfsmodel/window.cpp15
-rw-r--r--tests/manual/ssh/sftpfsmodel/window.h3
-rw-r--r--tests/manual/ssh/shell/shell.cpp18
-rw-r--r--tests/manual/ssh/shell/shell.h3
-rw-r--r--tests/manual/ssh/tunnel/directtunnel.cpp24
-rw-r--r--tests/manual/ssh/tunnel/directtunnel.h3
-rw-r--r--tests/manual/ssh/tunnel/forwardtunnel.h3
25 files changed, 137 insertions, 137 deletions
diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
index 5188b2278cc..7b5c93e5000 100644
--- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
+++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp
@@ -149,7 +149,7 @@ static QmlDesigner::Model* createModel(const QString &typeName, int major = 2, i
QmlDesigner::Model *model = QmlDesigner::Model::create(typeName.toUtf8(), major, minor, metaInfoPropxyModel);
QPlainTextEdit *textEdit = new QPlainTextEdit;
- QObject::connect(model, SIGNAL(destroyed()), textEdit, SLOT(deleteLater()));
+ QObject::connect(model, &QObject::destroyed, textEdit, &QObject::deleteLater);
textEdit->setPlainText(QString("import %1 %3.%4; %2{}").arg(typeName.split(".").first())
.arg(typeName.split(".").last())
.arg(major)
diff --git a/tests/auto/valgrind/callgrind/modeltest.cpp b/tests/auto/valgrind/callgrind/modeltest.cpp
index c844f12d307..94c0fd2dde3 100644
--- a/tests/auto/valgrind/callgrind/modeltest.cpp
+++ b/tests/auto/valgrind/callgrind/modeltest.cpp
@@ -85,8 +85,8 @@ ModelTestWidget::ModelTestWidget(CallgrindWidgetHandler *handler)
m_format->addItem("absolute", CostDelegate::FormatAbsolute);
m_format->addItem("relative", CostDelegate::FormatRelative);
m_format->addItem("rel. to parent", CostDelegate::FormatRelativeToParent);
- connect(m_format, SIGNAL(activated(int)),
- this, SLOT(formatChanged(int)));
+ connect(m_format, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
+ this, &ModelTestWidget::formatChanged);
h->addWidget(m_format);
QDoubleSpinBox *minimumCost = new QDoubleSpinBox;
@@ -94,8 +94,8 @@ ModelTestWidget::ModelTestWidget(CallgrindWidgetHandler *handler)
minimumCost->setRange(0, 1);
minimumCost->setDecimals(4);
minimumCost->setSingleStep(0.01);
- connect(minimumCost, SIGNAL(valueChanged(double)),
- m_handler->proxyModel(), SLOT(setMinimumInclusiveCostRatio(double)));
+ connect(minimumCost, &QDoubleSpinBox::valueChanged,
+ m_handler->proxyModel(), &DataProxyModel::setMinimumInclusiveCostRatio);
minimumCost->setValue(0.0001);
h->addWidget(minimumCost);
diff --git a/tests/manual/debugger/qquick1/myplugin/mytype.cpp b/tests/manual/debugger/qquick1/myplugin/mytype.cpp
index d8e52755713..10127323b6e 100644
--- a/tests/manual/debugger/qquick1/myplugin/mytype.cpp
+++ b/tests/manual/debugger/qquick1/myplugin/mytype.cpp
@@ -10,7 +10,7 @@ MyType::MyType(QObject *parent)
updateTimerText();
m_timer = new QTimer(this);
m_timer->setInterval(1000);
- connect(m_timer, SIGNAL(timeout()), SLOT(updateTimerText()));
+ connect(m_timer, &QTimer::timeout, this, &MyType::updateTimerText);
m_timer->start();
}
diff --git a/tests/manual/debugger/qquick1/myplugin/mytype.h b/tests/manual/debugger/qquick1/myplugin/mytype.h
index 30c90c9ef6c..e833fe81b86 100644
--- a/tests/manual/debugger/qquick1/myplugin/mytype.h
+++ b/tests/manual/debugger/qquick1/myplugin/mytype.h
@@ -20,10 +20,9 @@ public:
signals:
void timeChanged(const QString &newText);
-private slots:
+private:
void updateTimerText();
-private:
QString m_timeText;
QTimer *m_timer;
diff --git a/tests/manual/debugger/qquick2/myplugin/mytype.cpp b/tests/manual/debugger/qquick2/myplugin/mytype.cpp
index f3232af8703..f36105528c3 100644
--- a/tests/manual/debugger/qquick2/myplugin/mytype.cpp
+++ b/tests/manual/debugger/qquick2/myplugin/mytype.cpp
@@ -10,7 +10,7 @@ MyType::MyType(QObject *parent)
updateTimerText();
m_timer = new QTimer(this);
m_timer->setInterval(1000);
- connect(m_timer, SIGNAL(timeout()), SLOT(updateTimerText()));
+ connect(m_timer, &QTimer::timeout, this, &MyType::updateTimerText);
m_timer->start();
}
diff --git a/tests/manual/debugger/qquick2/myplugin/mytype.h b/tests/manual/debugger/qquick2/myplugin/mytype.h
index 30c90c9ef6c..e833fe81b86 100644
--- a/tests/manual/debugger/qquick2/myplugin/mytype.h
+++ b/tests/manual/debugger/qquick2/myplugin/mytype.h
@@ -20,10 +20,9 @@ public:
signals:
void timeChanged(const QString &newText);
-private slots:
+private:
void updateTimerText();
-private:
QString m_timeText;
QTimer *m_timer;
diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp
index 695de846c7f..20f74e347c8 100644
--- a/tests/manual/debugger/simple/simple_test_app.cpp
+++ b/tests/manual/debugger/simple/simple_test_app.cpp
@@ -1792,10 +1792,10 @@ namespace qobject {
parent.setObjectName("A Parent");
QObject child(&parent);
child.setObjectName("A Child");
- QObject::connect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));
- QObject::connect(&child, SIGNAL(destroyed()), &child, SLOT(deleteLater()));
- QObject::disconnect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));
- QObject::disconnect(&child, SIGNAL(destroyed()), &child, SLOT(deleteLater()));
+ QObject::connect(&child, &QObject::destroyed, &parent, &QObject::deleteLater);
+ QObject::connect(&child, &QObject::destroyed, &child, &QObject::deleteLater);
+ QObject::disconnect(&child, &QObject::destroyed, &parent, &QObject::deleteLater);
+ QObject::disconnect(&child, &QObject::destroyed, &child, &QObject::deleteLater);
child.setObjectName("A renamed Child");
BREAK_HERE;
// Check child "A renamed Child" QObject.
@@ -1889,11 +1889,11 @@ namespace qobject {
QObject ob1;
ob1.setObjectName("Another Object");
- QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
- QObject::connect(&ob1, SIGNAL(destroyed()), &ob, SLOT(deleteLater()));
+ QObject::connect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater);
+ QObject::connect(&ob1, &QObject::destroyed, &ob, &QObject::deleteLater);
BREAK_HERE;
- QObject::disconnect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
- QObject::disconnect(&ob1, SIGNAL(destroyed()), &ob, SLOT(deleteLater()));
+ QObject::disconnect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater);
+ QObject::disconnect(&ob1, &QObject::destroyed, &ob, &QObject::deleteLater);
dummyStatement(&ob, &ob1);
#endif
}
@@ -1930,7 +1930,6 @@ namespace qobject {
Q_OBJECT
public:
Receiver() { setObjectName("Receiver"); }
- public slots:
void aSlot() {
QObject *s = sender();
if (s) {
@@ -1945,7 +1944,7 @@ namespace qobject {
{
Sender sender;
Receiver receiver;
- QObject::connect(&sender, SIGNAL(aSignal()), &receiver, SLOT(aSlot()));
+ QObject::connect(&sender, &Sender::aSignal, &receiver, &Receiver::aSlot);
// Break here.
// Single step through signal emission.
sender.doEmit();
diff --git a/tests/manual/debugger/spacy path/app with space.cpp b/tests/manual/debugger/spacy path/app with space.cpp
index af7226bbc37..1dfa82c0efd 100644
--- a/tests/manual/debugger/spacy path/app with space.cpp
+++ b/tests/manual/debugger/spacy path/app with space.cpp
@@ -222,8 +222,8 @@ void testObject(int &argc, char *argv[])
QObject ob1;
ob1.setObjectName("Another Object");
- QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
- QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater()));
+ QObject::connect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater);
+ QObject::connect(&app, &QGuiApplication::lastWindowClosed, &ob, &QObject::deleteLater);
QList<QObject *> obs;
obs.append(&ob);
diff --git a/tests/manual/debugger/spacy-file/app with space.cpp b/tests/manual/debugger/spacy-file/app with space.cpp
index af7226bbc37..1dfa82c0efd 100644
--- a/tests/manual/debugger/spacy-file/app with space.cpp
+++ b/tests/manual/debugger/spacy-file/app with space.cpp
@@ -222,8 +222,8 @@ void testObject(int &argc, char *argv[])
QObject ob1;
ob1.setObjectName("Another Object");
- QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater()));
- QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater()));
+ QObject::connect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater);
+ QObject::connect(&app, &QGuiApplication::lastWindowClosed, &ob, &QObject::deleteLater);
QList<QObject *> obs;
obs.append(&ob);
diff --git a/tests/manual/fakevim/main.cpp b/tests/manual/fakevim/main.cpp
index fa561381b73..4250676dea2 100644
--- a/tests/manual/fakevim/main.cpp
+++ b/tests/manual/fakevim/main.cpp
@@ -84,7 +84,6 @@ public:
: QObject(parent), m_widget(widget), m_mainWindow(mw)
{}
-public slots:
void changeSelection(const QList<QTextEdit::ExtraSelection> &s)
{
if (QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(m_widget))
@@ -230,19 +229,18 @@ void readFile(FakeVimHandler &handler, const QString &editFileName)
void connectSignals(FakeVimHandler &handler, Proxy &proxy)
{
- QObject::connect(&handler, SIGNAL(commandBufferChanged(QString,int,int,int,QObject*)),
- &proxy, SLOT(changeStatusMessage(QString,int)));
- QObject::connect(&handler,
- SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
- &proxy, SLOT(changeSelection(QList<QTextEdit::ExtraSelection>)));
- QObject::connect(&handler, SIGNAL(extraInformationChanged(QString)),
- &proxy, SLOT(changeExtraInformation(QString)));
- QObject::connect(&handler, SIGNAL(statusDataChanged(QString)),
- &proxy, SLOT(changeStatusData(QString)));
- QObject::connect(&handler, SIGNAL(highlightMatches(QString)),
- &proxy, SLOT(highlightMatches(QString)));
- QObject::connect(&handler, SIGNAL(handleExCommandRequested(bool*,ExCommand)),
- &proxy, SLOT(handleExCommand(bool*,ExCommand)));
+ QObject::connect(&handler, &FakeVimHandler::commandBufferChanged,
+ &proxy, &Proxy::changeStatusMessage);
+ QObject::connect(&handler, &FakeVimHandler::selectionChanged,
+ &proxy, &Proxy::changeSelection);
+ QObject::connect(&handler, &FakeVimHandler::extraInformationChanged,
+ &proxy, &Proxy::changeExtraInformation);
+ QObject::connect(&handler, &FakeVimHandler::statusDataChanged,
+ &proxy, &Proxy::changeStatusData);
+ QObject::connect(&handler, &FakeVimHandler::highlightMatches,
+ &proxy, &Proxy::highlightMatches);
+ QObject::connect(&handler, &FakeVimHandler::handleExCommandRequested,
+ &proxy, &Proxy::handleExCommand);
}
int main(int argc, char *argv[])
diff --git a/tests/manual/pluginview/plugindialog.h b/tests/manual/pluginview/plugindialog.h
index 6206f3556d5..27d0eea7951 100644
--- a/tests/manual/pluginview/plugindialog.h
+++ b/tests/manual/pluginview/plugindialog.h
@@ -38,12 +38,11 @@ class PluginDialog : public QWidget
public:
PluginDialog();
-private slots:
+private:
void updateButtons();
void openDetails(ExtensionSystem::PluginSpec *spec = nullptr);
void openErrorDetails();
-private:
ExtensionSystem::PluginView *m_view;
QPushButton *m_detailsButton;
diff --git a/tests/manual/process/mainwindow.cpp b/tests/manual/process/mainwindow.cpp
index a3ca20196d4..bd89d935cf8 100644
--- a/tests/manual/process/mainwindow.cpp
+++ b/tests/manual/process/mainwindow.cpp
@@ -37,7 +37,7 @@ MainWindow::MainWindow(QWidget *parent) :
m_logWindow(new QPlainTextEdit)
{
setCentralWidget(m_logWindow);
- QTimer::singleShot(200, this, SLOT(test()));
+ QTimer::singleShot(200, this, &MainWindow::test);
}
void MainWindow::append(const QString &s)
@@ -54,8 +54,8 @@ void MainWindow::test()
Utils::SynchronousProcess process;
process.setTimeoutS(2);
qDebug() << "Async: " << cmd << args;
- connect(&process, SIGNAL(stdOut(QString,bool)), this, SLOT(append(QString)));
- connect(&process, SIGNAL(stdErr(QString,bool)), this, SLOT(append(QString)));
+ connect(&process, &Utils::SynchronousProcess::stdOut, this, &MainWindow::append);
+ connect(&process, &Utils::SynchronousProcess::stdErr, this, &MainWindow::append);
const Utils::SynchronousProcessResponse resp = process.run(cmd, args);
qDebug() << resp;
}
diff --git a/tests/manual/process/mainwindow.h b/tests/manual/process/mainwindow.h
index 6dfe3874000..3171b841f8b 100644
--- a/tests/manual/process/mainwindow.h
+++ b/tests/manual/process/mainwindow.h
@@ -37,9 +37,6 @@ Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
-signals:
-
-public slots:
void test();
void append(const QString &s);
diff --git a/tests/manual/ssh/errorhandling/main.cpp b/tests/manual/ssh/errorhandling/main.cpp
index 9eb44277c9e..7aab5d0bc18 100644
--- a/tests/manual/ssh/errorhandling/main.cpp
+++ b/tests/manual/ssh/errorhandling/main.cpp
@@ -110,7 +110,7 @@ public:
delete m_connection;
}
-private slots:
+private:
void handleConnected()
{
qDebug("Error: Received unexpected connected() signal.");
@@ -162,7 +162,6 @@ private slots:
qDebug("Error: The following test timed out: %s", testItem.description);
}
-private:
void runNextTest()
{
if (m_connection) {
@@ -170,10 +169,10 @@ private:
delete m_connection;
}
m_connection = new SshConnection(m_testSet.first().params);
- connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
- connect(m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
- connect(m_connection, SIGNAL(dataAvailable(QString)), SLOT(handleDataAvailable(QString)));
- connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleError(QSsh::SshError)));
+ connect(m_connection, &SshConnection::connected, this, &Test::handleConnected);
+ connect(m_connection, &SshConnection::disconnected, this, &Test::handleDisconnected);
+ connect(m_connection, &SshConnection::dataAvailable, this, &Test::handleDataAvailable);
+ connect(m_connection, &SshConnection::error, this, &Test::handleError);
const TestItem &nextItem = m_testSet.first();
m_timeoutTimer.stop();
m_timeoutTimer.setInterval(qMax(10000, nextItem.params.timeout * 1000));
diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp
index 44c90470051..062a974282b 100644
--- a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp
+++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp
@@ -45,7 +45,7 @@ RemoteProcessTest::RemoteProcessTest(const SshConnectionParameters &params)
m_state(Inactive)
{
m_timeoutTimer->setInterval(5000);
- connect(m_timeoutTimer, SIGNAL(timeout()), SLOT(handleTimeout()));
+ connect(m_timeoutTimer, &QTimer::timeout, this, &RemoteProcessTest::handleTimeout);
}
RemoteProcessTest::~RemoteProcessTest()
@@ -55,14 +55,16 @@ RemoteProcessTest::~RemoteProcessTest()
void RemoteProcessTest::run()
{
- connect(m_remoteRunner, SIGNAL(connectionError()),
- SLOT(handleConnectionError()));
- connect(m_remoteRunner, SIGNAL(processStarted()),
- SLOT(handleProcessStarted()));
- connect(m_remoteRunner, SIGNAL(readyReadStandardOutput()), SLOT(handleProcessStdout()));
- connect(m_remoteRunner, SIGNAL(readyReadStandardError()), SLOT(handleProcessStderr()));
- connect(m_remoteRunner, SIGNAL(processClosed(int)),
- SLOT(handleProcessClosed(int)));
+ connect(m_remoteRunner, &SshRemoteProcessRunner::connectionError,
+ this, &RemoteProcessTest::handleConnectionError);
+ connect(m_remoteRunner, &SshRemoteProcessRunner::processStarted,
+ this, &RemoteProcessTest::handleProcessStarted);
+ connect(m_remoteRunner, &SshRemoteProcessRunner::readyReadStandardOutput,
+ this, &RemoteProcessTest::handleProcessStdout);
+ connect(m_remoteRunner, &SshRemoteProcessRunner::readyReadStandardError,
+ this, &RemoteProcessTest::handleProcessStderr);
+ connect(m_remoteRunner, &SshRemoteProcessRunner::processClosed,
+ this, &RemoteProcessTest::handleProcessClosed);
std::cout << "Testing successful remote process... " << std::flush;
m_state = TestingSuccess;
@@ -91,7 +93,8 @@ void RemoteProcessTest::handleProcessStarted()
SshRemoteProcessRunner * const killer = new SshRemoteProcessRunner(this);
killer->run("pkill -9 sleep", m_sshParams);
} else if (m_state == TestingIoDevice) {
- connect(m_catProcess.data(), SIGNAL(readyRead()), SLOT(handleReadyRead()));
+ connect(m_catProcess.data(), &QIODevice::readyRead,
+ this, &RemoteProcessTest::handleReadyRead);
m_textStream = new QTextStream(m_catProcess.data());
*m_textStream << testString();
m_textStream->flush();
@@ -209,9 +212,10 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
std::cout << "Ok.\nTesting I/O device functionality... " << std::flush;
m_state = TestingIoDevice;
m_sshConnection = new SshConnection(m_sshParams);
- connect(m_sshConnection, SIGNAL(connected()), SLOT(handleConnected()));
- connect(m_sshConnection, SIGNAL(error(QSsh::SshError)),
- SLOT(handleConnectionError()));
+ connect(m_sshConnection, &SshConnection::connected,
+ this, &RemoteProcessTest::handleConnected);
+ connect(m_sshConnection, &SshConnection::error,
+ this, &RemoteProcessTest::handleConnectionError);
m_sshConnection->connectToHost();
m_timeoutTimer->start();
break;
@@ -280,8 +284,10 @@ void RemoteProcessTest::handleConnected()
Q_ASSERT(m_state == TestingIoDevice);
m_catProcess = m_sshConnection->createRemoteProcess(QString::fromLatin1("/bin/cat").toUtf8());
- connect(m_catProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted()));
- connect(m_catProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int)));
+ connect(m_catProcess.data(), &SshRemoteProcess::started,
+ this, &RemoteProcessTest::handleProcessStarted);
+ connect(m_catProcess.data(), &SshRemoteProcess::closed,
+ this, &RemoteProcessTest::handleProcessClosed);
m_started = false;
m_timeoutTimer->start();
m_catProcess->start();
@@ -347,11 +353,14 @@ void RemoteProcessTest::handleSuccessfulIoTest()
m_remoteStderr.clear();
m_echoProcess = m_sshConnection->createRemoteProcess("printf " + StderrOutput + " >&2");
m_echoProcess->setReadChannel(QProcess::StandardError);
- connect(m_echoProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted()));
- connect(m_echoProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int)));
- connect(m_echoProcess.data(), SIGNAL(readyRead()), SLOT(handleReadyRead()));
- connect(m_echoProcess.data(), SIGNAL(readyReadStandardError()),
- SLOT(handleReadyReadStderr()));
+ connect(m_echoProcess.data(), &SshRemoteProcess::started,
+ this, &RemoteProcessTest::handleProcessStarted);
+ connect(m_echoProcess.data(), &SshRemoteProcess::closed,
+ this, &RemoteProcessTest::handleProcessClosed);
+ connect(m_echoProcess.data(), &QIODevice::readyRead,
+ this, &RemoteProcessTest::handleReadyRead);
+ connect(m_echoProcess.data(), &SshRemoteProcess::readyReadStandardError,
+ this, &RemoteProcessTest::handleReadyReadStderr);
m_echoProcess->start();
m_timeoutTimer->start();
}
diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.h b/tests/manual/ssh/remoteprocess/remoteprocesstest.h
index 44c02169e78..b3c8ebc3e3f 100644
--- a/tests/manual/ssh/remoteprocess/remoteprocesstest.h
+++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.h
@@ -40,7 +40,12 @@ public:
~RemoteProcessTest();
void run();
-private slots:
+private:
+ enum State {
+ Inactive, TestingSuccess, TestingFailure, TestingCrash, TestingTerminal, TestingIoDevice,
+ TestingProcessChannels
+ };
+
void handleConnectionError();
void handleProcessStarted();
void handleProcessStdout();
@@ -52,12 +57,6 @@ private slots:
void handleReadyReadStderr();
void handleConnected();
-private:
- enum State {
- Inactive, TestingSuccess, TestingFailure, TestingCrash, TestingTerminal, TestingIoDevice,
- TestingProcessChannels
- };
-
QString testString() const;
void handleSuccessfulCrashTest();
void handleSuccessfulIoTest();
diff --git a/tests/manual/ssh/sftp/sftptest.cpp b/tests/manual/ssh/sftp/sftptest.cpp
index 007f261822b..40c3157fd0d 100644
--- a/tests/manual/ssh/sftp/sftptest.cpp
+++ b/tests/manual/ssh/sftp/sftptest.cpp
@@ -56,9 +56,9 @@ SftpTest::~SftpTest()
void SftpTest::run()
{
m_connection = new SshConnection(m_parameters.sshParams);
- connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
- connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleError()));
- connect(m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
+ connect(m_connection, &SshConnection::connected, this, &SftpTest::handleConnected);
+ connect(m_connection, &SshConnection::error, this, &SftpTest::handleError);
+ connect(m_connection, &SshConnection::disconnected, this, &SftpTest::handleDisconnected);
std::cout << "Connecting to host '"
<< qPrintable(m_parameters.sshParams.host) << "'..." << std::endl;
m_state = Connecting;
@@ -74,17 +74,17 @@ void SftpTest::handleConnected()
} else {
std::cout << "Connected. Initializing SFTP channel..." << std::endl;
m_channel = m_connection->createSftpChannel();
- connect(m_channel.data(), SIGNAL(initialized()), this,
- SLOT(handleChannelInitialized()));
- connect(m_channel.data(), SIGNAL(channelError(QString)), this,
- SLOT(handleChannelInitializationFailure(QString)));
- connect(m_channel.data(), SIGNAL(finished(QSsh::SftpJobId,QString)),
- this, SLOT(handleJobFinished(QSsh::SftpJobId,QString)));
- connect(m_channel.data(),
- SIGNAL(fileInfoAvailable(QSsh::SftpJobId,QList<QSsh::SftpFileInfo>)),
- SLOT(handleFileInfo(QSsh::SftpJobId,QList<QSsh::SftpFileInfo>)));
- connect(m_channel.data(), SIGNAL(closed()), this,
- SLOT(handleChannelClosed()));
+ connect(m_channel.data(), &SftpChannel::initialized,
+ this, &SftpTest::handleChannelInitialized);
+ connect(m_channel.data(), &SftpChannel::channelError,
+ this, &SftpTest::handleChannelInitializationFailure);
+ connect(m_channel.data(), &SftpChannel::finished,
+ this, static_cast<void (SftpTest::*)(QSsh::SftpJobId, const QString &)>(
+ &SftpTest::handleJobFinished));
+ connect(m_channel.data(), &SftpChannel::fileInfoAvailable,
+ this, &SftpTest::handleFileInfo);
+ connect(m_channel.data(), &SftpChannel::closed,
+ this, &SftpTest::handleChannelClosed);
m_state = InitializingChannel;
m_channel->initialize();
}
diff --git a/tests/manual/ssh/sftp/sftptest.h b/tests/manual/ssh/sftp/sftptest.h
index 1b984c41544..97b13217eeb 100644
--- a/tests/manual/ssh/sftp/sftptest.h
+++ b/tests/manual/ssh/sftp/sftptest.h
@@ -46,16 +46,6 @@ public:
~SftpTest();
void run();
-private slots:
- void handleConnected();
- void handleError();
- void handleDisconnected();
- void handleChannelInitialized();
- void handleChannelInitializationFailure(const QString &reason);
- void handleJobFinished(QSsh::SftpJobId job, const QString &error);
- void handleFileInfo(QSsh::SftpJobId job, const QList<QSsh::SftpFileInfo> &fileInfoList);
- void handleChannelClosed();
-
private:
typedef QHash<QSsh::SftpJobId, QString> JobMap;
typedef QSharedPointer<QFile> FilePtr;
@@ -65,6 +55,15 @@ private:
CheckingDirAttributes, CheckingDirContents, RemovingDir, ChannelClosing, Disconnecting
};
+ void handleConnected();
+ void handleError();
+ void handleDisconnected();
+ void handleChannelInitialized();
+ void handleChannelInitializationFailure(const QString &reason);
+ void handleJobFinished(QSsh::SftpJobId job, const QString &error);
+ void handleFileInfo(QSsh::SftpJobId job, const QList<QSsh::SftpFileInfo> &fileInfoList);
+ void handleChannelClosed();
+
void removeFile(const FilePtr &filePtr, bool remoteToo);
void removeFiles(bool remoteToo);
QString cmpFileName(const QString &localFileName) const;
diff --git a/tests/manual/ssh/sftpfsmodel/window.cpp b/tests/manual/ssh/sftpfsmodel/window.cpp
index fdbfab0f45b..79a05fad38a 100644
--- a/tests/manual/ssh/sftpfsmodel/window.cpp
+++ b/tests/manual/ssh/sftpfsmodel/window.cpp
@@ -44,8 +44,8 @@ using namespace QSsh;
SftpFsWindow::SftpFsWindow(QWidget *parent) : QDialog(parent), m_ui(new Ui::Window)
{
m_ui->setupUi(this);
- connect(m_ui->connectButton, SIGNAL(clicked()), SLOT(connectToHost()));
- connect(m_ui->downloadButton, SIGNAL(clicked()), SLOT(downloadFile()));
+ connect(m_ui->connectButton, &QAbstractButton::clicked, this, &SftpFsWindow::connectToHost);
+ connect(m_ui->downloadButton, &QAbstractButton::clicked, this, &SftpFsWindow::downloadFile);
}
SftpFsWindow::~SftpFsWindow()
@@ -67,11 +67,12 @@ void SftpFsWindow::connectToHost()
m_fsModel = new SftpFileSystemModel(this);
if (m_ui->useModelTesterCheckBox->isChecked())
new ModelTest(m_fsModel, this);
- connect(m_fsModel, SIGNAL(sftpOperationFailed(QString)),
- SLOT(handleSftpOperationFailed(QString)));
- connect(m_fsModel, SIGNAL(connectionError(QString)), SLOT(handleConnectionError(QString)));
- connect(m_fsModel, SIGNAL(sftpOperationFinished(QSsh::SftpJobId,QString)),
- SLOT(handleSftpOperationFinished(QSsh::SftpJobId,QString)));
+ connect(m_fsModel, &SftpFileSystemModel::sftpOperationFailed,
+ this, &SftpFsWindow::handleSftpOperationFailed);
+ connect(m_fsModel, &SftpFileSystemModel::connectionError,
+ this, &SftpFsWindow::handleConnectionError);
+ connect(m_fsModel, &SftpFileSystemModel::sftpOperationFinished,
+ this, &SftpFsWindow::handleSftpOperationFinished);
m_fsModel->setSshConnection(sshParams);
m_ui->fsView->setModel(m_fsModel);
}
diff --git a/tests/manual/ssh/sftpfsmodel/window.h b/tests/manual/ssh/sftpfsmodel/window.h
index 6b8dde1329e..d3ba03c1345 100644
--- a/tests/manual/ssh/sftpfsmodel/window.h
+++ b/tests/manual/ssh/sftpfsmodel/window.h
@@ -40,14 +40,13 @@ public:
SftpFsWindow(QWidget *parent = 0);
~SftpFsWindow();
-private slots:
+private:
void connectToHost();
void downloadFile();
void handleConnectionError(const QString &errorMessage);
void handleSftpOperationFailed(const QString &errorMessage);
void handleSftpOperationFinished(QSsh::SftpJobId jobId, const QString &error);
-private:
QSsh::SftpFileSystemModel *m_fsModel;
Ui::Window *m_ui;
};
diff --git a/tests/manual/ssh/shell/shell.cpp b/tests/manual/ssh/shell/shell.cpp
index 48f3f18bf75..c3997eed647 100644
--- a/tests/manual/ssh/shell/shell.cpp
+++ b/tests/manual/ssh/shell/shell.cpp
@@ -42,9 +42,9 @@ Shell::Shell(const SshConnectionParameters &parameters, QObject *parent)
m_connection(new SshConnection(parameters)),
m_stdin(new QFile(this))
{
- connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
- connect(m_connection, SIGNAL(dataAvailable(QString)), SLOT(handleShellMessage(QString)));
- connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
+ connect(m_connection, &SshConnection::connected, this, &Shell::handleConnected);
+ connect(m_connection, &SshConnection::dataAvailable, this, &Shell::handleShellMessage);
+ connect(m_connection, &SshConnection::error, this, &Shell::handleConnectionError);
}
Shell::~Shell()
@@ -77,17 +77,19 @@ void Shell::handleShellMessage(const QString &message)
void Shell::handleConnected()
{
m_shell = m_connection->createRemoteShell();
- connect(m_shell.data(), SIGNAL(started()), SLOT(handleShellStarted()));
- connect(m_shell.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleRemoteStdout()));
- connect(m_shell.data(), SIGNAL(readyReadStandardError()), SLOT(handleRemoteStderr()));
- connect(m_shell.data(), SIGNAL(closed(int)), SLOT(handleChannelClosed(int)));
+ connect(m_shell.data(), &SshRemoteProcess::started, this, &Shell::handleShellStarted);
+ connect(m_shell.data(), &SshRemoteProcess::readyReadStandardOutput,
+ this, &Shell::handleRemoteStdout);
+ connect(m_shell.data(), &SshRemoteProcess::readyReadStandardError,
+ this, &Shell::handleRemoteStderr);
+ connect(m_shell.data(), &SshRemoteProcess::closed, this, &Shell::handleChannelClosed);
m_shell->start();
}
void Shell::handleShellStarted()
{
QSocketNotifier * const notifier = new QSocketNotifier(0, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), SLOT(handleStdin()));
+ connect(notifier, &QSocketNotifier::activated, this, &Shell::handleStdin);
}
void Shell::handleRemoteStdout()
diff --git a/tests/manual/ssh/shell/shell.h b/tests/manual/ssh/shell/shell.h
index 3fae9bf18be..ed5f4d82b37 100644
--- a/tests/manual/ssh/shell/shell.h
+++ b/tests/manual/ssh/shell/shell.h
@@ -49,7 +49,7 @@ public:
void run();
-private slots:
+private:
void handleConnected();
void handleConnectionError();
void handleRemoteStdout();
@@ -59,7 +59,6 @@ private slots:
void handleShellStarted();
void handleStdin();
-private:
QSsh::SshConnection *m_connection;
QSharedPointer<QSsh::SshRemoteProcess> m_shell;
QFile * const m_stdin;
diff --git a/tests/manual/ssh/tunnel/directtunnel.cpp b/tests/manual/ssh/tunnel/directtunnel.cpp
index 5c23669d716..54f4c3a3e5d 100644
--- a/tests/manual/ssh/tunnel/directtunnel.cpp
+++ b/tests/manual/ssh/tunnel/directtunnel.cpp
@@ -47,8 +47,8 @@ DirectTunnel::DirectTunnel(const SshConnectionParameters &parameters, QObject *p
m_targetServer(new QTcpServer(this)),
m_expectingChannelClose(false)
{
- connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
- connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
+ connect(m_connection, &SshConnection::connected, this, &DirectTunnel::handleConnected);
+ connect(m_connection, &SshConnection::error, this, &DirectTunnel::handleConnectionError);
}
DirectTunnel::~DirectTunnel()
@@ -77,14 +77,16 @@ void DirectTunnel::handleConnected()
return;
}
m_targetPort = m_targetServer->serverPort();
- connect(m_targetServer, SIGNAL(newConnection()), SLOT(handleNewConnection()));
+ connect(m_targetServer, &QTcpServer::newConnection, this, &DirectTunnel::handleNewConnection);
m_tunnel = m_connection->createDirectTunnel(QLatin1String("localhost"), 1024, // made-up values
QLatin1String("localhost"), m_targetPort);
- connect(m_tunnel.data(), SIGNAL(initialized()), SLOT(handleInitialized()));
- connect(m_tunnel.data(), SIGNAL(error(QString)), SLOT(handleTunnelError(QString)));
- connect(m_tunnel.data(), SIGNAL(readyRead()), SLOT(handleServerData()));
- connect(m_tunnel.data(), SIGNAL(aboutToClose()), SLOT(handleTunnelClosed()));
+ connect(m_tunnel.data(), &SshDirectTcpIpTunnel::initialized,
+ this, &DirectTunnel::handleInitialized);
+ connect(m_tunnel.data(), &SshDirectTcpIpTunnel::error,
+ this, &DirectTunnel::handleTunnelError);
+ connect(m_tunnel.data(), &QIODevice::readyRead, this, &DirectTunnel::handleServerData);
+ connect(m_tunnel.data(), &QIODevice::aboutToClose, this, &DirectTunnel::handleTunnelClosed);
std::cout << "Initializing tunnel..." << std::endl;
m_tunnel->initialize();
@@ -95,7 +97,7 @@ void DirectTunnel::handleInitialized()
std::cout << "Writing data into the tunnel..." << std::endl;
m_tunnel->write(TestData);
QTimer * const timeoutTimer = new QTimer(this);
- connect(timeoutTimer, SIGNAL(timeout()), SLOT(handleTimeout()));
+ connect(timeoutTimer, &QTimer::timeout, this, &DirectTunnel::handleTimeout);
timeoutTimer->start(10000);
}
@@ -131,8 +133,10 @@ void DirectTunnel::handleNewConnection()
{
m_targetSocket = m_targetServer->nextPendingConnection();
m_targetServer->close();
- connect(m_targetSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(handleSocketError()));
- connect(m_targetSocket, SIGNAL(readyRead()), SLOT(handleClientData()));
+ connect(m_targetSocket,
+ static_cast<void (QAbstractSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error),
+ this, &DirectTunnel::handleSocketError);
+ connect(m_targetSocket, &QIODevice::readyRead, this, &DirectTunnel::handleClientData);
handleClientData();
}
diff --git a/tests/manual/ssh/tunnel/directtunnel.h b/tests/manual/ssh/tunnel/directtunnel.h
index 26c1898b1c5..b73fcd9d63b 100644
--- a/tests/manual/ssh/tunnel/directtunnel.h
+++ b/tests/manual/ssh/tunnel/directtunnel.h
@@ -51,7 +51,7 @@ public:
signals:
void finished(int errorCode);
-private slots:
+private:
void handleConnected();
void handleConnectionError();
void handleServerData();
@@ -63,7 +63,6 @@ private slots:
void handleClientData();
void handleTimeout();
-private:
QSsh::SshConnection * const m_connection;
QSharedPointer<QSsh::SshDirectTcpIpTunnel> m_tunnel;
QTcpServer * const m_targetServer;
diff --git a/tests/manual/ssh/tunnel/forwardtunnel.h b/tests/manual/ssh/tunnel/forwardtunnel.h
index d5cc23ff627..fd3bf35d40d 100644
--- a/tests/manual/ssh/tunnel/forwardtunnel.h
+++ b/tests/manual/ssh/tunnel/forwardtunnel.h
@@ -51,7 +51,7 @@ public:
signals:
void finished(int exitCode);
-private slots:
+private:
void handleConnected();
void handleConnectionError(QSsh::SshError error);
void handleInitialized();
@@ -60,7 +60,6 @@ private slots:
void handleNewConnection();
void handleSocketError();
-private:
QSsh::SshConnection * const m_connection;
QSharedPointer<QSsh::SshTcpIpForwardServer> m_server;
QTcpSocket *m_targetSocket;