增加cmd功能
This commit is contained in:
parent
b328cce9e6
commit
ba091b20f7
@ -74,12 +74,12 @@ FILE(GLOB src_sui "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/
|
||||
SET(PROJECT_SOURCES ${src_sui})
|
||||
|
||||
# 设置消息策略为qFatal来禁用qDebug信息
|
||||
#LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
||||
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
||||
|
||||
#资源文件
|
||||
QT6_ADD_RESOURCES(RCFILES res.qrc)
|
||||
#WIN32
|
||||
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${RCFILES} sui.rc)
|
||||
add_executable(${PROJECT_NAME} WIN32 ${PROJECT_SOURCES} ${RCFILES} sui.rc)
|
||||
|
||||
#安全编译
|
||||
#关闭RPATH特性
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
{
|
||||
"directoryIndex" : 0,
|
||||
"id" : "ctai::@6890427a1f51a3e7e1df",
|
||||
"jsonFile" : "target-ctai-Release-601e6aae1d47dea85cb1.json",
|
||||
"jsonFile" : "target-ctai-Release-642fcbdf8fb13058c3fb.json",
|
||||
"name" : "ctai",
|
||||
"projectIndex" : 0
|
||||
},
|
||||
@ -26,7 +26,7 @@
|
||||
"objects" :
|
||||
[
|
||||
{
|
||||
"jsonFile" : "codemodel-v2-f8cc5c54d0ff22bbea60.json",
|
||||
"jsonFile" : "codemodel-v2-25101bfd9591b46c49cf.json",
|
||||
"kind" : "codemodel",
|
||||
"version" :
|
||||
{
|
||||
@ -99,7 +99,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"jsonFile" : "codemodel-v2-f8cc5c54d0ff22bbea60.json",
|
||||
"jsonFile" : "codemodel-v2-25101bfd9591b46c49cf.json",
|
||||
"kind" : "codemodel",
|
||||
"version" :
|
||||
{
|
||||
@ -68,7 +68,9 @@
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake",
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake",
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6Core/Qt6CoreTargets.cmake",
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6/FindWrapPCRE2.cmake"
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6/FindWrapPCRE2.cmake",
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6EntryPointPrivate/Qt6EntryPointPrivateTargets.cmake",
|
||||
"D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake/Qt6EntryPointPrivate/Qt6EntryPointPrivateConfig.cmake"
|
||||
],
|
||||
"nodes" :
|
||||
[
|
||||
@ -1043,6 +1045,50 @@
|
||||
"line" : 76,
|
||||
"parent" : 169
|
||||
},
|
||||
{
|
||||
"command" : 15,
|
||||
"file" : 29,
|
||||
"line" : 47,
|
||||
"parent" : 154
|
||||
},
|
||||
{
|
||||
"command" : 14,
|
||||
"file" : 18,
|
||||
"line" : 143,
|
||||
"parent" : 171
|
||||
},
|
||||
{
|
||||
"command" : 7,
|
||||
"file" : 17,
|
||||
"line" : 76,
|
||||
"parent" : 172
|
||||
},
|
||||
{
|
||||
"command" : 6,
|
||||
"file" : 0,
|
||||
"line" : 859,
|
||||
"parent" : 173
|
||||
},
|
||||
{
|
||||
"file" : 34,
|
||||
"parent" : 174
|
||||
},
|
||||
{
|
||||
"command" : 5,
|
||||
"file" : 34,
|
||||
"line" : 55,
|
||||
"parent" : 175
|
||||
},
|
||||
{
|
||||
"file" : 33,
|
||||
"parent" : 176
|
||||
},
|
||||
{
|
||||
"command" : 4,
|
||||
"file" : 33,
|
||||
"line" : 61,
|
||||
"parent" : 177
|
||||
},
|
||||
{
|
||||
"command" : 18,
|
||||
"file" : 1,
|
||||
@ -1063,7 +1109,7 @@
|
||||
"compileCommandFragments" :
|
||||
[
|
||||
{
|
||||
"fragment" : " -fstack-protector-strong -fpic -fpie -s -O3 -DNDEBUG -std=gnu++17"
|
||||
"fragment" : "-DQT_NO_DEBUG_OUTPUT -fstack-protector-strong -fpic -fpie -s -O3 -DNDEBUG -std=gnu++17"
|
||||
},
|
||||
{
|
||||
"backtrace" : 4,
|
||||
@ -1089,9 +1135,13 @@
|
||||
"define" : "QT_GUI_LIB"
|
||||
},
|
||||
{
|
||||
"backtrace" : 171,
|
||||
"backtrace" : 179,
|
||||
"define" : "QT_MESSAGELOGCONTEXT"
|
||||
},
|
||||
{
|
||||
"backtrace" : 4,
|
||||
"define" : "QT_NEEDS_QMAIN"
|
||||
},
|
||||
{
|
||||
"backtrace" : 4,
|
||||
"define" : "QT_NO_DEBUG"
|
||||
@ -1138,7 +1188,7 @@
|
||||
"path" : "F:/SourceCode/ctai/build/ctai_autogen/include"
|
||||
},
|
||||
{
|
||||
"backtrace" : 172,
|
||||
"backtrace" : 180,
|
||||
"path" : "F:/SourceCode/ctai/3rdparty/json/include"
|
||||
},
|
||||
{
|
||||
@ -1181,15 +1231,16 @@
|
||||
[
|
||||
0,
|
||||
2,
|
||||
5,
|
||||
7,
|
||||
9,
|
||||
11,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
10,
|
||||
12,
|
||||
16,
|
||||
18,
|
||||
20,
|
||||
22
|
||||
13,
|
||||
17,
|
||||
19,
|
||||
21,
|
||||
23
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1208,9 +1259,13 @@
|
||||
"define" : "QT_GUI_LIB"
|
||||
},
|
||||
{
|
||||
"backtrace" : 171,
|
||||
"backtrace" : 179,
|
||||
"define" : "QT_MESSAGELOGCONTEXT"
|
||||
},
|
||||
{
|
||||
"backtrace" : 4,
|
||||
"define" : "QT_NEEDS_QMAIN"
|
||||
},
|
||||
{
|
||||
"backtrace" : 4,
|
||||
"define" : "QT_NO_DEBUG"
|
||||
@ -1257,7 +1312,7 @@
|
||||
"path" : "F:/SourceCode/ctai/build/ctai_autogen/include"
|
||||
},
|
||||
{
|
||||
"backtrace" : 172,
|
||||
"backtrace" : 180,
|
||||
"path" : "F:/SourceCode/ctai/3rdparty/json/include"
|
||||
},
|
||||
{
|
||||
@ -1289,7 +1344,7 @@
|
||||
"language" : "RC",
|
||||
"sourceIndexes" :
|
||||
[
|
||||
23
|
||||
24
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -1309,11 +1364,11 @@
|
||||
"commandFragments" :
|
||||
[
|
||||
{
|
||||
"fragment" : "-fstack-protector-strong -fpic -fpie -s -O3 -DNDEBUG",
|
||||
"fragment" : "-DQT_NO_DEBUG_OUTPUT -fstack-protector-strong -fpic -fpie -s -O3 -DNDEBUG",
|
||||
"role" : "flags"
|
||||
},
|
||||
{
|
||||
"fragment" : "-static",
|
||||
"fragment" : "-static -mwindows",
|
||||
"role" : "flags"
|
||||
},
|
||||
{
|
||||
@ -1766,11 +1821,6 @@
|
||||
"fragment" : "-lole32",
|
||||
"role" : "libraries"
|
||||
},
|
||||
{
|
||||
"backtrace" : 164,
|
||||
"fragment" : "-lshell32",
|
||||
"role" : "libraries"
|
||||
},
|
||||
{
|
||||
"backtrace" : 164,
|
||||
"fragment" : "-luser32",
|
||||
@ -1801,6 +1851,21 @@
|
||||
"fragment" : "D:\\Dev\\Qt\\6.8.0\\mingw1310_static_x64\\lib\\libQt6BundledPcre2.a",
|
||||
"role" : "libraries"
|
||||
},
|
||||
{
|
||||
"backtrace" : 178,
|
||||
"fragment" : "-lmingw32",
|
||||
"role" : "libraries"
|
||||
},
|
||||
{
|
||||
"backtrace" : 178,
|
||||
"fragment" : "D:\\Dev\\Qt\\6.8.0\\mingw1310_static_x64\\lib\\libQt6EntryPoint.a",
|
||||
"role" : "libraries"
|
||||
},
|
||||
{
|
||||
"backtrace" : 164,
|
||||
"fragment" : "-lshell32",
|
||||
"role" : "libraries"
|
||||
},
|
||||
{
|
||||
"fragment" : "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32",
|
||||
"role" : "libraries"
|
||||
@ -1823,16 +1888,17 @@
|
||||
[
|
||||
0,
|
||||
2,
|
||||
5,
|
||||
7,
|
||||
9,
|
||||
11,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
10,
|
||||
12,
|
||||
16,
|
||||
18,
|
||||
20,
|
||||
22,
|
||||
23
|
||||
13,
|
||||
17,
|
||||
19,
|
||||
21,
|
||||
23,
|
||||
24
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1841,31 +1907,31 @@
|
||||
[
|
||||
1,
|
||||
3,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
10,
|
||||
13,
|
||||
5,
|
||||
7,
|
||||
9,
|
||||
11,
|
||||
14,
|
||||
15,
|
||||
17,
|
||||
19,
|
||||
21
|
||||
16,
|
||||
18,
|
||||
20,
|
||||
22
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"sourceIndexes" :
|
||||
[
|
||||
24,
|
||||
25
|
||||
25,
|
||||
26
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "CMake Rules",
|
||||
"sourceIndexes" :
|
||||
[
|
||||
26
|
||||
27
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -1894,6 +1960,12 @@
|
||||
"path" : "src/ctai.h",
|
||||
"sourceGroupIndex" : 1
|
||||
},
|
||||
{
|
||||
"backtrace" : 2,
|
||||
"compileGroupIndex" : 0,
|
||||
"path" : "src/ctai_cmd.cpp",
|
||||
"sourceGroupIndex" : 0
|
||||
},
|
||||
{
|
||||
"backtrace" : 2,
|
||||
"path" : "src/ctai_cmd.h",
|
||||
Binary file not shown.
@ -1,20 +1,46 @@
|
||||
# ninja log v6
|
||||
20 2270 7620129029193625 F:/SourceCode/ctai/build/ctai_autogen/timestamp da3870ebc94b983e
|
||||
210 7974 7620084108460910 CMakeFiles/ctai.dir/src/sui.cpp.obj 3a17342904b8ace9
|
||||
20 2270 7620129029193625 F:/SourceCode/ctai/build/ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
15 8440 7620129158012852 F:/SourceCode/ctai/release/ctai.exe d07dbe2fe2f24af5
|
||||
17 2367 7620173693294593 ctai_autogen/timestamp da3870ebc94b983e
|
||||
2374 5935 7620173694463595 CMakeFiles/ctai.dir/src/ctai_tabwidget.cpp.obj 26d34a8cec6dc832
|
||||
3360 7747 7620168389560055 CMakeFiles/ctai.dir/qrc_res.cpp.obj 510d38eb24bea575
|
||||
3363 3701 7620168389589328 CMakeFiles/ctai.dir/sui.rc.obj c9433bc06ae3177e
|
||||
3347 16117 7620168389525068 CMakeFiles/ctai.dir/src/sui_title.cpp.obj 77eca22caea5afa2
|
||||
17 2367 7620173693294593 ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
2368 11198 7620173694404536 CMakeFiles/ctai.dir/ctai_autogen/mocs_compilation.cpp.obj db4509ef7457ed56
|
||||
3336 8299 7620168389317284 CMakeFiles/ctai.dir/src/ctai_tabbar.cpp.obj 60def43fc7c54455
|
||||
17 2367 7620173693294593 F:/SourceCode/ctai/build/ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
19733 29429 7620168553289383 F:/SourceCode/ctai/release/ctai.exe a422ac75e0552518
|
||||
194 386 7620072809272710 qrc_res.cpp 9794859fafc6825
|
||||
2271 10332 7620129030264664 CMakeFiles/ctai.dir/ctai_autogen/mocs_compilation.cpp.obj edff554b6683ac05
|
||||
20 2270 7620129029193625 ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
2273 9802 7620129030284197 CMakeFiles/ctai.dir/src/ctai.cpp.obj 79ab2194a4efa9b8
|
||||
2702 16863 7619293577120399 CMakeFiles/ctai.dir/src/sui_base_ex.cpp.obj 368ad9f813e51b15
|
||||
2277 9877 7620129030323225 CMakeFiles/ctai.dir/src/main.cpp.obj d96562025bd651b1
|
||||
2386 6452 7620078363875523 CMakeFiles/ctai.dir/src/ctai_session_widget.cpp.obj 1a04d5acea767e5e
|
||||
3342 15668 7620168389376356 CMakeFiles/ctai.dir/src/sui.cpp.obj 26a72315dd41d08a
|
||||
17 2367 7620173693294593 F:/SourceCode/ctai/build/ctai_autogen/timestamp da3870ebc94b983e
|
||||
3346 7756 7620168389415391 CMakeFiles/ctai.dir/src/sui_sys_style.cpp.obj 8efcdb8792bc7a18
|
||||
194 386 7620072809272710 F:/SourceCode/ctai/build/qrc_res.cpp 9794859fafc6825
|
||||
2704 6340 7619293577140184 CMakeFiles/ctai.dir/src/sui_sys_style.cpp.obj 712945df03e1fd7c
|
||||
235 8251 7620082904028313 CMakeFiles/ctai.dir/src/sui_title.cpp.obj 67e43e317c0f47c0
|
||||
20 2270 7620129029193625 ctai_autogen/timestamp da3870ebc94b983e
|
||||
2711 2819 7619293577208536 CMakeFiles/ctai.dir/sui.rc.obj 965e8028b6b04830
|
||||
388 2330 7620072809449452 CMakeFiles/ctai.dir/qrc_res.cpp.obj ccb95bbd074e4298
|
||||
2275 5713 7620129030303707 CMakeFiles/ctai.dir/src/ctai_tabwidget.cpp.obj e5d1869d361be35f
|
||||
188 2699 7620123897315533 CMakeFiles/ctai.dir/src/ctai_tabbar.cpp.obj 38289d2306b6b65a
|
||||
3334 8584 7620168389297772 CMakeFiles/ctai.dir/src/ctai_session_widget.cpp.obj 4337be8a8de54883
|
||||
3344 19733 7620168389395874 CMakeFiles/ctai.dir/src/sui_base_ex.cpp.obj 7f58ed4db09a4121
|
||||
2375 10992 7620173694483114 CMakeFiles/ctai.dir/src/main.cpp.obj 25b8fb9b9fa19542
|
||||
2370 10850 7620173694424066 CMakeFiles/ctai.dir/src/ctai.cpp.obj 9276df81a6dd9073
|
||||
16 2244 7620174122415386 ctai_autogen/timestamp da3870ebc94b983e
|
||||
16 2244 7620174122415386 ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
16 2244 7620174122415386 F:/SourceCode/ctai/build/ctai_autogen/timestamp da3870ebc94b983e
|
||||
16 2244 7620174122415386 F:/SourceCode/ctai/build/ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
2248 5880 7620174123363067 CMakeFiles/ctai.dir/src/ctai_cmd.cpp.obj ed42bda78c01626
|
||||
2250 6093 7620174123372846 CMakeFiles/ctai.dir/src/ctai_tabwidget.cpp.obj 26d34a8cec6dc832
|
||||
2246 10613 7620174123343424 CMakeFiles/ctai.dir/src/ctai.cpp.obj 9276df81a6dd9073
|
||||
2251 10624 7620174123392370 CMakeFiles/ctai.dir/src/main.cpp.obj 25b8fb9b9fa19542
|
||||
2245 10865 7620174123323634 CMakeFiles/ctai.dir/ctai_autogen/mocs_compilation.cpp.obj db4509ef7457ed56
|
||||
10865 19214 7620174209531361 F:/SourceCode/ctai/release/ctai.exe fe061b55ed384849
|
||||
14 243 7620174637232800 ctai_autogen/timestamp da3870ebc94b983e
|
||||
14 243 7620174637232800 ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
14 243 7620174637232800 F:/SourceCode/ctai/build/ctai_autogen/timestamp da3870ebc94b983e
|
||||
14 243 7620174637232800 F:/SourceCode/ctai/build/ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
274 2975 7620174639828024 CMakeFiles/ctai.dir/src/ctai_cmd.cpp.obj ed42bda78c01626
|
||||
2976 12267 7620174666846481 F:/SourceCode/ctai/release/ctai.exe fe061b55ed384849
|
||||
17 2276 7620176792525755 ctai_autogen/timestamp da3870ebc94b983e
|
||||
17 2276 7620176792525755 ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
17 2276 7620176792525755 F:/SourceCode/ctai/build/ctai_autogen/timestamp da3870ebc94b983e
|
||||
17 2276 7620176792525755 F:/SourceCode/ctai/build/ctai_autogen/mocs_compilation.cpp da3870ebc94b983e
|
||||
2280 5672 7620176793534426 CMakeFiles/ctai.dir/src/ctai_cmd.cpp.obj ed42bda78c01626
|
||||
2283 5820 7620176793569330 CMakeFiles/ctai.dir/src/ctai_tabwidget.cpp.obj 26d34a8cec6dc832
|
||||
2278 10394 7620176793524659 CMakeFiles/ctai.dir/src/ctai.cpp.obj 9276df81a6dd9073
|
||||
2285 10413 7620176793590390 CMakeFiles/ctai.dir/src/main.cpp.obj 25b8fb9b9fa19542
|
||||
2276 10661 7620176793495379 CMakeFiles/ctai.dir/ctai_autogen/mocs_compilation.cpp.obj db4509ef7457ed56
|
||||
10662 19650 7620176877355860 F:/SourceCode/ctai/release/ctai.exe fe061b55ed384849
|
||||
|
||||
Binary file not shown.
BIN
build/CMakeFiles/ctai.dir/src/ctai_cmd.cpp.obj
Normal file
BIN
build/CMakeFiles/ctai.dir/src/ctai_cmd.cpp.obj
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -466,6 +466,7 @@
|
||||
"QT_CORE_LIB",
|
||||
"QT_GUI_LIB",
|
||||
"QT_MESSAGELOGCONTEXT",
|
||||
"QT_NEEDS_QMAIN",
|
||||
"QT_NO_DEBUG",
|
||||
"QT_WIDGETS_LIB",
|
||||
"UNICODE",
|
||||
@ -533,6 +534,7 @@
|
||||
"SOURCES" :
|
||||
[
|
||||
[ "F:/SourceCode/ctai/src/ctai.cpp", "MU", null ],
|
||||
[ "F:/SourceCode/ctai/src/ctai_cmd.cpp", "MU", null ],
|
||||
[ "F:/SourceCode/ctai/src/ctai_session_widget.cpp", "MU", null ],
|
||||
[ "F:/SourceCode/ctai/src/ctai_tabbar.cpp", "MU", null ],
|
||||
[ "F:/SourceCode/ctai/src/ctai_tabwidget.cpp", "MU", null ],
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
moc:b2ef207d9e0c6a8f9862dc17c336f148b62c8f4eb00476a5447bae33346c778b
|
||||
moc:83796c023ab33d503582511eb571caaefe3ce0b526aefa399464ee37baa1c2f8
|
||||
uic:112cbdb5924982d8a55bab754383a3ad4ae11fd691919828dbe5441faa671856
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -37,9 +37,10 @@ namespace {
|
||||
struct qt_meta_stringdata_CLASSctai_cmdENDCLASS_t {};
|
||||
constexpr auto qt_meta_stringdata_CLASSctai_cmdENDCLASS = QtMocHelpers::stringData(
|
||||
"ctai_cmd",
|
||||
"executeCommand",
|
||||
"slots_executeCommand",
|
||||
"",
|
||||
"command"
|
||||
"command",
|
||||
"slots_readProcessOutput"
|
||||
);
|
||||
#else // !QT_MOC_HAS_STRINGDATA
|
||||
#error "qtmochelpers.h not found or too old."
|
||||
@ -52,7 +53,7 @@ Q_CONSTINIT static const uint qt_meta_data_CLASSctai_cmdENDCLASS[] = {
|
||||
12, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
1, 14, // methods
|
||||
2, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
@ -60,10 +61,12 @@ Q_CONSTINIT static const uint qt_meta_data_CLASSctai_cmdENDCLASS[] = {
|
||||
0, // signalCount
|
||||
|
||||
// slots: name, argc, parameters, tag, flags, initial metatype offsets
|
||||
1, 1, 20, 2, 0x08, 1 /* Private */,
|
||||
1, 1, 26, 2, 0x08, 1 /* Private */,
|
||||
4, 0, 29, 2, 0x08, 3 /* Private */,
|
||||
|
||||
// slots: parameters
|
||||
QMetaType::Void, QMetaType::QString, 3,
|
||||
QMetaType::Void,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
@ -77,9 +80,11 @@ Q_CONSTINIT const QMetaObject ctai_cmd::staticMetaObject = { {
|
||||
qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSctai_cmdENDCLASS_t,
|
||||
// Q_OBJECT / Q_GADGET
|
||||
QtPrivate::TypeAndForceComplete<ctai_cmd, std::true_type>,
|
||||
// method 'executeCommand'
|
||||
// method 'slots_executeCommand'
|
||||
QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
QtPrivate::TypeAndForceComplete<const QString &, std::false_type>
|
||||
QtPrivate::TypeAndForceComplete<const QString &, std::false_type>,
|
||||
// method 'slots_readProcessOutput'
|
||||
QtPrivate::TypeAndForceComplete<void, std::false_type>
|
||||
>,
|
||||
nullptr
|
||||
} };
|
||||
@ -90,7 +95,8 @@ void ctai_cmd::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, vo
|
||||
auto *_t = static_cast<ctai_cmd *>(_o);
|
||||
(void)_t;
|
||||
switch (_id) {
|
||||
case 0: _t->executeCommand((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1]))); break;
|
||||
case 0: _t->slots_executeCommand((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1]))); break;
|
||||
case 1: _t->slots_readProcessOutput(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
@ -115,13 +121,13 @@ int ctai_cmd::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 1)
|
||||
if (_id < 2)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 1;
|
||||
_id -= 2;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
if (_id < 1)
|
||||
if (_id < 2)
|
||||
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();
|
||||
_id -= 1;
|
||||
_id -= 2;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
||||
@ -1182,6 +1182,7 @@ ctai_autogen/timestamp: \
|
||||
F:/SourceCode/ctai/src/common.h \
|
||||
F:/SourceCode/ctai/src/ctai.cpp \
|
||||
F:/SourceCode/ctai/src/ctai.h \
|
||||
F:/SourceCode/ctai/src/ctai_cmd.cpp \
|
||||
F:/SourceCode/ctai/src/ctai_cmd.h \
|
||||
F:/SourceCode/ctai/src/ctai_session_widget.cpp \
|
||||
F:/SourceCode/ctai/src/ctai_session_widget.h \
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#define __FLT32_MIN_EXP__ (-125)
|
||||
#define __cpp_static_assert 201411L
|
||||
#define __BFLT16_MIN_10_EXP__ (-37)
|
||||
#define QT_NEEDS_QMAIN 1
|
||||
#define QT_GUI_LIB 1
|
||||
#define __ORDER_LITTLE_ENDIAN__ 1234
|
||||
#define __WCHAR_MAX__ 0xffff
|
||||
|
||||
BIN
release/ctai.exe
BIN
release/ctai.exe
Binary file not shown.
55
src/ctai_cmd.cpp
Normal file
55
src/ctai_cmd.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "ctai_cmd.h"
|
||||
|
||||
ctai_cmd::ctai_cmd()
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
textEdit = new QPlainTextEdit(this);
|
||||
textEdit->setReadOnly(false); // 允许编辑,以便模拟命令行输入输出环境
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
QLineEdit *lineEdit = new QLineEdit(this);
|
||||
layout->addWidget(lineEdit);
|
||||
layout->setStretch(0, 8);
|
||||
layout->setStretch(1, 2);
|
||||
connect(lineEdit, &QLineEdit::returnPressed, this, [this, lineEdit]()
|
||||
{
|
||||
slots_executeCommand(lineEdit->text());
|
||||
lineEdit->clear(); // 清空输入框
|
||||
});
|
||||
process = new QProcess(this);
|
||||
process->setProcessChannelMode(QProcess::MergedChannels); // 合并输出通道
|
||||
connect(process, &QProcess::readyRead, this, &ctai_cmd::slots_readProcessOutput);
|
||||
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
[](int code, QProcess::ExitStatus status){
|
||||
QMessageBox::warning(nullptr, "Process",
|
||||
QString("进程异常退出,代码:%1").arg(code));
|
||||
});
|
||||
// 启动Shell
|
||||
#ifdef Q_OS_WIN
|
||||
process->start("cmd.exe");
|
||||
#else
|
||||
process->start("/bin/bash");
|
||||
#endif
|
||||
}
|
||||
ctai_cmd::~ctai_cmd()
|
||||
{
|
||||
|
||||
}
|
||||
void ctai_cmd::slots_readProcessOutput() {
|
||||
// 实时读取输出
|
||||
QByteArray output = process->readAll();
|
||||
textEdit->appendPlainText(QString::fromLocal8Bit(output));
|
||||
|
||||
// 自动滚动到底部
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
textEdit->setTextCursor(cursor);
|
||||
}
|
||||
void ctai_cmd::slots_executeCommand(const QString &command)
|
||||
{
|
||||
if (!command.isEmpty()) {
|
||||
// 写入命令到进程
|
||||
process->write(command.toLocal8Bit() + "\n");
|
||||
textEdit->appendPlainText("> " + command); // 显示输入命令
|
||||
}
|
||||
}
|
||||
@ -8,37 +8,18 @@
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QProcess>
|
||||
class ctai_cmd : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ctai_cmd(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
textEdit = new QPlainTextEdit(this);
|
||||
textEdit->setReadOnly(false); // 允许编辑,以便模拟命令行输入输出环境
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
QLineEdit *lineEdit = new QLineEdit(this);
|
||||
layout->addWidget(lineEdit);
|
||||
connect(lineEdit, &QLineEdit::returnPressed, this, [this, lineEdit]() {
|
||||
executeCommand(lineEdit->text());
|
||||
lineEdit->clear(); // 清空输入框
|
||||
});
|
||||
}
|
||||
|
||||
ctai_cmd();
|
||||
~ctai_cmd();
|
||||
private slots:
|
||||
void executeCommand(const QString &command) {
|
||||
QStringList args = command.split(' '); // 假设我们以空格分割命令和参数来模拟简单的CLI处理。实际应用中可能需要更复杂的解析。
|
||||
if (args.isEmpty()) return; // 没有命令时不做任何事。
|
||||
QString cmd = args.takeFirst(); // 第一个参数是命令名,其余是参数。实际应用中可能需要更复杂的命令解析。
|
||||
// 这里简单处理为直接在文本编辑器中显示命令和可能的输出(实际应用中可能需要调用外部程序)
|
||||
textEdit->appendPlainText("Executing: " + command); // 模拟命令执行前的显示。实际应调用外部程序。
|
||||
// 模拟外部程序执行结果,实际应用中需要替换这部分逻辑。例如:使用QProcess启动外部程序并读取输出。
|
||||
textEdit->appendPlainText("Output: This is a mock output."); // 模拟输出结果。实际应用中应从外部程序获取输出。
|
||||
}
|
||||
|
||||
void slots_executeCommand(const QString &command);
|
||||
void slots_readProcessOutput();
|
||||
private:
|
||||
QPlainTextEdit *textEdit;
|
||||
QPlainTextEdit* textEdit;
|
||||
QProcess* process;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -16,5 +16,4 @@ void ctai_tabwidget::init_layout(){
|
||||
addTab(new QWidget(),QIcon(":/res/img/btn/btn_tips.png"),tr("提示词"));
|
||||
addTab(new QWidget(),QIcon(":/res/img/btn/btn_setting.png"),tr("设置"));
|
||||
addTab(new QWidget(),QIcon(":/res/img/btn/btn_about.png"),tr("关于"));
|
||||
qDebug()<<tabBar();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user