修复飞子阶段bug,增加标签页

This commit is contained in:
liuweilhy 2018-06-03 19:44:45 +08:00
parent e66ef36927
commit 47aca2dfb7
13 changed files with 187 additions and 78 deletions

1
.gitignore vendored
View File

@ -6,5 +6,6 @@
/NineChess/release
/NineChess/GeneratedFiles
/NineChess/x64
/NineChess/x86
/NineChess/.vs
/.vs

22
NineChess/.qmake.stash Normal file
View File

@ -0,0 +1,22 @@
QMAKE_CXX.INCDIRS = \
"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"
QMAKE_CXX.LIBDIRS = \
"D:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\ATLMFC\\lib\\x64" \
"D:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\lib\\x64" \
"C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64" \
"D:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.17134.0\\ucrt\\x64" \
"D:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.17134.0\\um\\x64"
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
QMAKE_CXX.QMAKE_MSC_VER = 1914
QMAKE_CXX.QMAKE_MSC_FULL_VER = 191426428
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_MSC_VER \
QMAKE_MSC_FULL_VER

View File

@ -31,6 +31,7 @@ HEADERS += \
src\boarditem.h \
src\gameview.h \
src\ninechess.h \
src\sizehinttextedit.h \
src\sizehintlistview.h \
src\gamescene.h
@ -41,8 +42,9 @@ RESOURCES += \
ninechesswindow.qrc
DISTFILES += \
Readme.txt \
NineChess.rc \
Readme.md \
Licence.txt \
History.txt
RC_FILE += NineChess.rc

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.5.1, 2018-05-17T00:26:36. -->
<!-- Written by QtCreator 4.6.1, 2018-06-03T17:03:31. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -59,14 +59,14 @@
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.10.1 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.10.1 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5101.win64_msvc2017_64_kit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.11.0 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.11.0 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5110.win64_msvc2017_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<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/build-ninechess-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug</value>
<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>
<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>
@ -90,7 +90,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -106,7 +106,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -114,13 +114,13 @@
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/My program/QT/build-ninechess-Desktop_Qt_5_10_1_MSVC2017_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/My program/QT/NineChess/build-ninechess-Desktop_Qt_5_11_0_MSVC2017_64bit-Release</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>
@ -144,7 +144,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -160,7 +160,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -168,13 +168,13 @@
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/My program/QT/build-ninechess-Desktop_Qt_5_10_1_MSVC2017_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/My program/QT/NineChess/build-ninechess-Desktop_Qt_5_11_0_MSVC2017_64bit-Profile</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>
@ -198,7 +198,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
@ -214,7 +214,7 @@
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
@ -222,7 +222,7 @@
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
@ -236,7 +236,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">在本地部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署设置</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
@ -285,14 +285,14 @@
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ninechess</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">ninechess2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/My program/QT/NineChess/NineChess/ninechess.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<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/build-ninechess-Desktop_Qt_5_10_1_MSVC2017_64bit-Debug</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="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

View File

@ -15,6 +15,7 @@
<RootNamespace>NineChess</RootNamespace>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
@ -86,7 +87,7 @@
</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>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\utils\my_sql\my_sql\lib;C:\utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<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>
<GenerateDebugInformation>false</GenerateDebugInformation>
@ -153,7 +154,7 @@
</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>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\utils\my_sql\my_sql\lib;C:\utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<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>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -239,10 +240,12 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">release\moc_predefs.h;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</CustomBuild>
<ClInclude Include="src\sizehinttextedit.h" />
<ClInclude Include="ui_ninechesswindow.h" />
</ItemGroup>
<ItemGroup>
<QtUic Include="ninechesswindow.ui">
<SubType>Designer</SubType>
</QtUic>
</ItemGroup>
<ItemGroup>
@ -300,7 +303,7 @@
<ImportGroup Label="ExtensionTargets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" Qt5Version_x0020_x64="qt5.10.1" />
<UserProperties UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" Qt5Version_x0020_x64="Qt5.11.0" />
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@ -110,24 +110,17 @@
<ClInclude Include="src\sizehintlistview.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\sizehinttextedit.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<ClInclude Include="ui_ninechesswindow.h">
<Filter>Generated Files</Filter>
</ClInclude>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QTDIR>D:\Qt\Qt5.10.1\5.10.1\msvc2017_64\</QTDIR>
<QTDIR>D:\Qt\Qt5.11.0\5.11.0\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QTDIR>D:\Qt\Qt5.10.1\5.10.1\msvc2017_64\</QTDIR>
<QTDIR>D:\Qt\Qt5.11.0\5.11.0\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>490</height>
<width>491</width>
<height>418</height>
</rect>
</property>
<property name="windowTitle">
@ -59,7 +59,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<width>491</width>
<height>26</height>
</rect>
</property>
@ -138,6 +138,7 @@
</property>
<addaction name="separator"/>
<addaction name="actionLimited_T"/>
<addaction name="separator"/>
</widget>
<addaction name="menu_F"/>
<addaction name="menu_C"/>
@ -277,7 +278,7 @@
<item>
<widget class="QLCDNumber" name="lcdNumber_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -353,7 +354,7 @@
<item>
<widget class="QLCDNumber" name="lcdNumber_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -380,24 +381,51 @@
</item>
</layout>
</widget>
<widget class="SizeHintListView" name="listView">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
</font>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="styleSheet">
<string notr="true">QToolTip {
font: 9pt &quot;consolas&quot;;
color: black;
}</string>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="SizeHintTextEdit" name="tab_Rule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<attribute name="title">
<string>规则</string>
</attribute>
<layout class="QFormLayout" name="formLayout"/>
</widget>
<widget class="SizeHintListView" name="tab_Manual">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title">
<string>棋谱</string>
</attribute>
<layout class="QFormLayout" name="formLayout"/>
</widget>
</widget>
</widget>
</item>
@ -827,6 +855,11 @@
<extends>QListView</extends>
<header>sizehintlistview.h</header>
</customwidget>
<customwidget>
<class>SizeHintTextEdit</class>
<extends>QPlainTextEdit</extends>
<header>sizehinttextedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="ninechesswindow.qrc"/>

View File

@ -152,6 +152,7 @@ void GameController::setRule(int ruleNo)
rule = NineChess::RULES[ruleNo];
rule.maxSteps = stepsLimit;
rule.maxTime = timeLimit;
// 设置模型规则,重置游戏
chess.setRule(&rule);
@ -519,7 +520,7 @@ bool GameController::removePiece(QPointF pos)
bool GameController::cleanForbidden()
{
for each (PieceItem *p in pieceList)
foreach (PieceItem *p, pieceList)
{
if (p->isDeleted()) {
pieceList.removeOne(p);

View File

@ -50,7 +50,7 @@ void GameScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
}
// 取消其它棋子的选中状态
//for each (QGraphicsItem * item in selectedItems())
//foreach (QGraphicsItem * item, selectedItems())
//{
// item->setSelected(false);
//}

View File

@ -14,13 +14,14 @@
const struct NineChess::Rule NineChess::RULES[RULENUM] = {
{
"成三棋", // 成三棋
"双方各九颗子,开局依次摆子;\n" // 规则说明
"凡出现三子相连,就提掉对手一子;\n"
"不能提对手的“三连”子,除非无子可提;\n"
"同时出现两个“三连”只能提一子;\n"
"摆完后依次走子,每次只能往相邻位置走一步;\n"
"把对手棋子提到少于3颗时胜利\n"
"走棋阶段不能行动(被“闷”)算负。",
// 规则说明
"1. 双方各9颗子开局依次摆子\n"
"2. 凡出现三子相连,就提掉对手一子;\n"
"3. 不能提对手的“三连”子,除非无子可提;\n"
"4. 同时出现两个“三连”只能提一子;\n"
"5. 摆完后依次走子,每次只能往相邻位置走一步;\n"
"6. 把对手棋子提到少于3颗时胜利\n"
"7. 走棋阶段不能行动(被“闷”)算负。",
9, // 双方各9子
3, // 赛点子数为3
false, // 没有斜线
@ -36,11 +37,13 @@ const struct NineChess::Rule NineChess::RULES[RULENUM] = {
},
{
"打三棋(12连棋)", // 打三棋
"规则与成三棋基本相同只是它用12颗子并且有斜线\n" // 规则说明
"摆棋阶段被提子的位置不能再摆子,直到走棋阶段;\n"
"摆棋阶段,摆满棋盘算先手负;\n"
"走棋阶段,后摆棋的一方先走;\n"
"一步出现几个“三连”就可以提几个子。",
// 规则说明
"1. 双方各12颗子棋盘有斜线\n"
"2. 摆棋阶段被提子的位置不能再摆子,直到走棋阶段;\n"
"3. 摆棋阶段,摆满棋盘算先手负;\n"
"4. 走棋阶段,后摆棋的一方先走;\n"
"5. 一步出现几个“三连”就可以提几个子;\n"
"6. 其它规则与成三棋基本相同。",
12, // 双方各12子
3, // 赛点子数为3
true, // 有斜线
@ -56,10 +59,11 @@ const struct NineChess::Rule NineChess::RULES[RULENUM] = {
},
{
"九连棋", // 九连棋
"规则与成三棋基本相同,只是它的棋子有序号,\n" // 规则说明
"相同序号、位置的“三连”不能重复提子;\n"
"走棋阶段不能行动(被“闷”),则由对手继续走棋;\n"
"一步出现几个“三连”就可以提几个子。",
// 规则说明
"1. 规则与成三棋基本相同,只是它的棋子有序号,\n"
"2. 相同序号、位置的“三连”不能重复提子;\n"
"3. 走棋阶段不能行动(被“闷”),则由对手继续走棋;\n"
"4. 一步出现几个“三连”就可以提几个子。",
9, // 双方各9子
3, // 赛点子数为3
false, // 没有斜线
@ -75,8 +79,8 @@ const struct NineChess::Rule NineChess::RULES[RULENUM] = {
},
{
"莫里斯九子棋", // 莫里斯九子棋
"规则与成三棋基本相同,只是在走子阶段,\n" // 规则说明
"当一方仅剩3子时他可以飞子到任意空位。",
// 规则说明
"规则与成三棋基本相同,只是在走子阶段,当一方仅剩3子时他可以飞子到任意空位。",
9, // 双方各9子
3, // 赛点子数为3
false, // 没有斜线
@ -820,7 +824,8 @@ bool NineChess::isSurrounded(int pos)
{
// 判断pos处的棋子是否被“闷”
if ((turn == PLAYER1 && (player1_Remain > rule.numAtLest || !rule.canFly)) ||
(turn == PLAYER2 && (player2_Remain > rule.numAtLest || !rule.canFly))) {
(turn == PLAYER2 && (player2_Remain > rule.numAtLest || !rule.canFly)))
{
int i, movePos;
for (i = 0; i < 4; i++) {
movePos = moveTable[pos][i];
@ -846,6 +851,13 @@ bool NineChess::isAllSurrounded(enum Player ply)
// 如果摆满
if (player1_Remain + player2_Remain >= SEAT * RING)
return true;
// 判断是否可以飞子
if ((turn == PLAYER1 && (player1_Remain <= rule.numAtLest && rule.canFly)) ||
(turn == PLAYER2 && (player2_Remain <= rule.numAtLest && rule.canFly)))
{
return false;
}
// 查询整个棋盘
for (int i = 1; i <= RING; i++)
{
for (int j = 0; j < SEAT; j++)

View File

@ -4,6 +4,7 @@
#include "ninechesswindow.h"
#include "gamecontroller.h"
#include "gamescene.h"
#include <QDesktopServices>
#include <QMap>
#include <QMessageBox>
#include <QTimer>
@ -84,11 +85,12 @@ NineChessWindow::~NineChessWindow()
{
if (game != NULL)
delete game;
qDeleteAll(ruleActionList);
}
bool NineChessWindow::eventFilter(QObject *watched, QEvent *event)
{
// 重载这个函数只是为了让规则菜单显示提示
// 重载这个函数只是为了让规则菜单(动态)显示提示
if (watched == ui.menu_R)
{
switch (event->type())
@ -104,7 +106,7 @@ bool NineChessWindow::eventFilter(QObject *watched, QEvent *event)
break;
}
}
QMainWindow::eventFilter(watched, event);
return QMainWindow::eventFilter(watched, event);
}
void NineChessWindow::initialize()
@ -174,6 +176,10 @@ void NineChessWindow::initialize()
// 重置游戏规则
game->setRule(ruleNo);
// 规则提示
QString tip_Rule = QString("%1\n%2").arg(tr(NineChess::RULES[ruleNo].name))
.arg(tr(NineChess::RULES[ruleNo].info));
ui.tab_Rule->setPlainText(tip_Rule);
}
void NineChessWindow::actionRules_triggered()
@ -188,6 +194,10 @@ void NineChessWindow::actionRules_triggered()
ruleNo = action->data().toInt();
// 重置游戏规则
game->setRule(ruleNo);
// 规则提示
QString tip_Rule = QString("%1\n%2").arg(tr(NineChess::RULES[ruleNo].name))
.arg(tr(NineChess::RULES[ruleNo].info));
ui.tab_Rule->setPlainText(tip_Rule);
}
@ -279,10 +289,10 @@ void NineChessWindow::on_actionResign_R_triggered()
void NineChessWindow::on_actionLimited_T_triggered()
{
/* 其实本来可以用设计器做个ui然后从QDialog派生个自己的对话框
*
*
* QDialog界面
*/
*
*
* QDialog界面
*/
int stepLimited = game->getStepsLimit();
int timeLimited = game->getTimeLimit();
@ -339,6 +349,10 @@ void NineChessWindow::on_actionLimited_T_triggered()
if (dialog->exec() == QDialog::Accepted) {
stepLimited = comboBox_step->currentData().toInt();
timeLimited = comboBox_time->currentData().toInt();
// 选择当前规则
QAction *action = dynamic_cast<QAction *>(sender());
action->setChecked(true);
int ruleNo = action->data().toInt();
// 重置游戏规则
game->setRule(ruleNo, stepLimited, timeLimited);
}
@ -370,7 +384,7 @@ void NineChessWindow::on_actionViewHelp_V_triggered()
void NineChessWindow::on_actionWeb_W_triggered()
{
QDesktopServices::openUrl(QUrl("http://hy-tech.top"));
}
void NineChessWindow::on_actionAbout_A_triggered()

View File

@ -0,0 +1,28 @@
/* QPlainTextEdit派生类
* sizeHint函数
*
* QDockWidget没有很好的控制初始大小的方法resize函数没效果
* 使
* this->setFixedWidth(108);
*
*/
#ifndef SIZEHINTTEXTEDIT
#define SIZEHINTTEXTEDIT
#include <QPlainTextEdit>
class SizeHintTextEdit : public QPlainTextEdit
{
public:
SizeHintTextEdit(QWidget * parent = 0) {}
QSize sizeHint() const{
QSize size = QPlainTextEdit::sizeHint();
// 缺省宽度设为128这样就不太宽了
size.setWidth(128);
return size;
}
};
#endif // SIZEHINTTEXTEDIT