Commit 58de38c3 authored by Oleg Solovyov's avatar Oleg Solovyov 🐴
Browse files

Port to KNSWidgets::Action class

parent 1a82b451
Pipeline #153470 passed with stage
in 42 seconds
......@@ -63,7 +63,7 @@ target_link_libraries(kigo
KF5::XmlGui
KF5::KIOWidgets # KUrlRequester
KF5::TextWidgets # KPluralHandlingSpinBox
KF5::NewStuff
KF5::NewStuffWidgets
KF5::DBusAddons
KF5::Crash
Qt${QT_MAJOR_VERSION}::Svg
......
......@@ -19,7 +19,6 @@
#include <QAction>
#include <KActionCollection>
#include <KConfigDialog>
#include <KNS3/QtQuickDialogWrapper>
#include <KStandardGameAction>
#include <KToggleAction>
#include <QIcon>
......@@ -140,17 +139,6 @@ bool MainWindow::loadGame(const QString &fileName)
}
}
void MainWindow::getMoreGames()
{
KNS3::QtQuickDialogWrapper dialog(QStringLiteral("kigo-games.knsrc"));
const QList<KNSCore::EntryInternal> entries = dialog.exec();
/*KNS3::Entry::List entries = dialog.changedEntries();
if (entries.size() > 0) {
// do something with the modified entries here if you want
// such as rescaning your data folder or whatnot
}*/
}
void MainWindow::backendError()
{
m_gameView->setInteractive(false);
......@@ -390,10 +378,9 @@ void MainWindow::setupActions()
m_newGameAction = KStandardGameAction::gameNew(this, &MainWindow::newGame, actionCollection());
m_loadGameAction = KStandardGameAction::load(
this, qOverload<>(&MainWindow::loadGame), actionCollection());
m_getMoreGamesAction = new QAction(QIcon::fromTheme( QStringLiteral( "get-hot-new-stuff") ), i18nc("@action", "Get More Games..." ), this);
m_getMoreGamesAction = new KNSWidgets::Action(i18nc("@action", "Get More Games..." ), QStringLiteral("kigo-games.knsrc"), actionCollection());
actionCollection()->setDefaultShortcut(m_getMoreGamesAction, Qt::CTRL | Qt::Key_G);
m_getMoreGamesAction->setToolTip(i18nc("@action", "Get More Games..."));
connect(m_getMoreGamesAction, &QAction::triggered, this, &MainWindow::getMoreGames);
actionCollection()->addAction( QStringLiteral( "get_more_games" ), m_getMoreGamesAction);
m_saveAction = KStandardGameAction::save(this, &MainWindow::saveGame, actionCollection());
KStandardGameAction::quit(this, &QWidget::close, actionCollection());
......
......@@ -9,6 +9,8 @@
#include <KXmlGuiWindow>
#include <KNSWidgets/Action>
class QAction;
class KToggleAction;
class QDockWidget;
......@@ -40,7 +42,6 @@ private Q_SLOTS:
void newGame(); ///< Configure new game
void loadGame(); ///< Configure loaded game
bool loadGame(const QString &fileName);
void getMoreGames();
void backendError(); ///<
void saveGame(); ///< Save current game state
void startGame(); ///< React on start button
......@@ -77,7 +78,7 @@ private:
QAction *m_newGameAction;
QAction *m_loadGameAction;
QAction *m_getMoreGamesAction;
KNSWidgets::Action *m_getMoreGamesAction;
QAction *m_saveAction; ///< Action to save the current game
QAction *m_undoMoveAction; ///< Action to jump to the last move
QAction *m_redoMoveAction; ///< Action to jump to the next move
......
Supports Markdown
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