From 15959110008bf3e162338892904dd837a8af11c6 Mon Sep 17 00:00:00 2001 From: xiaoming <2014500726@smail.xtu.edu.cn> Date: Sat, 20 Jul 2024 08:24:29 +0800 Subject: [PATCH] Update Internal Command Window Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn> --- CHANGELOG.md | 4 +++ docs/changelog.md | 2 ++ docs/img/ar_SA.svg | 2 +- docs/img/cs_CZ.svg | 2 +- docs/img/de_DE.svg | 2 +- docs/img/en_US.svg | 2 +- docs/img/es_ES.svg | 2 +- docs/img/fr_FR.svg | 2 +- docs/img/ja_JP.svg | 2 +- docs/img/ko_KR.svg | 2 +- docs/img/pt_BR.svg | 2 +- docs/img/ru_RU.svg | 2 +- docs/img/zh_CN.svg | 2 +- docs/img/zh_HK.svg | 2 +- lang/quardCRT_ar_SA.ts | 26 +++++++++++++------ lang/quardCRT_cs_CZ.ts | 26 +++++++++++++------ lang/quardCRT_de_DE.ts | 26 +++++++++++++------ lang/quardCRT_en_US.ts | 26 +++++++++++++------ lang/quardCRT_es_ES.ts | 26 +++++++++++++------ lang/quardCRT_fr_FR.ts | 26 +++++++++++++------ lang/quardCRT_ja_JP.ts | 26 +++++++++++++------ lang/quardCRT_ko_KR.ts | 26 +++++++++++++------ lang/quardCRT_pt_BR.ts | 26 +++++++++++++------ lang/quardCRT_ru_RU.ts | 26 +++++++++++++------ lang/quardCRT_zh_CN.ts | 26 +++++++++++++------ lang/quardCRT_zh_HK.ts | 26 +++++++++++++------ lib/qtermwidget/qtermwidget.cpp | 11 ++++---- lib/qtermwidget/qtermwidget.h | 6 ++--- .../internalcommandprocess.cpp | 16 ++++++++++++ .../internalcommandwindow.cpp | 23 +++++++++++++++- 30 files changed, 281 insertions(+), 117 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b59cd5..74ad4729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ en-US: - Add up to four window split screen mode and multiple layout modes - Add single/group/all session three modes in the send command window - Add the plugin information page to display the plugin website +- Add notification center +- Add internal command window - Improve the context menu of URL recognition links - Improve the find window to automatically fill in the currently selected text each time it is opened - Improve status bar @@ -28,6 +30,8 @@ zh-CN: - 增加了至多四窗口分屏模式以及多种布局模式 - 发送命令窗口增加单会话/组会话/全部会话三种模式 - 插件信息页面增加插件网站主页显示 +- 增加通知中心 +- 增加内部命令窗口 - 改进URL识别链接的上下文菜单 - 改进查找窗口在每次打开时自动填入当前选择的文本 - 改进状态栏 diff --git a/docs/changelog.md b/docs/changelog.md index bc86af08..4075fd3e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -12,6 +12,8 @@ - Add up to four window split screen mode and multiple layout modes - Add single/group/all session three modes in the send command window - Add the plugin information page to display the plugin website +- Add notification center +- Add internal command window - Improve the context menu of URL recognition links - Improve the find window to automatically fill in the currently selected text each time it is opened - Improve status bar diff --git a/docs/img/ar_SA.svg b/docs/img/ar_SA.svg index b9a89950..ab7a0566 100644 --- a/docs/img/ar_SA.svg +++ b/docs/img/ar_SA.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/cs_CZ.svg b/docs/img/cs_CZ.svg index b9a89950..ab7a0566 100644 --- a/docs/img/cs_CZ.svg +++ b/docs/img/cs_CZ.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/de_DE.svg b/docs/img/de_DE.svg index b9a89950..ab7a0566 100644 --- a/docs/img/de_DE.svg +++ b/docs/img/de_DE.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/en_US.svg b/docs/img/en_US.svg index b9a89950..ab7a0566 100644 --- a/docs/img/en_US.svg +++ b/docs/img/en_US.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/es_ES.svg b/docs/img/es_ES.svg index b9a89950..ab7a0566 100644 --- a/docs/img/es_ES.svg +++ b/docs/img/es_ES.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/fr_FR.svg b/docs/img/fr_FR.svg index b9a89950..ab7a0566 100644 --- a/docs/img/fr_FR.svg +++ b/docs/img/fr_FR.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/ja_JP.svg b/docs/img/ja_JP.svg index b9a89950..ab7a0566 100644 --- a/docs/img/ja_JP.svg +++ b/docs/img/ja_JP.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/ko_KR.svg b/docs/img/ko_KR.svg index b9a89950..ab7a0566 100644 --- a/docs/img/ko_KR.svg +++ b/docs/img/ko_KR.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/pt_BR.svg b/docs/img/pt_BR.svg index b9a89950..ab7a0566 100644 --- a/docs/img/pt_BR.svg +++ b/docs/img/pt_BR.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/ru_RU.svg b/docs/img/ru_RU.svg index b9a89950..ab7a0566 100644 --- a/docs/img/ru_RU.svg +++ b/docs/img/ru_RU.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/zh_CN.svg b/docs/img/zh_CN.svg index b9a89950..ab7a0566 100644 --- a/docs/img/zh_CN.svg +++ b/docs/img/zh_CN.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/docs/img/zh_HK.svg b/docs/img/zh_HK.svg index b9a89950..ab7a0566 100644 --- a/docs/img/zh_HK.svg +++ b/docs/img/zh_HK.svg @@ -1 +1 @@ -814/814 (100.0%) \ No newline at end of file +816/816 (100.0%) \ No newline at end of file diff --git a/lang/quardCRT_ar_SA.ts b/lang/quardCRT_ar_SA.ts index 6fea124c..faf8c522 100644 --- a/lang/quardCRT_ar_SA.ts +++ b/lang/quardCRT_ar_SA.ts @@ -2627,37 +2627,47 @@ If you need to use another shell, please create a session through [quick-connect الأمر الداخلي - - + + Open URL فتح الرابط - - + + Cannot open URL %1. تعذر فتح الرابط %1. - + Copy نسخ - + Paste لصق - + Select All تحديد الكل - + Find بحث + + + Zoom In + تكبير + + + + Zoom Out + تصغير + Konsole::Session diff --git a/lang/quardCRT_cs_CZ.ts b/lang/quardCRT_cs_CZ.ts index 30fcdef8..09bf8e37 100644 --- a/lang/quardCRT_cs_CZ.ts +++ b/lang/quardCRT_cs_CZ.ts @@ -2627,37 +2627,47 @@ Pokud potřebujete použít jiný shell, vytvořte prosím relaci prostřednictv Vnitřní příkaz - - + + Open URL Otevřít URL - - + + Cannot open URL %1. Nelze otevřít URL %1. - + Copy Kopírovat - + Paste Vložit - + Select All Vybrat vše - + Find Najít + + + Zoom In + Přiblížit + + + + Zoom Out + Oddálit + Konsole::Session diff --git a/lang/quardCRT_de_DE.ts b/lang/quardCRT_de_DE.ts index 9220ad7c..33cd667e 100644 --- a/lang/quardCRT_de_DE.ts +++ b/lang/quardCRT_de_DE.ts @@ -2627,37 +2627,47 @@ Wenn Sie eine andere Shell verwenden müssen, erstellen Sie bitte eine Sitzung Interner Befehl - - + + Open URL URL öffnen - - + + Cannot open URL %1. URL %1 kann nicht geöffnet werden. - + Copy Kopieren - + Paste Einfügen - + Select All Alles auswählen - + Find Suchen + + + Zoom In + Vergrößern + + + + Zoom Out + Verkleinern + Konsole::Session diff --git a/lang/quardCRT_en_US.ts b/lang/quardCRT_en_US.ts index f74b8062..629f2e24 100644 --- a/lang/quardCRT_en_US.ts +++ b/lang/quardCRT_en_US.ts @@ -2623,37 +2623,47 @@ If you need to use another shell, please create a session through [quick-connect - - + + Open URL - - + + Cannot open URL %1. - + Copy - + Paste - + Select All - + Find + + + Zoom In + + + + + Zoom Out + + Konsole::Session diff --git a/lang/quardCRT_es_ES.ts b/lang/quardCRT_es_ES.ts index 54ba0290..60e5e361 100644 --- a/lang/quardCRT_es_ES.ts +++ b/lang/quardCRT_es_ES.ts @@ -2627,37 +2627,47 @@ Si necesita usar otro shell, cree una sesión a través de [conexión rápida &g Comando interno - - + + Open URL Abrir URL - - + + Cannot open URL %1. No se puede abrir la URL %1. - + Copy Copiar - + Paste Pegar - + Select All Seleccionar todo - + Find Buscar + + + Zoom In + Acercar + + + + Zoom Out + Alejar + Konsole::Session diff --git a/lang/quardCRT_fr_FR.ts b/lang/quardCRT_fr_FR.ts index 469f1da7..ce4e4107 100644 --- a/lang/quardCRT_fr_FR.ts +++ b/lang/quardCRT_fr_FR.ts @@ -2627,37 +2627,47 @@ Si vous avez besoin d'utiliser un autre shell, veuillez créer une session Commande interne - - + + Open URL Ouvrir l'URL - - + + Cannot open URL %1. Impossible d'ouvrir l'URL %1. - + Copy Copier - + Paste Coller - + Select All Tout sélectionner - + Find Rechercher + + + Zoom In + Agrandir + + + + Zoom Out + Réduire + Konsole::Session diff --git a/lang/quardCRT_ja_JP.ts b/lang/quardCRT_ja_JP.ts index 9411fa0b..9044d0b0 100644 --- a/lang/quardCRT_ja_JP.ts +++ b/lang/quardCRT_ja_JP.ts @@ -2627,37 +2627,47 @@ PowerShell 5以降を使用してください! 内部コマンド - - + + Open URL URLを開く - - + + Cannot open URL %1. URL %1 を開けません。 - + Copy コピー - + Paste 貼り付け - + Select All 全て選択 - + Find 検索 + + + Zoom In + 拡大 + + + + Zoom Out + 縮小 + Konsole::Session diff --git a/lang/quardCRT_ko_KR.ts b/lang/quardCRT_ko_KR.ts index bd0a225f..e91fcef6 100644 --- a/lang/quardCRT_ko_KR.ts +++ b/lang/quardCRT_ko_KR.ts @@ -2627,37 +2627,47 @@ PowerShell 5 이상을 사용하십시오! 내부 명령어 - - + + Open URL URL 열기 - - + + Cannot open URL %1. %1 URL을 열 수 없습니다. - + Copy 복사 - + Paste 붙여넣기 - + Select All 모두 선택 - + Find 찾기 + + + Zoom In + 확대 + + + + Zoom Out + 축소 + Konsole::Session diff --git a/lang/quardCRT_pt_BR.ts b/lang/quardCRT_pt_BR.ts index 6514bfe0..b8249f2f 100644 --- a/lang/quardCRT_pt_BR.ts +++ b/lang/quardCRT_pt_BR.ts @@ -2627,37 +2627,47 @@ Se você precisar usar outro shell, crie uma sessão através de [conexão rápi Comando interno - - + + Open URL Abrir URL - - + + Cannot open URL %1. Não é possível abrir a URL %1. - + Copy Copiar - + Paste Colar - + Select All Selecionar tudo - + Find Localizar + + + Zoom In + Ampliar + + + + Zoom Out + Reduzir + Konsole::Session diff --git a/lang/quardCRT_ru_RU.ts b/lang/quardCRT_ru_RU.ts index 48f459f3..69dc14c3 100644 --- a/lang/quardCRT_ru_RU.ts +++ b/lang/quardCRT_ru_RU.ts @@ -2627,37 +2627,47 @@ If you need to use another shell, please create a session through [quick-connect Внутренняя команда - - + + Open URL Открыть URL - - + + Cannot open URL %1. Не удалось открыть URL %1. - + Copy Копировать - + Paste Вставить - + Select All Выделить все - + Find Найти + + + Zoom In + Увеличить + + + + Zoom Out + Уменьшить + Konsole::Session diff --git a/lang/quardCRT_zh_CN.ts b/lang/quardCRT_zh_CN.ts index e815f773..85d2597b 100644 --- a/lang/quardCRT_zh_CN.ts +++ b/lang/quardCRT_zh_CN.ts @@ -2627,37 +2627,47 @@ If you need to use another shell, please create a session through [quick-connect 内部命令 - - + + Open URL 打开 URL - - + + Cannot open URL %1. 无法打开 URL %1. - + Copy 复制 - + Paste 粘贴 - + Select All 全选 - + Find 查找 + + + Zoom In + 放大 + + + + Zoom Out + 缩小 + Konsole::Session diff --git a/lang/quardCRT_zh_HK.ts b/lang/quardCRT_zh_HK.ts index ca39514a..f867d2e3 100644 --- a/lang/quardCRT_zh_HK.ts +++ b/lang/quardCRT_zh_HK.ts @@ -2627,37 +2627,47 @@ If you need to use another shell, please create a session through [quick-connect 內部命令 - - + + Open URL 打開URL - - + + Cannot open URL %1. 無法打開URL %1。 - + Copy 複製 - + Paste 粘貼 - + Select All 全選 - + Find 查找 + + + Zoom In + 放大 + + + + Zoom Out + 縮小 + Konsole::Session diff --git a/lib/qtermwidget/qtermwidget.cpp b/lib/qtermwidget/qtermwidget.cpp index a64327e0..f979cecd 100644 --- a/lib/qtermwidget/qtermwidget.cpp +++ b/lib/qtermwidget/qtermwidget.cpp @@ -502,22 +502,23 @@ void QTermWidget::selectAll() m_impl->m_terminalDisplay->selectAll(); } -void QTermWidget::setZoom(int step) +int QTermWidget::setZoom(int step) { QFont font = m_impl->m_terminalDisplay->getVTFont(); font.setPointSize(font.pointSize() + step); setTerminalFont(font); + return font.pointSize(); } -void QTermWidget::zoomIn() +int QTermWidget::zoomIn() { - setZoom(STEP_ZOOM); + return setZoom(STEP_ZOOM); } -void QTermWidget::zoomOut() +int QTermWidget::zoomOut() { - setZoom(-STEP_ZOOM); + return setZoom(-STEP_ZOOM); } void QTermWidget::setKeyBindings(const QString & kb) diff --git a/lib/qtermwidget/qtermwidget.h b/lib/qtermwidget/qtermwidget.h index 2d374d90..f3c24036 100644 --- a/lib/qtermwidget/qtermwidget.h +++ b/lib/qtermwidget/qtermwidget.h @@ -334,8 +334,8 @@ public slots: void selectAll(); // Set zoom - void zoomIn(); - void zoomOut(); + int zoomIn(); + int zoomOut(); // Set size void setSize(const QSize &); @@ -396,7 +396,7 @@ private slots: Konsole::RegExpFilter *regExpFilter; }; void search(bool forwards, bool next); - void setZoom(int step); + int setZoom(int step); QWidget *messageParentWidget = nullptr; TermWidgetImpl * m_impl; SearchBar* m_searchBar; diff --git a/src/internalcommandwindow/internalcommandprocess.cpp b/src/internalcommandwindow/internalcommandprocess.cpp index e6c0cbdb..4324df5e 100644 --- a/src/internalcommandwindow/internalcommandprocess.cpp +++ b/src/internalcommandwindow/internalcommandprocess.cpp @@ -212,6 +212,22 @@ void InternalCommandProcess::recvData(const QByteArray &data) { } sdata.replace('\r', "\r\n"); buffer.append(sdata); + if(sdata.contains("\b")) { + int index = 0; + while ((index = buffer.indexOf('\b', index)) != -1) { + if (index > 0) { + buffer.remove(index - 1, 2); + index--; + } else { + buffer.remove(index, 1); + } + } + if(buffer.isEmpty()) { + emit sendData(QByteArray("\x1B[2K\r")); + sendPrompt(); + return; + } + } sdata.replace("\b", "\x08\x1B[J"); emit sendData(sdata); condition.wakeOne(); diff --git a/src/internalcommandwindow/internalcommandwindow.cpp b/src/internalcommandwindow/internalcommandwindow.cpp index 8954a84f..5f83eb65 100644 --- a/src/internalcommandwindow/internalcommandwindow.cpp +++ b/src/internalcommandwindow/internalcommandwindow.cpp @@ -9,6 +9,8 @@ #include #include #include + +#include "globalsetting.h" #include "globaloptionswindow.h" #include "internalcommandwindow.h" #include "ui_internalcommandwindow.h" @@ -40,7 +42,9 @@ InternalCommandWindow::InternalCommandWindow(QWidget *parent) font.setFamily(fontFamilies[0]); } font.setFixedPitch(true); - font.setPointSize(12); + GlobalSetting settings; + int fontsize = settings.value("Global/InternalCommand/fontsize", 12).toInt(); + font.setPointSize(fontsize); term->setTerminalFont(font); QStringList availableColorSchemes = term->availableColorSchemes(); @@ -218,6 +222,23 @@ void InternalCommandWindow::contextMenuEvent(QContextMenuEvent *event) { term->toggleShowSearchBar(); }); menu->addAction(findAction); + menu->addSeparator(); + + QAction *zoomInAction = new QAction(tr("Zoom In"),this); + connect(zoomInAction,&QAction::triggered,this,[&](){ + int fontsize = term->zoomIn(); + GlobalSetting settings; + settings.setValue("Global/InternalCommand/fontsize", fontsize); + }); + menu->addAction(zoomInAction); + + QAction *zoomOutAction = new QAction(tr("Zoom Out"),this); + connect(zoomOutAction,&QAction::triggered,this,[&](){ + int fontsize = term->zoomOut(); + GlobalSetting settings; + settings.setValue("Global/InternalCommand/fontsize", fontsize); + }); + menu->addAction(zoomOutAction); QRect screenGeometry = QGuiApplication::screenAt(cursor().pos())->geometry(); QPoint pos = cursor().pos() + QPoint(5,5);