diff --git a/gamewindow.ui b/gamewindow.ui index 599727e6..4e1777b0 100644 --- a/gamewindow.ui +++ b/gamewindow.ui @@ -286,6 +286,7 @@ + @@ -1102,6 +1103,17 @@ Options... + + + true + + + true + + + Fix Window Size + + true diff --git a/src/ui/qt/game.cpp b/src/ui/qt/game.cpp index f3dd23bd..d9a678dc 100644 --- a/src/ui/qt/game.cpp +++ b/src/ui/qt/game.cpp @@ -130,6 +130,7 @@ void Game::loadSettings() setEngineBlack(empty? false : settings->value("Options/blackIsAiPlayer").toBool()); setEngineWhite(empty ? true : settings->value("Options/whiteIsAiPlayer").toBool()); + setFixWindowSize(empty ? false : settings->value("Options/FixWindowSize").toBool()); setSound(empty ? true : settings->value("Options/Sound").toBool()); setAnimation(empty ? true : settings->value("Options/Animation").toBool()); setShuffling(empty ? true : settings->value("Options/Shuffling").toBool()); @@ -438,6 +439,12 @@ void Game::getAiDepthTime(int &time1, int &time2) time2 = aiThread[WHITE]->getTimeLimit(); } +void Game::setFixWindowSize(bool arg) noexcept +{ + fixWindowSize = arg; + settings->setValue("Options/FixWindowSize", arg); +} + void Game::setAnimation(bool arg) noexcept { hasAnimation = arg; diff --git a/src/ui/qt/game.h b/src/ui/qt/game.h index 5c943817..ee8a28d8 100644 --- a/src/ui/qt/game.h +++ b/src/ui/qt/game.h @@ -220,6 +220,9 @@ public slots: void setEngine(Color color, bool enabled = true); void setEngineBlack(bool enabled); void setEngineWhite(bool enabled); + + // Fix Window Size + void setFixWindowSize(bool arg) noexcept; // Is there a falling animation void setAnimation(bool arg = true) noexcept; @@ -421,6 +424,11 @@ public: void loadSettings(); + bool fixWindowSizeEnabled() + { + return fixWindowSize; + } + bool soundEnabled() { return hasSound; @@ -441,6 +449,9 @@ public: private: + // Fix Windows Size + bool fixWindowSize; + // Is there a falling animation bool hasAnimation; diff --git a/src/ui/qt/gamewindow.cpp b/src/ui/qt/gamewindow.cpp index e0f9d0d4..8cd2e648 100644 --- a/src/ui/qt/gamewindow.cpp +++ b/src/ui/qt/gamewindow.cpp @@ -98,11 +98,6 @@ MillGameWindow::MillGameWindow(QWidget * parent) : const int unith = (deskTopRect.height() - height()) / 2; this->move(unitw, unith); -#if defined(_DEBUG) || defined(QT_UI_TEST_MODE) - this->setFixedWidth(width()); - this->setFixedHeight(height()); -#endif - #ifdef MOBILE_APP_UI // Hide menu bar, toolbar, status bar, etc ui.menuBar->setVisible(false); @@ -201,6 +196,9 @@ void MillGameWindow::initialize() connect(ui.actionEngine2_R, SIGNAL(toggled(bool)), game, SLOT(setEngineWhite(bool))); + connect(ui.actionFixWindowSize, SIGNAL(toggled(bool)), + game, SLOT(setFixWindowSize(bool))); + connect(ui.actionSound_S, SIGNAL(toggled(bool)), game, SLOT(setSound(bool))); @@ -347,8 +345,15 @@ void MillGameWindow::initialize() const int screen_iPhone_SE[] = {640, 1136}; this->resize(QSize(screen_iPhone_SE[0], screen_iPhone_SE[1])); #else /* MOBILE_APP_UI */ - const int h = QApplication::desktop()->height(); - this->resize(QSize(h * 3/4, h * 3/4)); + + // Fix window size + if (game->fixWindowSizeEnabled()) { + setFixedWidth(width()); + setFixedHeight(height()); + } else { + const int h = QApplication::desktop()->height(); + this->resize(QSize(h * 3 / 4, h * 3 / 4)); + } ui.pushButton_back->setVisible(false); ui.pushButton_option->setVisible(false); @@ -374,6 +379,7 @@ void MillGameWindow::initialize() ui.actionEngine1_T->setChecked(game->isAiPlayer[BLACK]); ui.actionEngine2_R->setChecked(game->isAiPlayer[WHITE]); + ui.actionFixWindowSize->setChecked(game->fixWindowSizeEnabled()); ui.actionSound_S->setChecked(game->soundEnabled()); ui.actionAnimation_A->setChecked(game->animationEnabled());