添加棋谱文件的打开和保存功能
This commit is contained in:
parent
bdea2253bb
commit
a22595a93d
16
History.txt
16
History.txt
|
@ -1,12 +1,8 @@
|
|||
涔濊繛妫?NineChess
|
||||
鏇存柊鍘嗗彶锛?
|
||||
2018/6/10 V0.3
|
||||
1. 淇敼绠楁硶涓婄殑bug锛?
|
||||
2. 娣诲姞鍛戒护琛岃В鏋愬姛鑳姐€?
|
||||
|
||||
2018/5/19 V0.2
|
||||
1. Qt5.10.1+MSVC2017閲嶆瀯锛?
|
||||
2. 娓告垙鍙互姝g‘杩愯锛屽疄鐜版湰鏈哄鎴樺姛鑳斤紝鍏跺畠鍔熻兘寰呭畬鍠勩€?
|
||||
九连棋 NineChess
|
||||
更新历史:
|
||||
2018/5/19 V1.0
|
||||
1. Qt5.10.1+MSVC2017重构;
|
||||
2. 游戏可以正确运行,实现本机对战功能,其它功能待完善。
|
||||
|
||||
2015/11/6 V0.1
|
||||
1. 鏃犵畻娉曞彧鏈夌晫闈㈢殑绋嬪簭銆?
|
||||
1. 无算法只有界面的程序。
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#-------------------------------------------------
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2015-11-03T22:30:34
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.6.1, 2018-06-03T17:03:31. -->
|
||||
<!-- Written by QtCreator 4.6.1, 2018-08-30T00:01:19. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/My program/QT/NineChess/NineChess/debug/build-ninechess-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/My program/QT/NineChess/build-ninechess-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
@ -292,7 +292,7 @@
|
|||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ninechess.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">E:/My program/QT/NineChess/NineChess/debug/build-ninechess-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">E:/My program/QT/NineChess/build-ninechess-Desktop_Qt_5_11_0_MSVC2017_64bit-Debug</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtCore;release;\include;$(QTDIR)\mkspecs\win32-msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;release;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>release\</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;NDEBUG;QT_WIDGETS_LIB;QT_CORE_LIB;QT_GUI_LIB;QT_MULTIMEDIA_LIB;QT_NETWORK_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(QTDIR)\lib\qtmain.lib;shell32.lib;$(QTDIR)\lib\Qt5Multimedia.lib;$(QTDIR)\lib\Qt5Widgets.lib;$(QTDIR)\lib\Qt5Gui.lib;$(QTDIR)\lib\Qt5Network.lib;$(QTDIR)\lib\Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>qtmain.lib;shell32.lib;Qt5Widgets.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
|
@ -109,13 +109,13 @@
|
|||
<QtMoc>
|
||||
<QTDIR>$(QTDIR)</QTDIR>
|
||||
<OutputFile>.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</OutputFile>
|
||||
<Define>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;NDEBUG;%(PreprocessorDefinitions)</Define>
|
||||
<Define>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;NDEBUG;QT_WIDGETS_LIB;QT_CORE_LIB;QT_GUI_LIB;QT_MULTIMEDIA_LIB;QT_NETWORK_LIB;%(PreprocessorDefinitions)</Define>
|
||||
<CompilerFlavor>msvc</CompilerFlavor>
|
||||
<Include>$(Configuration)/moc_predefs.h</Include>
|
||||
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
|
||||
<InputFile>%(FullPath)</InputFile>
|
||||
<DynamicSource>output</DynamicSource>
|
||||
<IncludePath>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;$(QTDIR)\mkspecs/win32-msvc;.;$(QTDIR)\include;$(QTDIR)\include/QtMultimedia;$(QTDIR)\include/QtWidgets;$(QTDIR)\include/QtGui;$(QTDIR)\include/QtANGLE;$(QTDIR)\include/QtNetwork;$(QTDIR)\include/QtCore;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\ATLMFC\include;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt</IncludePath>
|
||||
<IncludePath>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;release;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories)</IncludePath>
|
||||
</QtMoc>
|
||||
<QtRcc>
|
||||
<InitFuncName>ninechesswindow</InitFuncName>
|
||||
|
@ -134,7 +134,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtCore;debug;\include;$(QTDIR)\mkspecs\win32-msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;debug;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>debug\</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
@ -143,7 +143,7 @@
|
|||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_MULTIMEDIA_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_WIDGETS_LIB;QT_CORE_LIB;QT_GUI_LIB;QT_MULTIMEDIA_LIB;QT_NETWORK_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
|
@ -153,7 +153,7 @@
|
|||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(QTDIR)\lib\qtmaind.lib;shell32.lib;$(QTDIR)\lib\Qt5Multimediad.lib;$(QTDIR)\lib\Qt5Widgetsd.lib;$(QTDIR)\lib\Qt5Guid.lib;$(QTDIR)\lib\Qt5Networkd.lib;$(QTDIR)\lib\Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>qtmaind.lib;shell32.lib;Qt5Widgetsd.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5Networkd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
|
@ -183,13 +183,13 @@
|
|||
<QtMoc>
|
||||
<QTDIR>$(QTDIR)</QTDIR>
|
||||
<OutputFile>.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</OutputFile>
|
||||
<Define>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_MULTIMEDIA_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</Define>
|
||||
<Define>_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_WIDGETS_LIB;QT_CORE_LIB;QT_GUI_LIB;QT_MULTIMEDIA_LIB;QT_NETWORK_LIB;%(PreprocessorDefinitions)</Define>
|
||||
<CompilerFlavor>msvc</CompilerFlavor>
|
||||
<Include>$(Configuration)/moc_predefs.h</Include>
|
||||
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
|
||||
<InputFile>%(FullPath)</InputFile>
|
||||
<DynamicSource>output</DynamicSource>
|
||||
<IncludePath>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;$(QTDIR)\mkspecs/win32-msvc;.;$(QTDIR)\include;$(QTDIR)\include/QtMultimedia;$(QTDIR)\include/QtWidgets;$(QTDIR)\include/QtGui;$(QTDIR)\include/QtANGLE;$(QTDIR)\include/QtNetwork;$(QTDIR)\include/QtCore;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\ATLMFC\include;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt;D:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt</IncludePath>
|
||||
<IncludePath>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;debug;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories)</IncludePath>
|
||||
</QtMoc>
|
||||
<QtUic>
|
||||
<QTDIR>$(QTDIR)</QTDIR>
|
||||
|
@ -221,12 +221,7 @@
|
|||
<QtMoc Include="src\ninechesswindow.h">
|
||||
</QtMoc>
|
||||
<ClInclude Include="src\pieceitem.h" />
|
||||
<QtMoc Include="src\sizehintlistview.h">
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\$(ConfigurationName)\.;.\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtCore;.\debug;\include;$(QTDIR)\mkspecs\win32-msvc</IncludePath>
|
||||
<Define Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_MULTIMEDIA_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB</Define>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName)\.;.\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtCore;.\release;\include;$(QTDIR)\mkspecs\win32-msvc</IncludePath>
|
||||
<Define Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_WINDOWS;UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;NDEBUG</Define>
|
||||
</QtMoc>
|
||||
<QtMoc Include="src\sizehintlistview.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
||||
|
@ -236,6 +231,13 @@
|
|||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generate moc_predefs.h</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">debug\moc_predefs.h;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Performing Custom Build Tools</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="release\moc_predefs.h.cbt">
|
||||
<FileType>Document</FileType>
|
||||
|
@ -244,6 +246,13 @@
|
|||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generate moc_predefs.h</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">release\moc_predefs.h;%(Outputs)</Outputs>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Performing Custom Build Tools</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="ui_ninechesswindow.h" />
|
||||
</ItemGroup>
|
||||
|
@ -307,7 +316,7 @@
|
|||
<ImportGroup Label="ExtensionTargets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" Qt5Version_x0020_x64="Qt5.11.0" />
|
||||
<UserProperties UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" Qt5Version_x0020_x64="msvc2017_64" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -263,6 +263,32 @@ void GameController::timerEvent(QTimerEvent *event)
|
|||
*/
|
||||
}
|
||||
|
||||
bool GameController::command(QString &cmd)
|
||||
{
|
||||
if (chess.command(cmd.toStdString().c_str())) {
|
||||
if (chess.getPhase() == NineChess::GAME_NOTSTARTED) {
|
||||
gameReset();
|
||||
gameStart();
|
||||
}
|
||||
updateScence(chess);
|
||||
// 将新增的棋谱行插入到ListModel
|
||||
currentRow = manualListModel.rowCount() - 1;
|
||||
int k = 0;
|
||||
// 输出命令行
|
||||
for (auto i = (chess.getCmdList())->begin(); i != (chess.getCmdList())->end(); ++i) {
|
||||
// 跳过已添加的,因标准list容器没有下标
|
||||
if (k++ <= currentRow)
|
||||
continue;
|
||||
manualListModel.insertRow(++currentRow);
|
||||
manualListModel.setData(manualListModel.index(currentRow), (*i).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 历史局面
|
||||
void GameController::phaseChange(int row, bool change /*= false*/)
|
||||
{
|
||||
|
|
|
@ -33,8 +33,6 @@ public:
|
|||
int getRuleNo() { return ruleNo; }
|
||||
int getTimeLimit() { return timeLimit; }
|
||||
int getStepsLimit() { return stepsLimit; }
|
||||
// 文本流
|
||||
QTextStream textStream;
|
||||
// 棋谱字符串列表模型
|
||||
QStringListModel manualListModel;
|
||||
|
||||
|
@ -69,6 +67,8 @@ public slots:
|
|||
void playSound(QString &soundPath);
|
||||
// 根据QGraphicsScene的信号和状态来执行选子、落子或去子
|
||||
bool actionPiece(QPointF p);
|
||||
// 棋谱的命令行执行
|
||||
bool command(QString &cmd);
|
||||
// 历史局面及局面改变
|
||||
void phaseChange(int row, bool change = false);
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ const struct NineChess::Rule NineChess::RULES[RULENUM] = {
|
|||
}
|
||||
};
|
||||
|
||||
// 名义上是个数组,实际上相当于一个判断是否在棋盘上的函数
|
||||
const char NineChess::inBoard[(RING + 2)*SEAT] = {
|
||||
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
||||
'\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff',
|
||||
|
|
|
@ -85,6 +85,8 @@ NineChessWindow::~NineChessWindow()
|
|||
if (game != NULL)
|
||||
delete game;
|
||||
qDeleteAll(ruleActionList);
|
||||
if (file.isOpen())
|
||||
file.close();
|
||||
}
|
||||
|
||||
bool NineChessWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
|
@ -240,38 +242,86 @@ void NineChessWindow::actionRules_triggered()
|
|||
|
||||
void NineChessWindow::on_actionNew_N_triggered()
|
||||
{
|
||||
|
||||
if (file.isOpen())
|
||||
file.close();
|
||||
game->gameReset();
|
||||
}
|
||||
|
||||
void NineChessWindow::on_actionOpen_O_triggered()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(this, "open", "../", "TXT(*.txt)");
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("打开棋谱文件"), QDir::currentPath(), "TXT(*.txt)");
|
||||
if (path.isEmpty() == false)
|
||||
{
|
||||
//文件对象
|
||||
QFile file(path);
|
||||
//打开文件,只读方式打开
|
||||
bool isok = file.open(QIODevice::ReadOnly);
|
||||
if (file.isOpen())
|
||||
file.close();
|
||||
//文件对象
|
||||
file.setFileName(path);
|
||||
// 不支持1MB以上的文件
|
||||
if (file.size() > 0x100000 )
|
||||
{
|
||||
// 定义新对话框
|
||||
QMessageBox msgBox(QMessageBox::Warning, tr("文件过大"), tr("不支持1MB以上文件"), QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
//打开文件,只读方式打开
|
||||
bool isok = file.open(QFileDevice::ReadOnly | QFileDevice::Text);
|
||||
if (isok = true)
|
||||
{
|
||||
|
||||
//读文件
|
||||
QByteArray array = file.readAll();
|
||||
qDebug() << array;
|
||||
|
||||
//读文件
|
||||
QTextStream textStream(&file);
|
||||
QString cmd;
|
||||
while (!textStream.atEnd())
|
||||
{
|
||||
cmd = textStream.readLine();
|
||||
game->command(cmd);
|
||||
}
|
||||
}
|
||||
//文件关闭
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void NineChessWindow::on_actionSave_S_triggered()
|
||||
{
|
||||
|
||||
if (file.isOpen())
|
||||
{
|
||||
file.close();
|
||||
//打开文件,只写方式打开
|
||||
bool isok = file.open(QFileDevice::WriteOnly | QFileDevice::Text);
|
||||
if (isok = true)
|
||||
{
|
||||
//写文件
|
||||
QTextStream textStream(&file);
|
||||
QStringListModel *strlist = qobject_cast<QStringListModel *>(ui.listView->model());
|
||||
for (QString cmd : strlist->stringList())
|
||||
textStream << cmd << endl;
|
||||
file.flush();
|
||||
}
|
||||
}
|
||||
else
|
||||
on_actionSaveAs_A_triggered();
|
||||
}
|
||||
|
||||
void NineChessWindow::on_actionSaveAs_A_triggered()
|
||||
{
|
||||
QString path = QFileDialog::getSaveFileName(this, tr("打开棋谱文件"), QDir::currentPath()+tr("棋谱.txt"), "TXT(*.txt)");
|
||||
if (path.isEmpty() == false)
|
||||
{
|
||||
if (file.isOpen())
|
||||
file.close();
|
||||
//文件对象
|
||||
file.setFileName(path);
|
||||
//打开文件,只写方式打开
|
||||
bool isok = file.open(QFileDevice::WriteOnly | QFileDevice::Text);
|
||||
if (isok = true)
|
||||
{
|
||||
//写文件
|
||||
QTextStream textStream(&file);
|
||||
QStringListModel *strlist = qobject_cast<QStringListModel *>(ui.listView->model());
|
||||
for (QString cmd : strlist->stringList())
|
||||
textStream << cmd << endl;
|
||||
file.flush();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -52,11 +52,9 @@ protected slots:
|
|||
const QVector<int> &roles = QVector<int>()) {
|
||||
QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
|
||||
QModelIndex index = model()->index(model()->rowCount() - 1, 0);
|
||||
if (topLeft == bottomRight) {
|
||||
if (index == bottomRight) {
|
||||
setCurrentIndex(index);
|
||||
scrollToBottom();
|
||||
}
|
||||
if (index == bottomRight) {
|
||||
setCurrentIndex(index);
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
r3 s000 t00
|
||||
(3,1) 00:00.000
|
||||
(2,1) 00:01.195
|
||||
(1,1) 00:01.754
|
||||
(2,3) 00:08.021
|
||||
(3,3) 00:02.332
|
||||
(3,4) 00:32.907
|
||||
(3,5) 00:03.513
|
||||
(1,5) 00:42.977
|
70
Readme.md
70
Readme.md
|
@ -1,43 +1,43 @@
|
|||
# 涔濊仈妫?NineChess
|
||||
# 九联棋 NineChess
|
||||
|
||||
#### 椤圭洰浠嬬粛锛?
|
||||
鏈父鎴忔牴鎹綔鑰呭効鏃舵父鎴忊€斺€斺€滀節鑱旀鈥濈紪鍒讹紝鍔犱笂鈥滄垚涓夋鈥濄€佲€滄墦涓夋鈥濆拰鈥滆帿閲屾柉涔濆瓙妫嬧€濓紝鍏变笁绉嶈鍒欑帺娉曘€?
|
||||
涓夌瑙勫垯鐣ユ湁宸紓锛岄紶鏍囨斁鍦ㄧ浉搴旇彍鍗曢」鏈変細鏈夎缁嗙殑瑙勫垯鎻愮ず銆?
|
||||
#### 项目介绍:
|
||||
本游戏根据作者儿时游戏——“九联棋”编制,加上“成三棋”、“打三棋”和“莫里斯九子棋”,共三种规则玩法。
|
||||
三种规则略有差异,鼠标放在相应菜单项有会有详细的规则提示。
|
||||
|
||||
#### 杞欢鏋勬灦锛?
|
||||
+ GUI妗嗘灦锛歈t5.10锛孮t5澶х増鏈笅鍧囧彲閫氱敤銆?
|
||||
+ 缂栬瘧鍣細MSVC2017锛孧SVC2013鍙婁互涓婄増鏈彲鐢ㄣ€?
|
||||
+ 婧愭枃浠剁紪鐮侊細鎵€鏈夊ご鏂囦欢(*.h)鍜屾簮鏂囦欢(*.cpp)閲囩敤UTF-8+BOM缂栫爜鏍煎紡銆俻ro鏂囦欢绛夐噰鐢║TF-8鏃燘OM缂栫爜銆?
|
||||
+ 鏈▼搴忛噰鐢∕VC锛堟ā鍨嬧€斺€旇鍥锯€斺€旀帶鍒跺櫒锛夎璁¤鑼冿紝瀵瑰簲绫诲涓嬶細
|
||||
#### 软件构架:
|
||||
+ GUI框架:Qt5.10,Qt5大版本下均可通用。
|
||||
+ 编译器:MSVC2017,MSVC2013及以上版本可用。
|
||||
+ 源文件编码:所有头文件(*.h)和源文件(*.cpp)采用UTF-8+BOM编码格式。pro文件等采用UTF-8无BOM编码。
|
||||
+ 本程序采用MVC(模型——视图——控制器)设计规范,对应类如下:
|
||||
```
|
||||
MVC
|
||||
鈹溾攢Model
|
||||
鈹? 鈹斺攢NineChess锛氱敤鏍囧噯C++鍐欑殑妫嬬被妯″瀷锛屽鐞嗕笅妫嬭繃绋?
|
||||
鈹溾攢View
|
||||
鈹? 鈹溾攢NineChessWindow锛氫粠QMainWindow娲剧敓鐨勪富绐楀彛绫伙紝鐢盦t鑷姩鐢熸垚
|
||||
鈹? 鈹溾攢SizeHintListView锛氫粠QListView娲剧敓鐨勫垪琛ㄦ
|
||||
鈹? 鈹溾攢GameScene锛氫粠QGraphicsScene娲剧敓鐨勫満鏅被
|
||||
鈹? 鈹溾攢GameView锛氫粠QGraphicsView娲剧敓鐨勮鍥炬
|
||||
鈹? 鈹溾攢BoardItem锛氫粠QGraphicsItem娲剧敓鐨勬鐩樺浘褰㈢被
|
||||
鈹? 鈹斺攢PiecedItem锛氫粠QGraphicsItem娲剧敓鐨勬瀛愬浘褰㈢被
|
||||
鈹斺攢Controller
|
||||
鈹斺攢GameController锛氫粠QObject娲剧敓鐨勬帶鍒剁被
|
||||
├─Model
|
||||
│ └─NineChess:用标准C++写的棋类模型,处理下棋过程
|
||||
├─View
|
||||
│ ├─NineChessWindow:从QMainWindow派生的主窗口类,由Qt自动生成
|
||||
│ ├─SizeHintListView:从QListView派生的列表框
|
||||
│ ├─GameScene:从QGraphicsScene派生的场景类
|
||||
│ ├─GameView:从QGraphicsView派生的视图框
|
||||
│ ├─BoardItem:从QGraphicsItem派生的棋盘图形类
|
||||
│ └─PiecedItem:从QGraphicsItem派生的棋子图形类
|
||||
└─Controller
|
||||
└─GameController:从QObject派生的控制类
|
||||
```
|
||||
+ 杩欎釜绋嬪簭鐢ㄥ埌浜嗗緢澶歈t鐗规€э紝鍏舵ā寮忓悗鏈熷彲浠ユ墿灞曞埌鍚勭妫嬬被娓告垙锛岄€傚悎鍒濆鑰呬竴鐪嬨€?
|
||||
+ 这个程序用到了很多Qt特性,其模式后期可以扩展到各种棋类游戏,适合初学者一看。
|
||||
|
||||
#### 璁稿彲鍗忚
|
||||
鍙傝Licence.txt
|
||||
#### 许可协议
|
||||
参见Licence.txt
|
||||
|
||||
#### 鏇存柊鍘嗗彶
|
||||
鍙傝History.txt
|
||||
#### 更新历史
|
||||
参见History.txt
|
||||
|
||||
#### 浣滆€呭0鏄庯細
|
||||
澶氬勾鍓嶄笂澶у閭d細鍎匡紝绗旇€呭氨鎵撶畻鍋氳繖涔堜釜绋嬪簭鍑烘潵銆傜劧鑰岋紝鏉′欢姣旇緝鑹拌嫤锛?
|
||||
涓€鏉ユ病鏈夎€佸笀鏁欙紝璇句笂鍙浜咰璇█鍜孷B锛孋++鏄瑪鑰呰嚜瀛︾殑锛屼竴涓汉鍟冩櫐娑╄繃鏃剁殑MFC;
|
||||
浜屾潵鎴戠┓鍒拌繛涓數鑴戦兘娌℃湁鈥︹€?
|
||||
涓夊槢锛屽氨鏄椽鐜┾€︹€?
|
||||
宸ヤ綔涔嬪悗鏈夋潯浠朵簡锛屾垜鍙堣嚜瀛︿簡C#鍜孮t锛屼絾閮藉緢鑲ゆ祬锛屾病娣卞叆瀛︼紝鍙敤鏉ュ仛鍑犱釜灏忓伐鍏疯€屽凡銆?
|
||||
鍚庢潵娑堟矇杩囦竴娈垫椂闂达紝鎴戠粓浜庢湁澶ф妸鐨勬椂闂存潵鎬濊€冧汉鐢熴€?
|
||||
椋庨洦杩囧悗锛屾垜鎯宠捣鎶婃椂闂寸敤鍦ㄥ叴瓒g埍濂戒笂銆備簬鏄紝杩欎釜灏忔父鎴忚癁鐢熶簡锛?
|
||||
濡傛灉浣犲彂鐜版湰绋嬪簭鏈変粈涔堥棶棰樻垨濂界殑寤鸿锛岃涓庢湰浜鸿仈绯汇€傛垜鐨勯偖绠辨槸锛歭iuweilhy@163.com
|
||||
>銆€銆€銆€銆€銆€銆€銆€銆€銆€銆€鈥斺€攂y liuweilhy 2015骞?1鏈?鏃
|
||||
#### 作者声明:
|
||||
多年前上大学那会儿,笔者就打算做这么个程序出来。然而,条件比较艰苦:
|
||||
一来没有老师教,课上只学了C语言和VB,C++是笔者自学的,一个人啃晦涩过时的MFC;
|
||||
二来我穷到连个电脑都没有……
|
||||
三嘛,就是贪玩……
|
||||
工作之后有条件了,我又自学了C#和Qt,但都很肤浅,没深入学,只用来做几个小工具而已。
|
||||
从5月末开始消沉到后来步入人生低谷,我终于有大把的时间来思考人生。
|
||||
风雨过后,我想起把时间用在兴趣爱好上。于是,这个小游戏诞生了!
|
||||
如果你发现本程序有什么问题或好的建议,请与本人联系。我的邮箱是:liuweilhy@163.com
|
||||
> ——by liuweilhy 2015年11月6日
|
Loading…
Reference in New Issue