diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2016-04-16 12:44:19 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2016-04-16 12:44:19 +0000 |
commit | d368658d9c25278e62023be7ebe573d04309be43 (patch) | |
tree | 8911a7e4c7f029243efc2d2967bcd8a6cef284cf /plugins | |
parent | 403ee5e18b2393a430ff5e9d3f0cb5feccdb341e (diff) |
PluginUpdater:
- more fixes for the options dialog
- Added feature to install a list of predefined item:
In module PluginUpdaterNewFiles, create a BYTE entry for each item you want to install
(Name as in the options dialog, BYTE value 1)
When you open "Available components list", those entries will be preselected.
git-svn-id: http://svn.miranda-ng.org/main/trunk@16675 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/PluginUpdater/res/Resource.rc | 6 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 21 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 75 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 3 |
5 files changed, 36 insertions, 71 deletions
diff --git a/plugins/PluginUpdater/res/Resource.rc b/plugins/PluginUpdater/res/Resource.rc index 246e4f38f6..70e4cd34c7 100644 --- a/plugins/PluginUpdater/res/Resource.rc +++ b/plugins/PluginUpdater/res/Resource.rc @@ -77,10 +77,10 @@ BEGIN "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,158,199,10
CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,173,267,10
EDITTEXT IDC_CUSTOMURL,12,187,267,16,ES_AUTOHSCROLL | WS_DISABLED
+ GROUPBOX "Platform",IDC_STATIC,212,122,58,40
+ CONTROL "x86", IDC_X86, "Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 217, 131, 28, 10
+ CONTROL "x64", IDC_X64, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 217, 146, 28, 10
CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,213,267,15,NOT WS_VISIBLE
- GROUPBOX "",IDC_STATIC,212,122,58,40
- CONTROL "x86", IDC_X86, "Button", BS_AUTORADIOBUTTON | WS_DISABLED | WS_TABSTOP, 217, 131, 28, 10
- CONTROL "x64", IDC_X64, "Button", BS_AUTORADIOBUTTON | WS_DISABLED | WS_TABSTOP, 217, 146, 28, 10
END
IDD_POPUP DIALOGEX 0, 0, 316, 174
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 860400c560..cab362e895 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -72,6 +72,7 @@ static void ApplyDownloads(void *param) ListView_SetItemText(hwndList, i, 1, TranslateT("Succeeded."));
if (unzip(todo[i].File.tszDiskPath, tszMirandaPath, tszFileBack,false))
SafeDeleteFile(todo[i].File.tszDiskPath); // remove .zip after successful update
+ db_unset(NULL, DB_MODULE_NEW_FILES, StrToLower(_T2A(todo[i].tszOldName)));
}
else
ListView_SetItemText(hwndList, i, 1, TranslateT("Failed!"));
@@ -220,6 +221,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ListView_DeleteAllItems(hwndList);
///
+ bool enableOk = false;
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)lParam;
for (int i = 0; i < todo.getCount(); ++i) {
LVITEM lvi = {0};
@@ -235,7 +237,15 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) lvi.iImage = ((groupId ==1) ? 0 : -1);
lvi.pszText = todo[i].tszOldName;
ListView_InsertItem(hwndList, &lvi);
+
+ if (todo[i].bEnabled)
+ {
+ enableOk = true;
+ ListView_SetCheckState(hwndList, lvi.iItem, 1);
+ }
}
+ if (enableOk)
+ EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
}
// do this after filling list - enables 'ITEMCHANGED' below
@@ -334,9 +344,6 @@ static void __stdcall LaunchListDialog(void *param) hwndDialog = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LIST), GetDesktopWindow(), DlgList, (LPARAM)param);
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// building file list in the separate thread
-
static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const TCHAR* tszBaseUrl, const TCHAR* tszPath)
{
FILEINFO *FileInfo = new FILEINFO;
@@ -360,11 +367,15 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const TCHAR* t for (tp = _tcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = _tcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
- // Deselect all plugins by default
- FileInfo->bEnabled = false;
+ // Load list of checked Plugins from database
+ Netlib_LogfT(hNetlibUser, _T("File %s found"), FileInfo->tszOldName);
+ FileInfo->bEnabled = db_get_b(NULL, DB_MODULE_NEW_FILES, _T2A(FileInfo->tszOldName)) != 0;
return FileInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// building file list in the separate thread
+//
static void GetList(void *)
{
TCHAR tszTempPath[MAX_PATH];
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index c5e85faee7..fd5f5f9ae7 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -150,13 +150,6 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar #else
CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED);
#endif
- if (opts.bChangePlatform) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRUNK_SYMBOLS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRUNK), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STABLE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOM), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- }
return TRUE;
case WM_COMMAND:
@@ -184,39 +177,18 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
- #ifdef _WIN64
- CheckDlgButton(hwndDlg, IDC_X64, BST_CHECKED);
- #else
- CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED);
- #endif
- EnableWindow(GetDlgItem(hwndDlg, IDC_X64), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_X86), FALSE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_TRUNK:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
- #ifdef _WIN64
- CheckDlgButton(hwndDlg, IDC_X64, BST_CHECKED);
- #else
- CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED);
- #endif
- EnableWindow(GetDlgItem(hwndDlg, IDC_X64), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_X86), FALSE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_STABLE:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
- #ifdef _WIN64
- CheckDlgButton(hwndDlg, IDC_X64, BST_CHECKED);
- #else
- CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED);
- #endif
- EnableWindow(GetDlgItem(hwndDlg, IDC_X64), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_X86), FALSE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_CUSTOM:
@@ -227,13 +199,6 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
}
- #ifdef _WIN64
- CheckDlgButton(hwndDlg, IDC_X64, BST_CHECKED);
- #else
- CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED);
- #endif
- EnableWindow(GetDlgItem(hwndDlg, IDC_X64), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_X86), FALSE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -250,33 +215,11 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_X86:
case IDC_X64:
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRUNK_SYMBOLS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRUNK), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STABLE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOM), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- db_set_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- db_set_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
- switch (GetUpdateMode()) {
- case UPDATE_MODE_STABLE:
- CheckDlgButton(hwndDlg, IDC_STABLE, BST_CHECKED);
- break;
- case UPDATE_MODE_TRUNK:
- CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED);
- break;
- case UPDATE_MODE_TRUNK_SYMBOLS:
- CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_CHECKED);
- break;
- default:
- CheckDlgButton(hwndDlg, IDC_CUSTOM, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
-
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
- if (url == NULL)
- url = GetDefaultUrl();
- SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
- }
- mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_OPP_BITS);
+ CheckDlgButton(hwndDlg, IDC_STABLE, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CUSTOM, BST_UNCHECKED);
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), LOWORD(wParam) == IDC_CHANGE_PLATFORM ? DEFAULT_OPP_BITS : DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -340,6 +283,14 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar opts.bForceRedownload = 0;
db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
}
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM))
+ {
+ db_set_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ db_set_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
+ }
+ else
+ db_set_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 0);
}
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 69d60a03a8..ca31724626 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -37,7 +37,7 @@ void LoadOptions() opts.bForceRedownload = db_get_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, 0);
opts.bSilentMode = db_get_b(NULL, MODNAME, "SilentMode", 0);
opts.bBackup = db_get_b(NULL, MODNAME, "Backup", 0);
- opts.bChangePlatform = false; // db_get_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, 0);
+ opts.bChangePlatform = db_get_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, 0);
}
#if MIRANDA_VER >= 0x0A00
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index da8f379c07..9efc5b88a1 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -117,11 +117,13 @@ extern struct PlugOptions #define DEFAULT_OPP_BITS 32
#define OLD_FILENAME FILENAME_X64
#define NEW_FILENAME FILENAME_X32
+ #define IDC_CHANGE_PLATFORM IDC_X86
#else
#define DEFAULT_BITS 32
#define DEFAULT_OPP_BITS 64
#define OLD_FILENAME FILENAME_X32
#define NEW_FILENAME FILENAME_X64
+ #define IDC_CHANGE_PLATFORM IDC_X64
#endif
#define PLUGIN_INFO_URL _T("http://miranda-ng.org/p/%s")
@@ -145,6 +147,7 @@ extern struct PlugOptions #define DB_SETTING_DONT_SWITCH_TO_STABLE "DontSwitchToStable"
#define DB_SETTING_CHANGEPLATFORM "ChangePlatform"
#define DB_MODULE_FILES MODNAME "Files"
+#define DB_MODULE_NEW_FILES MODNAME "NewFiles"
#define MAX_RETRIES 3
|