-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: network matchmaking implementation and optimization
- Loading branch information
Showing
20 changed files
with
375 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2019~2020 偕臧 All rights reserved. | ||
* Copyright (C) 2019~2024 偕臧 All rights reserved. | ||
* | ||
* Author: xmuli(偕臧) [email protected] | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2019~2020 偕臧 All rights reserved. | ||
* Copyright (C) 2019~2024 偕臧 All rights reserved. | ||
* | ||
* Author: xmuli(偕臧) [email protected] | ||
* | ||
|
@@ -25,24 +25,24 @@ | |
#include <QDialog> | ||
#include <QFont> | ||
|
||
namespace Ui { | ||
class AboutAuthor; | ||
namespace Ui | ||
{ | ||
class AboutAuthor; | ||
} | ||
|
||
class AboutAuthor : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit AboutAuthor(QWidget *parent = 0); | ||
explicit AboutAuthor(QWidget* parent = 0); | ||
~AboutAuthor(); | ||
|
||
protected: | ||
virtual void paintEvent(QPaintEvent *event) override; | ||
virtual void paintEvent(QPaintEvent* event) override; | ||
|
||
private: | ||
Ui::AboutAuthor *ui; | ||
QWidget * QDialog; | ||
Ui::AboutAuthor* ui; | ||
}; | ||
|
||
#endif // ABOUTAUTHOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ | |
<string/> | ||
</property> | ||
<property name="pixmap"> | ||
<pixmap resource="chooseresource.qrc">:/images/Alipay.png</pixmap> | ||
<pixmap resource="resources/res.qrc">:/images/Alipay.png</pixmap> | ||
</property> | ||
<property name="scaledContents"> | ||
<bool>true</bool> | ||
|
@@ -106,7 +106,7 @@ | |
<string/> | ||
</property> | ||
<property name="pixmap"> | ||
<pixmap resource="chooseresource.qrc">:/images/WeChat.png</pixmap> | ||
<pixmap resource="resources/res.qrc">:/images/WeChat.png</pixmap> | ||
</property> | ||
<property name="scaledContents"> | ||
<bool>true</bool> | ||
|
@@ -145,19 +145,25 @@ | |
<widget class="QTextBrowser" name="textBrowser"> | ||
<property name="html"> | ||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> | ||
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> | ||
p, li { white-space: pre-wrap; } | ||
</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> | ||
hr { height: 1px; border-width: 0; } | ||
li.unchecked::marker { content: "\2610"; } | ||
li.checked::marker { content: "\2612"; } | ||
</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'华文楷体';">作者:</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'华文楷体';"> </span><a href="https://github.com/XMuli"><span style=" font-family:'华文楷体'; text-decoration: underline; color:#007af4;">偕臧</span></a><span style=" font-family:'华文楷体';"> Copyri © 2019-2022</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'华文楷体';"> </span><a href="https://github.com/XMuli"><span style=" font-family:'华文楷体'; text-decoration: underline; color:#007af4;">偕臧</span></a><span style=" font-family:'华文楷体';"> Copyri © 2019-2024</span></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'华文楷体'; text-decoration: underline; color:#007af4;"><br /></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';">贡献者: </span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/Bruce-Ch"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">Bruce-Ch</span></a></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/BlueArvin"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">BlueArvin</span></a></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/Ubuntuser2012"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">Ubuntuser2012</span></a></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/kira-yamatoo"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">kira-yamatoo</span></a></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/hmsjy2017"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">hmsjy2017</span></a></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong';"><br /></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/zjuyk"><span style=" text-decoration: underline; color:#007af4;">zjuyk</span></a></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> - </span><a href="https://github.com/ryanfortner"><span style=" text-decoration: underline; color:#007af4;">ryanfortner</span></a></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; text-decoration: underline; color:#007af4;"><br /></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong'; text-decoration: underline; color:#007af4;"><br /></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong';"><br /></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';">项目:</span></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> 关于 </span><a href="https://github.com/XMuli/chineseChess"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">ChinessChess</span></a><span style=" font-family:'FangSong';"> 此开源项目,兴趣之做;说明都在这里 [</span><a href="https://github.com/XMuli/chineseChess/blob/master/README.zh_CN.md"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">中文</span></a><span style=" font-family:'FangSong';"> | </span><a href="https://github.com/XMuli/chineseChess/blob/master/README.md"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">English</span></a><span style=" font-family:'FangSong';">]</span></p> | ||
|
@@ -169,7 +175,7 @@ p, li { white-space: pre-wrap; } | |
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';"> 所有参与贡献的,亦都会留名在此。热爱开源,热爱生命,热爱生活。</span></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong';"><br /></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong';"><br /></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';">Bolg: </span><a href="https://ifmet.cn"><span style=" font-family:'FangSong'; text-decoration: underline; color:#007af4;">ifmet.cn</span></a></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';">Bolg: </span><a href="https://xmuli.tech"><span style=" text-decoration: underline; color:#007af4;">xmuli.tech</span></a></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong'; text-decoration: underline; color:#007af4;"><br /></p> | ||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'FangSong';">Gmail: [email protected]</span></p> | ||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'FangSong'; text-decoration: underline; color:#007af4;"><br /></p> | ||
|
@@ -187,8 +193,7 @@ p, li { white-space: pre-wrap; } | |
</layout> | ||
</widget> | ||
<resources> | ||
<include location="chooseresource.qrc"/> | ||
<include location="chooseresource.qrc"/> | ||
<include location="resources/res.qrc"/> | ||
</resources> | ||
<connections> | ||
<connection> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2019~2020 偕臧 All rights reserved. | ||
* Copyright (C) 2019~2024 偕臧 All rights reserved. | ||
* | ||
* Author: xmuli(偕臧) [email protected] | ||
* | ||
|
@@ -21,6 +21,7 @@ | |
*/ | ||
#include "ChessBoard.h" | ||
#include "ui_ChessBoard.h" | ||
#include <mutex> | ||
|
||
ChessBoard::ChessBoard(QWidget *parent) : | ||
QMainWindow(parent), | ||
|
@@ -409,31 +410,11 @@ bool ChessBoard:: isGeneral() | |
return false; | ||
} | ||
|
||
void ChessBoard::setNetworkGroupShow(const bool &show) | ||
void ChessBoard::showNetworkGui(const bool &show) | ||
{ | ||
ui->networkGroup->setVisible(show); | ||
} | ||
|
||
/*! | ||
* \brief ChessBoard::setNetworkGroupText | ||
* \param group group的名称 | ||
* \param input 输入栏 IP+prot | ||
* \param btn 按钮的名称,监听或者连接 | ||
* \param statue 连接结果的名称 | ||
*/ | ||
void ChessBoard::setNetworkGroupText(const QString &group, const QString &input, const QString &btn, const QString &statue) | ||
{ | ||
ui->networkGroup->setTitle(group); | ||
ui->lineEdit->setText(input); | ||
ui->btnTcpConnect->setText(btn); | ||
ui->labConnectStatus->setText(statue); | ||
} | ||
|
||
void ChessBoard::setstatusText(const QString &statue) | ||
{ | ||
ui->labConnectStatus->setText(statue); | ||
} | ||
|
||
//鼠标按下事件 | ||
//void ChessBoard::mousePressEvent(QMouseEvent *ev) | ||
//{ | ||
|
@@ -810,6 +791,13 @@ void ChessBoard::clickPieces(int id, int &row, int &col) | |
else { | ||
tryMoveStone(id, row, col); | ||
} | ||
|
||
// 初次按下时,自启动计时器 | ||
std::once_flag flag; | ||
std::call_once(flag, [&]() { | ||
m_bIsStart = false; | ||
on_pushButton_start_clicked(); | ||
}); | ||
} | ||
|
||
void ChessBoard::trySelectStone(int id) | ||
|
@@ -948,17 +936,17 @@ void ChessBoard::updateTime() | |
void ChessBoard::on_pushButton_start_clicked() | ||
{ | ||
if(!m_bIsStart) //尚未开始 开始计时 | ||
{ | ||
m_timer->start(1000); | ||
ui->pushButton_start->setText("暂停"); | ||
} | ||
else //已经开始,暂停 | ||
{ | ||
m_timer->stop(); | ||
ui->pushButton_start->setText("继续"); | ||
} | ||
{ | ||
m_timer->start(1000); | ||
ui->pushButton_start->setText("暂停"); | ||
} | ||
else //已经开始,暂停 | ||
{ | ||
m_timer->stop(); | ||
ui->pushButton_start->setText("继续"); | ||
} | ||
|
||
m_bIsStart = !m_bIsStart; | ||
m_bIsStart = !m_bIsStart; | ||
} | ||
|
||
void ChessBoard::on_pushButton_reset_clicked() | ||
|
@@ -1001,14 +989,4 @@ void ChessBoard::on_pushButton_toMenu_clicked() | |
emit this->toMenu(); | ||
} | ||
|
||
void ChessBoard::on_lineEdit_textChanged(const QString &arg1) | ||
{ | ||
emit sigLineEditTextChanged(arg1); | ||
} | ||
|
||
|
||
void ChessBoard::on_btnTcpConnect_released() | ||
{ | ||
emit sigBtnTcpConnectReleased(); | ||
} | ||
|
Oops, something went wrong.