Commit b7ee1cf2 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use memberfunction-pointer overloads of KStandardGameAction/KStandardAction

Needs KF5KDEGames 7.3, which also indirectly bumps min KF dep
parent badd8097
......@@ -9,7 +9,7 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project(kpat VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.12.0")
set (KF5_MIN_VERSION "5.59.0")
set (KF5_MIN_VERSION "5.64.0")
include(FindPkgConfig)
pkg_check_modules(FC_SOLVE REQUIRED libfreecell-solver)
......@@ -45,7 +45,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
XmlGui
)
find_package(KF5KDEGames 4.9.0 REQUIRED)
find_package(KF5KDEGames 7.3.0 REQUIRED)
include(FeatureSummary)
include(ECMAddAppIcon)
......
......@@ -168,7 +168,7 @@ void MainWindow::setupActions()
actionCollection()->setDefaultShortcut(a, Qt::CTRL | Qt::Key_D);
connect(a, &QAction::triggered, this, &MainWindow::newNumberedDeal);
a = KStandardGameAction::restart(this, SLOT(restart()), actionCollection());
a = KStandardGameAction::restart(this, &MainWindow::restart, actionCollection());
a->setText(i18nc("Replay the current deal from the start", "Restart Deal"));
// Note that this action is not shown in the menu or toolbar. It is
......@@ -189,12 +189,12 @@ void MainWindow::setupActions()
actionCollection()->setDefaultShortcut(a, Qt::CTRL | Qt::Key_Minus);
connect(a, &QAction::triggered, this, &MainWindow::previousDeal);
KStandardGameAction::load( this, SLOT(loadGame()), actionCollection() );
KStandardGameAction::load(this, QOverload<>::of(&MainWindow::loadGame), actionCollection());
m_recentFilesAction = KStandardGameAction::loadRecent( this, SLOT(loadGame(QUrl)), actionCollection() );
m_recentFilesAction = KStandardGameAction::loadRecent(this, QOverload<const QUrl&>::of(&MainWindow::loadGame), actionCollection() );
m_recentFilesAction->loadEntries(KSharedConfig::openConfig()->group( QString() ));
m_saveAction = KStandardGameAction::saveAs(this, SLOT(saveGame()), actionCollection());
m_saveAction = KStandardGameAction::saveAs(this, &MainWindow::saveGame, actionCollection());
actionCollection()->setDefaultShortcut(m_saveAction, Qt::CTRL | Qt::Key_S);
a = actionCollection()->addAction( QStringLiteral( "game_stats" ));
......@@ -202,15 +202,15 @@ void MainWindow::setupActions()
a->setIcon( QIcon::fromTheme( QStringLiteral( "games-highscores" )) );
connect(a, &QAction::triggered, this, &MainWindow::showStats);
KStandardGameAction::quit(this, SLOT(close()), actionCollection());
KStandardGameAction::quit(this, &MainWindow::close, actionCollection());
// Move Menu
m_undoAction = KStandardGameAction::undo(this, SLOT(undoMove()), actionCollection());
m_undoAction = KStandardGameAction::undo(this, &MainWindow::undoMove, actionCollection());
m_redoAction = KStandardGameAction::redo(this, SLOT(redoMove()), actionCollection());
m_redoAction = KStandardGameAction::redo(this, &MainWindow::redoMove, actionCollection());
m_demoAction = KStandardGameAction::demo( this, SLOT(toggleDemo()), actionCollection() );
m_demoAction = KStandardGameAction::demo(this, &MainWindow::toggleDemo, actionCollection());
// KStandardGameAction::hint is a regular action, but we want a toggle
// action, so we must create a new action and copy all the standard
......@@ -329,7 +329,7 @@ void MainWindow::setupActions()
actionCollection()->setDefaultShortcut(m_pickUpSetDownAction, Qt::Key_Space );
// showMenubar isn't a part of KStandardGameAction
m_showMenubarAction = KStandardAction::showMenubar(this, SLOT(toggleMenubar()), actionCollection());
m_showMenubarAction = KStandardAction::showMenubar(this, &MainWindow::toggleMenubar, actionCollection());
}
void MainWindow::undoMove() {
......@@ -934,12 +934,17 @@ void MainWindow::loadGame()
{
QUrl url = dialog->selectedUrls().at(0);
if ( !url.isEmpty() )
loadGame( url, true );
loadGame(url);
}
}
delete dialog;
}
void MainWindow::loadGame(const QUrl & url)
{
loadGame(url, true);
}
void MainWindow::saveGame()
{
if ( !m_dealer )
......
......@@ -67,7 +67,7 @@ public:
~MainWindow();
public Q_SLOTS:
bool loadGame( const QUrl & url, bool addToRecentFiles = true );
bool loadGame( const QUrl & url, bool addToRecentFiles);
void slotShowGameSelectionScreen();
void slotGameSelected(int id);
......@@ -75,6 +75,7 @@ protected Q_SLOTS:
void newGame();
void startRandom();
void loadGame();
void loadGame(const QUrl & url);
void restart();
void newNumberedDeal();
void startNumbered( int gameId, int dealNumber );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment