Compare commits

...

65 Commits

Author SHA1 Message Date
Lu Zhen eb44ce7fc0 chore: add additional instructions to the readme
Log:
Change-Id: I8ac1ead32ebd9e0c0c34397db243fbbd2de67b7d
2025-10-13 01:28:46 +00:00
Lu Zhen 04e53350eb chore: rename ide in readme
change deepin-unioncode to deepin-ide

Log:
Change-Id: Iedf7266fdbacf152eb9d5cb50085a365d2101862
2025-09-29 07:38:23 +00:00
Lu Zhen 9c43c39bd8 chore: remove inner address
Log:
Change-Id: Ib57cc7df13749ccf670758b540172478afbb288e
2025-07-17 14:39:33 +08:00
Lu Zhen 08f999be68 chore: remove rr debugger install option
Log:
Change-Id: I5d94bac93f14d245a9bdcdc34377a59001367201
2025-07-09 10:07:02 +08:00
Liu Zhangjian 85340462ab fix: enhance LSP client validation and menu actions
- Updated the LSP client to include a validity check for the client before performing actions.
- Added a new method `isValid()` to the `Client` class to return the validity status.
- Modified the `selectLspServer` method to check if the client is valid before proceeding.
- Updated the context menu actions in `LanguageClientHandler` to enable or disable based on the client's validity.
- Introduced a new member variable `isClientValid` in `ClientPrivate` to track the client's state.

Log: This change improves the robustness of the LSP client interactions by ensuring actions are only available when the client is in a valid state.
Bug: https://pms.uniontech.com/bug-view-319109.html
2025-06-11 11:37:48 +08:00
Liu Zhangjian a99a7ca49e fix: add pip existence check before installation
- Implemented a method to check if pip is installed before attempting to install packages. If pip is not found, the installer will now install python3-pip first and then proceed with the package installation.

Log: fix bug
Bug: https://pms.uniontech.com/bug-view-316965.html
2025-06-11 10:17:47 +08:00
Lu Zhen 607d8a2b71 chore: update spdx info
Log:
Change-Id: I95b31b5ac10f9ea3217019cca628a45b0797f4ac
2025-05-27 10:28:48 +08:00
Lu Zhen 2d85f0b558 doc: update notice file
Log:
Change-Id: I0d9d870fb1142ae84fbf68985b717558c3263335
2025-05-19 15:51:15 +08:00
ZhangTingan 218c09f2ec fix: The logs are not displayed in the same window before and after debugging starts.
Log: as title

Bug:
2025-05-15 19:47:02 +08:00
ZhangTingan fb548f310e fix: can`t handle terminated event from debugpy
Log: cppdap does not process event which body is empty, but 'body'is an optional filed, it should handle such cases.

Bug:
2025-05-15 19:47:02 +08:00
ZhangTingan b66db44449 fix: Adapting to QProcess Usage in Qt 6
Log: The abnormal execution of QProcess resulted in empty fuser output, causing port availability verification to fail, which ultimately led to connection failures with the correct debugging backend and freeze ide

Bug: https://pms.uniontech.com/bug-view-315851.html
2025-05-14 09:52:11 +08:00
Lu Zhen c023178ec3 doc: add NOTICE file
NOTICE file contain LICENSE info

Log:
Change-Id: Ibfb80371571c0ceecc2c52e46e18b98face46418
2025-05-12 11:19:08 +08:00
Lu Zhen 82792f47b6 fix: block when debug python code
disconnect to debugpy that has closed

Log:
Change-Id: Ia57b8165dd7d2547c5053aee1776be22d2ac8f9b
2025-05-09 17:56:07 +08:00
Lu Zhen 1ff25476a5 fix: python debugpy cannot connect
debugpy started but not listen on port, so delay some time to wait it initialized.

Log:
Bug: https://pms.uniontech.com/bug-view-315851.html
Change-Id: I14cd10e5b1fcb63a91b38562f9898f71122fbb67
2025-05-09 15:59:08 +08:00
Lu Zhen 71c3a56914 tag: update to 1.4.11
Log:
Change-Id: Ie288af5db6c3752504eb28102257ae5c6beaad3c
2025-04-28 16:19:03 +08:00
Lu Zhen a9e0ba8ead fix: crashed when open plugin detail page
Log:
Bug: https://pms.uniontech.com/bug-view-314807.html
Change-Id: Ica69be9473023d282fb3e3ed5b09e2188d61d65e
2025-04-28 15:51:03 +08:00
Lu Zhen c3a0e2b3b7 fix: stop running not work
Log:
Bug: https://pms.uniontech.com/bug-view-314821.html
Change-Id: Ie16bdc54fc2b5ed0abbe1fd1fd6a0877926f0c09
2025-04-28 15:33:03 +08:00
Lu Zhen 92c1168624 fix: crash when use inlinechat
Log:
Bug: https://pms.uniontech.com/bug-view-314743.html
Change-Id: I9ccdb5b6ad4bf6e51d805e6b71aef77098fdd540
2025-04-25 17:13:01 +08:00
Lu Zhen 8d33848878 chore: refactor core cmake file
Log:
Change-Id: I94f88659da449e9c229ad5f6573d051e55b03001
2025-04-25 10:22:00 +08:00
Lu Zhen 27551a0e5a chore: refactor core cmakelists dependency
Log:
Change-Id: Idb7407697c0280e6a04919ff29b661dd7d24ca93
2025-04-24 20:12:01 +08:00
Lu Zhen 6f7e93b2e3 fix: build faild on mips
Log:
Change-Id: Ic993dce88f06fa0744d2ae0bc2ddd1b1b4ab9a8a
2025-04-24 19:43:44 +08:00
Lu Zhen 787c142436 tag: update to 1.4.10
Log:
Change-Id: I9fa5f0bff6de2e3233a0eb8494bc89ed5f3af512
2025-04-23 09:38:58 +08:00
luzhen 51f61d06cb
chore:Merge from qt6.8 branch (#1106)
* feat: adapt for Qt6.8

Log: as title

* feat: adapt qtermwidget for Qt6.8

log: as title

* feat: adapt Javascript plugin to qt6.8

log: as title

* fix: [base] build error in arm

add -fpic

Log: as title.

* chore: add comment in base cmake file

Log:
Change-Id: Id5c85a4f865e619ed1dd16dbee397d197f0fcfd2

* fix: build faild on arm platform

enable fpic flag

Log:
Change-Id: I1ae86cb8051484b80c455874ee3427436a168370

* tag: update to 1.4.4

Log:
Change-Id: I897dcd763bffadd1f6a5f1d6ab74422fcf9f8e8a

* chore: refactor control to adapt mips

Log:
Change-Id: Ifd5519f7b06a9f59bac0155a7b57d53e1900371d

---------

Co-authored-by: Zhangtingan <zhangtingan@uniontech.com>
2025-04-22 17:30:40 +08:00
Lu Zhen bac15c260b tag: update to 1.4.9
Log:
Change-Id: Iecc6414b09b4778fe9ac014e9c5239ae16b30885
2025-04-21 14:12:56 +08:00
Lu Zhen 0938a54f88 fix: wrong initialize position
Log:
Change-Id: Iec6ec233f3564020fe825600d8947390cfe5855e
2025-04-18 09:35:53 +08:00
Lu Zhen 2024cced33 chore: remove unused file
Log:
Change-Id: I4d8d6b02d238d6df0c4f6632b18d68215e6694b0
2025-03-25 10:43:02 +08:00
Lu Zhen 26d47a2636 tag: update to 1.4.8
Log:
Change-Id: I26d0296b764c7a08c1894464d70cb9a4ef9c5a52
2025-03-14 09:56:03 +08:00
Lu Zhen f9161e9425 chore: remove unused code
Log:
Change-Id: I9555be2595e5c4baad400f2923310bf40f720e2b
2025-03-13 19:24:02 +08:00
Lu Zhen 25917acc6c tag: update to 1.4.7
Log:
Change-Id: I2e11350167ace74f35ca6ca5c3d3b907364cf44d
2025-03-13 17:17:03 +08:00
Lu Zhen 089fddabab fix: crash when add or switch ai model
Log:
Change-Id: I94b7a575c8bbcfaad647f5ebebbfd389c6675c88
2025-03-12 13:11:02 +08:00
Lu Zhen 3e97e943d3 tag: update to 1.4.6
Log:
Bug:
Change-Id: I21a094d879158e1ec23dd3b234eea5700af39e74
2025-03-10 17:09:10 +08:00
Lu Zhen 37eb3b8d74 fix: models translation missed
add q_object in class to void this issue

Log: bug fix
Change-Id: Ia367d56b01d95f8bf4e0ac784abc27c9fc1ddad6
2025-03-10 11:09:20 +08:00
Lu Zhen 680351c70c translation: update
translate model path placeholder

Log:
Change-Id: I78a65ca964ccd3d1dddb076296843e219b2e6540
2025-03-07 15:30:08 +08:00
Lu Zhen be582efc69 fix: hide stop button when model changed
Log: bug fix
Bug: https://pms.uniontech.com/bug-view-306851.html
Change-Id: Iacae941b5509d913024f9937528d55e5e8cfe402
2025-03-07 15:01:06 +08:00
Lu Zhen 31f57702e5 fix: keep default model not configed
Log:
Bug: https://pms.uniontech.com/bug-view-306857.html
Change-Id: If1326f4d472406017d457393eb09a513d5bb3fbf
2025-03-07 15:01:06 +08:00
Lu Zhen 60a3a4157b chore: optimize chat page Interaction
user can input when chat is answering

Log: optimize
Bug: https://pms.uniontech.com/bug-view-306865.html
Change-Id: I81eb2a612d2dccf90f9cba78120895f921889285
2025-03-07 11:35:07 +08:00
Lu Zhen a814f86a84 chore: rewrite model api placeholder
tell user not input api path with /chat

Log: bug fix
Bug: https://pms.uniontech.com/bug-view-306873.html
Change-Id: I81dbcd13d72cb9724c9c32d32e55272d15859804
2025-03-07 10:13:07 +08:00
Lu Zhen 54979d9a7f fix: template dialog cannot stays on top in wayland
set WindowStaysOnTopHint flag to resolve this issue

Log: bug fix
Bug: https://pms.uniontech.com/bug-view-306899.html
Change-Id: I21332f5f0e9d6f6afdb914fcb43170e7e8cfcb5d
2025-03-06 21:20:41 +08:00
Lu Zhen 11e421cba2 fix: remove unused button
create session button in chat page not used

Log: https://pms.uniontech.com/bug-view-306951.html
Change-Id: If164025ff80b1153a85de084134504bb67050b23
2025-03-06 20:53:40 +08:00
Lu Zhen 5dbff524b0 tag: update to 1.4.5
Log:
Change-Id: I1f4488b59054ead8523bd748a323407be2316eea
2025-02-27 15:44:35 +08:00
Lu Zhen 09ad0ec45d chore: disable smartut
Log:
Change-Id: I6f416e554768043e54abddb356ebe4e935f7277a
2025-02-27 15:28:35 +08:00
Lu Zhen e0216424cd chore: update translation
Log:
Change-Id: Ie9693244b1199c45d7db730143f89e36c6e045b1
2025-02-24 14:30:32 +08:00
Lu Zhen 597353b43a feat: add model change feature
Log:
Change-Id: I24bb03cb56340e128d9e6ef5b415434807533229
2025-02-24 11:10:12 +08:00
Liu Zhangjian c7cab35b40 fix: [editor] The tooltip is empty
as title

Log: fix bug
Bug: https://pms.uniontech.com/bug-view-286251.html
2025-02-13 10:00:46 +08:00
Zhang TingAn c1d043ed9e refactor: [chat] rename of out-dated plugin "CodeGeeX" to "Chat"
Log: as title
2025-02-13 09:59:34 +08:00
Liu Zhangjian 7e78363d6c fix: [binarytool] Optimize the display
as title

Log: fix bug
Bug: https://pms.uniontech.com/bug-view-272447.html
2025-02-12 13:48:00 +08:00
Liu Zhangjian 141af362b1 fix: [editor] Comment exception
as title

Log: fix bug
Bug: https://pms.uniontech.com/bug-view-284991.html
2025-02-12 13:15:50 +08:00
Zhang TingAn ae9ddf99a5 fix: [template] optimized ui of "create new project/file" dialog
Log: as title

Bug: https://pms.uniontech.com/bug-view-285081.html
2025-02-12 13:14:47 +08:00
Zhang TingAn d9c74dca9d fix: [project] Disable actions for non-active project
disable build/run/cmake.. actions in right-clicked menu and mainwindow`s menu

Log: as title
2025-02-10 20:01:34 +08:00
Liu Zhangjian a7f82a6518 fix: The diagnostic info cannot be displayed
as title

Log: fix issue
2025-02-10 11:03:54 +08:00
Liu Zhangjian e0f985f1b7 feat: [diagnostic] Added diagnostic information repair functionality
as title

Log: Added diagnostic information repair functionality.
2025-02-07 17:14:32 +08:00
Liu Zhangjian 10fd01966a fix: [notification] Fixed item height issue
as title

Log: fix issue
2025-02-05 16:14:36 +08:00
Liu Zhangjian 2feb7db0c6 feat: [ut] Add the feature to update the project tree
as title

Log: new feature
2025-01-22 13:43:19 +08:00
Lu Zhen 5f32126f95 fix: build faild
Log:
Change-Id: Ibe88a57b4f761a3e2d7fa83605c78e7cf6d34399
2025-01-21 10:14:18 +08:00
Zhang TingAn bf834c0bc6 translations: update translations
Log: as title
2025-01-21 10:04:58 +08:00
Zhang TingAn 2e7cbb6bf5 feat: [chat] modified ui of chat
change text & icons & answer component

Log: as title
2025-01-20 18:02:08 +08:00
Liu Zhangjian dd9a1ea2a9 fix: [ut] IDE crashed
as title

Log: fix issue
2025-01-20 17:53:57 +08:00
Liu Zhangjian f9cae7726a fix: [ut] Fixed some issues
1.fixed issue with translations
2.Adjust the description of some items
3.Optimized display

Log: fix issues
2025-01-20 16:33:56 +08:00
Zhang TingAn f494b5a774 fix: [cmake] incomplete path of cmake error
Log: as title
2025-01-20 15:29:55 +08:00
Lu Zhen 1cbf1af88c fix: build faild
missing header

Log:
Change-Id: I430bee85438189e085c840577c57f94c6f21383a
2025-01-17 10:13:15 +08:00
Liu Zhangjian b17e425e2c chore: Update translations
as title

Log: update translations
2025-01-16 19:24:04 +08:00
Kakueeen c6664013c0
feat: [ut] New plugin for unit test (#1030)
as title

Log: unit test plugin
2025-01-16 17:24:20 +08:00
Zhang TingAn 4b5fd4acb7 fix: [Ai] fix issues of compatible llm
switch state when received failed message
cancel requesting when terminate before prompt preprocessed

Log: as title
2025-01-16 10:07:14 +08:00
Zhang TingAn a5da4015c7 fix: [cmake] When the executable program changes, the project properties cannot be updated.
Log: as title
2025-01-14 14:04:41 +08:00
Zhang TingAn c53ee8381d feat: [Ai] Adapt the existing AI capabilities to switch between multiple LLMs
remove copilotApi
remove askApi

disabled chat history functional.

Log: as title
2025-01-14 14:04:07 +08:00
1375 changed files with 12631 additions and 24638 deletions

3
.gitignore vendored
View File

@ -74,3 +74,6 @@ doc/html/*
# union code gen
.unioncode
*.unioncode
.cursor/
.cursorindexingignore
.specstory/

View File

@ -89,11 +89,6 @@ Files: 3rdparty/cppdap/src/*
Copyright: 2019 Google LLC
License: Apache-2.0
# googletest
Files: 3rdparty/cppdap/third_party/googletest/*
Copyright: 2019 Google LLC
License: BSD-3-Clause
# nolhmann
Files: 3rdparty/cppdap/third_party/json/*
Copyright: 2019 Google LLC

View File

@ -1,5 +1,7 @@
add_subdirectory(cppdap)
add_subdirectory(unioncode-GitQlient)
add_subdirectory(unioncode-qscintilla214)
if (QT_VERSION_MAJOR MATCHES 5)
add_subdirectory(unioncode-GitQlient)
endif()
add_subdirectory(unioncode-qtermwidget-0.14.1)
add_subdirectory(unioncode-jsonrpccpp)

View File

@ -30,6 +30,7 @@
#include <thread>
#include <unordered_map>
#include <vector>
#include <set>
#ifdef ENABLE_LOG
#define Log(message) printf("%s", message);
@ -418,7 +419,9 @@ class Impl : public dap::Session {
// "body" is an optional field for some events, such as "Terminated Event".
bool body_ok = true;
d->field("body", [&](dap::Deserializer* d) {
if (!typeinfo->deserialize(d, data)) {
// todo: to completed
std::set<std::string> bodyCanBeEmpty { "terminated" };
if (!typeinfo->deserialize(d, data) && bodyCanBeEmpty.find(event) == bodyCanBeEmpty.end()) {
body_ok = false;
}
return true;

View File

@ -64,7 +64,7 @@ QString Diff::strOperation(Operation op) {
QString Diff::toString() const {
QString prettyText = text;
// Replace linebreaks with Pilcrow signs.
prettyText.replace('\n', L'\u00b6');
prettyText.replace('\n', QChar(L'\u00b6'));
return QString("Diff(") + strOperation(operation) + QString(",\"")
+ prettyText + QString("\")");
}
@ -954,8 +954,8 @@ int diff_match_patch::diff_cleanupSemanticScore(const QString &one,
bool whitespace2 = nonAlphaNumeric2 && char2.isSpace();
bool lineBreak1 = whitespace1 && char1.category() == QChar::Other_Control;
bool lineBreak2 = whitespace2 && char2.category() == QChar::Other_Control;
bool blankLine1 = lineBreak1 && BLANKLINEEND.indexIn(one) != -1;
bool blankLine2 = lineBreak2 && BLANKLINESTART.indexIn(two) != -1;
bool blankLine1 = lineBreak1 && BLANKLINEEND.match(one).hasMatch();
bool blankLine2 = lineBreak2 && BLANKLINESTART.match(two).hasMatch();
if (blankLine1 || blankLine2) {
// Five points for blank lines.
@ -978,8 +978,8 @@ int diff_match_patch::diff_cleanupSemanticScore(const QString &one,
// Define some regex patterns for matching boundaries.
QRegExp diff_match_patch::BLANKLINEEND = QRegExp("\\n\\r?\\n$");
QRegExp diff_match_patch::BLANKLINESTART = QRegExp("^\\r?\\n\\r?\\n");
QRegularExpression diff_match_patch::BLANKLINEEND = QRegularExpression("\\n\\r?\\n$");
QRegularExpression diff_match_patch::BLANKLINESTART = QRegularExpression("^\\r?\\n\\r?\\n");
void diff_match_patch::diff_cleanupEfficiency(QList<Diff> &diffs) {
@ -1429,7 +1429,7 @@ int diff_match_patch::match_main(const QString &text, const QString &pattern,
throw "Null inputs. (match_main)";
}
loc = std::max(0, std::min(loc, text.length()));
loc = std::max(0, std::min(loc, int(text.length())));
if (text == pattern) {
// Shortcut (potentially not guaranteed by the algorithm)
return 0;
@ -1497,7 +1497,7 @@ int diff_match_patch::match_bitap(const QString &text, const QString &pattern,
// Use the result from this iteration as the maximum for the next.
bin_max = bin_mid;
int start = std::max(1, loc - bin_mid + 1);
int finish = std::min(loc + bin_mid, text.length()) + pattern.length();
int finish = std::min(loc + bin_mid, int(text.length()) + int(pattern.length()));
rd = new int[finish + 2];
rd[finish + 1] = (1 << d) - 1;
@ -1592,7 +1592,7 @@ void diff_match_patch::patch_addContext(Patch &patch, const QString &text) {
&& pattern.length() < Match_MaxBits - Patch_Margin - Patch_Margin) {
padding += Patch_Margin;
pattern = safeMid(text, std::max(0, patch.start2 - padding),
std::min(text.length(), patch.start2 + patch.length1 + padding)
std::min(int(text.length()), patch.start2 + patch.length1 + padding)
- std::max(0, patch.start2 - padding));
}
// Add one chunk for good luck.
@ -1606,7 +1606,7 @@ void diff_match_patch::patch_addContext(Patch &patch, const QString &text) {
}
// Add the suffix.
QString suffix = safeMid(text, patch.start2 + patch.length1,
std::min(text.length(), patch.start2 + patch.length1 + padding)
std::min(int(text.length()), patch.start2 + patch.length1 + padding)
- (patch.start2 + patch.length1));
if (!suffix.isEmpty()) {
patch.diffs.append(Diff(EQUAL, suffix));
@ -1974,7 +1974,7 @@ void diff_match_patch::patch_splitMax(QList<Patch> &patches) {
bigpatch.diffs.removeFirst();
} else {
// Deletion or equality. Only take as much as we can stomach.
diff_text = diff_text.left(std::min(diff_text.length(),
diff_text = diff_text.left(std::min(int(diff_text.length()),
patch_size - patch.length1 - Patch_Margin));
patch.length1 += diff_text.length();
start1 += diff_text.length();
@ -2035,37 +2035,42 @@ QList<Patch> diff_match_patch::patch_fromText(const QString &textline) {
if (textline.isEmpty()) {
return patches;
}
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QStringList text = textline.split("\n", QString::SkipEmptyParts);
#else
QStringList text = textline.split("\n", Qt::SkipEmptyParts);
#endif
Patch patch;
QRegExp patchHeader("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$");
QRegularExpression patchHeader("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$");
char sign;
QString line;
while (!text.isEmpty()) {
if (!patchHeader.exactMatch(text.front())) {
auto match = patchHeader.match(text.front());
if (!match.hasMatch()) {
throw QString("Invalid patch string: %1").arg(text.front());
}
patch = Patch();
patch.start1 = patchHeader.cap(1).toInt();
if (patchHeader.cap(2).isEmpty()) {
patch.start1 = match.captured(1).toInt();
if (match.captured(2).isEmpty()) {
patch.start1--;
patch.length1 = 1;
} else if (patchHeader.cap(2) == "0") {
} else if (match.captured(2) == "0") {
patch.length1 = 0;
} else {
patch.start1--;
patch.length1 = patchHeader.cap(2).toInt();
patch.length1 = match.captured(2).toInt();
}
patch.start2 = patchHeader.cap(3).toInt();
if (patchHeader.cap(4).isEmpty()) {
patch.start2 = match.captured(3).toInt();
if (match.captured(4).isEmpty()) {
patch.start2--;
patch.length2 = 1;
} else if (patchHeader.cap(4) == "0") {
} else if (match.captured(4) == "0") {
patch.length2 = 0;
} else {
patch.start2--;
patch.length2 = patchHeader.cap(4).toInt();
patch.length2 = match.captured(4).toInt();
}
text.removeFirst();

View File

@ -152,8 +152,8 @@ public:
private:
// Define some regex patterns for matching boundaries.
static QRegExp BLANKLINEEND;
static QRegExp BLANKLINESTART;
static QRegularExpression BLANKLINEEND;
static QRegularExpression BLANKLINESTART;
public:

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,11 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 COMPONENTS
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS
Widgets
PrintSupport
REQUIRED)
find_package(Dtk COMPONENTS Widget REQUIRED)
find_package(Dtk${DTK_VERSION_MAJOR} COMPONENTS Widget REQUIRED)
file(GLOB_RECURSE SRCS CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
@ -40,9 +39,9 @@ target_include_directories(${PROJECT_NAME}
target_link_libraries(
${PROJECT_NAME}
Qt5::Widgets
Qt5::PrintSupport
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::PrintSupport
${DtkWidget_LIBRARIES}
)
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${LIBRARY_INSTALL_PREFIX})
install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${LIBRARY_INSTALL_PREFIX})

View File

@ -28,8 +28,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(QT_MINIMUM_VERSION "5.7.1")
set(LXQTBT_MINIMUM_VERSION "0.6.0")
find_package(Qt5Widgets "${QT_MINIMUM_VERSION}" REQUIRED)
find_package(Qt5LinguistTools "${QT_MINIMUM_VERSION}" REQUIRED)
#find_package(Qt5Widgets "${QT_MINIMUM_VERSION}" REQUIRED)
#find_package(Qt5LinguistTools "${QT_MINIMUM_VERSION}" REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}LinguistTools REQUIRED)
if (${QT_VERSION_MAJOR} MATCHES 6)
find_package(Qt6Core5Compat REQUIRED)
endif()
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
if(USE_UTF8PROC)
@ -110,9 +115,15 @@ message(STATUS "Translations will be installed in: ${TRANSLATIONS_DIR}")
CHECK_FUNCTION_EXISTS(updwtmpx HAVE_UPDWTMPX)
qt5_wrap_cpp(MOCS ${HDRS})
qt5_wrap_ui(UI_SRCS ${UI})
set(PKG_CONFIG_REQ "Qt5Widgets")
if (${QT_VERSION_MAJOR} MATCHES 6)
qt6_wrap_cpp(MOCS ${HDRS})
qt6_wrap_ui(UI_SRCS ${UI})
else()
qt5_wrap_cpp(MOCS ${HDRS})
qt5_wrap_ui(UI_SRCS ${UI})
endif()
set(PKG_CONFIG_REQ "Qt${QT_VERSION_MAJOR}Widgets")
lxqt_translate_ts(QTERMWIDGET_QM
TRANSLATION_DIR "lib/translations"
@ -127,7 +138,10 @@ lxqt_translate_ts(QTERMWIDGET_QM
)
add_library(${QTERMWIDGET_LIBRARY_NAME} SHARED ${SRCS} ${MOCS} ${UI_SRCS} ${QTERMWIDGET_QM})
target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} Qt5::Widgets)
target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} Qt${QT_VERSION_MAJOR}::Widgets)
if (${QT_VERSION_MAJOR} MATCHES 6)
target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} Qt6::Core5Compat)
endif()
if(APPLE)
target_compile_definitions(${QTERMWIDGET_LIBRARY_NAME}

View File

@ -78,8 +78,12 @@ public:
union
{
/** The unicode character value for this character. */
wchar_t character;
/**
#if QT_VERSION >= 0x060000
char16_t character;
#else
wchar_t character;
#endif
/**
* Experimental addition which allows a single Character instance to contain more than
* one unicode character.
*

View File

@ -31,7 +31,7 @@
#include <QSettings>
#include <QDir>
#include <QRegularExpression>
#include <QRandomGenerator>
// KDE
//#include <KColorScheme>
@ -177,11 +177,9 @@ void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry)
}
ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const
{
Q_UNUSED(randomSeed);
Q_ASSERT( index >= 0 && index < TABLE_COLORS );
if ( randomSeed != 0 )
qsrand(randomSeed);
ColorEntry entry = colorTable()[index];
if ( randomSeed != 0 &&
@ -191,9 +189,9 @@ ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const
const RandomizationRange& range = _randomTable[index];
int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0;
int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0;
int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0;
int hueDifference = range.hue ? (QRandomGenerator::global()->bounded(range.hue)) - range.hue/2 : 0;
int saturationDifference = range.saturation ? (QRandomGenerator::global()->bounded(range.saturation)) - range.saturation/2 : 0;
int valueDifference = range.value ? (QRandomGenerator::global()->bounded(range.value)) - range.value/2 : 0;
QColor& color = entry.color;
@ -367,9 +365,9 @@ void ColorScheme::readColorEntry(QSettings * s , int index)
if (hexColorPattern.match(colorStr).hasMatch())
{
// Parsing is always ok as already matched by the regexp
r = colorStr.midRef(1, 2).toInt(nullptr, 16);
g = colorStr.midRef(3, 2).toInt(nullptr, 16);
b = colorStr.midRef(5, 2).toInt(nullptr, 16);
r = colorStr.mid(1, 2).toInt(nullptr, 16);
g = colorStr.mid(3, 2).toInt(nullptr, 16);
b = colorStr.mid(5, 2).toInt(nullptr, 16);
ok = true;
}
}
@ -502,7 +500,7 @@ ColorScheme* KDE3ColorSchemeReader::read()
ColorScheme* scheme = new ColorScheme();
QRegExp comment(QLatin1String("#.*$"));
QRegularExpression comment(QLatin1String("#.*$"));
while ( !_device->atEnd() )
{
QString line(QString::fromUtf8(_device->readLine()));

View File

@ -24,7 +24,7 @@
#include "Emulation.h"
#include "HistorySearch.h"
HistorySearch::HistorySearch(EmulationPtr emulation, QRegExp regExp,
HistorySearch::HistorySearch(EmulationPtr emulation, QRegularExpression regExp,
bool forwards, int startColumn, int startLine,
QObject* parent) :
QObject(parent),
@ -41,7 +41,7 @@ HistorySearch::~HistorySearch() {
void HistorySearch::search() {
bool found = false;
if (! m_regExp.isEmpty())
if( ! m_regExp.isValid())
{
if (m_forwards) {
found = search(m_startColumn, m_startLine, -1, m_emulation->lineCount()) || search(0, 0, m_startColumn, m_startLine);
@ -119,7 +119,8 @@ bool HistorySearch::search(int startColumn, int startLine, int endColumn, int en
if (matchStart > -1)
{
int matchEnd = matchStart + m_regExp.matchedLength() - 1;
auto match = m_regExp.match(string);
int matchEnd = matchStart + match.capturedLength() - 1;
qDebug() << "Found in string from" << matchStart << "to" << matchEnd;
// Translate startPos and endPos to startColum, startLine, endColumn and endLine in history.

View File

@ -22,6 +22,7 @@
#include <QObject>
#include <QPointer>
#include <QMap>
#include <QRegularExpression>
#include <Session.h>
#include <ScreenWindow.h>
@ -38,7 +39,7 @@ class HistorySearch : public QObject
Q_OBJECT
public:
explicit HistorySearch(EmulationPtr emulation, QRegExp regExp, bool forwards,
explicit HistorySearch(EmulationPtr emulation, QRegularExpression regExp, bool forwards,
int startColumn, int startLine, QObject* parent);
~HistorySearch();
@ -55,7 +56,7 @@ private:
EmulationPtr m_emulation;
QRegExp m_regExp;
QRegularExpression m_regExp;
bool m_forwards;
int m_startColumn;
int m_startLine;

View File

@ -34,6 +34,7 @@
#include <QKeySequence>
#include <QDir>
#include <QtDebug>
#include <QRegularExpression>
#include "tools.h"
@ -532,10 +533,10 @@ QList<KeyboardTranslatorReader::Token> KeyboardTranslatorReader::tokenize(const
text = text.simplified();
// title line: keyboard "title"
static QRegExp title(QLatin1String("keyboard\\s+\"(.*)\""));
QRegularExpression title(QLatin1String("keyboard\\s+\"(.*)\""));
// key line: key KeySequence : "output"
// key line: key KeySequence : command
static QRegExp key(QLatin1String("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)"));
QRegularExpression key(QLatin1String("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)"));
QList<Token> list;
if ( text.isEmpty() )
@ -543,30 +544,31 @@ QList<KeyboardTranslatorReader::Token> KeyboardTranslatorReader::tokenize(const
return list;
}
if ( title.exactMatch(text) )
if ( title.match(text).hasMatch() )
{
auto match = title.match(text);
Token titleToken = { Token::TitleKeyword , QString() };
Token textToken = { Token::TitleText , title.capturedTexts().at(1) };
Token textToken = { Token::TitleText , match.capturedTexts().at(1) };
list << titleToken << textToken;
}
else if ( key.exactMatch(text) )
else if ( key.match(text).hasMatch() )
{
auto match = key.match(text);
Token keyToken = { Token::KeyKeyword , QString() };
Token sequenceToken = { Token::KeySequence , key.capturedTexts().value(1).remove(QLatin1Char(' ')) };
Token sequenceToken = { Token::KeySequence , match.capturedTexts().value(1).remove(QLatin1Char(' ')) };
list << keyToken << sequenceToken;
if ( key.capturedTexts().at(3).isEmpty() )
if ( match.capturedTexts().size() < 4 || match.capturedTexts().at(3).isEmpty() )
{
// capturedTexts()[2] is a command
Token commandToken = { Token::Command , key.capturedTexts().at(2) };
Token commandToken = { Token::Command , match.capturedTexts().at(2) };
list << commandToken;
}
else
{
// capturedTexts()[3] is the output string
Token outputToken = { Token::OutputText , key.capturedTexts().at(3) };
Token outputToken = { Token::OutputText , match.capturedTexts().at(3) };
list << outputToken;
}
}
@ -664,7 +666,8 @@ QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards,Qt::Keybo
if ( replacement == 'x' )
{
result.replace(i,1,"\\x"+QByteArray(1,ch).toHex());
QByteArray data = "\\x"+QByteArray(1,ch).toHex();
result.replace(i,1,data);
} else if ( replacement != 0 )
{
result.remove(i,1);
@ -682,7 +685,7 @@ QByteArray KeyboardTranslator::Entry::unescape(const QByteArray& input) const
for ( int i = 0 ; i < result.count()-1 ; i++ )
{
QByteRef ch = result[i];
auto ch = result[i];
if ( ch == '\\' )
{
char replacement[2] = {0,0};

View File

@ -317,10 +317,11 @@ int Pty::foregroundProcessGroup() const
return 0;
}
// TODO: we need to handle this
#if QT_VERSION < 0x060000
void Pty::setupChildProcess()
{
KPtyProcess::setupChildProcess();
// reset all signal handlers
// this ensures that terminal applications respond to
// signals generated via key sequences such as Ctrl+C
@ -328,11 +329,13 @@ void Pty::setupChildProcess()
struct sigaction action;
sigset_t sigset;
sigemptyset(&action.sa_mask);
sigemptyset(&sigset);
action.sa_handler = SIG_DFL;
action.sa_flags = 0;
for (int signal=1;signal < NSIG; signal++) {
sigaction(signal,&action,0L);
sigaction(signal,&action,nullptr);
sigaddset(&sigset, signal);
}
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
sigprocmask(SIG_UNBLOCK, &sigset, nullptr);
}
#endif

View File

@ -188,8 +188,10 @@ Q_OBJECT
*/
void receivedData(const char* buffer, int length);
protected:
void setupChildProcess();
#if QT_VERSION < 0x060000
protected:
void setupChildProcess() override;
#endif
private slots:
// called when data is received from the terminal process

View File

@ -30,13 +30,13 @@
// Qt
#include <QApplication>
#include <QByteRef>
#include <QDir>
#include <QFile>
#include <QRegExp>
#include <QStringList>
#include <QFile>
#include <QtDebug>
#include <QRegularExpression>
#include "Pty.h"
//#include "kptyprocess.h"
@ -381,7 +381,11 @@ void Session::setUserTitle( int what, const QString & caption )
if (what == 31) {
QString cwd=caption;
#if QT_VERSION >= 0x060000
cwd=cwd.replace( QRegularExpression(QLatin1String("^~")), QDir::homePath() );
#else
cwd=cwd.replace( QRegExp(QLatin1String("^~")), QDir::homePath() );
#endif
emit openUrlRequest(cwd);
}

View File

@ -252,19 +252,19 @@ void TerminalDisplay::fontChange(const QFont&)
void TerminalDisplay::calDrawTextAdditionHeight(QPainter& painter)
{
QRect test_rect, feedback_rect;
test_rect.setRect(1, 1, _fontWidth * 4, _fontHeight);
test_rect.setRect(1, 1, _fontWidth * 4, _fontHeight);
painter.drawText(test_rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + QLatin1String("Mq"), &feedback_rect);
//qDebug() << "test_rect:" << test_rect << "feeback_rect:" << feedback_rect;
//qDebug() << "test_rect:" << test_rect << "feeback_rect:" << feedback_rect;
_drawTextAdditionHeight = (feedback_rect.height() - _fontHeight) / 2;
if(_drawTextAdditionHeight < 0) {
_drawTextAdditionHeight = 0;
}
_drawTextAdditionHeight = (feedback_rect.height() - _fontHeight) / 2;
if(_drawTextAdditionHeight < 0) {
_drawTextAdditionHeight = 0;
}
// update the original content
// update the original content
_drawTextTestFlag = false;
update();
update();
}
void TerminalDisplay::setVTFont(const QFont& f)
@ -276,8 +276,9 @@ void TerminalDisplay::setVTFont(const QFont& f)
// this ensures the same handling for all platforms
// but then there was revealed that various Linux distros
// have this problem too...
font.setStyleStrategy(QFont::ForceIntegerMetrics);
#if QT_VERSION < 0x060000
font.setStyleStrategy(QFont::ForceIntegerMetrics);
#endif
QFontMetrics metrics(font);
if ( !QFontInfo(font).fixedPitch() )
@ -1946,7 +1947,13 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
spot->activate(QLatin1String("click-action"));
}
}
else if ( ev->button() == Qt::MidButton )
else if ( ev->button() ==
#if QT_VERSION >= 0x060000
Qt::MiddleButton
#else
Qt::MidButton
#endif
)
{
if ( _mouseMarks || (ev->modifiers() & Qt::ShiftModifier) )
emitSelection(true,ev->modifiers() & Qt::ControlModifier);
@ -2037,7 +2044,13 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev)
int button = 3;
if (ev->buttons() & Qt::LeftButton)
button = 0;
if (ev->buttons() & Qt::MidButton)
if (ev->buttons() &
#if QT_VERSION >= 0x060000
Qt::MiddleButton
#else
Qt::MidButton
#endif
)
button = 1;
if (ev->buttons() & Qt::RightButton)
button = 2;
@ -2079,7 +2092,14 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev)
if (_actSel == 0) return;
// don't extend selection while pasting
if (ev->buttons() & Qt::MidButton) return;
if (ev->buttons() &
#if QT_VERSION >= 0x060000
Qt::MiddleButton
#else
Qt::MidButton
#endif
)
return;
extendSelection( ev->pos() );
}
@ -2334,9 +2354,21 @@ void TerminalDisplay::mouseReleaseEvent(QMouseEvent* ev)
if ( !_mouseMarks &&
((ev->button() == Qt::RightButton && !(ev->modifiers() & Qt::ShiftModifier))
|| ev->button() == Qt::MidButton) )
|| ev->button() ==
#if QT_VERSION >= 0x060000
Qt::MiddleButton
#else
Qt::MidButton
#endif
))
{
emit mouseSignal( ev->button() == Qt::MidButton ? 1 : 2,
emit mouseSignal( ev->button() ==
#if QT_VERSION >= 0x060000
Qt::MiddleButton
#else
Qt::MidButton
#endif
? 1 : 2,
charColumn + 1,
charLine + 1 +_scrollBar->value() -_scrollBar->maximum() ,
2);
@ -2483,8 +2515,8 @@ void TerminalDisplay::mouseDoubleClickEvent(QMouseEvent* ev)
void TerminalDisplay::wheelEvent( QWheelEvent* ev )
{
if (ev->orientation() != Qt::Vertical)
return;
if (ev->angleDelta().y() == 0)
return;
// if the terminal program is not interested mouse events
// then send the event to the scrollbar if the slider has room to move
@ -2503,10 +2535,10 @@ void TerminalDisplay::wheelEvent( QWheelEvent* ev )
// to get a reasonable scrolling speed, scroll by one line for every 5 degrees
// of mouse wheel rotation. Mouse wheels typically move in steps of 15 degrees,
// giving a scroll of 3 lines
int key = ev->delta() > 0 ? Qt::Key_Up : Qt::Key_Down;
int key = ev->angleDelta().y() > 0 ? Qt::Key_Up : Qt::Key_Down;
// QWheelEvent::delta() gives rotation in eighths of a degree
int wheelDegrees = ev->delta() / 8;
// QWheelEvent::angleDelta().y() gives rotation in eighths of a degree
int wheelDegrees = ev->angleDelta().y() / 8;
int linesToScroll = abs(wheelDegrees) / 5;
QKeyEvent keyScrollEvent(QEvent::KeyPress,key,Qt::NoModifier);
@ -2519,14 +2551,17 @@ void TerminalDisplay::wheelEvent( QWheelEvent* ev )
{
// terminal program wants notification of mouse activity
int charLine;
int charColumn;
getCharacterPosition( ev->pos() , charLine , charColumn );
emit mouseSignal( ev->delta() > 0 ? 4 : 5,
charColumn + 1,
charLine + 1 +_scrollBar->value() -_scrollBar->maximum() ,
0);
int charLine;
int charColumn;
#if QT_VERSION <= 0x060000
getCharacterPosition( ev->pos() , charLine , charColumn );
#else
getCharacterPosition( ev->position().toPoint() , charLine , charColumn );
#endif
emit mouseSignal( ev->angleDelta().y() > 0 ? 4 : 5,
charColumn + 1,
charLine + 1 +_scrollBar->value() -_scrollBar->maximum() ,
0);
}
}

View File

@ -44,7 +44,6 @@
// Qt
#include <QEvent>
#include <QKeyEvent>
#include <QByteRef>
// KDE
//#include <kdebug.h>
@ -413,10 +412,10 @@ void Vt102Emulation::processWindowAttributeChange()
return;
}
QString newValue;
newValue.reserve(tokenBufferPos-i-2);
for (int j = 0; j < tokenBufferPos-i-2; j++)
newValue[j] = tokenBuffer[i+1+j];
// copy from the first char after ';', and skipping the ending delimiter
// 0x07 or 0x92. Note that as control characters in OSC text parts are
// ignored, only the second char in ST ("\e\\") is appended to tokenBuffer.
QString newValue = QString::fromWCharArray(tokenBuffer + i + 1, tokenBufferPos-i-2);
_pendingTitleUpdates[attributeToChange] = newValue;
_titleUpdateTimer->start(20);
@ -961,8 +960,8 @@ void Vt102Emulation::sendMouseEvent( int cb, int cx, int cy , int eventType )
// coordinate+32, no matter what the locale is. We could easily
// convert manually, but QString can also do it for us.
QChar coords[2];
coords[0] = cx + 0x20;
coords[1] = cy + 0x20;
coords[0] = QChar(cx + 0x20);
coords[1] = QChar(cy + 0x20);
QString coordsStr = QString(coords, 2);
QByteArray utf8 = coordsStr.toUtf8();
snprintf(command, sizeof(command), "\033[M%c%s", cb + 0x20, utf8.constData());
@ -1341,8 +1340,8 @@ char Vt102Emulation::eraseChar() const
{
KeyboardTranslator::Entry entry = _keyTranslator->findEntry(
Qt::Key_Backspace,
0,
0);
Qt::NoModifier,
KeyboardTranslator::NoState);
if ( entry.text().count() > 0 )
return entry.text().at(0);
else

View File

@ -404,9 +404,9 @@ int KProcess::startDetached(const QStringList &argv)
int KProcess::pid() const
{
#ifdef Q_OS_UNIX
return (int) QProcess::pid();
return (int) QProcess::processId();
#else
return QProcess::pid() ? QProcess::pid()->dwProcessId : 0;
return QProcess::processId() ? QProcess::processId()->dwProcessId : 0;
#endif
}

View File

@ -336,8 +336,10 @@ protected:
private:
// hide those
#if QT_VERSION < 0x060000
using QProcess::setReadChannelMode;
using QProcess::readChannelMode;
#endif
using QProcess::setProcessChannelMode;
using QProcess::processChannelMode;

View File

@ -332,24 +332,28 @@ gotpty:
(st.st_mode & (S_IRGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH))) &&
!d->chownpty(true)) {
qWarning()
<< "chownpty failed for device " << ptyName << "::" << d->ttyName
<< "\nThis means the communication can be eavesdropped." << endl;
<< "chownpty failed for device " << ptyName << "::" << d->ttyName
#if QT_VERSION >= 0x060000
<< "\nThis means the communication can be eavesdropped." << Qt::endl;
#else
<< "\nThis means the communication can be eavesdropped." << endl;
#endif
}
#if defined (HAVE__GETPTY) || defined (HAVE_GRANTPT)
# if defined(HAVE__GETPTY) || defined(HAVE_GRANTPT)
grantedpt:
#endif
# endif
#ifdef HAVE_REVOKE
# ifdef HAVE_REVOKE
revoke(d->ttyName.data());
#endif
# endif
#ifdef HAVE_UNLOCKPT
# ifdef HAVE_UNLOCKPT
unlockpt(d->masterFd);
#elif defined(TIOCSPTLCK)
# elif defined(TIOCSPTLCK)
int flag = 0;
ioctl(d->masterFd, TIOCSPTLCK, &flag);
#endif
# endif
d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY);
if (d->slaveFd < 0) {
@ -359,11 +363,11 @@ grantedpt:
return false;
}
#if (defined(__svr4__) || defined(__sgi__))
# if (defined(__svr4__) || defined(__sgi__))
// Solaris
ioctl(d->slaveFd, I_PUSH, "ptem");
ioctl(d->slaveFd, I_PUSH, "ldterm");
#endif
# endif
#endif /* HAVE_OPENPTY */

View File

@ -46,6 +46,25 @@ KPtyProcess::KPtyProcess(QObject *parent) :
d->pty->open();
connect(this, SIGNAL(stateChanged(QProcess::ProcessState)),
SLOT(_k_onStateChanged(QProcess::ProcessState)));
#if QT_VERSION >= 0x060000
setChildProcessModifier([this] {
Q_D(KPtyProcess);
d->pty->setCTty();
#if 0
if (d->addUtmp)
d->pty->login(KUser(KUser::UseRealUserID).loginName().toLocal8Bit().data(), qgetenv("DISPLAY"));
#endif
if (d->ptyChannels & StdinChannel)
dup2(d->pty->slaveFd(), 0);
if (d->ptyChannels & StdoutChannel)
dup2(d->pty->slaveFd(), 1);
if (d->ptyChannels & StderrChannel)
dup2(d->pty->slaveFd(), 2);
});
#endif
}
KPtyProcess::KPtyProcess(int ptyMasterFd, QObject *parent) :
@ -119,6 +138,7 @@ KPtyDevice *KPtyProcess::pty() const
return d->pty;
}
#if QT_VERSION < 0x060000
void KPtyProcess::setupChildProcess()
{
Q_D(KPtyProcess);
@ -140,5 +160,6 @@ void KPtyProcess::setupChildProcess()
KProcess::setupChildProcess();
}
#endif
//#include "kptyprocess.moc"

View File

@ -144,8 +144,9 @@ protected:
/**
* @reimp
*/
virtual void setupChildProcess();
#if QT_VERSION < 0x060000 // move to KPtyProcess()
void setupChildProcess() override;
#endif
private:
Q_PRIVATE_SLOT(d_func(), void _k_onStateChanged(QProcess::ProcessState))
};

View File

@ -159,10 +159,10 @@ void QTermWidget::search(bool forwards, bool next)
qDebug() << "current selection starts at: " << startColumn << startLine;
qDebug() << "current cursor position: " << m_impl->m_terminalDisplay->screenWindow()->cursorPosition();
QRegExp regExp(m_searchBar->searchText());
regExp.setPatternSyntax(m_searchBar->useRegularExpression() ? QRegExp::RegExp : QRegExp::FixedString);
regExp.setCaseSensitivity(m_searchBar->matchCase() ? Qt::CaseSensitive : Qt::CaseInsensitive);
QRegularExpression regExp(m_searchBar->searchText(),
m_searchBar->matchCase() ? QRegularExpression::CaseInsensitiveOption|
QRegularExpression::UseUnicodePropertiesOption
: QRegularExpression::UseUnicodePropertiesOption);
HistorySearch *historySearch =
new HistorySearch(m_impl->m_session->emulation(), regExp, forwards, startColumn, startLine, this);
connect(historySearch, SIGNAL(matchFound(int, int, int, int)), this, SLOT(matchFound(int, int, int, int)));
@ -253,13 +253,17 @@ void QTermWidget::startTerminalTeletype()
void QTermWidget::init(int startnow)
{
m_layout = new QVBoxLayout();
m_layout->setMargin(0);
m_layout->setContentsMargins(0, 0, 0, 0);
setLayout(m_layout);
// translations
// First check $XDG_DATA_DIRS. This follows the implementation in libqtxdg
QString d = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList dirs = d.split(QLatin1Char(':'), Qt::SkipEmptyParts);
#else
QStringList dirs = d.split(QLatin1Char(':'), QString::SkipEmptyParts);
#endif
if (dirs.isEmpty()) {
dirs.append(QString::fromLatin1("/usr/local/share"));
dirs.append(QString::fromLatin1("/usr/share"));

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.18.0)
project(deepin-unioncode)
@ -10,6 +10,9 @@ function(print_directory arg)
endfunction()
set(VERSION $ENV{VERSION})
# build with -fPIC flag in .a library on arm64
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (NOT VERSION)
set(VERSION "0.0.1")
endif()
@ -79,17 +82,36 @@ endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wl,--as-need -fPIE")
find_package(Dtk COMPONENTS Widget REQUIRED)
find_package(Qt6 COMPONENTS Core QUIET)
if (Qt6_FOUND)
set(QT_VERSION_MAJOR 6)
else()
find_package(Qt5 COMPONENTS Core REQUIRED)
set(QT_VERSION_MAJOR 5)
endif()
message(" >>> Found Qt version: ${QT_VERSION_MAJOR}")
if (QT_VERSION_MAJOR MATCHES 6)
set(DTK_VERSION_MAJOR 6)
set(KF_VERSION_MAJOR 6)
else()
set(DTK_VERSION_MAJOR "")
set(KF_VERSION_MAJOR 5)
endif()
message(" >>> Build with DTK: ${DTK_VERSION_MAJOR}")
find_package(Dtk${DTK_VERSION_MAJOR} COMPONENTS Widget REQUIRED)
include_directories(${PROJECT_NAME} PRIVATE ${DtkWidget_INCLUDE_DIRS})
# Use Qt modules no WebEngineWidgets WebChannel
set(QtFindModules Core Gui Widgets Concurrent Network DBus)
foreach(QtModule ${QtFindModules})
find_package(Qt5 COMPONENTS ${QtModule} REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${QtModule} REQUIRED)
# include qt module private include directors
include_directories(${Qt5${QtModule}_PRIVATE_INCLUDE_DIRS})
include_directories(${Qt${QT_VERSION_MAJOR}${QtModule}_PRIVATE_INCLUDE_DIRS})
# can use target_link_libraries(xxx ${QtUseModules})
list(APPEND QtUseModules "Qt5::${QtModule}")
list(APPEND QtUseModules "Qt${QT_VERSION_MAJOR}::${QtModule}")
message("QtModule found ${QtModule} OK!")
endforeach()

108
NOTICE.txt Normal file
View File

@ -0,0 +1,108 @@
This file provides copyright and license information for the deepin-unioncode project and its dependencies, as required by their respective licenses.
---
Project: deepin-unioncode
Source: https://github.com/linuxdeepin/deepin-unioncode
1. Configuration and Build Files
Files: .gitlab-ci.yml, .github/*, .gitignore, .clang-format, .clog.toml, .project.json, debian/*, *.qrc, .tx/*, *CMakeLists.txt, *.cmake, *.cmake.in, *.pc.in, *.txt, src/*.json, src/*.xml, src/*.policy, src/*.js, src/*.ini, src/*.qss, src/*.css, src/*.theme, src/*/templates/*, src/*.psd, src/configures/*, src/tools/eventrecorder/include/*.gitignore, src/tools/eventrecorder/Doxyfile, src/tools/eventrecorder/preload/syscall*.cc, src/tools/eventrecorder/preload/*.S, rpm/*.spec, *.sh, *.cfg
Copyright: None
License: CC0-1.0
License Text: Creative Commons CC0 1.0 Universal (Public Domain Dedication). See https://creativecommons.org/publicdomain/zero/1.0/
2. Documentation
Files: README*.md, docs/*, *.md
Copyright: UnionTech Software Technology Co., Ltd.
License: CC-BY-4.0
License Text: Creative Commons Attribution 4.0 International. See https://creativecommons.org/licenses/by/4.0/
3. Translations, Assets, Images, Desktop Files, Scripts, Plugins, and Tools
Files: translations/*.ts, assets/*, src/apps/*/assets/*, src/*.png, src/*.svg, src/*.jpg, src/*.desktop, src/scripts/*, src/plugin/*, src/tool/*
Copyright: UnionTech Software Technology Co., Ltd.
License: GPL-3.0-or-later
License Text: GNU General Public License, version 3 or later. See https://www.gnu.org/licenses/gpl-3.0.html
4. FlameGraph
Files: 3rdparty/scripts/*
Copyright: 2013 Brendan Gregg
License: GPL-3.0-or-later
License Text: GNU General Public License, version 3 or later. See https://www.gnu.org/licenses/gpl-3.0.html
5. cppdap and diff_match_patch
Files: 3rdparty/cppdap/src/*, 3rdparty/cppdap/include/*, 3rdparty/cppdap/examples/*, 3rdparty/cppdap/fuzz/*, 3rdparty/cppdap/kokoro/*, 3rdparty/cppdap/CONTRIBUTING, 3rdparty/diff-match-patch/*
Copyright: 2019 Google LLC
License: Apache-2.0
License Text: Apache License, Version 2.0. See https://www.apache.org/licenses/LICENSE-2.0
6. nlohmann JSON
Files: 3rdparty/cppdap/third_party/json/*
Copyright: 2019 Google LLC
License: MIT
License Text: MIT License. See https://opensource.org/licenses/MIT
7. GitQlient 1.4.3
Files: 3rdparty/unioncode-GitQlient/*
Copyright: 2011-2017 Peter Spiess-Knafl <dev@spiessknafl.at>, 2021 Francesc Martinez <es.linkedin.com/in/cescmm/en>, 2012 Peter Spiess-Knafl <dev@spiessknafl.at>, 2016 Jean-Daniel Michaud <jean.daniel.michaud@gmail.com>, 2016 Alexandre Poirot <alexandre.poirot@legrand.fr>, 2017 Jacques Software <software@jacques.com.au>
License: LGPL-2.1-or-later
License Text: GNU Lesser General Public License, version 2.1 or later. See https://www.gnu.org/licenses/lgpl-2.1.html
8. jsonrpc 1.4.1
Files: 3rdparty/unioncode-jsonrpccpp/*
Copyright: 2015 Alexandre Poirot
License: MIT
License Text: MIT License. See https://opensource.org/licenses/MIT
9. qtermwidget 0.14.1
Files: 3rdparty/unioncode-qtermwidget-0.14.1/*
Copyright: Adriaan de Groot <groot@kde.org>, 2010 KDE e.V <kde-ev-board@kde.org>, 2002-2007 Oswald Buddenhagen <ossi@kde.org>, 2006-2008 Robert Knight <robertknight@gmail.com>, 2002 Waldo Bastian <bastian@kde.org>, 2008 e_k <e_k@users.sourceforge.net>
License: GPL-2.0-or-later
License Text: GNU General Public License, version 2 or later. See https://www.gnu.org/licenses/gpl-2.0.html
10. qtermwidget (Examples and Libraries)
Files: 3rdparty/unioncode-qtermwidget-0.14.1/example/*, 3rdparty/unioncode-qtermwidget-0.14.1/lib/*
Copyright: Adriaan de Groot <groot@kde.org>, 2010 KDE e.V <kde-ev-board@kde.org>, 2002-2007 Oswald Buddenhagen <ossi@kde.org>, 2006-2008 Robert Knight <robertknight@gmail.com>, 2002 Waldo Bastian <bastian@kde.org>, 2008 e_k <e_k@users.sourceforge.net>
License: LGPL-2.0-or-later
License Text: GNU Lesser General Public License, version 2 or later. See https://www.gnu.org/licenses/lgpl-2.0.html
11. qtermwidget (CMake Files)
Files: 3rdparty/unioncode-qtermwidget-0.14.1/pyqt/cmake/*, 3rdparty/unioncode-qtermwidget-0.14.1/cmake/*
Copyright: 2012 Luca Beltrame <lbeltrame@kde.org>, 2012 Rolf Eike Beer <eike@sf-mail.de>, 2007-2014 Simon Edwards <simon@simonzone.com>
License: BSD-3-Clause
License Text: BSD 3-Clause License. See https://opensource.org/licenses/BSD-3-Clause
12. qscintilla 2.14
Files: 3rdparty/unioncode-qscintilla214/src/*
Copyright: 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
License: GPL-3.0-or-later
License Text: GNU General Public License, version 3 or later. See https://www.gnu.org/licenses/gpl-3.0.html
13. scintilla
Files: 3rdparty/unioncode-qscintilla214/scintilla/*
Copyright: 1998-2021 Neil Hodgson <neilh@scintilla.org>
License: HPND (Historical Permission Notice and Disclaimer)
License Text: See https://www.scintilla.org/License.txt
14. Event Recorder (Architecture-Specific Files)
Files: src/tools/eventrecorder/aarch64/*, src/tools/eventrecorder/mips64/*, src/tools/eventrecorder/sw64/*, src/tools/eventrecorder/x86_64/*
Copyright: 1993 Branko Lankester <branko@hacktic.nl>
License: BSD-Protection
License Text: BSD Protection License. See https://fedoraproject.org/wiki/Licensing/BSD#Protection
15. Event Recorder (ScopedFd, easylogging, linenoise)
Files: src/tools/eventrecorder/ScopedFd.h, src/tools/eventrecorder/easylogging*, src/tools/eventrecorder/linenoise*
Copyright: 2012-2018 Zuhd Web Services
License: MIT
License Text: MIT License. See https://opensource.org/licenses/MIT
16. Event Recorder (Wait)
Files: src/tools/eventrecorder/Wait*
Copyright: 2002 Niels Provos <provos@citi.umich.edu>
License: BSD-Protection
License Text: BSD Protection License. See https://fedoraproject.org/wiki/Licensing/BSD#Protection
17. Event Recorder (DWARF and ELF)
Files: src/tools/eventrecorder/include/dwarf/*, src/tools/eventrecorder/include/elf/*
Copyright: 2013 Austin T. Clements
License: MIT
License Text: MIT License. See https://opensource.org/licenses/MIT

View File

@ -1,8 +1,8 @@
# deepin-unioncode
# deepin-ide
[![zh](https://img.shields.io/badge/lang-zh-red.svg)](./README.md)
deepin-unioncode is a lightweight integrated development environment, featured with multilingual and cross platform compatibility.
deepin-ide (original namedeepin-unioncode) is a lightweight integrated development environment, featured with multilingual and cross platform compatibility.
## Build dependencies
@ -50,9 +50,9 @@ _The **dev** branch is current development branch, build dependencies may change
1. Make sure you have installed all dependencies.
``` shell
$ git clone https://github.com/linuxdeepin/deepin-unioncode.git
(gitee: $ git clone https://gitee.com/deepin-community/deepin-unioncode.git)
$ cd deepin-unioncode
$ git clone https://github.com/linuxdeepin/deepin-ide.git
(gitee: $ git clone https://gitee.com/deepin-community/deepin-ide.git)
$ cd deepin-ide
$ sudo apt build-dep ./
```
@ -69,11 +69,11 @@ $ cmake --build build
$ sudo cmake --build build --target install
```
The executable binary file could be found at `/usr/bin/deepin-unioncode`
The executable binary file could be found at `/usr/bin/deepin-ide`
## Usage
Execute `deepin-unioncode`
Execute `deepin-ide`
*Attention: After the installation of deepin-unicode, some features require the installation of dependency packages before they can be used normally.*
@ -97,7 +97,6 @@ Execute `deepin-unioncode`
## Getting help
- [Official Forum](https://bbs.deepin.org/)
- [User guide](https://wiki.deepin.org/zh/05_HOW-TO/02_%E5%BC%80%E5%8F%91%E7%9B%B8%E5%85%B3/deepin-unioncode)
- [Extended guide](./docs/extended-guide.md)
- [Developer Center](https://github.com/linuxdeepin/developer-center)
- [Gitter](https://gitter.im/orgs/linuxdeepin/rooms)
@ -113,7 +112,7 @@ We encourage you to report issues and contribute changes
## License
deepin-unioncode is licensed under [GPL-3.0-or-later](LICENSE)
deepin-ide is licensed under [GPL-3.0-or-later](LICENSE)
## 3rdparty support

View File

@ -1,8 +1,8 @@
# deepin-unioncode
# deepin-ide
[![en](https://img.shields.io/badge/lang-en-red.svg)](./README.en.md)
deepin-unioncode 是一款支持多语言、跨平台兼容特性的轻量级集成开发环境。
deepin-ide (原名:deepin-unioncode) 是一款支持多语言、跨平台兼容特性的轻量级集成开发环境。
## 构建依赖
@ -51,9 +51,9 @@ _当前的开发分支为**dev**,编译依赖可能会在没有更新本说明
``` shell
$ git clone https://github.com/linuxdeepin/deepin-unioncode.git
(gitee: $ git clone https://gitee.com/deepin-community/deepin-unioncode.git)
$ cd deepin-unioncode
$ git clone https://github.com/linuxdeepin/deepin-ide.git
(gitee: $ git clone https://gitee.com/deepin-community/deepin-ide.git)
$ cd deepin-ide
$ sudo apt build-dep ./
```
@ -70,13 +70,13 @@ $ cmake --build build
$ sudo cmake --build build --target install
```
可执行程序为 `/usr/bin/deepin-unioncode`
可执行程序为 `/usr/bin/deepin-ide`
## 使用
启动栏执行 `deepin-unioncode`
启动栏执行 `deepin-ide`
*注意deepin-unioncode安装后部分功能需要安装依赖包后才能正常使用。*
*注意deepin-ide安装后部分功能需要安装依赖包后才能正常使用。*
## 支持的语言工程
@ -98,7 +98,6 @@ $ sudo cmake --build build --target install
## 帮助
- [官方论坛](https://bbs.deepin.org/)
- [用户使用手册](https://wiki.deepin.org/zh/05_HOW-TO/02_%E5%BC%80%E5%8F%91%E7%9B%B8%E5%85%B3/deepin-unioncode)
- [扩展指南](./docs/extended-guide.md)
- [开发者中心](https://github.com/linuxdeepin/developer-center)
- [Gitter](https://gitter.im/orgs/linuxdeepin/rooms)
@ -114,7 +113,7 @@ $ sudo cmake --build build --target install
## 开源许可证
deepin-unioncode 在 [GPL-3.0-or-later](LICENSE)下发布。
deepin-ide 在 [GPL-3.0-or-later](LICENSE)下发布。
## 三方库支持

View File

@ -4,14 +4,14 @@ install(DIRECTORY templates/
install(DIRECTORY models/
DESTINATION "${SOURCES_INSTALL_RPEFIX}/models")
find_package(Qt5 COMPONENTS LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS LinguistTools)
# install translation.
if (CMAKE_BUILD_TYPE STREQUAL "Release")
file(GLOB TS_FILES "translations/*.ts")
foreach(TS_FILE IN LISTS TS_FILES)
message(STATUS "process ts file: ${TS_FILE}")
find_program(LUPDATE_COMMAND NAMES lupdate lupdate-qt5 lupdate-qt4 lupdate-pro)
find_program(LUPDATE_COMMAND NAMES lupdate lupdate-Qt${QT_VERSION_MAJOR} lupdate-qt4 lupdate-pro)
if (NOT LUPDATE_COMMAND)
message(FATAL_ERROR "lupdate command not found")
endif()
@ -46,4 +46,4 @@ file(GLOB ICON "${CMAKE_CURRENT_SOURCE_DIR}/configures/*.svg")
install(FILES ${SUPPORTFILES} DESTINATION "${SOURCES_INSTALL_RPEFIX}/configures")
install(FILES ${DESKTOPFILES} DESTINATION "/usr/share/applications")
install(FILES ${ICON} DESTINATION "${SOURCES_INSTALL_RPEFIX}/configures/icons")
install(FILES ${ICON} DESTINATION "${SOURCES_INSTALL_RPEFIX}/configures/icons")

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

50
debian/changelog vendored
View File

@ -1,3 +1,53 @@
deepin-unioncode (1.4.11) UNRELEASED; urgency=medium
* Bug fix
-- luzhen <luzhen@uniontech.com> Mon, 28 Apr 2025 16:09:10 +0800
deepin-unioncode (1.4.10) UNRELEASED; urgency=medium
* Adapt qt6.8
-- luzhen <luzhen@uniontech.com> Wed, 23 Apr 2025 09:31:26 +0800
deepin-unioncode (1.4.9) UNRELEASED; urgency=medium
* Bug fix
-- luzhen <luzhen@uniontech.com> Mon, 21 Apr 2025 14:06:39 +0800
deepin-unioncode (1.4.8) stable; urgency=medium
* bug fix
-- luzhen <luzhen@uniontech.com> Fri, 14 Mar 2025 09:49:16 +0800
deepin-unioncode (1.4.7) unstable; urgency=medium
* Bug fix
-- luzhen <luzhen@uniontech.com> Thu, 13 Mar 2025 17:10:00 +0800
deepin-unioncode (1.4.6) stable; urgency=medium
* Bug fix
-- luzhen <luzhen@uniontech.com> Mon, 10 Mar 2025 17:01:50 +0800
deepin-unioncode (1.4.5) unstable; urgency=medium
* Disable smartut
* Add model change feature
* Bug fix
-- luzhen <luzhen@uniontech.com> Thu, 27 Feb 2025 15:30:36 +0800
deepin-unioncode (1.4.4) UNRELEASED; urgency=medium
* Adapt to qt6.8
-- luzhen <luzhen@uniontech.com> Fri, 21 Feb 2025 14:39:48 +0800
deepin-unioncode (1.4.1) stable; urgency=medium
* Bug fix

26
debian/control vendored
View File

@ -5,11 +5,20 @@ Maintainer: Deepin Packages Builder <packages@linuxdeepin.com>
Build-Depends:
debhelper (>=9),
cmake,
qt5-qmake,
qtbase5-dev,
qttools5-dev,
qttools5-dev-tools,
qtwebengine5-dev[!loong64],
qt6-qmake | qt5-qmake,
qt6-base-dev | qtbase5-dev,
qt6-tools-dev-tools | qttools5-dev-tools,
qt6-tools-dev | qttools5-dev,
qt6-webengine-dev | qtwebengine5-dev,
qt6-multimedia-dev,
libdtk6widget-dev | libdtkwidget-dev,
libdtk6gui-dev | libdtkgui-dev,
libdtk6core-dev | libdtkcore-dev,
libdtk6core5-bin |libdtkcore5-bin,
libkf6syntaxhighlighting-dev | libkf5syntaxhighlighting-dev,
qt6-script-dev | qtscript5-dev,
qt6-5compat-dev | hello,
libqt5scripttools5 | hello,
lxqt-build-tools (>= 0.6.0~),
libssl-dev,
llvm (>=1:7~),
@ -29,15 +38,8 @@ Build-Depends:
libelfin-dev,
libdbus-1-dev,
libxi-dev,
qtscript5-dev,
libqt5scripttools5,
clang[!mips64],
doxygen,
libdtkgui-dev,
libdtkwidget-dev,
libdtkcore-dev,
libdtkcore5-bin,
libkf5syntaxhighlighting-dev,
libyaml-cpp-dev,
libcmark-dev,
libchardet-dev,

12
debian/rules vendored
View File

@ -3,6 +3,16 @@ include /usr/share/dpkg/default.mk
export QT_SELECT=5
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
define detect_qt_version
ifneq (,$(shell which qmake6 2>/dev/null))
QT_DIR="/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt6"
else
QT_DIR="/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt5"
endif
endef
$(eval $(call detect_qt_version))
%:
dh $@ --parallel
@ -10,6 +20,8 @@ override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DVERSION=$(PACK_VER) \
-DQT_DIR=$(QT_DIR) \
-DAPP_VERSION=$(DEB_VERSION_UPSTREAM) -DVERSION=$(DEB_VERSION_UPSTREAM) LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)

View File

@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "common/common.h"
#include "common/settings/settings.h"
#include "common/util/utils.h"
#include <framework/framework.h>
#include <framework/lifecycle/pluginsetting.h>
@ -103,10 +104,12 @@ void openProject(const QString &path)
int main(int argc, char *argv[])
{
// some platform opengl drive with wrongso use OpenGLES instead.
if (QSysInfo::currentCpuArchitecture().contains("arm")) {
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGLES);
format.setDefaultFormat(format);
if(utils::isWayland()) {
if (QSysInfo::currentCpuArchitecture().contains("arm")) {
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGLES);
format.setDefaultFormat(format);
}
}
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

View File

@ -13,7 +13,10 @@ add_library(
${PROJECT_SOURCES}
)
find_package(Dtk COMPONENTS Widget Core Gui REQUIRED)
# let code be position independent
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
find_package(Dtk${DTK_VERSION_MAJOR} COMPONENTS Widget Core Gui REQUIRED)
target_link_libraries(
${PROJECT_NAME}
@ -36,4 +39,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE
# config cmake file
configure_file(${CMAKE_SOURCE_DIR}/assets/dev/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,11 +1,25 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "abstractllm.h"
AbstractLLM::AbstractLLM(QObject *parent)
: QObject(parent)
: QObject(parent)
{
qRegisterMetaType<ResponseState>("ResponseState");
}
void AbstractLLM::setModelState(LLMState st)
{
if (state.loadAcquire() == st)
return;
state.storeRelease(st);
Q_EMIT modelStateChanged();
}
AbstractLLM::LLMState AbstractLLM::modelState() const
{
return static_cast<LLMState>(state.loadAcquire());
}

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
@ -14,6 +14,11 @@ class AbstractLLM : public QObject
{
Q_OBJECT
public:
enum LLMState {
Idle = 0,
Busy
};
enum ResponseState {
Receiving,
Success,
@ -22,6 +27,13 @@ public:
Canceled
};
enum Locale {
Zh,
En
};
using ResponseHandler = std::function<void(const QString &data, ResponseState state)>;
explicit AbstractLLM(QObject *parent = nullptr);
virtual ~AbstractLLM() {}
@ -30,18 +42,25 @@ public:
virtual bool checkValid(QString *errStr) = 0;
virtual QJsonObject create(const Conversation &conversation) = 0;
virtual void request(const QJsonObject &data) = 0;
virtual void request(const QString &prompt) = 0;
virtual void generate(const QString &prompt, const QString &suffix) = 0;
virtual void request(const QString &prompt, ResponseHandler handler = nullptr) = 0;
virtual void generate(const QString &prefix, const QString &suffix) = 0; // use to auto compelte
virtual void setTemperature(double temperature) = 0;
virtual void setStream(bool isStream) = 0;
virtual void processResponse(QNetworkReply *reply) = 0;
virtual void setLocale(Locale lc) = 0;
virtual void cancel() = 0;
virtual void setMaxTokens(int maxToken) = 0;
virtual Conversation *getCurrentConversation() = 0;
virtual bool isIdle() = 0;
void setModelState(LLMState st);
LLMState modelState() const;
signals:
void dataReceived(const QString &data, ResponseState statu);
void customDataReceived(const QString &key, const QJsonObject &customData);
void dataReceived(const QString &data, ResponseState state);
void modelStateChanged();
private:
QAtomicInt state { Idle };
};
#endif

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
@ -70,6 +70,20 @@ bool Conversation::popUserData()
return false;
}
bool Conversation::addResponse(const QString &data)
{
if (!data.isEmpty()) {
const QJsonDocument &document = QJsonDocument::fromJson(data.toUtf8());
if (document.isArray()) {
conversation = document.array();
} else {
conversation.push_back(QJsonObject({ { "role", "assistant" }, {"content", data} }));
}
return true;
}
return false;
}
QString Conversation::getLastResponse() const
{
if (!conversation.isEmpty() && conversation.last()["role"].toString() == "assistant") {

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
@ -28,6 +28,7 @@ public:
bool addUserData(const QString &data);
bool popUserData();
bool addResponse(const QString &data);
QString getLastResponse() const;
QByteArray getLastByteResponse() const;
bool popLastResponse();

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -5,7 +5,6 @@ include(${CMAKE_SOURCE_DIR}/3rdparty/unioncode-jsonrpccpp.cmake)
install(FILES ${CMAKE_SOURCE_DIR}/src/common/resource/icons/ide.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/)
configure_file(util/config.h.in config.h)
find_package(Qt5Network)
set(CMAKE_CXX_STANDARD 17)
@ -37,13 +36,13 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
)
find_package(Qt5 COMPONENTS Concurrent REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Concurrent REQUIRED)
target_link_libraries(
${PROJECT_NAME}
unioncode-jsonrpcclient
Qt5::Network
Qt5::Concurrent
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Concurrent
${DtkWidget_LIBRARIES}
)
@ -62,4 +61,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE
# config cmake file
configure_file(${CMAKE_SOURCE_DIR}/assets/dev/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake.in ${PROJECT_NAME}Config.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
@ -11,6 +11,7 @@
#include <QDir>
#include <QDebug>
#include <QApplication>
#include <QWidget>
constexpr char kKeyboardShortcuts[] = "KeyboardShortcuts";
static ActionManager *m_instance = nullptr;

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
@ -174,7 +174,7 @@ void PropertiesDialog::setupUi(DAbstractDialog *Dialog)
bgGroup->setItemMargins(QMargins(0, 0, 0, 0));
bgGroup->setBackgroundRole(QPalette::Window);
bgGroup->setUseWidgetBackground(false);
bgGpLayout->setMargin(0);
bgGpLayout->setContentsMargins(0, 0, 0, 0);
DFrame *wrapperFrame = new DFrame(bgGroup);
wrapperFrame->setLineWidth(0);

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Some files were not shown because too many files have changed in this diff Show More