Added a UI option to clean up at startup.Fixed known uncommitted issues.

This commit is contained in:
love-code-yeyixiao 2024-03-01 19:19:45 +08:00
parent f8bdf6d3e0
commit cafd0d7a19
3 changed files with 170 additions and 128 deletions

View File

@ -65,43 +65,6 @@
<string>General Options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QLabel" name="lblGeneral">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>SandMan Options</string>
</property>
</widget>
</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="1" column="1">
<widget class="QComboBox" name="uiLang"/>
</item>
<item row="2" column="1">
<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="3" column="1" colspan="2">
<widget class="QCheckBox" name="chkMonitorSize">
<property name="text">
@ -109,48 +72,6 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="chkPanic">
<property name="text">
<string>Hotkey for terminating all boxed processes:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="keyPanic"/>
</item>
</layout>
</item>
<item row="5" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="chkTop">
<property name="text">
<string>Hotkey for bringing sandman to the top:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="keyTop"/>
</item>
</layout>
</item>
<item row="6" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="chkPauseForce">
<property name="text">
<string>Hotkey for suspending process/folder forcing:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="keyPauseForce"/>
</item>
</layout>
</item>
<item row="7" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -165,13 +86,90 @@
</item>
</layout>
</item>
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="chkAsyncBoxOps">
<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>84</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>195</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="3" rowspan="2">
<spacer name="horizontalSpacer_14">
<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="4" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="chkPanic">
<property name="text">
<string>Hotkey for terminating all boxed processes:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="keyPanic"/>
</item>
</layout>
</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>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Run box operations asynchronously whenever possible (like content deletion)</string>
<string>SandMan Options</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="chkTop">
<property name="text">
<string>Hotkey for bringing sandman to the top:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="keyTop"/>
</item>
</layout>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lblRecovery">
<property name="font">
@ -186,59 +184,75 @@
</property>
</widget>
</item>
<item row="10" column="1" colspan="2">
<widget class="QCheckBox" name="chkShowRecovery">
<item row="2" column="1">
<widget class="QCheckBox" name="chkSandboxUrls">
<property name="text">
<string>Show file recovery window when emptying sandboxes</string>
<string>Open urls from this ui sandboxed</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</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="6" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="chkPauseForce">
<property name="text">
<string>Hotkey for suspending process/folder forcing:</string>
</property>
</widget>
</item>
<item>
<widget class="QKeySequenceEdit" name="keyPauseForce"/>
</item>
</layout>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="chkRecoveryTop">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="chkShowRecovery">
<property name="text">
<string>Show file recovery window when emptying sandboxes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkCheckDelete">
<property name="text">
<string>Don't check sandboxes' auto-delete status when Sandman starts.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkRecoveryTop">
<property name="text">
<string>Show the Recovery Window as Always on Top</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="chkAsyncBoxOps">
<property name="text">
<string>Show the Recovery Window as Always on Top</string>
<string>Run box operations asynchronously whenever possible (like content deletion)</string>
</property>
</widget>
</item>
<item row="11" column="3" rowspan="2">
<spacer name="horizontalSpacer_14">
<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="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>84</height>
</size>
</property>
</spacer>
</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>195</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">

View File

@ -282,6 +282,29 @@ CSandMan::CSandMan(QWidget *parent)
connect(qApp, &QGuiApplication::commitDataRequest, this, &CSandMan::commitData);
/*if (theConf->GetBool("Options/CheckAutoDelete", false)) {
for (auto& box : theAPI->GetAllBoxes().toStdMap()) {
CSandBoxPtr pBox = box.second;
if (box.second->GetActiveProcessCount() == 0) {
if (!pBox->GetBool("NeverDelete", false))
{
if (pBox->GetBool("AutoDelete", false))
{
bool DeleteSnapshots = false;
// if this box auto deletes first show the recovry dialog with the option to abort deletion
//if (!theGUI->OpenRecovery(pBox, DeleteSnapshots, true)) // unless no files are found than continue silently
// return;
if (theConf->GetBool("Options/AutoBoxOpsNotify", false))
OnLogMessage(tr("Auto deleting content of %1").arg(pBox->GetName()), true);
DeleteBoxContent(pBox, eAuto, DeleteSnapshots);
}
}
}
}
}*/
m_uTimerID = startTimer(1000);
bool bAutoRun = QApplication::arguments().contains("-autorun");
@ -2676,8 +2699,8 @@ void CSandMan::OnHotKey(size_t id)
case HK_SUSPEND:
{
for (auto each : theAPI->GetAllBoxes()) {
each->SetSuspendedAll(TRUE);
for (auto each : theAPI->GetAllBoxes().toStdMap()) {
each.second->SetSuspendedAll(TRUE);
};
break;
}

View File

@ -313,6 +313,7 @@ CSettingsWindow::CSettingsWindow(QWidget* parent)
connect(ui.chkNotifyRecovery, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged()));
connect(ui.chkShowRecovery, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged()));
connect(ui.chkCheckDelete, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged()));
connect(ui.chkRecoveryTop, SIGNAL(stateChanged(int)), this, SLOT(OnOptChanged()));
//
@ -924,6 +925,8 @@ void CSettingsWindow::LoadSettings()
ui.chkSuspend->setChecked(theConf->GetBool("Options/EnableSuspendKey", false));
ui.keySuspend->setKeySequence(QKeySequence(theConf->GetString("Options/SuspendKeySequence", "Ctrl+Pause")));
ui.chkCheckDelete->setChecked(!theConf->GetBool("Options/CleanUpOnStart", false));
ui.chkMonitorSize->setChecked(theConf->GetBool("Options/WatchBoxSize", false));
ui.chkWatchConfig->setChecked(theConf->GetBool("Options/WatchIni", true));
@ -1558,6 +1561,8 @@ void CSettingsWindow::SaveSettings()
theConf->SetValue("Options/EnableSuspendKey", ui.chkSuspend->isChecked());
theConf->SetValue("Options/SuspendKeySequence", ui.keySuspend->keySequence().toString());
theConf->SetValue("Options/CleanUpOnStart", !ui.chkCheckDelete->isChecked());
theConf->SetValue("Options/WatchBoxSize", ui.chkMonitorSize->isChecked());
theConf->SetValue("Options/WatchIni", ui.chkWatchConfig->isChecked());