Skip to content

Commit

Permalink
add visual studio
Browse files Browse the repository at this point in the history
  • Loading branch information
jared2020 committed Dec 4, 2024
1 parent fbb9dc5 commit 0088fa2
Show file tree
Hide file tree
Showing 14 changed files with 495 additions and 23 deletions.
3 changes: 0 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ CommentPragmas: '^ IWYU pragma:'
# 固定命名空间注释
FixNamespaceComments: true

# 对齐连续的尾随的注释
AlignTrailingComments: true

# 允许短的函数放在同一行: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All
AllowShortFunctionsOnASingleLine: Empty

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ bin
*.stash
*.cbt
debug
release
*.ipch
*qmlcache.qrc
build
bin
.vc
.vscode
.vs
.vs
**/GeneratedFiles/**
12 changes: 11 additions & 1 deletion 3rdparty/TaoCommon/src/TaoCommon/Common/PropertyHelper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QObject>
#include <QtGlobal>

Expand Down Expand Up @@ -132,6 +132,16 @@ class AppInfo : public QObject
*/
// 可读可写 属性。属性set函数 提升为 slot ,可被 invok / qml 调用
#define AUTO_PROPERTY_V2(T, NAME, InitValue) \
private: \
Q_PROPERTY(T NAME READ NAME WRITE set_##NAME NOTIFY NAME##Changed) \
public: \
PROP_GET(T, NAME); \
Q_SLOT PROP_SET(T, NAME); \
\
private: \
PROP_MEM(T, NAME, InitValue)

//**********************************QObject 属性 二进制兼容版, 头文件声明 与 源文件定义 分离**********************************

Expand Down
11 changes: 8 additions & 3 deletions 3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListItemBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
class TAO_API QuickListItemBase : public QObject
{
Q_OBJECT
AUTO_PROPERTY(bool, isChecked, false)
AUTO_PROPERTY(bool, isSelected, false)
AUTO_PROPERTY(bool, isAlternate, false)
AUTO_PROPERTY_V2(bool, isChecked, false)
AUTO_PROPERTY_V2(bool, isSelected, false)
AUTO_PROPERTY_V2(bool, isAlternate, false)
signals:
void isCheckedChanged(bool);
void isSelectedChanged(bool);
void isAlternateChanged(bool);

public:
explicit QuickListItemBase(QObject* parent = nullptr);
virtual ~QuickListItemBase() override;
Expand Down
27 changes: 19 additions & 8 deletions 3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@

class TAO_API QuickListModel : public QuickModelBase<QuickListItemBase*>
{
private:
Q_OBJECT
Q_PROPERTY(bool allChecked READ allChecked WRITE setAllChecked NOTIFY allCheckedChanged)
AUTO_PROPERTY(int, visibledCount, 0)
AUTO_PROPERTY(int, selectedCount, 0)
AUTO_PROPERTY(int, checkedCount, 0)

AUTO_PROPERTY(QStringList, headerRoles, {})
AUTO_PROPERTY(Qt::SortOrder, sortOrder, Qt::AscendingOrder)
AUTO_PROPERTY(QString, sortRole, {})
AUTO_PROPERTY(QStringList, noSortRoles, {})

AUTO_PROPERTY_V2(int, visibledCount, 0)
AUTO_PROPERTY_V2(int, selectedCount, 0)
AUTO_PROPERTY_V2(int, checkedCount, 0)

AUTO_PROPERTY_V2(QStringList, headerRoles, {})
AUTO_PROPERTY_V2(Qt::SortOrder, sortOrder, Qt::AscendingOrder)
AUTO_PROPERTY_V2(QString, sortRole, {})
AUTO_PROPERTY_V2(QStringList, noSortRoles, {})
signals:
void visibledCountChanged(int);
void selectedCountChanged(int);
void checkedCountChanged(int);
void headerRolesChanged(const QStringList&);
void sortOrderChanged(Qt::SortOrder);
void sortRoleChanged(const QString&);
void noSortRolesChanged(const QStringList&);

public:
using Super = QuickModelBase<QuickListItemBase*>;
explicit QuickListModel(QObject* parent = nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
template <class T>
class QuickModelBase : public QAbstractListModel
{

public:
using Super = QAbstractListModel;
explicit QuickModelBase(QObject* parent = nullptr);
Expand Down
6 changes: 4 additions & 2 deletions 3rdparty/TaoCommon/src/TaoCommon/Trans/Trans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#include <QQmlContext>
#include <QQmlEngine>
#include <QQuickView>
const static auto cEnglisthStr = u8"English";
const static auto cChineseStr = u8"简体中文";

const static QString cEnglisthStr = QStringLiteral("English");
const static QString cChineseStr = QStringLiteral("简体中文");

Trans::Trans(QObject* parent)
: QTranslator(parent)
{
Expand Down
25 changes: 25 additions & 0 deletions TaoQuick.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35431.28
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TaoQuickShow", "examples\TaoQuickShow\TaoQuickShow.vcxproj", "{459D668B-0F88-4B38-9C16-E28F89505358}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{459D668B-0F88-4B38-9C16-E28F89505358}.Debug|x64.ActiveCfg = Debug|x64
{459D668B-0F88-4B38-9C16-E28F89505358}.Debug|x64.Build.0 = Debug|x64
{459D668B-0F88-4B38-9C16-E28F89505358}.Release|x64.ActiveCfg = Release|x64
{459D668B-0F88-4B38-9C16-E28F89505358}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC052BAA-5D0E-46CB-A268-F382FB176B69}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions examples/TaoQuickShow/Src/AppInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "AppInfo.h"
#include "Ver-u8.h"
#include "taoVersionInfo.h"
#include <QQmlContext>
#include <QSysInfo>
AppInfo::AppInfo(QObject* parent)
Expand Down
13 changes: 9 additions & 4 deletions examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ class DeviceAddItem : public QuickListItemBase
{
Q_OBJECT

AUTO_PROPERTY(QString, name, "")
AUTO_PROPERTY(QString, address, "")
AUTO_PROPERTY(QString, modelString, "")
AUTO_PROPERTY(bool, online, false)
AUTO_PROPERTY_V2(QString, name, "")
AUTO_PROPERTY_V2(QString, address, "")
AUTO_PROPERTY_V2(QString, modelString, "")
AUTO_PROPERTY_V2(bool, online, false)
signals:
void nameChanged(const QString&);
void addressChanged(const QString&);
void modelStringChanged(const QString&);
void onlineChanged(bool);

public:
explicit DeviceAddItem(QObject* parent = nullptr);
Expand Down
7 changes: 6 additions & 1 deletion examples/TaoQuickShow/Src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#include "AppInfo.h"
#include "DeviceAddTable/DeviceAddModel.h"
#include "Frameless/TaoFrameLessView.h"
Expand Down Expand Up @@ -126,7 +127,11 @@ int main(int argc, char** argv)
// qml call 'Qt.quit()' will emit engine::quit, here should call qApp->quit
QObject::connect(view.engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
// qml clear content before quit
QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view]() { view.setSource({}); });
QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view]()
{
view.setSource({});
qInstallMessageHandler(nullptr);
});

view.setSource(url);
view.moveToScreenCenter();
Expand Down
200 changes: 200 additions & 0 deletions examples/TaoQuickShow/TaoQuickShow.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<QtRcc Include="..\..\src\TaoQuick\TaoQuick.qrc" />
<QtRcc Include="Contents.qrc" />
<QtRcc Include="Image.qrc" />
<QtRcc Include="Qml.qrc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Frameless\TaoFrameLessView_win.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Logger\Logger.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickModel\QuickListItemBase.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickModel\QuickListModel.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickTool\QuickTool.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickTree\Model\QuickTreeModel.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Thread\ThreadPool.cpp" />
<ClCompile Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Trans\Trans.cpp" />
<ClCompile Include="Src\AppInfo.cpp" />
<ClCompile Include="Src\DeviceAddTable\DeviceAddItem.cpp" />
<ClCompile Include="Src\DeviceAddTable\DeviceAddModel.cpp" />
<ClCompile Include="Src\main.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="Src\DeviceAddTable\DeviceAddItem.h" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="Src\DeviceAddTable\DeviceAddModel.h">
<DynamicSource>output</DynamicSource>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtMoc Include="Src\AppInfo.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\FileReadWrite.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\JsonSerialize.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\MathHelp.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\ObjectMap.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\Package.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\PropertyHelper.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Common\Subject.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Logger\Logger.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Logger\LoggerTemplate.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickModel\QuickListModel.h">
<DynamicSource>output</DynamicSource>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ParallelProcess Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ParallelProcess>
</QtMoc>
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickModel\QuickModelBase.hpp" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Thread\ThreadCommon.h" />
<ClInclude Include="..\..\taoVersionInfo.h" />
<ClInclude Include="Ver-u16.h" />
<ClInclude Include="Ver-u8.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Trans\Trans.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Thread\ThreadWorkerController.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Thread\ThreadPool.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickTree\Model\QuickTreeModel.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickTree\Model\QuickTreeItem.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickTool\QuickTool.h" />
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\QuickModel\QuickListItemBase.h">
<DynamicSource>output</DynamicSource>
</QtMoc>
<QtMoc Include="..\..\3rdparty\TaoCommon\src\TaoCommon\Frameless\TaoFrameLessView.h" />
<ClInclude Include="..\..\3rdparty\TaoCommon\src\TaoCommon\TaoCommonGlobal.h" />
<ClInclude Include="Src\stdafx.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{459D668B-0F88-4B38-9C16-E28F89505358}</ProjectGuid>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>5.15.12_msvc2019_64</QtInstall>
<QtModules>quick</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
<QtQMLDebugEnable>true</QtQMLDebugEnable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
<QtInstall>5.15.12_msvc2019_64</QtInstall>
<QtModules>quick</QtModules>
<QtBuildConfig>release</QtBuildConfig>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>$(SolutionDir)3rdparty\TaoCommon\src\TaoCommon;$(SolutionDir);$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>$(SolutionDir)3rdparty\TaoCommon\src\TaoCommon;$(SolutionDir);$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<LanguageStandard>Default</LanguageStandard>
<PreprocessorDefinitions>TaoCommon_NO_LIB;TaoQuickShowPath="qrc:/";TaoQuickImportPath="qrc:/";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<LanguageStandard>Default</LanguageStandard>
<PreprocessorDefinitions>TaoCommon_NO_LIB;TaoQuickShowPath="qrc:/";TaoQuickImportPath="qrc:/";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<QtMoc>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<QtMocDir>.\GeneratedFiles\$(ConfigurationName)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>.\GeneratedFiles</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<QtMoc>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<QtMocDir>.\GeneratedFiles\$(ConfigurationName)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>.\GeneratedFiles</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading

0 comments on commit 0088fa2

Please sign in to comment.