From 3ceb147e0cb8e392d7a08be429e1b8bdbb6aaae2 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 20 May 2024 16:56:38 +0800 Subject: [PATCH] fix: Visibility for the interrupt action is not correctly updated. fix: Consistence for path seperators of config folders. Enhancement: Auto create custom theme directory. --- RedPandaIDE/mainwindow.cpp | 6 ++---- RedPandaIDE/settings.cpp | 8 ++++---- RedPandaIDE/settingsdialog/environmentfolderswidget.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 67f6096c..98938cf0 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1078,8 +1078,7 @@ void MainWindow::applySettings() && pSettings->executor().enableProblemSet()); ui->cbProblemCaseValidateType->setCurrentIndex((int)(pSettings->executor().problemCaseValidateType())); - if (mDebugger != nullptr) - ui->actionInterrupt->setVisible(mDebugger->useDebugServer()); + ui->actionInterrupt->setVisible(mDebugger && mDebugger->useDebugServer()); //icon sets for editors updateEditorSettings(); updateDebuggerSettings(); @@ -5265,8 +5264,7 @@ void MainWindow::onEditorTabContextMenu(QTabWidget* tabWidget, const QPoint &pos void MainWindow::disableDebugActions() { - if (mDebugger != nullptr) - ui->actionInterrupt->setVisible(mDebugger->useDebugServer()); + ui->actionInterrupt->setVisible(mDebugger && mDebugger->useDebugServer()); ui->actionInterrupt->setEnabled(false); ui->actionStep_Into->setEnabled(false); ui->actionStep_Over->setEnabled(false); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 766ce300..e091c77b 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -270,13 +270,13 @@ QString Settings::Dirs::config(Settings::Dirs::DataType dataType) const case DataType::None: return configDir; case DataType::ColorScheme: - return includeTrailingPathDelimiter(configDir)+"scheme"; + return QFileInfo{includeTrailingPathDelimiter(configDir)+"scheme"}.absoluteFilePath(); case DataType::IconSet: - return includeTrailingPathDelimiter(configDir)+"iconsets"; + return QFileInfo{includeTrailingPathDelimiter(configDir)+"iconsets"}.absoluteFilePath(); case DataType::Theme: - return includeTrailingPathDelimiter(configDir)+"themes"; + return QFileInfo{includeTrailingPathDelimiter(configDir)+"themes"}.absoluteFilePath(); case DataType::Template: - return includeTrailingPathDelimiter(configDir) + "templates"; + return QFileInfo{includeTrailingPathDelimiter(configDir) + "templates"}.absoluteFilePath(); } return ""; } diff --git a/RedPandaIDE/settingsdialog/environmentfolderswidget.cpp b/RedPandaIDE/settingsdialog/environmentfolderswidget.cpp index 1a0f2bc7..8ea51dfa 100644 --- a/RedPandaIDE/settingsdialog/environmentfolderswidget.cpp +++ b/RedPandaIDE/settingsdialog/environmentfolderswidget.cpp @@ -96,9 +96,12 @@ void EnvironmentFoldersWidget::on_btnOpenIconSetFolderInFileBrowser_clicked() void EnvironmentFoldersWidget::on_btnOpenThemeFolderInFileBrowser_clicked() { + QString folderName = pSettings->dirs().config(Settings::Dirs::DataType::Theme); + QDir folder=QDir{folderName}; + if (!folder.exists()) + folder.mkpath(folderName); QDesktopServices::openUrl( QUrl("file:///"+ - includeTrailingPathDelimiter(pSettings->dirs().config(Settings::Dirs::DataType::Theme)),QUrl::TolerantMode)); - + includeTrailingPathDelimiter(folderName),QUrl::TolerantMode)); }