diff --git a/assets/translations/en_US.ts b/assets/translations/en_US.ts
index 8163827c6..3ae545e13 100644
--- a/assets/translations/en_US.ts
+++ b/assets/translations/en_US.ts
@@ -93,10 +93,15 @@
AskPageWidget
-
+
+
+
+
+
+
BinaryToolsConfigView
@@ -2125,22 +2130,22 @@ storage: %2
-
+
-
+
-
+
-
+
diff --git a/assets/translations/zh_CN.ts b/assets/translations/zh_CN.ts
index d289bde8f..b15d5d9d0 100644
--- a/assets/translations/zh_CN.ts
+++ b/assets/translations/zh_CN.ts
@@ -93,10 +93,15 @@
AskPageWidget
-
+
在这里提问,按Enter键发送...
+
+
+
+ 回答中
+
BinaryToolsConfigView
@@ -2160,22 +2165,22 @@ storage: %2
文本
-
+
工作区
-
+
视图
-
+
查找
-
+
Valgrind
diff --git a/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp b/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp
index c2dc7c8ce..d673acf51 100644
--- a/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp
+++ b/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp
@@ -105,9 +105,6 @@ void NavEditMainWindow::addWidgetWorkspace(const QString &title, AbstractWidget
{
if (!qDockWidgetWorkspace) {
qTabWidgetWorkspace = new DTabWidget();
- QFont font = qTabWidgetWorkspace->font();
- font.setItalic(true);
- qTabWidgetWorkspace->setFont(font);
qTabWidgetWorkspace->setMinimumHeight(300);
qTabWidgetWorkspace->setTabPosition(DTabWidget::West);
qDockWidgetWorkspace = new AutoHideDockWidget(DDockWidget::tr("Workspace"), this);
diff --git a/src/plugins/codegeex/codegeexmanager.cpp b/src/plugins/codegeex/codegeexmanager.cpp
index b40dc8a3e..20aba8f7a 100644
--- a/src/plugins/codegeex/codegeexmanager.cpp
+++ b/src/plugins/codegeex/codegeexmanager.cpp
@@ -129,7 +129,7 @@ void CodeGeeXManager::onResponse(const QString &msgID, const QString &data, cons
}
if (event == "finish") {
-
+ emit chatFinished();
} else if (event == "add"){
}
diff --git a/src/plugins/codegeex/codegeexmanager.h b/src/plugins/codegeex/codegeexmanager.h
index cf2777d97..755fe35e3 100644
--- a/src/plugins/codegeex/codegeexmanager.h
+++ b/src/plugins/codegeex/codegeexmanager.h
@@ -38,6 +38,7 @@ class CodeGeeXManager : public QObject
void loginSuccessed();
void createdNewSession();
void requestMessageUpdate(const MessageData &msg);
+ void chatFinished();
public Q_SLOTS:
void onSessionCreated(const QString &talkId, bool isSuccessful);
diff --git a/src/plugins/codegeex/widgets/askpagewidget.cpp b/src/plugins/codegeex/widgets/askpagewidget.cpp
index 9f762ecf9..5f6bc0da9 100644
--- a/src/plugins/codegeex/widgets/askpagewidget.cpp
+++ b/src/plugins/codegeex/widgets/askpagewidget.cpp
@@ -14,19 +14,28 @@
#include
#include
#include
+#include
AskPageWidget::AskPageWidget(QWidget *parent)
: QWidget (parent)
+ , processTimer(new QTimer(this))
{
initUI();
initConnection();
+
+ processTimer->setInterval(200);
+ placeHolderText = tr("Ask question here, press Enter to send...");
}
void AskPageWidget::setIntroPage()
{
cleanWidgets();
curState = Intro;
- scrollArea->setWidget(new IntroPage(scrollArea));
+ IntroPage *introPage = new IntroPage(scrollArea);
+ connect(introPage, &IntroPage::suggestionToSend, [this](const QString &suggesstion){
+ askQuestion(suggesstion);
+ });
+ scrollArea->setWidget(introPage);
Q_EMIT introPageShown();
}
@@ -64,11 +73,15 @@ void AskPageWidget::onSendBtnClicked()
if (prompt.isEmpty())
return;
- CodeGeeXManager::instance()->sendMessage(prompt);
- inputEdit->clear();
+ askQuestion(prompt);
}
}
+void AskPageWidget::onChatFinished()
+{
+ enterInputState();
+}
+
void AskPageWidget::initUI()
{
setContentsMargins(0, 0, 0, 0);
@@ -97,18 +110,24 @@ void AskPageWidget::initInputWidget()
inputEdit = new QLineEdit(inputWidget);
inputEdit->setFixedHeight(50);
- inputEdit->setPlaceholderText(tr("Ask question here, press Enter to send..."));
+ inputEdit->setPlaceholderText(placeHolderText);
editLayout->addWidget(inputEdit);
-
-// QLabel *inputTips = new QLabel(inputWidget);
-// inputTips->setText(tr("Ctrl + Enter for Newline | \" / \" for command"));
-// inputTips->setIndent(10);
-// layout->addWidget(inputTips);
}
void AskPageWidget::initConnection()
{
connect(CodeGeeXManager::instance(), &CodeGeeXManager::requestMessageUpdate, this, &AskPageWidget::onMessageUpdate);
+ connect(CodeGeeXManager::instance(), &CodeGeeXManager::chatFinished, this, &AskPageWidget::onChatFinished);
+ connect(processTimer, &QTimer::timeout, [this](){
+ QString tips;
+ int maxDotNum = 4;
+ int dotNum = progressCalcNum++ % maxDotNum;
+ for (int i = 0; i < dotNum; i++) {
+ tips += "...";
+ }
+ QString holderText = tr("Answering") + tips;
+ inputEdit->setPlaceholderText(holderText);
+ });
connect(inputEdit, &QLineEdit::returnPressed, this, &AskPageWidget::onSendBtnClicked);
}
@@ -131,3 +150,24 @@ void AskPageWidget::setSessionPage()
Q_EMIT sessionPageShown();
}
+
+void AskPageWidget::enterAnswerState()
+{
+ progressCalcNum = 0;
+ inputEdit->clear();
+ inputEdit->setEnabled(false);
+ processTimer->start();
+}
+
+void AskPageWidget::enterInputState()
+{
+ processTimer->stop();
+ inputEdit->setEnabled(true);
+ inputEdit->setPlaceholderText(placeHolderText);
+}
+
+void AskPageWidget::askQuestion(const QString &question)
+{
+ CodeGeeXManager::instance()->sendMessage(question);
+ enterAnswerState();
+}
diff --git a/src/plugins/codegeex/widgets/askpagewidget.h b/src/plugins/codegeex/widgets/askpagewidget.h
index b34b2803c..76ddf5aa8 100644
--- a/src/plugins/codegeex/widgets/askpagewidget.h
+++ b/src/plugins/codegeex/widgets/askpagewidget.h
@@ -38,6 +38,7 @@ class AskPageWidget : public QWidget
public Q_SLOTS:
void onMessageUpdate(const MessageData &msgData);
void onSendBtnClicked();
+ void onChatFinished();
private:
void initUI();
@@ -47,11 +48,19 @@ public Q_SLOTS:
void cleanWidgets();
void setSessionPage();
+ void enterAnswerState();
+ void enterInputState();
+
+ void askQuestion(const QString &question);
+
PageState curState;
QScrollArea *scrollArea { nullptr };
QWidget *inputWidget { nullptr };
QWidget *messageContainer { nullptr };
QLineEdit *inputEdit { nullptr };
+ QTimer *processTimer { nullptr };
+ int progressCalcNum = 0;
+ QString placeHolderText;
QMap msgComponents {};
};
diff --git a/src/plugins/codegeex/widgets/intropage.cpp b/src/plugins/codegeex/widgets/intropage.cpp
index d51caa59b..146b211bb 100644
--- a/src/plugins/codegeex/widgets/intropage.cpp
+++ b/src/plugins/codegeex/widgets/intropage.cpp
@@ -101,6 +101,6 @@ void IntroPage::appendSuggestButton(QVBoxLayout *layout, const QString &text)
layout->addWidget(suggestButton);
connect(suggestButton, &QPushButton::clicked, [ = ] {
- CodeGeeXManager::instance()->sendMessage(suggestButton->text());
+ emit suggestionToSend(suggestButton->text());
});
}
diff --git a/src/plugins/codegeex/widgets/intropage.h b/src/plugins/codegeex/widgets/intropage.h
index e3a46415c..410d2c46b 100644
--- a/src/plugins/codegeex/widgets/intropage.h
+++ b/src/plugins/codegeex/widgets/intropage.h
@@ -17,6 +17,9 @@ class IntroPage : public QWidget
public:
explicit IntroPage(QWidget *parent = nullptr);
+signals:
+ void suggestionToSend(const QString &suggesstion);
+
private:
void initUI();
void initLogo();