config: Rename MOBILE_APP_UI to QT_MOBILE_APP_UI
This commit is contained in:
parent
8054e4b486
commit
c7fc29152d
|
@ -45,7 +45,8 @@
|
|||
|
||||
#define NET_FIGHT_SUPPORT
|
||||
|
||||
//#define MOBILE_APP_UI
|
||||
/// Qt simple GUI like a mobile app (WIP)
|
||||
//#define QT_MOBILE_APP_UI
|
||||
|
||||
//#define QT_UI_TEST_MODE
|
||||
|
||||
|
@ -123,7 +124,7 @@
|
|||
#define PLAYER_DRAW_SEAT_NUMBER
|
||||
#endif
|
||||
|
||||
#ifndef MOBILE_APP_UI
|
||||
#ifndef QT_MOBILE_APP_UI
|
||||
#define SAVE_GAMEBOOK_WHEN_ACTION_NEW_TRIGGERED
|
||||
#endif
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ TRANSLATIONS += millgame-qt_zh_CN.ts
|
|||
DEFINES += DISABLE_PERFECT_AI
|
||||
|
||||
# Mobile App support
|
||||
#DEFINES += MOBILE_APP_UI
|
||||
#DEFINES += QT_MOBILE_APP_UI
|
||||
|
||||
# With C++17 support
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
|
|
|
@ -90,24 +90,24 @@ void BoardItem::paint(QPainter *painter,
|
|||
Q_UNUSED(widget)
|
||||
|
||||
// Fill shadow
|
||||
#ifndef MOBILE_APP_UI
|
||||
#ifndef QT_MOBILE_APP_UI
|
||||
QColor shadowColor(128, 42, 42);
|
||||
shadowColor.setAlphaF(0.3);
|
||||
painter->fillRect(boundingRect(), QBrush(shadowColor));
|
||||
#endif /* ! MOBILE_APP_UI */
|
||||
#endif /* ! QT_MOBILE_APP_UI */
|
||||
|
||||
// Fill in picture
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QColor(239, 239, 239));
|
||||
painter->drawRect(-size / 2, -size / 2, size, size);
|
||||
#else
|
||||
painter->drawPixmap(-size / 2, -size / 2, size, size,
|
||||
QPixmap(":/image/resources/image/board.png"));
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
// Solid line brush
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
QPen pen(QBrush(QColor(241, 156, 159)), LINE_WEIGHT, Qt::SolidLine, Qt::SquareCap, Qt::BevelJoin);
|
||||
#else
|
||||
QPen pen(QBrush(QColor(178, 34, 34)), LINE_WEIGHT, Qt::SolidLine, Qt::SquareCap, Qt::BevelJoin);
|
||||
|
|
|
@ -71,9 +71,9 @@ Game::Game(
|
|||
// The difference is that the background in view does not change with the view transformation,
|
||||
// and the background in scene changes with the view transformation
|
||||
//scene.setBackgroundBrush(QPixmap(":/image/resources/image/background.png"));
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
scene.setBackgroundBrush(QColor(239, 239, 239));
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
//resetAiPlayers();
|
||||
createAiThreads();
|
||||
|
@ -877,7 +877,7 @@ bool Game::actionPiece(QPointF p)
|
|||
|
||||
// When you click the chessboard while browsing the history, it is considered repentance
|
||||
if (currentRow != manualListModel.rowCount() - 1) {
|
||||
#ifndef MOBILE_APP_UI
|
||||
#ifndef QT_MOBILE_APP_UI
|
||||
// Define new dialog box
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
@ -890,7 +890,7 @@ bool Game::actionPiece(QPointF p)
|
|||
(msgBox.button(QMessageBox::Cancel))->setText(tr("No"));
|
||||
|
||||
if (QMessageBox::Ok == msgBox.exec()) {
|
||||
#endif /* !MOBILE_APP_UI */
|
||||
#endif /* !QT_MOBILE_APP_UI */
|
||||
const int rowCount = manualListModel.rowCount();
|
||||
const int removeCount = rowCount - currentRow - 1;
|
||||
manualListModel.removeRows(currentRow + 1, rowCount - currentRow - 1);
|
||||
|
@ -909,11 +909,11 @@ bool Game::actionPiece(QPointF p)
|
|||
updateScence();
|
||||
message = QString::fromStdString(getTips());
|
||||
emit statusBarChanged(message);
|
||||
#ifndef MOBILE_APP_UI
|
||||
#ifndef QT_MOBILE_APP_UI
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
#endif /* !MOBILE_APP_UI */
|
||||
#endif /* !QT_MOBILE_APP_UI */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ MillGameWindow::MillGameWindow(QWidget * parent) :
|
|||
const int unith = (deskTopRect.height() - height()) / 2;
|
||||
this->move(unitw, unith);
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
// Hide menu bar, toolbar, status bar, etc
|
||||
ui.menuBar->setVisible(false);
|
||||
ui.mainToolBar->setVisible(false);
|
||||
|
@ -185,7 +185,7 @@ void MillGameWindow::initialize()
|
|||
connect(ui.actionResign_G, SIGNAL(triggered()),
|
||||
game, SLOT(resign()));
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
connect(ui.pushButton_resign, SIGNAL(released()),
|
||||
game, SLOT(resign()));
|
||||
#endif
|
||||
|
@ -319,13 +319,13 @@ void MillGameWindow::initialize()
|
|||
connect(ui.actionPrevious_B, &QAction::triggered,
|
||||
this, &MillGameWindow::on_actionRowChange);
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
connect(ui.pushButton_retractMove, &QPushButton::released,
|
||||
this, &MillGameWindow::on_actionRowChange);
|
||||
|
||||
connect(ui.pushButton_newGame, &QPushButton::released,
|
||||
this, &MillGameWindow::on_actionNew_N_triggered);
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
connect(ui.actionNext_F, &QAction::triggered,
|
||||
this, &MillGameWindow::on_actionRowChange);
|
||||
|
@ -341,7 +341,7 @@ void MillGameWindow::initialize()
|
|||
on_actionRowChange();
|
||||
|
||||
// Set form size
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
#if 0
|
||||
const int screen_iPhone_XS_Max[] = {1242, 2688};
|
||||
const int screen_iPhone_XS[] = {1125, 2436};
|
||||
|
@ -356,7 +356,7 @@ void MillGameWindow::initialize()
|
|||
#endif
|
||||
const int screen_iPhone_SE[] = {640, 1136};
|
||||
this->resize(QSize(screen_iPhone_SE[0], screen_iPhone_SE[1]));
|
||||
#else /* MOBILE_APP_UI */
|
||||
#else /* QT_MOBILE_APP_UI */
|
||||
|
||||
// Fix window size
|
||||
if (game->fixWindowSizeEnabled()) {
|
||||
|
@ -375,7 +375,7 @@ void MillGameWindow::initialize()
|
|||
ui.pushButton_resign->setVisible(false);
|
||||
ui.pushButton_retractMove->setVisible(false);
|
||||
ui.pushButton_hint->setVisible(false);
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
#ifdef SHOW_MAXIMIZED_ON_LOAD
|
||||
showMaximized();
|
||||
|
@ -383,10 +383,10 @@ void MillGameWindow::initialize()
|
|||
Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
|
||||
#endif // SHOW_MAXIMIZED_ON_LOAD
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
ui.pushButton_option->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
connect(ui.pushButton_option, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ctxMenu(const QPoint &)));
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
ui.actionEngine1_T->setChecked(game->isAiPlayer[WHITE]);
|
||||
ui.actionEngine2_R->setChecked(game->isAiPlayer[BLACK]);
|
||||
|
@ -409,14 +409,14 @@ void MillGameWindow::initialize()
|
|||
ui.actionDeveloperMode->setChecked(gameOptions.getDeveloperMode());
|
||||
}
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
void MillGameWindow::ctxMenu(const QPoint &pos)
|
||||
{
|
||||
QMenu *menu = new QMenu;
|
||||
menu->addAction(tr("Test Item"), this, SLOT(on_actionNew_N_triggered()));
|
||||
menu->exec(ui.pushButton_option->mapToGlobal(pos));
|
||||
}
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
void MillGameWindow::ruleInfo()
|
||||
{
|
||||
|
@ -751,9 +751,9 @@ void MillGameWindow::on_actionRowChange()
|
|||
if (obsender == ui.actionBegin_S) {
|
||||
ui.listView->setCurrentIndex(model->index(0, 0));
|
||||
} else if (obsender == ui.actionPrevious_B
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
|| obsender == ui.pushButton_retractMove
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
) {
|
||||
if (currentRow > 0) {
|
||||
ui.listView->setCurrentIndex(model->index(currentRow - 1, 0));
|
||||
|
@ -1035,7 +1035,7 @@ void MillGameWindow::on_actionAbout_A_triggered()
|
|||
delete dialog;
|
||||
}
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
void MillGameWindow::mousePressEvent(QMouseEvent *mouseEvent)
|
||||
{
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
|
@ -1059,4 +1059,4 @@ void MillGameWindow::mouseReleaseEvent(QMouseEvent *mouseEvent)
|
|||
m_move = false;
|
||||
}
|
||||
}
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
|
|
@ -50,18 +50,18 @@ public:
|
|||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
void mousePressEvent(QMouseEvent *mouseEvent) override;
|
||||
void mouseMoveEvent(QMouseEvent *mouseEvent) override;
|
||||
void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
private slots:
|
||||
void initialize();
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
void ctxMenu(const QPoint &pos);
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
void actionRules_triggered();
|
||||
|
||||
|
@ -120,7 +120,7 @@ private:
|
|||
QFile file;
|
||||
QTimer autoRunTimer;
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
bool m_move {false};
|
||||
QPoint m_startPoint;
|
||||
QPoint m_windowPoint;
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
constexpr short BOARD_SIZE = 500;
|
||||
#else
|
||||
constexpr short BOARD_SIZE = 550;
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
constexpr short BOARD_MINISIZE = 150; // Minimum width and height, i.e. 1 / 4 Size
|
||||
constexpr short PIECE_SIZE = 56;
|
||||
|
|
|
@ -48,11 +48,11 @@ PieceItem::PieceItem(QGraphicsItem *parent) :
|
|||
|
||||
removeLineWeight = LINE_WEIGHT * 5;
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
selectLineColor = Qt::gray;
|
||||
#else
|
||||
selectLineColor = Qt::darkYellow;
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
|
||||
removeLineColor = QColor(227, 23, 13);
|
||||
removeLineColor.setAlphaF(0.9);
|
||||
|
@ -84,26 +84,26 @@ void PieceItem::paint(QPainter *painter,
|
|||
switch (model) {
|
||||
case Models::whitePiece:
|
||||
// If the model is white, draw white pieces
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QColor(0, 93, 172));
|
||||
painter->drawEllipse(-size / 2, -size / 2, size, size);
|
||||
#else
|
||||
painter->drawPixmap(-size / 2, -size / 2, size, size,
|
||||
QPixmap(":/image/resources/image/white_piece.png"));
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
break;
|
||||
|
||||
case Models::blackPiece:
|
||||
// If the model is black, draw black pieces
|
||||
#ifdef MOBILE_APP_UI
|
||||
#ifdef QT_MOBILE_APP_UI
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QColor(231, 36, 46));
|
||||
painter->drawEllipse(-size / 2, -size / 2, size, size);
|
||||
#else
|
||||
painter->drawPixmap(-size / 2, -size / 2, size, size,
|
||||
QPixmap(":/image/resources/image/black_piece.png"));
|
||||
#endif /* MOBILE_APP_UI */
|
||||
#endif /* QT_MOBILE_APP_UI */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue