Skip to content

Commit

Permalink
feat: update ui of messageBox
Browse files Browse the repository at this point in the history
use DDialog to replace messageBox
1.after change language   2.delete codegeex session
  • Loading branch information
LiHua000 authored and deepin-mozart committed Dec 7, 2023
1 parent b240ab5 commit 0db9b50
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
17 changes: 15 additions & 2 deletions src/plugins/codegeex/widgets/askpagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <DScrollArea>
#include <DScrollBar>
#include <DHorizontalLine>
#include <DDialog>

#include <QVBoxLayout>
#include <QDebug>
Expand Down Expand Up @@ -93,8 +94,20 @@ void AskPageWidget::onChatFinished()

void AskPageWidget::onDeleteBtnClicked()
{
CodeGeeXManager::instance()->deleteCurrentSession();
CodeGeeXManager::instance()->cleanHistoryMessage();
DDialog *confirmDialog = new DDialog(this);
confirmDialog->setIcon(QIcon::fromTheme("dialog-warning"));
confirmDialog->setMessage(tr("This operation will delete all the content of this session. confirm to delete it?"));
confirmDialog->insertButton(0, tr("cancel"));
confirmDialog->insertButton(1, tr("delete"), false, DDialog::ButtonWarning);

connect(confirmDialog, &DDialog::buttonClicked, this, [](int index) {
if (index == 1) {
CodeGeeXManager::instance()->deleteCurrentSession();
CodeGeeXManager::instance()->cleanHistoryMessage();
}
});

confirmDialog->exec();
}

void AskPageWidget::onHistoryBtnClicked()
Expand Down
14 changes: 7 additions & 7 deletions src/plugins/option/optioncore/mainframe/profilesettingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <DLabel>
#include <DComboBox>
#include <DPushButton>
#include <DDialog>

#include <QBoxLayout>

Expand All @@ -24,8 +25,7 @@ class ProfileSettingWidgetPrivate
};

ProfileSettingWidget::ProfileSettingWidget(QWidget *parent)
: PageWidget(parent)
, d(new ProfileSettingWidgetPrivate)
: PageWidget(parent), d(new ProfileSettingWidgetPrivate)
{
readTranslate();
setupUi();
Expand All @@ -34,7 +34,7 @@ ProfileSettingWidget::ProfileSettingWidget(QWidget *parent)

ProfileSettingWidget::~ProfileSettingWidget()
{
if(d)
if (d)
delete d;
}

Expand Down Expand Up @@ -74,11 +74,11 @@ void ProfileSettingWidget::saveConfig()
file.write(chooseFileName.toUtf8());
file.close();
}
DMessageBox msgBox;
DPushButton *okButton = new DPushButton(tr("Ok"));
msgBox.addButton(okButton, QMessageBox::ButtonRole::NoRole);

DDialog msgBox;
msgBox.addButton(tr("Ok"));
msgBox.setWindowTitle(tr("Restart Required--deep-in unioncode"));
msgBox.setText(tr("The language change will take effect after restart."));
msgBox.setMessage(tr("The language change will take effect after restart."));
msgBox.exec();
}

Expand Down

0 comments on commit 0db9b50

Please sign in to comment.