Refactor files in src/client/tabs to new Qt Slot/Signal syntax (#5833)

* Refactor files in src/client/tabs to new Qt Slot/Signal syntax

* Refactor DeckEditorMenu to use new signal/slot syntax

Add DeckEditorMenu as friend class to AbstractTabDeckEditor since the slots are protected

* fix build failure
This commit is contained in:
RickyRister 2025-04-15 15:05:52 -07:00 committed by GitHub
parent c4d0921a15
commit 686717e544
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 152 additions and 157 deletions

View file

@ -6,10 +6,10 @@
DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), deckEditor(parent) DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), deckEditor(parent)
{ {
aNewDeck = new QAction(QString(), this); aNewDeck = new QAction(QString(), this);
connect(aNewDeck, SIGNAL(triggered()), deckEditor, SLOT(actNewDeck())); connect(aNewDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actNewDeck);
aLoadDeck = new QAction(QString(), this); aLoadDeck = new QAction(QString(), this);
connect(aLoadDeck, SIGNAL(triggered()), deckEditor, SLOT(actLoadDeck())); connect(aLoadDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actLoadDeck);
loadRecentDeckMenu = new QMenu(this); loadRecentDeckMenu = new QMenu(this);
connect(&SettingsCache::instance().recents(), &RecentsSettings::recentlyOpenedDeckPathsChanged, this, connect(&SettingsCache::instance().recents(), &RecentsSettings::recentlyOpenedDeckPathsChanged, this,
@ -21,47 +21,50 @@ DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), d
updateRecentlyOpened(); updateRecentlyOpened();
aSaveDeck = new QAction(QString(), this); aSaveDeck = new QAction(QString(), this);
connect(aSaveDeck, SIGNAL(triggered()), deckEditor, SLOT(actSaveDeck())); connect(aSaveDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actSaveDeck);
aSaveDeckAs = new QAction(QString(), this); aSaveDeckAs = new QAction(QString(), this);
connect(aSaveDeckAs, SIGNAL(triggered()), deckEditor, SLOT(actSaveDeckAs())); connect(aSaveDeckAs, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actSaveDeckAs);
aLoadDeckFromClipboard = new QAction(QString(), this); aLoadDeckFromClipboard = new QAction(QString(), this);
connect(aLoadDeckFromClipboard, SIGNAL(triggered()), deckEditor, SLOT(actLoadDeckFromClipboard())); connect(aLoadDeckFromClipboard, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actLoadDeckFromClipboard);
aEditDeckInClipboard = new QAction(QString(), this); aEditDeckInClipboard = new QAction(QString(), this);
connect(aEditDeckInClipboard, SIGNAL(triggered()), deckEditor, SLOT(actEditDeckInClipboard())); connect(aEditDeckInClipboard, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actEditDeckInClipboard);
aEditDeckInClipboardRaw = new QAction(QString(), this); aEditDeckInClipboardRaw = new QAction(QString(), this);
connect(aEditDeckInClipboardRaw, SIGNAL(triggered()), deckEditor, SLOT(actEditDeckInClipboardRaw())); connect(aEditDeckInClipboardRaw, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actEditDeckInClipboardRaw);
aSaveDeckToClipboard = new QAction(QString(), this); aSaveDeckToClipboard = new QAction(QString(), this);
connect(aSaveDeckToClipboard, SIGNAL(triggered()), deckEditor, SLOT(actSaveDeckToClipboard())); connect(aSaveDeckToClipboard, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actSaveDeckToClipboard);
aSaveDeckToClipboardNoSetInfo = new QAction(QString(), this); aSaveDeckToClipboardNoSetInfo = new QAction(QString(), this);
connect(aSaveDeckToClipboardNoSetInfo, SIGNAL(triggered()), deckEditor, SLOT(actSaveDeckToClipboardNoSetInfo())); connect(aSaveDeckToClipboardNoSetInfo, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actSaveDeckToClipboardNoSetInfo);
aSaveDeckToClipboardRaw = new QAction(QString(), this); aSaveDeckToClipboardRaw = new QAction(QString(), this);
connect(aSaveDeckToClipboardRaw, SIGNAL(triggered()), deckEditor, SLOT(actSaveDeckToClipboardRaw())); connect(aSaveDeckToClipboardRaw, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actSaveDeckToClipboardRaw);
aSaveDeckToClipboardRawNoSetInfo = new QAction(QString(), this); aSaveDeckToClipboardRawNoSetInfo = new QAction(QString(), this);
connect(aSaveDeckToClipboardRawNoSetInfo, SIGNAL(triggered()), deckEditor, connect(aSaveDeckToClipboardRawNoSetInfo, &QAction::triggered, deckEditor,
SLOT(actSaveDeckToClipboardRawNoSetInfo())); &AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo);
aPrintDeck = new QAction(QString(), this); aPrintDeck = new QAction(QString(), this);
connect(aPrintDeck, SIGNAL(triggered()), deckEditor, SLOT(actPrintDeck())); connect(aPrintDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actPrintDeck);
aExportDeckDecklist = new QAction(QString(), this); aExportDeckDecklist = new QAction(QString(), this);
connect(aExportDeckDecklist, SIGNAL(triggered()), deckEditor, SLOT(actExportDeckDecklist())); connect(aExportDeckDecklist, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actExportDeckDecklist);
aExportDeckDecklistXyz = new QAction(QString(), this); aExportDeckDecklistXyz = new QAction(QString(), this);
connect(aExportDeckDecklistXyz, SIGNAL(triggered()), deckEditor, SLOT(actExportDeckDecklistXyz())); connect(aExportDeckDecklistXyz, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actExportDeckDecklistXyz);
aAnalyzeDeckDeckstats = new QAction(QString(), this); aAnalyzeDeckDeckstats = new QAction(QString(), this);
connect(aAnalyzeDeckDeckstats, SIGNAL(triggered()), deckEditor, SLOT(actAnalyzeDeckDeckstats())); connect(aAnalyzeDeckDeckstats, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actAnalyzeDeckDeckstats);
aAnalyzeDeckTappedout = new QAction(QString(), this); aAnalyzeDeckTappedout = new QAction(QString(), this);
connect(aAnalyzeDeckTappedout, SIGNAL(triggered()), deckEditor, SLOT(actAnalyzeDeckTappedout())); connect(aAnalyzeDeckTappedout, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actAnalyzeDeckTappedout);
analyzeDeckMenu = new QMenu(this); analyzeDeckMenu = new QMenu(this);
analyzeDeckMenu->addAction(aExportDeckDecklist); analyzeDeckMenu->addAction(aExportDeckDecklist);
@ -102,7 +105,8 @@ DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), d
addAction(aClose); addAction(aClose);
retranslateUi(); retranslateUi();
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&DeckEditorMenu::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
} }

View file

@ -30,6 +30,7 @@
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox> #include <QMessageBox>
#include <QPrintPreviewDialog> #include <QPrintPreviewDialog>
#include <QPrinter>
#include <QProcessEnvironment> #include <QProcessEnvironment>
#include <QPushButton> #include <QPushButton>
#include <QRegularExpression> #include <QRegularExpression>
@ -65,7 +66,8 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta
connect(filterDockWidget, &DeckEditorFilterDockWidget::clearAllDatabaseFilters, databaseDisplayDockWidget, connect(filterDockWidget, &DeckEditorFilterDockWidget::clearAllDatabaseFilters, databaseDisplayDockWidget,
&DeckEditorDatabaseDisplayWidget::clearAllDatabaseFilters); &DeckEditorDatabaseDisplayWidget::clearAllDatabaseFilters);
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&AbstractTabDeckEditor::refreshShortcuts);
} }
void AbstractTabDeckEditor::updateCard(CardInfoPtr _card) void AbstractTabDeckEditor::updateCard(CardInfoPtr _card)
@ -337,8 +339,7 @@ bool AbstractTabDeckEditor::actSaveDeck()
cmd.set_deck_list(deckString.toStdString()); cmd.set_deck_list(deckString.toStdString());
PendingCommand *pend = AbstractClient::prepareSessionCommand(cmd); PendingCommand *pend = AbstractClient::prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &AbstractTabDeckEditor::saveDeckRemoteFinished);
SLOT(saveDeckRemoteFinished(Response)));
tabSupervisor->getClient()->sendCommand(pend); tabSupervisor->getClient()->sendCommand(pend);
return true; return true;
@ -457,7 +458,7 @@ void AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo()
void AbstractTabDeckEditor::actPrintDeck() void AbstractTabDeckEditor::actPrintDeck()
{ {
auto *dlg = new QPrintPreviewDialog(this); auto *dlg = new QPrintPreviewDialog(this);
connect(dlg, SIGNAL(paintRequested(QPrinter *)), deckDockWidget->deckModel, SLOT(printDeckList(QPrinter *))); connect(dlg, &QPrintPreviewDialog::paintRequested, deckDockWidget->deckModel, &DeckListModel::printDeckList);
dlg->exec(); dlg->exec();
} }

View file

@ -44,6 +44,8 @@ class AbstractTabDeckEditor : public Tab
{ {
Q_OBJECT Q_OBJECT
friend class DeckEditorMenu;
public: public:
explicit AbstractTabDeckEditor(TabSupervisor *_tabSupervisor); explicit AbstractTabDeckEditor(TabSupervisor *_tabSupervisor);

View file

@ -21,7 +21,7 @@ TabEdhRec::TabEdhRec(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
#endif #endif
networkManager->setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy); networkManager->setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
connect(networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(processApiJson(QNetworkReply *))); connect(networkManager, &QNetworkAccessManager::finished, this, &TabEdhRec::processApiJson);
} }
void TabEdhRec::retranslateUi() void TabEdhRec::retranslateUi()

View file

@ -67,36 +67,36 @@ void TabDeckEditor::createMenus()
aCardInfoDockVisible = cardInfoDockMenu->addAction(QString()); aCardInfoDockVisible = cardInfoDockMenu->addAction(QString());
aCardInfoDockVisible->setCheckable(true); aCardInfoDockVisible->setCheckable(true);
connect(aCardInfoDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aCardInfoDockVisible, &QAction::triggered, this, &TabDeckEditor::dockVisibleTriggered);
aCardInfoDockFloating = cardInfoDockMenu->addAction(QString()); aCardInfoDockFloating = cardInfoDockMenu->addAction(QString());
aCardInfoDockFloating->setCheckable(true); aCardInfoDockFloating->setCheckable(true);
connect(aCardInfoDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aCardInfoDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
aDeckDockVisible = deckDockMenu->addAction(QString()); aDeckDockVisible = deckDockMenu->addAction(QString());
aDeckDockVisible->setCheckable(true); aDeckDockVisible->setCheckable(true);
connect(aDeckDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aDeckDockVisible, &QAction::triggered, this, &TabDeckEditor::dockVisibleTriggered);
aDeckDockFloating = deckDockMenu->addAction(QString()); aDeckDockFloating = deckDockMenu->addAction(QString());
aDeckDockFloating->setCheckable(true); aDeckDockFloating->setCheckable(true);
connect(aDeckDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aDeckDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
aFilterDockVisible = filterDockMenu->addAction(QString()); aFilterDockVisible = filterDockMenu->addAction(QString());
aFilterDockVisible->setCheckable(true); aFilterDockVisible->setCheckable(true);
connect(aFilterDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aFilterDockVisible, &QAction::triggered, this, &TabDeckEditor::dockVisibleTriggered);
aFilterDockFloating = filterDockMenu->addAction(QString()); aFilterDockFloating = filterDockMenu->addAction(QString());
aFilterDockFloating->setCheckable(true); aFilterDockFloating->setCheckable(true);
connect(aFilterDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aFilterDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
aPrintingSelectorDockVisible = printingSelectorDockMenu->addAction(QString()); aPrintingSelectorDockVisible = printingSelectorDockMenu->addAction(QString());
aPrintingSelectorDockVisible->setCheckable(true); aPrintingSelectorDockVisible->setCheckable(true);
connect(aPrintingSelectorDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aPrintingSelectorDockVisible, &QAction::triggered, this, &TabDeckEditor::dockVisibleTriggered);
aPrintingSelectorDockFloating = printingSelectorDockMenu->addAction(QString()); aPrintingSelectorDockFloating = printingSelectorDockMenu->addAction(QString());
aPrintingSelectorDockFloating->setCheckable(true); aPrintingSelectorDockFloating->setCheckable(true);
connect(aPrintingSelectorDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aPrintingSelectorDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
viewMenu->addSeparator(); viewMenu->addSeparator();
aResetLayout = viewMenu->addAction(QString()); aResetLayout = viewMenu->addAction(QString());
connect(aResetLayout, SIGNAL(triggered()), this, SLOT(restartLayout())); connect(aResetLayout, &QAction::triggered, this, &TabDeckEditor::restartLayout);
viewMenu->addAction(aResetLayout); viewMenu->addAction(aResetLayout);
deckMenu->setSaveStatus(false); deckMenu->setSaveStatus(false);
@ -200,7 +200,7 @@ void TabDeckEditor::loadLayout()
databaseDisplayDockWidget->setMinimumSize(100, 100); databaseDisplayDockWidget->setMinimumSize(100, 100);
databaseDisplayDockWidget->setMaximumSize(1400, 5000); databaseDisplayDockWidget->setMaximumSize(1400, 5000);
QTimer::singleShot(100, this, SLOT(freeDocksSize())); QTimer::singleShot(100, this, &TabDeckEditor::freeDocksSize);
} }
void TabDeckEditor::restartLayout() void TabDeckEditor::restartLayout()
@ -236,7 +236,7 @@ void TabDeckEditor::restartLayout()
splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Horizontal); splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Horizontal);
splitDockWidget(cardInfoDockWidget, filterDockWidget, Qt::Vertical); splitDockWidget(cardInfoDockWidget, filterDockWidget, Qt::Vertical);
QTimer::singleShot(100, this, SLOT(freeDocksSize())); QTimer::singleShot(100, this, &TabDeckEditor::freeDocksSize);
} }
void TabDeckEditor::freeDocksSize() void TabDeckEditor::freeDocksSize()

View file

@ -105,19 +105,19 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
// Left side actions // Left side actions
aOpenLocalDeck = new QAction(this); aOpenLocalDeck = new QAction(this);
aOpenLocalDeck->setIcon(QPixmap("theme:icons/pencil")); aOpenLocalDeck->setIcon(QPixmap("theme:icons/pencil"));
connect(aOpenLocalDeck, SIGNAL(triggered()), this, SLOT(actOpenLocalDeck())); connect(aOpenLocalDeck, &QAction::triggered, this, &TabDeckStorage::actOpenLocalDeck);
aRenameLocal = new QAction(this); aRenameLocal = new QAction(this);
aRenameLocal->setIcon(QPixmap("theme:icons/rename")); aRenameLocal->setIcon(QPixmap("theme:icons/rename"));
connect(aRenameLocal, &QAction::triggered, this, &TabDeckStorage::actRenameLocal); connect(aRenameLocal, &QAction::triggered, this, &TabDeckStorage::actRenameLocal);
aUpload = new QAction(this); aUpload = new QAction(this);
aUpload->setIcon(QPixmap("theme:icons/arrow_right_green")); aUpload->setIcon(QPixmap("theme:icons/arrow_right_green"));
connect(aUpload, SIGNAL(triggered()), this, SLOT(actUpload())); connect(aUpload, &QAction::triggered, this, &TabDeckStorage::actUpload);
aNewLocalFolder = new QAction(this); aNewLocalFolder = new QAction(this);
aNewLocalFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogNewFolder)); aNewLocalFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogNewFolder));
connect(aNewLocalFolder, &QAction::triggered, this, &TabDeckStorage::actNewLocalFolder); connect(aNewLocalFolder, &QAction::triggered, this, &TabDeckStorage::actNewLocalFolder);
aDeleteLocalDeck = new QAction(this); aDeleteLocalDeck = new QAction(this);
aDeleteLocalDeck->setIcon(QPixmap("theme:icons/remove_row")); aDeleteLocalDeck->setIcon(QPixmap("theme:icons/remove_row"));
connect(aDeleteLocalDeck, SIGNAL(triggered()), this, SLOT(actDeleteLocalDeck())); connect(aDeleteLocalDeck, &QAction::triggered, this, &TabDeckStorage::actDeleteLocalDeck);
aOpenDecksFolder = new QAction(this); aOpenDecksFolder = new QAction(this);
aOpenDecksFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_DirOpenIcon)); aOpenDecksFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_DirOpenIcon));
@ -126,16 +126,16 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
// Right side actions // Right side actions
aOpenRemoteDeck = new QAction(this); aOpenRemoteDeck = new QAction(this);
aOpenRemoteDeck->setIcon(QPixmap("theme:icons/pencil")); aOpenRemoteDeck->setIcon(QPixmap("theme:icons/pencil"));
connect(aOpenRemoteDeck, SIGNAL(triggered()), this, SLOT(actOpenRemoteDeck())); connect(aOpenRemoteDeck, &QAction::triggered, this, &TabDeckStorage::actOpenRemoteDeck);
aDownload = new QAction(this); aDownload = new QAction(this);
aDownload->setIcon(QPixmap("theme:icons/arrow_left_green")); aDownload->setIcon(QPixmap("theme:icons/arrow_left_green"));
connect(aDownload, SIGNAL(triggered()), this, SLOT(actDownload())); connect(aDownload, &QAction::triggered, this, &TabDeckStorage::actDownload);
aNewFolder = new QAction(this); aNewFolder = new QAction(this);
aNewFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogNewFolder)); aNewFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogNewFolder));
connect(aNewFolder, SIGNAL(triggered()), this, SLOT(actNewFolder())); connect(aNewFolder, &QAction::triggered, this, &TabDeckStorage::actNewFolder);
aDeleteRemoteDeck = new QAction(this); aDeleteRemoteDeck = new QAction(this);
aDeleteRemoteDeck->setIcon(QPixmap("theme:icons/remove_row")); aDeleteRemoteDeck->setIcon(QPixmap("theme:icons/remove_row"));
connect(aDeleteRemoteDeck, SIGNAL(triggered()), this, SLOT(actDeleteRemoteDeck())); connect(aDeleteRemoteDeck, &QAction::triggered, this, &TabDeckStorage::actDeleteRemoteDeck);
// Add actions to toolbars // Add actions to toolbars
leftToolBar->addAction(aOpenLocalDeck); leftToolBar->addAction(aOpenLocalDeck);
@ -339,8 +339,7 @@ void TabDeckStorage::uploadDeck(const QString &filePath, const QString &targetPa
cmd.set_deck_list(deckString.toStdString()); cmd.set_deck_list(deckString.toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabDeckStorage::uploadFinished);
SLOT(uploadFinished(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -421,8 +420,7 @@ void TabDeckStorage::actOpenRemoteDeck()
cmd.set_deck_id(node->getId()); cmd.set_deck_id(node->getId());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabDeckStorage::openRemoteDeckFinished);
SLOT(openRemoteDeckFinished(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} }
} }
@ -479,8 +477,7 @@ void TabDeckStorage::downloadNodeAtIndex(const QModelIndex &curLeft, const QMode
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
pend->setExtraData(filePath); pend->setExtraData(filePath);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabDeckStorage::downloadFinished);
SLOT(downloadFinished(Response, CommandContainer, QVariant)));
client->sendCommand(pend); client->sendCommand(pend);
} }
// node at index is invalid // node at index is invalid
@ -522,8 +519,7 @@ void TabDeckStorage::actNewFolder()
cmd.set_dir_name(folder); cmd.set_dir_name(folder);
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabDeckStorage::newFolderFinished);
SLOT(newFolderFinished(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -573,15 +569,13 @@ void TabDeckStorage::deleteRemoteDeck(const RemoteDeckList_TreeModel::Node *curR
Command_DeckDelDir cmd; Command_DeckDelDir cmd;
cmd.set_path(targetPath.toStdString()); cmd.set_path(targetPath.toStdString());
pend = client->prepareSessionCommand(cmd); pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabDeckStorage::deleteFolderFinished);
SLOT(deleteFolderFinished(Response, CommandContainer)));
} else { } else {
const auto *deckNode = dynamic_cast<const RemoteDeckList_TreeModel::FileNode *>(curRight); const auto *deckNode = dynamic_cast<const RemoteDeckList_TreeModel::FileNode *>(curRight);
Command_DeckDel cmd; Command_DeckDel cmd;
cmd.set_deck_id(deckNode->getId()); cmd.set_deck_id(deckNode->getId());
pend = client->prepareSessionCommand(cmd); pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabDeckStorage::deleteDeckFinished);
SLOT(deleteDeckFinished(Response, CommandContainer)));
} }
client->sendCommand(pend); client->sendCommand(pend);

View file

@ -115,11 +115,12 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
createReplayMenuItems(); createReplayMenuItems();
createViewMenuItems(); createViewMenuItems();
retranslateUi(); retranslateUi();
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&TabGame::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
messageLog->logReplayStarted(gameInfo.game_id()); messageLog->logReplayStarted(gameInfo.game_id());
QTimer::singleShot(0, this, SLOT(loadLayout())); QTimer::singleShot(0, this, &TabGame::loadLayout);
} }
TabGame::TabGame(TabSupervisor *_tabSupervisor, TabGame::TabGame(TabSupervisor *_tabSupervisor,
@ -156,14 +157,15 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
createMenuItems(); createMenuItems();
createViewMenuItems(); createViewMenuItems();
retranslateUi(); retranslateUi();
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&TabGame::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
// append game to rooms game list for others to see // append game to rooms game list for others to see
for (int i = gameInfo.game_types_size() - 1; i >= 0; i--) for (int i = gameInfo.game_types_size() - 1; i >= 0; i--)
gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value()); gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value());
QTimer::singleShot(0, this, SLOT(loadLayout())); QTimer::singleShot(0, this, &TabGame::loadLayout);
} }
void TabGame::addMentionTag(const QString &value) void TabGame::addMentionTag(const QString &value)
@ -628,7 +630,7 @@ Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
} }
scene->addPlayer(newPlayer); scene->addPlayer(newPlayer);
connect(newPlayer, SIGNAL(newCardAdded(AbstractCardItem *)), this, SLOT(newCardAdded(AbstractCardItem *))); connect(newPlayer, &Player::newCardAdded, this, &TabGame::newCardAdded);
messageLog->connectToPlayer(newPlayer); messageLog->connectToPlayer(newPlayer);
if (local && !spectator) { if (local && !spectator) {
@ -636,7 +638,7 @@ Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
newPlayer->setShortcutsActive(); newPlayer->setShortcutsActive();
auto *deckView = new DeckViewContainer(playerId, this); auto *deckView = new DeckViewContainer(playerId, this);
connect(deckView, SIGNAL(newCardAdded(AbstractCardItem *)), this, SLOT(newCardAdded(AbstractCardItem *))); connect(deckView, &DeckViewContainer::newCardAdded, this, &TabGame::newCardAdded);
deckViewContainers.insert(playerId, deckView); deckViewContainers.insert(playerId, deckView);
deckViewContainerLayout->addWidget(deckView); deckViewContainerLayout->addWidget(deckView);
@ -784,8 +786,7 @@ void TabGame::sendGameCommand(PendingCommand *pend, int playerId)
if (!client) if (!client)
return; return;
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabGame::commandFinished);
SLOT(commandFinished(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -796,8 +797,7 @@ void TabGame::sendGameCommand(const google::protobuf::Message &command, int play
return; return;
PendingCommand *pend = prepareGameCommand(command); PendingCommand *pend = prepareGameCommand(command);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabGame::commandFinished);
SLOT(commandFinished(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -1198,10 +1198,11 @@ void TabGame::eventSetActivePhase(const Event_SetActivePhase &event,
void TabGame::newCardAdded(AbstractCardItem *card) void TabGame::newCardAdded(AbstractCardItem *card)
{ {
connect(card, SIGNAL(hovered(AbstractCardItem *)), cardInfoFrameWidget, SLOT(setCard(AbstractCardItem *))); connect(card, &AbstractCardItem::hovered, cardInfoFrameWidget,
qOverload<AbstractCardItem *>(&CardInfoFrameWidget::setCard));
connect(card, &AbstractCardItem::showCardInfoPopup, this, &TabGame::showCardInfoPopup); connect(card, &AbstractCardItem::showCardInfoPopup, this, &TabGame::showCardInfoPopup);
connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
connect(card, SIGNAL(cardShiftClicked(QString)), this, SLOT(linkCardToChat(QString))); connect(card, &AbstractCardItem::cardShiftClicked, this, &TabGame::linkCardToChat);
} }
CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) const CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) const
@ -1289,34 +1290,34 @@ void TabGame::updateCardMenu(AbstractCardItem *card)
void TabGame::createMenuItems() void TabGame::createMenuItems()
{ {
aNextPhase = new QAction(this); aNextPhase = new QAction(this);
connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase())); connect(aNextPhase, &QAction::triggered, this, &TabGame::actNextPhase);
aNextPhaseAction = new QAction(this); aNextPhaseAction = new QAction(this);
connect(aNextPhaseAction, SIGNAL(triggered()), this, SLOT(actNextPhaseAction())); connect(aNextPhaseAction, &QAction::triggered, this, &TabGame::actNextPhaseAction);
aNextTurn = new QAction(this); aNextTurn = new QAction(this);
connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn())); connect(aNextTurn, &QAction::triggered, this, &TabGame::actNextTurn);
aReverseTurn = new QAction(this); aReverseTurn = new QAction(this);
connect(aReverseTurn, SIGNAL(triggered()), this, SLOT(actReverseTurn())); connect(aReverseTurn, &QAction::triggered, this, &TabGame::actReverseTurn);
aRemoveLocalArrows = new QAction(this); aRemoveLocalArrows = new QAction(this);
connect(aRemoveLocalArrows, SIGNAL(triggered()), this, SLOT(actRemoveLocalArrows())); connect(aRemoveLocalArrows, &QAction::triggered, this, &TabGame::actRemoveLocalArrows);
aRotateViewCW = new QAction(this); aRotateViewCW = new QAction(this);
connect(aRotateViewCW, SIGNAL(triggered()), this, SLOT(actRotateViewCW())); connect(aRotateViewCW, &QAction::triggered, this, &TabGame::actRotateViewCW);
aRotateViewCCW = new QAction(this); aRotateViewCCW = new QAction(this);
connect(aRotateViewCCW, SIGNAL(triggered()), this, SLOT(actRotateViewCCW())); connect(aRotateViewCCW, &QAction::triggered, this, &TabGame::actRotateViewCCW);
aGameInfo = new QAction(this); aGameInfo = new QAction(this);
connect(aGameInfo, SIGNAL(triggered()), this, SLOT(actGameInfo())); connect(aGameInfo, &QAction::triggered, this, &TabGame::actGameInfo);
aConcede = new QAction(this); aConcede = new QAction(this);
connect(aConcede, SIGNAL(triggered()), this, SLOT(actConcede())); connect(aConcede, &QAction::triggered, this, &TabGame::actConcede);
aLeaveGame = new QAction(this); aLeaveGame = new QAction(this);
connect(aLeaveGame, &QAction::triggered, this, [this] { closeRequest(); }); connect(aLeaveGame, &QAction::triggered, this, [this] { closeRequest(); });
aFocusChat = new QAction(this); aFocusChat = new QAction(this);
connect(aFocusChat, SIGNAL(triggered()), sayEdit, SLOT(setFocus())); connect(aFocusChat, &QAction::triggered, sayEdit, qOverload<>(&LineEditCompleter::setFocus));
aCloseReplay = nullptr; aCloseReplay = nullptr;
phasesMenu = new TearOffMenu(this); phasesMenu = new TearOffMenu(this);
for (int i = 0; i < phasesToolbar->phaseCount(); ++i) { for (int i = 0; i < phasesToolbar->phaseCount(); ++i) {
QAction *temp = new QAction(QString(), this); QAction *temp = new QAction(QString(), this);
connect(temp, SIGNAL(triggered()), this, SLOT(actPhaseAction())); connect(temp, &QAction::triggered, this, &TabGame::actPhaseAction);
phasesMenu->addAction(temp); phasesMenu->addAction(temp);
phaseActions.append(temp); phaseActions.append(temp);
} }
@ -1375,40 +1376,40 @@ void TabGame::createViewMenuItems()
aCardInfoDockVisible = cardInfoDockMenu->addAction(QString()); aCardInfoDockVisible = cardInfoDockMenu->addAction(QString());
aCardInfoDockVisible->setCheckable(true); aCardInfoDockVisible->setCheckable(true);
connect(aCardInfoDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aCardInfoDockVisible, &QAction::triggered, this, &TabGame::dockVisibleTriggered);
aCardInfoDockFloating = cardInfoDockMenu->addAction(QString()); aCardInfoDockFloating = cardInfoDockMenu->addAction(QString());
aCardInfoDockFloating->setCheckable(true); aCardInfoDockFloating->setCheckable(true);
connect(aCardInfoDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aCardInfoDockFloating, &QAction::triggered, this, &TabGame::dockFloatingTriggered);
aMessageLayoutDockVisible = messageLayoutDockMenu->addAction(QString()); aMessageLayoutDockVisible = messageLayoutDockMenu->addAction(QString());
aMessageLayoutDockVisible->setCheckable(true); aMessageLayoutDockVisible->setCheckable(true);
connect(aMessageLayoutDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aMessageLayoutDockVisible, &QAction::triggered, this, &TabGame::dockVisibleTriggered);
aMessageLayoutDockFloating = messageLayoutDockMenu->addAction(QString()); aMessageLayoutDockFloating = messageLayoutDockMenu->addAction(QString());
aMessageLayoutDockFloating->setCheckable(true); aMessageLayoutDockFloating->setCheckable(true);
connect(aMessageLayoutDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aMessageLayoutDockFloating, &QAction::triggered, this, &TabGame::dockFloatingTriggered);
aPlayerListDockVisible = playerListDockMenu->addAction(QString()); aPlayerListDockVisible = playerListDockMenu->addAction(QString());
aPlayerListDockVisible->setCheckable(true); aPlayerListDockVisible->setCheckable(true);
connect(aPlayerListDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aPlayerListDockVisible, &QAction::triggered, this, &TabGame::dockVisibleTriggered);
aPlayerListDockFloating = playerListDockMenu->addAction(QString()); aPlayerListDockFloating = playerListDockMenu->addAction(QString());
aPlayerListDockFloating->setCheckable(true); aPlayerListDockFloating->setCheckable(true);
connect(aPlayerListDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aPlayerListDockFloating, &QAction::triggered, this, &TabGame::dockFloatingTriggered);
if (replayDock) { if (replayDock) {
replayDockMenu = viewMenu->addMenu(QString()); replayDockMenu = viewMenu->addMenu(QString());
aReplayDockVisible = replayDockMenu->addAction(QString()); aReplayDockVisible = replayDockMenu->addAction(QString());
aReplayDockVisible->setCheckable(true); aReplayDockVisible->setCheckable(true);
connect(aReplayDockVisible, SIGNAL(triggered()), this, SLOT(dockVisibleTriggered())); connect(aReplayDockVisible, &QAction::triggered, this, &TabGame::dockVisibleTriggered);
aReplayDockFloating = replayDockMenu->addAction(QString()); aReplayDockFloating = replayDockMenu->addAction(QString());
aReplayDockFloating->setCheckable(true); aReplayDockFloating->setCheckable(true);
connect(aReplayDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered())); connect(aReplayDockFloating, &QAction::triggered, this, &TabGame::dockFloatingTriggered);
} }
viewMenu->addSeparator(); viewMenu->addSeparator();
aResetLayout = viewMenu->addAction(QString()); aResetLayout = viewMenu->addAction(QString());
connect(aResetLayout, SIGNAL(triggered()), this, SLOT(actResetLayout())); connect(aResetLayout, &QAction::triggered, this, &TabGame::actResetLayout);
viewMenu->addAction(aResetLayout); viewMenu->addAction(aResetLayout);
addTabMenu(viewMenu); addTabMenu(viewMenu);
@ -1459,7 +1460,7 @@ void TabGame::loadLayout()
aReplayDockFloating->setChecked(replayDock->isFloating()); aReplayDockFloating->setChecked(replayDock->isFloating());
} }
QTimer::singleShot(100, this, SLOT(freeDocksSize())); QTimer::singleShot(100, this, &TabGame::freeDocksSize);
} }
void TabGame::freeDocksSize() void TabGame::freeDocksSize()
@ -1525,15 +1526,15 @@ void TabGame::actResetLayout()
playerListDock->setMaximumSize(250, 50); playerListDock->setMaximumSize(250, 50);
} }
QTimer::singleShot(100, this, SLOT(freeDocksSize())); QTimer::singleShot(100, this, &TabGame::freeDocksSize);
} }
void TabGame::createPlayAreaWidget(bool bReplay) void TabGame::createPlayAreaWidget(bool bReplay)
{ {
phasesToolbar = new PhasesToolbar; phasesToolbar = new PhasesToolbar;
if (!bReplay) if (!bReplay)
connect(phasesToolbar, SIGNAL(sendGameCommand(const ::google::protobuf::Message &, int)), this, connect(phasesToolbar, &PhasesToolbar::sendGameCommand, this,
SLOT(sendGameCommand(const ::google::protobuf::Message &, int))); qOverload<const ::google::protobuf::Message &, int>(&TabGame::sendGameCommand));
scene = new GameScene(phasesToolbar, this); scene = new GameScene(phasesToolbar, this);
gameView = new GameView(scene); gameView = new GameView(scene);
@ -1551,9 +1552,8 @@ void TabGame::createReplayDock()
// timeline widget // timeline widget
timelineWidget = new ReplayTimelineWidget; timelineWidget = new ReplayTimelineWidget;
timelineWidget->setTimeline(replayTimeline); timelineWidget->setTimeline(replayTimeline);
connect(timelineWidget, SIGNAL(processNextEvent(Player::EventProcessingOptions)), this, connect(timelineWidget, &ReplayTimelineWidget::processNextEvent, this, &TabGame::replayNextEvent);
SLOT(replayNextEvent(Player::EventProcessingOptions))); connect(timelineWidget, &ReplayTimelineWidget::replayFinished, this, &TabGame::replayFinished);
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
connect(timelineWidget, &ReplayTimelineWidget::rewound, this, &TabGame::replayRewind); connect(timelineWidget, &ReplayTimelineWidget::rewound, this, &TabGame::replayRewind);
// timeline skip shortcuts // timeline skip shortcuts
@ -1585,13 +1585,13 @@ void TabGame::createReplayDock()
playButtonIcon.addPixmap(QPixmap("theme:replay/pause"), QIcon::Normal, QIcon::On); playButtonIcon.addPixmap(QPixmap("theme:replay/pause"), QIcon::Normal, QIcon::On);
replayPlayButton->setIcon(playButtonIcon); replayPlayButton->setIcon(playButtonIcon);
replayPlayButton->setCheckable(true); replayPlayButton->setCheckable(true);
connect(replayPlayButton, SIGNAL(toggled(bool)), this, SLOT(replayPlayButtonToggled(bool))); connect(replayPlayButton, &QToolButton::toggled, this, &TabGame::replayPlayButtonToggled);
replayFastForwardButton = new QToolButton; replayFastForwardButton = new QToolButton;
replayFastForwardButton->setIconSize(QSize(32, 32)); replayFastForwardButton->setIconSize(QSize(32, 32));
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward")); replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
replayFastForwardButton->setCheckable(true); replayFastForwardButton->setCheckable(true);
connect(replayFastForwardButton, SIGNAL(toggled(bool)), this, SLOT(replayFastForwardButtonToggled(bool))); connect(replayFastForwardButton, &QToolButton::toggled, this, &TabGame::replayFastForwardButtonToggled);
// putting everything together // putting everything together
replayControlLayout = new QHBoxLayout; replayControlLayout = new QHBoxLayout;
@ -1611,7 +1611,7 @@ void TabGame::createReplayDock()
replayDock->setFloating(false); replayDock->setFloating(false);
replayDock->installEventFilter(this); replayDock->installEventFilter(this);
connect(replayDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool))); connect(replayDock, &QDockWidget::topLevelChanged, this, &TabGame::dockTopLevelChanged);
} }
void TabGame::createDeckViewContainerWidget(bool bReplay) void TabGame::createDeckViewContainerWidget(bool bReplay)
@ -1652,7 +1652,7 @@ void TabGame::createCardInfoDock(bool bReplay)
cardInfoDock->setFloating(false); cardInfoDock->setFloating(false);
cardInfoDock->installEventFilter(this); cardInfoDock->installEventFilter(this);
connect(cardInfoDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool))); connect(cardInfoDock, &QDockWidget::topLevelChanged, this, &TabGame::dockTopLevelChanged);
} }
void TabGame::createPlayerListDock(bool bReplay) void TabGame::createPlayerListDock(bool bReplay)
@ -1674,26 +1674,28 @@ void TabGame::createPlayerListDock(bool bReplay)
playerListDock->setFloating(false); playerListDock->setFloating(false);
playerListDock->installEventFilter(this); playerListDock->installEventFilter(this);
connect(playerListDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool))); connect(playerListDock, &QDockWidget::topLevelChanged, this, &TabGame::dockTopLevelChanged);
} }
void TabGame::createMessageDock(bool bReplay) void TabGame::createMessageDock(bool bReplay)
{ {
messageLog = new MessageLogWidget(tabSupervisor, this); messageLog = new MessageLogWidget(tabSupervisor, this);
connect(messageLog, SIGNAL(cardNameHovered(QString)), cardInfoFrameWidget, SLOT(setCard(QString))); connect(messageLog, &MessageLogWidget::cardNameHovered, cardInfoFrameWidget,
qOverload<const QString &>(&CardInfoFrameWidget::setCard));
connect(messageLog, &MessageLogWidget::showCardInfoPopup, this, &TabGame::showCardInfoPopup); connect(messageLog, &MessageLogWidget::showCardInfoPopup, this, &TabGame::showCardInfoPopup);
connect(messageLog, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(messageLog, &MessageLogWidget::deleteCardInfoPopup, this, &TabGame::deleteCardInfoPopup);
if (!bReplay) { if (!bReplay) {
connect(messageLog, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(messageLog, &MessageLogWidget::openMessageDialog, this, &TabGame::openMessageDialog);
connect(messageLog, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString))); connect(messageLog, &MessageLogWidget::addMentionTag, this, &TabGame::addMentionTag);
connect(&SettingsCache::instance(), SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged())); connect(&SettingsCache::instance(), &SettingsCache::chatMentionCompleterChanged, this,
&TabGame::actCompleterChanged);
timeElapsedLabel = new QLabel; timeElapsedLabel = new QLabel;
timeElapsedLabel->setAlignment(Qt::AlignCenter); timeElapsedLabel->setAlignment(Qt::AlignCenter);
gameTimer = new QTimer(this); gameTimer = new QTimer(this);
gameTimer->setInterval(1000); gameTimer->setInterval(1000);
connect(gameTimer, SIGNAL(timeout()), this, SLOT(incrementGameTime())); connect(gameTimer, &QTimer::timeout, this, &TabGame::incrementGameTime);
gameTimer->start(); gameTimer->start();
sayLabel = new QLabel; sayLabel = new QLabel;
@ -1721,8 +1723,8 @@ void TabGame::createMessageDock(bool bReplay)
} }
} }
connect(tabSupervisor, SIGNAL(adminLockChanged(bool)), this, SLOT(adminLockChanged(bool))); connect(tabSupervisor, &TabSupervisor::adminLockChanged, this, &TabGame::adminLockChanged);
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(actSay())); connect(sayEdit, &LineEditCompleter::returnPressed, this, &TabGame::actSay);
sayHLayout = new QHBoxLayout; sayHLayout = new QHBoxLayout;
sayHLayout->addWidget(sayLabel); sayHLayout->addWidget(sayLabel);
@ -1748,7 +1750,7 @@ void TabGame::createMessageDock(bool bReplay)
messageLayoutDock->setFloating(false); messageLayoutDock->setFloating(false);
messageLayoutDock->installEventFilter(this); messageLayoutDock->installEventFilter(this);
connect(messageLayoutDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool))); connect(messageLayoutDock, &QDockWidget::topLevelChanged, this, &TabGame::dockTopLevelChanged);
} }
void TabGame::hideEvent(QHideEvent *event) void TabGame::hideEvent(QHideEvent *event)

View file

@ -116,8 +116,7 @@ void TabLog::getClicked()
cmd.set_date_range(dateRange); cmd.set_date_range(dateRange);
cmd.set_maximum_results(maximumResults->value()); cmd.set_maximum_results(maximumResults->value());
PendingCommand *pend = client->prepareModeratorCommand(cmd); PendingCommand *pend = client->prepareModeratorCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabLog::viewLogHistory_processResponse);
SLOT(viewLogHistory_processResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -186,11 +185,11 @@ void TabLog::createDock()
getButton = new QPushButton(tr("Get User Logs")); getButton = new QPushButton(tr("Get User Logs"));
getButton->setAutoDefault(true); getButton->setAutoDefault(true);
connect(getButton, SIGNAL(clicked()), this, SLOT(getClicked())); connect(getButton, &QPushButton::clicked, this, &TabLog::getClicked);
clearButton = new QPushButton(tr("Clear Filters")); clearButton = new QPushButton(tr("Clear Filters"));
clearButton->setAutoDefault(true); clearButton->setAutoDefault(true);
connect(clearButton, SIGNAL(clicked()), this, SLOT(clearClicked())); connect(clearButton, &QPushButton::clicked, this, &TabLog::clearClicked);
criteriaGrid = new QGridLayout; criteriaGrid = new QGridLayout;
criteriaGrid->addWidget(labelFindUserName, 0, 0); criteriaGrid->addWidget(labelFindUserName, 0, 0);

View file

@ -28,11 +28,11 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor,
{ {
chatView = new ChatView(tabSupervisor, 0, true); chatView = new ChatView(tabSupervisor, 0, true);
connect(chatView, &ChatView::showCardInfoPopup, this, &TabMessage::showCardInfoPopup); connect(chatView, &ChatView::showCardInfoPopup, this, &TabMessage::showCardInfoPopup);
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(chatView, &ChatView::deleteCardInfoPopup, this, &TabMessage::deleteCardInfoPopup);
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString))); connect(chatView, &ChatView::addMentionTag, this, &TabMessage::addMentionTag);
sayEdit = new LineEditUnfocusable; sayEdit = new LineEditUnfocusable;
sayEdit->setMaxLength(MAX_TEXT_LENGTH); sayEdit->setMaxLength(MAX_TEXT_LENGTH);
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage())); connect(sayEdit, &LineEditUnfocusable::returnPressed, this, &TabMessage::sendMessage);
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(chatView); vbox->addWidget(chatView);
@ -102,7 +102,7 @@ void TabMessage::sendMessage()
cmd.set_message(sayEdit->text().toStdString()); cmd.set_message(sayEdit->text().toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(messageSent(const Response &))); connect(pend, &PendingCommand::finished, this, &TabMessage::messageSent);
client->sendCommand(pend); client->sendCommand(pend);
sayEdit->clear(); sayEdit->clear();
@ -140,10 +140,10 @@ bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event)
void TabMessage::showSystemPopup(const Event_UserMessage &event) void TabMessage::showSystemPopup(const Event_UserMessage &event)
{ {
if (trayIcon) { if (trayIcon) {
disconnect(trayIcon, SIGNAL(messageClicked()), 0, 0); disconnect(trayIcon, &QSystemTrayIcon::messageClicked, 0, 0);
trayIcon->showMessage(tr("Private message from") + " " + otherUserInfo->name().c_str(), trayIcon->showMessage(tr("Private message from") + " " + otherUserInfo->name().c_str(),
event.message().c_str()); event.message().c_str());
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &TabMessage::messageClicked);
} else { } else {
qCWarning(TabMessageLog) << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed"; qCWarning(TabMessageLog) << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed";
} }

View file

@ -96,8 +96,8 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
// Left side actions // Left side actions
aOpenLocalReplay = new QAction(this); aOpenLocalReplay = new QAction(this);
aOpenLocalReplay->setIcon(QPixmap("theme:icons/view")); aOpenLocalReplay->setIcon(QPixmap("theme:icons/view"));
connect(aOpenLocalReplay, SIGNAL(triggered()), this, SLOT(actOpenLocalReplay())); connect(aOpenLocalReplay, &QAction::triggered, this, &TabReplays::actOpenLocalReplay);
connect(localDirView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actOpenLocalReplay())); connect(localDirView, &QTreeView::doubleClicked, this, &TabReplays::actOpenLocalReplay);
aRenameLocal = new QAction(this); aRenameLocal = new QAction(this);
aRenameLocal->setIcon(QPixmap("theme:icons/rename")); aRenameLocal->setIcon(QPixmap("theme:icons/rename"));
connect(aRenameLocal, &QAction::triggered, this, &TabReplays::actRenameLocal); connect(aRenameLocal, &QAction::triggered, this, &TabReplays::actRenameLocal);
@ -106,7 +106,7 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
connect(aNewLocalFolder, &QAction::triggered, this, &TabReplays::actNewLocalFolder); connect(aNewLocalFolder, &QAction::triggered, this, &TabReplays::actNewLocalFolder);
aDeleteLocalReplay = new QAction(this); aDeleteLocalReplay = new QAction(this);
aDeleteLocalReplay->setIcon(QPixmap("theme:icons/remove_row")); aDeleteLocalReplay->setIcon(QPixmap("theme:icons/remove_row"));
connect(aDeleteLocalReplay, SIGNAL(triggered()), this, SLOT(actDeleteLocalReplay())); connect(aDeleteLocalReplay, &QAction::triggered, this, &TabReplays::actDeleteLocalReplay);
aOpenReplaysFolder = new QAction(this); aOpenReplaysFolder = new QAction(this);
aOpenReplaysFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_DirOpenIcon)); aOpenReplaysFolder->setIcon(qApp->style()->standardIcon(QStyle::SP_DirOpenIcon));
@ -115,17 +115,17 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
// Right side actions // Right side actions
aOpenRemoteReplay = new QAction(this); aOpenRemoteReplay = new QAction(this);
aOpenRemoteReplay->setIcon(QPixmap("theme:icons/view")); aOpenRemoteReplay->setIcon(QPixmap("theme:icons/view"));
connect(aOpenRemoteReplay, SIGNAL(triggered()), this, SLOT(actOpenRemoteReplay())); connect(aOpenRemoteReplay, &QAction::triggered, this, &TabReplays::actOpenRemoteReplay);
connect(serverDirView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actOpenRemoteReplay())); connect(serverDirView, &QTreeView::doubleClicked, this, &TabReplays::actOpenRemoteReplay);
aDownload = new QAction(this); aDownload = new QAction(this);
aDownload->setIcon(QPixmap("theme:icons/arrow_left_green")); aDownload->setIcon(QPixmap("theme:icons/arrow_left_green"));
connect(aDownload, SIGNAL(triggered()), this, SLOT(actDownload())); connect(aDownload, &QAction::triggered, this, &TabReplays::actDownload);
aKeep = new QAction(this); aKeep = new QAction(this);
aKeep->setIcon(QPixmap("theme:icons/lock")); aKeep->setIcon(QPixmap("theme:icons/lock"));
connect(aKeep, SIGNAL(triggered()), this, SLOT(actKeepRemoteReplay())); connect(aKeep, &QAction::triggered, this, &TabReplays::actKeepRemoteReplay);
aDeleteRemoteReplay = new QAction(this); aDeleteRemoteReplay = new QAction(this);
aDeleteRemoteReplay->setIcon(QPixmap("theme:icons/remove_row")); aDeleteRemoteReplay->setIcon(QPixmap("theme:icons/remove_row"));
connect(aDeleteRemoteReplay, SIGNAL(triggered()), this, SLOT(actDeleteRemoteReplay())); connect(aDeleteRemoteReplay, &QAction::triggered, this, &TabReplays::actDeleteRemoteReplay);
// Add actions to toolbars // Add actions to toolbars
leftToolBar->addAction(aOpenLocalReplay); leftToolBar->addAction(aOpenLocalReplay);
@ -146,8 +146,7 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
mainWidget->setLayout(hbox); mainWidget->setLayout(hbox);
setCentralWidget(mainWidget); setCentralWidget(mainWidget);
connect(client, SIGNAL(replayAddedEventReceived(const Event_ReplayAdded &)), this, connect(client, &AbstractClient::replayAddedEventReceived, this, &TabReplays::replayAddedEventReceived);
SLOT(replayAddedEventReceived(const Event_ReplayAdded &)));
connect(client, &AbstractClient::userInfoChanged, this, &TabReplays::handleConnected); connect(client, &AbstractClient::userInfoChanged, this, &TabReplays::handleConnected);
connect(client, &AbstractClient::statusChanged, this, &TabReplays::handleConnectionChanged); connect(client, &AbstractClient::statusChanged, this, &TabReplays::handleConnectionChanged);
@ -323,8 +322,7 @@ void TabReplays::actOpenRemoteReplay()
cmd.set_replay_id(curRight->replay_id()); cmd.set_replay_id(curRight->replay_id());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabReplays::openRemoteReplayFinished);
SLOT(openRemoteReplayFinished(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
} }
@ -378,8 +376,7 @@ void TabReplays::downloadNodeAtIndex(const QModelIndex &curLeft, const QModelInd
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
pend->setExtraData(filePath); pend->setExtraData(filePath);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabReplays::downloadFinished);
SLOT(downloadFinished(Response, CommandContainer, QVariant)));
client->sendCommand(pend); client->sendCommand(pend);
} }
// node at index was invalid // node at index was invalid
@ -416,8 +413,7 @@ void TabReplays::actKeepRemoteReplay()
cmd.set_do_not_hide(!curRight->do_not_hide()); cmd.set_do_not_hide(!curRight->do_not_hide());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabReplays::keepRemoteReplayFinished);
SLOT(keepRemoteReplayFinished(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} }
} }
@ -455,8 +451,7 @@ void TabReplays::actDeleteRemoteReplay()
cmd.set_game_id(curRight->game_id()); cmd.set_game_id(curRight->game_id());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabReplays::deleteRemoteReplayFinished);
SLOT(deleteRemoteReplayFinished(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} }
} }

View file

@ -53,28 +53,29 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
SIGNAL(openMessageDialog(const QString &, bool))); SIGNAL(openMessageDialog(const QString &, bool)));
chatView = new ChatView(tabSupervisor, nullptr, true, this); chatView = new ChatView(tabSupervisor, nullptr, true, this);
connect(chatView, SIGNAL(showMentionPopup(const QString &)), this, SLOT(actShowMentionPopup(const QString &))); connect(chatView, &ChatView::showMentionPopup, this, &TabRoom::actShowMentionPopup);
connect(chatView, SIGNAL(messageClickedSignal()), this, SLOT(focusTab())); connect(chatView, &ChatView::messageClickedSignal, this, &TabRoom::focusTab);
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(chatView, &ChatView::openMessageDialog, this, &TabRoom::openMessageDialog);
connect(chatView, &ChatView::showCardInfoPopup, this, &TabRoom::showCardInfoPopup); connect(chatView, &ChatView::showCardInfoPopup, this, &TabRoom::showCardInfoPopup);
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(chatView, &ChatView::deleteCardInfoPopup, this, &TabRoom::deleteCardInfoPopup);
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString))); connect(chatView, &ChatView::addMentionTag, this, &TabRoom::addMentionTag);
connect(&SettingsCache::instance(), SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged())); connect(&SettingsCache::instance(), &SettingsCache::chatMentionCompleterChanged, this,
&TabRoom::actCompleterChanged);
sayLabel = new QLabel; sayLabel = new QLabel;
sayEdit = new LineEditCompleter; sayEdit = new LineEditCompleter;
sayEdit->setMaxLength(MAX_TEXT_LENGTH); sayEdit->setMaxLength(MAX_TEXT_LENGTH);
sayLabel->setBuddy(sayEdit); sayLabel->setBuddy(sayEdit);
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage())); connect(sayEdit, &LineEditCompleter::returnPressed, this, &TabRoom::sendMessage);
QMenu *chatSettingsMenu = new QMenu(this); QMenu *chatSettingsMenu = new QMenu(this);
aClearChat = chatSettingsMenu->addAction(QString()); aClearChat = chatSettingsMenu->addAction(QString());
connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat())); connect(aClearChat, &QAction::triggered, this, &TabRoom::actClearChat);
chatSettingsMenu->addSeparator(); chatSettingsMenu->addSeparator();
aOpenChatSettings = chatSettingsMenu->addAction(QString()); aOpenChatSettings = chatSettingsMenu->addAction(QString());
connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings())); connect(aOpenChatSettings, &QAction::triggered, this, &TabRoom::actOpenChatSettings);
QToolButton *chatSettingsButton = new QToolButton; QToolButton *chatSettingsButton = new QToolButton;
chatSettingsButton->setIcon(QPixmap("theme:icons/settings")); chatSettingsButton->setIcon(QPixmap("theme:icons/settings"));
@ -126,7 +127,8 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
sayEdit->setCompleter(completer); sayEdit->setCompleter(completer);
actCompleterChanged(); actCompleterChanged();
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&TabRoom::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
retranslateUi(); retranslateUi();
@ -165,9 +167,9 @@ void TabRoom::actShowPopup(const QString &message)
{ {
if (trayIcon && (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this) || if (trayIcon && (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this) ||
QApplication::activeWindow() == nullptr || QApplication::focusWidget() == nullptr)) { QApplication::activeWindow() == nullptr || QApplication::focusWidget() == nullptr)) {
disconnect(trayIcon, SIGNAL(messageClicked()), nullptr, nullptr); disconnect(trayIcon, &QSystemTrayIcon::messageClicked, nullptr, nullptr);
trayIcon->showMessage(message, tr("Click to view")); trayIcon->showMessage(message, tr("Click to view"));
connect(trayIcon, SIGNAL(messageClicked()), chatView, SLOT(actMessageClicked())); connect(trayIcon, &QSystemTrayIcon::messageClicked, chatView, &ChatView::messageClickedSignal);
} }
} }
@ -201,8 +203,7 @@ void TabRoom::sendMessage()
cmd.set_message(sayEdit->text().toStdString()); cmd.set_message(sayEdit->text().toStdString());
PendingCommand *pend = prepareRoomCommand(cmd); PendingCommand *pend = prepareRoomCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabRoom::sayFinished);
SLOT(sayFinished(const Response &)));
sendRoomCommand(pend); sendRoomCommand(pend);
sayEdit->clear(); sayEdit->clear();
} }

View file

@ -33,7 +33,7 @@ RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent) : QGroupBox
roomList->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); roomList->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
joinButton = new QPushButton; joinButton = new QPushButton;
connect(joinButton, SIGNAL(clicked()), this, SLOT(joinClicked())); connect(joinButton, &QPushButton::clicked, this, &RoomSelector::joinClicked);
QHBoxLayout *buttonLayout = new QHBoxLayout; QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(); buttonLayout->addStretch();
buttonLayout->addWidget(joinButton); buttonLayout->addWidget(joinButton);
@ -44,9 +44,8 @@ RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent) : QGroupBox
retranslateUi(); retranslateUi();
setLayout(vbox); setLayout(vbox);
connect(client, SIGNAL(listRoomsEventReceived(const Event_ListRooms &)), this, connect(client, &AbstractClient::listRoomsEventReceived, this, &RoomSelector::processListRoomsEvent);
SLOT(processListRoomsEvent(const Event_ListRooms &))); connect(roomList, &QTreeWidget::activated, this, &RoomSelector::joinClicked);
connect(roomList, SIGNAL(activated(const QModelIndex &)), this, SLOT(joinClicked()));
client->sendCommand(client->prepareSessionCommand(Command_ListRooms())); client->sendCommand(client->prepareSessionCommand(Command_ListRooms()));
} }
@ -144,10 +143,9 @@ TabServer::TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client) : T
serverInfoBox = new QTextBrowser; serverInfoBox = new QTextBrowser;
serverInfoBox->setOpenExternalLinks(true); serverInfoBox->setOpenExternalLinks(true);
connect(roomSelector, SIGNAL(joinRoomRequest(int, bool)), this, SLOT(joinRoom(int, bool))); connect(roomSelector, &RoomSelector::joinRoomRequest, this, &TabServer::joinRoom);
connect(client, SIGNAL(serverMessageEventReceived(const Event_ServerMessage &)), this, connect(client, &AbstractClient::serverMessageEventReceived, this, &TabServer::processServerMessageEvent);
SLOT(processServerMessageEvent(const Event_ServerMessage &)));
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(roomSelector); vbox->addWidget(roomSelector);
@ -185,8 +183,7 @@ void TabServer::joinRoom(int id, bool setCurrent)
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
pend->setExtraData(setCurrent); pend->setExtraData(setCurrent);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &TabServer::joinRoomFinished);
SLOT(joinRoomFinished(Response, CommandContainer, QVariant)));
client->sendCommand(pend); client->sendCommand(pend);