Clazy: Use fixits to refactor some old style signal connections

This commit is contained in:
Felix Kauselmann
2021-06-01 18:14:24 +02:00
parent ca81b5424a
commit 8377de7c3e
49 changed files with 371 additions and 367 deletions

View File

@ -69,7 +69,7 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
cancel = new QPushButton(tr("Close"));
cancel->setFlat(true);
connect(cancel, SIGNAL(clicked()), this, SLOT(hide()));
connect(cancel, &QAbstractButton::clicked, this, &QWidget::hide);
buttons->addStretch();
buttons->addWidget(cancel);

View File

@ -21,9 +21,9 @@ void GoToDialog::setupUI()
textLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
accept = new QPushButton(tr("Go To"));
connect(accept, SIGNAL(clicked()), this, SLOT(goTo()));
connect(accept, &QAbstractButton::clicked, this, &GoToDialog::goTo);
cancel = new QPushButton(tr("Cancel"));
connect(cancel, SIGNAL(clicked()), this, SLOT(close()));
connect(cancel, &QAbstractButton::clicked, this, &QWidget::close);
auto topLayout = new QHBoxLayout;

View File

@ -29,7 +29,7 @@ GoToFlow::GoToFlow(QWidget *parent, FlowType flowType)
: GoToFlowWidget(parent), ready(false)
{
updateTimer = new QTimer;
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
connect(updateTimer, &QTimer::timeout, this, &GoToFlow::updateImageData);
worker = new PageLoader(&mutexGoToFlow);
@ -38,13 +38,13 @@ GoToFlow::GoToFlow(QWidget *parent, FlowType flowType)
imageSize = Configuration::getConfiguration().getGotoSlideSize();
flow->setSlideSize(imageSize);
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(setPageNumber(int)));
connect(flow, SIGNAL(selected(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
connect(flow, &PictureFlow::centerIndexChanged, this, &GoToFlowWidget::setPageNumber);
connect(flow, &YACReaderFlow::selected, this, &GoToFlow::goToPage);
connect(flow, &PictureFlow::centerIndexChanged, this, &GoToFlow::preload);
connect(flow, &PictureFlow::centerIndexChangedSilent, this, &GoToFlow::preload);
connect(toolBar, SIGNAL(goTo(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
connect(toolBar, SIGNAL(setCenter(unsigned int)), flow, SLOT(showSlide(unsigned int)));
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &PictureFlow::showSlide);
mainLayout->addWidget(flow);
toolBar->raise();

View File

@ -21,11 +21,11 @@ GoToFlowGL::GoToFlowGL(QWidget *parent, FlowType flowType)
imageSize = Configuration::getConfiguration().getGotoSlideSize();
flow->setSlideSize(imageSize);
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(setPageNumber(int)));
connect(flow, SIGNAL(selected(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
connect(flow, &YACReaderFlowGL::centerIndexChanged, this, &GoToFlowWidget::setPageNumber);
connect(flow, &YACReaderFlowGL::selected, this, &GoToFlowGL::goToPage);
connect(toolBar, SIGNAL(goTo(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
connect(toolBar, SIGNAL(setCenter(unsigned int)), flow, SLOT(setCenterIndex(unsigned int)));
connect(toolBar, &GoToFlowToolBar::setCenter, flow, &YACReaderFlowGL::setCenterIndex);
mainLayout->addWidget(flow);
toolBar->raise();

View File

@ -57,7 +57,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
centerButton->setStyleSheet(centerButtonCSS);
centerButton->setFixedSize(26, 50);
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
connect(centerButton, SIGNAL(clicked()), this, SLOT(centerSlide()));
connect(centerButton, &QAbstractButton::clicked, this, &GoToFlowToolBar::centerSlide);
QString goToButtonCSS = "QPushButton {background-image: url(:/images/imgGoToSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
"QPushButton:focus { border: none; outline: none;}"

View File

@ -139,11 +139,11 @@ void MainWindowViewer::setupUI()
//setUnifiedTitleAndToolBarOnMac(true);
viewer = new Viewer(this);
connect(viewer, SIGNAL(reset()), this, SLOT(processReset()));
connect(viewer, &Viewer::reset, this, &MainWindowViewer::processReset);
//detected end of comic
connect(viewer, SIGNAL(openNextComic()), this, SLOT(openNextComic()));
connect(viewer, &Viewer::openNextComic, this, &MainWindowViewer::openNextComic);
//detected start of comic
connect(viewer, SIGNAL(openPreviousComic()), this, SLOT(openPreviousComic()));
connect(viewer, &Viewer::openPreviousComic, this, &MainWindowViewer::openPreviousComic);
setCentralWidget(viewer);
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
@ -163,15 +163,15 @@ void MainWindowViewer::setupUI()
had->loadHelp(":/files/helpYACReader.html");
optionsDialog = new OptionsDialog(this);
connect(optionsDialog, SIGNAL(accepted()), viewer, SLOT(updateOptions()));
connect(optionsDialog, SIGNAL(optionsChanged()), this, SLOT(reloadOptions()));
connect(optionsDialog, SIGNAL(changedFilters(int, int, int)), viewer, SLOT(updateFilters(int, int, int)));
connect(optionsDialog, &QDialog::accepted, viewer, &Viewer::updateOptions);
connect(optionsDialog, &YACReaderOptionsDialog::optionsChanged, this, &MainWindowViewer::reloadOptions);
connect(optionsDialog, &OptionsDialog::changedFilters, viewer, &Viewer::updateFilters);
connect(optionsDialog, &OptionsDialog::changedImageOptions, viewer, &Viewer::updatePage);
optionsDialog->restoreOptions(settings);
//shortcutsDialog = new ShortcutsDialog(this);
editShortcutsDialog = new EditShortcutsDialog(this);
connect(optionsDialog, SIGNAL(editShortcuts()), editShortcutsDialog, SLOT(show()));
connect(optionsDialog, &YACReaderOptionsDialog::editShortcuts, editShortcutsDialog, &QWidget::show);
createActions();
setUpShortcutsManagement();
@ -240,13 +240,13 @@ void MainWindowViewer::createActions()
openFolderAction->setToolTip(tr("Open image folder"));
openFolderAction->setData(OPEN_FOLDER_ACTION_Y);
openFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_FOLDER_ACTION_Y));
connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openFolder()));
connect(openFolderAction, &QAction::triggered, this, &MainWindowViewer::openFolder);
openLatestComicAction = new QAction(tr("Open latest comic"), this);
openLatestComicAction->setToolTip(tr("Open the latest comic opened in the previous reading session"));
openLatestComicAction->setData(OPEN_LATEST_COMIC_Y);
openLatestComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_LATEST_COMIC_Y));
connect(openLatestComicAction, SIGNAL(triggered()), this, SLOT(openLatestComic()));
connect(openLatestComicAction, &QAction::triggered, this, &MainWindowViewer::openLatestComic);
QAction *recentFileAction = nullptr;
//TODO: Replace limit with a configurable value
@ -267,7 +267,7 @@ void MainWindowViewer::createActions()
saveImageAction->setDisabled(true);
saveImageAction->setData(SAVE_IMAGE_ACTION_Y);
saveImageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SAVE_IMAGE_ACTION_Y));
connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage()));
connect(saveImageAction, &QAction::triggered, this, &MainWindowViewer::saveImage);
openComicOnTheLeftAction = new QAction(tr("Previous Comic"), this);
openComicOnTheLeftAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png"));
@ -292,7 +292,7 @@ void MainWindowViewer::createActions()
goToPageOnTheLeftAction->setDisabled(true);
goToPageOnTheLeftAction->setData(PREV_ACTION_Y);
goToPageOnTheLeftAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y));
connect(goToPageOnTheLeftAction, SIGNAL(triggered()), viewer, SLOT(left()));
connect(goToPageOnTheLeftAction, &QAction::triggered, viewer, &Viewer::left);
goToPageOnTheRightAction = new QAction(tr("&Next"), this);
goToPageOnTheRightAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
@ -301,7 +301,7 @@ void MainWindowViewer::createActions()
goToPageOnTheRightAction->setDisabled(true);
goToPageOnTheRightAction->setData(NEXT_ACTION_Y);
goToPageOnTheRightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y));
connect(goToPageOnTheRightAction, SIGNAL(triggered()), viewer, SLOT(right()));
connect(goToPageOnTheRightAction, &QAction::triggered, viewer, &Viewer::right);
adjustHeightAction = new QAction(tr("Fit Height"), this);
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
@ -312,7 +312,7 @@ void MainWindowViewer::createActions()
adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
adjustHeightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_HEIGHT_ACTION_Y));
adjustHeightAction->setCheckable(true);
connect(adjustHeightAction, SIGNAL(triggered()), this, SLOT(fitToHeight()));
connect(adjustHeightAction, &QAction::triggered, this, &MainWindowViewer::fitToHeight);
adjustWidthAction = new QAction(tr("Fit Width"), this);
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
@ -323,7 +323,7 @@ void MainWindowViewer::createActions()
adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
adjustWidthAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_WIDTH_ACTION_Y));
adjustWidthAction->setCheckable(true);
connect(adjustWidthAction, SIGNAL(triggered()), this, SLOT(fitToWidth()));
connect(adjustWidthAction, &QAction::triggered, this, &MainWindowViewer::fitToWidth);
adjustToFullSizeAction = new QAction(tr("Show full size"), this);
adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
@ -332,7 +332,7 @@ void MainWindowViewer::createActions()
adjustToFullSizeAction->setData(ADJUST_TO_FULL_SIZE_ACTION_Y);
adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y));
adjustToFullSizeAction->setCheckable(true);
connect(adjustToFullSizeAction, SIGNAL(triggered()), this, SLOT(adjustToFullSizeSwitch()));
connect(adjustToFullSizeAction, &QAction::triggered, this, &MainWindowViewer::adjustToFullSizeSwitch);
fitToPageAction = new QAction(tr("Fit to page"), this);
fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/fitToPage.png"));
@ -340,7 +340,7 @@ void MainWindowViewer::createActions()
fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y);
fitToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FIT_TO_PAGE_ACTION_Y));
fitToPageAction->setCheckable(true);
connect(fitToPageAction, SIGNAL(triggered()), this, SLOT(fitToPageSwitch()));
connect(fitToPageAction, &QAction::triggered, this, &MainWindowViewer::fitToPageSwitch);
//fit modes have to be exclusive and checkable
auto fitModes = new QActionGroup(this);
@ -370,7 +370,7 @@ void MainWindowViewer::createActions()
resetZoomAction->setDisabled(true);
resetZoomAction->setData(RESET_ZOOM_ACTION_Y);
resetZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RESET_ZOOM_ACTION_Y));
connect(resetZoomAction, SIGNAL(triggered()), this, SLOT(resetZoomLevel()));
connect(resetZoomAction, &QAction::triggered, this, &MainWindowViewer::resetZoomLevel);
showZoomSliderlAction = new QAction(tr("Show zoom slider"), this);
showZoomSliderlAction->setIcon(QIcon(":/images/viewer_toolbar/zoom.png"));
@ -380,27 +380,27 @@ void MainWindowViewer::createActions()
increasePageZoomAction->setDisabled(true);
increasePageZoomAction->setData(ZOOM_PLUS_ACTION_Y);
increasePageZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_PLUS_ACTION_Y));
connect(increasePageZoomAction, SIGNAL(triggered()), this, SLOT(increasePageZoomLevel()));
connect(increasePageZoomAction, &QAction::triggered, this, &MainWindowViewer::increasePageZoomLevel);
decreasePageZoomAction = new QAction(tr("Zoom-"), this);
decreasePageZoomAction->setDisabled(true);
decreasePageZoomAction->setData(ZOOM_MINUS_ACTION_Y);
decreasePageZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_MINUS_ACTION_Y));
connect(decreasePageZoomAction, SIGNAL(triggered()), this, SLOT(decreasePageZoomLevel()));
connect(decreasePageZoomAction, &QAction::triggered, this, &MainWindowViewer::decreasePageZoomLevel);
leftRotationAction = new QAction(tr("Rotate image to the left"), this);
leftRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateL.png"));
leftRotationAction->setDisabled(true);
leftRotationAction->setData(LEFT_ROTATION_ACTION_Y);
leftRotationAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(LEFT_ROTATION_ACTION_Y));
connect(leftRotationAction, SIGNAL(triggered()), viewer, SLOT(rotateLeft()));
connect(leftRotationAction, &QAction::triggered, viewer, &Viewer::rotateLeft);
rightRotationAction = new QAction(tr("Rotate image to the right"), this);
rightRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateR.png"));
rightRotationAction->setDisabled(true);
rightRotationAction->setData(RIGHT_ROTATION_ACTION_Y);
rightRotationAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RIGHT_ROTATION_ACTION_Y));
connect(rightRotationAction, SIGNAL(triggered()), viewer, SLOT(rotateRight()));
connect(rightRotationAction, &QAction::triggered, viewer, &Viewer::rotateRight);
doublePageAction = new QAction(tr("Double page mode"), this);
doublePageAction->setToolTip(tr("Switch to double page mode"));
@ -410,7 +410,7 @@ void MainWindowViewer::createActions()
doublePageAction->setChecked(Configuration::getConfiguration().getDoublePage());
doublePageAction->setData(DOUBLE_PAGE_ACTION_Y);
doublePageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_PAGE_ACTION_Y));
connect(doublePageAction, SIGNAL(triggered()), viewer, SLOT(doublePageSwitch()));
connect(doublePageAction, &QAction::triggered, viewer, &Viewer::doublePageSwitch);
//inversed pictures mode
doubleMangaPageAction = new QAction(tr("Double page manga mode"), this);
@ -421,7 +421,7 @@ void MainWindowViewer::createActions()
doubleMangaPageAction->setChecked(Configuration::getConfiguration().getDoubleMangaPage());
doubleMangaPageAction->setData(DOUBLE_MANGA_PAGE_ACTION_Y);
doubleMangaPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_MANGA_PAGE_ACTION_Y));
connect(doubleMangaPageAction, SIGNAL(triggered()), viewer, SLOT(doubleMangaPageSwitch()));
connect(doubleMangaPageAction, &QAction::triggered, viewer, &Viewer::doubleMangaPageSwitch);
connect(doubleMangaPageAction, &QAction::triggered, this, &MainWindowViewer::doubleMangaPageSwitch);
goToPageAction = new QAction(tr("Go To"), this);
@ -430,7 +430,7 @@ void MainWindowViewer::createActions()
goToPageAction->setToolTip(tr("Go to page ..."));
goToPageAction->setData(GO_TO_PAGE_ACTION_Y);
goToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_PAGE_ACTION_Y));
connect(goToPageAction, SIGNAL(triggered()), viewer, SLOT(showGoToDialog()));
connect(goToPageAction, &QAction::triggered, viewer, &Viewer::showGoToDialog);
optionsAction = new QAction(tr("Options"), this);
optionsAction->setToolTip(tr("YACReader options"));
@ -445,7 +445,7 @@ void MainWindowViewer::createActions()
helpAboutAction->setIcon(QIcon(":/images/viewer_toolbar/help.png"));
helpAboutAction->setData(HELP_ABOUT_ACTION_Y);
helpAboutAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(HELP_ABOUT_ACTION_Y));
connect(helpAboutAction, SIGNAL(triggered()), had, SLOT(show()));
connect(helpAboutAction, &QAction::triggered, had, &QWidget::show);
showMagnifyingGlassAction = new QAction(tr("Magnifying glass"), this);
showMagnifyingGlassAction->setToolTip(tr("Switch Magnifying glass"));
@ -454,7 +454,7 @@ void MainWindowViewer::createActions()
showMagnifyingGlassAction->setCheckable(true);
showMagnifyingGlassAction->setData(SHOW_MAGNIFYING_GLASS_ACTION_Y);
showMagnifyingGlassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_MAGNIFYING_GLASS_ACTION_Y));
connect(showMagnifyingGlassAction, SIGNAL(triggered()), viewer, SLOT(magnifyingGlassSwitch()));
connect(showMagnifyingGlassAction, &QAction::triggered, viewer, &Viewer::magnifyingGlassSwitch);
setBookmarkAction = new QAction(tr("Set bookmark"), this);
setBookmarkAction->setToolTip(tr("Set a bookmark on the current page"));
@ -463,9 +463,9 @@ void MainWindowViewer::createActions()
setBookmarkAction->setCheckable(true);
setBookmarkAction->setData(SET_BOOKMARK_ACTION_Y);
setBookmarkAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_BOOKMARK_ACTION_Y));
connect(setBookmarkAction, SIGNAL(triggered(bool)), viewer, SLOT(setBookmark(bool)));
connect(viewer, SIGNAL(pageAvailable(bool)), setBookmarkAction, SLOT(setEnabled(bool)));
connect(viewer, SIGNAL(pageIsBookmark(bool)), setBookmarkAction, SLOT(setChecked(bool)));
connect(setBookmarkAction, &QAction::triggered, viewer, &Viewer::setBookmark);
connect(viewer, &Viewer::pageAvailable, setBookmarkAction, &QAction::setEnabled);
connect(viewer, &Viewer::pageIsBookmark, setBookmarkAction, &QAction::setChecked);
showBookmarksAction = new QAction(tr("Show bookmarks"), this);
showBookmarksAction->setToolTip(tr("Show the bookmarks of the current comic"));
@ -473,27 +473,27 @@ void MainWindowViewer::createActions()
showBookmarksAction->setDisabled(true);
showBookmarksAction->setData(SHOW_BOOKMARKS_ACTION_Y);
showBookmarksAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_BOOKMARKS_ACTION_Y));
connect(showBookmarksAction, SIGNAL(triggered()), viewer->getBookmarksDialog(), SLOT(show()));
connect(showBookmarksAction, &QAction::triggered, viewer->getBookmarksDialog(), &QWidget::show);
showShorcutsAction = new QAction(tr("Show keyboard shortcuts"), this);
showShorcutsAction->setIcon(QIcon(":/images/viewer_toolbar/shortcuts.png"));
showShorcutsAction->setData(SHOW_SHORCUTS_ACTION_Y);
showShorcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_SHORCUTS_ACTION_Y));
//connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
connect(showShorcutsAction, SIGNAL(triggered()), editShortcutsDialog, SLOT(show()));
connect(showShorcutsAction, &QAction::triggered, editShortcutsDialog, &QWidget::show);
showInfoAction = new QAction(tr("Show Info"), this);
showInfoAction->setIcon(QIcon(":/images/viewer_toolbar/info.png"));
showInfoAction->setDisabled(true);
showInfoAction->setData(SHOW_INFO_ACTION_Y);
showInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_INFO_ACTION_Y));
connect(showInfoAction, SIGNAL(triggered()), viewer, SLOT(informationSwitch()));
connect(showInfoAction, &QAction::triggered, viewer, &Viewer::informationSwitch);
closeAction = new QAction(tr("Close"), this);
closeAction->setIcon(QIcon(":/images/viewer_toolbar/close.png"));
closeAction->setData(CLOSE_ACTION_Y);
closeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(CLOSE_ACTION_Y));
connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
connect(closeAction, &QAction::triggered, this, &QWidget::close);
showDictionaryAction = new QAction(tr("Show Dictionary"), this);
showDictionaryAction->setIcon(QIcon(":/images/viewer_toolbar/translator.png"));
@ -501,7 +501,7 @@ void MainWindowViewer::createActions()
showDictionaryAction->setDisabled(true);
showDictionaryAction->setData(SHOW_DICTIONARY_ACTION_Y);
showDictionaryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_DICTIONARY_ACTION_Y));
connect(showDictionaryAction, SIGNAL(triggered()), viewer, SLOT(translatorSwitch()));
connect(showDictionaryAction, &QAction::triggered, viewer, &Viewer::translatorSwitch);
//deprecated
alwaysOnTopAction = new QAction(tr("Always on top"), this);
@ -511,19 +511,19 @@ void MainWindowViewer::createActions()
alwaysOnTopAction->setChecked(Configuration::getConfiguration().getAlwaysOnTop());
alwaysOnTopAction->setData(ALWAYS_ON_TOP_ACTION_Y);
alwaysOnTopAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ALWAYS_ON_TOP_ACTION_Y));
connect(alwaysOnTopAction, SIGNAL(triggered()), this, SLOT(alwaysOnTopSwitch()));
connect(alwaysOnTopAction, &QAction::triggered, this, &MainWindowViewer::alwaysOnTopSwitch);
showFlowAction = new QAction(tr("Show go to flow"), this);
showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png"));
showFlowAction->setDisabled(true);
showFlowAction->setData(SHOW_FLOW_ACTION_Y);
showFlowAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_FLOW_ACTION_Y));
connect(showFlowAction, SIGNAL(triggered()), viewer, SLOT(goToFlowSwitch()));
connect(showFlowAction, &QAction::triggered, viewer, &Viewer::goToFlowSwitch);
showEditShortcutsAction = new QAction(tr("Edit shortcuts"), this);
showEditShortcutsAction->setData(SHOW_EDIT_SHORTCUTS_ACTION_Y);
showEditShortcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_EDIT_SHORTCUTS_ACTION_Y));
connect(showEditShortcutsAction, SIGNAL(triggered()), editShortcutsDialog, SLOT(show()));
connect(showEditShortcutsAction, &QAction::triggered, editShortcutsDialog, &QWidget::show);
}
void MainWindowViewer::createToolBars()
@ -584,9 +584,9 @@ void MainWindowViewer::createToolBars()
comicToolBar->addAction(showZoomSliderlAction);
connect(showZoomSliderlAction, SIGNAL(triggered()), this, SLOT(toggleFitToWidthSlider()));
connect(zoomSliderAction, SIGNAL(zoomRatioChanged(int)), viewer, SLOT(updateZoomRatio(int)));
connect(viewer, SIGNAL(zoomUpdated(int)), zoomSliderAction, SLOT(updateZoomRatio(int)));
connect(showZoomSliderlAction, &QAction::triggered, this, &MainWindowViewer::toggleFitToWidthSlider);
connect(zoomSliderAction, &YACReaderSlider::zoomRatioChanged, viewer, &Viewer::updateZoomRatio);
connect(viewer, &Viewer::zoomUpdated, zoomSliderAction, &YACReaderSlider::updateZoomRatio);
comicToolBar->addAction(leftRotationAction);
comicToolBar->addAction(rightRotationAction);
@ -1217,8 +1217,8 @@ void MainWindowViewer::checkNewVersion()
if (lastCheck.isNull() || lastCheck.daysTo(current) >= conf.getNumDaysBetweenVersionChecks()) {
versionChecker = new HttpVersionChecker();
connect(versionChecker, SIGNAL(newVersionDetected()),
this, SLOT(newVersion()));
connect(versionChecker, &HttpVersionChecker::newVersionDetected,
this, &MainWindowViewer::newVersion);
QTimer::singleShot(100, versionChecker, &HttpVersionChecker::get);

View File

@ -19,7 +19,7 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget *parent)
anim->setEndValue(0.0);
anim->setEasingCurve(QEasingCurve::InExpo);
connect(anim, SIGNAL(finished()), this, SLOT(hide()));
connect(anim, &QAbstractAnimation::finished, this, &QWidget::hide);
textLabel = new QLabel(this);
textLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);

View File

@ -53,7 +53,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"), ""));
pathBox->setLayout(path);
connect(pathFindButton, SIGNAL(clicked()), this, SLOT(findFolder()));
connect(pathFindButton, &QAbstractButton::clicked, this, &OptionsDialog::findFolder);
auto colorSelection = new QHBoxLayout;
backgroundColor = new QLabel();
@ -63,7 +63,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
backgroundColor->setAutoFillBackground(true);
colorDialog = new QColorDialog(Qt::red, this);
connect(colorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(updateColor(QColor)));
connect(colorDialog, &QColorDialog::colorSelected, this, &OptionsDialog::updateColor);
QGroupBox *colorBox = new QGroupBox(tr("Background color"));
//backgroundColor->setMinimumWidth(100);
@ -72,26 +72,26 @@ OptionsDialog::OptionsDialog(QWidget *parent)
colorSelection->setStretchFactor(backgroundColor, 1);
colorSelection->setStretchFactor(selectBackgroundColorButton, 0);
//colorSelection->addStretch();
connect(selectBackgroundColorButton, SIGNAL(clicked()), colorDialog, SLOT(show()));
connect(selectBackgroundColorButton, &QAbstractButton::clicked, colorDialog, &QWidget::show);
colorBox->setLayout(colorSelection);
brightnessS = new YACReaderSpinSliderWidget(this, true);
brightnessS->setRange(0, 100);
//brightnessS->setText(tr("Brightness"));
brightnessS->setTracking(false);
connect(brightnessS, SIGNAL(valueChanged(int)), this, SLOT(brightnessChanged(int)));
connect(brightnessS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::brightnessChanged);
contrastS = new YACReaderSpinSliderWidget(this, true);
contrastS->setRange(0, 250);
//contrastS->setText(tr("Contrast"));
contrastS->setTracking(false);
connect(contrastS, SIGNAL(valueChanged(int)), this, SLOT(contrastChanged(int)));
connect(contrastS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::contrastChanged);
gammaS = new YACReaderSpinSliderWidget(this, true);
gammaS->setRange(0, 250);
//gammaS->setText(tr("Gamma"));
gammaS->setTracking(false);
connect(gammaS, SIGNAL(valueChanged(int)), this, SLOT(gammaChanged(int)));
connect(gammaS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::gammaChanged);
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
quickNavi = new QCheckBox(tr("Quick Navigation Mode"));
@ -126,7 +126,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
layoutImage->addWidget(contrastS, 1, 1);
layoutImage->addWidget(gammaS, 2, 1);
QPushButton *pushButton = new QPushButton(tr("Reset"));
connect(pushButton, SIGNAL(pressed()), this, SLOT(resetImageConfig()));
connect(pushButton, &QAbstractButton::pressed, this, &OptionsDialog::resetImageConfig);
layoutImage->addWidget(pushButton, 3, 0);
layoutImage->setColumnStretch(1, 1);

View File

@ -414,7 +414,7 @@ void Render::render()
//si se ha creado un hilo para renderizar la página actual, se arranca
if (pageRenders[currentPageBufferedIndex] != 0) {
//se conecta la señal pageReady del hilo, con el SLOT prepareAvailablePage
connect(pageRenders[currentPageBufferedIndex], SIGNAL(pageReady(int)), this, SLOT(prepareAvailablePage(int)));
connect(pageRenders[currentPageBufferedIndex], &PageRender::pageReady, this, &Render::prepareAvailablePage);
//se emite la señal de procesando, debido a que los hilos se arrancan aquí
if (filters.size() > 0)
emit processingPage();
@ -712,17 +712,17 @@ void Render::createComic(const QString &path)
connect(comic, SIGNAL(errorOpening()), this, SIGNAL(errorOpening()), Qt::QueuedConnection);
connect(comic, SIGNAL(errorOpening(QString)), this, SIGNAL(errorOpening(QString)), Qt::QueuedConnection);
connect(comic, SIGNAL(crcErrorFound(QString)), this, SIGNAL(crcError(QString)), Qt::QueuedConnection);
connect(comic, &Comic::crcErrorFound, this, &Render::crcError, Qt::QueuedConnection);
connect(comic, SIGNAL(errorOpening()), this, SLOT(reset()), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int)), this, SLOT(pageRawDataReady(int)), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int)), this, SIGNAL(imageLoaded(int)), Qt::QueuedConnection);
connect(comic, SIGNAL(openAt(int)), this, SLOT(renderAt(int)), Qt::QueuedConnection);
connect(comic, &Comic::openAt, this, &Render::renderAt, Qt::QueuedConnection);
connect(comic, SIGNAL(numPages(unsigned int)), this, SIGNAL(numPages(unsigned int)), Qt::QueuedConnection);
connect(comic, SIGNAL(numPages(unsigned int)), this, SLOT(setNumPages(unsigned int)), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int, QByteArray)), this, SIGNAL(imageLoaded(int, QByteArray)), Qt::QueuedConnection);
connect(comic, SIGNAL(isBookmark(bool)), this, SIGNAL(currentPageIsBookmark(bool)), Qt::QueuedConnection);
connect(comic, &Comic::isBookmark, this, &Render::currentPageIsBookmark, Qt::QueuedConnection);
connect(comic, SIGNAL(bookmarksUpdated()), this, SIGNAL(bookmarksUpdated()), Qt::QueuedConnection);
connect(comic, &Comic::bookmarksUpdated, this, &Render::bookmarksUpdated, Qt::QueuedConnection);
//connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast()));
//connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover()));
@ -748,11 +748,11 @@ void Render::startLoad()
connect(comic, SIGNAL(errorOpening()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(imagesLoaded()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, &Comic::imagesLoaded, thread, &QThread::quit, Qt::QueuedConnection);
connect(comic, SIGNAL(destroyed()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(invalidated()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, &Comic::invalidated, thread, &QThread::quit, Qt::QueuedConnection);
connect(thread, SIGNAL(started()), comic, SLOT(process()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
connect(thread, &QThread::finished, thread, &QObject::deleteLater);
if (thread != nullptr)
thread->start();
@ -983,7 +983,7 @@ void Render::fillBuffer()
pagesReady[currentIndex + i]) //preload next pages
{
pageRenders[currentPageBufferedIndex + i] = new PageRender(this, currentIndex + i, comic->getRawData()->at(currentIndex + i), buffer[currentPageBufferedIndex + i], imageRotation, filters);
connect(pageRenders[currentPageBufferedIndex + i], SIGNAL(pageReady(int)), this, SLOT(prepareAvailablePage(int)));
connect(pageRenders[currentPageBufferedIndex + i], &PageRender::pageReady, this, &Render::prepareAvailablePage);
pageRenders[currentPageBufferedIndex + i]->start();
}
@ -994,7 +994,7 @@ void Render::fillBuffer()
pagesReady[currentIndex - i]) //preload previous pages
{
pageRenders[currentPageBufferedIndex - i] = new PageRender(this, currentIndex - i, comic->getRawData()->at(currentIndex - i), buffer[currentPageBufferedIndex - i], imageRotation, filters);
connect(pageRenders[currentPageBufferedIndex - i], SIGNAL(pageReady(int)), this, SLOT(prepareAvailablePage(int)));
connect(pageRenders[currentPageBufferedIndex - i], &PageRender::pageReady, this, &Render::prepareAvailablePage);
pageRenders[currentPageBufferedIndex - i]->start();
}
}

View File

@ -18,7 +18,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget *parent)
auto mainLayout = new QVBoxLayout;
close = new QPushButton(tr("Close"));
connect(close, SIGNAL(clicked()), this, SLOT(close()));
connect(close, &QAbstractButton::clicked, this, &QWidget::close);
auto bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();

View File

@ -157,9 +157,9 @@ YACReaderTranslator::YACReaderTranslator(QWidget *parent)
show();
connect(searchButton, SIGNAL(pressed()), this, SLOT(translate()));
connect(speakButton, SIGNAL(pressed()), this, SLOT(play()));
connect(clearButton, SIGNAL(pressed()), this, SLOT(clear()));
connect(searchButton, &QAbstractButton::pressed, this, &YACReaderTranslator::translate);
connect(speakButton, &QAbstractButton::pressed, this, &YACReaderTranslator::play);
connect(clearButton, &QAbstractButton::pressed, this, &YACReaderTranslator::clear);
//multimedia/phonon
#if QT_VERSION >= 0x050000
@ -191,16 +191,16 @@ void YACReaderTranslator::translate()
QString to = this->to->itemData(this->to->currentIndex()).toString();
TranslationLoader *translationLoader = new TranslationLoader(text, from, to);
connect(translationLoader, SIGNAL(requestFinished(QString)), this, SLOT(setTranslation(QString)));
connect(translationLoader, SIGNAL(error()), this, SLOT(error()));
connect(translationLoader, SIGNAL(timeOut()), this, SLOT(error()));
connect(translationLoader, SIGNAL(finished()), translationLoader, SLOT(deleteLater()));
connect(translationLoader, &TranslationLoader::requestFinished, this, &YACReaderTranslator::setTranslation);
connect(translationLoader, &TranslationLoader::error, this, &YACReaderTranslator::error);
connect(translationLoader, &TranslationLoader::timeOut, this, &YACReaderTranslator::error);
connect(translationLoader, &QThread::finished, translationLoader, &QObject::deleteLater);
TextToSpeachLoader *tts = new TextToSpeachLoader(text, from);
connect(tts, SIGNAL(requestFinished(QUrl)), this, SLOT(setSpeak(QUrl)));
connect(tts, SIGNAL(error()), this, SLOT(error()));
connect(tts, SIGNAL(timeOut()), this, SLOT(error()));
connect(tts, SIGNAL(finished()), tts, SLOT(deleteLater()));
connect(tts, &TextToSpeachLoader::requestFinished, this, &YACReaderTranslator::setSpeak);
connect(tts, &TextToSpeachLoader::error, this, &YACReaderTranslator::error);
connect(tts, &TextToSpeachLoader::timeOut, this, &YACReaderTranslator::error);
connect(tts, &QThread::finished, tts, &QObject::deleteLater);
translationLoader->start();
tts->start();
@ -348,8 +348,8 @@ void TranslationLoader::run()
QTimer tT;
tT.setSingleShot(true);
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
connect(&manager, SIGNAL(finished(QNetworkReply *)), &q, SLOT(quit()));
connect(&tT, &QTimer::timeout, &q, &QEventLoop::quit);
connect(&manager, &QNetworkAccessManager::finished, &q, &QEventLoop::quit);
QString url = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appid=%1&from=%2&to=%3&text=%4&contentType=text/plain";
url = url.arg(APPID).arg(from).arg(to).arg(text);
@ -391,8 +391,8 @@ void TextToSpeachLoader::run()
QTimer tT;
tT.setSingleShot(true);
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
connect(&manager, SIGNAL(finished(QNetworkReply *)), &q, SLOT(quit()));
connect(&tT, &QTimer::timeout, &q, &QEventLoop::quit);
connect(&manager, &QNetworkAccessManager::finished, &q, &QEventLoop::quit);
QString url = "http://api.microsofttranslator.com/V2/Ajax.svc/Speak?appid=%1&language=%2&text=%3&contentType=text/plain";
url = url.arg(APPID).arg(language).arg(text);

View File

@ -115,9 +115,9 @@ Viewer::Viewer(QWidget *parent)
//animations
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
connect(verticalScroller, SIGNAL(valueChanged(const QVariant &)), this, SIGNAL(backgroundChanges()));
connect(verticalScroller, &QVariantAnimation::valueChanged, this, &Viewer::backgroundChanges);
horizontalScroller = new QPropertyAnimation(horizontalScrollBar(), "sliderPosition");
connect(horizontalScroller, SIGNAL(valueChanged(const QVariant &)), this, SIGNAL(backgroundChanges()));
connect(horizontalScroller, &QVariantAnimation::valueChanged, this, &Viewer::backgroundChanges);
groupScroller = new QParallelAnimationGroup();
groupScroller->addAnimation(verticalScroller);
groupScroller->addAnimation(horizontalScroller);
@ -155,41 +155,41 @@ void Viewer::createConnections()
connect(this, SIGNAL(backgroundChanges()), mglass, SLOT(updateImage()));
//goToDialog
connect(goToDialog, SIGNAL(goToPage(unsigned int)), this, SLOT(goTo(unsigned int)));
connect(goToDialog, &GoToDialog::goToPage, this, &Viewer::goTo);
//goToFlow goTo
connect(goToFlow, SIGNAL(goToPage(unsigned int)), this, SLOT(goTo(unsigned int)));
//current time
auto t = new QTimer(this);
connect(t, SIGNAL(timeout()), this, SLOT(updateInformation()));
connect(t, &QTimer::timeout, this, &Viewer::updateInformation);
t->start(1000);
//hide cursor
connect(hideCursorTimer, SIGNAL(timeout()), this, SLOT(hideCursor()));
connect(hideCursorTimer, &QTimer::timeout, this, &Viewer::hideCursor);
//bookmarks
connect(bd, SIGNAL(goToPage(unsigned int)), this, SLOT(goTo(unsigned int)));
connect(bd, &BookmarksDialog::goToPage, this, &Viewer::goTo);
//render
connect(render, SIGNAL(errorOpening()), this, SLOT(resetContent()));
connect(render, SIGNAL(errorOpening()), this, SLOT(showMessageErrorOpening()));
connect(render, SIGNAL(errorOpening(QString)), this, SLOT(showMessageErrorOpening(QString)));
connect(render, SIGNAL(crcError(QString)), this, SLOT(processCRCError(QString)));
connect(render, &Render::crcError, this, &Viewer::processCRCError);
connect(render, SIGNAL(numPages(unsigned int)), goToFlow, SLOT(setNumSlides(unsigned int)));
connect(render, SIGNAL(numPages(unsigned int)), goToDialog, SLOT(setNumPages(unsigned int)));
//connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation()));
connect(render, SIGNAL(imageLoaded(int, QByteArray)), goToFlow, SLOT(setImageReady(int, QByteArray)));
connect(render, SIGNAL(currentPageReady()), this, SLOT(updatePage()));
connect(render, SIGNAL(processingPage()), this, SLOT(setLoadingMessage()));
connect(render, SIGNAL(currentPageIsBookmark(bool)), this, SIGNAL(pageIsBookmark(bool)));
connect(render, SIGNAL(pageChanged(int)), this, SLOT(updateInformation()));
connect(render, &Render::currentPageReady, this, &Viewer::updatePage);
connect(render, &Render::processingPage, this, &Viewer::setLoadingMessage);
connect(render, &Render::currentPageIsBookmark, this, &Viewer::pageIsBookmark);
connect(render, &Render::pageChanged, this, &Viewer::updateInformation);
//connect(render,SIGNAL(bookmarksLoaded(Bookmarks)),this,SLOT(setBookmarks(Bookmarks)));
connect(render, SIGNAL(isLast()), this, SLOT(showIsLastMessage()));
connect(render, SIGNAL(isCover()), this, SLOT(showIsCoverMessage()));
connect(render, &Render::isLast, this, &Viewer::showIsLastMessage);
connect(render, &Render::isCover, this, &Viewer::showIsCoverMessage);
connect(render, SIGNAL(bookmarksUpdated()), this, SLOT(setBookmarks()));
connect(render, &Render::bookmarksUpdated, this, &Viewer::setBookmarks);
}
//Deprecated
@ -841,8 +841,8 @@ void Viewer::showGoToFlow()
void Viewer::animateShowGoToFlow()
{
if (goToFlow->isHidden() && showGoToFlowAnimation->state() != QPropertyAnimation::Running) {
disconnect(showGoToFlowAnimation, SIGNAL(finished()), goToFlow, SLOT(hide()));
connect(showGoToFlowAnimation, SIGNAL(finished()), this, SLOT(moveCursoToGoToFlow()));
disconnect(showGoToFlowAnimation, &QAbstractAnimation::finished, goToFlow, &QWidget::hide);
connect(showGoToFlowAnimation, &QAbstractAnimation::finished, this, &Viewer::moveCursoToGoToFlow);
showGoToFlowAnimation->setStartValue(QPoint((width() - goToFlow->width()) / 2, height() - 10));
showGoToFlowAnimation->setEndValue(QPoint((width() - goToFlow->width()) / 2, height() - goToFlow->height()));
showGoToFlowAnimation->start();
@ -856,8 +856,8 @@ void Viewer::animateShowGoToFlow()
void Viewer::animateHideGoToFlow()
{
if (goToFlow->isVisible() && showGoToFlowAnimation->state() != QPropertyAnimation::Running) {
connect(showGoToFlowAnimation, SIGNAL(finished()), goToFlow, SLOT(hide()));
disconnect(showGoToFlowAnimation, SIGNAL(finished()), this, SLOT(moveCursoToGoToFlow()));
connect(showGoToFlowAnimation, &QAbstractAnimation::finished, goToFlow, &QWidget::hide);
disconnect(showGoToFlowAnimation, &QAbstractAnimation::finished, this, &Viewer::moveCursoToGoToFlow);
showGoToFlowAnimation->setStartValue(QPoint((width() - goToFlow->width()) / 2, height() - goToFlow->height()));
showGoToFlowAnimation->setEndValue(QPoint((width() - goToFlow->width()) / 2, height()));
showGoToFlowAnimation->start();
@ -1018,7 +1018,7 @@ void Viewer::updateBackgroundColor(const QColor &color)
void Viewer::animateShowTranslator()
{
if (translator->isHidden() && translatorAnimation->state() != QPropertyAnimation::Running) {
disconnect(translatorAnimation, SIGNAL(finished()), translator, SLOT(hide()));
disconnect(translatorAnimation, &QAbstractAnimation::finished, translator, &QWidget::hide);
if (translatorXPos == -10000)
translatorXPos = (width() - translator->width()) / 2;
int x = qMax(0, qMin(translatorXPos, width() - translator->width()));
@ -1036,7 +1036,7 @@ void Viewer::animateShowTranslator()
void Viewer::animateHideTranslator()
{
if (translator->isVisible() && translatorAnimation->state() != QPropertyAnimation::Running) {
connect(translatorAnimation, SIGNAL(finished()), translator, SLOT(hide()));
connect(translatorAnimation, &QAbstractAnimation::finished, translator, &QWidget::hide);
translatorAnimation->setStartValue(QPoint(translatorXPos = translator->pos().x(), translator->pos().y()));
if ((translator->width() / 2) + translator->pos().x() <= width() / 2)
translatorAnimation->setEndValue(QPoint(-translator->width(), translator->pos().y()));

View File

@ -11,7 +11,7 @@ YACReaderSliderAction::YACReaderSliderAction(QWidget *parent)
widget = new YACReaderSlider();
setDefaultWidget(widget);
connect(widget, SIGNAL(zoomRatioChanged(int)), this, SIGNAL(zoomRatioChanged(int)));
connect(widget, &YACReaderSlider::zoomRatioChanged, this, &YACReaderSliderAction::zoomRatioChanged);
}
void YACReaderSliderAction::updateText(int value)