This commit is contained in:
DavidXanatos 2022-01-14 14:06:01 +01:00
parent d4aab142af
commit 0b1b4af79a
7 changed files with 43 additions and 23 deletions

View File

@ -32,6 +32,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed box border not spaning across multiple monitors
- fixed issues with border when using different DPI scaling on multiple monitors [#1512](https://github.com/sandboxie-plus/Sandboxie/issues/1512) [#1506](https://github.com/sandboxie-plus/Sandboxie/issues/1506)
- fixed dpi issues with Qt [#1368](https://github.com/sandboxie-plus/Sandboxie/issues/1368)
- fixed issue with bright flashing on window creation when in dark mode [#1231](https://github.com/sandboxie-plus/Sandboxie/issues/1231)
- fixed issues with the PortableRootDir setting [#1509](https://github.com/sandboxie-plus/Sandboxie/issues/1509)

View File

@ -452,4 +452,20 @@ bool InitConsole(bool bCreateIfNeeded)
printf("\r\n");
return true;
}
#endif
#endif
//
// avoid flashing a bright white window when in dark mode
//
void SafeShow(QWidget* pWidget) {
pWidget->setProperty("windowOpacity", 0.0);
pWidget->show();
QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers | QEventLoop::ExcludeSocketNotifiers);
pWidget->setProperty("windowOpacity", 1.0);
}
int SafeExec(QDialog* pDialog){
SafeShow(pDialog);
return pDialog->exec();
}

View File

@ -97,4 +97,7 @@ MISCHELPERS_EXPORT QAction* MakeAction(QActionGroup* pGroup, QMenu* pParent, con
#ifdef WIN32
MISCHELPERS_EXPORT bool InitConsole(bool bCreateIfNeeded = true);
#endif
#endif
MISCHELPERS_EXPORT void SafeShow(QWidget* pWidget);
MISCHELPERS_EXPORT int SafeExec(QDialog* pDialog);

View File

@ -271,10 +271,10 @@ CSandMan::CSandMan(QWidget *parent)
bool bAutoRun = QApplication::arguments().contains("-autorun");
if (g_PendingMessage.isEmpty()) {
m_pTrayIcon->show(); // Note: qt bug; hide does not work if not showing first :/
if (!bAutoRun && theConf->GetInt("Options/SysTrayIcon", 1) == 0)
m_pTrayIcon->hide();
if(g_PendingMessage.isEmpty()){
m_pTrayIcon->show(); // Note: qt bug; hide does not work if not showing first :/
if(!bAutoRun && theConf->GetInt("Options/SysTrayIcon", 1) == 0)
m_pTrayIcon->hide();
}
//
@ -940,8 +940,8 @@ void CSandMan::OnStatusChanged()
QString BoxPath = QDir::cleanPath(QApplication::applicationDirPath() + "/../Sandbox").replace("/", "\\");
int PortableRootDir = theConf->GetInt("Options/PortableRootDir", -1);
if (PortableRootDir == -1)
int PortableRootDir = theConf->GetInt("Options/PortableRootDir", 2);
if (PortableRootDir == 2)
{
bool State = false;
PortableRootDir = CCheckableMessageBox::question(this, "Sandboxie-Plus",
@ -2337,10 +2337,10 @@ void CSandMan::UpdateCertState()
g_CertInfo.about_to_expire = g_CertInfo.expirers_in_sec && g_CertInfo.expirers_in_sec < (60*60*24*30);
if (g_CertInfo.outdated)
OnLogMessage(tr("The supporter certificate is not valid for this build, please get an updated certificate"));
// outdated always implicates it is no longer valid
else if (g_CertInfo.expired) // may be still valid for the current older builds
OnLogMessage(tr("The supporter certificate is expired %1 days ago, please get an updated certificate")
.arg(g_CertInfo.valid ? tr(", but it remains valid for the current build") : ""));
// outdated always implicates its no longer valid
else if (g_CertInfo.expired) // may be still valid for the current ald older builds
OnLogMessage(tr("The supporter certificate is expired%1, please get an updated certificate")
.arg(g_CertInfo.valid ? tr(", but it remians valid for the current build") : ""));
else if(g_CertInfo.about_to_expire)
OnLogMessage(tr("The supporter certificate will expire in %1 days, please get an updated certificate").arg(g_CertInfo.expirers_in_sec / (60*60*24)));

View File

@ -816,7 +816,7 @@ void CSbieView::OnSandBoxAction(QAction* Action)
connect(pFileBrowserWindow, &CFileBrowserWindow::Closed, [this, pBox]() {
FileBrowserWindows.remove(pBox.data());
});
pFileBrowserWindow->show();
SafeShow(pFileBrowserWindow);
}
}
else if (Action == m_pMenuExplore)
@ -884,7 +884,7 @@ void CSbieView::OnSandBoxAction(QAction* Action)
connect(pSnapshotsWindow, &CSnapshotsWindow::Closed, [this, pBox]() {
SnapshotWindows.remove(pBox.data());
});
pSnapshotsWindow->show();
SafeShow(pSnapshotsWindow);
}
}
else if (Action == m_pMenuDuplicate)
@ -1168,7 +1168,7 @@ void CSbieView::OnDoubleClicked(const QModelIndex& index)
connect(pBoxEx->m_pOptionsWnd, &COptionsWindow::Closed, [pBoxEx]() {
pBoxEx->m_pOptionsWnd = NULL;
});
pBoxEx->m_pOptionsWnd->show();
SafeShow(pBoxEx->m_pOptionsWnd);
}
else {
pBoxEx->m_pOptionsWnd->setWindowState((pBoxEx->m_pOptionsWnd->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);

View File

@ -103,7 +103,7 @@ void CPopUpWindow::Show()
this->move(scrRect.width() - 600 - 20, scrRect.height() - 200 - 50);
}
this->show();
SafeShow(this);
}
void CPopUpWindow::Poke()

View File

@ -184,13 +184,13 @@ void CSettingsWindow::showCompat()
{
m_CompatLoaded = 2;
ui.tabs->setCurrentWidget(ui.tabCompat);
show();
SafeShow(this);
}
void CSettingsWindow::showSupport()
{
ui.tabs->setCurrentWidget(ui.tabSupport);
show();
SafeShow(this);
ui.chkNoCheck->setVisible(true);
}
@ -299,9 +299,8 @@ void CSettingsWindow::LoadSettings()
}
int PortableRootDir = theConf->GetInt("Options/PortableRootDir", -1);
if (PortableRootDir != -1 && theConf->IsPortable())
ui.chkAutoRoot->setChecked(PortableRootDir == 0 ? Qt::Unchecked : Qt::Checked);
if (theGUI->IsFullyPortable())
ui.chkAutoRoot->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/PortableRootDir", 2)));
else
ui.chkAutoRoot->setVisible(false);
@ -480,7 +479,7 @@ void CSettingsWindow::SaveSettings()
}
if (ui.chkAutoRoot->isVisible())
theConf->SetValue("Options/PortableRootDir", ui.chkAutoRoot->checkState() == Qt::Checked ? 1 : 0);
theConf->SetValue("Options/PortableRootDir", CSettingsWindow__Chk2Int(ui.chkAutoRoot->checkState()));
theConf->SetValue("Options/AutoRunSoftCompat", !ui.chkNoCompat->isChecked());
@ -596,7 +595,7 @@ void CSettingsWindow::OnChange()
QStandardItem *item = model->item(0);
item->setFlags((ui.cmbSysTray->currentIndex() == 0) ? item->flags() & ~Qt::ItemIsEnabled : item->flags() | Qt::ItemIsEnabled);
if (ui.chkAutoRoot->isVisible() && theGUI->IsFullyPortable())
if (ui.chkAutoRoot->isVisible())
ui.fileRoot->setEnabled(ui.chkAutoRoot->checkState() != Qt::Checked);
ui.btnSetPassword->setEnabled(ui.chkPassRequired->isChecked());