diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-27 12:27:42 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-27 12:27:50 +0300 |
commit | 1cabfa1a3fa019eff1454dcf6462905e1fa834b6 (patch) | |
tree | 031ab50de320f503fc0228d84e7308c94abc1304 /plugins/CrashDumper/src | |
parent | df19001fa48529bd59096ebd9a0b1ce669278532 (diff) |
code cleaning
Diffstat (limited to 'plugins/CrashDumper/src')
-rw-r--r-- | plugins/CrashDumper/src/crshdmp.cpp | 13 | ||||
-rw-r--r-- | plugins/CrashDumper/src/stdafx.h | 17 | ||||
-rw-r--r-- | plugins/CrashDumper/src/ui.cpp | 153 |
3 files changed, 91 insertions, 92 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 7305b25612..8c76065ec6 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -18,6 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+int OptionsInit(WPARAM wParam, LPARAM);
+
CMPlugin g_plugin;
LCID packlcid;
@@ -197,17 +199,6 @@ static int FoldersPathChanged(WPARAM, LPARAM) return 0;
}
-int OptionsInit(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.szTitle.a = MODULENAME;
- odp.szGroup.a = LPGEN("Services");
- odp.flags = ODPF_BOLDGROUPS;
- odp.pDialog = new COptDialog;
- g_plugin.addOptions(wParam, &odp);
- return 0;
-}
-
static int ToolbarModulesLoaded(WPARAM, LPARAM)
{
TTBButton ttb = {};
diff --git a/plugins/CrashDumper/src/stdafx.h b/plugins/CrashDumper/src/stdafx.h index 7a2db71c67..51c44fa0e4 100644 --- a/plugins/CrashDumper/src/stdafx.h +++ b/plugins/CrashDumper/src/stdafx.h @@ -158,23 +158,6 @@ HICON LoadIconEx(int iconId, bool big = false); void ReleaseIconEx(int iconId);
HANDLE GetIconHandle(int iconId);
-class COptDialog : public CDlgBase
-{
-private:
- CCtrlEdit m_edtUserName, m_edtPass;
- CCtrlCheck m_chkAutoUpload, m_chkClassicDates, m_chkRepSubfolder, m_chkCatchCrashes;
- CCtrlLabel m_lblRestart;
-
-protected:
- bool OnInitDialog() override;
- bool OnApply() override;
-
- void OnCatchCrashesChange(CCtrlCheck*);
-
-public:
- COptDialog();
-};
-
class CViewVersionInfo : public CDlgBase
{
private:
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 7422264d55..13ba7a5b1c 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -194,80 +194,105 @@ void DestroyAllWindows(void) }
}
-COptDialog::COptDialog() :
- CDlgBase(g_plugin, IDD_OPTIONS),
- m_edtUserName(this, IDC_USERNAME),
- m_edtPass(this, IDC_PASSWORD),
- m_chkAutoUpload(this, IDC_UPLOADCHN),
- m_chkClassicDates(this, IDC_CLASSICDATES),
- m_chkRepSubfolder(this, IDC_DATESUBFOLDER),
- m_chkCatchCrashes(this, IDC_CATCHCRASHES),
- m_lblRestart(this, IDC_RESTARTNOTE)
-{
- CreateLink(m_chkAutoUpload, "UploadChanged", DBVT_BYTE, 0);
- m_chkCatchCrashes.OnChange = Callback(this, &COptDialog::OnCatchCrashesChange);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// options
-bool COptDialog::OnInitDialog()
+class COptDialog : public CDlgBase
{
- CDlgBase::OnInitDialog();
- DBVARIANT dbv;
- if (g_plugin.getString("Username", &dbv) == 0) {
- m_edtUserName.SetTextA(dbv.pszVal);
- db_free(&dbv);
+ CCtrlEdit m_edtUserName, m_edtPass;
+ CCtrlCheck m_chkAutoUpload, m_chkClassicDates, m_chkRepSubfolder, m_chkCatchCrashes;
+ CCtrlLabel m_lblRestart;
+
+ void COptDialog::OnCatchCrashesChange(CCtrlCheck*)
+ {
+ m_chkClassicDates.Enable(m_chkCatchCrashes.GetState());
+ m_chkRepSubfolder.Enable(m_chkCatchCrashes.GetState());
+ m_lblRestart.Show();
+ needrestart = 1;
}
- if (g_plugin.getString("Password", &dbv) == 0) {
- m_edtPass.SetTextA(dbv.pszVal);
- db_free(&dbv);
+
+public:
+ COptDialog() :
+ CDlgBase(g_plugin, IDD_OPTIONS),
+ m_edtUserName(this, IDC_USERNAME),
+ m_edtPass(this, IDC_PASSWORD),
+ m_chkAutoUpload(this, IDC_UPLOADCHN),
+ m_chkClassicDates(this, IDC_CLASSICDATES),
+ m_chkRepSubfolder(this, IDC_DATESUBFOLDER),
+ m_chkCatchCrashes(this, IDC_CATCHCRASHES),
+ m_lblRestart(this, IDC_RESTARTNOTE)
+ {
+ CreateLink(m_chkAutoUpload, "UploadChanged", DBVT_BYTE, 0);
+ m_chkCatchCrashes.OnChange = Callback(this, &COptDialog::OnCatchCrashesChange);
}
- m_chkClassicDates.SetState(clsdates);
- m_chkRepSubfolder.SetState(dtsubfldr);
- m_chkCatchCrashes.SetState(catchcrashes);
- if (!catchcrashes) {
- m_chkClassicDates.Disable();
- m_chkRepSubfolder.Disable();
+
+ bool COptDialog::OnInitDialog()
+ {
+ CDlgBase::OnInitDialog();
+ DBVARIANT dbv;
+ if (g_plugin.getString("Username", &dbv) == 0) {
+ m_edtUserName.SetTextA(dbv.pszVal);
+ db_free(&dbv);
+ }
+ if (g_plugin.getString("Password", &dbv) == 0) {
+ m_edtPass.SetTextA(dbv.pszVal);
+ db_free(&dbv);
+ }
+ m_chkClassicDates.SetState(clsdates);
+ m_chkRepSubfolder.SetState(dtsubfldr);
+ m_chkCatchCrashes.SetState(catchcrashes);
+ if (!catchcrashes) {
+ m_chkClassicDates.Disable();
+ m_chkRepSubfolder.Disable();
+ }
+ if (needrestart)
+ m_lblRestart.Show();
+ return true;
}
- if (needrestart)
- m_lblRestart.Show();
- return true;
-}
-void COptDialog::OnCatchCrashesChange(CCtrlCheck*)
-{
- m_chkClassicDates.Enable(m_chkCatchCrashes.GetState());
- m_chkRepSubfolder.Enable(m_chkCatchCrashes.GetState());
- m_lblRestart.Show();
- needrestart = 1;
-}
+ bool COptDialog::OnApply()
+ {
+ char szSetting[100];
+ m_edtUserName.GetTextA(szSetting, _countof(szSetting));
+ g_plugin.setString("Username", szSetting);
+
+ m_edtPass.GetTextA(szSetting, _countof(szSetting));
+ g_plugin.setString("Password", szSetting);
+
+ clsdates = m_chkClassicDates.GetState();
+ if (clsdates)
+ g_plugin.setByte("ClassicDates", 1);
+ else
+ g_plugin.setByte("ClassicDates", 0);
+ dtsubfldr = m_chkRepSubfolder.GetState();
+ if (dtsubfldr)
+ g_plugin.setByte("SubFolders", 1);
+ else
+ g_plugin.setByte("SubFolders", 0);
+ catchcrashes = m_chkCatchCrashes.GetState();
+ if (catchcrashes)
+ g_plugin.setByte("CatchCrashes", 1);
+ else
+ g_plugin.setByte("CatchCrashes", 0);
+
+ return true;
+ }
+};
-bool COptDialog::OnApply()
+int OptionsInit(WPARAM wParam, LPARAM)
{
- char szSetting[100];
- m_edtUserName.GetTextA(szSetting, _countof(szSetting));
- g_plugin.setString("Username", szSetting);
-
- m_edtPass.GetTextA(szSetting, _countof(szSetting));
- g_plugin.setString("Password", szSetting);
-
- clsdates = m_chkClassicDates.GetState();
- if (clsdates)
- g_plugin.setByte("ClassicDates", 1);
- else
- g_plugin.setByte("ClassicDates", 0);
- dtsubfldr = m_chkRepSubfolder.GetState();
- if (dtsubfldr)
- g_plugin.setByte("SubFolders", 1);
- else
- g_plugin.setByte("SubFolders", 0);
- catchcrashes = m_chkCatchCrashes.GetState();
- if (catchcrashes)
- g_plugin.setByte("CatchCrashes", 1);
- else
- g_plugin.setByte("CatchCrashes", 0);
-
- return true;
+ OPTIONSDIALOGPAGE odp = {};
+ odp.szTitle.a = MODULENAME;
+ odp.szGroup.a = LPGEN("Services");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pDialog = new COptDialog;
+ g_plugin.addOptions(wParam, &odp);
+ return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// popups
+
LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
|