commit d28541a47dcfd888fc183ef533faed6d13eb254b Author: codeboss <2422523675@qq.com> Date: Mon Jul 14 02:33:40 2025 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8fe9ac3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vs/ +x64/ diff --git a/QBinTranslate.sln b/QBinTranslate.sln new file mode 100644 index 0000000..d8f0fef --- /dev/null +++ b/QBinTranslate.sln @@ -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 diff --git a/TranslateUI/StructView.cpp b/TranslateUI/StructView.cpp new file mode 100644 index 0000000..bdb1d56 --- /dev/null +++ b/TranslateUI/StructView.cpp @@ -0,0 +1,78 @@ +#include "StructView.h" +#include +#include +#include +#include +#include +#include +#include + + +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()<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() << new QStandardItem(u8"µ¥Ôª±êÖ¾")<< new QStandardItem(u8"Êý¾Ý") + << new QStandardItem(u8"UINT8") << new QStandardItem("0") << new QStandardItem("1*1")); + _bin_model->appendRow(QList() << new QStandardItem(u8"¼¯ºÏ³ß´ç") << new QStandardItem(u8"Êý¾Ý") + << new QStandardItem(u8"UINT16") << new QStandardItem("0") << new QStandardItem(u8"2*1")); + _bin_model->appendRow(QList() << new QStandardItem(u8"±ä³¤Êý¾Ý") << new QStandardItem(u8"¼¯ºÏ") + << new QStandardItem(u8"UINT8") << new QStandardItem("0") << new QStandardItem(u8"1*¼¯ºÏ³ß´ç")); + _bin_model->appendRow(QList() << 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")); +} diff --git a/TranslateUI/StructView.h b/TranslateUI/StructView.h new file mode 100644 index 0000000..7f943d6 --- /dev/null +++ b/TranslateUI/StructView.h @@ -0,0 +1,25 @@ +#pragma once +#include +#include +#include +#include +#include + +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); + +}; + diff --git a/TranslateUI/TranslateUI.cpp b/TranslateUI/TranslateUI.cpp new file mode 100644 index 0000000..709d32b --- /dev/null +++ b/TranslateUI/TranslateUI.cpp @@ -0,0 +1,10 @@ +#include "TranslateUI.h" + +TranslateUI::TranslateUI(QWidget *parent) + : QMainWindow(parent) +{ +} + +TranslateUI::~TranslateUI() +{} + diff --git a/TranslateUI/TranslateUI.h b/TranslateUI/TranslateUI.h new file mode 100644 index 0000000..e1285b3 --- /dev/null +++ b/TranslateUI/TranslateUI.h @@ -0,0 +1,15 @@ +#pragma once + +#include + +class TranslateUI : public QMainWindow +{ + Q_OBJECT + +public: + TranslateUI(QWidget *parent = nullptr); + ~TranslateUI(); + +private: +}; + diff --git a/TranslateUI/TranslateUI.qrc b/TranslateUI/TranslateUI.qrc new file mode 100644 index 0000000..e695e43 --- /dev/null +++ b/TranslateUI/TranslateUI.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/TranslateUI/TranslateUI.ui b/TranslateUI/TranslateUI.ui new file mode 100644 index 0000000..c11c2c1 --- /dev/null +++ b/TranslateUI/TranslateUI.ui @@ -0,0 +1,29 @@ + + + TranslateUIClass + + + TranslateUIClass + + + + 0 + 0 + 600 + 400 + + + + TranslateUI + + + + + + + + + + + + diff --git a/TranslateUI/TranslateUI.vcxproj b/TranslateUI/TranslateUI.vcxproj new file mode 100644 index 0000000..164b604 --- /dev/null +++ b/TranslateUI/TranslateUI.vcxproj @@ -0,0 +1,111 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {A476B13D-5DF1-4C24-A2F2-719D52676EF7} + QtVS_v304 + 10.0 + 10.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + Application + v143 + true + Unicode + + + Application + v143 + false + true + Unicode + + + + + + + 5.12.11_msvc2017_64 + core;gui;widgets + debug + + + 5.12.11_msvc2017_64 + core;gui;widgets + release + + + + + + + + + + + + + + + + + + + + + + true + Level3 + true + true + + + Windows + true + + + + + true + Level3 + true + true + true + true + + + Windows + false + true + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TranslateUI/TranslateUI.vcxproj.filters b/TranslateUI/TranslateUI.vcxproj.filters new file mode 100644 index 0000000..a25d0b0 --- /dev/null +++ b/TranslateUI/TranslateUI.vcxproj.filters @@ -0,0 +1,52 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + + + Resource Files + + + Form Files + + + Header Files + + + Source Files + + + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/TranslateUI/TranslateUI.vcxproj.user b/TranslateUI/TranslateUI.vcxproj.user new file mode 100644 index 0000000..41a709a --- /dev/null +++ b/TranslateUI/TranslateUI.vcxproj.user @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/TranslateUI/main.cpp b/TranslateUI/main.cpp new file mode 100644 index 0000000..355938e --- /dev/null +++ b/TranslateUI/main.cpp @@ -0,0 +1,13 @@ +#include "TranslateUI.h" +#include +#include "StructView.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + BinaryStructView vb; + vb.show(); + + return app.exec(); +}