network: 点击网络对战时弹出网络设置对话框

This commit is contained in:
CalciteM 2019-07-28 08:10:50 +08:00
parent e6c4a55aa4
commit 3afd2a7900
3 changed files with 22 additions and 1 deletions

View File

@ -29,5 +29,6 @@ int main(int argc, char *argv[])
NineChessWindow w;
w.show();
w.move((QApplication::desktop()->width() - w.width()) / 4, (QApplication::desktop()->height() - w.height()) / 2);
return a.exec();
}

View File

@ -50,6 +50,8 @@
#include "gamecontroller.h"
#include "gamescene.h"
#include "graphicsconst.h"
#include "server.h"
#include "client.h"
NineChessWindow::NineChessWindow(QWidget * parent) :
QMainWindow(parent),
@ -88,7 +90,7 @@ NineChessWindow::NineChessWindow(QWidget * parent) :
ui.gameView->setRenderHint(QPainter::Antialiasing);
// 因功能限制,使部分功能不可用,将来再添加
ui.actionInternet_I->setDisabled(true);
ui.actionInternet_I->setDisabled(false);
ui.actionSetting_O->setDisabled(true);
// 初始化游戏规则菜单
@ -116,6 +118,9 @@ NineChessWindow::~NineChessWindow()
}
qDeleteAll(ruleActionList);
delete server;
delete client;
}
void NineChessWindow::closeEvent(QCloseEvent *event)
@ -288,6 +293,10 @@ void NineChessWindow::initialize()
QWidget::setWindowFlags(Qt::WindowMaximizeButtonHint |
Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
#endif // SHOW_MAXIMIZED_ON_LOAD
// 网络
server = new Server();
client = new Client();
}
void NineChessWindow::ruleInfo()
@ -750,6 +759,10 @@ void NineChessWindow::on_actionInternet_I_triggered()
{
ui.actionLocal_L->setChecked(false);
ui.actionInternet_I->setChecked(true);
server->show();
client->show();
}
void NineChessWindow::on_actionEngine_E_triggered()

View File

@ -31,6 +31,9 @@
#include "ui_ninechesswindow.h"
#include "config.h"
#include "server.h"
#include "client.h"
class GameScene;
class GameController;
@ -112,6 +115,10 @@ private:
// 定时器
QTimer autoRunTimer;
// 网络
Server *server;
Client *client;
};
#endif // NINECHESSWINDOW_H