diff options
author | Martin Kampas <martin.kampas@jolla.com> | 2016-11-22 11:06:55 +0100 |
---|---|---|
committer | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-11-23 20:17:53 +0000 |
commit | bce1e2beabe6fa15b79c0d3d2641c99a2cb6581f (patch) | |
tree | df36ad49d4410b1fdbc98cd050f8c412b224fd36 | |
parent | df675ea04b1c3d43102d6b7dc459fe9027efb715 (diff) |
Modernize: Use Qt5 signal slot connection syntax
Change-Id: I84d1303bdc67bad3373de5b42f7e9f9507339397
Reviewed-by: Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>
-rw-r--r-- | src/bench/allhostswidget.cpp | 4 | ||||
-rw-r--r-- | src/bench/hostmanager.cpp | 12 | ||||
-rw-r--r-- | src/bench/hostmodel.cpp | 18 | ||||
-rw-r--r-- | src/bench/hostsoptionpage.cpp | 26 | ||||
-rw-r--r-- | src/bench/hostwidget.cpp | 85 | ||||
-rw-r--r-- | src/bench/importpathoptionpage.cpp | 6 | ||||
-rw-r--r-- | src/bench/mainwindow.cpp | 80 | ||||
-rw-r--r-- | src/bench/optionsdialog.cpp | 4 | ||||
-rw-r--r-- | src/ipc/ipcclient.cpp | 40 | ||||
-rw-r--r-- | src/ipc/ipcconnection.cpp | 7 | ||||
-rw-r--r-- | src/ipc/ipcserver.cpp | 11 | ||||
-rw-r--r-- | src/livehubengine.cpp | 2 | ||||
-rw-r--r-- | src/livenodeengine.cpp | 2 | ||||
-rw-r--r-- | src/logreceiver.cpp | 2 | ||||
-rw-r--r-- | src/previewGenerator/main.cpp | 2 | ||||
-rw-r--r-- | src/remotelogger.cpp | 2 | ||||
-rw-r--r-- | src/remotepublisher.cpp | 35 | ||||
-rw-r--r-- | src/remotereceiver.cpp | 28 | ||||
-rw-r--r-- | src/watcher.cpp | 4 | ||||
-rw-r--r-- | src/widgets/logview.cpp | 4 | ||||
-rw-r--r-- | src/widgets/logview.h | 2 | ||||
-rw-r--r-- | src/widgets/workspaceview.cpp | 2 | ||||
-rw-r--r-- | tests/testipc/tst_testipc.cpp | 8 |
23 files changed, 228 insertions, 158 deletions
diff --git a/src/bench/allhostswidget.cpp b/src/bench/allhostswidget.cpp index 899be34..114eba7 100644 --- a/src/bench/allhostswidget.cpp +++ b/src/bench/allhostswidget.cpp @@ -39,11 +39,11 @@ AllHostsWidget::AllHostsWidget(QWidget *parent) : setContentsMargins(0,0,0,0); m_publishAction = new QAction("Publish", this); m_publishAction->setIcon(QIcon(":images/publish.svg")); - connect(m_publishAction, SIGNAL(triggered(bool)), this, SLOT(onPublishTriggered())); + connect(m_publishAction, &QAction::triggered, this, &AllHostsWidget::onPublishTriggered); m_refreshAction = new QAction("Refresh", this); m_refreshAction->setIcon(QIcon(":images/refresh.svg")); - connect(m_refreshAction, SIGNAL(triggered(bool)), this, SIGNAL(refreshAll())); + connect(m_refreshAction, &QAction::triggered, this, &AllHostsWidget::refreshAll); setAcceptDrops(true); diff --git a/src/bench/hostmanager.cpp b/src/bench/hostmanager.cpp index 546f46e..633bfcd 100644 --- a/src/bench/hostmanager.cpp +++ b/src/bench/hostmanager.cpp @@ -68,7 +68,7 @@ void HostManager::setModel(HostModel *model) m_model = model; QListView::setModel(model); - connect(model, SIGNAL(modelReset()), this, SLOT(modelReseted())); + connect(model, &HostModel::modelReset, this, &HostManager::modelReseted); } void HostManager::setLiveHubEngine(LiveHubEngine *engine) @@ -154,15 +154,15 @@ void HostManager::addHost(int index) widget->setLiveHubEngine(m_engine.data()); widget->setHost(host); setIndexWidget(m_model->index(index,0), widget); - connect(widget, SIGNAL(openHostConfig(Host*)), this, SIGNAL(openHostConfig(Host*))); + connect(widget, &HostWidget::openHostConfig, this, &HostManager::openHostConfig); QDockWidget *dock = new QDockWidget(host->name()); dock->setObjectName(host->name() + "LogDock"); - connect(host, SIGNAL(nameChanged(QString)), dock, SLOT(setWindowTitle(QString))); + connect(host, &Host::nameChanged, dock, &QDockWidget::setWindowTitle); LogView *view = new LogView(false, dock); - connect(widget, SIGNAL(remoteLog(int,QString,QUrl,int,int)), view, SLOT(appendToLog(int,QString,QUrl,int,int))); - connect(widget, SIGNAL(clearLog()), view, SLOT(clear())); - connect(widget, SIGNAL(connected()), view, SLOT(clear())); + connect(widget, &HostWidget::remoteLog, view, &LogView::appendToLog); + connect(widget, &HostWidget::clearLog, view, &LogView::clear); + connect(widget, &HostWidget::connected, view, &LogView::clear); dock->setWidget(view); m_logList.append(dock); emit logWidgetAdded(dock); diff --git a/src/bench/hostmodel.cpp b/src/bench/hostmodel.cpp index a0a3b76..98c102e 100644 --- a/src/bench/hostmodel.cpp +++ b/src/bench/hostmodel.cpp @@ -100,15 +100,15 @@ void HostModel::addHost(Host *host) beginInsertRows(QModelIndex(), m_hosts.count(), m_hosts.count()); m_hosts.append(host); - connect(host, SIGNAL(nameChanged(QString)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(addressChanged(QString)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(portChanged(int)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(followTreeSelectionChanged(bool)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(currentFileChanged(LiveDocument)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(xOffsetChanged(int)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(yOffsetChanged(int)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(rotationChanged(int)), this, SLOT(onHostChanged())); - connect(host, SIGNAL(onlineChanged(bool)), this, SLOT(onHostChanged())); + connect(host, &Host::nameChanged, this, &HostModel::onHostChanged); + connect(host, &Host::addressChanged, this, &HostModel::onHostChanged); + connect(host, &Host::portChanged, this, &HostModel::onHostChanged); + connect(host, &Host::followTreeSelectionChanged, this, &HostModel::onHostChanged); + connect(host, &Host::currentFileChanged, this, &HostModel::onHostChanged); + connect(host, &Host::xOffsetChanged, this, &HostModel::onHostChanged); + connect(host, &Host::yOffsetChanged, this, &HostModel::onHostChanged); + connect(host, &Host::rotationChanged, this, &HostModel::onHostChanged); + connect(host, &Host::onlineChanged, this, &HostModel::onHostChanged); endInsertRows(); } diff --git a/src/bench/hostsoptionpage.cpp b/src/bench/hostsoptionpage.cpp index e463b44..c7ac997 100644 --- a/src/bench/hostsoptionpage.cpp +++ b/src/bench/hostsoptionpage.cpp @@ -48,20 +48,26 @@ HostsOptionsPage::HostsOptionsPage(QWidget *parent) : ui->hostUI->setVisible(false); - connect(ui->nameField, SIGNAL(textEdited(QString)), this, SLOT(updateName(QString))); - connect(ui->ipField, SIGNAL(textEdited(QString)), this, SLOT(updateAddress(QString))); - connect(ui->portField, SIGNAL(valueChanged(int)), this, SLOT(updatePort(int))); - connect(ui->followTreeSelectionField, SIGNAL(clicked(bool)), this, SLOT(updateFollowTreeSelection(bool))); - connect(ui->xField, SIGNAL(valueChanged(int)), this, SLOT(updateXOffset(int))); - connect(ui->yField, SIGNAL(valueChanged(int)), this, SLOT(updateYOffset(int))); - connect(ui->rotationField, SIGNAL(valueChanged(int)), this, SLOT(updateRotation(int))); + connect(ui->nameField, &QLineEdit::textEdited, this, &HostsOptionsPage::updateName); + connect(ui->ipField, &QLineEdit::textEdited, this, &HostsOptionsPage::updateAddress); + void (QSpinBox::*QSpinBox__valueChanged)(int) = &QSpinBox::valueChanged; + connect(ui->portField, QSpinBox__valueChanged, this, &HostsOptionsPage::updatePort); + connect(ui->followTreeSelectionField, &QCheckBox::clicked, this, &HostsOptionsPage::updateFollowTreeSelection); + connect(ui->xField, QSpinBox__valueChanged, this, &HostsOptionsPage::updateXOffset); + connect(ui->yField, QSpinBox__valueChanged, this, &HostsOptionsPage::updateYOffset); + connect(ui->rotationField, QSpinBox__valueChanged, this, &HostsOptionsPage::updateRotation); QMenu *menu = new QMenu(ui->addHostButton); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) menu->addAction("Auto Discovery...", this, SLOT(showAutoDiscoveryDialog())); menu->addAction("Manual", this, SLOT(addHost())); +#else + menu->addAction("Auto Discovery...", this, &HostsOptionsPage::showAutoDiscoveryDialog); + menu->addAction("Manual", this, [this] { addHost(); }); +#endif ui->addHostButton->setMenu(menu); - connect(ui->removeHostButton, SIGNAL(clicked()), this, SLOT(removeHost())); + connect(ui->removeHostButton, &QAbstractButton::clicked, this, &HostsOptionsPage::removeHost); } HostsOptionsPage::~HostsOptionsPage() @@ -74,8 +80,8 @@ void HostsOptionsPage::setHostModel(HostModel *model) m_model = model; m_currentIndex = -1; - connect(ui->hostsWidget->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), - this, SLOT(onCurrentRowChanged(QModelIndex,QModelIndex))); + connect(ui->hostsWidget->selectionModel(), &QItemSelectionModel::currentRowChanged, + this, &HostsOptionsPage::onCurrentRowChanged); for (int i=0; i< m_model->rowCount(); i++) { Host *host = m_model->hostAt(i); diff --git a/src/bench/hostwidget.cpp b/src/bench/hostwidget.cpp index 2452329..ef56eb7 100644 --- a/src/bench/hostwidget.cpp +++ b/src/bench/hostwidget.cpp @@ -50,15 +50,15 @@ HostWidget::HostWidget(QWidget *parent) : m_connectDisconnectAction = new QAction("Offline", this); m_connectDisconnectAction->setIcon(QIcon(":images/error_ball.svg")); - connect(m_connectDisconnectAction, SIGNAL(triggered(bool)), this, SLOT(connectToServer())); + connect(m_connectDisconnectAction, &QAction::triggered, this, &HostWidget::connectToServer); m_refreshAction = new QAction("Refresh", this); m_refreshAction->setIcon(QIcon(":images/refresh.svg")); - connect(m_refreshAction, SIGNAL(triggered(bool)), this, SLOT(refresh())); + connect(m_refreshAction, &QAction::triggered, this, &HostWidget::refresh); m_publishAction = new QAction("Publish", this); m_publishAction->setIcon(QIcon(":/images/publish.svg")); - connect(m_publishAction, SIGNAL(triggered(bool)), this, SLOT(publishAll())); + connect(m_publishAction, &QAction::triggered, this, &HostWidget::publishAll); m_followTreeSelectionAction = new QAction("Follow", this); m_followTreeSelectionAction->setIcon(QIcon(":images/linked.svg")); @@ -66,7 +66,7 @@ HostWidget::HostWidget(QWidget *parent) : m_editHostAction = new QAction("Setup", this); m_editHostAction->setIcon(QIcon(":images/edit.svg")); - connect(m_editHostAction, SIGNAL(triggered(bool)), this, SLOT(onEditHost())); + connect(m_editHostAction, &QAction::triggered, this, &HostWidget::onEditHost); QGridLayout *layout = new QGridLayout(this); layout->setContentsMargins(0,0,0,0); @@ -103,20 +103,16 @@ HostWidget::HostWidget(QWidget *parent) : vbox->addWidget(toolBar);; - connect(&m_publisher, SIGNAL(connected()), this, SIGNAL(connected())); - connect(&m_publisher, SIGNAL(connected()), this, SLOT(onConnected())); - connect(&m_publisher, SIGNAL(disconnected()), this, SLOT(onDisconnected())); - connect(&m_publisher, SIGNAL(connectionError(QAbstractSocket::SocketError)), - this, SLOT(onConnectionError(QAbstractSocket::SocketError))); - connect(&m_publisher, SIGNAL(sendingError(QUuid,QAbstractSocket::SocketError)), - this, SLOT(onSendingError(QUuid,QAbstractSocket::SocketError))); - connect(&m_publisher, SIGNAL(sentSuccessfully(QUuid)), - this, SLOT(onSentSuccessfully(QUuid))); - connect(&m_publisher, SIGNAL(needsPinAuthentication()), this, SLOT(showPinDialog())); - connect(&m_publisher, SIGNAL(pinOk(bool)), this, SLOT(onPinOk(bool))); - connect(&m_publisher, SIGNAL(remoteLog(int,QString,QUrl,int,int)), - this, SIGNAL(remoteLog(int,QString,QUrl,int,int))); - connect(&m_publisher, SIGNAL(clearLog()), this, SIGNAL(clearLog())); + connect(&m_publisher, &RemotePublisher::connected, this, &HostWidget::connected); + connect(&m_publisher, &RemotePublisher::connected, this, &HostWidget::onConnected); + connect(&m_publisher, &RemotePublisher::disconnected, this, &HostWidget::onDisconnected); + connect(&m_publisher, &RemotePublisher::connectionError, this, &HostWidget::onConnectionError); + connect(&m_publisher, &RemotePublisher::sendingError, this, &HostWidget::onSendingError); + connect(&m_publisher, &RemotePublisher::sentSuccessfully, this, &HostWidget::onSentSuccessfully); + connect(&m_publisher, &RemotePublisher::needsPinAuthentication, this, &HostWidget::showPinDialog); + connect(&m_publisher, &RemotePublisher::pinOk, this, &HostWidget::onPinOk); + connect(&m_publisher, &RemotePublisher::remoteLog, this, &HostWidget::remoteLog); + connect(&m_publisher, &RemotePublisher::clearLog, this, &HostWidget::clearLog); } void HostWidget::setHost(Host *host) @@ -127,21 +123,20 @@ void HostWidget::setHost(Host *host) updateFile(m_host->currentFile()); m_followTreeSelectionAction->setChecked(m_host->followTreeSelection()); - connect(host, SIGNAL(addressChanged(QString)), this, SLOT(updateTitle())); - connect(host, SIGNAL(addressChanged(QString)), this, SLOT(scheduleConnectToServer())); - connect(host, SIGNAL(portChanged(int)), this, SLOT(updateTitle())); - connect(host, SIGNAL(portChanged(int)), this, SLOT(scheduleConnectToServer())); - connect(host, SIGNAL(availableChanged(bool)), this, SLOT(updateAvailableState(bool))); - connect(host, SIGNAL(currentFileChanged(LiveDocument)), this, SLOT(updateFile(LiveDocument))); - connect(host, SIGNAL(nameChanged(QString)), this, SLOT(updateTitle())); - connect(host, SIGNAL(xOffsetChanged(int)), this, SLOT(sendXOffset(int))); - connect(host, SIGNAL(yOffsetChanged(int)), this, SLOT(sendYOffset(int))); - connect(host, SIGNAL(rotationChanged(int)), this, SLOT(sendRotation(int))); - connect(host, SIGNAL(followTreeSelectionChanged(bool)), - this, SLOT(updateFollowTreeSelection(bool))); - - connect(m_followTreeSelectionAction, SIGNAL(triggered(bool)), host, SLOT(setFollowTreeSelection(bool))); - connect(&m_publisher, SIGNAL(activeDocumentChanged(LiveDocument)), m_host, SLOT(setCurrentFile(LiveDocument))); + connect(host, &Host::addressChanged, this, &HostWidget::updateTitle); + connect(host, &Host::addressChanged, this, &HostWidget::scheduleConnectToServer); + connect(host, &Host::portChanged, this, &HostWidget::updateTitle); + connect(host, &Host::portChanged, this, &HostWidget::scheduleConnectToServer); + connect(host, &Host::availableChanged, this, &HostWidget::updateAvailableState); + connect(host, &Host::currentFileChanged, this, &HostWidget::updateFile); + connect(host, &Host::nameChanged, this, &HostWidget::updateTitle); + connect(host, &Host::xOffsetChanged, this, &HostWidget::sendXOffset); + connect(host, &Host::yOffsetChanged, this, &HostWidget::sendYOffset); + connect(host, &Host::rotationChanged, this, &HostWidget::sendRotation); + connect(host, &Host::followTreeSelectionChanged, this, &HostWidget::updateFollowTreeSelection); + + connect(m_followTreeSelectionAction, &QAction::triggered, host, &Host::setFollowTreeSelection); + connect(&m_publisher, &RemotePublisher::activeDocumentChanged, host, &Host::setCurrentFile); updateAvailableState(m_host->available()); updateRemoteActions(); @@ -153,12 +148,12 @@ void HostWidget::setLiveHubEngine(LiveHubEngine *engine) m_publisher.setWorkspace(m_engine->workspace()); - connect(m_engine.data(), SIGNAL(workspaceChanged(QString)), &m_publisher, SLOT(setWorkspace(QString))); - connect(m_engine.data(), SIGNAL(workspaceChanged(QString)), this, SLOT(refreshDocumentLabel())); - connect(m_engine.data(), SIGNAL(fileChanged(LiveDocument)), this, SLOT(sendDocument(LiveDocument))); - connect(m_engine.data(), SIGNAL(beginPublishWorkspace()), &m_publisher, SLOT(beginBulkSend())); - connect(m_engine.data(), SIGNAL(endPublishWorkspace()), &m_publisher, SLOT(endBulkSend())); - connect(&m_publisher, SIGNAL(needsPublishWorkspace()), this, SLOT(publishWorkspace())); + connect(m_engine.data(), &LiveHubEngine::workspaceChanged, &m_publisher, &RemotePublisher::setWorkspace); + connect(m_engine.data(), &LiveHubEngine::workspaceChanged, this, &HostWidget::refreshDocumentLabel); + connect(m_engine.data(), &LiveHubEngine::fileChanged, this, &HostWidget::sendDocument); + connect(m_engine.data(), &LiveHubEngine::beginPublishWorkspace, &m_publisher, &RemotePublisher::beginBulkSend); + connect(m_engine.data(), &LiveHubEngine::endPublishWorkspace, &m_publisher, &RemotePublisher::endBulkSend); + connect(&m_publisher, &RemotePublisher::needsPublishWorkspace, this, &HostWidget::publishWorkspace); } void HostWidget::setCurrentFile(const LiveDocument ¤tFile) @@ -296,8 +291,8 @@ void HostWidget::onConnected() sendYOffset(m_host->yOffset()); sendRotation(m_host->rotation()); - disconnect(m_connectDisconnectAction, SIGNAL(triggered()), 0, 0); - connect(m_connectDisconnectAction, SIGNAL(triggered()), &m_publisher, SLOT(disconnectFromServer())); + disconnect(m_connectDisconnectAction, &QAction::triggered, 0, 0); + connect(m_connectDisconnectAction, &QAction::triggered, &m_publisher, &RemotePublisher::disconnectFromServer); } void HostWidget::onDisconnected() @@ -312,8 +307,8 @@ void HostWidget::onDisconnected() m_host->setCurrentFile(LiveDocument()); updateRemoteActions(); - disconnect(m_connectDisconnectAction, SIGNAL(triggered()), 0, 0); - connect(m_connectDisconnectAction, SIGNAL(triggered()), this, SLOT(connectToServer())); + disconnect(m_connectDisconnectAction, &QAction::triggered, 0, 0); + connect(m_connectDisconnectAction, &QAction::triggered, this, &HostWidget::connectToServer); } void HostWidget::onConnectionError(QAbstractSocket::SocketError error) @@ -349,9 +344,9 @@ void HostWidget::publishWorkspace() if (m_publisher.state() != QAbstractSocket::ConnectedState) return; - connect(m_engine.data(), SIGNAL(publishFile(LiveDocument)), this, SLOT(sendDocument(LiveDocument))); + connect(m_engine.data(), &LiveHubEngine::publishFile, this, &HostWidget::sendDocument); m_engine->publishWorkspace(); - disconnect(m_engine.data(), SIGNAL(publishFile(LiveDocument)), this, SLOT(sendDocument(LiveDocument))); + disconnect(m_engine.data(), &LiveHubEngine::publishFile, this, &HostWidget::sendDocument); } void HostWidget::sendDocument(const LiveDocument& document) diff --git a/src/bench/importpathoptionpage.cpp b/src/bench/importpathoptionpage.cpp index 151e919..34fd3e1 100644 --- a/src/bench/importpathoptionpage.cpp +++ b/src/bench/importpathoptionpage.cpp @@ -48,9 +48,9 @@ ImportPathOptionPage::ImportPathOptionPage(QWidget *parent) : } s.endArray(); - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addItem())); - connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeItem())); - connect(ui->editButton, SIGNAL(clicked()), this, SLOT(editItem())); + connect(ui->addButton, &QAbstractButton::clicked, this, &ImportPathOptionPage::addItem); + connect(ui->removeButton, &QAbstractButton::clicked, this, &ImportPathOptionPage::removeItem); + connect(ui->editButton, &QAbstractButton::clicked, this, &ImportPathOptionPage::editItem); } ImportPathOptionPage::~ImportPathOptionPage() diff --git a/src/bench/mainwindow.cpp b/src/bench/mainwindow.cpp index 62a29e5..61924aa 100644 --- a/src/bench/mainwindow.cpp +++ b/src/bench/mainwindow.cpp @@ -77,17 +77,17 @@ MainWindow::MainWindow(QWidget *parent) m_hub->setFilePublishingActive(true); m_node->setWorkspaceView(m_workspace); - connect(m_workspace, SIGNAL(pathActivated(LiveDocument)), m_hub, SLOT(setActivePath(LiveDocument))); - connect(m_workspace, SIGNAL(pathActivated(LiveDocument)), m_hostManager, SLOT(followTreeSelection(LiveDocument))); - connect(m_hub, SIGNAL(activateDocument(LiveDocument)), this, SLOT(updateWindowTitle())); - connect(m_hub, SIGNAL(activateDocument(LiveDocument)), m_node, SLOT(loadDocument(LiveDocument))); - connect(m_node, SIGNAL(activeWindowChanged(QQuickWindow*)), this, SLOT(onActiveWindowChanged(QQuickWindow*))); - connect(m_node->qmlEngine(), SIGNAL(quit()), this, SLOT(logQuitEvent())); - connect(m_allHosts, SIGNAL(publishAll()), m_hostManager, SLOT(publishAll())); - connect(m_allHosts, SIGNAL(currentFileChanged(LiveDocument)), m_hostManager, SLOT(setCurrentFile(LiveDocument))); - connect(m_allHosts, SIGNAL(refreshAll()), m_hostManager, SLOT(refreshAll())); - connect(m_hostManager, SIGNAL(logWidgetAdded(QDockWidget*)), this, SLOT(onLogWidgetAdded(QDockWidget*))); - connect(m_hostManager, SIGNAL(openHostConfig(Host*)), this, SLOT(openPreferences(Host*))); + connect(m_workspace, &WorkspaceView::pathActivated, m_hub, &LiveHubEngine::setActivePath); + connect(m_workspace, &WorkspaceView::pathActivated, m_hostManager, &HostManager::followTreeSelection); + connect(m_hub, &LiveHubEngine::activateDocument, this, &MainWindow::updateWindowTitle); + connect(m_hub, &LiveHubEngine::activateDocument, m_node, &LiveNodeEngine::loadDocument); + connect(m_node, &LiveNodeEngine::activeWindowChanged, this, &MainWindow::onActiveWindowChanged); + connect(m_node->qmlEngine(), &QQmlEngine::quit, this, &MainWindow::logQuitEvent); + connect(m_allHosts, &AllHostsWidget::publishAll, m_hostManager, &HostManager::publishAll); + connect(m_allHosts, &AllHostsWidget::currentFileChanged, m_hostManager, &HostManager::setCurrentFile); + connect(m_allHosts, &AllHostsWidget::refreshAll, m_hostManager, &HostManager::refreshAll); + connect(m_hostManager, &HostManager::logWidgetAdded, this, &MainWindow::onLogWidgetAdded); + connect(m_hostManager, &HostManager::openHostConfig, this, &MainWindow::openPreferences); m_qmlDefaultimportList = m_node->qmlEngine()->importPathList(); } @@ -168,34 +168,78 @@ void MainWindow::setupLogView() m_logDock->setFeatures(QDockWidget::AllDockWidgetFeatures); addDockWidget(Qt::BottomDockWidgetArea, m_logDock); - connect(m_node, SIGNAL(clearLog()), m_log, SLOT(clear())); - connect(m_node, SIGNAL(logIgnoreMessages(bool)), m_log, SLOT(setIgnoreMessages(bool))); - connect(m_node, SIGNAL(logErrors(QList<QQmlError>)), m_log, SLOT(appendToLog(QList<QQmlError>))); + connect(m_node, &LiveNodeEngine::clearLog, m_log, &LogView::clear); + connect(m_node, &LiveNodeEngine::logIgnoreMessages, m_log, &LogView::setIgnoreMessages); + connect(m_node, &LiveNodeEngine::logErrors, m_log, &LogView::appendAllToLog); } void MainWindow::setupMenuBar() { QMenu *file = menuBar()->addMenu(tr("&File")); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) m_openWorkspace = file->addAction(QIcon::fromTheme("folder-open"), tr("&Open Workspace..."), this, SLOT(openWorkspace()), QKeySequence::Open); +#else + m_openWorkspace = file->addAction(QIcon::fromTheme("folder-open"), tr("&Open Workspace..."), + this, &MainWindow::openWorkspace, QKeySequence::Open); +#endif m_recentMenu = file->addMenu(QIcon::fromTheme("document-open-recent"), "&Recent"); m_recentMenu->setEnabled(false); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) file->addAction(tr("Preferences..."), this, SLOT(openPreferences()), QKeySequence::Preferences); +#else + file->addAction(tr("Preferences..."), this, [this] { openPreferences(); }, + QKeySequence::Preferences); +#endif file->addSeparator(); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) file->addAction(QIcon::fromTheme("application-exit"), tr("&Quit"), this, SLOT(close()), QKeySequence::Quit); +#else + file->addAction(QIcon::fromTheme("application-exit"), tr("&Quit"), + this, &MainWindow::close, QKeySequence::Quit); +#endif QMenu *view = menuBar()->addMenu(tr("&View")); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) view->addAction(tr("Take Snapshot"), this, SLOT(takeSnapshot()), QKeySequence("Ctrl+F3")); +#else + view->addAction(tr("Take Snapshot"), this, &MainWindow::takeSnapshot, QKeySequence("Ctrl+F3")); +#endif view->addSeparator(); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) QAction *slow = view->addAction(tr("Slow Down Animations"), this, SLOT(slowDownAnimations(bool)), QKeySequence(tr("Ctrl+."))); +#else + QAction *slow = view->addAction(tr("Slow Down Animations"), + this, &MainWindow::slowDownAnimations, + QKeySequence(tr("Ctrl+."))); +#endif slow->setCheckable(true); view->addSeparator(); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) m_refresh = view->addAction(QIcon::fromTheme("view-refresh"), tr("Refresh"), m_node, SLOT(refresh()), QKeySequence::Refresh); +#else + m_refresh = view->addAction(QIcon::fromTheme("view-refresh"), tr("Refresh"), + m_node, &BenchLiveNodeEngine::refresh, QKeySequence::Refresh); +#endif +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) m_resizeFit = view->addAction(QIcon::fromTheme("zoom-fit-best"), tr("Resize to Fit"), this, SLOT(resizeToFit())); +#else + m_resizeFit = view->addAction(QIcon::fromTheme("zoom-fit-best"), tr("Resize to Fit"), + this, &MainWindow::resizeToFit); +#endif +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) view->addAction(tr("Show Containing Folder"), m_workspace, SLOT(goUp()), QKeySequence("Ctrl+Esc")); +#else + view->addAction(tr("Show Containing Folder"), m_workspace, &WorkspaceView::goUp, + QKeySequence("Ctrl+Esc")); +#endif +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) m_stayOnTop = view->addAction(tr("Stay on Top"), this, SLOT(stayOnTop())); +#else + m_stayOnTop = view->addAction(tr("Stay on Top"), this, &MainWindow::stayOnTop); +#endif m_stayOnTop->setCheckable(true); view->addSeparator(); @@ -448,11 +492,19 @@ void MainWindow::updateRecentFolder(const QString& path) m_recentMenu->clear(); foreach (const QString file, m_recentFolder) { +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) m_recentMenu->addAction(file, this, SLOT(openRecentFolder())); +#else + m_recentMenu->addAction(file, this, &MainWindow::openRecentFolder); +#endif } m_recentMenu->addSeparator(); +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) m_recentMenu->addAction("Clear Menu", this, SLOT(clearRecentFolder())); +#else + m_recentMenu->addAction("Clear Menu", this, &MainWindow::clearRecentFolder); +#endif } void MainWindow::stayOnTop() diff --git a/src/bench/optionsdialog.cpp b/src/bench/optionsdialog.cpp index ef99807..00c5898 100644 --- a/src/bench/optionsdialog.cpp +++ b/src/bench/optionsdialog.cpp @@ -60,8 +60,8 @@ OptionsDialog::OptionsDialog(QWidget *parent) item->setData(Qt::UserRole, index); ui->optionsView->addItem(item); - connect(ui->optionsView, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(optionSelected(QListWidgetItem*))); + connect(ui->optionsView, &QListWidget::currentItemChanged, + this, &OptionsDialog::optionSelected); } OptionsDialog::~OptionsDialog() diff --git a/src/ipc/ipcclient.cpp b/src/ipc/ipcclient.cpp index b63319f..ada2511 100644 --- a/src/ipc/ipcclient.cpp +++ b/src/ipc/ipcclient.cpp @@ -84,13 +84,14 @@ IpcClient::IpcClient(QObject *parent) , m_written(0) , m_connection(new IpcConnection(m_socket)) { - connect(m_socket, SIGNAL(connected()), this, SIGNAL(connected())); - connect(m_socket, SIGNAL(connected()), this, SLOT(processQueue())); - connect(m_socket, SIGNAL(disconnected()), this, SIGNAL(disconnected())); - connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError))); - connect(m_socket, SIGNAL(bytesWritten(qint64)), this , SLOT(onBytesWritten(qint64))); - - connect(m_connection, SIGNAL(received(QString,QByteArray)), this, SIGNAL(received(QString,QByteArray))); + connect(m_socket, &QAbstractSocket::connected, this, &IpcClient::connected); + connect(m_socket, &QAbstractSocket::connected, this, &IpcClient::processQueue); + connect(m_socket, &QAbstractSocket::disconnected, this, &IpcClient::disconnected); + void (QAbstractSocket::*QAbstractSocket__error)(QAbstractSocket::SocketError) = &QAbstractSocket::error; + connect(m_socket, QAbstractSocket__error, this, &IpcClient::onError); + connect(m_socket, &QAbstractSocket::bytesWritten, this, &IpcClient::onBytesWritten); + + connect(m_connection, &IpcConnection::received, this, &IpcClient::received); } IpcClient::IpcClient(QTcpSocket *socket, QObject *parent) @@ -100,10 +101,11 @@ IpcClient::IpcClient(QTcpSocket *socket, QObject *parent) , m_written(0) , m_connection(0) { - connect(m_socket, SIGNAL(connected()), this, SIGNAL(connected())); - connect(m_socket, SIGNAL(disconnected()), this, SIGNAL(disconnected())); - connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError))); - connect(m_socket, SIGNAL(bytesWritten(qint64)), this , SLOT(onBytesWritten(qint64))); + connect(m_socket, &QAbstractSocket::connected, this, &IpcClient::connected); + connect(m_socket, &QAbstractSocket::disconnected, this, &IpcClient::disconnected); + void (QAbstractSocket::*QAbstractSocket__error)(QAbstractSocket::SocketError) = &QAbstractSocket::error; + connect(m_socket, QAbstractSocket__error, this, &IpcClient::onError); + connect(m_socket, &QAbstractSocket::bytesWritten, this, &IpcClient::onBytesWritten); } /*! @@ -140,7 +142,11 @@ QUuid IpcClient::send(const QString &method, const QByteArray &data) pkg->m_tries = 0; m_queue.enqueue(pkg); +#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) QTimer::singleShot(0, this, SLOT(processQueue())); +#else + QTimer::singleShot(0, this, &IpcClient::processQueue); +#endif return pkg->m_uuid; } @@ -295,7 +301,11 @@ void IpcClient::processQueue() DEBUG << "Tried to sent the package" << m_current->m_tries << "times, but didn't succeed"; m_queue.dequeue(); onError(QAbstractSocket::ConnectionRefusedError); +#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) QTimer::singleShot(0, this, SLOT(processQueue())); +#else + QTimer::singleShot(0, this, &IpcClient::processQueue); +#endif return; } @@ -305,7 +315,11 @@ void IpcClient::processQueue() m_queue.dequeue(); m_current->m_bytes = size; } else { +#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) QTimer::singleShot(1000, this, SLOT(processQueue())); +#else + QTimer::singleShot(1000, this, &IpcClient::processQueue); +#endif m_current = 0; } } @@ -335,7 +349,11 @@ void IpcClient::onError(QAbstractSocket::SocketError socketError) delete m_current; m_current = 0; +#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) QTimer::singleShot(0, this, SLOT(processQueue())); +#else + QTimer::singleShot(0, this, &IpcClient::processQueue); +#endif } if ((m_socket->state() != QAbstractSocket::ConnectedState && diff --git a/src/ipc/ipcconnection.cpp b/src/ipc/ipcconnection.cpp index 8d35e07..32c038e 100644 --- a/src/ipc/ipcconnection.cpp +++ b/src/ipc/ipcconnection.cpp @@ -54,9 +54,10 @@ IpcConnection::IpcConnection(QTcpSocket *socket, QObject *parent) { DEBUG << "IpcConnection()"; - connect(m_socket, SIGNAL(disconnected()), this, SLOT(close())); - connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(closeWithError())); - connect(m_socket, SIGNAL(readyRead()), this, SLOT(readData())); + connect(m_socket, &QAbstractSocket::disconnected, this, &IpcConnection::close); + void (QAbstractSocket::*QAbstractSocket__error)(QAbstractSocket::SocketError) = &QAbstractSocket::error; + connect(m_socket, QAbstractSocket__error, this, &IpcConnection::closeWithError); + connect(m_socket, &QAbstractSocket::readyRead, this, &IpcConnection::readData); } /** diff --git a/src/ipc/ipcserver.cpp b/src/ipc/ipcserver.cpp index 3db2005..3d8288c 100644 --- a/src/ipc/ipcserver.cpp +++ b/src/ipc/ipcserver.cpp @@ -49,10 +49,7 @@ * * \code{.cpp} * m_server = new IpcServer(this); - * connect( - * m_server, SIGNAL(received(QString,QByteArray)), - * this, SLOT(handleCall(QString, QByteArray)) - * ); + * connect(m_server, &IpcServer::received, this, &MyHandler::handleCall); * m_server->listen(10234); * * ... @@ -75,7 +72,7 @@ IpcServer::IpcServer(QObject *parent) : QObject(parent) , m_server(new QTcpServer(this)) { - connect(m_server, SIGNAL(newConnection()), this, SLOT(newConnection())); + connect(m_server, &QTcpServer::newConnection, this, &IpcServer::newConnection); } /*! @@ -98,8 +95,8 @@ void IpcServer::newConnection() emit clientConnected(socket->peerAddress()); emit clientConnected(socket); IpcConnection *connection = new IpcConnection(socket, this); - connect(connection, SIGNAL(connectionClosed()), this, SLOT(onConnectionClosed())); - connect(connection, SIGNAL(received(QString,QByteArray)), this, SIGNAL(received(QString,QByteArray))); + connect(connection, &IpcConnection::connectionClosed, this, &IpcServer::onConnectionClosed); + connect(connection, &IpcConnection::received, this, &IpcServer::received); } } diff --git a/src/livehubengine.cpp b/src/livehubengine.cpp index b922a58..39208bf 100644 --- a/src/livehubengine.cpp +++ b/src/livehubengine.cpp @@ -55,7 +55,7 @@ LiveHubEngine::LiveHubEngine(QObject *parent) , m_watcher(new Watcher(this)) , m_filePublishingActive(false) { - connect(m_watcher, SIGNAL(directoriesChanged(QStringList)), this, SLOT(directoriesChanged(QStringList))); + connect(m_watcher, &Watcher::directoriesChanged, this, &LiveHubEngine::directoriesChanged); } /*! diff --git a/src/livenodeengine.cpp b/src/livenodeengine.cpp index 44f6f00..faecf00 100644 --- a/src/livenodeengine.cpp +++ b/src/livenodeengine.cpp @@ -163,7 +163,7 @@ LiveNodeEngine::LiveNodeEngine(QObject *parent) { m_delayReload->setInterval(250); m_delayReload->setSingleShot(true); - connect(m_delayReload, SIGNAL(timeout()), this, SLOT(reloadDocument())); + connect(m_delayReload, &QTimer::timeout, this, &LiveNodeEngine::reloadDocument); } /*! diff --git a/src/logreceiver.cpp b/src/logreceiver.cpp index 5e3aaba..7cec063 100644 --- a/src/logreceiver.cpp +++ b/src/logreceiver.cpp @@ -50,7 +50,7 @@ LogReceiver::LogReceiver(QObject *parent) : m_socket(new QUdpSocket(this)) { setPort(45454); - connect(m_socket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams())); + connect(m_socket, &QAbstractSocket::readyRead, this, &LogReceiver::processPendingDatagrams); } /*! diff --git a/src/previewGenerator/main.cpp b/src/previewGenerator/main.cpp index 3ef884c..8e8db68 100644 --- a/src/previewGenerator/main.cpp +++ b/src/previewGenerator/main.cpp @@ -54,7 +54,7 @@ public: PreviewServer() : m_server(new QLocalServer()) { - connect(m_server, SIGNAL(newConnection()), this, SLOT(onNewConnection())); + connect(m_server, &QLocalServer::newConnection, this, &PreviewServer::onNewConnection); } bool listen() diff --git a/src/remotelogger.cpp b/src/remotelogger.cpp index 8aaec69..57a9ace 100644 --- a/src/remotelogger.cpp +++ b/src/remotelogger.cpp @@ -48,7 +48,7 @@ RemoteLogger::RemoteLogger(QObject *parent) : m_socket(new QUdpSocket(this)) , m_port(45454) { - connect(this, SIGNAL(message(int,QString)), this, SLOT(broadcast(int,QString))); + connect(this, &Logger::message, this, &RemoteLogger::broadcast); } /*! diff --git a/src/remotepublisher.cpp b/src/remotepublisher.cpp index 7bba61d..ca24924 100644 --- a/src/remotepublisher.cpp +++ b/src/remotepublisher.cpp @@ -58,19 +58,16 @@ RemotePublisher::RemotePublisher(QObject *parent) , m_ipc(new IpcClient(this)) , m_hub(0) { - connect(m_ipc, SIGNAL(sentSuccessfully(QUuid)), this, SIGNAL(sentSuccessfully(QUuid))); - connect(m_ipc, SIGNAL(sendingError(QUuid,QAbstractSocket::SocketError)), - this, SIGNAL(sendingError(QUuid,QAbstractSocket::SocketError))); - connect(m_ipc, SIGNAL(connectionError(QAbstractSocket::SocketError)), - this, SIGNAL(connectionError(QAbstractSocket::SocketError))); - connect(m_ipc, SIGNAL(connected()), this, SIGNAL(connected())); - connect(m_ipc, SIGNAL(disconnected()), this, SIGNAL(disconnected())); - - connect(m_ipc, SIGNAL(received(QString,QByteArray)), this, SLOT(handleCall(QString,QByteArray))); - - connect(m_ipc, SIGNAL(sentSuccessfully(QUuid)), this, SLOT(onSentSuccessfully(QUuid))); - connect(m_ipc, SIGNAL(sendingError(QUuid,QAbstractSocket::SocketError)), - this, SLOT(onSendingError(QUuid,QAbstractSocket::SocketError))); + connect(m_ipc, &IpcClient::sentSuccessfully, this, &RemotePublisher::sentSuccessfully); + connect(m_ipc, &IpcClient::sendingError, this, &RemotePublisher::sendingError); + connect(m_ipc, &IpcClient::connectionError, this, &RemotePublisher::connectionError); + connect(m_ipc, &IpcClient::connected, this, &RemotePublisher::connected); + connect(m_ipc, &IpcClient::disconnected, this, &RemotePublisher::disconnected); + + connect(m_ipc, &IpcClient::received, this, &RemotePublisher::handleCall); + + connect(m_ipc, &IpcClient::sentSuccessfully, this, &RemotePublisher::onSentSuccessfully); + connect(m_ipc, &IpcClient::sendingError, this, &RemotePublisher::onSendingError); } /*! @@ -92,12 +89,12 @@ void RemotePublisher::registerHub(LiveHubEngine *hub) disconnect(m_hub); } m_hub = hub; - connect(hub, SIGNAL(activateDocument(LiveDocument)), this, SLOT(activateDocument(LiveDocument))); - connect(hub, SIGNAL(fileChanged(LiveDocument)), this, SLOT(sendDocument(LiveDocument))); - connect(hub, SIGNAL(publishFile(LiveDocument)), this, SLOT(sendDocument(LiveDocument))); - connect(this, SIGNAL(needsPublishWorkspace()), hub, SLOT(publishWorkspace())); - connect(hub, SIGNAL(beginPublishWorkspace()), this, SLOT(beginBulkSend())); - connect(hub, SIGNAL(endPublishWorkspace()), this, SLOT(endBulkSend())); + connect(hub, &LiveHubEngine::activateDocument, this, &RemotePublisher::activateDocument); + connect(hub, &LiveHubEngine::fileChanged, this, &RemotePublisher::sendDocument); + connect(hub, &LiveHubEngine::publishFile, this, &RemotePublisher::sendDocument); + connect(this, &RemotePublisher::needsPublishWorkspace, hub, &LiveHubEngine::publishWorkspace); + connect(hub, &LiveHubEngine::beginPublishWorkspace, this, &RemotePublisher::beginBulkSend); + connect(hub, &LiveHubEngine::endPublishWorkspace, this, &RemotePublisher::endBulkSend); } /*! diff --git a/src/remotereceiver.cpp b/src/remotereceiver.cpp index 4d57caf..98cdaab 100644 --- a/src/remotereceiver.cpp +++ b/src/remotereceiver.cpp @@ -84,10 +84,14 @@ RemoteReceiver::RemoteReceiver(QObject *parent) , m_updateDocumentsOnConnectState(UpdateNotStarted) , m_logSentPosition(0) { - connect(m_server, SIGNAL(received(QString,QByteArray)), this, SLOT(handleCall(QString,QByteArray))); - connect(m_server, SIGNAL(clientConnected(QTcpSocket*)), this, SLOT(onClientConnected(QTcpSocket*))); - connect(m_server, SIGNAL(clientConnected(QHostAddress)), this, SIGNAL(clientConnected(QHostAddress))); - connect(m_server, SIGNAL(clientDisconnected(QHostAddress)), this, SIGNAL(clientDisconnected(QHostAddress))); + void (IpcServer::*IpcServer__clientConnected_socket)(QTcpSocket*) = &IpcServer::clientConnected; + void (IpcServer::*IpcServer__clientConnected_address)(const QHostAddress &) = &IpcServer::clientConnected; + void (IpcServer::*IpcServer__clientDisconnected_address)(const QHostAddress &) = &IpcServer::clientDisconnected; + + connect(m_server, &IpcServer::received, this, &RemoteReceiver::handleCall); + connect(m_server, IpcServer__clientConnected_socket, this, &RemoteReceiver::onClientConnected); + connect(m_server, IpcServer__clientConnected_address, this, &RemoteReceiver::clientConnected); + connect(m_server, IpcServer__clientDisconnected_address, this, &RemoteReceiver::clientDisconnected); } /*! @@ -249,14 +253,14 @@ void RemoteReceiver::registerNode(LiveNodeEngine *node) { if (m_node) { disconnect(m_node); } m_node = node; - connect(m_node, SIGNAL(logErrors(QList<QQmlError>)), this, SLOT(appendToLog(QList<QQmlError>))); - connect(m_node, SIGNAL(clearLog()), this, SLOT(clearLog())); - connect(m_node, SIGNAL(activeDocumentChanged(LiveDocument)), this, SLOT(onActiveDocumentChanged(LiveDocument))); - connect(this, SIGNAL(activateDocument(LiveDocument)), m_node, SLOT(loadDocument(LiveDocument))); - connect(this, SIGNAL(updateDocument(LiveDocument,QByteArray)), m_node, SLOT(updateDocument(LiveDocument,QByteArray))); - connect(this, SIGNAL(xOffsetChanged(int)), m_node, SLOT(setXOffset(int))); - connect(this, SIGNAL(yOffsetChanged(int)), m_node, SLOT(setYOffset(int))); - connect(this, SIGNAL(rotationChanged(int)), m_node, SLOT(setRotation(int))); + connect(m_node, &LiveNodeEngine::logErrors, this, &RemoteReceiver::appendToLog); + connect(m_node, &LiveNodeEngine::clearLog, this, &RemoteReceiver::clearLog); + connect(m_node, &LiveNodeEngine::activeDocumentChanged, this, &RemoteReceiver::onActiveDocumentChanged); + connect(this, &RemoteReceiver::activateDocument, m_node, &LiveNodeEngine::loadDocument); + connect(this, &RemoteReceiver::updateDocument, m_node, &LiveNodeEngine::updateDocument); + connect(this, &RemoteReceiver::xOffsetChanged, m_node, &LiveNodeEngine::setXOffset); + connect(this, &RemoteReceiver::yOffsetChanged, m_node, &LiveNodeEngine::setYOffset); + connect(this, &RemoteReceiver::rotationChanged, m_node, &LiveNodeEngine::setRotation); } /*! diff --git a/src/watcher.cpp b/src/watcher.cpp index 37f625f..2be3abb 100644 --- a/src/watcher.cpp +++ b/src/watcher.cpp @@ -48,8 +48,8 @@ Watcher::Watcher(QObject *parent) , m_watcher(new QFileSystemWatcher(this)) , m_waitTimer(new QTimer(this)) { - connect(m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(recordChange(QString))); - connect(m_waitTimer, SIGNAL(timeout()), this, SLOT(notifyChanges())); + connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &Watcher::recordChange); + connect(m_waitTimer, &QTimer::timeout, this, &Watcher::notifyChanges); m_waitTimer->setInterval(100); m_waitTimer->setSingleShot(true); } diff --git a/src/widgets/logview.cpp b/src/widgets/logview.cpp index 2117921..f291faf 100644 --- a/src/widgets/logview.cpp +++ b/src/widgets/logview.cpp @@ -47,7 +47,7 @@ LogView::LogView(bool createLogger, QWidget *parent) if (createLogger) { m_logger = new Logger(this); - connect(m_logger, SIGNAL(message(int,QString)), this, SLOT(appendToLog(int,QString))); + connect(m_logger, &Logger::message, this, &LogView::appendToLog); } } @@ -104,7 +104,7 @@ void LogView::appendToLog(int type, const QString &msg, const QUrl &url, int lin m_log->appendHtml(s); } -void LogView::appendToLog(const QList<QQmlError> &errors) +void LogView::appendAllToLog(const QList<QQmlError> &errors) { foreach (const QQmlError &err, errors) { if (!err.isValid()) diff --git a/src/widgets/logview.h b/src/widgets/logview.h index 7ecdd7f..7d1874a 100644 --- a/src/widgets/logview.h +++ b/src/widgets/logview.h @@ -53,7 +53,7 @@ public slots: void setIgnoreMessages(bool ignoreMessages); void clear(); void appendToLog(int type, const QString &msg, const QUrl &url = QUrl(), int line = -1, int column = -1); - void appendToLog(const QList<QQmlError> &errors); + void appendAllToLog(const QList<QQmlError> &errors); private: QPlainTextEdit *m_log; diff --git a/src/widgets/workspaceview.cpp b/src/widgets/workspaceview.cpp index acc125f..a1f26f8 100644 --- a/src/widgets/workspaceview.cpp +++ b/src/widgets/workspaceview.cpp @@ -66,7 +66,7 @@ WorkspaceView::WorkspaceView(QWidget *parent) m_view->setPalette(noHighlightPalette); m_view->setItemDelegate(new WorkspaceDelegate(this)); - connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(indexActivated(QModelIndex))); + connect(m_view, &QTreeView::activated, this, &WorkspaceView::indexActivated); m_model->setAllowedTypesFilter(QStringList() << "*.qml" << "*.png" << "*.otf" << "*.ttf"); diff --git a/tests/testipc/tst_testipc.cpp b/tests/testipc/tst_testipc.cpp index f73d37a..197b4d2 100644 --- a/tests/testipc/tst_testipc.cpp +++ b/tests/testipc/tst_testipc.cpp @@ -60,21 +60,21 @@ private Q_SLOTS: void call() { IpcServer peer1; peer1.listen(10234); - connect(&peer1, SIGNAL(received(QString,QByteArray)), this, SLOT(handleCall(QString,QByteArray))); + connect(&peer1, &IpcServer::received, this, &TestIpc::handleCall); IpcClient peer2; peer2.connectToServer("127.0.0.1", 10234); QByteArray bytes; QDataStream stream(&bytes, QIODevice::ReadWrite); stream << QString("Hello IPC!"); peer2.send("echo(QString)", bytes); - QSignalSpy received(&peer1, SIGNAL(received(QString,QByteArray))); + QSignalSpy received(&peer1, &IpcServer::received); QTRY_COMPARE(received.count(), 1); } void sendFile() { IpcServer peer1; peer1.listen(10234); - connect(&peer1, SIGNAL(received(QString,QByteArray)), this, SLOT(handleCall(QString,QByteArray))); + connect(&peer1, &IpcServer::received, this, &TestIpc::handleCall); IpcClient peer2; peer2.connectToServer("127.0.0.1", 10234); QByteArray bytes; @@ -83,7 +83,7 @@ private Q_SLOTS: stream << filePath; stream << QString("hello").toLatin1(); peer2.send("sendFile(QString,QByteArray)", bytes); - QSignalSpy received(&peer1, SIGNAL(received(QString,QByteArray))); + QSignalSpy received(&peer1, &IpcServer::received); QTRY_COMPARE(received.count(), 1); } }; |