Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
129 lines (119 loc) · 5.84 KB
/
Copy pathmain.cpp
File metadata and controls
129 lines (119 loc) · 5.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Honeycomb — 由异猫工作群(mutantcat.org)发行
// GitHub: https://github.com/Mutantcat-Working-Group
#include <QIcon>
#include <QApplication>
#include <QQmlContext>
#include <QQmlApplicationEngine>
#include <QQuickStyle>
#include <QtQml>
#include <QtWebEngineQuick/QtWebEngineQuick>
#include "src/RandomNumberGenerator.h"
#include "src/RandomLetterGenerator.h"
#include "src/RandomMixedGenerator.h"
#include "src/BarcodeGenerator.h"
#include "src/QRCodeGenerator.h"
#include "src/QRCodeScanner.h"
#include "src/JsonYamlConverter.h"
#include "src/ColorPicker.h"
#include "src/ColorSelector.h"
#include "src/MD5Generator.h"
#include "src/SHA1Generator.h"
#include "src/SHA256Generator.h"
#include "src/PasswordStrengthGenerator.h"
#include "src/RandomMacGenerator.h"
#include "src/RandomIpv4Generator.h"
#include "src/RandomIpv6Generator.h"
#include "src/UuidGenerator.h"
#include "src/WebSocketTest.h"
#include "src/RestfulTest.h"
#include "src/MQTTListener.h"
#include "src/MQTTPublisher.h"
#include "src/SubnetCalculator.h"
#include "src/RTSPViewer.h"
#include "src/ResistorCalculator.h"
#include "src/FolderHttpServer.h"
#include "src/FakeApiServer.h"
#include "src/SMCrypto.h"
#include "src/AESCrypto.h"
#include "src/OpenAIClient.h"
#include "src/AgentPromptManager.h"
#include "src/DNSLookupTool.h"
#include "src/EnvironmentPathTool.h"
#include "src/ProcessManagerTool.h"
#include "src/FileHashCalculator.h"
#include "src/FileUtilityTool.h"
#include "src/UpdateChecker.h"
#include "src/SerialPortTool.h"
#include "src/WindowElementInspector.h"
#include "src/GameAssetGenerator.h"
int main(int argc, char *argv[])
{
QtWebEngineQuick::initialize();
QApplication app(argc, argv);
// 设置应用程序图标
#ifndef Q_OS_MACOS
app.setWindowIcon(QIcon(":/qt/qml/Honeycomb/logo.png"));
#endif
// 设置 Qt Quick Controls 样式为 Basic,支持自定义控件外观
QQuickStyle::setStyle("Basic");
// 创建图像提供器
g_barcodeImageProvider = new BarcodeImageProvider();
g_qrcodeImageProvider = new QRCodeImageProvider();
g_qrScannerImageProvider = new QRScannerImageProvider();
// 注册 C++ 类型到 QML
qmlRegisterType<RandomNumberGenerator>("Honeycomb", 1, 0, "RandomNumberGenerator");
qmlRegisterType<RandomLetterGenerator>("Honeycomb", 1, 0, "RandomLetterGenerator");
qmlRegisterType<RandomMixedGenerator>("Honeycomb", 1, 0, "RandomMixedGenerator");
qmlRegisterType<BarcodeGenerator>("Honeycomb", 1, 0, "BarcodeGenerator");
qmlRegisterType<QRCodeGenerator>("Honeycomb", 1, 0, "QRCodeGenerator");
qmlRegisterType<QRCodeScanner>("Honeycomb", 1, 0, "QRCodeScanner");
qmlRegisterType<JsonYamlConverter>("Honeycomb", 1, 0, "JsonYamlConverter");
qmlRegisterType<ColorPicker>("Honeycomb", 1, 0, "ColorPicker");
qmlRegisterType<ColorSelector>("Honeycomb", 1, 0, "ColorSelector");
qmlRegisterType<MD5Generator>("Honeycomb", 1, 0, "MD5Generator");
qmlRegisterType<SHA1Generator>("Honeycomb", 1, 0, "SHA1Generator");
qmlRegisterType<SHA256Generator>("Honeycomb", 1, 0, "SHA256Generator");
qmlRegisterType<PasswordStrengthGenerator>("Honeycomb", 1, 0, "PasswordStrengthGenerator");
qmlRegisterType<RandomMacGenerator>("Honeycomb", 1, 0, "RandomMacGenerator");
qmlRegisterType<RandomIpv4Generator>("Honeycomb", 1, 0, "RandomIpv4Generator");
qmlRegisterType<RandomIpv6Generator>("Honeycomb", 1, 0, "RandomIpv6Generator");
qmlRegisterType<UuidGenerator>("Honeycomb", 1, 0, "UuidGenerator");
qmlRegisterType<WebSocketTest>("Honeycomb", 1, 0, "WebSocketTest");
qmlRegisterType<RestfulTest>("Honeycomb", 1, 0, "RestfulTest");
qmlRegisterType<MQTTListener>("Honeycomb", 1, 0, "MQTTListener");
qmlRegisterType<MQTTPublisher>("Honeycomb", 1, 0, "MQTTPublisher");
qmlRegisterType<SubnetCalculator>("Honeycomb", 1, 0, "SubnetCalculator");
qmlRegisterType<RTSPViewer>("Honeycomb", 1, 0, "RTSPViewer");
qmlRegisterType<ResistorCalculator>("Honeycomb", 1, 0, "ResistorCalculator");
qmlRegisterType<FolderHttpServer>("Honeycomb", 1, 0, "FolderHttpServer");
qmlRegisterType<FakeApiServer>("Honeycomb", 1, 0, "FakeApiServer");
qmlRegisterType<SMCrypto>("Honeycomb", 1, 0, "SMCrypto");
qmlRegisterType<AESCrypto>("Honeycomb", 1, 0, "AESCrypto");
qmlRegisterType<OpenAIClient>("Honeycomb", 1, 0, "OpenAIClient");
qmlRegisterType<AgentPromptManager>("Honeycomb", 1, 0, "AgentPromptManager");
qmlRegisterType<DNSLookupTool>("Honeycomb", 1, 0, "DNSLookupTool");
qmlRegisterType<EnvironmentPathTool>("Honeycomb", 1, 0, "EnvironmentPathTool");
qmlRegisterType<ProcessManagerTool>("Honeycomb", 1, 0, "ProcessManagerTool");
qmlRegisterType<FileHashCalculator>("Honeycomb", 1, 0, "FileHashCalculator");
qmlRegisterType<FileUtilityTool>("Honeycomb", 1, 0, "FileUtilityTool");
qmlRegisterType<UpdateChecker>("Honeycomb", 1, 0, "UpdateChecker");
qmlRegisterType<SerialPortTool>("Honeycomb", 1, 0, "SerialPortTool");
qmlRegisterType<WindowElementInspector>("Honeycomb", 1, 0, "WindowElementInspector");
qmlRegisterType<GameAssetGenerator>("Honeycomb", 1, 0, "GameAssetGenerator");
QQmlApplicationEngine engine;
// 添加图像提供器到引擎
engine.addImageProvider("barcode", g_barcodeImageProvider);
engine.addImageProvider("qrcode", g_qrcodeImageProvider);
engine.addImageProvider("qrscanner", g_qrScannerImageProvider);
// 唯一版本事实来源是 CMakeLists.txt 里的 PROJECT_VERSION,经编译期宏下发,
// 避免 i18n 写死版本号与「关于」页实际显示不一致。
engine.rootContext()->setContextProperty("appVersion", QStringLiteral(HONEYCOMB_VERSION));
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("Honeycomb", "Main");
return app.exec();
}