init
This commit is contained in:
commit
d28541a47d
|
@ -0,0 +1,2 @@
|
|||
.vs/
|
||||
x64/
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36221.1 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TranslateUI", "TranslateUI\TranslateUI.vcxproj", "{A476B13D-5DF1-4C24-A2F2-719D52676EF7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A476B13D-5DF1-4C24-A2F2-719D52676EF7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A476B13D-5DF1-4C24-A2F2-719D52676EF7}.Debug|x64.Build.0 = Debug|x64
|
||||
{A476B13D-5DF1-4C24-A2F2-719D52676EF7}.Release|x64.ActiveCfg = Release|x64
|
||||
{A476B13D-5DF1-4C24-A2F2-719D52676EF7}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3EBB3ACE-7FDB-4602-8D43-C7608AEE6CF1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,78 @@
|
|||
#include "StructView.h"
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QSplitter>
|
||||
#include <QGroupBox>
|
||||
#include <QTabWidget>
|
||||
|
||||
|
||||
BinaryStructView::BinaryStructView(QWidget* p /*= nullptr*/)
|
||||
:QWidget(p),
|
||||
_name_enter(new QLineEdit(this)),
|
||||
_base_type(new QComboBox(this)),
|
||||
_ends_set(new QComboBox(this)),
|
||||
_bin_layout(new QTableView(this)),
|
||||
_bin_model(new QStandardItemModel(this)),
|
||||
_struct_layout(new QTreeView(this)),
|
||||
_struct_model(new QStandardItemModel(this)),
|
||||
_translate_layout(new QTreeView(this)),
|
||||
_translate_model(new QStandardItemModel(this))
|
||||
{
|
||||
auto layout = new QGridLayout(this);
|
||||
//layout->setSpacing(10);
|
||||
layout->addWidget(new QLabel(tr("Unit Name:"), this));
|
||||
layout->addWidget(_name_enter, 0, 1);
|
||||
layout->addWidget(new QLabel(tr("Base On:"), this), 0, 2);
|
||||
layout->addWidget(_base_type, 0, 3);
|
||||
layout->addWidget(new QLabel(tr("Basedata Endian Appoint:"), this), 0, 4);
|
||||
layout->addWidget(_ends_set, 0, 5);
|
||||
auto btn = new QPushButton(tr("Save"), this);
|
||||
layout->addWidget(btn, 0, 6);
|
||||
|
||||
auto h_splitter = new QSplitter(Qt::Horizontal, this);
|
||||
layout->addWidget(h_splitter, 1, 0, 3, 7);
|
||||
|
||||
auto splitter = new QSplitter(Qt::Vertical, this);
|
||||
h_splitter->addWidget(splitter);
|
||||
auto translation_panel = new QGroupBox(tr("Translation Detail"), this);
|
||||
auto translation_layout = new QGridLayout(translation_panel);
|
||||
translation_layout->addWidget(this->_translate_layout);
|
||||
h_splitter->addWidget(translation_panel);
|
||||
|
||||
auto bin_panel = new QGroupBox(tr("Sequence Define"));
|
||||
auto bin_layout = new QGridLayout(bin_panel);
|
||||
bin_layout->addWidget(_bin_layout);
|
||||
splitter->addWidget(bin_panel);
|
||||
|
||||
auto struct_panel = new QGroupBox(tr("Structual Preview"), this);
|
||||
auto struct_layout = new QGridLayout(struct_panel);
|
||||
struct_layout->addWidget(_struct_layout);
|
||||
splitter->addWidget(struct_panel);
|
||||
|
||||
// =======================
|
||||
_base_type->addItems(QStringList()<<tr("Struct Based")<<tr("Union Based"));
|
||||
_ends_set->addItems(QStringList() << tr("little-endian") << tr("big-endian"));
|
||||
_bin_layout->setModel(_bin_model);
|
||||
_struct_layout->setModel(_struct_model);
|
||||
_translate_layout->setModel(this->_translate_model);
|
||||
|
||||
_bin_model->setHorizontalHeaderLabels(QStringList() << tr("Member Name") << tr("Logical Type") << tr("Base Type")
|
||||
<< tr("Bytes Offset") << tr("Bytes Count"));
|
||||
_bin_model->appendRow(QList<QStandardItem*>() << new QStandardItem(u8"单元标志")<< new QStandardItem(u8"数据")
|
||||
<< new QStandardItem(u8"UINT8") << new QStandardItem("0") << new QStandardItem("1*1"));
|
||||
_bin_model->appendRow(QList<QStandardItem*>() << new QStandardItem(u8"集合尺寸") << new QStandardItem(u8"数据")
|
||||
<< new QStandardItem(u8"UINT16") << new QStandardItem("0") << new QStandardItem(u8"2*1"));
|
||||
_bin_model->appendRow(QList<QStandardItem*>() << new QStandardItem(u8"变长数据") << new QStandardItem(u8"集合")
|
||||
<< new QStandardItem(u8"UINT8") << new QStandardItem("0") << new QStandardItem(u8"1*集合尺寸"));
|
||||
_bin_model->appendRow(QList<QStandardItem*>() << new QStandardItem(u8"联合数据") << new QStandardItem(u8"联合")
|
||||
<< new QStandardItem(u8"X联合") << new QStandardItem("0") << new QStandardItem(u8"8*1"));
|
||||
|
||||
_struct_model->setHorizontalHeaderLabels(QStringList() << tr("Fields") << tr("Comment"));
|
||||
|
||||
|
||||
_translate_model->setHorizontalHeaderLabels(QStringList() << tr("Apply Condition") << tr("Translate Type") << tr("RuleBase") << tr("Result With"));
|
||||
_translate_model->appendRow(QList< QStandardItem*>() << new QStandardItem(u8"绑定") << new QStandardItem(u8"直译") << new QStandardItem(u8"数值转换") << new QStandardItem(u8"To=16进制"));
|
||||
_translate_model->appendRow(QList< QStandardItem*>() << new QStandardItem(u8"绑定") << new QStandardItem(u8"直译") << new QStandardItem(u8"数值转换") << new QStandardItem(u8"To=float,LSB=0.1"));
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <QTableView>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTreeView>
|
||||
#include <QLineEdit>
|
||||
|
||||
class BinaryStructView : public QWidget
|
||||
{
|
||||
private:
|
||||
QLineEdit *const _name_enter;
|
||||
QComboBox *const _base_type;
|
||||
QComboBox *const _ends_set;
|
||||
QTableView *const _bin_layout;
|
||||
QStandardItemModel* const _bin_model;
|
||||
QTreeView* const _struct_layout;
|
||||
QStandardItemModel* const _struct_model;
|
||||
QTreeView* const _translate_layout;
|
||||
QStandardItemModel* const _translate_model;
|
||||
|
||||
public:
|
||||
BinaryStructView(QWidget* p = nullptr);
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include "TranslateUI.h"
|
||||
|
||||
TranslateUI::TranslateUI(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
}
|
||||
|
||||
TranslateUI::~TranslateUI()
|
||||
{}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
|
||||
class TranslateUI : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TranslateUI(QWidget *parent = nullptr);
|
||||
~TranslateUI();
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<RCC>
|
||||
<qresource prefix="TranslateUI">
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<UI version="4.0" >
|
||||
<class>TranslateUIClass</class>
|
||||
<widget class="QMainWindow" name="TranslateUIClass" >
|
||||
<property name="objectName" >
|
||||
<string notr="true">TranslateUIClass</string>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>TranslateUI</string>
|
||||
</property> <widget class="QMenuBar" name="menuBar" />
|
||||
<widget class="QToolBar" name="mainToolBar" />
|
||||
<widget class="QWidget" name="centralWidget" />
|
||||
<widget class="QStatusBar" name="statusBar" />
|
||||
</widget>
|
||||
<layoutDefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources>
|
||||
<include location="TranslateUI.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</UI>
|
|
@ -0,0 +1,111 @@
|
|||
<?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>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A476B13D-5DF1-4C24-A2F2-719D52676EF7}</ProjectGuid>
|
||||
<Keyword>QtVS_v304</Keyword>
|
||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.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>v143</PlatformToolset>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</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.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;gui;widgets</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;gui;widgets</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'">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
</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>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="TranslateUI.qrc" />
|
||||
<QtUic Include="TranslateUI.ui" />
|
||||
<QtMoc Include="TranslateUI.h" />
|
||||
<ClCompile Include="StructView.cpp" />
|
||||
<ClCompile Include="TranslateUI.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StructView.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Form Files">
|
||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||
<Extensions>ui</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Translation Files">
|
||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||
<Extensions>ts</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="TranslateUI.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</QtRcc>
|
||||
<QtUic Include="TranslateUI.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtMoc Include="TranslateUI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<ClCompile Include="TranslateUI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StructView.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StructView.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QtTouchProperty>
|
||||
</QtTouchProperty>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QtTouchProperty>
|
||||
</QtTouchProperty>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,13 @@
|
|||
#include "TranslateUI.h"
|
||||
#include <QtWidgets/QApplication>
|
||||
#include "StructView.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
BinaryStructView vb;
|
||||
vb.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
Loading…
Reference in New Issue