qt: Add Fix Window Size option menu item
This commit is contained in:
parent
0eaf8d5134
commit
11449d0a0f
|
@ -286,6 +286,7 @@
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionSetting_O"/>
|
<addaction name="actionSetting_O"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionFixWindowSize"/>
|
||||||
<addaction name="actionToolBar_T"/>
|
<addaction name="actionToolBar_T"/>
|
||||||
<addaction name="actionDockBar_D"/>
|
<addaction name="actionDockBar_D"/>
|
||||||
<addaction name="actionMusic_M"/>
|
<addaction name="actionMusic_M"/>
|
||||||
|
@ -1102,6 +1103,17 @@
|
||||||
<string>Options...</string>
|
<string>Options...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionFixWindowSize">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fix Window Size</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="actionToolBar_T">
|
<action name="actionToolBar_T">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
|
@ -130,6 +130,7 @@ void Game::loadSettings()
|
||||||
|
|
||||||
setEngineBlack(empty? false : settings->value("Options/blackIsAiPlayer").toBool());
|
setEngineBlack(empty? false : settings->value("Options/blackIsAiPlayer").toBool());
|
||||||
setEngineWhite(empty ? true : settings->value("Options/whiteIsAiPlayer").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());
|
setSound(empty ? true : settings->value("Options/Sound").toBool());
|
||||||
setAnimation(empty ? true : settings->value("Options/Animation").toBool());
|
setAnimation(empty ? true : settings->value("Options/Animation").toBool());
|
||||||
setShuffling(empty ? true : settings->value("Options/Shuffling").toBool());
|
setShuffling(empty ? true : settings->value("Options/Shuffling").toBool());
|
||||||
|
@ -438,6 +439,12 @@ void Game::getAiDepthTime(int &time1, int &time2)
|
||||||
time2 = aiThread[WHITE]->getTimeLimit();
|
time2 = aiThread[WHITE]->getTimeLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::setFixWindowSize(bool arg) noexcept
|
||||||
|
{
|
||||||
|
fixWindowSize = arg;
|
||||||
|
settings->setValue("Options/FixWindowSize", arg);
|
||||||
|
}
|
||||||
|
|
||||||
void Game::setAnimation(bool arg) noexcept
|
void Game::setAnimation(bool arg) noexcept
|
||||||
{
|
{
|
||||||
hasAnimation = arg;
|
hasAnimation = arg;
|
||||||
|
|
|
@ -220,6 +220,9 @@ public slots:
|
||||||
void setEngine(Color color, bool enabled = true);
|
void setEngine(Color color, bool enabled = true);
|
||||||
void setEngineBlack(bool enabled);
|
void setEngineBlack(bool enabled);
|
||||||
void setEngineWhite(bool enabled);
|
void setEngineWhite(bool enabled);
|
||||||
|
|
||||||
|
// Fix Window Size
|
||||||
|
void setFixWindowSize(bool arg) noexcept;
|
||||||
|
|
||||||
// Is there a falling animation
|
// Is there a falling animation
|
||||||
void setAnimation(bool arg = true) noexcept;
|
void setAnimation(bool arg = true) noexcept;
|
||||||
|
@ -421,6 +424,11 @@ public:
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
|
||||||
|
bool fixWindowSizeEnabled()
|
||||||
|
{
|
||||||
|
return fixWindowSize;
|
||||||
|
}
|
||||||
|
|
||||||
bool soundEnabled()
|
bool soundEnabled()
|
||||||
{
|
{
|
||||||
return hasSound;
|
return hasSound;
|
||||||
|
@ -441,6 +449,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// Fix Windows Size
|
||||||
|
bool fixWindowSize;
|
||||||
|
|
||||||
// Is there a falling animation
|
// Is there a falling animation
|
||||||
bool hasAnimation;
|
bool hasAnimation;
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,6 @@ MillGameWindow::MillGameWindow(QWidget * parent) :
|
||||||
const int unith = (deskTopRect.height() - height()) / 2;
|
const int unith = (deskTopRect.height() - height()) / 2;
|
||||||
this->move(unitw, unith);
|
this->move(unitw, unith);
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(QT_UI_TEST_MODE)
|
|
||||||
this->setFixedWidth(width());
|
|
||||||
this->setFixedHeight(height());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MOBILE_APP_UI
|
#ifdef MOBILE_APP_UI
|
||||||
// Hide menu bar, toolbar, status bar, etc
|
// Hide menu bar, toolbar, status bar, etc
|
||||||
ui.menuBar->setVisible(false);
|
ui.menuBar->setVisible(false);
|
||||||
|
@ -201,6 +196,9 @@ void MillGameWindow::initialize()
|
||||||
connect(ui.actionEngine2_R, SIGNAL(toggled(bool)),
|
connect(ui.actionEngine2_R, SIGNAL(toggled(bool)),
|
||||||
game, SLOT(setEngineWhite(bool)));
|
game, SLOT(setEngineWhite(bool)));
|
||||||
|
|
||||||
|
connect(ui.actionFixWindowSize, SIGNAL(toggled(bool)),
|
||||||
|
game, SLOT(setFixWindowSize(bool)));
|
||||||
|
|
||||||
connect(ui.actionSound_S, SIGNAL(toggled(bool)),
|
connect(ui.actionSound_S, SIGNAL(toggled(bool)),
|
||||||
game, SLOT(setSound(bool)));
|
game, SLOT(setSound(bool)));
|
||||||
|
|
||||||
|
@ -347,8 +345,15 @@ void MillGameWindow::initialize()
|
||||||
const int screen_iPhone_SE[] = {640, 1136};
|
const int screen_iPhone_SE[] = {640, 1136};
|
||||||
this->resize(QSize(screen_iPhone_SE[0], screen_iPhone_SE[1]));
|
this->resize(QSize(screen_iPhone_SE[0], screen_iPhone_SE[1]));
|
||||||
#else /* MOBILE_APP_UI */
|
#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_back->setVisible(false);
|
||||||
ui.pushButton_option->setVisible(false);
|
ui.pushButton_option->setVisible(false);
|
||||||
|
@ -374,6 +379,7 @@ void MillGameWindow::initialize()
|
||||||
ui.actionEngine1_T->setChecked(game->isAiPlayer[BLACK]);
|
ui.actionEngine1_T->setChecked(game->isAiPlayer[BLACK]);
|
||||||
ui.actionEngine2_R->setChecked(game->isAiPlayer[WHITE]);
|
ui.actionEngine2_R->setChecked(game->isAiPlayer[WHITE]);
|
||||||
|
|
||||||
|
ui.actionFixWindowSize->setChecked(game->fixWindowSizeEnabled());
|
||||||
ui.actionSound_S->setChecked(game->soundEnabled());
|
ui.actionSound_S->setChecked(game->soundEnabled());
|
||||||
ui.actionAnimation_A->setChecked(game->animationEnabled());
|
ui.actionAnimation_A->setChecked(game->animationEnabled());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue