Skip to content

Commit c80fb70

Browse files
authored
Update Debug 1.0
1 parent 4611ec0 commit c80fb70

12 files changed

+1489
-1543
lines changed

Codes/cgobangchessboard.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CGobangChessboard::CGobangChessboard(QWidget *parent)
99
: QLabel(parent)
1010
{
1111
/** [InitializeVirtualChessboard] */
12-
m_virtualChessboard = (CGobangChessman **)new CGobangChessman*[15];
12+
m_virtualChessboard = (CGobangChessman**) new CGobangChessman*[15];
1313
for(int i = 0; i < 15; ++i)
1414
{
1515
m_virtualChessboard[i] = new CGobangChessman[15];
@@ -61,7 +61,7 @@ CGobangChessboard::CGobangChessboard(QWidget *parent)
6161

6262
void CGobangChessboard::restart()
6363
{
64-
// qDebug() << "=====重新开始=====";
64+
qDebug() << "=====重新开始=====";
6565

6666

6767
/** [InitializeVirtualChessboard] */
@@ -151,7 +151,7 @@ void CGobangChessboard::ai()
151151

152152

153153
/** [Play] */
154-
// qDebug() << "White:" << m_virtualChessboard[highestScoreIndexX][highestScoreIndexY].score();
154+
qDebug() << "White:" << m_virtualChessboard[highestScoreIndexX][highestScoreIndexY].score();
155155
this->paintChessman(highestScoreIndexX, highestScoreIndexY, CGobangChessman::CChessmanType::Type_White);
156156
m_virtualChessboard[highestScoreIndexX][highestScoreIndexY].setChessman(CGobangChessman::CChessmanType::Type_White);
157157
m_playerChessmanType = CGobangChessman::CChessmanType::Type_Black;
@@ -1166,7 +1166,7 @@ void CGobangChessboard::mouseReleaseEvent(QMouseEvent *mouseReleaseEvent)
11661166
}
11671167
if(m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].isEmpty())
11681168
{
1169-
// qDebug() << "Black:" << m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].score();
1169+
qDebug() << "Black:" << m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].score();
11701170
this->paintChessman(newChessboardPositionIndexX, newChessboardPositionIndexY, CGobangChessman::CChessmanType::Type_Black);
11711171
m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].setChessman(CGobangChessman::CChessmanType::Type_Black);
11721172
m_playerChessmanType = CGobangChessman::CChessmanType::Type_White;
@@ -1176,10 +1176,9 @@ void CGobangChessboard::mouseReleaseEvent(QMouseEvent *mouseReleaseEvent)
11761176

11771177
void CGobangChessboard::paintChessboard()
11781178
{
1179+
/** [SetPainter] */
11791180
QImage *temporaryImage = new QImage(m_chessboardImagePixelLength, m_chessboardImagePixelLength, QImage::Format_ARGB32);
11801181
QPainter painter;
1181-
1182-
/** [SetPainter] */
11831182
painter.begin(temporaryImage);
11841183
painter.setPen(QPen(COLOR_BLACK));
11851184
painter.setBrush(QBrush(COLOR_BLACK));
@@ -1246,15 +1245,11 @@ void CGobangChessboard::paintChessboard()
12461245
/* [PaintEllipses] **/
12471246

12481247

1249-
/** [LoadPaintedImage] */
1248+
/** [LoadAndSavePaintedImage] */
12501249
painter.end();
12511250
this->setPixmap(QPixmap::fromImage(*temporaryImage));
1252-
/* [LoadPaintedImage] **/
1253-
1254-
1255-
/** [SavePaintedImage] */
12561251
m_vectorPlayImagesHistory.append(temporaryImage);
1257-
/* [SavePaintedImage] **/
1252+
/* [LoadPaintedImage] **/
12581253
}
12591254

12601255
void CGobangChessboard::paintPredictor()
@@ -1290,11 +1285,9 @@ void CGobangChessboard::paintPredictor()
12901285

12911286
bool CGobangChessboard::paintChessman(int indexX, int indexY, CGobangChessman::CChessmanType chessmanType)
12921287
{
1288+
/** [SetPainter] */
12931289
QImage *temporaryImage = new QImage(*m_vectorPlayImagesHistory.last());
12941290
QPainter painter;
1295-
1296-
1297-
/** [SetPainter] */
12981291
painter.begin(temporaryImage);
12991292
switch(chessmanType)
13001293
{

Codes/cloginwindow.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,13 @@ CLoginWindow::CLoginWindow(QWidget *parent)
2828
/* [FilesSystem] **/
2929

3030

31-
/** [WidgetBackground] */
32-
// QPalette palette;
33-
// palette.setBrush(QPalette::Background,QBrush(QPixmap(":/image/png/sign.png").scaled(this->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
34-
// this->setPalette(palette);
35-
/* [WidgetBackground] **/
36-
37-
3831
/** [MessagesLabel] */
3932
/* [MessagesLabel] **/
4033

4134

4235
/** [LineEdits] */
43-
ui->lineEditAccount->setValidator(new QRegExpValidator(QRegExp("[A-Za-z0-9]{0,20}"), this)); //用正则表达式来限制输入
44-
ui->lineEditPassword->setValidator(new QRegExpValidator(QRegExp("[A-Za-z0-9-@#&/*+]{0,20}"), this)); //用正则表达式来限制输入
36+
ui->lineEditAccount->setValidator(new QRegExpValidator(QRegExp("[A-Za-z0-9]{0,30}"), this)); //用正则表达式来限制输入
37+
ui->lineEditPassword->setValidator(new QRegExpValidator(QRegExp("[A-Za-z0-9-@#&/*+]{0,30}"), this)); //用正则表达式来限制输入
4538
/* [LineEdits] **/
4639

4740

Codes/cloginwindow.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ color:rgb(0, 0, 0);</string>
390390
<string/>
391391
</property>
392392
<property name="maxLength">
393-
<number>20</number>
393+
<number>30</number>
394394
</property>
395395
<property name="frame">
396396
<bool>true</bool>
@@ -530,7 +530,7 @@ color:rgb(0, 0, 0);</string>
530530
<string/>
531531
</property>
532532
<property name="maxLength">
533-
<number>20</number>
533+
<number>30</number>
534534
</property>
535535
<property name="frame">
536536
<bool>true</bool>

Codes/cmainwindow.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</font>
2626
</property>
2727
<property name="windowTitle">
28-
<string>IntelligentWindow</string>
28+
<string>IntelligentWindowClient</string>
2929
</property>
3030
<property name="windowIcon">
3131
<iconset>

Codes/cmodifypassworddialog.cpp

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,7 @@ CModifyPasswordDialog::CModifyPasswordDialog(QString account, QWidget *parent) :
4141
CEncrypt encrypt;
4242
ui->lineEditSecretiveQuestion1->setText(encrypt.XOR(userQuestion1, CEncrypt::Model_XOR).data());
4343
ui->lineEditSecretiveQuestion2->setText(encrypt.XOR(userQuestion2, CEncrypt::Model_XOR).data());
44-
connect(ui->lineEditOldPassword, &QLineEdit::textChanged, [&](const QString &lineEditString){
45-
CString checkString(lineEditString);
46-
// if(checkString.CheckChar(checkString.GetStringSize() - 1, CString::Model_Password) == CString::Error_NullChar){
47-
// if(checkString.DeleteChar(checkString.GetStringSize() - 1) == CString::Error_None)
48-
// {
49-
// ui->lineEditOldPassword->setText(checkString.GetQString());
50-
// }
51-
// else
52-
// {
53-
// ui->lineEditOldPassword->clear();
54-
// }
55-
// QMessageBox::warning(this, "提示", "密码只能包含阿拉伯数字、大小写字母以及一部分特殊符号!");
56-
// }
57-
});
58-
connect(ui->lineEditNewPassword, &QLineEdit::textChanged, [&](const QString &lineEditString){
59-
CString checkString(lineEditString);
60-
// if(checkString.CheckChar(checkString.GetStringSize() - 1, CString::Model_Password) == CString::Error_NullChar){
61-
// if(checkString.DeleteChar(checkString.GetStringSize() - 1) == CString::Error_None)
62-
// {
63-
// ui->lineEditNewPassword->setText(checkString.GetQString());
64-
// }
65-
// else
66-
// {
67-
// ui->lineEditNewPassword->clear();
68-
// }
69-
// QMessageBox::warning(this, "提示", "密码只能包含阿拉伯数字、大小写字母以及一部分特殊符号!");
70-
// }
71-
});
44+
ui->lineEditNewPassword->setValidator(new QRegExpValidator(QRegExp("[A-Za-z0-9-@#&/*+]{0,30}"), this)); //用正则表达式来限制输入
7245

7346
/**
7447
* 代码区块【输入框】【结束】
@@ -87,24 +60,18 @@ CModifyPasswordDialog::CModifyPasswordDialog(QString account, QWidget *parent) :
8760
{
8861
QString secretiveAnswer1 = ui->lineEditSecretiveAnswer1->text();
8962
QString secretiveAnswer2 = ui->lineEditSecretiveAnswer2->text();
90-
QString oldPassword = ui->lineEditOldPassword->text();
9163
QString newPassword = ui->lineEditNewPassword->text();
9264

9365
if(secretiveAnswer1 == "" || secretiveAnswer2 == "")
9466
{
9567
QMessageBox::warning(this, "提示", "答案不能为空!");
9668
return;
9769
}
98-
if(oldPassword == "" || newPassword == "")
70+
if(newPassword == "")
9971
{
10072
QMessageBox::warning(this, "提示", "密码不能为空!");
10173
return;
10274
}
103-
if(oldPassword == newPassword)
104-
{
105-
QMessageBox::warning(this, "提示", "两次密码输入一致!");
106-
return;
107-
}
10875

10976
QFileInfoList usersFilesInfoList = m_dirUsersEnc.entryInfoList(QDir::Files | QDir::CaseSensitive); //过滤条件为只限文件并区分大小写
11077

@@ -131,11 +98,6 @@ CModifyPasswordDialog::CModifyPasswordDialog(QString account, QWidget *parent) :
13198
QMessageBox::warning(this, "提示", "第二个秘问答案输入错误!");
13299
return;
133100
}
134-
else if(oldPassword != myencrypt.XOR(userPassword, CEncrypt::Model_XOR).data())
135-
{
136-
QMessageBox::warning(this, "提示", "原密码输入错误!");
137-
return;
138-
}
139101
else
140102
{
141103
QFile file_user_enc(m_path_users_enc + account + ".enc");

Codes/cmodifypassworddialog.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
#include "cstring.h"
1010
#include "cencrypt.h"
1111

12+
#include <QCoreApplication>
1213
#include <QDir>
13-
#include <QFile>
1414
#include <QDialog>
15-
#include <QString>
15+
#include <QFile>
1616
#include <QMessageBox>
17-
#include <QCoreApplication>
17+
#include <QRegExpValidator>
18+
#include <QString>
1819

1920
namespace Ui {
2021
class CModifyPasswordDialog;

0 commit comments

Comments
 (0)