From 0d2c842317456241371e543ed9122744732dfa2f Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 18 Apr 2022 11:35:42 +0800 Subject: [PATCH] - fix: index of the longest line not correctly updated ( which will cause selection errors) --- NEWS.md | 1 + RedPandaIDE/qsynedit/TextBuffer.cpp | 8 +++-- .../projectcompileparamaterswidget.cpp | 29 +++++++++++++++ .../projectcompileparamaterswidget.ui | 36 +++++++++++++++++-- 4 files changed, 70 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9e5b01c9..0db48ed1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,7 @@ Red Panda C++ Version 1.0.4 - enhancement: add Portugese translation - fix: crash when eval statements like "fsm::stack fsm;" - enhancement: add Traditional Chinese translation + - fix: index of the longest line not correctly updated ( which will cause selection errors) Red Panda C++ Version 1.0.3 - fix: when oj problem grabbed by competitive companion received, diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/RedPandaIDE/qsynedit/TextBuffer.cpp index ef119d34..2090918a 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.cpp +++ b/RedPandaIDE/qsynedit/TextBuffer.cpp @@ -398,6 +398,8 @@ void SynEditStringList::deleteAt(int Index) beginUpdate(); if (mIndexOfLongestLine == Index) mIndexOfLongestLine = -1; + else if (mIndexOfLongestLine>Index) + mIndexOfLongestLine -= 1; mList.removeAt(Index); emit deleted(Index,1); endUpdate(); @@ -426,9 +428,11 @@ void SynEditStringList::putString(int Index, const QString &s, bool notify) { ListIndexOutOfBounds(Index); } beginUpdate(); - mIndexOfLongestLine = -1; + int oldColumns = mList[Index]->fColumns; mList[Index]->fString = s; - mList[Index]->fColumns = -1; + calculateLineColumns(Index); + if (oldColumns>mList[Index]->fColumns) + mIndexOfLongestLine = -1; if (notify) emit putted(Index,1); endUpdate(); diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp index ac1f3ee8..4a6dfda3 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp @@ -18,6 +18,9 @@ #include "ui_projectcompileparamaterswidget.h" #include "../mainwindow.h" #include "../project.h" +#include "../iconsmanager.h" + +#include ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &name, const QString &group, QWidget *parent) : SettingsWidget(name,group,parent), @@ -45,3 +48,29 @@ void ProjectCompileParamatersWidget::doSave() pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText(); pMainWindow->project()->saveOptions(); } + +void ProjectCompileParamatersWidget::on_btnChooseLib_clicked() +{ +#ifdef Q_OS_WIN + QString filter = tr("Library Files (*.a *.lib)"); +#else + QString filter = tr("Library Files (*.a)"); +#endif + + QStringList files = QFileDialog::getOpenFileNames( + this, + tr("Add Library Files"), + filter + ); + if (!files.isEmpty()) { + foreach (const QString& file,files) { + ui->txtLinker->appendPlainText(" "+genMakePath1(file)); + } + } +} + +void ProjectCompileParamatersWidget::updateIcons(const QSize &size) +{ + pIconsManager->setIcon(ui->btnChooseLib, IconsManager::ACTION_MISC_FOLDER); +} + diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui index a536b31e..b1fe6cad 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui @@ -24,7 +24,7 @@ - 0 + 2 @@ -74,7 +74,7 @@ Linker - + 5 @@ -90,6 +90,38 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + + +