From 5b661533903c0da20afca4938dc7686151f00996 Mon Sep 17 00:00:00 2001 From: Felix Kauselmann Date: Tue, 22 Jun 2021 12:28:00 +0200 Subject: [PATCH] YACReader/viewer: Convert a bunch of loosely related signals to new syntax --- YACReader/main_window_viewer.cpp | 4 ++-- YACReader/translator.cpp | 5 +++-- YACReader/translator.h | 3 ++- YACReader/viewer.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index faf0a886..85a98e87 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -213,7 +213,7 @@ void MainWindowViewer::createActions() openAction->setToolTip(tr("Open a comic")); openAction->setData(OPEN_ACTION_Y); openAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_ACTION_Y)); - connect(openAction, SIGNAL(triggered()), this, SLOT(open())); + connect(openAction, &QAction::triggered, this, QOverload<>::of(&MainWindowViewer::open)); #ifdef Q_OS_MAC newInstanceAction = new QAction(tr("New instance"), this); @@ -438,7 +438,7 @@ void MainWindowViewer::createActions() optionsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPTIONS_ACTION_Y)); optionsAction->setIcon(QIcon(":/images/viewer_toolbar/options.png")); - connect(optionsAction, SIGNAL(triggered()), optionsDialog, SLOT(show())); + connect(optionsAction, &QAction::triggered, optionsDialog, &OptionsDialog::show); helpAboutAction = new QAction(tr("Help"), this); helpAboutAction->setToolTip(tr("Help, About YACReader")); diff --git a/YACReader/translator.cpp b/YACReader/translator.cpp index 9929e470..5dbc7df2 100644 --- a/YACReader/translator.cpp +++ b/YACReader/translator.cpp @@ -13,6 +13,7 @@ #include #include #include "translator.h" +#include "viewer.h" #include "yacreader_busy_widget.h" @@ -33,7 +34,7 @@ #define APPID "417CEAD93449502CC3C9B69FED26C54118E62BCC" -YACReaderTranslator::YACReaderTranslator(QWidget *parent) +YACReaderTranslator::YACReaderTranslator(Viewer *parent) : QWidget(parent), drag(false) { QString scrollBarStyle = "QScrollBar:vertical { border: none; background: #404040; width: 7px; margin: 0 3px 0 0; }" @@ -68,7 +69,7 @@ YACReaderTranslator::YACReaderTranslator(QWidget *parent) titleBar->addWidget(close); titleBar->setContentsMargins(0, 0, 0, 0); titleBar->setSpacing(0); - connect(close, SIGNAL(clicked()), this->parent(), SLOT(animateHideTranslator())); + connect(close, &QAbstractButton::clicked, parent, &Viewer::animateHideTranslator); layout->addLayout(titleBar); diff --git a/YACReader/translator.h b/YACReader/translator.h index 0ef17951..189c8fb8 100644 --- a/YACReader/translator.h +++ b/YACReader/translator.h @@ -13,6 +13,7 @@ class YACReaderBusyWidget; #include #include #include +#include "viewer.h" #if QT_VERSION >= 0x050000 class QMediaPlayer; @@ -25,7 +26,7 @@ class YACReaderTranslator : public QWidget { Q_OBJECT public: - YACReaderTranslator(QWidget *parent = nullptr); + YACReaderTranslator(Viewer *parent = nullptr); ~YACReaderTranslator() override; public slots: diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index bc8587a8..c26544ec 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -152,7 +152,7 @@ Viewer::~Viewer() void Viewer::createConnections() { //magnifyingGlass (update mg after a background change - connect(this, SIGNAL(backgroundChanges()), mglass, SLOT(updateImage())); + connect(this, &Viewer::backgroundChanges, mglass, QOverload<>::of(&MagnifyingGlass::updateImage)); //goToDialog connect(goToDialog, &GoToDialog::goToPage, this, &Viewer::goTo);