This commit is contained in:
DavidXanatos 2022-12-15 14:06:58 +01:00
parent 656c722e38
commit 58ea37d01f
10 changed files with 247 additions and 107 deletions

View File

@ -6,11 +6,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.6.1b / 5.61.1] - 2022-12-??
### Added
- added game/presentation mode [#2534](https://github.com/sandboxie-plus/Sandboxie/issues/2534)
### Fixed
- fixed support settign page not showing version updates properly
## [1.6.1a / 5.61.1] - 2022-12-07
### Added

View File

@ -45,7 +45,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
@ -54,7 +54,110 @@
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_8">
<item row="7" column="1" colspan="2">
<item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>UI Language:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QCheckBox" name="chkShowRecovery">
<property name="text">
<string>Show first recovery window when emptying sandboxes</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="chkRecoveryTop">
<property name="text">
<string>Show the Recovery Window as Always on Top</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkAsyncBoxOps">
<property name="text">
<string>Run box operations asynchronously whenever possible (like content deletion)</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkMonitorSize">
<property name="text">
<string>Count and display the disk space occupied by each sandbox</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="uiLang"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblGeneral">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>General Options</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lblRecovery">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Recovery Options</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkSandboxUrls">
<property name="text">
<string>Open urls from this ui sandboxed</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="chkNotifications">
<property name="text">
<string>Show Notifications for relevant log Messages</string>
@ -64,10 +167,10 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkAsyncBoxOps">
<item row="10" column="1">
<widget class="QCheckBox" name="chkNotifyRecovery">
<property name="text">
<string>Run box operations asynchronously whenever possible (like content deletion)</string>
<string>Show recoverable files as notifications</string>
</property>
</widget>
</item>
@ -85,89 +188,6 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblGeneral">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>General Options</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lblRecovery">
<property name="font">
<font>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Recovery Options</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QCheckBox" name="chkNotifyRecovery">
<property name="text">
<string>Show recoverable files as notifications</string>
</property>
</widget>
</item>
<item row="12" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>UI Language:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="chkSandboxUrls">
<property name="text">
<string>Open urls from this ui sandboxed</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="chkRecoveryTop">
<property name="text">
<string>Show the Recovery Window as Always on Top</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="chkMonitorSize">
<property name="text">
<string>Count and display the disk space occupied by each sandbox</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="uiLang"/>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="chkWatchConfig">
<property name="text">
@ -175,23 +195,10 @@
</property>
</widget>
</item>
<item row="12" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1" colspan="2">
<widget class="QCheckBox" name="chkShowRecovery">
<item row="7" column="1">
<widget class="QCheckBox" name="chkSilentMode">
<property name="text">
<string>Show first recovery window when emptying sandboxes</string>
<string>Suppress pop-up notifications when in game / presentation mode</string>
</property>
</widget>
</item>

View File

@ -0,0 +1,106 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "stdafx.h"
#include "FullScreen.h"
#include <windows.h>
#include <Shlwapi.h>
static bool IsPlatformFullScreenMode()
{
// SHQueryUserNotificationState is only available for Vista and above.
#if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_VISTA)
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&osvi) && osvi.dwMajorVersion < 6)
return false;
typedef HRESULT(WINAPI* SHQueryUserNotificationStatePtr)(
QUERY_USER_NOTIFICATION_STATE* state);
HMODULE shell32_base = ::GetModuleHandle(L"shell32.dll");
if (!shell32_base) {
return false;
}
SHQueryUserNotificationStatePtr query_user_notification_state_ptr =
reinterpret_cast<SHQueryUserNotificationStatePtr>
(::GetProcAddress(shell32_base, "SHQueryUserNotificationState"));
if (!query_user_notification_state_ptr) {
return false;
}
QUERY_USER_NOTIFICATION_STATE state;
if (FAILED((*query_user_notification_state_ptr)(&state)))
return false;
return state == QUNS_RUNNING_D3D_FULL_SCREEN ||
state == QUNS_PRESENTATION_MODE;
#else
return false;
#endif
}
static bool IsFullScreenWindowMode()
{
// Get the foreground window which the user is currently working on.
HWND wnd = ::GetForegroundWindow();
if (!wnd)
return false;
// Get the monitor where the window is located.
RECT wnd_rect;
if (!::GetWindowRect(wnd, &wnd_rect))
return false;
HMONITOR monitor = ::MonitorFromRect(&wnd_rect, MONITOR_DEFAULTTONULL);
if (!monitor)
return false;
MONITORINFO monitor_info = { sizeof(monitor_info) };
if (!::GetMonitorInfo(monitor, &monitor_info))
return false;
// It should be the main monitor.
if (!(monitor_info.dwFlags & MONITORINFOF_PRIMARY))
return false;
// The window should be at least as large as the monitor.
if (!::IntersectRect(&wnd_rect, &wnd_rect, &monitor_info.rcMonitor))
return false;
if (!::EqualRect(&wnd_rect, &monitor_info.rcMonitor))
return false;
// At last, the window style should not have WS_DLGFRAME and WS_THICKFRAME and
// its extended style should not have WS_EX_WINDOWEDGE and WS_EX_TOOLWINDOW.
LONG style = ::GetWindowLong(wnd, GWL_STYLE);
LONG ext_style = ::GetWindowLong(wnd, GWL_EXSTYLE);
return !((style & (WS_DLGFRAME | WS_THICKFRAME)) ||
(ext_style & (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW)));
}
static bool IsFullScreenConsoleMode()
{
// We detect this by attaching the current process to the console of the
// foreground window and then checking if it is in full screen mode.
DWORD pid = 0;
::GetWindowThreadProcessId(::GetForegroundWindow(), &pid);
if (!pid)
return false;
if (!::AttachConsole(pid))
return false;
DWORD modes = 0;
::GetConsoleDisplayMode(&modes);
::FreeConsole();
return (modes & (CONSOLE_FULLSCREEN | CONSOLE_FULLSCREEN_HARDWARE)) != 0;
}
bool IsFullScreenMode() {
return IsPlatformFullScreenMode()
//|| IsFullScreenConsoleMode()
|| IsFullScreenWindowMode();
}

View File

@ -0,0 +1,3 @@
#pragma once
bool IsFullScreenMode();

View File

@ -33,6 +33,7 @@
#include "../MiscHelpers/Common/NeonEffect.h"
#include <QVariantAnimation>
#include <QSessionManager>
#include "Helpers/FullScreen.h"
CSbiePlusAPI* theAPI = NULL;
@ -518,7 +519,7 @@ void CSandMan::CreateMenus(bool bAdvanced)
}
m_pMenuView->addSeparator();
m_pMenuBrowse = m_pMenuView->addAction(CSandMan::GetIcon("Tree"), tr("Show File Panel"), this, SLOT(OnProcView()));
m_pMenuBrowse = m_pMenuView->addAction(CSandMan::GetIcon("Folder"), tr("Show File Panel"), this, SLOT(OnProcView()));
m_pMenuBrowse->setCheckable(true);
m_pMenuBrowse->setShortcut(QKeySequence("Ctrl+D"));
m_pMenuBrowse->setShortcutContext(Qt::WidgetWithChildrenShortcut);
@ -1243,6 +1244,12 @@ bool CSandMan::IsFullyPortable()
return false;
}
bool CSandMan::IsSilentMode()
{
if (!theConf->GetBool("Options/CheckSilentMode", true))
return false;
return IsFullScreenMode();
}
void CSandMan::OnMessage(const QString& MsgData)
{
QStringList Messages = MsgData.split("\n");

View File

@ -56,8 +56,9 @@ public:
bool IsShowHidden() { return m_pShowHidden && m_pShowHidden->isChecked(); }
bool KeepTerminated() { return m_pKeepTerminated && m_pKeepTerminated->isChecked(); }
bool ShowAllSessions() { return m_pShowAllSessions && m_pShowAllSessions->isChecked(); }
bool IsDisableRecovery() {return m_pDisableRecovery && m_pDisableRecovery->isChecked();}
bool IsDisableMessages() {return m_pDisableMessages && m_pDisableMessages->isChecked();}
bool IsSilentMode();
bool IsDisableRecovery() {return IsSilentMode() || m_pDisableRecovery && m_pDisableRecovery->isChecked();}
bool IsDisableMessages() {return IsSilentMode() || m_pDisableMessages && m_pDisableMessages->isChecked();}
CSbieView* GetBoxView() { return m_pBoxView; }
CFileView* GetFileView() { return m_pFileView; }

View File

@ -17,6 +17,7 @@ HEADERS += ./stdafx.h \
./Views/TraceView.h \
./Dialogs/MultiErrorDialog.h \
./Helpers/FindTool.h \
./Helpers/FullScreen.h \
./Helpers/WinAdmin.h \
./Helpers/ReadDirectoryChanges.h \
./Helpers/ReadDirectoryChangesPrivate.h \
@ -46,6 +47,7 @@ SOURCES += ./main.cpp \
./Views/TraceView.cpp \
./Dialogs/MultiErrorDialog.cpp \
./Helpers/FindTool.cpp \
./Helpers/FullScreen.cpp \
./Helpers/WinAdmin.cpp \
./Helpers/ReadDirectoryChanges.cpp \
./Helpers/ReadDirectoryChangesPrivate.cpp \

View File

@ -207,6 +207,7 @@
<ClCompile Include="BoxMonitor.cpp" />
<ClCompile Include="Dialogs\MultiErrorDialog.cpp" />
<ClCompile Include="Helpers\FindTool.cpp" />
<ClCompile Include="Helpers\FullScreen.cpp" />
<ClCompile Include="Helpers\ReadDirectoryChanges.cpp" />
<ClCompile Include="Helpers\ReadDirectoryChangesPrivate.cpp" />
<ClCompile Include="Helpers\WinAdmin.cpp" />
@ -338,6 +339,7 @@
<ClInclude Include="..\version.h" />
<QtMoc Include="BoxMonitor.h" />
<ClInclude Include="Helpers\FindTool.h" />
<ClInclude Include="Helpers\FullScreen.h" />
<ClInclude Include="Helpers\ReadDirectoryChanges.h" />
<ClInclude Include="Helpers\ReadDirectoryChangesPrivate.h" />
<ClInclude Include="Helpers\ThreadSafeQueue.h" />

View File

@ -177,6 +177,9 @@
<ClCompile Include="OnlineUpdater.cpp">
<Filter>SandMan</Filter>
</ClCompile>
<ClCompile Include="Helpers\FullScreen.cpp">
<Filter>Helpers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -203,6 +206,9 @@
<ClInclude Include="Helpers\ThreadSafeQueue.h">
<Filter>Helpers</Filter>
</ClInclude>
<ClInclude Include="Helpers\FullScreen.h">
<Filter>Helpers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtMoc Include="SandMan.h">

View File

@ -600,6 +600,7 @@ void CSettingsWindow::LoadSettings()
//ui.cmbFontScale->setCurrentIndex(ui.cmbFontScale->findData(theConf->GetInt("Options/FontScaling", 100)));
ui.cmbFontScale->setCurrentText(QString::number(theConf->GetInt("Options/FontScaling", 100)));
ui.chkSilentMode->setChecked(theConf->GetBool("Options/CheckSilentMode", true));
ui.chkNotifications->setChecked(theConf->GetBool("Options/ShowNotifications", true));
ui.chkSandboxUrls->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/OpenUrlsSandboxed", 2)));
@ -896,6 +897,7 @@ void CSettingsWindow::SaveSettings()
theConf->SetValue("Options/RunInDefaultBox", ui.chkAlwaysDefault->isChecked());
theConf->SetValue("Options/CheckSilentMode", ui.chkSilentMode->isChecked());
theConf->SetValue("Options/ShowNotifications", ui.chkNotifications->isChecked());
theConf->SetValue("Options/OpenUrlsSandboxed", CSettingsWindow__Chk2Int(ui.chkSandboxUrls->checkState()));