Skip to content

Commit

Permalink
fix: fix some display issue of codegeex plugin
Browse files Browse the repository at this point in the history
as title
  • Loading branch information
Lighto-Ku committed Nov 16, 2023
1 parent 25756e3 commit 4f09e1e
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 16 deletions.
6 changes: 6 additions & 0 deletions src/plugins/codegeex/codegeex.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
<file>images/navigation.png</file>
<file>images/logo-codegeex.png</file>
<file>images/photo.svg</file>
<file>images/chat_icon_del_hover.svg</file>
<file>images/chat_icon_history_hover.svg</file>
<file>images/chat_icon_new_hover.svg</file>
<file>images/insert.svg</file>
<file>images/copy.svg</file>
<file>images/insert-dark-filled.svg</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions src/plugins/codegeex/codegeexmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void CodeGeeXManager::deleteCurrentSession()

void CodeGeeXManager::sendMessage(const QString &prompt)
{
qInfo() << "send prompt ======= " << prompt;
QString askId = "User" + QString::number(QDateTime::currentMSecsSinceEpoch());
MessageData msgData(askId, MessageData::Ask);

Check warning on line 97 in src/plugins/codegeex/codegeexmanager.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Local variable 'msgData' shadows outer variable
msgData.updateData(prompt);
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/codegeex/images/chat_icon_del_hover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/plugins/codegeex/images/chat_icon_history_hover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/plugins/codegeex/images/chat_icon_new_hover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/plugins/codegeex/images/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/plugins/codegeex/images/insert-dark-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/plugins/codegeex/images/insert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/plugins/codegeex/images/message_copy_hover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/plugins/codegeex/widgets/codeeditcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ void CodeEditComponent::initTitleWidgets()
titleWidget->setLayout(layout);

copyButton = new DPushButton(titleWidget);
copyButton->setText(tr("Copy"));
// copyButton->setText(tr("Copy"));
copyButton->setFlat(true);
copyButton->setIcon(QIcon(QPixmap(":/resoures/images/copy.svg")));
layout->addWidget(copyButton);

insertButton = new DPushButton(titleWidget);
insertButton->setText(tr("Insert"));
// insertButton->setText(tr("Insert"));
insertButton->setFlat(true);
insertButton->setIcon(QIcon(QPixmap(":/resoures/images/insert-dark-filled.svg")));
layout->addWidget(insertButton);

layout->addStretch(1);
Expand Down
11 changes: 7 additions & 4 deletions src/plugins/codegeex/widgets/codegeexwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void CodeGeeXWidget::toTranslateCode(const QString &code)
transPage->setInputEditText(code);
transPage->cleanOutputEdit();

stackWidget->setCurrentIndex(2);
tabBar->setCurrentIndex(1);
}

void CodeGeeXWidget::initUI()
Expand Down Expand Up @@ -142,13 +142,16 @@ void CodeGeeXWidget::initAskWidget()
headerLayout->addStretch(1);

deleteBtn = new DPushButton(this);
deleteBtn->setText(tr("Delete"));
deleteBtn->setFlat(true);
deleteBtn->setIcon(QIcon(QPixmap(":/resoures/images/chat_icon_del_hover.svg")));
headerLayout->addWidget(deleteBtn);
historyBtn = new DPushButton(this);
historyBtn->setText(tr("History"));
historyBtn->setFlat(true);
historyBtn->setIcon(QIcon(QPixmap(":/resoures/images/chat_icon_history_hover.svg")));
headerLayout->addWidget(historyBtn);
createNewBtn = new DPushButton(this);
createNewBtn->setText(tr("New"));
createNewBtn->setFlat(true);
createNewBtn->setIcon(QIcon(QPixmap(":/resoures/images/chat_icon_new_hover.svg")));
headerLayout->addWidget(createNewBtn);

initTabBar();
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/codegeex/widgets/messagecomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ MessageComponent::MessageComponent(const MessageData &msgData, QWidget *parent)
}
void MessageComponent::updateMessage(const MessageData &msgData)
{
if (msgData.messageType() == MessageData::Ask) {
curUpdateLabel = new DLabel(this);
curUpdateLabel->setWordWrap(true);
msgLayout->addWidget(curUpdateLabel);
curUpdateLabel->setText(msgData.messageData());
return;
}

if (!createCodeEdit(msgData))
return;

Expand Down
17 changes: 7 additions & 10 deletions src/plugins/codegeex/widgets/translationpagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,18 @@ void TranslationPageWidget::initUI()
inputEdit->setFixedHeight(200);
layout->addWidget(inputEdit);

layout->addSpacing(20);

QHBoxLayout *midLayout = new QHBoxLayout;

QVBoxLayout *comboBoxLayout = new QVBoxLayout;
DLabel *comboBoxLabel = new DLabel(this);
comboBoxLabel->setFixedHeight(20);
comboBoxLabel->setText(tr("Translate Into:"));
comboBoxLayout->addWidget(comboBoxLabel);

layout->addSpacing(20);
midLayout->addWidget(comboBoxLabel);

langComboBox = new DComboBox(this);
langComboBox->addItems(CodeGeeX::SupportLanguage);
comboBoxLayout->addWidget(langComboBox);

midLayout->addLayout(comboBoxLayout);
midLayout->addWidget(langComboBox);

midLayout->addSpacing(100);

Expand All @@ -82,14 +79,14 @@ void TranslationPageWidget::initUI()

layout->addLayout(midLayout);

layout->addSpacing(20);

outputEdit = new CodeEditComponent(this);
outputEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
outputEdit->setTitle(tr("Output Code"));
outputEdit->setFixedHeight(200);
outputEdit->showButtons(CodeEditComponent::InsertOnly);
outputEdit->setReadOnly(true);
outputEdit->setUpdateHeight(true);
outputEdit->updateCode("");

layout->addWidget(outputEdit);

layout->addStretch(1);
Expand Down

0 comments on commit 4f09e1e

Please sign in to comment.