summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-20 22:57:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-20 22:57:35 +0300
commita144aedf745f07beed2257b77839ad7c979b9eec (patch)
treee712d8c6a0c7617fb9c1c08a373fa71837b711c9 /plugins
parent713d02facf10fb187f7f74c32942d18e817a7934 (diff)
CurrencyRates:
- fixes #1857 (rate limit error); - code cleaning; - version bump
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CurrencyRates/res/Forex.rc21
-rw-r--r--plugins/CurrencyRates/src/CommonOptionDlg.cpp43
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp54
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderBase.h2
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp8
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.cpp70
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.h44
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp2
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h1
-rw-r--r--plugins/CurrencyRates/src/DBUtils.h40
-rw-r--r--plugins/CurrencyRates/src/HTTPSession.cpp16
-rw-r--r--plugins/CurrencyRates/src/SettingsDlg.cpp107
-rw-r--r--plugins/CurrencyRates/src/SettingsDlg.h4
-rw-r--r--plugins/CurrencyRates/src/resource.h16
-rw-r--r--plugins/CurrencyRates/src/stdafx.h1
-rw-r--r--plugins/CurrencyRates/src/version.h2
16 files changed, 155 insertions, 276 deletions
diff --git a/plugins/CurrencyRates/res/Forex.rc b/plugins/CurrencyRates/res/Forex.rc
index ecd52b4664..3d55d1d363 100644
--- a/plugins/CurrencyRates/res/Forex.rc
+++ b/plugins/CurrencyRates/res/Forex.rc
@@ -30,7 +30,7 @@ IDI_ICON_MAIN ICON "main.ico"
IDI_ICON_SECTION ICON "Section.ico"
-IDI_ICON_CURRENCYRATE ICON "currencyrate.ico"
+IDI_ICON_CURRENCYRATE ICON "currencyrate.ico"
IDI_ICON_UP ICON "up.ico"
@@ -222,7 +222,7 @@ BEGIN
EDITTEXT IDC_EDIT_PREVIOUS_RATE,97,75,61,12,ES_AUTOHSCROLL | ES_READONLY
END
-IDD_DIALOG_OPT_GOOGLE DIALOGEX 0, 0, 310, 233
+IDD_DIALOG_OPT_GOOGLE DIALOGEX 0, 0, 310, 242
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -239,14 +239,16 @@ BEGIN
EDITTEXT IDC_EDIT_REFRESH_RATE,117,151,40,12,ES_AUTOHSCROLL
CONTROL "",IDC_SPIN_REFRESH_RATE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,234,150,11,14
COMBOBOX IDC_COMBO_REFRESH_RATE,160,151,69,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "&Display in Contact List as:",IDC_STATIC,7,168,107,8
+ LTEXT "&Display in Contact List as:",IDC_STATIC,7,167,107,8
EDITTEXT IDC_EDIT_CONTACT_LIST_FORMAT,117,165,120,12,ES_AUTOHSCROLL
PUSHBUTTON "&Variables...",IDC_BUTTON_DESCRIPTION,240,165,65,12
- LTEXT "&Status Message:",IDC_STATIC,7,181,108,8
+ LTEXT "&Status Message:",IDC_STATIC,7,181,107,8
EDITTEXT IDC_EDIT_STATUS_MESSAGE_FORMAT,117,179,120,12,ES_AUTOHSCROLL
- LTEXT "&Tendency:",IDC_STATIC,7,195,102,8
+ LTEXT "&Tendency:",IDC_STATIC,7,195,107,8
EDITTEXT IDC_EDIT_TENDENCY_FORMAT,117,193,120,12,ES_AUTOHSCROLL
- PUSHBUTTON "&Advanced Settings...",IDC_BUTTON_ADVANCED_SETTINGS,102,211,110,14
+ LTEXT "&Personal key:",IDC_STATIC,7,210,107,8
+ EDITTEXT IDC_EDIT_PERSONAL_KEY,117,208,120,12,ES_AUTOHSCROLL
+ PUSHBUTTON "&Advanced Settings...",IDC_BUTTON_ADVANCED_SETTINGS,105,223,110,14
END
IDD_DIALOG_CURRENCYRATE_INFO_1 DIALOGEX 0, 0, 222, 143
@@ -328,7 +330,7 @@ BEGIN
RIGHTMARGIN, 305
VERTGUIDE, 249
TOPMARGIN, 7
- BOTTOMMARGIN, 225
+ BOTTOMMARGIN, 237
END
IDD_DIALOG_CURRENCYRATE_INFO_1, DIALOG
@@ -352,6 +354,11 @@ BEGIN
0
END
+IDD_DIALOG_OPT_GOOGLE AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/CurrencyRates/src/CommonOptionDlg.cpp b/plugins/CurrencyRates/src/CommonOptionDlg.cpp
index f963ce9d12..d635a54438 100644
--- a/plugins/CurrencyRates/src/CommonOptionDlg.cpp
+++ b/plugins/CurrencyRates/src/CommonOptionDlg.cpp
@@ -34,37 +34,33 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr
{
assert(rData.m_pCurrencyRatesProvider);
- CCurrencyRatesProviderVisitorDbSettings visitor;
- rData.m_pCurrencyRatesProvider->Accept(visitor);
- assert(visitor.m_pszDbRefreshRateType);
- assert(visitor.m_pszDbRefreshRateValue);
- assert(visitor.m_pszDbDisplayNameFormat);
- assert(visitor.m_pszDbStatusMsgFormat);
- assert(visitor.m_pszDbTendencyFormat);
-
// set contact list display format
- tstring sDspNameFrmt = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat);
+ tstring sDspNameFrmt = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_DisplayNameFormat, DB_DEF_DisplayNameFormat);
::SetDlgItemText(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT, sDspNameFrmt.c_str());
// set status message display format
- tstring sStatusMsgFrmt = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat);
+ tstring sStatusMsgFrmt = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_StatusMsgFormat, DB_DEF_StatusMsgFormat);
::SetDlgItemText(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT, sStatusMsgFrmt.c_str());
// set tendency format
- tstring sTendencyFrmt = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
+ tstring sTendencyFrmt = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_TendencyFormat, DB_DEF_TendencyFormat);
::SetDlgItemText(hWnd, IDC_EDIT_TENDENCY_FORMAT, sTendencyFrmt.c_str());
+ // set api key
+ tstring sApiKey = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_ApiKey, L"");
+ ::SetDlgItemText(hWnd, IDC_EDIT_PERSONAL_KEY, sApiKey.c_str());
+
// refresh rate
HWND hwndCombo = ::GetDlgItem(hWnd, IDC_COMBO_REFRESH_RATE);
LPCTSTR pszRefreshRateTypes[] = { TranslateT("Seconds"), TranslateT("Minutes"), TranslateT("Hours") };
for (int i = 0; i < _countof(pszRefreshRateTypes); ++i)
::SendMessage(hwndCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRefreshRateTypes[i]));
- int nRefreshRateType = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES);
+ int nRefreshRateType = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_RefreshRateType, RRT_MINUTES);
if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
nRefreshRateType = RRT_MINUTES;
- UINT nRate = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1);
+ UINT nRate = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_RefreshRateValue, 1);
switch (nRefreshRateType) {
default:
case RRT_SECONDS:
@@ -119,6 +115,7 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr
case IDC_EDIT_CONTACT_LIST_FORMAT:
case IDC_EDIT_STATUS_MESSAGE_FORMAT:
case IDC_EDIT_TENDENCY_FORMAT:
+ case IDC_EDIT_PERSONAL_KEY:
if (reinterpret_cast<HWND>(lp) == ::GetFocus())
PropSheet_Changed(::GetParent(hWnd), hWnd);
break;
@@ -193,25 +190,21 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr
assert(rData.m_pCurrencyRatesProvider);
- CCurrencyRatesProviderVisitorDbSettings visitor;
- rData.m_pCurrencyRatesProvider->Accept(visitor);
- assert(visitor.m_pszDbRefreshRateType);
- assert(visitor.m_pszDbRefreshRateValue);
- assert(visitor.m_pszDbDisplayNameFormat);
- assert(visitor.m_pszDbStatusMsgFormat);
-
rData.m_bFireSetingsChangedEvent = true;
- db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, nType);
- db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, nRefreshRate);
+ db_set_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_RefreshRateType, nType);
+ db_set_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_RefreshRateValue, nRefreshRate);
tstring s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT));
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, s.c_str());
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_DisplayNameFormat, s.c_str());
s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT));
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, s.c_str());
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_StatusMsgFormat, s.c_str());
s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_TENDENCY_FORMAT));
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, s.c_str());
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_TendencyFormat, s.c_str());
+
+ s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_PERSONAL_KEY));
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_ApiKey, s.c_str());
CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pCurrencyRatesProvider, false);
if (pAdvSet)
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp
index 5a8c617f07..42a8942ccd 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp
@@ -138,27 +138,14 @@ CCurrencyRatesProviderBase::~CCurrencyRatesProviderBase()
bool CCurrencyRatesProviderBase::Init()
{
bool bSucceded = m_pXMLInfo != nullptr;
- if (!m_pXMLInfo) {
- CCurrencyRatesProviderVisitorDbSettings visitor;
- Accept(visitor);
- assert(visitor.m_pszXMLIniFileName);
-
- m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName, bSucceded)));
- }
+ if (!m_pXMLInfo)
+ m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(DB_DEF_IniFileName, bSucceded)));
return bSucceded;
}
CCurrencyRatesProviderBase::CXMLFileInfo* CCurrencyRatesProviderBase::GetXMLFileInfo()const
{
- // if(!m_pXMLInfo)
- // {
- // CCurrencyRatesProviderVisitorDbSettings visitor;
- // Accept(visitor);
- // assert(visitor.m_pszXMLIniFileName);
- // m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName)));
- // }
-
return m_pXMLInfo.get();
}
@@ -599,11 +586,8 @@ void CCurrencyRatesProviderBase::WriteContactRate(MCONTACT hContact, double dRat
sLogFileName = GenerateLogFileName(sLogFileName, sSymbol);
tstring sFormat = global_settings.GetLogFormat();
- if (bUseContactSpecific) {
- CCurrencyRatesProviderVisitorDbSettings visitor;
- Accept(visitor);
- sFormat = CurrencyRates_DBGetStringW(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_LOG_FILE, visitor.m_pszDefLogFileFormat);
- }
+ if (bUseContactSpecific)
+ sFormat = CurrencyRates_DBGetStringW(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_LOG_FILE, DB_DEF_LogFormat);
log_to_file(this, hContact, sLogFileName, sFormat);
}
@@ -667,19 +651,16 @@ MCONTACT CCurrencyRatesProviderBase::CreateNewContact(const tstring& rsName)
return hContact;
}
-DWORD get_refresh_timeout_miliseconds(const CCurrencyRatesProviderVisitorDbSettings& visitor)
+DWORD get_refresh_timeout_miliseconds()
{
if (!g_bAutoUpdate)
return INFINITE;
- assert(visitor.m_pszDbRefreshRateType);
- assert(visitor.m_pszDbRefreshRateValue);
-
- int nRefreshRateType = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES);
+ int nRefreshRateType = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_RefreshRateType, RRT_MINUTES);
if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS)
nRefreshRateType = RRT_MINUTES;
- DWORD nTimeout = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1);
+ DWORD nTimeout = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_RefreshRateValue, 1);
switch (nRefreshRateType) {
default:
case RRT_SECONDS:
@@ -717,13 +698,10 @@ private:
void CCurrencyRatesProviderBase::Run()
{
- CCurrencyRatesProviderVisitorDbSettings visitor;
- Accept(visitor);
-
- DWORD nTimeout = get_refresh_timeout_miliseconds(visitor);
- m_sContactListFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat);
- m_sStatusMsgFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat);
- m_sTendencyFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
+ DWORD nTimeout = get_refresh_timeout_miliseconds();
+ m_sContactListFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_DisplayNameFormat, DB_DEF_DisplayNameFormat);
+ m_sStatusMsgFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_StatusMsgFormat, DB_DEF_StatusMsgFormat);
+ m_sTendencyFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_TendencyFormat, DB_DEF_TendencyFormat);
enum
{
@@ -772,10 +750,10 @@ void CCurrencyRatesProviderBase::Run()
break;
case WAIT_OBJECT_0 + SETTINGS_CHANGED:
- nTimeout = get_refresh_timeout_miliseconds(visitor);
- m_sContactListFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat);
- m_sStatusMsgFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat);
- m_sTendencyFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
+ nTimeout = get_refresh_timeout_miliseconds();
+ m_sContactListFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_DisplayNameFormat, DB_DEF_DisplayNameFormat);
+ m_sStatusMsgFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_StatusMsgFormat, DB_DEF_StatusMsgFormat);
+ m_sTendencyFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_TendencyFormat, DB_DEF_TendencyFormat);
{
mir_cslock lck(m_cs);
anContacts = m_aContacts;
@@ -802,7 +780,7 @@ void CCurrencyRatesProviderBase::Run()
break;
case WAIT_TIMEOUT:
- nTimeout = get_refresh_timeout_miliseconds(visitor);
+ nTimeout = get_refresh_timeout_miliseconds();
{
mir_cslock lck(m_cs);
anContacts = m_aContacts;
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h
index ddb00ea18c..0203675edf 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h
@@ -78,7 +78,7 @@ public:
virtual void AddContact(MCONTACT hContact);
virtual void DeleteContact(MCONTACT hContact);
virtual void Run();
- virtual void Accept(CCurrencyRatesProviderVisitor& visitor)const;
+ virtual void Accept(CCurrencyRatesProviderVisitor& visitor) const;
virtual void RefreshAllContacts();
virtual void RefreshSettings();
virtual void RefreshContact(MCONTACT hContact);
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp
index 6b4e845b73..050006fb7c 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp
@@ -6,7 +6,10 @@
tstring build_url(const tstring &rsURL, const tstring &from, const tstring &to)
{
tostringstream o;
- o << rsURL << L"?q=" << from << L"_" << to << "&compact=ultra&apiKey=" << API_KEY;
+ o << rsURL << L"?q=" << from << L"_" << to << "&compact=ultra";
+ ptrA szApiKey(g_plugin.getStringA(DB_KEY_ApiKey));
+ if (szApiKey != nullptr)
+ o << "&apiKey=" << szApiKey.get();
return o.str();
}
@@ -50,9 +53,8 @@ INT_PTR CALLBACK OptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
const auto& rapCurrencyRatesProviders = pProviders->GetProviders();
for (auto i = rapCurrencyRatesProviders.begin(); i != rapCurrencyRatesProviders.end(); ++i) {
const auto& pProvider = *i;
- if (auto p = dynamic_cast<CCurrencyRatesProviderCurrencyConverter*>(pProvider.get())) {
+ if (auto p = dynamic_cast<CCurrencyRatesProviderCurrencyConverter*>(pProvider.get()))
return p;
- }
}
assert(!"We should never get here!");
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.cpp
deleted file mode 100644
index 5b28a6b56e..0000000000
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "StdAfx.h"
-
-CCurrencyRatesProviderVisitorDbSettings::CCurrencyRatesProviderVisitorDbSettings() :
- m_pszDbRefreshRateType(nullptr),
- m_pszDbRefreshRateValue(nullptr),
- m_pszDbDisplayNameFormat(nullptr),
- m_pszDefDisplayFormat(nullptr),
- m_pszDefLogFileFormat(nullptr),
- m_pszDefHistoryFormat(nullptr),
- m_pszXMLIniFileName(nullptr),
- m_pszDbStatusMsgFormat(nullptr),
- m_pszDefStatusMsgFormat(nullptr),
- m_pszDbLogMode(nullptr),
- m_pszDbHistoryFormat(nullptr),
- m_pszDbHistoryCondition(nullptr),
- m_pszDbLogFile(nullptr),
- m_pszDbLogFormat(nullptr),
- m_pszDbLogCondition(nullptr),
- m_pszDbPopupFormat(nullptr),
- m_pszDefPopupFormat(nullptr),
- m_pszDbPopupCondition(nullptr),
- m_pszDbPopupColourMode(nullptr),
- m_pszDbPopupBkColour(nullptr),
- m_pszDbPopupTextColour(nullptr),
- m_pszDbPopupDelayMode(nullptr),
- m_pszDbPopupDelayTimeout(nullptr),
- m_pszDbPopupHistoryFlag(nullptr),
- m_pszDbTendencyFormat(nullptr),
- m_pszDefTendencyFormat(L"%r>%p")
-{
-}
-
-CCurrencyRatesProviderVisitorDbSettings::~CCurrencyRatesProviderVisitorDbSettings()
-{
-}
-
-void CCurrencyRatesProviderVisitorDbSettings::Visit(const CCurrencyRatesProviderBase&/* rProvider*/)
-{
- m_pszDefLogFileFormat = L"%s\\t%t\\t%r\\n";
- m_pszDefHistoryFormat = L"%s %r";
- m_pszDefPopupFormat = L"\\nCurrent = %r\\nPrevious = %p";
-}
-
-void CCurrencyRatesProviderVisitorDbSettings::Visit(const CCurrencyRatesProviderCurrencyConverter&)
-{
- m_pszDbRefreshRateType = "CC_RefreshRateType";
- m_pszDbRefreshRateValue = "CC_RefreshRateValue";
- m_pszDbDisplayNameFormat = "CC_DspNameFrmt";
- m_pszDefDisplayFormat = L"1 %f = %r %i";
- m_pszXMLIniFileName = L"CC.xml";
- m_pszDbStatusMsgFormat = "CC_StatusMessageFormat";
-
- m_pszDbLogMode = "CC_LogMode";
- m_pszDbHistoryFormat = "CC_HistoryFormat";
- m_pszDbHistoryCondition = "CC_AddToHistoryOnlyIfValueIsChanged";
- m_pszDbLogFile = "CC_LogFile";
- m_pszDbLogFormat = "CC_LogFileFormat";
- m_pszDbLogCondition = "CC_AddToLogOnlyIfValueIsChanged";
- m_pszDbPopupFormat = "CC_PopupFormat";
- m_pszDbPopupCondition = "CC_ShowPopupOnlyIfValueChanged";
-
- m_pszDbPopupColourMode = "CC_PopupColourMode";
- m_pszDbPopupBkColour = "CC_PopupColourBk";
- m_pszDbPopupTextColour = "CC_PopupColourText";
- m_pszDbPopupDelayMode = "CC_PopupDelayMode";
- m_pszDbPopupDelayTimeout = "CC_PopupDelayTimeout";
- m_pszDbPopupHistoryFlag = "CC_PopupHistoryFlag";
-
- m_pszDbTendencyFormat = "CC_TendencyFormat";
-}
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.h
deleted file mode 100644
index e5abdcb998..0000000000
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef __97cd432a_1119_4803_a96f_0abc1cc2653f_CurrencyRatesProviderVisitorDbSettings_h__
-#define __97cd432a_1119_4803_a96f_0abc1cc2653f_CurrencyRatesProviderVisitorDbSettings_h__
-
-class CCurrencyRatesProviderVisitorDbSettings : public CCurrencyRatesProviderVisitor
-{
-public:
- CCurrencyRatesProviderVisitorDbSettings();
- ~CCurrencyRatesProviderVisitorDbSettings();
-
-private:
- virtual void Visit(const CCurrencyRatesProviderBase& rProvider)override;
- virtual void Visit(const CCurrencyRatesProviderCurrencyConverter& rProvider)override;
-public:
- LPCSTR m_pszDbRefreshRateType;
- LPCSTR m_pszDbRefreshRateValue;
- LPCSTR m_pszDbDisplayNameFormat;
- LPCTSTR m_pszDefDisplayFormat;
- LPCTSTR m_pszDefLogFileFormat;
- LPCTSTR m_pszDefHistoryFormat;
- LPCTSTR m_pszXMLIniFileName;
- LPCSTR m_pszDbStatusMsgFormat;
- LPCTSTR m_pszDefStatusMsgFormat;
- LPCTSTR m_pszDefPopupFormat;
- LPCSTR m_pszDbTendencyFormat;
- LPCTSTR m_pszDefTendencyFormat;
-
- //global settings
- LPCSTR m_pszDbLogMode;
- LPCSTR m_pszDbHistoryFormat;
- LPCSTR m_pszDbHistoryCondition;
- LPCSTR m_pszDbLogFile;
- LPCSTR m_pszDbLogFormat;
- LPCSTR m_pszDbLogCondition;
- LPCSTR m_pszDbPopupFormat;
- LPCSTR m_pszDbPopupCondition;
- LPCSTR m_pszDbPopupColourMode;
- LPCSTR m_pszDbPopupBkColour;
- LPCSTR m_pszDbPopupTextColour;
- LPCSTR m_pszDbPopupDelayMode;
- LPCSTR m_pszDbPopupDelayTimeout;
- LPCSTR m_pszDbPopupHistoryFlag;
-};
-
-#endif //__97cd432a_1119_4803_a96f_0abc1cc2653f_CurrencyRatesProviderVisitorDbSettings_h__
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp
index 34bf3afab9..56556440f0 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp
@@ -12,7 +12,7 @@ CCurrencyRatesProviderVisitorFormater::~CCurrencyRatesProviderVisitorFormater()
{
}
-const tstring& CCurrencyRatesProviderVisitorFormater::GetResult()const
+const tstring& CCurrencyRatesProviderVisitorFormater::GetResult() const
{
return m_sResult;
}
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h
index 0528f21484..ca2f03a255 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h
@@ -15,7 +15,6 @@ private:
private:
void FormatDoubleHelper(LPCSTR pszDbSet, const tstring sInvalid = L"-");
- // void FormatChangeValueHelper(bool bPercentage);
private:
MCONTACT m_hContact;
diff --git a/plugins/CurrencyRates/src/DBUtils.h b/plugins/CurrencyRates/src/DBUtils.h
index e479fc0114..f6c7f83b71 100644
--- a/plugins/CurrencyRates/src/DBUtils.h
+++ b/plugins/CurrencyRates/src/DBUtils.h
@@ -1,6 +1,46 @@
#ifndef __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
#define __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__
+#define DB_KEY_RefreshRateType "CC_RefreshRateType"
+#define DB_KEY_RefreshRateValue "CC_RefreshRateValue"
+
+#define DB_KEY_StatusMsgFormat "CC_StatusMessageFormat"
+#define DB_DEF_StatusMsgFormat L""
+
+#define DB_DEF_IniFileName L"CC.xml"
+
+#define DB_KEY_ApiKey "CC_ApiKey"
+
+#define DB_KEY_DisplayNameFormat "CC_DspNameFrmt"
+#define DB_DEF_DisplayNameFormat L"1 %f = %r %i"
+
+#define DB_KEY_HistoryFormat "CC_HistoryFormat"
+#define DB_DEF_HistoryFormat L"%s %r"
+
+#define DB_KEY_HistoryCondition "CC_AddToHistoryOnlyIfValueIsChanged"
+
+#define DB_KEY_LogMode "CC_LogMode"
+#define DB_KEY_LogFile "CC_LogFile"
+#define DB_KEY_LogCondition "CC_AddToLogOnlyIfValueIsChanged"
+
+#define DB_KEY_LogFormat "CC_LogFileFormat"
+#define DB_DEF_LogFormat L"%s\\t%t\\t%r\\n"
+
+#define DB_KEY_PopupFormat "CC_PopupFormat"
+#define DB_DEF_PopupFormat L"\\nCurrent = %r\\nPrevious = %p"
+
+#define DB_KEY_PopupCondition "CC_ShowPopupOnlyIfValueChanged"
+
+#define DB_KEY_PopupColourMode "CC_PopupColourMode"
+#define DB_KEY_PopupBkColour "CC_PopupColourBk"
+#define DB_KEY_PopupTextColour "CC_PopupColourText"
+#define DB_KEY_PopupDelayMode "CC_PopupDelayMode"
+#define DB_KEY_PopupDelayTimeout "CC_PopupDelayTimeout"
+#define DB_KEY_PopupHistoryFlag "CC_PopupHistoryFlag"
+
+#define DB_KEY_TendencyFormat "CC_TendencyFormat"
+#define DB_DEF_TendencyFormat L"%r>%p"
+
void FixInvalidChars(tstring &s);
std::wstring GetNodeText(const TiXmlElement*);
diff --git a/plugins/CurrencyRates/src/HTTPSession.cpp b/plugins/CurrencyRates/src/HTTPSession.cpp
index 06f1d5409d..e32aac7eab 100644
--- a/plugins/CurrencyRates/src/HTTPSession.cpp
+++ b/plugins/CurrencyRates/src/HTTPSession.cpp
@@ -1,13 +1,21 @@
#include "StdAfx.h"
+#define ERROR_MSG LPGENW("This plugin requires a personal key. Press Yes to obtain it at the site and then enter the result in the Options dialog, otherwise this plugin will fail")
+
+void CALLBACK waitStub()
+{
+ if (IDYES == MessageBox(0, TranslateW(ERROR_MSG), _A2W(CURRENCYRATES_MODULE_NAME), MB_YESNOCANCEL))
+ Utils_OpenUrl("https://free.currencyconverterapi.com/free-api-key");
+}
+
class CHTTPSession::CImpl
{
public:
CImpl() {}
virtual ~CImpl() {}
- virtual bool OpenURL(const tstring& rsURL) = 0;
- virtual bool ReadResponce(tstring& rsResponce)const = 0;
+ virtual bool OpenURL(const tstring &rsURL) = 0;
+ virtual bool ReadResponce(tstring &rsResponce)const = 0;
};
int find_header(const NETLIBHTTPREQUEST* pRequest, const char* hdr)
@@ -32,6 +40,10 @@ public:
{
assert(nullptr == g_hNetLib);
+ ptrA szApiKey(g_plugin.getStringA(DB_KEY_ApiKey));
+ if (szApiKey == nullptr)
+ Miranda_WaitOnHandle(waitStub);
+
NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = CURRENCYRATES_PROTOCOL_NAME;
diff --git a/plugins/CurrencyRates/src/SettingsDlg.cpp b/plugins/CurrencyRates/src/SettingsDlg.cpp
index ef81b22a41..fe4a3102bc 100644
--- a/plugins/CurrencyRates/src/SettingsDlg.cpp
+++ b/plugins/CurrencyRates/src/SettingsDlg.cpp
@@ -345,9 +345,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L
if (BN_CLICKED == HIWORD(wp)) {
CSettingWindowParam* pParam = get_param(hWnd);
if (!pParam->m_pPopupSettings) {
- CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(pParam->m_hContact);
-
- pParam->m_pPopupSettings = new CPopupSettings(pProvider.get());
+ pParam->m_pPopupSettings = new CPopupSettings();
pParam->m_pPopupSettings->InitForContact(pParam->m_hContact);
}
@@ -644,23 +642,11 @@ CAdvProviderSettings::CAdvProviderSettings(const ICurrencyRatesProvider* pCurren
{
assert(m_pCurrencyRatesProvider);
- CCurrencyRatesProviderVisitorDbSettings visitor;
- m_pCurrencyRatesProvider->Accept(visitor);
-
- assert(visitor.m_pszDefLogFileFormat);
- assert(visitor.m_pszDefHistoryFormat);
- assert(visitor.m_pszDbLogMode);
- assert(visitor.m_pszDbHistoryFormat);
- assert(visitor.m_pszDbHistoryCondition);
- assert(visitor.m_pszDbLogFile);
- assert(visitor.m_pszDbLogFormat);
- assert(visitor.m_pszDbLogCondition);
-
- m_wLogMode = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, static_cast<WORD>(lmDisabled));
- m_sFormatHistory = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, visitor.m_pszDefHistoryFormat);
- m_bIsOnlyChangedHistory = 1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, 0);
+ m_wLogMode = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogMode, static_cast<WORD>(lmDisabled));
+ m_sFormatHistory = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_HistoryFormat, DB_DEF_HistoryFormat);
+ m_bIsOnlyChangedHistory = 1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_HistoryCondition, 0);
- m_sLogFileName = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile);
+ m_sLogFileName = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_LogFile);
if (true == m_sLogFileName.empty()) {
m_sLogFileName = g_pszVariableUserProfile;
m_sLogFileName += L"\\CurrencyRates\\";
@@ -668,11 +654,11 @@ CAdvProviderSettings::CAdvProviderSettings(const ICurrencyRatesProvider* pCurren
m_sLogFileName += L".log";
}
- m_sFormatLogFile = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, visitor.m_pszDefLogFileFormat);
- m_bIsOnlyChangedLogFile = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, 0));
+ m_sFormatLogFile = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_LogFormat, DB_DEF_LogFormat);
+ m_bIsOnlyChangedLogFile = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogCondition, 0));
- m_sPopupFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, visitor.m_pszDefPopupFormat);
- m_bShowPopupIfValueChanged = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, 0));
+ m_sPopupFormat = CurrencyRates_DBGetStringW(NULL, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupFormat, DB_DEF_PopupFormat);
+ m_bShowPopupIfValueChanged = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupCondition, 0));
}
CAdvProviderSettings::~CAdvProviderSettings()
@@ -687,38 +673,22 @@ const ICurrencyRatesProvider* CAdvProviderSettings::GetProviderPtr()const
void CAdvProviderSettings::SaveToDb()const
{
- CCurrencyRatesProviderVisitorDbSettings visitor;
- m_pCurrencyRatesProvider->Accept(visitor);
-
- assert(visitor.m_pszDbLogMode);
- assert(visitor.m_pszDbHistoryFormat);
- assert(visitor.m_pszDbHistoryCondition);
- assert(visitor.m_pszDbLogFile);
- assert(visitor.m_pszDbLogFormat);
- assert(visitor.m_pszDbLogCondition);
- assert(visitor.m_pszDbPopupColourMode);
- assert(visitor.m_pszDbPopupBkColour);
- assert(visitor.m_pszDbPopupTextColour);
- assert(visitor.m_pszDbPopupDelayMode);
- assert(visitor.m_pszDbPopupDelayTimeout);
- assert(visitor.m_pszDbPopupHistoryFlag);
-
- db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, m_wLogMode);
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, m_sFormatHistory.c_str());
- db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, m_bIsOnlyChangedHistory);
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile, m_sLogFileName.c_str());
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, m_sFormatLogFile.c_str());
- db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, m_bIsOnlyChangedLogFile);
- db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, m_sPopupFormat.c_str());
- db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, m_bShowPopupIfValueChanged);
+ db_set_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogMode, m_wLogMode);
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_HistoryFormat, m_sFormatHistory.c_str());
+ db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_HistoryCondition, m_bIsOnlyChangedHistory);
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogFile, m_sLogFileName.c_str());
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogFormat, m_sFormatLogFile.c_str());
+ db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogCondition, m_bIsOnlyChangedLogFile);
+ db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupFormat, m_sPopupFormat.c_str());
+ db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupCondition, m_bShowPopupIfValueChanged);
if (nullptr != m_pPopupSettings) {
- db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode()));
- db_set_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_pPopupSettings->GetColourBk());
- db_set_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_pPopupSettings->GetColourText());
- db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode()));
- db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_pPopupSettings->GetDelayTimeout());
- db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_pPopupSettings->GetHistoryFlag());
+ db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode()));
+ db_set_dw(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupBkColour, m_pPopupSettings->GetColourBk());
+ db_set_dw(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupTextColour, m_pPopupSettings->GetColourText());
+ db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode()));
+ db_set_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupDelayTimeout, m_pPopupSettings->GetDelayTimeout());
+ db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupHistoryFlag, m_pPopupSettings->GetHistoryFlag());
}
}
@@ -805,13 +775,16 @@ void CAdvProviderSettings::SetShowPopupIfValueChangedFlag(bool val)
CPopupSettings* CAdvProviderSettings::GetPopupSettingsPtr()const
{
if (nullptr == m_pPopupSettings)
- m_pPopupSettings = new CPopupSettings(m_pCurrencyRatesProvider);
+ m_pPopupSettings = new CPopupSettings();
return m_pPopupSettings;
}
-CPopupSettings::CPopupSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider)
- : m_modeColour(colourDefault),
+/////////////////////////////////////////////////////////////////////////////////////////
+// class CPopupSettings
+
+CPopupSettings::CPopupSettings() :
+ m_modeColour(colourDefault),
m_modeDelay(delayFromPopup),
m_rgbBkg(GetDefColourBk()),
m_rgbText(GetDefColourText()),
@@ -819,29 +792,19 @@ CPopupSettings::CPopupSettings(const ICurrencyRatesProvider* pCurrencyRatesProvi
m_bUseHistory(false)
{
- CCurrencyRatesProviderVisitorDbSettings visitor;
- pCurrencyRatesProvider->Accept(visitor);
-
- assert(visitor.m_pszDbPopupColourMode);
- assert(visitor.m_pszDbPopupBkColour);
- assert(visitor.m_pszDbPopupTextColour);
- assert(visitor.m_pszDbPopupDelayMode);
- assert(visitor.m_pszDbPopupDelayTimeout);
- assert(visitor.m_pszDbPopupHistoryFlag);
-
- BYTE m = db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_modeColour));
+ BYTE m = db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupColourMode, static_cast<BYTE>(m_modeColour));
if (m >= colourDefault && m <= colourUserDefined)
m_modeColour = static_cast<EColourMode>(m);
- m_rgbBkg = db_get_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_rgbBkg);
- m_rgbText = db_get_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_rgbText);
+ m_rgbBkg = db_get_dw(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupBkColour, m_rgbBkg);
+ m_rgbText = db_get_dw(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupTextColour, m_rgbText);
- m = db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_modeDelay));
+ m = db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupDelayMode, static_cast<BYTE>(m_modeDelay));
if (m >= delayFromPopup && m <= delayPermanent) {
m_modeDelay = static_cast<EDelayMode>(m);
}
- m_wDelay = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_wDelay);
- m_bUseHistory = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_bUseHistory));
+ m_wDelay = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupDelayTimeout, m_wDelay);
+ m_bUseHistory = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupHistoryFlag, m_bUseHistory));
}
/*static */
diff --git a/plugins/CurrencyRates/src/SettingsDlg.h b/plugins/CurrencyRates/src/SettingsDlg.h
index 87c7ab697a..95667c8434 100644
--- a/plugins/CurrencyRates/src/SettingsDlg.h
+++ b/plugins/CurrencyRates/src/SettingsDlg.h
@@ -1,8 +1,6 @@
#ifndef __E211E4D9_383C_43BE_A787_7EF1D585B90D_SettingsDlg_h__
#define __E211E4D9_383C_43BE_A787_7EF1D585B90D_SettingsDlg_h__
-class ICurrencyRatesProvider;
-
class CPopupSettings
{
public:
@@ -20,7 +18,7 @@ public:
};
public:
- CPopupSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider);
+ CPopupSettings();
static COLORREF GetDefColourBk();
static COLORREF GetDefColourText();
diff --git a/plugins/CurrencyRates/src/resource.h b/plugins/CurrencyRates/src/resource.h
index ef87ff4a70..e1216a897c 100644
--- a/plugins/CurrencyRates/src/resource.h
+++ b/plugins/CurrencyRates/src/resource.h
@@ -1,19 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by C:\Code\miranda-ng-from-github\plugins\CurrencyRates\res\Forex.rc
+// Used by w:\miranda-ng\plugins\CurrencyRates\res\Forex.rc
//
#define IDI_ICON_MAIN 102
-#define IDD_DIALOG_CURRENCYRATE_INFO 102
+#define IDD_DIALOG_CURRENCYRATE_INFO 102
#define IDD_DIALOG_OPT_GOOGLE 103
#define IDI_ICON_SECTION 110
-#define IDI_ICON_CURRENCYRATE 111
+#define IDI_ICON_CURRENCYRATE 111
#define IDI_ICON_UP 113
#define IDI_ICON_DOWN 114
#define IDD_CONTACT_SETTINGS 115
#define IDI_ICON_NOTCHANGED 116
#define IDD_CURRENCY_CONVERTER 116
#define IDI_ICON_CURRENCY_CONVERTER 117
-#define IDD_DIALOG_CURRENCYRATE_INFO_1 118
+#define IDD_DIALOG_CURRENCYRATE_INFO_1 118
#define IDI_ICON_REFRESH 118
#define IDI_ICON_IMPORT 119
#define IDI_ICON_EXPORT 120
@@ -26,10 +26,10 @@
#define IDC_EDIT_REFRESH_RATE 1002
#define IDC_SPIN_REFRESH_RATE 1003
#define IDC_COMBO_REFRESH_RATE 1004
-#define IDC_STATIC_CURRENCYRATE_NAME 1008
+#define IDC_STATIC_CURRENCYRATE_NAME 1008
#define IDC_SYSLINK_PROVIDER 1009
#define IDC_STATIC_CHART 1010
-#define IDC_STATIC_CURRENCYRATE_CHART 1010
+#define IDC_STATIC_CURRENCYRATE_CHART 1010
#define IDC_COMBO_CONVERT_FROM 1011
#define IDC_COMBO_CONVERT_INTO 1012
#define IDC_BUTTON_ADD 1013
@@ -46,6 +46,8 @@
#define IDC_EDIT_FILE_NAME 1022
#define IDC_EDIT_TENDENCY_FORMAT 1022
#define IDC_BUTTON_BROWSE 1023
+#define IDC_EDIT_TENDENCY_FORMAT2 1023
+#define IDC_EDIT_PERSONAL_KEY 1023
#define IDC_STATIC_SELECT_FILE 1024
#define IDC_EDIT_NAME 1025
#define IDC_EDIT_HISTORY_FORMAT 1026
@@ -92,7 +94,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 125
+#define _APS_NEXT_RESOURCE_VALUE 126
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1073
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/CurrencyRates/src/stdafx.h b/plugins/CurrencyRates/src/stdafx.h
index a3c13386fe..9efc929760 100644
--- a/plugins/CurrencyRates/src/stdafx.h
+++ b/plugins/CurrencyRates/src/stdafx.h
@@ -98,7 +98,6 @@ inline tstring currencyrates_a2t(const char* s)
#include "CurrencyRatesProviders.h"
#include "CurrencyRatesProviderBase.h"
#include "CurrencyRatesProviderVisitor.h"
-#include "CurrencyRatesProviderVisitorDbSettings.h"
#include "CurrencyRatesProviderVisitorFormater.h"
#include "CurrencyRatesProviderVisitorTendency.h"
#include "CurrencyRatesProviderVisitorFormatSpecificator.h"
diff --git a/plugins/CurrencyRates/src/version.h b/plugins/CurrencyRates/src/version.h
index 603fea2945..c0cc293fb1 100644
--- a/plugins/CurrencyRates/src/version.h
+++ b/plugins/CurrencyRates/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>