diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /build*/ *.kdev4 CMakeLists.txt.user* +.vscode diff --git a/src/kmahjongg.h b/src/kmahjongg.h --- a/src/kmahjongg.h +++ b/src/kmahjongg.h @@ -77,6 +77,7 @@ void showHighscores(); void slotBoardEditor(); void noMovesAvailable(); + void toggleFullscreen(bool fullscreen); private: enum class GameState { Gameplay, @@ -112,6 +113,7 @@ KGameClock * m_gameTimer; KToggleAction * m_pauseAction; + KToggleAction * m_fullscreenAction; KToggleAction * m_demoAction; static const QString gameMagic; diff --git a/src/kmahjongg.cpp b/src/kmahjongg.cpp --- a/src/kmahjongg.cpp +++ b/src/kmahjongg.cpp @@ -169,6 +169,10 @@ actionCollection()->setDefaultShortcut(anglecw, Qt::Key_G); connect(anglecw, &QAction::triggered, m_gameView, &GameView::angleSwitchCW); + m_fullscreenAction = KStandardAction::fullScreen( + this, &KMahjongg::toggleFullscreen, this, actionCollection() + ); + m_demoAction = KStandardGameAction::demo(this, SLOT(demoMode()), actionCollection()); KStandardGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); @@ -188,6 +192,15 @@ setupGUI(qApp->desktop()->availableGeometry().size() * 0.7); } +void KMahjongg::toggleFullscreen(bool fullscreen) +{ + if (fullscreen) { + setWindowState(Qt::WindowState::WindowFullScreen); + } else { + setWindowState(Qt::WindowState::WindowNoState); + } +} + void KMahjongg::setupStatusBar() { m_gameTimerLabel = new QLabel(i18n("Time: 0:00:00"), statusBar()); diff --git a/src/kmahjonggui.rc b/src/kmahjonggui.rc --- a/src/kmahjonggui.rc +++ b/src/kmahjonggui.rc @@ -1,6 +1,6 @@ +