Skip to content

Commit

Permalink
Update Debug 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ProYRB authored Apr 10, 2021
1 parent 4611ec0 commit c80fb70
Show file tree
Hide file tree
Showing 12 changed files with 1,489 additions and 1,543 deletions.
23 changes: 8 additions & 15 deletions Codes/cgobangchessboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CGobangChessboard::CGobangChessboard(QWidget *parent)
: QLabel(parent)
{
/** [InitializeVirtualChessboard] */
m_virtualChessboard = (CGobangChessman **)new CGobangChessman*[15];
m_virtualChessboard = (CGobangChessman**) new CGobangChessman*[15];
for(int i = 0; i < 15; ++i)
{
m_virtualChessboard[i] = new CGobangChessman[15];
Expand Down Expand Up @@ -61,7 +61,7 @@ CGobangChessboard::CGobangChessboard(QWidget *parent)

void CGobangChessboard::restart()
{
// qDebug() << "=====重新开始=====";
qDebug() << "=====重新开始=====";


/** [InitializeVirtualChessboard] */
Expand Down Expand Up @@ -151,7 +151,7 @@ void CGobangChessboard::ai()


/** [Play] */
// qDebug() << "White:" << m_virtualChessboard[highestScoreIndexX][highestScoreIndexY].score();
qDebug() << "White:" << m_virtualChessboard[highestScoreIndexX][highestScoreIndexY].score();
this->paintChessman(highestScoreIndexX, highestScoreIndexY, CGobangChessman::CChessmanType::Type_White);
m_virtualChessboard[highestScoreIndexX][highestScoreIndexY].setChessman(CGobangChessman::CChessmanType::Type_White);
m_playerChessmanType = CGobangChessman::CChessmanType::Type_Black;
Expand Down Expand Up @@ -1166,7 +1166,7 @@ void CGobangChessboard::mouseReleaseEvent(QMouseEvent *mouseReleaseEvent)
}
if(m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].isEmpty())
{
// qDebug() << "Black:" << m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].score();
qDebug() << "Black:" << m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].score();
this->paintChessman(newChessboardPositionIndexX, newChessboardPositionIndexY, CGobangChessman::CChessmanType::Type_Black);
m_virtualChessboard[newChessboardPositionIndexX][newChessboardPositionIndexY].setChessman(CGobangChessman::CChessmanType::Type_Black);
m_playerChessmanType = CGobangChessman::CChessmanType::Type_White;
Expand All @@ -1176,10 +1176,9 @@ void CGobangChessboard::mouseReleaseEvent(QMouseEvent *mouseReleaseEvent)

void CGobangChessboard::paintChessboard()
{
/** [SetPainter] */
QImage *temporaryImage = new QImage(m_chessboardImagePixelLength, m_chessboardImagePixelLength, QImage::Format_ARGB32);
QPainter painter;

/** [SetPainter] */
painter.begin(temporaryImage);
painter.setPen(QPen(COLOR_BLACK));
painter.setBrush(QBrush(COLOR_BLACK));
Expand Down Expand Up @@ -1246,15 +1245,11 @@ void CGobangChessboard::paintChessboard()
/* [PaintEllipses] **/


/** [LoadPaintedImage] */
/** [LoadAndSavePaintedImage] */
painter.end();
this->setPixmap(QPixmap::fromImage(*temporaryImage));
/* [LoadPaintedImage] **/


/** [SavePaintedImage] */
m_vectorPlayImagesHistory.append(temporaryImage);
/* [SavePaintedImage] **/
/* [LoadPaintedImage] **/
}

void CGobangChessboard::paintPredictor()
Expand Down Expand Up @@ -1290,11 +1285,9 @@ void CGobangChessboard::paintPredictor()

bool CGobangChessboard::paintChessman(int indexX, int indexY, CGobangChessman::CChessmanType chessmanType)
{
/** [SetPainter] */
QImage *temporaryImage = new QImage(*m_vectorPlayImagesHistory.last());
QPainter painter;


/** [SetPainter] */
painter.begin(temporaryImage);
switch(chessmanType)
{
Expand Down
11 changes: 2 additions & 9 deletions Codes/cloginwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,13 @@ CLoginWindow::CLoginWindow(QWidget *parent)
/* [FilesSystem] **/


/** [WidgetBackground] */
// QPalette palette;
// palette.setBrush(QPalette::Background,QBrush(QPixmap(":/image/png/sign.png").scaled(this->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
// this->setPalette(palette);
/* [WidgetBackground] **/


/** [MessagesLabel] */
/* [MessagesLabel] **/


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


Expand Down
4 changes: 2 additions & 2 deletions Codes/cloginwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ color:rgb(0, 0, 0);</string>
<string/>
</property>
<property name="maxLength">
<number>20</number>
<number>30</number>
</property>
<property name="frame">
<bool>true</bool>
Expand Down Expand Up @@ -530,7 +530,7 @@ color:rgb(0, 0, 0);</string>
<string/>
</property>
<property name="maxLength">
<number>20</number>
<number>30</number>
</property>
<property name="frame">
<bool>true</bool>
Expand Down
2 changes: 1 addition & 1 deletion Codes/cmainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</font>
</property>
<property name="windowTitle">
<string>IntelligentWindow</string>
<string>IntelligentWindowClient</string>
</property>
<property name="windowIcon">
<iconset>
Expand Down
42 changes: 2 additions & 40 deletions Codes/cmodifypassworddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,7 @@ CModifyPasswordDialog::CModifyPasswordDialog(QString account, QWidget *parent) :
CEncrypt encrypt;
ui->lineEditSecretiveQuestion1->setText(encrypt.XOR(userQuestion1, CEncrypt::Model_XOR).data());
ui->lineEditSecretiveQuestion2->setText(encrypt.XOR(userQuestion2, CEncrypt::Model_XOR).data());
connect(ui->lineEditOldPassword, &QLineEdit::textChanged, [&](const QString &lineEditString){
CString checkString(lineEditString);
// if(checkString.CheckChar(checkString.GetStringSize() - 1, CString::Model_Password) == CString::Error_NullChar){
// if(checkString.DeleteChar(checkString.GetStringSize() - 1) == CString::Error_None)
// {
// ui->lineEditOldPassword->setText(checkString.GetQString());
// }
// else
// {
// ui->lineEditOldPassword->clear();
// }
// QMessageBox::warning(this, "提示", "密码只能包含阿拉伯数字、大小写字母以及一部分特殊符号!");
// }
});
connect(ui->lineEditNewPassword, &QLineEdit::textChanged, [&](const QString &lineEditString){
CString checkString(lineEditString);
// if(checkString.CheckChar(checkString.GetStringSize() - 1, CString::Model_Password) == CString::Error_NullChar){
// if(checkString.DeleteChar(checkString.GetStringSize() - 1) == CString::Error_None)
// {
// ui->lineEditNewPassword->setText(checkString.GetQString());
// }
// else
// {
// ui->lineEditNewPassword->clear();
// }
// QMessageBox::warning(this, "提示", "密码只能包含阿拉伯数字、大小写字母以及一部分特殊符号!");
// }
});
ui->lineEditNewPassword->setValidator(new QRegExpValidator(QRegExp("[A-Za-z0-9-@#&/*+]{0,30}"), this)); //用正则表达式来限制输入

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

if(secretiveAnswer1 == "" || secretiveAnswer2 == "")
{
QMessageBox::warning(this, "提示", "答案不能为空!");
return;
}
if(oldPassword == "" || newPassword == "")
if(newPassword == "")
{
QMessageBox::warning(this, "提示", "密码不能为空!");
return;
}
if(oldPassword == newPassword)
{
QMessageBox::warning(this, "提示", "两次密码输入一致!");
return;
}

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

Expand All @@ -131,11 +98,6 @@ CModifyPasswordDialog::CModifyPasswordDialog(QString account, QWidget *parent) :
QMessageBox::warning(this, "提示", "第二个秘问答案输入错误!");
return;
}
else if(oldPassword != myencrypt.XOR(userPassword, CEncrypt::Model_XOR).data())
{
QMessageBox::warning(this, "提示", "原密码输入错误!");
return;
}
else
{
QFile file_user_enc(m_path_users_enc + account + ".enc");
Expand Down
7 changes: 4 additions & 3 deletions Codes/cmodifypassworddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#include "cstring.h"
#include "cencrypt.h"

#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QDialog>
#include <QString>
#include <QFile>
#include <QMessageBox>
#include <QCoreApplication>
#include <QRegExpValidator>
#include <QString>

namespace Ui {
class CModifyPasswordDialog;
Expand Down
Loading

0 comments on commit c80fb70

Please sign in to comment.