fix: Visibility for the interrupt action is not correctly updated.

fix: Consistence for path seperators of config folders.
Enhancement: Auto create custom theme directory.
This commit is contained in:
Roy Qu 2024-05-20 16:56:38 +08:00
parent fd38aa4160
commit 3ceb147e0c
3 changed files with 11 additions and 10 deletions

View File

@ -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);

View File

@ -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 "";
}

View File

@ -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));
}