From b9062c6af2cd06d0473f1e38de1dd850b8cb046c Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Fri, 29 Nov 2024 10:03:07 +0100 Subject: [PATCH] 1.15.4 --- CHANGELOG.md | 10 +++++ Sandboxie/common/my_version.h | 2 +- .../SandMan/Helpers/IniHighlighter.cpp | 40 ++++++++++++------- .../SandMan/Helpers/IniHighlighter.h | 2 +- SandboxiePlus/SandMan/SandMan.cpp | 6 +-- .../SandMan/Windows/OptionsNetwork.cpp | 6 +-- .../SandMan/Windows/OptionsWindow.cpp | 2 +- .../SandMan/Windows/SettingsWindow.cpp | 2 +- SandboxiePlus/version.h | 2 +- 9 files changed, 46 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d853e62..4d7eb89c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). + +## [1.15.4 / 5.70.4] - 2024-12-?? + +### +- Fixed issues with ini section editor in dark mode +- Fix deleting sandbox content [#4407](https://github.com/sandboxie-plus/Sandboxie/pull/4407) + + + + ## [1.15.3 / 5.70.3] - 2024-11-28 ### Added diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 1c145188..92c46363 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -26,7 +26,7 @@ #define VERSION_MJR 5 #define VERSION_MIN 70 -#define VERSION_REV 3 +#define VERSION_REV 4 #define VERSION_UPD 0 #if VERSION_UPD > 0 diff --git a/SandboxiePlus/SandMan/Helpers/IniHighlighter.cpp b/SandboxiePlus/SandMan/Helpers/IniHighlighter.cpp index 33c98446..6e892d65 100644 --- a/SandboxiePlus/SandMan/Helpers/IniHighlighter.cpp +++ b/SandboxiePlus/SandMan/Helpers/IniHighlighter.cpp @@ -1,55 +1,65 @@ #include "stdafx.h" #include "IniHighlighter.h" -CIniHighlighter::CIniHighlighter(QTextDocument *parent) +CIniHighlighter::CIniHighlighter(bool bDarkMode, QTextDocument *parent) : QSyntaxHighlighter(parent) { + // Define colors for light and dark mode + QColor blue = bDarkMode ? QColor("#87CEFA") : QColor("#0000FF"); // Lighter blue for dark mode + QColor green = bDarkMode ? QColor("#90EE90") : QColor("#008000"); // Lighter green for dark mode + QColor darkRed = bDarkMode ? QColor("#FF6347") : QColor("#800000"); // Lighter red for dark mode + QColor red = bDarkMode ? QColor("#FF4500") : QColor("#FF0000"); // Brighter red for dark mode + QColor black = bDarkMode ? QColor("#DCDCDC") : QColor("#000000"); // Light gray for dark mode + QColor brown = bDarkMode ? QColor("#F4A460") : QColor("#A52A2A"); // Light brown for dark mode + QColor purple = bDarkMode ? QColor("#DA70D6") : QColor("#800080"); // Brighter purple for dark mode + QColor gray = bDarkMode ? QColor("#A9A9A9") : QColor("#808080"); // Lighter gray for dark mode + HighlightRule rule; // Section headers: [Section] - sectionFormat.setForeground(QColor("#0000FF")); // Blue + sectionFormat.setForeground(blue); sectionFormat.setFontWeight(QFont::Bold); rule.pattern = QRegularExpression("^\\s*\\[.*\\]\\s*$"); rule.format = sectionFormat; highlightRules.append(rule); // Comments: ; comment or # comment - commentFormat.setForeground(QColor("#008000")); // Green + commentFormat.setForeground(green); rule.pattern = QRegularExpression("^\\s*[;#].*"); rule.format = commentFormat; highlightRules.append(rule); // Keys: key= - keyFormat.setForeground(QColor("#800000")); // Dark Red + keyFormat.setForeground(darkRed); rule.pattern = QRegularExpression("^[\\w\\.]+(?=\\s*=)"); rule.format = keyFormat; highlightRules.append(rule); // Equals sign: = - equalsFormat.setForeground(QColor("#FF0000")); // Red + equalsFormat.setForeground(red); rule.pattern = QRegularExpression("="); rule.format = equalsFormat; highlightRules.append(rule); // Values: =value - valueFormat.setForeground(QColor("#000000")); // Black + valueFormat.setForeground(black); rule.pattern = QRegularExpression("(?<=\\=).*"); rule.format = valueFormat; highlightRules.append(rule); // Initialize formats for value prefix and first comma - valuePrefixFormat.setForeground(QColor("#0000FF")); // Blue - firstCommaFormat.setForeground(QColor("#FF0000")); // Red + valuePrefixFormat.setForeground(blue); + firstCommaFormat.setForeground(red); #ifdef INI_WITH_JSON // Initialize JSON formats - jsonKeyFormat.setForeground(QColor("#A52A2A")); // Brown - jsonStringFormat.setForeground(QColor("#000000")); // Black - jsonNumberFormat.setForeground(QColor("#0000FF")); // Blue - jsonBoolNullFormat.setForeground(QColor("#800080")); // Purple - jsonBracesFormat.setForeground(QColor("#808080")); // Gray - jsonColonFormat.setForeground(QColor("#FF0000")); // Red - jsonCommaFormat.setForeground(QColor("#FF0000")); // Red + jsonKeyFormat.setForeground(brown); + jsonStringFormat.setForeground(black); + jsonNumberFormat.setForeground(blue); + jsonBoolNullFormat.setForeground(purple); + jsonBracesFormat.setForeground(gray); + jsonColonFormat.setForeground(red); + jsonCommaFormat.setForeground(red); // 1. JSON Colon: Match colons not preceded by backslash HighlightRule jsonRule; diff --git a/SandboxiePlus/SandMan/Helpers/IniHighlighter.h b/SandboxiePlus/SandMan/Helpers/IniHighlighter.h index 6ffff429..05e110f8 100644 --- a/SandboxiePlus/SandMan/Helpers/IniHighlighter.h +++ b/SandboxiePlus/SandMan/Helpers/IniHighlighter.h @@ -9,7 +9,7 @@ class CIniHighlighter : public QSyntaxHighlighter Q_OBJECT public: - explicit CIniHighlighter(QTextDocument *parent = nullptr); + explicit CIniHighlighter(bool bDarkMode, QTextDocument *parent = nullptr); ~CIniHighlighter(); protected: diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 139fbec0..5a853662 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -1308,9 +1308,9 @@ void CSandMan::OnRestartAsAdmin() theAPI->Disconnect(); WCHAR buf[255] = { 0 }; GetModuleFileNameW(NULL, buf, 255); - SHELLEXECUTEINFO se; - memset(&se, 0, sizeof(SHELLEXECUTEINFO)); - se.cbSize = sizeof(SHELLEXECUTEINFO); + SHELLEXECUTEINFOW se; + memset(&se, 0, sizeof(se)); + se.cbSize = sizeof(se); se.lpVerb = L"runas"; se.lpFile = buf; se.nShow = SW_HIDE; diff --git a/SandboxiePlus/SandMan/Windows/OptionsNetwork.cpp b/SandboxiePlus/SandMan/Windows/OptionsNetwork.cpp index d62dd43d..18827929 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsNetwork.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsNetwork.cpp @@ -100,14 +100,14 @@ void COptionsWindow::SaveINetAccess() int Mode = ui.cmbBlockINet->currentData().toInt(); if (Mode == 1) { if (!FindEntryInSettingList("AllowNetworkAccess", "!,n")) - m_pBox->InsertText("AllowNetworkAccess", "!,n"); + m_pBox->AppendText("AllowNetworkAccess", "!,n"); } else m_pBox->DelValue("AllowNetworkAccess", "!,n"); if (Mode == 0) { if (m_WFPisBlocking && !FindEntryInSettingList("AllowNetworkAccess", "y")) - m_pBox->InsertText("AllowNetworkAccess", "y"); + m_pBox->AppendText("AllowNetworkAccess", "y"); } else m_pBox->DelValue("AllowNetworkAccess", "y"); @@ -115,7 +115,7 @@ void COptionsWindow::SaveINetAccess() QTreeWidgetItem* pBlockedNet = FindGroupByName(""); if (pBlockedNet && pBlockedNet->childCount() > 0) { if (theGUI->IsWFPEnabled() && !FindEntryInSettingList("AllowNetworkAccess", ",n")) - m_pBox->InsertText("AllowNetworkAccess", ",n"); + m_pBox->AppendText("AllowNetworkAccess", ",n"); } else m_pBox->DelValue("AllowNetworkAccess", ",n"); diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index 3f66d2ec..f8cb66b3 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -415,7 +415,7 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri pTree->setAlternatingRowColors(true); } - m_pCodeEdit = new CCodeEdit(new CIniHighlighter); + m_pCodeEdit = new CCodeEdit(new CIniHighlighter(theGUI->m_DarkTheme)); ui.txtIniSection->parentWidget()->layout()->replaceWidget(ui.txtIniSection, m_pCodeEdit); delete ui.txtIniSection; ui.txtIniSection = NULL; diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index 67448544..ecd72d06 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -601,7 +601,7 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) ui.btnResetIniFont->setIcon(CSandMan::GetIcon("ResetFont")); ui.btnResetIniFont->setToolTip(tr("Reset font")); - m_pCodeEdit = new CCodeEdit(new CIniHighlighter); + m_pCodeEdit = new CCodeEdit(new CIniHighlighter(theGUI->m_DarkTheme)); ui.txtIniSection->parentWidget()->layout()->replaceWidget(ui.txtIniSection, m_pCodeEdit); delete ui.txtIniSection; ui.txtIniSection = NULL; diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 13d637b5..fb3baa97 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 15 -#define VERSION_REV 3 +#define VERSION_REV 4 #define VERSION_UPD 0 #ifndef STR