YACReaderLibrary: Convert a bunch of widgets/dialogs to new slot syntax

This commit is contained in:
Felix Kauselmann 2021-06-22 12:37:27 +02:00
parent 79d004c42b
commit f1e4396dc5
4 changed files with 18 additions and 15 deletions

View File

@ -59,14 +59,14 @@ YACReaderActivityIndicatorWidget::YACReaderActivityIndicatorWidget(QWidget *pare
auto effect = new QGraphicsOpacityEffect(); auto effect = new QGraphicsOpacityEffect();
//effect->setOpacity(1.0); //effect->setOpacity(1.0);
QPropertyAnimation *animation = new QPropertyAnimation(effect, "opacity"); auto *animation = new QPropertyAnimation(effect, "opacity", this);
animation->setDuration(1000); animation->setDuration(1000);
animation->setStartValue(1); animation->setStartValue(1);
animation->setEndValue(0); animation->setEndValue(0);
//animation->setEasingCurve(QEasingCurve::InQuint); //animation->setEasingCurve(QEasingCurve::InQuint);
QPropertyAnimation *animation2 = new QPropertyAnimation(effect, "opacity"); auto *animation2 = new QPropertyAnimation(effect, "opacity", this);
animation2->setDuration(1000); animation2->setDuration(1000);
animation2->setStartValue(0); animation2->setStartValue(0);
@ -75,8 +75,8 @@ YACReaderActivityIndicatorWidget::YACReaderActivityIndicatorWidget(QWidget *pare
glow->setGraphicsEffect(effect); glow->setGraphicsEffect(effect);
connect(animation, SIGNAL(finished()), animation2, SLOT(start())); connect(animation, &QPropertyAnimation::finished, animation2, [=] { animation2->start(); });
connect(animation2, SIGNAL(finished()), animation, SLOT(start())); connect(animation2, &QPropertyAnimation::finished, animation, [=] { animation->start(); });
animation->start(); animation->start();
} }

View File

@ -1067,13 +1067,13 @@ void LibraryWindow::createConnections()
//connect(foldersView, SIGNAL(clicked(QModelIndex)), historyController, SLOT(updateHistory(QModelIndex))); //connect(foldersView, SIGNAL(clicked(QModelIndex)), historyController, SLOT(updateHistory(QModelIndex)));
//libraryCreator connections //libraryCreator connections
connect(createLibraryDialog, SIGNAL(createLibrary(QString, QString, QString)), this, SLOT(create(QString, QString, QString))); connect(createLibraryDialog, &CreateLibraryDialog::createLibrary, this, QOverload<QString, QString, QString>::of(&LibraryWindow::create));
connect(createLibraryDialog, &CreateLibraryDialog::libraryExists, this, &LibraryWindow::libraryAlreadyExists); connect(createLibraryDialog, &CreateLibraryDialog::libraryExists, this, &LibraryWindow::libraryAlreadyExists);
connect(importComicsInfoDialog, &QDialog::finished, this, &LibraryWindow::reloadCurrentLibrary); connect(importComicsInfoDialog, &QDialog::finished, this, &LibraryWindow::reloadCurrentLibrary);
//connect(libraryCreator,SIGNAL(coverExtracted(QString)),createLibraryDialog,SLOT(showCurrentFile(QString))); //connect(libraryCreator,SIGNAL(coverExtracted(QString)),createLibraryDialog,SLOT(showCurrentFile(QString)));
//connect(libraryCreator,SIGNAL(coverExtracted(QString)),updateLibraryDialog,SLOT(showCurrentFile(QString))); //connect(libraryCreator,SIGNAL(coverExtracted(QString)),updateLibraryDialog,SLOT(showCurrentFile(QString)));
connect(libraryCreator, SIGNAL(finished()), this, SLOT(showRootWidget())); connect(libraryCreator, &LibraryCreator::finished, this, &LibraryWindow::showRootWidget);
connect(libraryCreator, &LibraryCreator::updated, this, &LibraryWindow::reloadCurrentLibrary); connect(libraryCreator, &LibraryCreator::updated, this, &LibraryWindow::reloadCurrentLibrary);
connect(libraryCreator, &LibraryCreator::created, this, &LibraryWindow::openLastCreated); connect(libraryCreator, &LibraryCreator::created, this, &LibraryWindow::openLastCreated);
//connect(libraryCreator,SIGNAL(updatedCurrentFolder()), this, SLOT(showRootWidget())); //connect(libraryCreator,SIGNAL(updatedCurrentFolder()), this, SLOT(showRootWidget()));
@ -1089,7 +1089,7 @@ void LibraryWindow::createConnections()
//packageManager connections //packageManager connections
connect(exportLibraryDialog, &ExportLibraryDialog::exportPath, this, &LibraryWindow::exportLibrary); connect(exportLibraryDialog, &ExportLibraryDialog::exportPath, this, &LibraryWindow::exportLibrary);
connect(exportLibraryDialog, &QDialog::rejected, packageManager, &PackageManager::cancel); connect(exportLibraryDialog, &QDialog::rejected, packageManager, &PackageManager::cancel);
connect(packageManager, SIGNAL(exported()), exportLibraryDialog, SLOT(close())); connect(packageManager, &PackageManager::exported, exportLibraryDialog, &ExportLibraryDialog::close);
connect(importLibraryDialog, &ImportLibraryDialog::unpackCLC, this, &LibraryWindow::importLibrary); connect(importLibraryDialog, &ImportLibraryDialog::unpackCLC, this, &LibraryWindow::importLibrary);
connect(importLibraryDialog, &QDialog::rejected, packageManager, &PackageManager::cancel); connect(importLibraryDialog, &QDialog::rejected, packageManager, &PackageManager::cancel);
connect(importLibraryDialog, &QDialog::rejected, this, &LibraryWindow::deleteCurrentLibrary); connect(importLibraryDialog, &QDialog::rejected, this, &LibraryWindow::deleteCurrentLibrary);
@ -1114,13 +1114,15 @@ void LibraryWindow::createConnections()
//connect(foldersView, SIGNAL(clicked(QModelIndex)), this, SLOT(loadCovers(QModelIndex))); //connect(foldersView, SIGNAL(clicked(QModelIndex)), this, SLOT(loadCovers(QModelIndex)));
//drops in folders view //drops in folders view
connect(foldersView, SIGNAL(copyComicsToFolder(QList<QPair<QString, QString>>, QModelIndex)), this, SLOT(copyAndImportComicsToFolder(QList<QPair<QString, QString>>, QModelIndex))); connect(foldersView, QOverload<QList<QPair<QString, QString>>, QModelIndex>::of(&YACReaderFoldersView::copyComicsToFolder),
connect(foldersView, SIGNAL(moveComicsToFolder(QList<QPair<QString, QString>>, QModelIndex)), this, SLOT(moveAndImportComicsToFolder(QList<QPair<QString, QString>>, QModelIndex))); this, &LibraryWindow::copyAndImportComicsToFolder);
connect(foldersView, QOverload<QList<QPair<QString, QString>>, QModelIndex>::of(&YACReaderFoldersView::moveComicsToFolder),
this, &LibraryWindow::moveAndImportComicsToFolder);
connect(foldersView, &QWidget::customContextMenuRequested, this, &LibraryWindow::showFoldersContextMenu); connect(foldersView, &QWidget::customContextMenuRequested, this, &LibraryWindow::showFoldersContextMenu);
//actions //actions
connect(createLibraryAction, &QAction::triggered, this, &LibraryWindow::createLibrary); connect(createLibraryAction, &QAction::triggered, this, &LibraryWindow::createLibrary);
connect(exportLibraryAction, &QAction::triggered, exportLibraryDialog, &QDialog::open); connect(exportLibraryAction, &QAction::triggered, exportLibraryDialog, &ExportLibraryDialog::open);
connect(importLibraryAction, &QAction::triggered, this, &LibraryWindow::importLibraryPackage); connect(importLibraryAction, &QAction::triggered, this, &LibraryWindow::importLibraryPackage);
connect(openLibraryAction, &QAction::triggered, this, &LibraryWindow::showAddLibrary); connect(openLibraryAction, &QAction::triggered, this, &LibraryWindow::showAddLibrary);
@ -1217,9 +1219,9 @@ void LibraryWindow::createConnections()
connect(addLabelAction, &QAction::triggered, this, &LibraryWindow::showAddNewLabelDialog); connect(addLabelAction, &QAction::triggered, this, &LibraryWindow::showAddNewLabelDialog);
connect(renameListAction, &QAction::triggered, this, &LibraryWindow::showRenameCurrentList); connect(renameListAction, &QAction::triggered, this, &LibraryWindow::showRenameCurrentList);
connect(listsModel, SIGNAL(addComicsToFavorites(QList<qulonglong>)), comicsModel, SLOT(addComicsToFavorites(QList<qulonglong>))); connect(listsModel, &ReadingListModel::addComicsToFavorites, comicsModel, QOverload<const QList<qulonglong> &>::of(&ComicModel::addComicsToFavorites));
connect(listsModel, SIGNAL(addComicsToLabel(QList<qulonglong>, qulonglong)), comicsModel, SLOT(addComicsToLabel(QList<qulonglong>, qulonglong))); connect(listsModel, &ReadingListModel::addComicsToLabel, comicsModel, QOverload<const QList<qulonglong> &, qulonglong>::of(&ComicModel::addComicsToLabel));
connect(listsModel, SIGNAL(addComicsToReadingList(QList<qulonglong>, qulonglong)), comicsModel, SLOT(addComicsToReadingList(QList<qulonglong>, qulonglong))); connect(listsModel, &ReadingListModel::addComicsToReadingList, comicsModel, QOverload<const QList<qulonglong> &, qulonglong>::of(&ComicModel::addComicsToReadingList));
//-- //--
connect(addToFavoritesAction, &QAction::triggered, this, &LibraryWindow::addSelectedComicsToFavorites); connect(addToFavoritesAction, &QAction::triggered, this, &LibraryWindow::addSelectedComicsToFavorites);

View File

@ -13,8 +13,9 @@ void PackageManager::createPackage(const QString &libraryPath, const QString &de
<< "-y" << "-y"
<< "-ttar" << dest + ".clc" << libraryPath; << "-ttar" << dest + ".clc" << libraryPath;
_7z = new QProcess(); _7z = new QProcess();
//TODO: Missing slot for openingError!!!
connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError))); connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError)));
connect(_7z, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(exported())); connect(_7z, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &PackageManager::exported);
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MAC
_7z->start("7z", attributes); //TODO: use 7z.so _7z->start("7z", attributes); //TODO: use 7z.so
#else #else

View File

@ -117,7 +117,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent)
portLabel->setStyleSheet("QLabel {color:#575757; font-size:18px; font-family: Arial;}"); portLabel->setStyleSheet("QLabel {color:#575757; font-size:18px; font-family: Arial;}");
ip = new QComboBox(this); ip = new QComboBox(this);
connect(ip, SIGNAL(activated(const QString &)), this, SLOT(regenerateQR(const QString &))); connect(ip, QOverload<const QString &>::of(&QComboBox::activated), this, &ServerConfigDialog::regenerateQR);
ip->setFixedWidth(200); ip->setFixedWidth(200);
ip->move(332, 153); ip->move(332, 153);