summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-09-10 19:43:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-09-10 19:43:01 +0300
commit8ae4a1dc21b72aea5dac2ae1badd91238682ae45 (patch)
tree82a51fb9c4f032c6226503b26b16848bd9a4583c
parent22c5c5accc245edf6ec0e0c1366b60b8bd060e4f (diff)
Plugin Updater: new option to tune the number of backups to keep (3 by default)
-rw-r--r--plugins/PluginUpdater/res/Resource.rc36
-rw-r--r--plugins/PluginUpdater/src/Options.cpp6
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp3
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp2
-rw-r--r--plugins/PluginUpdater/src/resource.h4
-rw-r--r--plugins/PluginUpdater/src/stdafx.h2
6 files changed, 31 insertions, 22 deletions
diff --git a/plugins/PluginUpdater/res/Resource.rc b/plugins/PluginUpdater/res/Resource.rc
index 7f58df1125..93ab74cba8 100644
--- a/plugins/PluginUpdater/res/Resource.rc
+++ b/plugins/PluginUpdater/res/Resource.rc
@@ -56,34 +56,37 @@ BEGIN
PUSHBUTTON "Select &none",IDC_SELNONE,175,218,60,14,NOT WS_TABSTOP
END
-IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 301, 260
+IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 301, 259
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Update options",IDC_STATIC,1,3,285,89
+ GROUPBOX "Update options",IDC_STATIC,1,3,285,99
CONTROL "On startup",IDC_UPDATEONSTARTUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,18,73,10
CONTROL "(but only once a day)",IDC_ONLYONCEADAY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,92,18,186,10
CONTROL "Every",IDC_UPDATEONPERIOD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,32,52,10
- EDITTEXT IDC_PERIOD,65,30,28,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
- CONTROL "",IDC_PERIODSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,92,30,10,14
+ EDITTEXT IDC_PERIOD,82,30,28,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
+ CONTROL "",IDC_PERIODSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,104,30,10,14
COMBOBOX IDC_PERIODMEASURE,114,30,58,30,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "Silent mode",IDC_SILENTMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,46,267,10
- CONTROL "Restart Miranda automatically",IDC_AUTORESTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,60,267,10
+ CONTROL "Restart Miranda automatically",IDC_AUTORESTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,267,10
CONTROL "Backup database before update (requires Db_autobackups plugin)",IDC_BACKUP,
- "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,74,272,10
- GROUPBOX "Files source",IDC_STATIC,2,94,285,132
- CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,107,267,10
+ "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,70,272,10
+ LTEXT "Number of backups to keep:",IDC_STATIC,12,84,184,8
+ EDITTEXT IDC_NUMBER_BACKUPS,204,82,40,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_BACKUPS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,243,82,11,14
+ GROUPBOX "Files source",IDC_STATIC,2,103,285,132
+ CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,116,267,10
CONTROL "Stable version with debug symbols",IDC_STABLE_SYMBOLS,
- "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,121,267,10
- CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,135,267,10
+ "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,130,267,10
+ CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,144,267,10
CONTROL "Development version with debug symbols",IDC_TRUNK_SYMBOLS,
- "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,149,267,10
- CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,163,267,10
- EDITTEXT IDC_CUSTOMURL,12,175,267,16,ES_AUTOHSCROLL | WS_DISABLED
- CONTROL "Change platform to 32-bit",IDC_CHANGE_PLATFORM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,196,267,10
- CONTROL "Use HTTPS",IDC_USE_HTTPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,209,267,10
- CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,229,267,15,NOT WS_VISIBLE
+ "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,158,267,10
+ CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,172,267,10
+ EDITTEXT IDC_CUSTOMURL,12,187,267,16,ES_AUTOHSCROLL | WS_DISABLED
+ CONTROL "Change platform to 32-bit",IDC_CHANGE_PLATFORM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,208,267,10
+ CONTROL "Use HTTPS",IDC_USE_HTTPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,221,267,10
+ CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,238,267,15,NOT WS_VISIBLE
END
IDD_POPUP DIALOGEX 0, 0, 316, 174
@@ -180,7 +183,6 @@ BEGIN
BEGIN
LEFTMARGIN, 1
RIGHTMARGIN, 294
- BOTTOMMARGIN, 254
END
IDD_MISSINGPLUGINS, DIALOG
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 63f8d3894a..b052cb06d0 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -72,6 +72,7 @@ wchar_t* GetDefaultUrl()
class COptionsDlg : public CDlgBase
{
+ CCtrlSpin spinBackups;
CCtrlCombo cmbPeriod;
CCtrlCheck chkPeriod, chkStable, chkStableSym, chkTrunk, chkTrunkSym, chkCustom;
CCtrlCheck chkHttps, chkPlatform, chkStartup, chkAutoRestart, chkOnlyOnce, chkBackup, chkSilent;
@@ -124,7 +125,9 @@ public:
chkTrunkSym(this, IDC_TRUNK_SYMBOLS),
chkStable(this, IDC_STABLE),
chkStableSym(this, IDC_STABLE_SYMBOLS),
- chkCustom(this, IDC_CUSTOM)
+ chkCustom(this, IDC_CUSTOM),
+
+ spinBackups(this, IDC_BACKUPS_SPIN, 10, 1)
{
CreateLink(chkHttps, g_plugin.bUseHttps);
CreateLink(chkBackup, g_plugin.bBackup);
@@ -133,6 +136,7 @@ public:
CreateLink(chkStartup, g_plugin.bUpdateOnStartup);
CreateLink(chkOnlyOnce, g_plugin.bOnlyOnceADay);
CreateLink(chkAutoRestart, g_plugin.bAutoRestart);
+ CreateLink(spinBackups, g_plugin.iNumberBackups);
chkPlatform.OnChange = chkHttps.OnChange = Callback(this, &COptionsDlg::onChange_Url);
chkPeriod.OnChange = Callback(this, &COptionsDlg::onChange_Period);
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index 108bac717b..176844452a 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -59,7 +59,8 @@ CMPlugin::CMPlugin() :
// other settings
iPeriod(MODULENAME, "Period", 1),
- iPeriodMeasure(MODULENAME, "PeriodMeasure", 1)
+ iPeriodMeasure(MODULENAME, "PeriodMeasure", 1),
+ iNumberBackups(MODULENAME, "NumberOfBackups", 3)
{
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 72d7e5fd4a..8794b2b1e0 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -458,7 +458,7 @@ void CreateWorkFolders(TFileName &wszTempFolder, TFileName &wszBackupFolder)
} while (FindNextFileW(hFind, &fdata));
// remove all folders with lesser dates if there're more than 10 folders
- while (arNames.getCount() > 9) {
+ while (arNames.getCount() >= g_plugin.iNumberBackups) {
SafeDeleteDirectory(arNames[0]);
arNames.remove(00);
}
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h
index 9105bba95a..a31fb28440 100644
--- a/plugins/PluginUpdater/src/resource.h
+++ b/plugins/PluginUpdater/src/resource.h
@@ -64,6 +64,8 @@
#define IDC_ERR_BG 1061
#define IDC_INFO_MESSAGES_BG 1062
#define IDC_AUTORESTART 1063
+#define IDC_NUMBER_BACKUPS 1064
+#define IDC_BACKUPS_SPIN 1066
// Next default values for new objects
//
@@ -71,7 +73,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40075
-#define _APS_NEXT_CONTROL_VALUE 1064
+#define _APS_NEXT_CONTROL_VALUE 1067
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index ed46c7c286..3e9f3e1b72 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -169,7 +169,7 @@ struct CMPlugin : public PLUGIN<CMPlugin>
// common options
CMOption<bool> bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bSilentMode, bBackup, bChangePlatform, bUseHttps, bAutoRestart;
- CMOption<int> iPeriod, iPeriodMeasure;
+ CMOption<int> iPeriod, iPeriodMeasure, iNumberBackups;
// popup options
CMOption<BYTE> PopupDefColors, PopupLeftClickAction, PopupRightClickAction;