Skip to content

Commit

Permalink
fix: [codegeex] incorecct ui and display logic
Browse files Browse the repository at this point in the history
  • Loading branch information
LiHua000 authored and deepin-mozart committed Nov 11, 2024
1 parent fe4b34c commit 7b96111
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/plugins/codegeex/codegeex/copilotapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ void CopilotApi::slotReadReplyStream(QNetworkReply *reply)
qCritical() << "Error:" << reply->errorString();
} else {
QString replyMsg = QString::fromUtf8(reply->readAll());
qInfo() << replyMsg;
QStringList lines = replyMsg.split('\n');
QString data;
QString event;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/codegeex/copilot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void Copilot::switchToCodegeexPage()
{
auto &ctx = dpfInstance.serviceContext();
WindowService *windowService = ctx.service<WindowService>(WindowService::name());
windowService->showWidgetAtPosition(MWNA_CODEGEEX, Position::Right, false);
windowService->showWidgetAtRightspace(MWNA_CODEGEEX);
}

QString Copilot::assembleCodeByCurrentFile(const QString &code)
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/codegeex/widgets/codegeexwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void CodeGeeXWidget::initUI()
auto initLoginUI = [this]() {
auto mainLayout = new QVBoxLayout(this);
auto loginWidget = new DWidget(this);
loginWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
loginWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
auto verticalLayout = new QVBoxLayout(loginWidget);
verticalLayout->setAlignment(Qt::AlignCenter);
verticalLayout->setContentsMargins(50, 0, 50, 50);
Expand All @@ -120,6 +120,7 @@ void CodeGeeXWidget::initUI()

auto welcome_label = new DLabel(loginWidget);
welcome_label->setText(tr("Welcome to CodeGeeX"));//\nA must-have all-round AI tool for developers
welcome_label->setWordWrap(true);
welcome_label->setAlignment(Qt::AlignCenter);

auto font = welcome_label->font();
Expand All @@ -129,6 +130,7 @@ void CodeGeeXWidget::initUI()

auto descrption_label = new DLabel(loginWidget);
descrption_label->setText(tr("A must-have all-round AI tool for developers"));
descrption_label->setWordWrap(true);
descrption_label->setAlignment(Qt::AlignCenter);

font = descrption_label->font();
Expand All @@ -143,7 +145,6 @@ void CodeGeeXWidget::initUI()

auto btnLayout = new QHBoxLayout; //make DSuggestBtn alignCenter
auto loginBtn = new DSuggestButton(loginWidget);
loginBtn->setFixedSize(200, 36);
loginBtn->setText(tr("Go to login"));
connect(loginBtn, &DSuggestButton::clicked, this, [=] {
CodeGeeXManager::instance()->login();
Expand All @@ -154,7 +155,7 @@ void CodeGeeXWidget::initUI()
verticalLayout->addSpacing(30);
verticalLayout->addLayout(btnLayout, Qt::AlignCenter);

mainLayout->addWidget(loginWidget);
mainLayout->addWidget(loginWidget, 1, Qt::AlignVCenter);
};
initLoginUI();
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/codegeex/widgets/intropage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void IntroPage::appendSuggestButton(QVBoxLayout *layout, const QString &text, co
layout->addWidget(suggestButton);

connect(suggestButton, &DPushButton::clicked, [=] {
emit suggestionToSend(suggestButton->text());
emit suggestionToSend(text);
});
}

Expand Down

0 comments on commit 7b96111

Please sign in to comment.