diff options
author | Kirill Volinsky <Mataes2007@gmail.com> | 2018-07-27 10:35:17 +0300 |
---|---|---|
committer | Kirill Volinsky <Mataes2007@gmail.com> | 2018-07-27 10:35:17 +0300 |
commit | 29d414e39c3aa15f4877e597c1cac2d83b199078 (patch) | |
tree | b54b2ce556715727bd21c8e5dd8852b925a7bc10 /plugins | |
parent | 24cc466028da7e224c12babfbfe425a694052be9 (diff) |
CurrencyRates: quotes replaced to currencyrates
Diffstat (limited to 'plugins')
79 files changed, 1457 insertions, 1457 deletions
diff --git a/plugins/CurrencyRates/QuotesChart/QuotesChart.csproj b/plugins/CurrencyRates/CurrencyRatesChart/CurrencyRatesChart.csproj index a502da630a..d58b687ce4 100644 --- a/plugins/CurrencyRates/QuotesChart/QuotesChart.csproj +++ b/plugins/CurrencyRates/CurrencyRatesChart/CurrencyRatesChart.csproj @@ -8,8 +8,8 @@ <ProjectGuid>{C255CA56-D05E-4389-A32E-CA3EBE412684}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>QuotesChart</RootNamespace> - <AssemblyName>QuotesChart</AssemblyName> + <RootNamespace>CurrencyRatesChart</RootNamespace> + <AssemblyName>CurrencyRatesChart</AssemblyName> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <TargetFrameworkProfile /> @@ -19,7 +19,7 @@ <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> + <OutputPath>bin\x32\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -28,7 +28,7 @@ <PlatformTarget>x86</PlatformTarget> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> + <OutputPath>bin\x32\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -39,7 +39,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x64</PlatformTarget> - <CodeAnalysisLogFile>bin\Debug\QuotesChart.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile> + <CodeAnalysisLogFile>bin\Debug\CurrencyRatesChart.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <ErrorReport>prompt</ErrorReport> @@ -53,7 +53,7 @@ <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>x64</PlatformTarget> - <CodeAnalysisLogFile>bin\Release\QuotesChart.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile> + <CodeAnalysisLogFile>bin\Release\CurrencyRatesChart.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <ErrorReport>prompt</ErrorReport> diff --git a/plugins/CurrencyRates/QuotesChart/Form1.Designer.cs b/plugins/CurrencyRates/CurrencyRatesChart/Form1.Designer.cs index 39c45d2e6d..f00dc61cf4 100644 --- a/plugins/CurrencyRates/QuotesChart/Form1.Designer.cs +++ b/plugins/CurrencyRates/CurrencyRatesChart/Form1.Designer.cs @@ -1,6 +1,6 @@ -namespace QuotesChart +namespace CurrencyRatesChart { - partial class FormMirandaQuotesChart + partial class FormMirandaCurrencyRatesChart { /// <summary> /// Required designer variable. @@ -30,30 +30,30 @@ { System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMirandaQuotesChart)); - this.chartQuotes = new System.Windows.Forms.DataVisualization.Charting.Chart(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMirandaCurrencyRatesChart)); + this.chartCurrencyRates = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.label1 = new System.Windows.Forms.Label(); this.dateFrom = new System.Windows.Forms.DateTimePicker(); this.dateTo = new System.Windows.Forms.DateTimePicker(); this.label2 = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.chartQuotes)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.chartCurrencyRates)).BeginInit(); this.SuspendLayout(); // - // chartQuotes + // chartCurrencyRates // - this.chartQuotes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.chartCurrencyRates.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); chartArea1.Name = "ChartArea1"; - this.chartQuotes.ChartAreas.Add(chartArea1); + this.chartCurrencyRates.ChartAreas.Add(chartArea1); legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Bottom; legend1.Name = "Legend1"; - this.chartQuotes.Legends.Add(legend1); - this.chartQuotes.Location = new System.Drawing.Point(2, 45); - this.chartQuotes.Name = "chartQuotes"; - this.chartQuotes.Size = new System.Drawing.Size(423, 433); - this.chartQuotes.TabIndex = 0; - this.chartQuotes.Text = "chart1"; + this.chartCurrencyRates.Legends.Add(legend1); + this.chartCurrencyRates.Location = new System.Drawing.Point(2, 45); + this.chartCurrencyRates.Name = "chartCurrencyRates"; + this.chartCurrencyRates.Size = new System.Drawing.Size(423, 433); + this.chartCurrencyRates.TabIndex = 0; + this.chartCurrencyRates.Text = "chart1"; // // label1 // @@ -91,7 +91,7 @@ this.label2.TabIndex = 3; this.label2.Text = "To"; // - // FormMirandaQuotesChart + // FormMirandaCurrencyRatesChart // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -100,12 +100,12 @@ this.Controls.Add(this.label2); this.Controls.Add(this.dateFrom); this.Controls.Add(this.label1); - this.Controls.Add(this.chartQuotes); + this.Controls.Add(this.chartCurrencyRates); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "FormMirandaQuotesChart"; - this.Text = "Miranda Quotes Chart"; + this.Name = "FormMirandaCurrencyRatesChart"; + this.Text = "Miranda CurrencyRates Chart"; this.Load += new System.EventHandler(this.Form1_Load); - ((System.ComponentModel.ISupportInitialize)(this.chartQuotes)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.chartCurrencyRates)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -113,7 +113,7 @@ #endregion - private System.Windows.Forms.DataVisualization.Charting.Chart chartQuotes; + private System.Windows.Forms.DataVisualization.Charting.Chart chartCurrencyRates; private System.Windows.Forms.Label label1; private System.Windows.Forms.DateTimePicker dateFrom; private System.Windows.Forms.DateTimePicker dateTo; diff --git a/plugins/CurrencyRates/QuotesChart/Form1.cs b/plugins/CurrencyRates/CurrencyRatesChart/Form1.cs index b6295d4b56..d26457e39f 100644 --- a/plugins/CurrencyRates/QuotesChart/Form1.cs +++ b/plugins/CurrencyRates/CurrencyRatesChart/Form1.cs @@ -9,11 +9,11 @@ using System.Windows.Forms; using Microsoft.VisualBasic.FileIO; using System.Runtime.InteropServices; -namespace QuotesChart +namespace CurrencyRatesChart { - public partial class FormMirandaQuotesChart : Form + public partial class FormMirandaCurrencyRatesChart : Form { - public FormMirandaQuotesChart() + public FormMirandaCurrencyRatesChart() { InitializeComponent(); } @@ -33,8 +33,8 @@ namespace QuotesChart { if (dateFrom.Value < dateTo.Value) { - chartQuotes.ChartAreas[0].AxisX.Minimum = dateFrom.Value.ToOADate(); - chartQuotes.Invalidate(); + chartCurrencyRates.ChartAreas[0].AxisX.Minimum = dateFrom.Value.ToOADate(); + chartCurrencyRates.Invalidate(); } } @@ -42,8 +42,8 @@ namespace QuotesChart { if (dateTo.Value > dateFrom.Value) { - chartQuotes.ChartAreas[0].AxisX.Maximum = dateTo.Value.ToOADate(); - chartQuotes.Invalidate(); + chartCurrencyRates.ChartAreas[0].AxisX.Maximum = dateTo.Value.ToOADate(); + chartCurrencyRates.Invalidate(); } } @@ -97,10 +97,10 @@ namespace QuotesChart if (series == null) { - if (chartQuotes.Series.FindByName(name) == null) + if (chartCurrencyRates.Series.FindByName(name) == null) { - chartQuotes.Series.Add(name); - series = chartQuotes.Series[name]; + chartCurrencyRates.Series.Add(name); + series = chartCurrencyRates.Series[name]; series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; } else @@ -141,8 +141,8 @@ namespace QuotesChart if (dateMin.HasValue && dateMax.HasValue) { - chartQuotes.ChartAreas[0].AxisX.Minimum = dateMin.Value.ToOADate(); - chartQuotes.ChartAreas[0].AxisX.Maximum = dateMax.Value.ToOADate(); + chartCurrencyRates.ChartAreas[0].AxisX.Minimum = dateMin.Value.ToOADate(); + chartCurrencyRates.ChartAreas[0].AxisX.Maximum = dateMax.Value.ToOADate(); dateFrom.Value = dateMin.Value; dateTo.Value = dateMax.Value; diff --git a/plugins/CurrencyRates/QuotesChart/Form1.resx b/plugins/CurrencyRates/CurrencyRatesChart/Form1.resx index 3d63dcc355..3d63dcc355 100644 --- a/plugins/CurrencyRates/QuotesChart/Form1.resx +++ b/plugins/CurrencyRates/CurrencyRatesChart/Form1.resx diff --git a/plugins/CurrencyRates/QuotesChart/Program.cs b/plugins/CurrencyRates/CurrencyRatesChart/Program.cs index d2c79f5966..732fd0fc01 100644 --- a/plugins/CurrencyRates/QuotesChart/Program.cs +++ b/plugins/CurrencyRates/CurrencyRatesChart/Program.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -namespace QuotesChart +namespace CurrencyRatesChart { static class Program { @@ -15,7 +15,7 @@ namespace QuotesChart { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new FormMirandaQuotesChart()); + Application.Run(new FormMirandaCurrencyRatesChart()); } } } diff --git a/plugins/CurrencyRates/QuotesChart/Properties/AssemblyInfo.cs b/plugins/CurrencyRates/CurrencyRatesChart/Properties/AssemblyInfo.cs index c90728eff3..765def9d57 100644 --- a/plugins/CurrencyRates/QuotesChart/Properties/AssemblyInfo.cs +++ b/plugins/CurrencyRates/CurrencyRatesChart/Properties/AssemblyInfo.cs @@ -5,8 +5,8 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("QuotesChart")] -[assembly: AssemblyDescription("Chart Application for Miranda Quotes plugin")] +[assembly: AssemblyTitle("CurrencyRatesChart")] +[assembly: AssemblyDescription("Chart Application for Miranda CurrencyRates plugin")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Dioksin")] [assembly: AssemblyProduct("Miranda")] diff --git a/plugins/CurrencyRates/QuotesChart/Properties/Resources.Designer.cs b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Resources.Designer.cs index 0bef6c885c..141d83b862 100644 --- a/plugins/CurrencyRates/QuotesChart/Properties/Resources.Designer.cs +++ b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // </auto-generated> //------------------------------------------------------------------------------ -namespace QuotesChart.Properties { +namespace CurrencyRatesChart.Properties { using System; @@ -39,7 +39,7 @@ namespace QuotesChart.Properties { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("QuotesChart.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CurrencyRatesChart.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/plugins/CurrencyRates/QuotesChart/Properties/Resources.resx b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Resources.resx index af7dbebbac..af7dbebbac 100644 --- a/plugins/CurrencyRates/QuotesChart/Properties/Resources.resx +++ b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Resources.resx diff --git a/plugins/CurrencyRates/QuotesChart/Properties/Settings.Designer.cs b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Settings.Designer.cs index 02c737069d..b34f77d1b3 100644 --- a/plugins/CurrencyRates/QuotesChart/Properties/Settings.Designer.cs +++ b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // </auto-generated> //------------------------------------------------------------------------------ -namespace QuotesChart.Properties { +namespace CurrencyRatesChart.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/plugins/CurrencyRates/QuotesChart/Properties/Settings.settings b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Settings.settings index 39645652af..39645652af 100644 --- a/plugins/CurrencyRates/QuotesChart/Properties/Settings.settings +++ b/plugins/CurrencyRates/CurrencyRatesChart/Properties/Settings.settings diff --git a/plugins/CurrencyRates/QuotesChart/app.config b/plugins/CurrencyRates/CurrencyRatesChart/app.config index e365603337..e365603337 100644 --- a/plugins/CurrencyRates/QuotesChart/app.config +++ b/plugins/CurrencyRates/CurrencyRatesChart/app.config diff --git a/plugins/CurrencyRates/QuotesChart/main.ico b/plugins/CurrencyRates/CurrencyRatesChart/main.ico Binary files differindex da85d1f7c6..da85d1f7c6 100644 --- a/plugins/CurrencyRates/QuotesChart/main.ico +++ b/plugins/CurrencyRates/CurrencyRatesChart/main.ico diff --git a/plugins/CurrencyRates/QuotesChart/bin/x32/QuotesChart.exe b/plugins/CurrencyRates/QuotesChart/bin/x32/QuotesChart.exe Binary files differdeleted file mode 100644 index 5a96cbbcfb..0000000000 --- a/plugins/CurrencyRates/QuotesChart/bin/x32/QuotesChart.exe +++ /dev/null diff --git a/plugins/CurrencyRates/QuotesChart/bin/x64/QuotesChart.exe b/plugins/CurrencyRates/QuotesChart/bin/x64/QuotesChart.exe Binary files differdeleted file mode 100644 index d85e08c0f1..0000000000 --- a/plugins/CurrencyRates/QuotesChart/bin/x64/QuotesChart.exe +++ /dev/null diff --git a/plugins/CurrencyRates/docs/Utility/cc.xml b/plugins/CurrencyRates/docs/Utility/cc.xml index 874d03e457..232d7d6488 100644 --- a/plugins/CurrencyRates/docs/Utility/cc.xml +++ b/plugins/CurrencyRates/docs/Utility/cc.xml @@ -7,512 +7,512 @@ <section> <name>Currencies</name> - <quote> + <currencyrate> <id>AED</id><symbol>AED</symbol><description>United Arab Emirates Dirham (AED)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>AFN</id><symbol>AFN</symbol><description>Afghan Afghani (AFN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ALL</id><symbol>ALL</symbol><description>Albanian Lek (ALL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>AMD</id><symbol>AMD</symbol><description>Armenian Dram (AMD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ANG</id><symbol>ANG</symbol><description>Netherlands Antillean Gulden (ANG)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>AOA</id><symbol>AOA</symbol><description>Angolan Kwanza (AOA)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ARS</id><symbol>ARS</symbol><description>Argentine Peso (ARS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>AUD</id><symbol>AUD</symbol><description>Australian Dollar (AUD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>AWG</id><symbol>AWG</symbol><description>Aruban Florin (AWG)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>AZN</id><symbol>AZN</symbol><description>Azerbaijani Manat (AZN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BAM</id><symbol>BAM</symbol><description>Bosnia-Herzegovina Convertible Mark (BAM)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BBD</id><symbol>BBD</symbol><description>Barbadian Dollar (BBD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BDT</id><symbol>BDT</symbol><description>Bangladeshi Taka (BDT)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BGN</id><symbol>BGN</symbol><description>Bulgarian Lev (BGN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BHD</id><symbol>BHD</symbol><description>Bahraini Dinar (BHD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BIF</id><symbol>BIF</symbol><description>Burundian Franc (BIF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BMD</id><symbol>BMD</symbol><description>Bermudan Dollar (BMD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BND</id><symbol>BND</symbol><description>Brunei Dollar (BND)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BOB</id><symbol>BOB</symbol><description>Bolivian Boliviano (BOB)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BRL</id><symbol>BRL</symbol><description>Brazilian Real (BRL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BSD</id><symbol>BSD</symbol><description>Bahamian Dollar (BSD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BTC</id><symbol>BTC</symbol><description>Bitcoin (BTC)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BTN</id><symbol>BTN</symbol><description>Bhutanese Ngultrum (BTN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BWP</id><symbol>BWP</symbol><description>Botswana Pula (BWP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BYN</id><symbol>BYN</symbol><description>Belarusian Ruble (BYN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BYR</id><symbol>BYR</symbol><description>Belarusian Ruble (2000–2016) (BYR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>BZD</id><symbol>BZD</symbol><description>Belize Dollar (BZD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CAD</id><symbol>CAD</symbol><description>Canadian Dollar (CAD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CDF</id><symbol>CDF</symbol><description>Congolese Franc (CDF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CHF</id><symbol>CHF</symbol><description>Swiss Franc (CHF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CLF</id><symbol>CLF</symbol><description>Chilean Unit of Account (UF) (CLF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CLP</id><symbol>CLP</symbol><description>Chilean Peso (CLP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CNH</id><symbol>CNH</symbol><description>CNH (CNH)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CNY</id><symbol>CNY</symbol><description>Chinese Yuan (CNY)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>COP</id><symbol>COP</symbol><description>Colombian Peso (COP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CRC</id><symbol>CRC</symbol><description>Costa Rican Colón (CRC)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CUP</id><symbol>CUP</symbol><description>Cuban Peso (CUP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CVE</id><symbol>CVE</symbol><description>Cape Verdean Escudo (CVE)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>CZK</id><symbol>CZK</symbol><description>Czech Koruna (CZK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>DEM</id><symbol>DEM</symbol><description>German Mark (DEM)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>DJF</id><symbol>DJF</symbol><description>Djiboutian Franc (DJF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>DKK</id><symbol>DKK</symbol><description>Danish Krone (DKK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>DOP</id><symbol>DOP</symbol><description>Dominican Peso (DOP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>DZD</id><symbol>DZD</symbol><description>Algerian Dinar (DZD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>EGP</id><symbol>EGP</symbol><description>Egyptian Pound (EGP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ERN</id><symbol>ERN</symbol><description>Eritrean Nakfa (ERN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ETB</id><symbol>ETB</symbol><description>Ethiopian Birr (ETB)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>EUR</id><symbol>EUR</symbol><description>Euro (EUR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>FIM</id><symbol>FIM</symbol><description>Finnish Markka (FIM)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>FJD</id><symbol>FJD</symbol><description>Fijian Dollar (FJD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>FKP</id><symbol>FKP</symbol><description>Falkland Islands Pound (FKP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>FRF</id><symbol>FRF</symbol><description>French Franc (FRF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GBP</id><symbol>GBP</symbol><description>British Pound (GBP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GEL</id><symbol>GEL</symbol><description>Georgian Lari (GEL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GHS</id><symbol>GHS</symbol><description>Ghanaian Cedi (GHS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GIP</id><symbol>GIP</symbol><description>Gibraltar Pound (GIP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GMD</id><symbol>GMD</symbol><description>Gambian Dalasi (GMD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GNF</id><symbol>GNF</symbol><description>Guinean Franc (GNF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GTQ</id><symbol>GTQ</symbol><description>Guatemalan Quetzal (GTQ)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>GYD</id><symbol>GYD</symbol><description>Guyanaese Dollar (GYD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>HKD</id><symbol>HKD</symbol><description>Hong Kong Dollar (HKD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>HNL</id><symbol>HNL</symbol><description>Honduran Lempira (HNL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>HRK</id><symbol>HRK</symbol><description>Croatian Kuna (HRK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>HTG</id><symbol>HTG</symbol><description>Haitian Gourde (HTG)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>HUF</id><symbol>HUF</symbol><description>Hungarian Forint (HUF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>IDR</id><symbol>IDR</symbol><description>Indonesian Rupiah (IDR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>IEP</id><symbol>IEP</symbol><description>Irish Pound (IEP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ILS</id><symbol>ILS</symbol><description>Israeli New Shekel (ILS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>INR</id><symbol>INR</symbol><description>Indian Rupee (INR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>IQD</id><symbol>IQD</symbol><description>Iraqi Dinar (IQD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>IRR</id><symbol>IRR</symbol><description>Iranian Rial (IRR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ISK</id><symbol>ISK</symbol><description>Icelandic Króna (ISK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ITL</id><symbol>ITL</symbol><description>Italian Lira (ITL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>JMD</id><symbol>JMD</symbol><description>Jamaican Dollar (JMD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>JOD</id><symbol>JOD</symbol><description>Jordanian Dinar (JOD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>JPY</id><symbol>JPY</symbol><description>Japanese Yen (JPY)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KES</id><symbol>KES</symbol><description>Kenyan Shilling (KES)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KGS</id><symbol>KGS</symbol><description>Kyrgystani Som (KGS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KHR</id><symbol>KHR</symbol><description>Cambodian Riel (KHR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KMF</id><symbol>KMF</symbol><description>Comorian Franc (KMF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KPW</id><symbol>KPW</symbol><description>North Korean Won (KPW)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KRW</id><symbol>KRW</symbol><description>South Korean Won (KRW)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KWD</id><symbol>KWD</symbol><description>Kuwaiti Dinar (KWD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KYD</id><symbol>KYD</symbol><description>Cayman Islands Dollar (KYD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>KZT</id><symbol>KZT</symbol><description>Kazakhstani Tenge (KZT)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LAK</id><symbol>LAK</symbol><description>Laotian Kip (LAK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LBP</id><symbol>LBP</symbol><description>Lebanese Pound (LBP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LKR</id><symbol>LKR</symbol><description>Sri Lankan Rupee (LKR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LRD</id><symbol>LRD</symbol><description>Liberian Dollar (LRD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LSL</id><symbol>LSL</symbol><description>Lesotho Loti (LSL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LTL</id><symbol>LTL</symbol><description>Lithuanian Litas (LTL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LVL</id><symbol>LVL</symbol><description>Latvian Lats (LVL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>LYD</id><symbol>LYD</symbol><description>Libyan Dinar (LYD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MAD</id><symbol>MAD</symbol><description>Moroccan Dirham (MAD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MDL</id><symbol>MDL</symbol><description>Moldovan Leu (MDL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MGA</id><symbol>MGA</symbol><description>Malagasy Ariary (MGA)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MKD</id><symbol>MKD</symbol><description>Macedonian Denar (MKD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MNT</id><symbol>MNT</symbol><description>Mongolian Tugrik (MNT)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MOP</id><symbol>MOP</symbol><description>Macanese Pataca (MOP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MRO</id><symbol>MRO</symbol><description>Mauritanian Ouguiya (MRO)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MUR</id><symbol>MUR</symbol><description>Mauritian Rupee (MUR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MVR</id><symbol>MVR</symbol><description>Maldivian Rufiyaa (MVR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MWK</id><symbol>MWK</symbol><description>Malawian Kwacha (MWK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MXN</id><symbol>MXN</symbol><description>Mexican Peso (MXN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MYR</id><symbol>MYR</symbol><description>Malaysian Ringgit (MYR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>MZN</id><symbol>MZN</symbol><description>Mozambican Metical (MZN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>NAD</id><symbol>NAD</symbol><description>Namibian Dollar (NAD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>NGN</id><symbol>NGN</symbol><description>Nigerian Naira (NGN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>NIO</id><symbol>NIO</symbol><description>Nicaraguan Córdoba (NIO)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>NOK</id><symbol>NOK</symbol><description>Norwegian Krone (NOK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>NPR</id><symbol>NPR</symbol><description>Nepalese Rupee (NPR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>NZD</id><symbol>NZD</symbol><description>New Zealand Dollar (NZD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>OMR</id><symbol>OMR</symbol><description>Omani Rial (OMR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PAB</id><symbol>PAB</symbol><description>Panamanian Balboa (PAB)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PEN</id><symbol>PEN</symbol><description>Peruvian Nuevo Sol (PEN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PGK</id><symbol>PGK</symbol><description>Papua New Guinean Kina (PGK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PHP</id><symbol>PHP</symbol><description>Philippine Peso (PHP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PKG</id><symbol>PKG</symbol><description>PKG (PKG)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PKR</id><symbol>PKR</symbol><description>Pakistani Rupee (PKR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PLN</id><symbol>PLN</symbol><description>Polish Zloty (PLN)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>PYG</id><symbol>PYG</symbol><description>Paraguayan Guarani (PYG)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>QAR</id><symbol>QAR</symbol><description>Qatari Riyal (QAR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>RON</id><symbol>RON</symbol><description>New Romanian Leu (RON)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>RSD</id><symbol>RSD</symbol><description>Serbian Dinar (RSD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>RUB</id><symbol>RUB</symbol><description>Russian Ruble (RUB)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>RWF</id><symbol>RWF</symbol><description>Rwandan Franc (RWF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SAR</id><symbol>SAR</symbol><description>Saudi Riyal (SAR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SBD</id><symbol>SBD</symbol><description>Solomon Islands Dollar (SBD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SCR</id><symbol>SCR</symbol><description>Seychellois Rupee (SCR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SDG</id><symbol>SDG</symbol><description>Sudanese Pound (SDG)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SEK</id><symbol>SEK</symbol><description>Swedish Krona (SEK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SGD</id><symbol>SGD</symbol><description>Singapore Dollar (SGD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SHP</id><symbol>SHP</symbol><description>St. Helena Pound (SHP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SKK</id><symbol>SKK</symbol><description>Slovak Koruna (SKK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SLL</id><symbol>SLL</symbol><description>Sierra Leonean Leone (SLL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SOS</id><symbol>SOS</symbol><description>Somali Shilling (SOS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SRD</id><symbol>SRD</symbol><description>Surinamese Dollar (SRD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>STD</id><symbol>STD</symbol><description>São Tomé and Príncipe Dobra (STD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SVC</id><symbol>SVC</symbol><description>Salvadoran Colón (SVC)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SYP</id><symbol>SYP</symbol><description>Syrian Pound (SYP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>SZL</id><symbol>SZL</symbol><description>Swazi Lilangeni (SZL)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>THB</id><symbol>THB</symbol><description>Thai Baht (THB)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TJS</id><symbol>TJS</symbol><description>Tajikistani Somoni (TJS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TMT</id><symbol>TMT</symbol><description>Turkmenistani Manat (TMT)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TND</id><symbol>TND</symbol><description>Tunisian Dinar (TND)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TOP</id><symbol>TOP</symbol><description>Tongan Paʻanga (TOP)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TRY</id><symbol>TRY</symbol><description>Turkish Lira (TRY)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TTD</id><symbol>TTD</symbol><description>Trinidad and Tobago Dollar (TTD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TWD</id><symbol>TWD</symbol><description>New Taiwan Dollar (TWD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>TZS</id><symbol>TZS</symbol><description>Tanzanian Shilling (TZS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>UAH</id><symbol>UAH</symbol><description>Ukrainian Hryvnia (UAH)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>UGX</id><symbol>UGX</symbol><description>Ugandan Shilling (UGX)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>USD</id><symbol>USD</symbol><description>United States Dollar (USD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>UYU</id><symbol>UYU</symbol><description>Uruguayan Peso (UYU)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>UZS</id><symbol>UZS</symbol><description>Uzbekistani Som (UZS)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>VEF</id><symbol>VEF</symbol><description>Venezuelan Bolívar (VEF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>VND</id><symbol>VND</symbol><description>Vietnamese Dong (VND)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>VUV</id><symbol>VUV</symbol><description>Vanuatu Vatu (VUV)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>WST</id><symbol>WST</symbol><description>Samoan Tala (WST)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>XAF</id><symbol>XAF</symbol><description>Central African CFA Franc (FCFA)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>XCD</id><symbol>XCD</symbol><description>East Caribbean Dollar (XCD)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>XDR</id><symbol>XDR</symbol><description>Special Drawing Rights (XDR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>XOF</id><symbol>XOF</symbol><description>West African CFA Franc (CFA)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>XPF</id><symbol>XPF</symbol><description>CFP Franc (CFPF)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>YER</id><symbol>YER</symbol><description>Yemeni Rial (YER)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ZAR</id><symbol>ZAR</symbol><description>South African Rand (ZAR)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ZMK</id><symbol>ZMK</symbol><description>Zambian Kwacha (1968–2012) (ZMK)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ZMW</id><symbol>ZMW</symbol><description>Zambian Kwacha (ZMW)</description> - </quote> - <quote> + </currencyrate> + <currencyrate> <id>ZWL</id><symbol>ZWL</symbol><description>Zimbabwean Dollar (2009) (ZWL)</description> - </quote> + </currencyrate> </section> </Provider>
\ No newline at end of file diff --git a/plugins/CurrencyRates/proto_CurrencyRates/res/proto_CurrencyRates.rc b/plugins/CurrencyRates/proto_CurrencyRates/res/proto_CurrencyRates.rc index f85d1993b2..16b7546399 100644 --- a/plugins/CurrencyRates/proto_CurrencyRates/res/proto_CurrencyRates.rc +++ b/plugins/CurrencyRates/proto_CurrencyRates/res/proto_CurrencyRates.rc @@ -90,7 +90,7 @@ BEGIN VALUE "CompanyName", "Dioksin" VALUE "FileDescription", "CurrencyRates protocol icons" VALUE "FileVersion", "0, 0, 0, 1" - VALUE "InternalName", "proto_Quotes" + VALUE "InternalName", "proto_CurrencyRates" VALUE "LegalCopyright", "Do not worry!" VALUE "OriginalFilename", "proto_CurrencyRates.dll" VALUE "ProductName", "Miranda NG" diff --git a/plugins/CurrencyRates/res/Export quotes.ico b/plugins/CurrencyRates/res/Export currencyrates.ico Binary files differindex 31c7aa2ba1..31c7aa2ba1 100644 --- a/plugins/CurrencyRates/res/Export quotes.ico +++ b/plugins/CurrencyRates/res/Export currencyrates.ico diff --git a/plugins/CurrencyRates/res/Forex.rc b/plugins/CurrencyRates/res/Forex.rc index 088587b982..05b0d2732c 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_QUOTE ICON "quote.ico" +IDI_ICON_CURRENCYRATE ICON "currencyrate.ico" IDI_ICON_UP ICON "up.ico" @@ -40,11 +40,11 @@ IDI_ICON_CURRENCY_CONVERTER ICON "CurrencyConverter.ico" IDI_ICON_REFRESH ICON "Refresh.ico" -IDI_ICON_EXPORT ICON "Export quotes.ico" +IDI_ICON_EXPORT ICON "Export currencyrates.ico" IDI_ICON_SWAP ICON "swap.ico" -IDI_ICON_IMPORT ICON "Import quotes.ico" +IDI_ICON_IMPORT ICON "Import currencyrates.ico" IDI_ICON_NOTCHANGED ICON "notchanged.ico" @@ -111,7 +111,7 @@ BEGIN LTEXT "&Select File:",IDC_STATIC_SELECT_FILE,50,113,49,8 EDITTEXT IDC_EDIT_FILE_NAME,101,111,137,12,ES_AUTOHSCROLL PUSHBUTTON "&Browse...",IDC_BUTTON_BROWSE,241,111,65,12 - LTEXT "Variables Allowed: %miranda_userdata%,%quotename%",IDC_STATIC,50,126,257,8,WS_DISABLED + LTEXT "Variables Allowed: %miranda_userdata%,%currencyratename%",IDC_STATIC,50,126,257,8,WS_DISABLED LTEXT "F&ormat:",IDC_STATIC_LOG_FILE_FORMAT,50,142,47,8 EDITTEXT IDC_EDIT_LOG_FILE_FORMAT,101,140,137,12,ES_AUTOHSCROLL PUSHBUTTON "V&ariables...",IDC_BUTTON_LOG_FILE_DESCRIPTION,241,140,65,12 @@ -165,7 +165,7 @@ BEGIN LTEXT "&Select File:",IDC_STATIC_SELECT_FILE,30,101,49,8 EDITTEXT IDC_EDIT_FILE_NAME,81,99,137,12,ES_AUTOHSCROLL PUSHBUTTON "&Browse...",IDC_BUTTON_BROWSE,221,99,65,12 - LTEXT "Variables Allowed: %miranda_userdata%,%quotename%",IDC_STATIC,30,115,257,8,WS_DISABLED + LTEXT "Variables Allowed: %miranda_userdata%,%currencyratename%",IDC_STATIC,30,115,257,8,WS_DISABLED LTEXT "F&ormat:",IDC_STATIC_LOG_FILE_FORMAT,30,131,47,8 EDITTEXT IDC_EDIT_LOG_FILE_FORMAT,81,129,137,12,ES_AUTOHSCROLL PUSHBUTTON "V&ariables...",IDC_BUTTON_LOG_FILE_DESCRIPTION,221,129,65,12 @@ -208,11 +208,11 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,167,139,50,14 END -IDD_DIALOG_QUOTE_INFO DIALOGEX 0, 0, 222, 132 +IDD_DIALOG_CURRENCYRATE_INFO DIALOGEX 0, 0, 222, 132 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CTEXT "",IDC_STATIC_QUOTE_NAME,7,7,208,8 + CTEXT "",IDC_STATIC_CURRENCYRATE_NAME,7,7,208,8 CONTROL "",IDC_SYSLINK_PROVIDER,"SysLink",WS_TABSTOP,7,110,208,14 LTEXT "Current Rate:",IDC_STATIC,21,62,72,8 EDITTEXT IDC_EDIT_RATE,97,60,61,12,ES_AUTOHSCROLL | ES_READONLY @@ -249,12 +249,12 @@ BEGIN PUSHBUTTON "&Advanced Settings...",IDC_BUTTON_ADVANCED_SETTINGS,102,211,110,14 END -IDD_DIALOG_QUOTE_INFO_1 DIALOGEX 0, 0, 222, 143 +IDD_DIALOG_CURRENCYRATE_INFO_1 DIALOGEX 0, 0, 222, 143 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Quote\\Rate Info" +CAPTION "CurrencyRate\\Rate Info" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CTEXT "",IDC_STATIC_QUOTE_NAME,7,7,208,8 + CTEXT "",IDC_STATIC_CURRENCYRATE_NAME,7,7,208,8 CONTROL "",IDC_SYSLINK_PROVIDER,"SysLink",WS_TABSTOP,7,98,208,14 LTEXT "Current Rate:",IDC_STATIC,15,57,81,8 EDITTEXT IDC_EDIT_RATE,108,55,61,12,ES_AUTOHSCROLL | ES_READONLY @@ -314,7 +314,7 @@ BEGIN BOTTOMMARGIN, 153 END - IDD_DIALOG_QUOTE_INFO, DIALOG + IDD_DIALOG_CURRENCYRATE_INFO, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 215 @@ -331,7 +331,7 @@ BEGIN BOTTOMMARGIN, 225 END - IDD_DIALOG_QUOTE_INFO_1, DIALOG + IDD_DIALOG_CURRENCYRATE_INFO_1, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 215 diff --git a/plugins/CurrencyRates/res/Import quotes.ico b/plugins/CurrencyRates/res/Import currencyrates.ico Binary files differindex 506aa62af3..506aa62af3 100644 --- a/plugins/CurrencyRates/res/Import quotes.ico +++ b/plugins/CurrencyRates/res/Import currencyrates.ico diff --git a/plugins/CurrencyRates/res/quote.ico b/plugins/CurrencyRates/res/currencyrate.ico Binary files differindex 1367c475d6..1367c475d6 100644 --- a/plugins/CurrencyRates/res/quote.ico +++ b/plugins/CurrencyRates/res/currencyrate.ico diff --git a/plugins/CurrencyRates/src/ComHelper.cpp b/plugins/CurrencyRates/src/ComHelper.cpp index 9c77e6d7ad..c4715892b5 100644 --- a/plugins/CurrencyRates/src/ComHelper.cpp +++ b/plugins/CurrencyRates/src/ComHelper.cpp @@ -24,5 +24,5 @@ void ShowComError(_com_error& e, const tstring& rsAdditionalInfo) { tstring sErrorMsg = ComException2Msg(e, rsAdditionalInfo); LogIt(sErrorMsg); - Quotes_MessageBox(nullptr, sErrorMsg.c_str(), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(nullptr, sErrorMsg.c_str(), MB_OK | MB_ICONERROR); } diff --git a/plugins/CurrencyRates/src/CommonOptionDlg.cpp b/plugins/CurrencyRates/src/CommonOptionDlg.cpp index 0fdd483abb..2878f2a91f 100644 --- a/plugins/CurrencyRates/src/CommonOptionDlg.cpp +++ b/plugins/CurrencyRates/src/CommonOptionDlg.cpp @@ -1,11 +1,11 @@ #include "StdAfx.h" typedef boost::shared_ptr<CAdvProviderSettings> TAdvSettingsPtr; -typedef std::map<const IQuotesProvider*, TAdvSettingsPtr> TAdvSettings; +typedef std::map<const ICurrencyRatesProvider*, TAdvSettingsPtr> TAdvSettings; TAdvSettings g_aAdvSettings; -CAdvProviderSettings* get_adv_settings(const IQuotesProvider* pProvider, bool bCreateIfNonExist) +CAdvProviderSettings* get_adv_settings(const ICurrencyRatesProvider* pProvider, bool bCreateIfNonExist) { TAdvSettings::iterator i = g_aAdvSettings.find(pProvider); if (i != g_aAdvSettings.end()) @@ -20,7 +20,7 @@ CAdvProviderSettings* get_adv_settings(const IQuotesProvider* pProvider, bool bC return nullptr; } -void remove_adv_settings(const IQuotesProvider *pProvider) +void remove_adv_settings(const ICurrencyRatesProvider *pProvider) { TAdvSettings::iterator i = g_aAdvSettings.find(pProvider); if (i != g_aAdvSettings.end()) @@ -32,10 +32,10 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr switch (msg) { case WM_INITDIALOG: { - assert(rData.m_pQuotesProvider); + assert(rData.m_pCurrencyRatesProvider); - CQuotesProviderVisitorDbSettings visitor; - rData.m_pQuotesProvider->Accept(visitor); + CCurrencyRatesProviderVisitorDbSettings visitor; + rData.m_pCurrencyRatesProvider->Accept(visitor); assert(visitor.m_pszDbRefreshRateType); assert(visitor.m_pszDbRefreshRateValue); assert(visitor.m_pszDbDisplayNameFormat); @@ -43,15 +43,15 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr assert(visitor.m_pszDbTendencyFormat); // set contact list display format - tstring sDspNameFrmt = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat); + tstring sDspNameFrmt = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat); ::SetDlgItemText(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT, sDspNameFrmt.c_str()); // set status message display format - tstring sStatusMsgFrmt = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat); + tstring sStatusMsgFrmt = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat); ::SetDlgItemText(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT, sStatusMsgFrmt.c_str()); // set tendency format - tstring sTendencyFrmt = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat); + tstring sTendencyFrmt = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat); ::SetDlgItemText(hWnd, IDC_EDIT_TENDENCY_FORMAT, sTendencyFrmt.c_str()); // refresh rate @@ -60,11 +60,11 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr for (int i = 0; i < _countof(pszRefreshRateTypes); ++i) ::SendMessage(hwndCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRefreshRateTypes[i])); - int nRefreshRateType = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); + int nRefreshRateType = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS) nRefreshRateType = RRT_MINUTES; - UINT nRate = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); + UINT nRate = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); switch (nRefreshRateType) { default: case RRT_SECONDS: @@ -128,10 +128,10 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr case BN_CLICKED: switch (LOWORD(wp)) { case IDC_BUTTON_DESCRIPTION: - show_variable_list(hWnd, rData.m_pQuotesProvider); + show_variable_list(hWnd, rData.m_pCurrencyRatesProvider); break; case IDC_BUTTON_ADVANCED_SETTINGS: - CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider, true); + CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pCurrencyRatesProvider, true); assert(pAdvSet); if (true == ShowSettingsDlg(hWnd, pAdvSet)) PropSheet_Changed(::GetParent(hWnd), hWnd); @@ -156,14 +156,14 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr case RRT_SECONDS: if (FALSE == bOk || nRefreshRate < 1 || nRefreshRate > 60) { prepare_edit_ctrl_for_error(::GetDlgItem(hWnd, IDC_EDIT_REFRESH_RATE)); - Quotes_MessageBox(hWnd, TranslateT("Enter integer value between 1 and 60."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter integer value between 1 and 60."), MB_OK | MB_ICONERROR); bOk = FALSE; } break; case RRT_HOURS: if (FALSE == bOk || nRefreshRate < 1 || nRefreshRate > 24) { prepare_edit_ctrl_for_error(::GetDlgItem(hWnd, IDC_EDIT_REFRESH_RATE)); - Quotes_MessageBox(hWnd, TranslateT("Enter integer value between 1 and 24."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter integer value between 1 and 24."), MB_OK | MB_ICONERROR); bOk = FALSE; } break; @@ -176,7 +176,7 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr tstring s = get_window_text(hEdit); if (true == s.empty()) { prepare_edit_ctrl_for_error(hEdit); - Quotes_MessageBox(hWnd, TranslateT("Enter text to display in contact list."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter text to display in contact list."), MB_OK | MB_ICONERROR); bOk = FALSE; } } @@ -191,29 +191,29 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr assert(TRUE == bOk); ERefreshRateType nType = static_cast<ERefreshRateType>(::SendDlgItemMessage(hWnd, IDC_COMBO_REFRESH_RATE, CB_GETCURSEL, 0, 0)); - assert(rData.m_pQuotesProvider); + assert(rData.m_pCurrencyRatesProvider); - CQuotesProviderVisitorDbSettings visitor; - rData.m_pQuotesProvider->Accept(visitor); + 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(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateType, nType); - db_set_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, nRefreshRate); + db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, nType); + db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, nRefreshRate); tstring s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT)); - db_set_ws(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, s.c_str()); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, s.c_str()); s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT)); - db_set_ws(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, s.c_str()); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, s.c_str()); s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_TENDENCY_FORMAT)); - db_set_ws(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbTendencyFormat, s.c_str()); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, s.c_str()); - CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pQuotesProvider, false); + CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pCurrencyRatesProvider, false); if (pAdvSet) pAdvSet->SaveToDb(); break; @@ -222,7 +222,7 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr break; case WM_DESTROY: - remove_adv_settings(rData.m_pQuotesProvider); + remove_adv_settings(rData.m_pCurrencyRatesProvider); break; } } diff --git a/plugins/CurrencyRates/src/CommonOptionDlg.h b/plugins/CurrencyRates/src/CommonOptionDlg.h index 5e39582da0..bc4ca8c456 100644 --- a/plugins/CurrencyRates/src/CommonOptionDlg.h +++ b/plugins/CurrencyRates/src/CommonOptionDlg.h @@ -1,14 +1,14 @@ #ifndef __c85fe710_f71b_4a58_9d44_3e39f6209c5f_CommonOptionDlg_h__ #define __c85fe710_f71b_4a58_9d44_3e39f6209c5f_CommonOptionDlg_h__ -class CQuotesProviderBase; +class CCurrencyRatesProviderBase; struct CCommonDlgProcData { - CCommonDlgProcData(const CQuotesProviderBase* pQuotesProvider) - : m_pQuotesProvider(pQuotesProvider), m_bFireSetingsChangedEvent(false){} + CCommonDlgProcData(const CCurrencyRatesProviderBase* pCurrencyRatesProvider) + : m_pCurrencyRatesProvider(pCurrencyRatesProvider), m_bFireSetingsChangedEvent(false){} - const CQuotesProviderBase* m_pQuotesProvider; + const CCurrencyRatesProviderBase* m_pCurrencyRatesProvider; bool m_bFireSetingsChangedEvent; }; diff --git a/plugins/CurrencyRates/src/CreateFilePath.cpp b/plugins/CurrencyRates/src/CreateFilePath.cpp index 449d8b7ae7..18a8896e9d 100644 --- a/plugins/CurrencyRates/src/CreateFilePath.cpp +++ b/plugins/CurrencyRates/src/CreateFilePath.cpp @@ -28,6 +28,6 @@ tstring CreateFilePath(const tstring& rsName) tstring s(rsName); prepare_name(s); tostringstream o; - o << szPath << L"\\Quotes\\" << s; + o << szPath << L"\\CurrencyRates\\" << s; return o.str(); }
\ No newline at end of file diff --git a/plugins/CurrencyRates/src/CurrencyConverter.cpp b/plugins/CurrencyRates/src/CurrencyConverter.cpp index 6edf7f812b..d71655b014 100644 --- a/plugins/CurrencyRates/src/CurrencyConverter.cpp +++ b/plugins/CurrencyRates/src/CurrencyConverter.cpp @@ -1,19 +1,19 @@ #include "StdAfx.h" -#include "QuotesProviderCurrencyConverter.h" +#include "CurrencyRatesProviderCurrencyConverter.h" #define WINDOW_PREFIX "CurrenyConverter_" -#define DB_STR_CC_QUOTE_FROM_ID "CurrencyConverter_FromID" -#define DB_STR_CC_QUOTE_TO_ID "CurrencyConverter_ToID" +#define DB_STR_CC_CURRENCYRATE_FROM_ID "CurrencyConverter_FromID" +#define DB_STR_CC_CURRENCYRATE_TO_ID "CurrencyConverter_ToID" #define DB_STR_CC_AMOUNT "CurrencyConverter_Amount" -static CQuotesProviderCurrencyConverter* get_currency_converter_provider() +static CCurrencyRatesProviderCurrencyConverter* get_currency_converter_provider() { - CModuleInfo::TQuotesProvidersPtr pProviders = CModuleInfo::GetQuoteProvidersPtr(); - const CQuotesProviders::TQuotesProviders& rapQuotesProviders = pProviders->GetProviders(); - for (CQuotesProviders::TQuotesProviders::const_iterator i = rapQuotesProviders.begin(); i != rapQuotesProviders.end(); ++i) { - const CQuotesProviders::TQuotesProviderPtr& pProvider = *i; - if (auto p = dynamic_cast<CQuotesProviderCurrencyConverter*>(pProvider.get())) + CModuleInfo::TCurrencyRatesProvidersPtr pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); + const CCurrencyRatesProviders::TCurrencyRatesProviders& rapCurrencyRatesProviders = pProviders->GetProviders(); + for (CCurrencyRatesProviders::TCurrencyRatesProviders::const_iterator i = rapCurrencyRatesProviders.begin(); i != rapCurrencyRatesProviders.end(); ++i) { + const CCurrencyRatesProviders::TCurrencyRatesProviderPtr& pProvider = *i; + if (auto p = dynamic_cast<CCurrencyRatesProviderCurrencyConverter*>(pProvider.get())) { return p; } @@ -23,24 +23,24 @@ static CQuotesProviderCurrencyConverter* get_currency_converter_provider() return nullptr; } -CQuotesProviderBase::CQuoteSection get_quotes(const CQuotesProviderCurrencyConverter* pProvider = nullptr) +CCurrencyRatesProviderBase::CCurrencyRateSection get_currencyrates(const CCurrencyRatesProviderCurrencyConverter* pProvider = nullptr) { if (nullptr == pProvider) pProvider = get_currency_converter_provider(); if (pProvider) { - const auto& rQuotes = pProvider->GetQuotes(); - if (rQuotes.GetSectionCount() > 0) - return rQuotes.GetSection(0); + const auto& rCurrencyRates = pProvider->GetCurrencyRates(); + if (rCurrencyRates.GetSectionCount() > 0) + return rCurrencyRates.GetSection(0); } - return CQuotesProviderBase::CQuoteSection(); + return CCurrencyRatesProviderBase::CCurrencyRateSection(); } -inline tstring make_quote_name(const CQuotesProviderBase::CQuote& rQuote) +inline tstring make_currencyrate_name(const CCurrencyRatesProviderBase::CCurrencyRate& rCurrencyRate) { - const tstring& rsDesc = rQuote.GetName(); - return((false == rsDesc.empty()) ? rsDesc : rQuote.GetSymbol()); + const tstring& rsDesc = rCurrencyRate.GetName(); + return((false == rsDesc.empty()) ? rsDesc : rCurrencyRate.GetSymbol()); } inline void update_convert_button(HWND hDlg) @@ -91,49 +91,49 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM assert(hWL); WindowList_Add(hWL, hDlg); - Window_SetIcon_IcoLib(hDlg, Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER)); + Window_SetIcon_IcoLib(hDlg, CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER)); HWND hcbxFrom = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_FROM); HWND hcbxTo = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_INTO); - tstring sFromQuoteID = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_FROM_ID); - tstring sToQuoteID = Quotes_DBGetStringT(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_TO_ID); + tstring sFromCurrencyRateID = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_FROM_ID); + tstring sToCurrencyRateID = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_TO_ID); const auto pProvider = get_currency_converter_provider(); - const auto& rSection = get_quotes(pProvider); - auto cQuotes = rSection.GetQuoteCount(); - for (auto i = 0u; i < cQuotes; ++i) { - const auto& rQuote = rSection.GetQuote(i); - tstring sName = make_quote_name(rQuote); + const auto& rSection = get_currencyrates(pProvider); + auto cCurrencyRates = rSection.GetCurrencyRateCount(); + for (auto i = 0u; i < cCurrencyRates; ++i) { + const auto& rCurrencyRate = rSection.GetCurrencyRate(i); + tstring sName = make_currencyrate_name(rCurrencyRate); LPCTSTR pszName = sName.c_str(); LRESULT nFrom = ::SendMessage(hcbxFrom, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName)); LRESULT nTo = ::SendMessage(hcbxTo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName)); - if (0 == mir_wstrcmpi(rQuote.GetID().c_str(), sFromQuoteID.c_str())) { + if (0 == mir_wstrcmpi(rCurrencyRate.GetID().c_str(), sFromCurrencyRateID.c_str())) { ::SendMessage(hcbxFrom, CB_SETCURSEL, nFrom, 0); } - if (0 == mir_wstrcmpi(rQuote.GetID().c_str(), sToQuoteID.c_str())) { + if (0 == mir_wstrcmpi(rCurrencyRate.GetID().c_str(), sToCurrencyRateID.c_str())) { ::SendMessage(hcbxTo, CB_SETCURSEL, nTo, 0); } } double dAmount = 1.0; - Quotes_DBReadDouble(NULL, QUOTES_MODULE_NAME, DB_STR_CC_AMOUNT, dAmount); + CurrencyRates_DBReadDouble(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_AMOUNT, dAmount); ::SetDlgItemText(hDlg, IDC_EDIT_VALUE, double2str(dAmount).c_str()); - const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo(); + const ICurrencyRatesProvider::CProviderInfo& pi = pProvider->GetInfo(); tostringstream o; o << TranslateT("Info provided by") << L" <a href=\"" << pi.m_sURL << L"\">" << pi.m_sName << L"</a>"; ::SetDlgItemText(hDlg, IDC_SYSLINK_PROVIDER, o.str().c_str()); - ::SendDlgItemMessage(hDlg, IDC_BUTTON_SWAP, BM_SETIMAGE, IMAGE_ICON, LPARAM(Quotes_LoadIconEx(IDI_ICON_SWAP))); + ::SendDlgItemMessage(hDlg, IDC_BUTTON_SWAP, BM_SETIMAGE, IMAGE_ICON, LPARAM(CurrencyRates_LoadIconEx(IDI_ICON_SWAP))); update_convert_button(hDlg); update_swap_button(hDlg); - Utils_RestoreWindowPositionNoSize(hDlg, NULL, QUOTES_PROTOCOL_NAME, WINDOW_PREFIX); + Utils_RestoreWindowPositionNoSize(hDlg, NULL, CURRENCYRATES_MODULE_NAME, WINDOW_PREFIX); ::ShowWindow(hDlg, SW_SHOW); } return TRUE; @@ -143,7 +143,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, false); assert(hWL); WindowList_Remove(hWL, hDlg); - Utils_SaveWindowPosition(hDlg, NULL, QUOTES_PROTOCOL_NAME, WINDOW_PREFIX); + Utils_SaveWindowPosition(hDlg, NULL, CURRENCYRATES_MODULE_NAME, WINDOW_PREFIX); EndDialog(hDlg, 0); } return TRUE; @@ -190,19 +190,19 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM double dAmount = 1.0; if ((true == str2double(sText, dAmount)) && (dAmount > 0.0)) { - Quotes_DBWriteDouble(NULL, QUOTES_MODULE_NAME, DB_STR_CC_AMOUNT, dAmount); + CurrencyRates_DBWriteDouble(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_AMOUNT, dAmount); size_t nFrom = static_cast<size_t>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0)); size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hDlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0)); if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo)) { - const auto& rSection = get_quotes(); - size_t cQuotes = rSection.GetQuoteCount(); - if ((nFrom < cQuotes) && (nTo < cQuotes)) { - auto from = rSection.GetQuote(nFrom); - auto to = rSection.GetQuote(nTo); + const auto& rSection = get_currencyrates(); + size_t cCurrencyRates = rSection.GetCurrencyRateCount(); + if ((nFrom < cCurrencyRates) && (nTo < cCurrencyRates)) { + auto from = rSection.GetCurrencyRate(nFrom); + auto to = rSection.GetCurrencyRate(nTo); - db_set_ws(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_FROM_ID, from.GetID().c_str()); - db_set_ws(NULL, QUOTES_MODULE_NAME, DB_STR_CC_QUOTE_TO_ID, to.GetID().c_str()); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_FROM_ID, from.GetID().c_str()); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_TO_ID, to.GetID().c_str()); const auto pProvider = get_currency_converter_provider(); assert(pProvider); @@ -221,7 +221,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM } if (false == sError.empty()) - sResult = quotes_a2t(sError.c_str());//A2T(sError.c_str()); + sResult = currencyrates_a2t(sError.c_str());//A2T(sError.c_str()); SetDlgItemText(hDlg, IDC_EDIT_RESULT, sResult.c_str()); } @@ -229,7 +229,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM } } else { - Quotes_MessageBox(hDlg, TranslateT("Enter positive number."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hDlg, TranslateT("Enter positive number."), MB_OK | MB_ICONERROR); prepare_edit_ctrl_for_error(GetDlgItem(hDlg, IDC_EDIT_VALUE)); } } @@ -252,7 +252,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM return (FALSE); } -INT_PTR QuotesMenu_CurrencyConverter(WPARAM, LPARAM) +INT_PTR CurrencyRatesMenu_CurrencyConverter(WPARAM, LPARAM) { MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX, true); HWND hWnd = WindowList_Find(hWL, NULL); diff --git a/plugins/CurrencyRates/src/CurrencyConverter.h b/plugins/CurrencyRates/src/CurrencyConverter.h index 57988413fe..eca03ec40e 100644 --- a/plugins/CurrencyRates/src/CurrencyConverter.h +++ b/plugins/CurrencyRates/src/CurrencyConverter.h @@ -1,6 +1,6 @@ #ifndef __4FB6320B_2D02_408b_BAF5_426C185AAA11_CurrencyConverter_h__ #define __4FB6320B_2D02_408b_BAF5_426C185AAA11_CurrencyConverter_h__ -INT_PTR QuotesMenu_CurrencyConverter(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRatesMenu_CurrencyConverter(WPARAM wp, LPARAM lp); #endif //__4FB6320B_2D02_408b_BAF5_426C185AAA11_CurrencyConverter_h__ diff --git a/plugins/CurrencyRates/src/QuoteChart.cpp b/plugins/CurrencyRates/src/CurrencyRateChart.cpp index b1f4ec8f91..a3208811a4 100644 --- a/plugins/CurrencyRates/src/QuoteChart.cpp +++ b/plugins/CurrencyRates/src/CurrencyRateChart.cpp @@ -54,7 +54,7 @@ namespace } -INT_PTR QuotesMenu_Chart(WPARAM wp, LPARAM /*lp*/) +INT_PTR CurrencyRatesMenu_Chart(WPARAM wp, LPARAM /*lp*/) { #ifdef _UNICODE MCONTACT hContact = static_cast<MCONTACT>(wp); @@ -63,7 +63,7 @@ INT_PTR QuotesMenu_Chart(WPARAM wp, LPARAM /*lp*/) auto sLogFileName = GetContactLogFileName(hContact); - if(auto hWnd = ::FindWindow(nullptr,_T("Miranda Quotes Chart"))) + if(auto hWnd = ::FindWindow(nullptr,_T("Miranda CurrencyRates Chart"))) { COPYDATASTRUCT copydata_struct; copydata_struct.cbData = static_cast<DWORD>(sLogFileName.size()*sizeof(TCHAR)); @@ -82,7 +82,7 @@ INT_PTR QuotesMenu_Chart(WPARAM wp, LPARAM /*lp*/) si.wShowWindow = SW_SHOWNORMAL; ZeroMemory(&pi, sizeof(pi)); - auto sCmdLine = CreateFilePath(_T("QuotesChart.exe")); + auto sCmdLine = CreateFilePath(_T("CurrencyRatesChart.exe")); sCmdLine += _T(" \""); sCmdLine += sLogFileName; sCmdLine += _T("\""); diff --git a/plugins/CurrencyRates/src/CurrencyRateChart.h b/plugins/CurrencyRates/src/CurrencyRateChart.h new file mode 100644 index 0000000000..0869c1fa1c --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRateChart.h @@ -0,0 +1,12 @@ +#ifndef __39BE8775_A837_494f_925C_0ABF7910F238_CurrencyRateChart_h__ +#define __39BE8775_A837_494f_925C_0ABF7910F238_CurrencyRateChart_h__ + +#pragma once + +#ifdef CHART_IMPLEMENT + +INT_PTR CurrencyRatesMenu_Chart(WPARAM wp, LPARAM lp); + +#endif + +#endif //__39BE8775_A837_494f_925C_0ABF7910F238_CurrencyRateChart_h__ diff --git a/plugins/CurrencyRates/src/QuoteInfoDlg.cpp b/plugins/CurrencyRates/src/CurrencyRateInfoDlg.cpp index 8f48dd4252..927fa7197d 100644 --- a/plugins/CurrencyRates/src/QuoteInfoDlg.cpp +++ b/plugins/CurrencyRates/src/CurrencyRateInfoDlg.cpp @@ -8,13 +8,13 @@ extern HGENMENU g_hMenuChart; #endif extern HGENMENU g_hMenuRefresh, g_hMenuRoot; -#define WINDOW_PREFIX_INFO "Quote Info" +#define WINDOW_PREFIX_INFO "CurrencyRate Info" MCONTACT g_hContact; inline bool IsMyContact(MCONTACT hContact) { - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(hContact); return (nullptr != pProvider); } @@ -25,11 +25,11 @@ inline MCONTACT get_contact(HWND hWnd) static bool get_fetch_time(time_t& rTime, MCONTACT hContact) { - rTime = db_get_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, -1); + rTime = db_get_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FETCH_TIME, -1); return (rTime != -1); } -INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK CurrencyRateInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: @@ -38,10 +38,10 @@ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WP TranslateDialogDefault(hdlg); { tstring sDescription = GetContactName(hContact); - ::SetDlgItemText(hdlg, IDC_STATIC_QUOTE_NAME, sDescription.c_str()); + ::SetDlgItemText(hdlg, IDC_STATIC_CURRENCYRATE_NAME, sDescription.c_str()); double dRate = 0.0; - if (true == Quotes_DBReadDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_PREV_VALUE, dRate)) { + if (true == CurrencyRates_DBReadDouble(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_PREV_VALUE, dRate)) { tostringstream o; o.imbue(GetSystemLocale()); o << dRate; @@ -50,7 +50,7 @@ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WP } dRate = 0.0; - if (true == Quotes_DBReadDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_CURR_VALUE, dRate)) { + if (true == CurrencyRates_DBReadDouble(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_CURR_VALUE, dRate)) { tostringstream o; o.imbue(GetSystemLocale()); o << dRate; @@ -66,9 +66,9 @@ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WP } } - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(hContact); - const IQuotesProvider::CProviderInfo& pi = pProvider->GetInfo(); + const ICurrencyRatesProvider::CProviderInfo& pi = pProvider->GetInfo(); tostringstream o; o << TranslateT("Info provided by") << L" <a href=\"" << pi.m_sURL << L"\">" << pi.m_sName << L"</a>"; @@ -91,12 +91,12 @@ INT_PTR CALLBACK QuoteInfoDlgProcImpl(MCONTACT hContact, HWND hdlg, UINT msg, WP return FALSE; } -INT_PTR CALLBACK QuoteInfoDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK CurrencyRateInfoDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) { - return QuoteInfoDlgProcImpl(g_hContact, hdlg, msg, wParam, lParam); + return CurrencyRateInfoDlgProcImpl(g_hContact, hdlg, msg, wParam, lParam); } -int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) +int CurrencyRatesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) { MCONTACT hContact = MCONTACT(lp); if (NULL == hContact) @@ -108,16 +108,16 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) g_hContact = hContact; OPTIONSDIALOGPAGE odp = {}; - odp.pfnDlgProc = QuoteInfoDlgProc; + odp.pfnDlgProc = CurrencyRateInfoDlgProc; odp.position = -2000000000; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_QUOTE_INFO); - odp.szTitle.a = LPGEN("Quote"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_CURRENCYRATE_INFO); + odp.szTitle.a = LPGEN("CurrencyRate"); g_plugin.addUserInfo(wp, &odp); return 0; } -INT_PTR QuotesMenu_EditSettings(WPARAM wp, LPARAM) +INT_PTR CurrencyRatesMenu_EditSettings(WPARAM wp, LPARAM) { MCONTACT hContact = MCONTACT(wp); if (NULL != hContact) @@ -134,7 +134,7 @@ namespace } } -INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM) +INT_PTR CurrencyRatesMenu_OpenLogFile(WPARAM wp, LPARAM) { MCONTACT hContact = MCONTACT(wp); if (NULL == hContact) @@ -147,13 +147,13 @@ INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM) return 0; } -INT_PTR QuotesMenu_RefreshContact(WPARAM wp, LPARAM) +INT_PTR CurrencyRatesMenu_RefreshContact(WPARAM wp, LPARAM) { MCONTACT hContact = MCONTACT(wp); if (NULL == hContact) return 0; - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(hContact); if (!pProvider) return 0; @@ -161,7 +161,7 @@ INT_PTR QuotesMenu_RefreshContact(WPARAM wp, LPARAM) return 0; } -static INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK CurrencyRateInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) { MCONTACT hContact = NULL; MWindowList hWL; @@ -174,7 +174,7 @@ static INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LP WindowList_Add(hWL, hdlg, hContact); ::SetWindowLongPtr(hdlg, GWLP_USERDATA, hContact); - Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); + Utils_RestoreWindowPositionNoSize(hdlg, hContact, CURRENCYRATES_MODULE_NAME, WINDOW_PREFIX_INFO); ::ShowWindow(hdlg, SW_SHOW); break; @@ -190,7 +190,7 @@ static INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LP hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, false); assert(hWL); WindowList_Remove(hWL, hdlg); - Utils_SaveWindowPosition(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); + Utils_SaveWindowPosition(hdlg, hContact, CURRENCYRATES_MODULE_NAME, WINDOW_PREFIX_INFO); } return FALSE; @@ -205,13 +205,13 @@ static INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg, UINT msg, WPARAM wParam, LP break; } - return QuoteInfoDlgProcImpl(hContact, hdlg, msg, wParam, lParam); + return CurrencyRateInfoDlgProcImpl(hContact, hdlg, msg, wParam, lParam); } -int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) +int CurrencyRates_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) { MCONTACT hContact = MCONTACT(wp); - if (CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact)) { + if (CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(hContact)) { MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO, true); assert(hWL); HWND hWnd = WindowList_Find(hWL, hContact); @@ -220,7 +220,7 @@ int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) SetFocus(hWnd); } else if (true == IsMyContact(hContact)) - CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), nullptr, QuoteInfoDlgProc1, LPARAM(hContact)); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DIALOG_CURRENCYRATE_INFO_1), nullptr, CurrencyRateInfoDlgProc1, LPARAM(hContact)); return 1; } @@ -228,7 +228,7 @@ int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) return 0; } -int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM) +int CurrencyRates_PrebuildContactMenu(WPARAM wp, LPARAM) { Menu_EnableItem(g_hMenuEditSettings, false); Menu_EnableItem(g_hMenuOpenLogFile, false); @@ -239,7 +239,7 @@ int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM) MCONTACT hContact = MCONTACT(wp); char *szProto = GetContactProto(hContact); - if (mir_strcmp(szProto, QUOTES_MODULE_NAME)) { + if (mir_strcmp(szProto, CURRENCYRATES_PROTOCOL_NAME)) { Menu_ShowItem(g_hMenuRoot, false); return 0; } diff --git a/plugins/CurrencyRates/src/CurrencyRateInfoDlg.h b/plugins/CurrencyRates/src/CurrencyRateInfoDlg.h new file mode 100644 index 0000000000..d0df6e99c5 --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRateInfoDlg.h @@ -0,0 +1,11 @@ +#ifndef __aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_CurrencyRateInfoDlg_h__ +#define __aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_CurrencyRateInfoDlg_h__ + +int CurrencyRatesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRatesMenu_EditSettings(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRatesMenu_OpenLogFile(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRatesMenu_RefreshContact(WPARAM wp, LPARAM lp); +int CurrencyRates_PrebuildContactMenu(WPARAM wp, LPARAM lp); +int CurrencyRates_OnContactDoubleClick(WPARAM wp, LPARAM lp); + +#endif //__aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_CurrencyRateInfoDlg_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderBase.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp index 4d4dc760b5..d05b977394 100644 --- a/plugins/CurrencyRates/src/QuotesProviderBase.cpp +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp @@ -3,11 +3,11 @@ extern bool g_bAutoUpdate; extern HANDLE g_hEventWorkThreadStop; -struct CQuotesProviderBase::CXMLFileInfo +struct CCurrencyRatesProviderBase::CXMLFileInfo { CXMLFileInfo() : m_qs(L"Unknown") {} - IQuotesProvider::CProviderInfo m_pi; - CQuotesProviderBase::CQuoteSection m_qs; + ICurrencyRatesProvider::CProviderInfo m_pi; + CCurrencyRatesProviderBase::CCurrencyRateSection m_qs; tstring m_sURL; }; @@ -16,7 +16,7 @@ inline tstring get_ini_file_name(LPCTSTR pszFileName) return CreateFilePath(pszFileName); } -bool parse_quote(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuote& q) +bool parse_currencyrate(const IXMLNode::TXMLNodePtr& pTop, CCurrencyRatesProviderBase::CCurrencyRate& q) { tstring sSymbol; tstring sDescription; @@ -41,14 +41,14 @@ bool parse_quote(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuote& } } - q = CQuotesProviderBase::CQuote(sID, TranslateW(sSymbol.c_str()), TranslateW(sDescription.c_str())); + q = CCurrencyRatesProviderBase::CCurrencyRate(sID, TranslateW(sSymbol.c_str()), TranslateW(sDescription.c_str())); return true; } -bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuoteSection& qs) +bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CCurrencyRatesProviderBase::CCurrencyRateSection& qs) { - CQuotesProviderBase::CQuoteSection::TSections aSections; - CQuotesProviderBase::CQuoteSection::TQuotes aQuotes; + CCurrencyRatesProviderBase::CCurrencyRateSection::TSections aSections; + CCurrencyRatesProviderBase::CCurrencyRateSection::TCurrencyRates aCurrencyRates; tstring sSectionName; size_t cChild = pTop->GetChildCount(); @@ -56,14 +56,14 @@ bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuot IXMLNode::TXMLNodePtr pNode = pTop->GetChildNode(i); tstring sName = pNode->GetName(); if (0 == mir_wstrcmpi(L"section", sName.c_str())) { - CQuotesProviderBase::CQuoteSection qs1; + CCurrencyRatesProviderBase::CCurrencyRateSection qs1; if (true == parse_section(pNode, qs1)) aSections.push_back(qs1); } - else if (0 == mir_wstrcmpi(L"quote", sName.c_str())) { - CQuotesProviderBase::CQuote q; - if (true == parse_quote(pNode, q)) - aQuotes.push_back(q); + else if (0 == mir_wstrcmpi(L"currencyrate", sName.c_str())) { + CCurrencyRatesProviderBase::CCurrencyRate q; + if (true == parse_currencyrate(pNode, q)) + aCurrencyRates.push_back(q); } else if (0 == mir_wstrcmpi(L"name", sName.c_str())) { sSectionName = pNode->GetText(); @@ -72,7 +72,7 @@ bool parse_section(const IXMLNode::TXMLNodePtr& pTop, CQuotesProviderBase::CQuot } } - qs = CQuotesProviderBase::CQuoteSection(TranslateW(sSectionName.c_str()), aSections, aQuotes); + qs = CCurrencyRatesProviderBase::CCurrencyRateSection(TranslateW(sSectionName.c_str()), aSections, aCurrencyRates); return true; } @@ -96,10 +96,10 @@ IXMLNode::TXMLNodePtr find_provider(const IXMLNode::TXMLNodePtr& pRoot) return pProvider; } -CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool& rbSucceded) +CCurrencyRatesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool& rbSucceded) { - CQuotesProviderBase::CXMLFileInfo res; - CQuotesProviderBase::CQuoteSection::TSections aSections; + CCurrencyRatesProviderBase::CXMLFileInfo res; + CCurrencyRatesProviderBase::CCurrencyRateSection::TSections aSections; const CModuleInfo::TXMLEnginePtr& pXMLEngine = CModuleInfo::GetXMLEnginePtr(); IXMLNode::TXMLNodePtr pRoot = pXMLEngine->LoadFile(rsXMLFile); @@ -112,7 +112,7 @@ CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool& IXMLNode::TXMLNodePtr pNode = pProvider->GetChildNode(i); tstring sName = pNode->GetName(); if (0 == mir_wstrcmpi(L"section", sName.c_str())) { - CQuotesProviderBase::CQuoteSection qs; + CCurrencyRatesProviderBase::CCurrencyRateSection qs; if (true == parse_section(pNode, qs)) aSections.push_back(qs); } @@ -126,35 +126,35 @@ CQuotesProviderBase::CXMLFileInfo parse_ini_file(const tstring& rsXMLFile, bool& } } - res.m_qs = CQuotesProviderBase::CQuoteSection(res.m_pi.m_sName, aSections); + res.m_qs = CCurrencyRatesProviderBase::CCurrencyRateSection(res.m_pi.m_sName, aSections); return res; } -CQuotesProviderBase::CXMLFileInfo init_xml_info(LPCTSTR pszFileName, bool& rbSucceded) +CCurrencyRatesProviderBase::CXMLFileInfo init_xml_info(LPCTSTR pszFileName, bool& rbSucceded) { rbSucceded = false; tstring sIniFile = get_ini_file_name(pszFileName); return parse_ini_file(sIniFile, rbSucceded); } -CQuotesProviderBase::CQuotesProviderBase() +CCurrencyRatesProviderBase::CCurrencyRatesProviderBase() : m_hEventSettingsChanged(::CreateEvent(nullptr, FALSE, FALSE, nullptr)), m_hEventRefreshContact(::CreateEvent(nullptr, FALSE, FALSE, nullptr)), m_bRefreshInProgress(false) { } -CQuotesProviderBase::~CQuotesProviderBase() +CCurrencyRatesProviderBase::~CCurrencyRatesProviderBase() { ::CloseHandle(m_hEventSettingsChanged); ::CloseHandle(m_hEventRefreshContact); } -bool CQuotesProviderBase::Init() +bool CCurrencyRatesProviderBase::Init() { bool bSucceded = m_pXMLInfo != nullptr; if (!m_pXMLInfo) { - CQuotesProviderVisitorDbSettings visitor; + CCurrencyRatesProviderVisitorDbSettings visitor; Accept(visitor); assert(visitor.m_pszXMLIniFileName); @@ -164,11 +164,11 @@ bool CQuotesProviderBase::Init() return bSucceded; } -CQuotesProviderBase::CXMLFileInfo* CQuotesProviderBase::GetXMLFileInfo()const +CCurrencyRatesProviderBase::CXMLFileInfo* CCurrencyRatesProviderBase::GetXMLFileInfo()const { // if(!m_pXMLInfo) // { - // CQuotesProviderVisitorDbSettings visitor; + // CCurrencyRatesProviderVisitorDbSettings visitor; // Accept(visitor); // assert(visitor.m_pszXMLIniFileName); // m_pXMLInfo.reset(new CXMLFileInfo(init_xml_info(visitor.m_pszXMLIniFileName))); @@ -177,27 +177,27 @@ CQuotesProviderBase::CXMLFileInfo* CQuotesProviderBase::GetXMLFileInfo()const return m_pXMLInfo.get(); } -const CQuotesProviderBase::CProviderInfo& CQuotesProviderBase::GetInfo()const +const CCurrencyRatesProviderBase::CProviderInfo& CCurrencyRatesProviderBase::GetInfo()const { return GetXMLFileInfo()->m_pi; } -const CQuotesProviderBase::CQuoteSection& CQuotesProviderBase::GetQuotes()const +const CCurrencyRatesProviderBase::CCurrencyRateSection& CCurrencyRatesProviderBase::GetCurrencyRates()const { return GetXMLFileInfo()->m_qs; } -const tstring& CQuotesProviderBase::GetURL()const +const tstring& CCurrencyRatesProviderBase::GetURL()const { return GetXMLFileInfo()->m_sURL; } -bool CQuotesProviderBase::IsOnline() +bool CCurrencyRatesProviderBase::IsOnline() { return /*g_bAutoUpdate*/true; } -void CQuotesProviderBase::AddContact(MCONTACT hContact) +void CCurrencyRatesProviderBase::AddContact(MCONTACT hContact) { // CCritSection cs(m_cs); assert(m_aContacts.end() == std::find(m_aContacts.begin(), m_aContacts.end(), hContact)); @@ -205,7 +205,7 @@ void CQuotesProviderBase::AddContact(MCONTACT hContact) m_aContacts.push_back(hContact); } -void CQuotesProviderBase::DeleteContact(MCONTACT hContact) +void CCurrencyRatesProviderBase::DeleteContact(MCONTACT hContact) { mir_cslock lck(m_cs); @@ -214,15 +214,15 @@ void CQuotesProviderBase::DeleteContact(MCONTACT hContact) m_aContacts.erase(i); } -void CQuotesProviderBase::SetContactStatus(MCONTACT hContact, int nNewStatus) +void CCurrencyRatesProviderBase::SetContactStatus(MCONTACT hContact, int nNewStatus) { - int nStatus = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_STATUS, ID_STATUS_OFFLINE); + int nStatus = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_STATUS, ID_STATUS_OFFLINE); if (nNewStatus != nStatus) { - db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_STATUS, nNewStatus); + db_set_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_STATUS, nNewStatus); if (ID_STATUS_ONLINE != nNewStatus) { db_unset(hContact, LIST_MODULE_NAME, STATUS_MSG_NAME); - tstring sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL); + tstring sSymbol = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL); if (false == sSymbol.empty()) db_set_ws(hContact, LIST_MODULE_NAME, CONTACT_LIST_NAME, sSymbol.c_str()); @@ -255,7 +255,7 @@ public: public: CTendency() : m_nComparison(NonValid) {} - bool Parse(const IQuotesProvider* pProvider, const tstring& rsFrmt, MCONTACT hContact) + bool Parse(const ICurrencyRatesProvider* pProvider, const tstring& rsFrmt, MCONTACT hContact) { m_abValueFlags[0] = false; m_abValueFlags[1] = false; @@ -277,7 +277,7 @@ public: if (i != rsFrmt.end()) { wchar_t t = *i; ++i; - CQuotesProviderVisitorTendency visitor(hContact, t); + CCurrencyRatesProviderVisitorTendency visitor(hContact, t); pProvider->Accept(visitor); if (false == visitor.IsValid()) { bValid = false; @@ -367,7 +367,7 @@ private: EComparison m_nComparison; }; -tstring format_rate(const IQuotesProvider *pProvider, MCONTACT hContact, const tstring &rsFrmt) +tstring format_rate(const ICurrencyRatesProvider *pProvider, MCONTACT hContact, const tstring &rsFrmt) { tstring sResult; @@ -411,7 +411,7 @@ tstring format_rate(const IQuotesProvider *pProvider, MCONTACT hContact, const t else chr = *i; } - CQuotesProviderVisitorFormater visitor(hContact, chr, nWidth); + CCurrencyRatesProviderVisitorFormater visitor(hContact, chr, nWidth); pProvider->Accept(visitor); const tstring& s = visitor.GetResult(); sResult += s; @@ -425,12 +425,12 @@ tstring format_rate(const IQuotesProvider *pProvider, MCONTACT hContact, const t return sResult; } -void log_to_file(const IQuotesProvider* pProvider, +void log_to_file(const ICurrencyRatesProvider* pProvider, MCONTACT hContact, const tstring& rsLogFileName, const tstring& rsFormat) { - std::string sPath = quotes_t2a(rsLogFileName.c_str()); + std::string sPath = currencyrates_t2a(rsLogFileName.c_str()); std::string::size_type n = sPath.find_last_of("\\/"); if (std::string::npos != n) @@ -448,7 +448,7 @@ void log_to_file(const IQuotesProvider* pProvider, } } -void log_to_history(const IQuotesProvider* pProvider, +void log_to_history(const ICurrencyRatesProvider* pProvider, MCONTACT hContact, time_t nTime, const tstring& rsFormat) @@ -457,7 +457,7 @@ void log_to_history(const IQuotesProvider* pProvider, T2Utf psz(s.c_str()); DBEVENTINFO dbei = {}; - dbei.szModule = QUOTES_PROTOCOL_NAME; + dbei.szModule = CURRENCYRATES_MODULE_NAME; dbei.timestamp = static_cast<DWORD>(nTime); dbei.flags = DBEF_READ | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; @@ -482,7 +482,7 @@ bool do_set_contact_extra_icon(MCONTACT hContact, const CTendency& tendency) return false; } -bool show_popup(const IQuotesProvider* pProvider, +bool show_popup(const ICurrencyRatesProvider* pProvider, MCONTACT hContact, const CTendency& tendency, const tstring& rsFormat, @@ -498,14 +498,14 @@ bool show_popup(const IQuotesProvider* pProvider, if (tendency.IsValid()) { CTendency::EResult nComparison = tendency.Compare(); if (CTendency::NotChanged == nComparison) - ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_NOTCHANGED); + ppd.lchIcon = CurrencyRates_LoadIconEx(IDI_ICON_NOTCHANGED); else if (CTendency::Up == nComparison) - ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_UP); + ppd.lchIcon = CurrencyRates_LoadIconEx(IDI_ICON_UP); else if (CTendency::Down == nComparison) - ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_DOWN); + ppd.lchIcon = CurrencyRates_LoadIconEx(IDI_ICON_DOWN); } - CQuotesProviderVisitorFormater visitor(hContact, 's', 0); + CCurrencyRatesProviderVisitorFormater visitor(hContact, 's', 0); pProvider->Accept(visitor); const tstring& sTitle = visitor.GetResult(); mir_wstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME); @@ -545,20 +545,20 @@ bool show_popup(const IQuotesProvider* pProvider, return (0 == CallService(MS_POPUP_ADDPOPUPT, reinterpret_cast<WPARAM>(&ppd), lp)); } -void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/) +void CCurrencyRatesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/) { time_t nTime = ::time(0); if (false == rsSymbol.empty()) - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsSymbol.c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL, rsSymbol.c_str()); double dPrev = 0.0; - bool bValidPrev = Quotes_DBReadDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_CURR_VALUE, dPrev); + bool bValidPrev = CurrencyRates_DBReadDouble(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_CURR_VALUE, dPrev); if (true == bValidPrev) - Quotes_DBWriteDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_PREV_VALUE, dPrev); + CurrencyRates_DBWriteDouble(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_PREV_VALUE, dPrev); - Quotes_DBWriteDouble(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_CURR_VALUE, dRate); - db_set_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, nTime); + CurrencyRates_DBWriteDouble(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_CURR_VALUE, dRate); + db_set_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FETCH_TIME, nTime); tstring sSymbol = rsSymbol; @@ -570,7 +570,7 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons } else { if (true == sSymbol.empty()) - sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL); + sSymbol = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL); oNick << std::setfill(L' ') << std::setw(10) << std::left << sSymbol << std::setw(6) << std::right << dRate; } @@ -587,37 +587,37 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons else db_unset(hContact, LIST_MODULE_NAME, STATUS_MSG_NAME); - bool bUseContactSpecific = (db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0) > 0); + bool bUseContactSpecific = (db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0) > 0); CAdvProviderSettings global_settings(this); WORD dwMode = (bUseContactSpecific) - ? db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, static_cast<WORD>(lmDisabled)) + ? db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG, static_cast<WORD>(lmDisabled)) : global_settings.GetLogMode(); if (dwMode&lmExternalFile) { bool bAdd = true; bool bOnlyIfChanged = (bUseContactSpecific) - ? (db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE_CONDITION, 1) > 0) + ? (db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE_CONDITION, 1) > 0) : global_settings.GetLogOnlyChangedFlag(); if (true == bOnlyIfChanged) { bAdd = ((false == bValidPrev) || (false == IsWithinAccuracy(dRate, dPrev))); } if (true == bAdd) { tstring sLogFileName = (bUseContactSpecific) - ? Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE, global_settings.GetLogFileName().c_str()) + ? CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE, global_settings.GetLogFileName().c_str()) : global_settings.GetLogFileName(); if (true == sSymbol.empty()) { - sSymbol = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL); + sSymbol = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL); } sLogFileName = GenerateLogFileName(sLogFileName, sSymbol); tstring sFormat = global_settings.GetLogFormat(); if (bUseContactSpecific) { - CQuotesProviderVisitorDbSettings visitor; + CCurrencyRatesProviderVisitorDbSettings visitor; Accept(visitor); - sFormat = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_LOG_FILE, visitor.m_pszDefLogFileFormat); + sFormat = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_LOG_FILE, visitor.m_pszDefLogFileFormat); } log_to_file(this, hContact, sLogFileName, sFormat); @@ -626,7 +626,7 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons if (dwMode&lmInternalHistory) { bool bAdd = true; bool bOnlyIfChanged = (bUseContactSpecific) - ? (db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_HISTORY_CONDITION, 1) > 0) + ? (db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_HISTORY_CONDITION, 1) > 0) : global_settings.GetHistoryOnlyChangedFlag(); if (true == bOnlyIfChanged) { @@ -634,7 +634,7 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons } if (true == bAdd) { tstring sFormat = (bUseContactSpecific) - ? Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_HISTORY, global_settings.GetHistoryFormat().c_str()) + ? CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_HISTORY, global_settings.GetHistoryFormat().c_str()) : global_settings.GetHistoryFormat(); log_to_history(this, hContact, nTime, sFormat); @@ -643,12 +643,12 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons if (dwMode&lmPopup) { bool bOnlyIfChanged = (bUseContactSpecific) - ? (1 == db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_CONDITION, 1) > 0) + ? (1 == db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_CONDITION, 1) > 0) : global_settings.GetShowPopupIfValueChangedFlag(); if ((false == bOnlyIfChanged) || ((true == bOnlyIfChanged) && (true == bValidPrev) && (false == IsWithinAccuracy(dRate, dPrev)))) { tstring sFormat = (bUseContactSpecific) - ? Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_POPUP, global_settings.GetPopupFormat().c_str()) + ? CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_POPUP, global_settings.GetPopupFormat().c_str()) : global_settings.GetPopupFormat(); CPopupSettings ps = *(global_settings.GetPopupSettingsPtr()); @@ -660,14 +660,14 @@ void CQuotesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, cons SetContactStatus(hContact, ID_STATUS_ONLINE); } -MCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName) +MCONTACT CCurrencyRatesProviderBase::CreateNewContact(const tstring& rsName) { MCONTACT hContact = db_add_contact(); if (hContact) { - if (0 == Proto_AddToContact(hContact, QUOTES_PROTOCOL_NAME)) { + if (0 == Proto_AddToContact(hContact, CURRENCYRATES_PROTOCOL_NAME)) { tstring sProvName = GetInfo().m_sName; - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_PROVIDER, sProvName.c_str()); - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsName.c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_PROVIDER, sProvName.c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL, rsName.c_str()); db_set_ws(hContact, LIST_MODULE_NAME, CONTACT_LIST_NAME, rsName.c_str()); mir_cslock lck(m_cs); @@ -682,7 +682,7 @@ MCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName) return hContact; } -DWORD get_refresh_timeout_miliseconds(const CQuotesProviderVisitorDbSettings& visitor) +DWORD get_refresh_timeout_miliseconds(const CCurrencyRatesProviderVisitorDbSettings& visitor) { if (!g_bAutoUpdate) return INFINITE; @@ -690,11 +690,11 @@ DWORD get_refresh_timeout_miliseconds(const CQuotesProviderVisitorDbSettings& vi assert(visitor.m_pszDbRefreshRateType); assert(visitor.m_pszDbRefreshRateValue); - int nRefreshRateType = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); + int nRefreshRateType = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS) nRefreshRateType = RRT_MINUTES; - DWORD nTimeout = db_get_w(NULL, QUOTES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); + DWORD nTimeout = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); switch (nRefreshRateType) { default: case RRT_SECONDS: @@ -730,15 +730,15 @@ private: bool m_b; }; -void CQuotesProviderBase::Run() +void CCurrencyRatesProviderBase::Run() { - CQuotesProviderVisitorDbSettings visitor; + CCurrencyRatesProviderVisitorDbSettings visitor; Accept(visitor); DWORD nTimeout = get_refresh_timeout_miliseconds(visitor); - m_sContactListFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat); - m_sStatusMsgFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat); - m_sTendencyFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat); + m_sContactListFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat); + m_sStatusMsgFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat); + m_sTendencyFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat); enum { @@ -763,7 +763,7 @@ void CQuotesProviderBase::Run() if (g_bAutoUpdate) { CBoolGuard bg(m_bRefreshInProgress); - RefreshQuotes(anContacts); + RefreshCurrencyRates(anContacts); } while (false == bGoToBed) { @@ -788,9 +788,9 @@ void CQuotesProviderBase::Run() case WAIT_OBJECT_0 + SETTINGS_CHANGED: nTimeout = get_refresh_timeout_miliseconds(visitor); - m_sContactListFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat); - m_sStatusMsgFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat); - m_sTendencyFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat); + m_sContactListFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, visitor.m_pszDefDisplayFormat); + m_sStatusMsgFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, visitor.m_pszDefStatusMsgFormat); + m_sTendencyFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat); { mir_cslock lck(m_cs); anContacts = m_aContacts; @@ -811,7 +811,7 @@ void CQuotesProviderBase::Run() { CBoolGuard bg(m_bRefreshInProgress); - RefreshQuotes(anContacts); + RefreshCurrencyRates(anContacts); } } break; @@ -823,7 +823,7 @@ void CQuotesProviderBase::Run() } { CBoolGuard bg(m_bRefreshInProgress); - RefreshQuotes(anContacts); + RefreshCurrencyRates(anContacts); } break; @@ -835,7 +835,7 @@ void CQuotesProviderBase::Run() OnEndRun(); } -void CQuotesProviderBase::OnEndRun() +void CCurrencyRatesProviderBase::OnEndRun() { TContracts anContacts; { @@ -848,18 +848,18 @@ void CQuotesProviderBase::OnEndRun() std::for_each(anContacts.begin(), anContacts.end(), boost::bind(&SetContactStatus, _1, ID_STATUS_OFFLINE)); } -void CQuotesProviderBase::Accept(CQuotesProviderVisitor &visitor)const +void CCurrencyRatesProviderBase::Accept(CCurrencyRatesProviderVisitor &visitor)const { visitor.Visit(*this); } -void CQuotesProviderBase::RefreshSettings() +void CCurrencyRatesProviderBase::RefreshSettings() { BOOL b = ::SetEvent(m_hEventSettingsChanged); assert(b && "Failed to set event"); } -void CQuotesProviderBase::RefreshAllContacts() +void CCurrencyRatesProviderBase::RefreshAllContacts() { {// for CCritSection mir_cslock lck(m_cs); @@ -871,7 +871,7 @@ void CQuotesProviderBase::RefreshAllContacts() assert(b && "Failed to set event"); } -void CQuotesProviderBase::RefreshContact(MCONTACT hContact) +void CCurrencyRatesProviderBase::RefreshContact(MCONTACT hContact) { {// for CCritSection mir_cslock lck(m_cs); diff --git a/plugins/CurrencyRates/src/QuotesProviderBase.h b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h index 40f8c1ec24..ddb00ea18c 100644 --- a/plugins/CurrencyRates/src/QuotesProviderBase.h +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h @@ -1,13 +1,13 @@ -#ifndef __3e6cb4ec_fc47_468f_a2c8_a77941176bc9_QuotesProviderBase_h__ -#define __3e6cb4ec_fc47_468f_a2c8_a77941176bc9_QuotesProviderBase_h__ +#ifndef __3e6cb4ec_fc47_468f_a2c8_a77941176bc9_CurrencyRatesProviderBase_h__ +#define __3e6cb4ec_fc47_468f_a2c8_a77941176bc9_CurrencyRatesProviderBase_h__ -class CQuotesProviderBase : public IQuotesProvider +class CCurrencyRatesProviderBase : public ICurrencyRatesProvider { public: - class CQuote + class CCurrencyRate { public: - CQuote(const tstring& rsID = L"", const tstring& rsSymbol = L"", const tstring& rsName = L"") + CCurrencyRate(const tstring& rsID = L"", const tstring& rsSymbol = L"", const tstring& rsName = L"") : m_sSymbol(rsSymbol), m_sName(rsName), m_sID(rsID){} const tstring& GetSymbol()const{ return m_sSymbol; } @@ -20,15 +20,15 @@ public: tstring m_sID; }; - class CQuoteSection + class CCurrencyRateSection { public: - typedef std::vector<CQuoteSection> TSections; - typedef std::vector<CQuote> TQuotes; + typedef std::vector<CCurrencyRateSection> TSections; + typedef std::vector<CCurrencyRate> TCurrencyRates; public: - CQuoteSection(const tstring& rsName = L"", const TSections& raSections = TSections(), const TQuotes& raQuotes = TQuotes()) - : m_sName(rsName), m_aSections(raSections), m_aQuotes(raQuotes){} + CCurrencyRateSection(const tstring& rsName = L"", const TSections& raSections = TSections(), const TCurrencyRates& raCurrencyRates = TCurrencyRates()) + : m_sName(rsName), m_aSections(raSections), m_aCurrencyRates(raCurrencyRates){} const tstring& GetName()const { @@ -39,24 +39,24 @@ public: { return m_aSections.size(); } - CQuoteSection GetSection(size_t nIndex)const + CCurrencyRateSection GetSection(size_t nIndex)const { - return ((nIndex < m_aSections.size()) ? m_aSections[nIndex] : CQuoteSection()); + return ((nIndex < m_aSections.size()) ? m_aSections[nIndex] : CCurrencyRateSection()); } - size_t GetQuoteCount()const + size_t GetCurrencyRateCount()const { - return m_aQuotes.size(); + return m_aCurrencyRates.size(); } - CQuote GetQuote(size_t nIndex)const + CCurrencyRate GetCurrencyRate(size_t nIndex)const { - return ((nIndex < m_aQuotes.size()) ? m_aQuotes[nIndex] : CQuote()); + return ((nIndex < m_aCurrencyRates.size()) ? m_aCurrencyRates[nIndex] : CCurrencyRate()); } private: tstring m_sName; TSections m_aSections; - TQuotes m_aQuotes; + TCurrencyRates m_aCurrencyRates; }; protected: @@ -66,11 +66,11 @@ public: struct CXMLFileInfo; public: - CQuotesProviderBase(); - ~CQuotesProviderBase(); + CCurrencyRatesProviderBase(); + ~CCurrencyRatesProviderBase(); - const CQuoteSection& GetQuotes()const; + const CCurrencyRateSection& GetCurrencyRates()const; // void SetSettingsEvent(); virtual bool Init(); @@ -78,7 +78,7 @@ public: virtual void AddContact(MCONTACT hContact); virtual void DeleteContact(MCONTACT hContact); virtual void Run(); - virtual void Accept(CQuotesProviderVisitor& visitor)const; + virtual void Accept(CCurrencyRatesProviderVisitor& visitor)const; virtual void RefreshAllContacts(); virtual void RefreshSettings(); virtual void RefreshContact(MCONTACT hContact); @@ -92,7 +92,7 @@ protected: void WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol = L""); private: - virtual void RefreshQuotes(TContracts& anContacts) = 0; + virtual void RefreshCurrencyRates(TContracts& anContacts) = 0; private: virtual void OnEndRun(); @@ -116,4 +116,4 @@ private: bool m_bRefreshInProgress; }; -#endif //__3e6cb4ec_fc47_468f_a2c8_a77941176bc9_QuotesProviderBase_h__ +#endif //__3e6cb4ec_fc47_468f_a2c8_a77941176bc9_CurrencyRatesProviderBase_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderCurrencyConverter.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp index f51a662721..49cd4529ee 100644 --- a/plugins/CurrencyRates/src/QuotesProviderCurrencyConverter.cpp +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "QuotesProviderCurrencyConverter.h" +#include "CurrencyRatesProviderCurrencyConverter.h" #include <boost\property_tree\ptree.hpp> #include <boost\property_tree\json_parser.hpp> @@ -14,8 +14,8 @@ namespace tstring build_url(MCONTACT hContact, const tstring& rsURL) { - tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID); - tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID); + tstring sFrom = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_ID); + tstring sTo = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_ID); return build_url(rsURL, sFrom, sTo); } @@ -24,7 +24,7 @@ namespace try { boost::property_tree::ptree pt; - std::istringstream i_stream(quotes_t2a(rsJSON.c_str())); + std::istringstream i_stream(currencyrates_t2a(rsJSON.c_str())); boost::property_tree::read_json(i_stream, pt); if (!pt.empty()) @@ -45,18 +45,18 @@ namespace return false; } - using TWatchedRates = std::vector<CQuotesProviderCurrencyConverter::TRateInfo>; + using TWatchedRates = std::vector<CCurrencyRatesProviderCurrencyConverter::TRateInfo>; TWatchedRates g_aWatchedRates; INT_PTR CALLBACK OptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - auto get_provider = []()->CQuotesProviderCurrencyConverter* + auto get_provider = []()->CCurrencyRatesProviderCurrencyConverter* { - auto pProviders = CModuleInfo::GetQuoteProvidersPtr(); - const auto& rapQuotesProviders = pProviders->GetProviders(); - for (auto i = rapQuotesProviders.begin(); i != rapQuotesProviders.end(); ++i) { + auto pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); + const auto& rapCurrencyRatesProviders = pProviders->GetProviders(); + for (auto i = rapCurrencyRatesProviders.begin(); i != rapCurrencyRatesProviders.end(); ++i) { const auto& pProvider = *i; - if (auto p = dynamic_cast<CQuotesProviderCurrencyConverter*>(pProvider.get())) + if (auto p = dynamic_cast<CCurrencyRatesProviderCurrencyConverter*>(pProvider.get())) { return p; } @@ -66,10 +66,10 @@ namespace return nullptr; }; - auto make_quote_name = [](const CQuotesProviderBase::CQuote& rQuote)->tstring + auto make_currencyrate_name = [](const CCurrencyRatesProviderBase::CCurrencyRate& rCurrencyRate)->tstring { - const tstring& rsDesc = rQuote.GetName(); - return((false == rsDesc.empty()) ? rsDesc : rQuote.GetSymbol()); + const tstring& rsDesc = rCurrencyRate.GetName(); + return((false == rsDesc.empty()) ? rsDesc : rCurrencyRate.GetSymbol()); }; auto make_contact_name = [](const tstring& rsSymbolFrom, const tstring& rsSymbolTo)->tstring @@ -80,7 +80,7 @@ namespace }; - auto make_rate_name = [make_contact_name](const CQuotesProviderCurrencyConverter::TRateInfo& ri)->tstring + auto make_rate_name = [make_contact_name](const CCurrencyRatesProviderCurrencyConverter::TRateInfo& ri)->tstring { if ((false == ri.first.GetName().empty()) && (false == ri.second.GetName().empty())) return make_contact_name(ri.first.GetName(), ri.second.GetName()); @@ -106,7 +106,7 @@ namespace TWatchedRates aRemove; size_t cWatchedRates = pProvider->GetWatchedRateCount(); for (size_t i = 0; i < cWatchedRates; ++i) { - CQuotesProviderCurrencyConverter::TRateInfo ri; + CCurrencyRatesProviderCurrencyConverter::TRateInfo ri; if (true == pProvider->GetWatchedRateInfo(i, ri)) { auto it = std::find_if(aTemp.begin(), aTemp.end(), [&ri](const auto& other)->bool { @@ -140,18 +140,18 @@ namespace HWND hcbxFrom = ::GetDlgItem(hdlg, IDC_COMBO_CONVERT_FROM); HWND hcbxTo = ::GetDlgItem(hdlg, IDC_COMBO_CONVERT_INTO); - CQuotesProviderBase::CQuoteSection rSection; - const auto& rQuotes = pProvider->GetQuotes(); - if (rQuotes.GetSectionCount() > 0) + CCurrencyRatesProviderBase::CCurrencyRateSection rSection; + const auto& rCurrencyRates = pProvider->GetCurrencyRates(); + if (rCurrencyRates.GetSectionCount() > 0) { - rSection = rQuotes.GetSection(0); + rSection = rCurrencyRates.GetSection(0); } - auto cQuotes = rSection.GetQuoteCount(); - for (auto i = 0u; i < cQuotes; ++i) + auto cCurrencyRates = rSection.GetCurrencyRateCount(); + for (auto i = 0u; i < cCurrencyRates; ++i) { - const auto& rQuote = rSection.GetQuote(i); - tstring sName = make_quote_name(rQuote); + const auto& rCurrencyRate = rSection.GetCurrencyRate(i); + tstring sName = make_currencyrate_name(rCurrencyRate); LPCTSTR pszName = sName.c_str(); ::SendMessage(hcbxFrom, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName)); ::SendMessage(hcbxTo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszName)); @@ -160,7 +160,7 @@ namespace auto cWatchedRates = pProvider->GetWatchedRateCount(); for (auto i = 0u; i < cWatchedRates; ++i) { - CQuotesProviderCurrencyConverter::TRateInfo ri; + CCurrencyRatesProviderCurrencyConverter::TRateInfo ri; if (true == pProvider->GetWatchedRateInfo(i, ri)) { g_aWatchedRates.push_back(ri); @@ -207,19 +207,19 @@ namespace size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0)); if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo)) { - CQuotesProviderBase::CQuoteSection rSection; - const auto& rQuotes = pProvider->GetQuotes(); - if (rQuotes.GetSectionCount() > 0) + CCurrencyRatesProviderBase::CCurrencyRateSection rSection; + const auto& rCurrencyRates = pProvider->GetCurrencyRates(); + if (rCurrencyRates.GetSectionCount() > 0) { - rSection = rQuotes.GetSection(0); + rSection = rCurrencyRates.GetSection(0); } - auto cQuotes = rSection.GetQuoteCount(); - if ((nFrom < cQuotes) && (nTo < cQuotes)) + auto cCurrencyRates = rSection.GetCurrencyRateCount(); + if ((nFrom < cCurrencyRates) && (nTo < cCurrencyRates)) { - CQuotesProviderCurrencyConverter::TRateInfo ri; - ri.first = rSection.GetQuote(nFrom); - ri.second = rSection.GetQuote(nTo); + CCurrencyRatesProviderCurrencyConverter::TRateInfo ri; + ri.first = rSection.GetCurrencyRate(nFrom); + ri.second = rSection.GetCurrencyRate(nTo); g_aWatchedRates.push_back(ri); @@ -261,22 +261,22 @@ namespace } -CQuotesProviderCurrencyConverter::CQuotesProviderCurrencyConverter() +CCurrencyRatesProviderCurrencyConverter::CCurrencyRatesProviderCurrencyConverter() { } -CQuotesProviderCurrencyConverter::~CQuotesProviderCurrencyConverter() +CCurrencyRatesProviderCurrencyConverter::~CCurrencyRatesProviderCurrencyConverter() { } -void CQuotesProviderCurrencyConverter::Accept(CQuotesProviderVisitor& visitor)const +void CCurrencyRatesProviderCurrencyConverter::Accept(CCurrencyRatesProviderVisitor& visitor)const { - CQuotesProviderBase::Accept(visitor); + CCurrencyRatesProviderBase::Accept(visitor); visitor.Visit(*this); } -void CQuotesProviderCurrencyConverter::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp) +void CCurrencyRatesProviderCurrencyConverter::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_OPT_GOOGLE); odp.pfnDlgProc = OptDlgProc; @@ -284,7 +284,7 @@ void CQuotesProviderCurrencyConverter::ShowPropertyPage(WPARAM wp, OPTIONSDIALOG g_plugin.addOptions(wp, &odp); } -void CQuotesProviderCurrencyConverter::RefreshQuotes(TContracts& anContacts) +void CCurrencyRatesProviderCurrencyConverter::RefreshCurrencyRates(TContracts& anContacts) { CHTTPSession http; tstring sURL = GetURL(); @@ -308,7 +308,7 @@ void CQuotesProviderCurrencyConverter::RefreshQuotes(TContracts& anContacts) } } -double CQuotesProviderCurrencyConverter::Convert(double dAmount, const CQuote& from, const CQuote& to)const +double CCurrencyRatesProviderCurrencyConverter::Convert(double dAmount, const CCurrencyRate& from, const CCurrencyRate& to)const { tstring sFullURL = build_url(GetURL(), from.GetID(), to.GetID()); @@ -331,22 +331,22 @@ double CQuotesProviderCurrencyConverter::Convert(double dAmount, const CQuote& f return 0.0; } -size_t CQuotesProviderCurrencyConverter::GetWatchedRateCount()const +size_t CCurrencyRatesProviderCurrencyConverter::GetWatchedRateCount()const { return m_aContacts.size(); } -bool CQuotesProviderCurrencyConverter::GetWatchedRateInfo(size_t nIndex, TRateInfo& rRateInfo) +bool CCurrencyRatesProviderCurrencyConverter::GetWatchedRateInfo(size_t nIndex, TRateInfo& rRateInfo) { if(nIndex < m_aContacts.size()) { MCONTACT hContact = m_aContacts[nIndex]; - tstring sSymbolFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID); - tstring sSymbolTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID); - tstring sDescFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_DESCRIPTION); - tstring sDescTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_DESCRIPTION); + tstring sSymbolFrom = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_ID); + tstring sSymbolTo = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_ID); + tstring sDescFrom = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_DESCRIPTION); + tstring sDescTo = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_DESCRIPTION); - rRateInfo.first = CQuote(sSymbolFrom, sSymbolFrom, sDescFrom); - rRateInfo.second = CQuote(sSymbolTo, sSymbolTo, sDescTo); + rRateInfo.first = CCurrencyRate(sSymbolFrom, sSymbolFrom, sDescFrom); + rRateInfo.second = CCurrencyRate(sSymbolTo, sSymbolTo, sDescTo); return true; } else { @@ -354,12 +354,12 @@ bool CQuotesProviderCurrencyConverter::GetWatchedRateInfo(size_t nIndex, TRateIn } } -bool CQuotesProviderCurrencyConverter::WatchForRate(const TRateInfo& ri, bool bWatch) +bool CCurrencyRatesProviderCurrencyConverter::WatchForRate(const TRateInfo& ri, bool bWatch) { auto i = std::find_if(m_aContacts.begin(), m_aContacts.end(), [&ri](auto hContact)->bool { - tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID); - tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID); + tstring sFrom = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_ID); + tstring sTo = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_ID); return ((0 == mir_wstrcmpi(ri.first.GetID().c_str(), sFrom.c_str())) && (0 == mir_wstrcmpi(ri.second.GetID().c_str(), sTo.c_str()))); }); @@ -378,15 +378,15 @@ bool CQuotesProviderCurrencyConverter::WatchForRate(const TRateInfo& ri, bool bW MCONTACT hContact = CreateNewContact(sName); if (hContact) { - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID, ri.first.GetID().c_str()); - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID, ri.second.GetID().c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_ID, ri.first.GetID().c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_ID, ri.second.GetID().c_str()); if (false == ri.first.GetName().empty()) { - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_DESCRIPTION, ri.first.GetName().c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_DESCRIPTION, ri.first.GetName().c_str()); } if (false == ri.second.GetName().empty()) { - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_DESCRIPTION, ri.second.GetName().c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_DESCRIPTION, ri.second.GetName().c_str()); } return true; @@ -407,14 +407,14 @@ bool CQuotesProviderCurrencyConverter::WatchForRate(const TRateInfo& ri, bool bW return false; } -MCONTACT CQuotesProviderCurrencyConverter::GetContactByID(const tstring& rsFromID, const tstring& rsToID)const +MCONTACT CCurrencyRatesProviderCurrencyConverter::GetContactByID(const tstring& rsFromID, const tstring& rsToID)const { mir_cslock lck(m_cs); auto i = std::find_if(m_aContacts.begin(), m_aContacts.end(), [rsFromID, rsToID](MCONTACT hContact)->bool { - tstring sFrom = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_FROM_ID); - tstring sTo = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_TO_ID); + tstring sFrom = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_ID); + tstring sTo = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_ID); return ((0 == mir_wstrcmpi(rsFromID.c_str(), sFrom.c_str())) && (0 == mir_wstrcmpi(rsToID.c_str(), sTo.c_str()))); }); diff --git a/plugins/CurrencyRates/src/QuotesProviderCurrencyConverter.h b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h index c6138756b3..66658c5c99 100644 --- a/plugins/CurrencyRates/src/QuotesProviderCurrencyConverter.h +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h @@ -6,24 +6,24 @@ #define DB_STR_TO_DESCRIPTION "ToDesc" -class CQuotesProviderCurrencyConverter : public CQuotesProviderBase +class CCurrencyRatesProviderCurrencyConverter : public CCurrencyRatesProviderBase { public: - using TRateInfo = std::pair<CQuote, CQuote>; + using TRateInfo = std::pair<CCurrencyRate, CCurrencyRate>; public: - CQuotesProviderCurrencyConverter(); - ~CQuotesProviderCurrencyConverter(); + CCurrencyRatesProviderCurrencyConverter(); + ~CCurrencyRatesProviderCurrencyConverter(); - double Convert(double dAmount, const CQuote& from, const CQuote& to)const; + double Convert(double dAmount, const CCurrencyRate& from, const CCurrencyRate& to)const; size_t GetWatchedRateCount()const; bool GetWatchedRateInfo(size_t nIndex, TRateInfo& rRateInfo); bool WatchForRate(const TRateInfo& ri, bool bWatch); MCONTACT GetContactByID(const tstring& rsFromID, const tstring& rsToID)const; private: - virtual void Accept(CQuotesProviderVisitor& visitor)const override; + virtual void Accept(CCurrencyRatesProviderVisitor& visitor)const override; virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp)override; - virtual void RefreshQuotes(TContracts& anContacts)override; + virtual void RefreshCurrencyRates(TContracts& anContacts)override; }; diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h new file mode 100644 index 0000000000..270ff00108 --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h @@ -0,0 +1,25 @@ +#ifndef __7fca59e7_17b2_4849_bd7a_02c7675f2d76_CurrencyRatesProviderVisitor_h__ +#define __7fca59e7_17b2_4849_bd7a_02c7675f2d76_CurrencyRatesProviderVisitor_h__ + +class CCurrencyRatesProviderBase; +class CCurrencyRatesProviderFinance; +class CCurrencyRatesProviderDukasCopy; +class CCurrencyRatesProviderGoogleFinance; +class CCurrencyRatesProviderYahoo; +class CCurrencyRatesProviderCurrencyConverter; + +class CCurrencyRatesProviderVisitor +{ +public: + CCurrencyRatesProviderVisitor() {} + virtual ~CCurrencyRatesProviderVisitor() {} + + virtual void Visit(const CCurrencyRatesProviderBase&){} + virtual void Visit(const CCurrencyRatesProviderFinance&){} + virtual void Visit(const CCurrencyRatesProviderDukasCopy&){} + virtual void Visit(const CCurrencyRatesProviderGoogleFinance&){} + virtual void Visit(const CCurrencyRatesProviderYahoo&){} + virtual void Visit(const CCurrencyRatesProviderCurrencyConverter&) {} +}; + +#endif //__7fca59e7_17b2_4849_bd7a_02c7675f2d76_CurrencyRatesProviderVisitor_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorDbSettings.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.cpp index 3793e91699..72d16ccb17 100644 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorDbSettings.cpp +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" -CQuotesProviderVisitorDbSettings::CQuotesProviderVisitorDbSettings() +CCurrencyRatesProviderVisitorDbSettings::CCurrencyRatesProviderVisitorDbSettings() : m_pszDbRefreshRateType(nullptr), m_pszDbRefreshRateValue(nullptr), m_pszDbDisplayNameFormat(nullptr), @@ -30,18 +30,18 @@ CQuotesProviderVisitorDbSettings::CQuotesProviderVisitorDbSettings() { } -CQuotesProviderVisitorDbSettings::~CQuotesProviderVisitorDbSettings() +CCurrencyRatesProviderVisitorDbSettings::~CCurrencyRatesProviderVisitorDbSettings() { } -void CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderBase&/* rProvider*/) +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 CQuotesProviderVisitorDbSettings::Visit(const CQuotesProviderCurrencyConverter&) +void CCurrencyRatesProviderVisitorDbSettings::Visit(const CCurrencyRatesProviderCurrencyConverter&) { m_pszDbRefreshRateType = "CC_RefreshRateType"; m_pszDbRefreshRateValue = "CC_RefreshRateValue"; diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorDbSettings.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.h index 6a5b180b0d..e5abdcb998 100644 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorDbSettings.h +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorDbSettings.h @@ -1,15 +1,15 @@ -#ifndef __97cd432a_1119_4803_a96f_0abc1cc2653f_QuotesProviderVisitorDbSettings_h__ -#define __97cd432a_1119_4803_a96f_0abc1cc2653f_QuotesProviderVisitorDbSettings_h__ +#ifndef __97cd432a_1119_4803_a96f_0abc1cc2653f_CurrencyRatesProviderVisitorDbSettings_h__ +#define __97cd432a_1119_4803_a96f_0abc1cc2653f_CurrencyRatesProviderVisitorDbSettings_h__ -class CQuotesProviderVisitorDbSettings : public CQuotesProviderVisitor +class CCurrencyRatesProviderVisitorDbSettings : public CCurrencyRatesProviderVisitor { public: - CQuotesProviderVisitorDbSettings(); - ~CQuotesProviderVisitorDbSettings(); + CCurrencyRatesProviderVisitorDbSettings(); + ~CCurrencyRatesProviderVisitorDbSettings(); private: - virtual void Visit(const CQuotesProviderBase& rProvider)override; - virtual void Visit(const CQuotesProviderCurrencyConverter& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderBase& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderCurrencyConverter& rProvider)override; public: LPCSTR m_pszDbRefreshRateType; LPCSTR m_pszDbRefreshRateValue; @@ -41,4 +41,4 @@ public: LPCSTR m_pszDbPopupHistoryFlag; }; -#endif //__97cd432a_1119_4803_a96f_0abc1cc2653f_QuotesProviderVisitorDbSettings_h__ +#endif //__97cd432a_1119_4803_a96f_0abc1cc2653f_CurrencyRatesProviderVisitorDbSettings_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorFormatSpecificator.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.cpp index 451eaa4f2f..e9f6450d94 100644 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorFormatSpecificator.cpp +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.cpp @@ -1,20 +1,20 @@ #include "StdAfx.h" -CQuotesProviderVisitorFormatSpecificator::CQuotesProviderVisitorFormatSpecificator() +CCurrencyRatesProviderVisitorFormatSpecificator::CCurrencyRatesProviderVisitorFormatSpecificator() { } -CQuotesProviderVisitorFormatSpecificator::~CQuotesProviderVisitorFormatSpecificator() +CCurrencyRatesProviderVisitorFormatSpecificator::~CCurrencyRatesProviderVisitorFormatSpecificator() { } -void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderDukasCopy&/* rProvider*/) +void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderDukasCopy&/* rProvider*/) { - m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Quote Symbol"))); - m_aSpecificators.push_back(CFormatSpecificator(L"%d", TranslateT("Quote Name"))); + m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("CurrencyRate Symbol"))); + m_aSpecificators.push_back(CFormatSpecificator(L"%d", TranslateT("CurrencyRate Name"))); } -void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderBase&/* rProvider*/) +void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderBase&/* rProvider*/) { m_aSpecificators.push_back(CFormatSpecificator(L"%S", TranslateT("Source of Information"))); m_aSpecificators.push_back(CFormatSpecificator(L"%r", TranslateT("Rate Value"))); @@ -27,24 +27,24 @@ void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderBase&/ m_aSpecificators.push_back(CFormatSpecificator(L"\\\\", TranslateT("Left slash (\\)"))); } -void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderGoogleFinance&/* rProvider*/) +void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderGoogleFinance&/* rProvider*/) { - m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Quote Symbol"))); - m_aSpecificators.push_back(CFormatSpecificator(L"%n", TranslateT("Quote Name"))); + m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("CurrencyRate Symbol"))); + m_aSpecificators.push_back(CFormatSpecificator(L"%n", TranslateT("CurrencyRate Name"))); m_aSpecificators.push_back(CFormatSpecificator(L"%o", TranslateT("Open Price"))); m_aSpecificators.push_back(CFormatSpecificator(L"%d", TranslateT("Percent Change to After Hours"))); m_aSpecificators.push_back(CFormatSpecificator(L"%y", TranslateT("Percent Change to Yesterday Close"))); } -const CQuotesProviderVisitorFormatSpecificator::TFormatSpecificators& CQuotesProviderVisitorFormatSpecificator::GetSpecificators()const +const CCurrencyRatesProviderVisitorFormatSpecificator::TFormatSpecificators& CCurrencyRatesProviderVisitorFormatSpecificator::GetSpecificators()const { return m_aSpecificators; } -void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderYahoo&) +void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderYahoo&) { - m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Quote Symbol"))); - m_aSpecificators.push_back(CFormatSpecificator(L"%n", TranslateT("Quote Name"))); + m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("CurrencyRate Symbol"))); + m_aSpecificators.push_back(CFormatSpecificator(L"%n", TranslateT("CurrencyRate Name"))); m_aSpecificators.push_back(CFormatSpecificator(L"%o", TranslateT("Open Price"))); m_aSpecificators.push_back(CFormatSpecificator(L"%h", TranslateT("Day's High"))); m_aSpecificators.push_back(CFormatSpecificator(L"%g", TranslateT("Day's Low"))); @@ -52,7 +52,7 @@ void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderYahoo& m_aSpecificators.push_back(CFormatSpecificator(L"%c", TranslateT("Change"))); } -void CQuotesProviderVisitorFormatSpecificator::Visit(const CQuotesProviderCurrencyConverter&) +void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderCurrencyConverter&) { m_aSpecificators.push_back(CFormatSpecificator(L"%F", TranslateT("From Currency Full Name"))); m_aSpecificators.push_back(CFormatSpecificator(L"%f", TranslateT("From Currency Short Name"))); diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h new file mode 100644 index 0000000000..f2e11b7f44 --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h @@ -0,0 +1,33 @@ +#ifndef __00c159f3_525a_41e9_8fc5_00464b6fafa3_CurrencyRatesProviderVisitorFormatSpecificator_h__ +#define __00c159f3_525a_41e9_8fc5_00464b6fafa3_CurrencyRatesProviderVisitorFormatSpecificator_h__ + +class CCurrencyRatesProviderVisitorFormatSpecificator : public CCurrencyRatesProviderVisitor +{ +public: + struct CFormatSpecificator + { + CFormatSpecificator(const tstring& rsSymbol = L"", const tstring& rsDec = L"") + : m_sSymbol(rsSymbol), m_sDesc(rsDec){} + + tstring m_sSymbol; + tstring m_sDesc; + }; + typedef std::vector<CFormatSpecificator> TFormatSpecificators; + +public: + CCurrencyRatesProviderVisitorFormatSpecificator(); + ~CCurrencyRatesProviderVisitorFormatSpecificator(); + + const TFormatSpecificators& GetSpecificators()const; + +private: + virtual void Visit(const CCurrencyRatesProviderDukasCopy& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderBase& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderGoogleFinance& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderYahoo& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderCurrencyConverter& rProvider)override; +private: + TFormatSpecificators m_aSpecificators; +}; + +#endif//__00c159f3_525a_41e9_8fc5_00464b6fafa3_CurrencyRatesProviderVisitorFormatSpecificator_h__ diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp new file mode 100644 index 0000000000..e46354c2e4 --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.cpp @@ -0,0 +1,122 @@ +#include "StdAfx.h" +#include "CurrencyRatesProviderCurrencyConverter.h" + +CCurrencyRatesProviderVisitorFormater::CCurrencyRatesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth) + : m_hContact(hContact), + m_chr(chr), + m_nWidth(nWidth) +{ +} + +CCurrencyRatesProviderVisitorFormater::~CCurrencyRatesProviderVisitorFormater() +{ +} + +const tstring& CCurrencyRatesProviderVisitorFormater::GetResult()const +{ + return m_sResult; +} + +static bool get_fetch_time(MCONTACT hContact, time_t& rTime) +{ + DBVARIANT dbv; + if (db_get(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type)) + return false; + + rTime = dbv.dVal; + return true; +} + +static tstring format_fetch_time(const CCurrencyRatesProviderBase&, MCONTACT hContact, const tstring& rsFormat) +{ + time_t nTime; + if (true == get_fetch_time(hContact, nTime)) { + boost::posix_time::ptime time = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(boost::posix_time::from_time_t(nTime)); + tostringstream k; + k.imbue(std::locale(GetSystemLocale(), new ttime_facet(rsFormat.c_str()))); + k << time; + return k.str(); + } + + return tstring(); +} + +void CCurrencyRatesProviderVisitorFormater::Visit(const CCurrencyRatesProviderBase& rProvider) +{ + switch (m_chr) { + case '%': + case '\t': + case '\\': + m_sResult = m_chr; + break; + case 'S': + m_sResult = CurrencyRates_DBGetStringT(m_hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_PROVIDER); + break; + case 's': + m_sResult = CurrencyRates_DBGetStringT(m_hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL); + break; + case 'X': + m_sResult = format_fetch_time(rProvider, m_hContact, CurrencyRates_GetTimeFormat(true)); + break; + case 'x': + m_sResult = format_fetch_time(rProvider, m_hContact, CurrencyRates_GetDateFormat(true)); + break; + case 't': + { + tstring sFrmt = CurrencyRates_GetDateFormat(true); + sFrmt += L" "; + sFrmt += CurrencyRates_GetTimeFormat(true); + m_sResult = format_fetch_time(rProvider, m_hContact, sFrmt); + } + break; + case 'r': + case 'R': + FormatDoubleHelper(DB_STR_CURRENCYRATE_CURR_VALUE); + break; + case 'p': + FormatDoubleHelper(DB_STR_CURRENCYRATE_PREV_VALUE); + break; + } +} + + +tstring format_double(double dValue, int nWidth) +{ + tostringstream o; + o.imbue(GetSystemLocale()); + + if (nWidth > 0 && nWidth <= 9) + o << std::setprecision(nWidth) << std::showpoint << std::fixed; + + o << dValue; + + return o.str(); +} + +void CCurrencyRatesProviderVisitorFormater::FormatDoubleHelper(LPCSTR pszDbSet, + const tstring sInvalid/* = L"-"*/) +{ + double d = 0.0; + if (true == CurrencyRates_DBReadDouble(m_hContact, CURRENCYRATES_MODULE_NAME, pszDbSet, d)) + m_sResult = format_double(d, m_nWidth); + else + m_sResult = sInvalid; +} + +void CCurrencyRatesProviderVisitorFormater::Visit(const CCurrencyRatesProviderCurrencyConverter&) +{ + switch (m_chr) { + case 'F': + m_sResult = CurrencyRates_DBGetStringT(m_hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_DESCRIPTION); + break; + case 'f': + m_sResult = CurrencyRates_DBGetStringT(m_hContact, CURRENCYRATES_MODULE_NAME, DB_STR_FROM_ID); + break; + case 'I': + m_sResult = CurrencyRates_DBGetStringT(m_hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_DESCRIPTION); + break; + case 'i': + m_sResult = CurrencyRates_DBGetStringT(m_hContact, CURRENCYRATES_MODULE_NAME, DB_STR_TO_ID); + break; + } +}
\ No newline at end of file diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h new file mode 100644 index 0000000000..65ce84b9e4 --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h @@ -0,0 +1,27 @@ +#ifndef __2b5ddd05_9255_4be0_9408_e59768b70568_CurrencyRatesProviderVisitorFormater_h__ +#define __2b5ddd05_9255_4be0_9408_e59768b70568_CurrencyRatesProviderVisitorFormater_h__ + +class CCurrencyRatesProviderVisitorFormater : public CCurrencyRatesProviderVisitor +{ +public: + CCurrencyRatesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth); + ~CCurrencyRatesProviderVisitorFormater(); + + const tstring& GetResult()const; + +private: + virtual void Visit(const CCurrencyRatesProviderBase& rProvider)override; + virtual void Visit(const CCurrencyRatesProviderCurrencyConverter& rProvider)override; + +private: + void FormatDoubleHelper(LPCSTR pszDbSet, const tstring sInvalid = L"-"); + // void FormatChangeValueHelper(bool bPercentage); + +private: + MCONTACT m_hContact; + wchar_t m_chr; + tstring m_sResult; + int m_nWidth; +}; + +#endif //__2b5ddd05_9255_4be0_9408_e59768b70568_CurrencyRatesProviderVisitorFormater_h__ diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp new file mode 100644 index 0000000000..b9ed9a9d94 --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp @@ -0,0 +1,24 @@ +#include "stdafx.h" + +CCurrencyRatesProviderVisitorTendency::CCurrencyRatesProviderVisitorTendency(MCONTACT hContact, wchar_t chr) + : m_hContact(hContact), m_chr(chr), m_bValid(false), m_dResult(0.0) +{ +} + +void CCurrencyRatesProviderVisitorTendency::Visit(const CCurrencyRatesProviderBase&) +{ + switch (m_chr) { + case 'r': + case 'R': + GetValue(DB_STR_CURRENCYRATE_CURR_VALUE); + break; + case 'p': + GetValue(DB_STR_CURRENCYRATE_PREV_VALUE); + break; + } +} + +void CCurrencyRatesProviderVisitorTendency::GetValue(LPCSTR pszDbKeyName) +{ + m_bValid = CurrencyRates_DBReadDouble(m_hContact, CURRENCYRATES_MODULE_NAME, pszDbKeyName, m_dResult); +} diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h new file mode 100644 index 0000000000..d0497889ae --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h @@ -0,0 +1,25 @@ +#ifndef __AD721194_E9944366_9CF1_0307460EF32F_CurrencyRatesProviderVisitorTendency_h__ +#define __AD721194_E9944366_9CF1_0307460EF32F_CurrencyRatesProviderVisitorTendency_h__ + +class CCurrencyRatesProviderVisitorTendency : public CCurrencyRatesProviderVisitor +{ +public: + CCurrencyRatesProviderVisitorTendency(MCONTACT hContact, wchar_t chr); + + bool IsValid()const{ return m_bValid; } + double GetResult()const{ return m_dResult; } + +private: + virtual void Visit(const CCurrencyRatesProviderBase& rProvider); + +private: + void GetValue(LPCSTR pszDbKeyName); + +private: + MCONTACT m_hContact; + wchar_t m_chr; + bool m_bValid; + double m_dResult; +}; + +#endif //__AD721194_E9944366_9CF1_0307460EF32F_CurrencyRatesProviderVisitorTendency_h__ diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp new file mode 100644 index 0000000000..a2906c619b --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp @@ -0,0 +1,90 @@ +#include "StdAfx.h" +#include "CurrencyRatesProviderCurrencyConverter.h" + +#define LAST_RUN_VERSION "LastRunVersion" + +CCurrencyRatesProviders::CCurrencyRatesProviders() +{ + InitProviders(); +} + +CCurrencyRatesProviders::~CCurrencyRatesProviders() +{ + ClearProviders(); +} + +const CCurrencyRatesProviders::TCurrencyRatesProviders& CCurrencyRatesProviders::GetProviders()const +{ + return m_apProviders; +} + +template<class T>void create_provider(CCurrencyRatesProviders::TCurrencyRatesProviders& apProviders) +{ + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider(new T); + if (pProvider->Init()) + apProviders.push_back(pProvider); +}; + +void CCurrencyRatesProviders::CreateProviders() +{ + create_provider<CCurrencyRatesProviderCurrencyConverter>(m_apProviders); +} + +void CCurrencyRatesProviders::ClearProviders() +{ + m_apProviders.clear(); +} + +void convert_contact_settings(MCONTACT hContact) +{ + WORD dwLogMode = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG, static_cast<WORD>(lmDisabled)); + if ((dwLogMode&lmInternalHistory) || (dwLogMode&lmExternalFile)) + db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 1); +} + +void CCurrencyRatesProviders::InitProviders() +{ + CreateProviders(); + + const WORD nCurrentVersion = 17; + WORD nVersion = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, 1); + + for (auto &hContact : Contacts(CURRENCYRATES_MODULE_NAME)) { + TCurrencyRatesProviderPtr pProvider = GetContactProviderPtr(hContact); + if (pProvider) { + pProvider->AddContact(hContact); + if (nVersion < nCurrentVersion) + convert_contact_settings(hContact); + } + } + + db_set_w(NULL, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, nCurrentVersion); +} + +CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::GetContactProviderPtr(MCONTACT hContact)const +{ + char* szProto = GetContactProto(hContact); + if (nullptr == szProto || 0 != ::_stricmp(szProto, CURRENCYRATES_PROTOCOL_NAME)) + return TCurrencyRatesProviderPtr(); + + tstring sProvider = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_PROVIDER); + if (true == sProvider.empty()) + return TCurrencyRatesProviderPtr(); + + return FindProvider(sProvider); +} + +CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::FindProvider(const tstring& rsName)const +{ + TCurrencyRatesProviderPtr pResult; + for (TCurrencyRatesProviders::const_iterator i = m_apProviders.begin(); i != m_apProviders.end(); ++i) { + const TCurrencyRatesProviderPtr& pProvider = *i; + const ICurrencyRatesProvider::CProviderInfo& rInfo = pProvider->GetInfo(); + if (0 == ::mir_wstrcmpi(rsName.c_str(), rInfo.m_sName.c_str())) { + pResult = pProvider; + break; + } + } + + return pResult; +} diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviders.h b/plugins/CurrencyRates/src/CurrencyRatesProviders.h new file mode 100644 index 0000000000..da30a2522b --- /dev/null +++ b/plugins/CurrencyRates/src/CurrencyRatesProviders.h @@ -0,0 +1,29 @@ +#ifndef __148306d1_da2a_43df_b1ad_0cdc8ef8a79e_CurrencyRatesProviders_h__ +#define __148306d1_da2a_43df_b1ad_0cdc8ef8a79e_CurrencyRatesProviders_h__ + +class ICurrencyRatesProvider; + +class CCurrencyRatesProviders +{ +public: + typedef boost::shared_ptr<ICurrencyRatesProvider> TCurrencyRatesProviderPtr; + typedef std::vector<TCurrencyRatesProviderPtr> TCurrencyRatesProviders; + +public: + CCurrencyRatesProviders(); + ~CCurrencyRatesProviders(); + + TCurrencyRatesProviderPtr FindProvider(const tstring& rsName)const; + TCurrencyRatesProviderPtr GetContactProviderPtr(MCONTACT hContact)const; + const TCurrencyRatesProviders& GetProviders()const; + +private: + void InitProviders(); + void CreateProviders(); + void ClearProviders(); + +private: + TCurrencyRatesProviders m_apProviders; +}; + +#endif //__148306d1_da2a_43df_b1ad_0cdc8ef8a79e_CurrencyRatesProviders_h__ diff --git a/plugins/CurrencyRates/src/DBUtils.cpp b/plugins/CurrencyRates/src/DBUtils.cpp index c041bbf51c..ebb816a8ea 100644 --- a/plugins/CurrencyRates/src/DBUtils.cpp +++ b/plugins/CurrencyRates/src/DBUtils.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" -std::string Quotes_DBGetStringA(MCONTACT hContact, const char* szModule, const char* szSetting, const char* pszDefValue /*= NULL*/) +std::string CurrencyRates_DBGetStringA(MCONTACT hContact, const char* szModule, const char* szSetting, const char* pszDefValue /*= NULL*/) { std::string sResult; char* pszSymbol = db_get_sa(hContact, szModule, szSetting); @@ -14,7 +14,7 @@ std::string Quotes_DBGetStringA(MCONTACT hContact, const char* szModule, const c return sResult; } -std::wstring Quotes_DBGetStringW(MCONTACT hContact, const char* szModule, const char* szSetting, const wchar_t* pszDefValue/* = NULL*/) +std::wstring CurrencyRates_DBGetStringW(MCONTACT hContact, const char* szModule, const char* szSetting, const wchar_t* pszDefValue/* = NULL*/) { std::wstring sResult; wchar_t* pszSymbol = db_get_wsa(hContact, szModule, szSetting); @@ -28,12 +28,12 @@ std::wstring Quotes_DBGetStringW(MCONTACT hContact, const char* szModule, const return sResult; } -bool Quotes_DBWriteDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double dValue) +bool CurrencyRates_DBWriteDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double dValue) { return 0 == db_set_blob(hContact, szModule, szSetting, &dValue, sizeof(dValue)); } -bool Quotes_DBReadDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double& rdValue) +bool CurrencyRates_DBReadDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double& rdValue) { DBVARIANT dbv = { 0 }; dbv.type = DBVT_BLOB; diff --git a/plugins/CurrencyRates/src/DBUtils.h b/plugins/CurrencyRates/src/DBUtils.h index ae2d1d2a00..ff53653e6a 100644 --- a/plugins/CurrencyRates/src/DBUtils.h +++ b/plugins/CurrencyRates/src/DBUtils.h @@ -1,13 +1,13 @@ #ifndef __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__ #define __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__ -std::string Quotes_DBGetStringA(MCONTACT hContact, const char* szModule, const char* szSetting, const char* pszDefValue = NULL); -std::wstring Quotes_DBGetStringW(MCONTACT hContact, const char* szModule, const char* szSetting, const wchar_t* pszDefValue = NULL); +std::string CurrencyRates_DBGetStringA(MCONTACT hContact, const char* szModule, const char* szSetting, const char* pszDefValue = NULL); +std::wstring CurrencyRates_DBGetStringW(MCONTACT hContact, const char* szModule, const char* szSetting, const wchar_t* pszDefValue = NULL); -#define Quotes_DBGetStringT Quotes_DBGetStringW +#define CurrencyRates_DBGetStringT CurrencyRates_DBGetStringW -bool Quotes_DBWriteDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double dValue); -bool Quotes_DBReadDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double& rdValue); +bool CurrencyRates_DBWriteDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double dValue); +bool CurrencyRates_DBReadDouble(MCONTACT hContact, const char* szModule, const char* szSetting, double& rdValue); #endif //__54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__ diff --git a/plugins/CurrencyRates/src/EconomicRateInfo.h b/plugins/CurrencyRates/src/EconomicRateInfo.h index 0e47893ee0..664649a47a 100644 --- a/plugins/CurrencyRates/src/EconomicRateInfo.h +++ b/plugins/CurrencyRates/src/EconomicRateInfo.h @@ -1,9 +1,9 @@ #ifndef __87d726e0_26c6_485d_8016_1fba819b037d_EconomicRateInfo__ #define __87d726e0_26c6_485d_8016_1fba819b037d_EconomicRateInfo__ -#define QUOTES_PROTOCOL_NAME "Quotes"// protocol name +#define CURRENCYRATES_PROTOCOL_NAME "CurrencyRates"// protocol name -#define QUOTES_MODULE_NAME "Quotes" // db settings module path +#define CURRENCYRATES_MODULE_NAME "CurrencyRates" // db settings module path enum ERefreshRateType { @@ -13,13 +13,13 @@ enum ERefreshRateType }; #define DB_STR_ENABLE_LOG "EnableLog" -#define DB_STR_QUOTE_PROVIDER "QuoteProvider" -#define DB_STR_QUOTE_ID "QuoteID" -#define DB_STR_QUOTE_SYMBOL "QuoteSymbol" -#define DB_STR_QUOTE_DESCRIPTION "QuoteDescription" -#define DB_STR_QUOTE_PREV_VALUE "PreviousQuoteValue" -#define DB_STR_QUOTE_CURR_VALUE "CurrentQuoteValue" -#define DB_STR_QUOTE_FETCH_TIME "FetchTime" +#define DB_STR_CURRENCYRATE_PROVIDER "CurrencyRateProvider" +#define DB_STR_CURRENCYRATE_ID "CurrencyRateID" +#define DB_STR_CURRENCYRATE_SYMBOL "CurrencyRateSymbol" +#define DB_STR_CURRENCYRATE_DESCRIPTION "CurrencyRateDescription" +#define DB_STR_CURRENCYRATE_PREV_VALUE "PreviousCurrencyRateValue" +#define DB_STR_CURRENCYRATE_CURR_VALUE "CurrentCurrencyRateValue" +#define DB_STR_CURRENCYRATE_FETCH_TIME "FetchTime" enum ELogMode @@ -31,22 +31,22 @@ enum ELogMode }; #define DB_STR_CONTACT_SPEC_SETTINGS "ContactSpecSettings" -#define DB_STR_QUOTE_LOG "Log" -#define DB_STR_QUOTE_LOG_FILE "LogFile" -#define DB_STR_QUOTE_FORMAT_LOG_FILE "LogFileFormat" -#define DB_STR_QUOTE_FORMAT_HISTORY "HistoryFormat" -#define DB_STR_QUOTE_LOG_FILE_CONDITION "AddToLogOnlyIfValueIsChanged" -#define DB_STR_QUOTE_HISTORY_CONDITION "AddToHistoryOnlyIfValueIsChanged" -#define DB_STR_QUOTE_EXTRA_IMAGE_SLOT "ExtraImageSlot" -#define DB_STR_QUOTE_FORMAT_POPUP "PopupFormat" -#define DB_STR_QUOTE_POPUP_CONDITION "ShowPopupOnlyIfValueIsChanged" - -#define DB_STR_QUOTE_POPUP_COLOUR_MODE "PopupColourMode" -#define DB_STR_QUOTE_POPUP_COLOUR_BK "PopupColourBk" -#define DB_STR_QUOTE_POPUP_COLOUR_TEXT "PopupColourText" -#define DB_STR_QUOTE_POPUP_DELAY_MODE "PopupDelayMode" -#define DB_STR_QUOTE_POPUP_DELAY_TIMEOUT "PopupDelayTimeout" -#define DB_STR_QUOTE_POPUP_HISTORY_FLAG "PopupHistoryFlag" +#define DB_STR_CURRENCYRATE_LOG "Log" +#define DB_STR_CURRENCYRATE_LOG_FILE "LogFile" +#define DB_STR_CURRENCYRATE_FORMAT_LOG_FILE "LogFileFormat" +#define DB_STR_CURRENCYRATE_FORMAT_HISTORY "HistoryFormat" +#define DB_STR_CURRENCYRATE_LOG_FILE_CONDITION "AddToLogOnlyIfValueIsChanged" +#define DB_STR_CURRENCYRATE_HISTORY_CONDITION "AddToHistoryOnlyIfValueIsChanged" +#define DB_STR_CURRENCYRATE_EXTRA_IMAGE_SLOT "ExtraImageSlot" +#define DB_STR_CURRENCYRATE_FORMAT_POPUP "PopupFormat" +#define DB_STR_CURRENCYRATE_POPUP_CONDITION "ShowPopupOnlyIfValueIsChanged" + +#define DB_STR_CURRENCYRATE_POPUP_COLOUR_MODE "PopupColourMode" +#define DB_STR_CURRENCYRATE_POPUP_COLOUR_BK "PopupColourBk" +#define DB_STR_CURRENCYRATE_POPUP_COLOUR_TEXT "PopupColourText" +#define DB_STR_CURRENCYRATE_POPUP_DELAY_MODE "PopupDelayMode" +#define DB_STR_CURRENCYRATE_POPUP_DELAY_TIMEOUT "PopupDelayTimeout" +#define DB_STR_CURRENCYRATE_POPUP_HISTORY_FLAG "PopupHistoryFlag" // #define DB_STR_NICK "Nick" diff --git a/plugins/CurrencyRates/src/ExtraImages.cpp b/plugins/CurrencyRates/src/ExtraImages.cpp index 2111ccf089..686f4e34e7 100644 --- a/plugins/CurrencyRates/src/ExtraImages.cpp +++ b/plugins/CurrencyRates/src/ExtraImages.cpp @@ -2,9 +2,9 @@ static HANDLE hExtraIcon; -void Quotes_InitExtraIcons() +void CurrencyRates_InitExtraIcons() { - hExtraIcon = ExtraIcon_RegisterIcolib(ICON_STR_QUOTE, QUOTES_PROTOCOL_NAME, QUOTES_PROTOCOL_NAME "_" ICON_STR_MAIN); + hExtraIcon = ExtraIcon_RegisterIcolib(ICON_STR_CURRENCYRATE, CURRENCYRATES_PROTOCOL_NAME, CURRENCYRATES_PROTOCOL_NAME "_" ICON_STR_MAIN); } bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex) @@ -15,13 +15,13 @@ bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex) HANDLE hIcolib; switch (nIndex) { case eiUp: - hIcolib = Quotes_GetIconHandle(IDI_ICON_UP); + hIcolib = CurrencyRates_GetIconHandle(IDI_ICON_UP); break; case eiDown: - hIcolib = Quotes_GetIconHandle(IDI_ICON_DOWN); + hIcolib = CurrencyRates_GetIconHandle(IDI_ICON_DOWN); break; case eiNotChanged: - hIcolib = Quotes_GetIconHandle(IDI_ICON_NOTCHANGED); + hIcolib = CurrencyRates_GetIconHandle(IDI_ICON_NOTCHANGED); break; default: hIcolib = nullptr; diff --git a/plugins/CurrencyRates/src/ExtraImages.h b/plugins/CurrencyRates/src/ExtraImages.h index 4888203a6d..b3ef9deaa6 100644 --- a/plugins/CurrencyRates/src/ExtraImages.h +++ b/plugins/CurrencyRates/src/ExtraImages.h @@ -11,6 +11,6 @@ enum EImageIndex bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex); -void Quotes_InitExtraIcons(void); +void CurrencyRates_InitExtraIcons(void); #endif //__9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__ diff --git a/plugins/CurrencyRates/src/Forex.cpp b/plugins/CurrencyRates/src/Forex.cpp index 6a1845cf93..cd4e6dfd53 100644 --- a/plugins/CurrencyRates/src/Forex.cpp +++ b/plugins/CurrencyRates/src/Forex.cpp @@ -22,34 +22,34 @@ THandles g_ahThreads; HGENMENU g_hEnableDisableMenu; HANDLE g_hTBButton; -LPSTR g_pszAutoUpdateCmd = "Quotes/Enable-Disable Auto Update"; -LPSTR g_pszCurrencyConverter = "Quotes/CurrencyConverter"; +LPSTR g_pszAutoUpdateCmd = "CurrencyRates/Enable-Disable Auto Update"; +LPSTR g_pszCurrencyConverter = "CurrencyRates/CurrencyConverter"; void UpdateMenu(bool bAutoUpdate) { if (bAutoUpdate) // to enable auto-update - Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Enabled"), Quotes_GetIconHandle(IDI_ICON_MAIN)); + Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Enabled"), CurrencyRates_GetIconHandle(IDI_ICON_MAIN)); else // to disable auto-update - Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Disabled"), Quotes_GetIconHandle(IDI_ICON_DISABLED)); + Menu_ModifyItem(g_hEnableDisableMenu, LPGENW("Auto Update Disabled"), CurrencyRates_GetIconHandle(IDI_ICON_DISABLED)); CallService(MS_TTB_SETBUTTONSTATE, reinterpret_cast<WPARAM>(g_hTBButton), !bAutoUpdate ? TTBST_PUSHED : 0); } -INT_PTR QuotesMenu_RefreshAll(WPARAM, LPARAM) +INT_PTR CurrencyRatesMenu_RefreshAll(WPARAM, LPARAM) { - const CQuotesProviders::TQuotesProviders& apProviders = CModuleInfo::GetQuoteProvidersPtr()->GetProviders(); - std::for_each(apProviders.begin(), apProviders.end(), boost::bind(&IQuotesProvider::RefreshAllContacts, _1)); + const CCurrencyRatesProviders::TCurrencyRatesProviders& apProviders = CModuleInfo::GetCurrencyRateProvidersPtr()->GetProviders(); + std::for_each(apProviders.begin(), apProviders.end(), boost::bind(&ICurrencyRatesProvider::RefreshAllContacts, _1)); return 0; } -INT_PTR QuotesMenu_EnableDisable(WPARAM, LPARAM) +INT_PTR CurrencyRatesMenu_EnableDisable(WPARAM, LPARAM) { g_bAutoUpdate = (g_bAutoUpdate) ? false : true; - db_set_b(NULL, QUOTES_MODULE_NAME, DB_STR_AUTO_UPDATE, g_bAutoUpdate); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_AUTO_UPDATE, g_bAutoUpdate); - const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); - const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders(); - std::for_each(std::begin(rapProviders), std::end(rapProviders), [](const CQuotesProviders::TQuotesProviderPtr& pProvider) { + const CModuleInfo::TCurrencyRatesProvidersPtr& pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); + const CCurrencyRatesProviders::TCurrencyRatesProviders& rapProviders = pProviders->GetProviders(); + std::for_each(std::begin(rapProviders), std::end(rapProviders), [](const CCurrencyRatesProviders::TCurrencyRatesProviderPtr& pProvider) { pProvider->RefreshSettings(); if (g_bAutoUpdate) pProvider->RefreshAllContacts(); @@ -63,102 +63,102 @@ void InitMenu() { CMenuItem mi(&g_plugin); mi.flags = CMIF_UNICODE; - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Currency rates"), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Currency rates"), 0, CurrencyRates_GetIconHandle(IDI_ICON_MAIN)); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "B474F556-22B6-42A1-A91E-22FE4F671388"); SET_UID(mi, 0x9de6716, 0x3591, 0x48c4, 0x9f, 0x64, 0x1b, 0xfd, 0xc6, 0xd1, 0x34, 0x97); mi.name.w = LPGENW("Enable/Disable Auto Update"); mi.position = 10100001; - mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); + mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_MAIN); mi.pszService = g_pszAutoUpdateCmd; g_hEnableDisableMenu = Menu_AddMainMenuItem(&mi); - CreateServiceFunction(mi.pszService, QuotesMenu_EnableDisable); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_EnableDisable); UpdateMenu(g_bAutoUpdate); SET_UID(mi, 0x91cbabf6, 0x5073, 0x4a78, 0x84, 0x8, 0x34, 0x61, 0xc1, 0x8a, 0x34, 0xd9); mi.name.w = LPGENW("Refresh All Rates"); mi.position = 20100001; - mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); - mi.pszService = "Quotes/RefreshAll"; + mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_MAIN); + mi.pszService = "CurrencyRates/RefreshAll"; Menu_AddMainMenuItem(&mi); - CreateServiceFunction(mi.pszService, QuotesMenu_RefreshAll); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_RefreshAll); SET_UID(mi, 0x3663409c, 0xbd36, 0x473b, 0x9b, 0x4f, 0xff, 0x80, 0xf6, 0x2c, 0xdf, 0x9b); mi.name.w = LPGENW("Currency Converter..."); mi.position = 20100002; - mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); + mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); mi.pszService = g_pszCurrencyConverter; Menu_AddMainMenuItem(&mi); - CreateServiceFunction(mi.pszService, QuotesMenu_CurrencyConverter); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_CurrencyConverter); SET_UID(mi, 0x7cca4fd9, 0x903f, 0x4b7d, 0x93, 0x7a, 0x18, 0x63, 0x23, 0xd4, 0xa9, 0xa9); mi.name.w = LPGENW("Export All Currency Rates"); - mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_EXPORT); - mi.pszService = "Quotes/ExportAll"; + mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_EXPORT); + mi.pszService = "CurrencyRates/ExportAll"; mi.position = 20100003; Menu_AddMainMenuItem(&mi); - CreateServiceFunction(mi.pszService, QuotesMenu_ExportAll); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_ExportAll); SET_UID(mi, 0xa994d3b, 0x77c2, 0x4612, 0x8d, 0x5, 0x6a, 0xae, 0x8c, 0x21, 0xbd, 0xc9); mi.name.w = LPGENW("Import All Currency Rates"); - mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_IMPORT); - mi.pszService = "Quotes/ImportAll"; + mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_IMPORT); + mi.pszService = "CurrencyRates/ImportAll"; mi.position = 20100004; Menu_AddMainMenuItem(&mi); - CreateServiceFunction(mi.pszService, QuotesMenu_ImportAll); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_ImportAll); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CurrencyRates_PrebuildContactMenu); - g_hMenuRoot = mi.root = g_plugin.addRootMenu(MO_CONTACT, _T(QUOTES_PROTOCOL_NAME), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); + g_hMenuRoot = mi.root = g_plugin.addRootMenu(MO_CONTACT, LPGENW("Currency rates"), 0, CurrencyRates_GetIconHandle(IDI_ICON_MAIN)); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "C259BE01-642C-461E-997D-0E756B2A3AD6"); SET_UID(mi, 0xb9812194, 0x3235, 0x4e76, 0xa3, 0xa4, 0x73, 0x32, 0x96, 0x1c, 0x1c, 0xf4); mi.name.w = LPGENW("Refresh"); - mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH); - mi.pszService = "Quotes/RefreshContact"; - g_hMenuRefresh = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); + mi.hIcolibItem = CurrencyRates_GetIconHandle(IDI_ICON_REFRESH); + mi.pszService = "CurrencyRates/RefreshContact"; + g_hMenuRefresh = Menu_AddContactMenuItem(&mi, CURRENCYRATES_PROTOCOL_NAME); Menu_ConfigureItem(g_hMenuRefresh, MCI_OPT_EXECPARAM, INT_PTR(0)); - CreateServiceFunction(mi.pszService, QuotesMenu_RefreshContact); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_RefreshContact); SET_UID(mi, 0x19a16fa2, 0xf370, 0x4201, 0x92, 0x9, 0x25, 0xde, 0x4e, 0x55, 0xf9, 0x1a); mi.name.w = LPGENW("Open Log File..."); mi.hIcolibItem = nullptr; - mi.pszService = "Quotes/OpenLogFile"; - g_hMenuOpenLogFile = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); + mi.pszService = "CurrencyRates/OpenLogFile"; + g_hMenuOpenLogFile = Menu_AddContactMenuItem(&mi, CURRENCYRATES_PROTOCOL_NAME); Menu_ConfigureItem(g_hMenuOpenLogFile, MCI_OPT_EXECPARAM, 1); - CreateServiceFunction(mi.pszService, QuotesMenu_OpenLogFile); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_OpenLogFile); #ifdef CHART_IMPLEMENT SET_UID(mi, 0x65da7256, 0x43a2, 0x4857, 0xac, 0x52, 0x1c, 0xb7, 0xff, 0xd7, 0x96, 0xfa); mi.name.w = LPGENW("Chart..."); mi.hIcolibItem = nullptr; - mi.pszService = "Quotes/Chart"; - g_hMenuChart = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); - CreateServiceFunction(mi.pszService, QuotesMenu_Chart); + mi.pszService = "CurrencyRates/Chart"; + g_hMenuChart = Menu_AddContactMenuItem(&mi, CURRENCYRATES_PROTOCOL_NAME); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_Chart); #endif SET_UID(mi, 0xac5fc17, 0x5640, 0x4f81, 0xa3, 0x44, 0x8c, 0xb6, 0x9a, 0x5c, 0x98, 0xf); mi.name.w = LPGENW("Edit Settings..."); mi.hIcolibItem = nullptr; - mi.pszService = "Quotes/EditSettings"; - g_hMenuEditSettings = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); + mi.pszService = "CurrencyRates/EditSettings"; + g_hMenuEditSettings = Menu_AddContactMenuItem(&mi, CURRENCYRATES_PROTOCOL_NAME); #ifdef CHART_IMPLEMENT Menu_ConfigureItem(g_hMenuEditSettings, MCI_OPT_EXECPARAM, 3); #else Menu_ConfigureItem(g_hMenuEditSettings, MCI_OPT_EXECPARAM, 2); #endif - CreateServiceFunction(mi.pszService, QuotesMenu_EditSettings); + CreateServiceFunction(mi.pszService, CurrencyRatesMenu_EditSettings); } -int Quotes_OnToolbarLoaded(WPARAM, LPARAM) +int CurrencyRates_OnToolbarLoaded(WPARAM, LPARAM) { TTBButton ttb = {}; ttb.name = LPGEN("Enable/Disable Currency Rates Auto Update"); ttb.pszService = g_pszAutoUpdateCmd; ttb.pszTooltipUp = LPGEN("Currency Rates Auto Update Enabled"); ttb.pszTooltipDn = LPGEN("Currency Rates Auto Update Disabled"); - ttb.hIconHandleUp = Quotes_GetIconHandle(IDI_ICON_MAIN); - ttb.hIconHandleDn = Quotes_GetIconHandle(IDI_ICON_DISABLED); + ttb.hIconHandleUp = CurrencyRates_GetIconHandle(IDI_ICON_MAIN); + ttb.hIconHandleDn = CurrencyRates_GetIconHandle(IDI_ICON_DISABLED); ttb.dwFlags = ((g_bAutoUpdate) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE; g_hTBButton = g_plugin.addTTB(&ttb); @@ -166,8 +166,8 @@ int Quotes_OnToolbarLoaded(WPARAM, LPARAM) ttb.pszService = g_pszCurrencyConverter; ttb.pszTooltipUp = LPGEN("Currency Converter"); ttb.pszTooltipDn = LPGEN("Currency Converter"); - ttb.hIconHandleUp = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); - ttb.hIconHandleDn = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); + ttb.hIconHandleUp = CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); + ttb.hIconHandleDn = CurrencyRates_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); ttb.dwFlags = TTBBF_VISIBLE; g_plugin.addTTB(&ttb); @@ -176,53 +176,53 @@ int Quotes_OnToolbarLoaded(WPARAM, LPARAM) static void WorkingThread(void *pParam) { - IQuotesProvider *pProvider = reinterpret_cast<IQuotesProvider*>(pParam); + ICurrencyRatesProvider *pProvider = reinterpret_cast<ICurrencyRatesProvider*>(pParam); assert(pProvider); if (pProvider) pProvider->Run(); } -int QuotesEventFunc_OnModulesLoaded(WPARAM, LPARAM) +int CurrencyRatesEventFunc_OnModulesLoaded(WPARAM, LPARAM) { CHTTPSession::Init(); g_hEventWorkThreadStop = ::CreateEvent(nullptr, TRUE, FALSE, nullptr); - HookEvent(ME_USERINFO_INITIALISE, QuotesEventFunc_OnUserInfoInit); + HookEvent(ME_USERINFO_INITIALISE, CurrencyRatesEventFunc_OnUserInfoInit); - HookEvent(ME_CLIST_DOUBLECLICKED, Quotes_OnContactDoubleClick); + HookEvent(ME_CLIST_DOUBLECLICKED, CurrencyRates_OnContactDoubleClick); - HookEvent(ME_TTB_MODULELOADED, Quotes_OnToolbarLoaded); + HookEvent(ME_TTB_MODULELOADED, CurrencyRates_OnToolbarLoaded); - g_bAutoUpdate = 1 == db_get_b(NULL, QUOTES_MODULE_NAME, DB_STR_AUTO_UPDATE, 1); + g_bAutoUpdate = 1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_AUTO_UPDATE, 1); InitMenu(); BOOL b = ::ResetEvent(g_hEventWorkThreadStop); assert(b && "Failed to reset event"); - const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); - const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders(); - for (CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin(); i != rapProviders.end(); ++i) { - const CQuotesProviders::TQuotesProviderPtr& pProvider = *i; + const CModuleInfo::TCurrencyRatesProvidersPtr& pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); + const CCurrencyRatesProviders::TCurrencyRatesProviders& rapProviders = pProviders->GetProviders(); + for (CCurrencyRatesProviders::TCurrencyRatesProviders::const_iterator i = rapProviders.begin(); i != rapProviders.end(); ++i) { + const CCurrencyRatesProviders::TCurrencyRatesProviderPtr& pProvider = *i; g_ahThreads.push_back(mir_forkthread(WorkingThread, pProvider.get())); } return 0; } -int QuotesEventFunc_OnContactDeleted(WPARAM wParam, LPARAM) +int CurrencyRatesEventFunc_OnContactDeleted(WPARAM wParam, LPARAM) { MCONTACT hContact = MCONTACT(wParam); - const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); - CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); + const CModuleInfo::TCurrencyRatesProvidersPtr& pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); if (pProvider) pProvider->DeleteContact(hContact); return 0; } -INT_PTR QuoteProtoFunc_GetCaps(WPARAM wParam, LPARAM) +INT_PTR CurrencyRateProtoFunc_GetCaps(WPARAM wParam, LPARAM) { switch (wParam) { case PFLAG_UNIQUEIDTEXT: @@ -232,7 +232,7 @@ INT_PTR QuoteProtoFunc_GetCaps(WPARAM wParam, LPARAM) return 0; } -INT_PTR QuoteProtoFunc_GetStatus(WPARAM, LPARAM) +INT_PTR CurrencyRateProtoFunc_GetStatus(WPARAM, LPARAM) { return g_bAutoUpdate ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; } @@ -247,7 +247,7 @@ void WaitForWorkingThreads() } -int QuotesEventFunc_PreShutdown(WPARAM, LPARAM) +int CurrencyRatesEventFunc_PreShutdown(WPARAM, LPARAM) { ::SetEvent(g_hEventWorkThreadStop); @@ -255,22 +255,22 @@ int QuotesEventFunc_PreShutdown(WPARAM, LPARAM) return 0; } -int QuotesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/) +int CurrencyRatesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/) { - const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); - const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders(); + const CModuleInfo::TCurrencyRatesProvidersPtr& pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); + const CCurrencyRatesProviders::TCurrencyRatesProviders& rapProviders = pProviders->GetProviders(); OPTIONSDIALOGPAGE odp = {}; odp.position = 910000000; - odp.szTitle.w = _T(QUOTES_PROTOCOL_NAME); + odp.szTitle.w = LPGENW("Currency Rates"); odp.szGroup.w = LPGENW("Network"); odp.flags = ODPF_USERINFOTAB | ODPF_UNICODE; - std::for_each(rapProviders.begin(), rapProviders.end(), boost::bind(&IQuotesProvider::ShowPropertyPage, _1, wp, boost::ref(odp))); + std::for_each(rapProviders.begin(), rapProviders.end(), boost::bind(&ICurrencyRatesProvider::ShowPropertyPage, _1, wp, boost::ref(odp))); return 0; } -inline int Quotes_UnhookEvent(HANDLE h) +inline int CurrencyRates_UnhookEvent(HANDLE h) { return UnhookEvent(h); } @@ -296,10 +296,10 @@ PLUGININFOEX pluginInfoEx = }; CMPlugin::CMPlugin() : - PLUGIN<CMPlugin>(QUOTES_PROTOCOL_NAME, pluginInfoEx) + PLUGIN<CMPlugin>(CURRENCYRATES_PROTOCOL_NAME, pluginInfoEx) { RegisterProtocol(PROTOTYPE_VIRTUAL); - SetUniqueId(DB_STR_QUOTE_SYMBOL); + SetUniqueId(DB_STR_CURRENCYRATE_SYMBOL); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -309,19 +309,19 @@ int CMPlugin::Load(void) if (!CModuleInfo::Verify()) return 1; - Quotes_IconsInit(); - Quotes_InitExtraIcons(); + CurrencyRates_IconsInit(); + CurrencyRates_InitExtraIcons(); - CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETCAPS, QuoteProtoFunc_GetCaps); - CreateProtoServiceFunction(QUOTES_PROTOCOL_NAME, PS_GETSTATUS, QuoteProtoFunc_GetStatus); + CreateProtoServiceFunction(CURRENCYRATES_PROTOCOL_NAME, PS_GETCAPS, CurrencyRateProtoFunc_GetCaps); + CreateProtoServiceFunction(CURRENCYRATES_PROTOCOL_NAME, PS_GETSTATUS, CurrencyRateProtoFunc_GetStatus); - HookEvent(ME_SYSTEM_MODULESLOADED, QuotesEventFunc_OnModulesLoaded); - HookEvent(ME_DB_CONTACT_DELETED, QuotesEventFunc_OnContactDeleted); - HookEvent(ME_SYSTEM_PRESHUTDOWN, QuotesEventFunc_PreShutdown); - HookEvent(ME_OPT_INITIALISE, QuotesEventFunc_OptInitialise); + HookEvent(ME_SYSTEM_MODULESLOADED, CurrencyRatesEventFunc_OnModulesLoaded); + HookEvent(ME_DB_CONTACT_DELETED, CurrencyRatesEventFunc_OnContactDeleted); + HookEvent(ME_SYSTEM_PRESHUTDOWN, CurrencyRatesEventFunc_PreShutdown); + HookEvent(ME_OPT_INITIALISE, CurrencyRatesEventFunc_OptInitialise); - CreateServiceFunction(MS_QUOTES_EXPORT, Quotes_Export); - CreateServiceFunction(MS_QUOTES_IMPORT, Quotes_Import); + CreateServiceFunction(MS_CURRENCYRATES_EXPORT, CurrencyRates_Export); + CreateServiceFunction(MS_CURRENCYRATES_IMPORT, CurrencyRates_Import); return 0; } diff --git a/plugins/CurrencyRates/src/HTTPSession.cpp b/plugins/CurrencyRates/src/HTTPSession.cpp index 20f3498e8a..f7cb9cfb85 100644 --- a/plugins/CurrencyRates/src/HTTPSession.cpp +++ b/plugins/CurrencyRates/src/HTTPSession.cpp @@ -34,8 +34,8 @@ public: NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; - nlu.szSettingsModule = QUOTES_PROTOCOL_NAME; - nlu.szDescriptiveName.w = TranslateT("Quotes HTTP connections"); + nlu.szSettingsModule = CURRENCYRATES_PROTOCOL_NAME; + nlu.szDescriptiveName.w = TranslateT("CurrencyRates HTTP connections"); g_hNetLib = Netlib_RegisterUser(&nlu); return (nullptr != g_hNetLib); } @@ -46,7 +46,7 @@ public: { m_aURL.clear(); - std::string s = quotes_t2a(rsURL.c_str()); + std::string s = currencyrates_t2a(rsURL.c_str()); const char* psz = s.c_str(); m_aURL.insert(m_aURL.begin(), psz, psz + mir_strlen(psz) + 1); return true; @@ -102,7 +102,7 @@ public: else { // USES_CONVERSION; // LPCTSTR p = A2CT(pResult); - rsResponce = quotes_a2t(pResult);//p; + rsResponce = currencyrates_a2t(pResult);//p; } bResult = true; diff --git a/plugins/CurrencyRates/src/IQuotesProvider.h b/plugins/CurrencyRates/src/ICurrencyRatesProvider.h index 763248aa7f..cbdb467bf5 100644 --- a/plugins/CurrencyRates/src/IQuotesProvider.h +++ b/plugins/CurrencyRates/src/ICurrencyRatesProvider.h @@ -1,11 +1,11 @@ #pragma once -#ifndef __ac71e133_786c_41a7_ab07_625b76ff2a8c_QuotesProvider_h__ -#define __ac71e133_786c_41a7_ab07_625b76ff2a8c_QuotesProvider_h__ +#ifndef __ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__ +#define __ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__ -class CQuotesProviderVisitor; +class CCurrencyRatesProviderVisitor; -class IQuotesProvider : private boost::noncopyable +class ICurrencyRatesProvider : private boost::noncopyable { public: struct CProviderInfo @@ -16,8 +16,8 @@ public: }; public: - IQuotesProvider() {} - virtual ~IQuotesProvider() {} + ICurrencyRatesProvider() {} + virtual ~ICurrencyRatesProvider() {} virtual bool Init() = 0; virtual const CProviderInfo& GetInfo()const = 0; @@ -33,7 +33,7 @@ public: virtual void Run() = 0; - virtual void Accept(CQuotesProviderVisitor& visitor)const = 0; + virtual void Accept(CCurrencyRatesProviderVisitor& visitor)const = 0; }; -#endif //__ac71e133_786c_41a7_ab07_625b76ff2a8c_QuotesProvider_h__ +#endif //__ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__ diff --git a/plugins/CurrencyRates/src/IconLib.cpp b/plugins/CurrencyRates/src/IconLib.cpp index 9e0a079edc..52a3ca1acf 100644 --- a/plugins/CurrencyRates/src/IconLib.cpp +++ b/plugins/CurrencyRates/src/IconLib.cpp @@ -4,11 +4,11 @@ static IconItem iconList[] = { { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN }, { LPGEN("Auto Update Disabled"), "auto_update_disabled", IDI_ICON_DISABLED }, - { LPGEN("Quote/Rate up"), "quote_up", IDI_ICON_UP }, - { LPGEN("Quote/Rate down"), "quote_down", IDI_ICON_DOWN }, - { LPGEN("Quote/Rate not changed"), "quote_not_changed", IDI_ICON_NOTCHANGED }, - { LPGEN("Quote Section"), "quote_section", IDI_ICON_SECTION }, - { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE }, + { LPGEN("CurrencyRate/Rate up"), "currencyrate_up", IDI_ICON_UP }, + { LPGEN("CurrencyRate/Rate down"), "currencyrate_down", IDI_ICON_DOWN }, + { LPGEN("CurrencyRate/Rate not changed"), "currencyrate_not_changed", IDI_ICON_NOTCHANGED }, + { LPGEN("CurrencyRate Section"), "currencyrate_section", IDI_ICON_SECTION }, + { LPGEN("CurrencyRate"), ICON_STR_CURRENCYRATE, IDI_ICON_CURRENCYRATE }, { LPGEN("Currency Converter"), "currency_converter", IDI_ICON_CURRENCY_CONVERTER }, { LPGEN("Refresh"), "refresh", IDI_ICON_REFRESH }, { LPGEN("Export"), "export", IDI_ICON_EXPORT }, @@ -16,12 +16,12 @@ static IconItem iconList[] = { LPGEN("Import"), "import", IDI_ICON_IMPORT } }; -void Quotes_IconsInit() +void CurrencyRates_IconsInit() { - ::g_plugin.registerIcon(QUOTES_PROTOCOL_NAME, iconList, QUOTES_PROTOCOL_NAME); + ::g_plugin.registerIcon(CURRENCYRATES_PROTOCOL_NAME, iconList, CURRENCYRATES_PROTOCOL_NAME); } -HICON Quotes_LoadIconEx(int iconId, bool bBig /*= false*/) +HICON CurrencyRates_LoadIconEx(int iconId, bool bBig /*= false*/) { for (int i = 0; i < _countof(iconList); i++) if (iconList[i].defIconID == iconId) @@ -30,7 +30,7 @@ HICON Quotes_LoadIconEx(int iconId, bool bBig /*= false*/) return nullptr; } -HANDLE Quotes_GetIconHandle(int iconId) +HANDLE CurrencyRates_GetIconHandle(int iconId) { for (int i = 0; i < _countof(iconList); i++) if (iconList[i].defIconID == iconId) diff --git a/plugins/CurrencyRates/src/IconLib.h b/plugins/CurrencyRates/src/IconLib.h index fff9e3a571..4e0146fba8 100644 --- a/plugins/CurrencyRates/src/IconLib.h +++ b/plugins/CurrencyRates/src/IconLib.h @@ -2,10 +2,10 @@ #define __8821d334_afac_439e_9a81_76318e1ac4ef_IconLib_h__ #define ICON_STR_MAIN "main" -#define ICON_STR_QUOTE "quote" +#define ICON_STR_CURRENCYRATE "currencyrate" -void Quotes_IconsInit(); -HICON Quotes_LoadIconEx(int iconId, bool bBig = false); -HANDLE Quotes_GetIconHandle(int iconId); +void CurrencyRates_IconsInit(); +HICON CurrencyRates_LoadIconEx(int iconId, bool bBig = false); +HANDLE CurrencyRates_GetIconHandle(int iconId); #endif //__8821d334_afac_439e_9a81_76318e1ac4ef_IconLib_h__ diff --git a/plugins/CurrencyRates/src/ImportExport.cpp b/plugins/CurrencyRates/src/ImportExport.cpp index 31bdd33913..98317a56c7 100644 --- a/plugins/CurrencyRates/src/ImportExport.cpp +++ b/plugins/CurrencyRates/src/ImportExport.cpp @@ -1,5 +1,5 @@ #include "StdAfx.h" -#include "QuotesProviderCurrencyConverter.h" +#include "CurrencyRatesProviderCurrencyConverter.h" LPCTSTR g_pszXmlValue = L"Value"; LPCTSTR g_pszXmlName = L"Name"; @@ -83,7 +83,7 @@ static int enum_contact_settings(const char* szSetting, void *lp) IXMLNode::TXMLNodePtr pXmlSet = ctx->m_pXmlEngine->CreateNode(g_pszXmlSetting, tstring()); if (pXmlSet) { - IXMLNode::TXMLNodePtr pXmlName = ctx->m_pXmlEngine->CreateNode(g_pszXmlName, quotes_a2t(szSetting)); + IXMLNode::TXMLNodePtr pXmlName = ctx->m_pXmlEngine->CreateNode(g_pszXmlName, currencyrates_a2t(szSetting)); IXMLNode::TXMLNodePtr pXmlValue = ctx->m_pXmlEngine->CreateNode(g_pszXmlValue, sValue.str()); if (pXmlName && pXmlValue) { @@ -103,7 +103,7 @@ int EnumDbModules(const char *szModuleName, void *lp) { CEnumContext *ctx = (CEnumContext*)lp; IXMLNode::TXMLNodePtr pXml = ctx->m_pNode; - IXMLNode::TXMLNodePtr pModule = ctx->m_pXmlEngine->CreateNode(g_pszXmlModule, quotes_a2t(szModuleName)/*A2CT(szModuleName)*/); + IXMLNode::TXMLNodePtr pModule = ctx->m_pXmlEngine->CreateNode(g_pszXmlModule, currencyrates_a2t(szModuleName)/*A2CT(szModuleName)*/); if (pModule) { ctx->m_pszModule = szModuleName; ctx->m_pNode = pModule; @@ -200,7 +200,7 @@ bool show_open_file_dialog(bool bOpen, tstring& rsFile) return true; } -INT_PTR Quotes_Export(WPARAM wp, LPARAM lp) +INT_PTR CurrencyRates_Export(WPARAM wp, LPARAM lp) { tstring sFileName; const char* pszFile = reinterpret_cast<const char*>(lp); @@ -208,14 +208,14 @@ INT_PTR Quotes_Export(WPARAM wp, LPARAM lp) if (false == show_open_file_dialog(false, sFileName)) return -1; } - else sFileName = quotes_a2t(pszFile);//A2CT(pszFile); + else sFileName = currencyrates_a2t(pszFile);//A2CT(pszFile); CModuleInfo::TXMLEnginePtr pXmlEngine = CModuleInfo::GetInstance().GetXMLEnginePtr(); - CModuleInfo::TQuotesProvidersPtr pProviders = CModuleInfo::GetInstance().GetQuoteProvidersPtr(); + CModuleInfo::TCurrencyRatesProvidersPtr pProviders = CModuleInfo::GetInstance().GetCurrencyRateProvidersPtr(); IXMLNode::TXMLNodePtr pRoot = pXmlEngine->CreateNode(g_pszXmlContacts, tstring()); MCONTACT hContact = MCONTACT(wp); if (hContact) { - CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); if (pProvider) { IXMLNode::TXMLNodePtr pNode = export_contact(hContact, pXmlEngine); if (pNode) @@ -223,8 +223,8 @@ INT_PTR Quotes_Export(WPARAM wp, LPARAM lp) } } else { - for (auto &cc : Contacts(QUOTES_MODULE_NAME)) { - CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(cc); + for (auto &cc : Contacts(CURRENCYRATES_MODULE_NAME)) { + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = pProviders->GetContactProviderPtr(cc); if (pProvider) { IXMLNode::TXMLNodePtr pNode = export_contact(cc, pXmlEngine); if (pNode) @@ -248,7 +248,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) tstring sModuleName = pXmlModule->GetText(); if (false == sModuleName.empty()) { DBCONTACTWRITESETTING dbs; - std::string s = quotes_t2a(sModuleName.c_str()); + std::string s = currencyrates_t2a(sModuleName.c_str()); dbs.szModule = s.c_str();//T2CA(sModuleName.c_str()); bool bCListModule = 0 == mir_wstrcmpi(sModuleName.c_str(), L"CList"); @@ -276,7 +276,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule) } if ((false == sName.empty()) && (false == sType.empty())) { - std::string s1 = quotes_t2a(sName.c_str()); + std::string s1 = currencyrates_t2a(sName.c_str()); dbs.szSetting = s1.c_str(); if (0 == mir_wstrcmpi(g_pszXmlTypeByte, sType.c_str())) { tistringstream in(sValue.c_str()); @@ -390,19 +390,19 @@ struct CContactState { CContactState() : m_hContact(NULL), m_bNewContact(false) {} MCONTACT m_hContact; - CQuotesProviders::TQuotesProviderPtr m_pProvider; + CCurrencyRatesProviders::TCurrencyRatesProviderPtr m_pProvider; bool m_bNewContact; }; -IXMLNode::TXMLNodePtr find_quotes_module(const IXMLNode::TXMLNodePtr& pXmlContact) +IXMLNode::TXMLNodePtr find_currencyrates_module(const IXMLNode::TXMLNodePtr& pXmlContact) { - static const tstring g_sQuotes = quotes_a2t(QUOTES_MODULE_NAME); + static const tstring g_sCurrencyRates = currencyrates_a2t(CURRENCYRATES_MODULE_NAME); size_t cChild = pXmlContact->GetChildCount(); for (size_t i = 0; i < cChild; ++i) { IXMLNode::TXMLNodePtr pNode = pXmlContact->GetChildNode(i); tstring sName = pNode->GetName(); if ((0 == mir_wstrcmpi(g_pszXmlModule, sName.c_str())) - && (0 == mir_wstrcmpi(g_sQuotes.c_str(), pNode->GetText().c_str()))) { + && (0 == mir_wstrcmpi(g_sCurrencyRates.c_str(), pNode->GetText().c_str()))) { return pNode; } } @@ -432,47 +432,47 @@ TNameValue parse_setting_node(const IXMLNode::TXMLNodePtr& pXmlSetting) return std::make_pair(sName, sValue); } -CQuotesProviders::TQuotesProviderPtr find_provider(const IXMLNode::TXMLNodePtr& pXmlQuotesModule) +CCurrencyRatesProviders::TCurrencyRatesProviderPtr find_provider(const IXMLNode::TXMLNodePtr& pXmlCurrencyRatesModule) { // USES_CONVERSION; - static const tstring g_sQuotesProvider = quotes_a2t(DB_STR_QUOTE_PROVIDER);//A2CT(DB_STR_QUOTE_PROVIDER); - size_t cChild = pXmlQuotesModule->GetChildCount(); + static const tstring g_sCurrencyRatesProvider = currencyrates_a2t(DB_STR_CURRENCYRATE_PROVIDER);//A2CT(DB_STR_CURRENCYRATE_PROVIDER); + size_t cChild = pXmlCurrencyRatesModule->GetChildCount(); for (size_t i = 0; i < cChild; ++i) { - IXMLNode::TXMLNodePtr pXMLSetting = pXmlQuotesModule->GetChildNode(i); + IXMLNode::TXMLNodePtr pXMLSetting = pXmlCurrencyRatesModule->GetChildNode(i); if (pXMLSetting && (0 == mir_wstrcmpi(g_pszXmlSetting, pXMLSetting->GetName().c_str()))) { TNameValue Item = parse_setting_node(pXMLSetting); - if ((0 == mir_wstrcmpi(g_sQuotesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty())) { - return CModuleInfo::GetInstance().GetQuoteProvidersPtr()->FindProvider(Item.second); + if ((0 == mir_wstrcmpi(g_sCurrencyRatesProvider.c_str(), Item.first.c_str())) && (false == Item.second.empty())) { + return CModuleInfo::GetInstance().GetCurrencyRateProvidersPtr()->FindProvider(Item.second); } } } - return CQuotesProviders::TQuotesProviderPtr(); + return CCurrencyRatesProviders::TCurrencyRatesProviderPtr(); } bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState& cst) { - class visitor : public CQuotesProviderVisitor + class visitor : public CCurrencyRatesProviderVisitor { public: - visitor(const IXMLNode::TXMLNodePtr& pXmlQuotes) - : m_hContact(NULL), m_pXmlQuotes(pXmlQuotes) + visitor(const IXMLNode::TXMLNodePtr& pXmlCurrencyRates) + : m_hContact(NULL), m_pXmlCurrencyRates(pXmlCurrencyRates) { } MCONTACT GetContact()const { return m_hContact; } private: - virtual void Visit(const CQuotesProviderCurrencyConverter& rProvider)override + virtual void Visit(const CCurrencyRatesProviderCurrencyConverter& rProvider)override { - static const tstring g_sFromID = quotes_a2t(DB_STR_FROM_ID);//A2CT(DB_STR_FROM_ID); - static const tstring g_sToID = quotes_a2t(DB_STR_TO_ID);//A2CT(DB_STR_TO_ID); + static const tstring g_sFromID = currencyrates_a2t(DB_STR_FROM_ID);//A2CT(DB_STR_FROM_ID); + static const tstring g_sToID = currencyrates_a2t(DB_STR_TO_ID);//A2CT(DB_STR_TO_ID); tstring sFromID; tstring sToID; - size_t cChild = m_pXmlQuotes->GetChildCount(); + size_t cChild = m_pXmlCurrencyRates->GetChildCount(); for (size_t i = 0; i < cChild; ++i) { - IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i); + IXMLNode::TXMLNodePtr pNode = m_pXmlCurrencyRates->GetChildNode(i); if (pNode && (0 == mir_wstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) { TNameValue Item = parse_setting_node(pNode); if (0 == mir_wstrcmpi(g_sFromID.c_str(), Item.first.c_str())) { @@ -491,12 +491,12 @@ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState& tstring GetXMLNodeValue(const char* pszXMLNodeName)const { - tstring sXMLNodeName = quotes_a2t(pszXMLNodeName); + tstring sXMLNodeName = currencyrates_a2t(pszXMLNodeName); tstring sValue; - size_t cChild = m_pXmlQuotes->GetChildCount(); + size_t cChild = m_pXmlCurrencyRates->GetChildCount(); for (size_t i = 0; i < cChild; ++i) { - IXMLNode::TXMLNodePtr pNode = m_pXmlQuotes->GetChildNode(i); + IXMLNode::TXMLNodePtr pNode = m_pXmlCurrencyRates->GetChildNode(i); if (pNode && (0 == mir_wstrcmpi(g_pszXmlSetting, pNode->GetName().c_str()))) { TNameValue Item = parse_setting_node(pNode); if (0 == mir_wstrcmpi(Item.first.c_str(), sXMLNodeName.c_str())) { @@ -511,14 +511,14 @@ bool get_contact_state(const IXMLNode::TXMLNodePtr& pXmlContact, CContactState& private: MCONTACT m_hContact; - IXMLNode::TXMLNodePtr m_pXmlQuotes; + IXMLNode::TXMLNodePtr m_pXmlCurrencyRates; }; - IXMLNode::TXMLNodePtr pXmlQuotes = find_quotes_module(pXmlContact); - if (pXmlQuotes) { - cst.m_pProvider = find_provider(pXmlQuotes); + IXMLNode::TXMLNodePtr pXmlCurrencyRates = find_currencyrates_module(pXmlContact); + if (pXmlCurrencyRates) { + cst.m_pProvider = find_provider(pXmlCurrencyRates); if (cst.m_pProvider) { - visitor vs(pXmlQuotes); + visitor vs(pXmlCurrencyRates); cst.m_pProvider->Accept(vs); cst.m_hContact = vs.GetContact(); return true; @@ -539,7 +539,7 @@ bool import_contact(const IXMLNode::TXMLNodePtr& pXmlContact, CImportContext& im cst.m_hContact = db_add_contact(); cst.m_bNewContact = true; } - else if (impctx.m_nFlags & QUOTES_IMPORT_SKIP_EXISTING_CONTACTS) + else if (impctx.m_nFlags & CURRENCYRATES_IMPORT_SKIP_EXISTING_CONTACTS) return true; if (cst.m_hContact) { @@ -604,7 +604,7 @@ bool do_import(const IXMLNode::TXMLNodePtr& pXmlRoot, UINT nFlags) return (handle_contacts_node(pXmlRoot, imctx) > 0); } -INT_PTR Quotes_Import(WPARAM wp, LPARAM lp) +INT_PTR CurrencyRates_Import(WPARAM wp, LPARAM lp) { // USES_CONVERSION; @@ -614,7 +614,7 @@ INT_PTR Quotes_Import(WPARAM wp, LPARAM lp) if (false == show_open_file_dialog(true, sFileName)) return -1; } - else sFileName = quotes_a2t(pszFile);//A2CT(pszFile); + else sFileName = currencyrates_a2t(pszFile);//A2CT(pszFile); CModuleInfo::TXMLEnginePtr pXmlEngine = CModuleInfo::GetInstance().GetXMLEnginePtr(); IXMLNode::TXMLNodePtr pXmlRoot = pXmlEngine->LoadFile(sFileName); @@ -624,12 +624,12 @@ INT_PTR Quotes_Import(WPARAM wp, LPARAM lp) return 1; } -INT_PTR QuotesMenu_ImportAll(WPARAM, LPARAM) +INT_PTR CurrencyRatesMenu_ImportAll(WPARAM, LPARAM) { - return CallService(MS_QUOTES_IMPORT, 0, 0); + return CallService(MS_CURRENCYRATES_IMPORT, 0, 0); } -INT_PTR QuotesMenu_ExportAll(WPARAM, LPARAM) +INT_PTR CurrencyRatesMenu_ExportAll(WPARAM, LPARAM) { - return CallService(MS_QUOTES_EXPORT, 0, 0); + return CallService(MS_CURRENCYRATES_EXPORT, 0, 0); } diff --git a/plugins/CurrencyRates/src/ImportExport.h b/plugins/CurrencyRates/src/ImportExport.h index f6f29f68c9..3c167674ce 100644 --- a/plugins/CurrencyRates/src/ImportExport.h +++ b/plugins/CurrencyRates/src/ImportExport.h @@ -1,9 +1,9 @@ #ifndef __F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__ #define __F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__ -INT_PTR Quotes_Export(WPARAM wp, LPARAM lp); -INT_PTR Quotes_Import(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRates_Export(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRates_Import(WPARAM wp, LPARAM lp); -INT_PTR QuotesMenu_ImportAll(WPARAM wp, LPARAM lp); -INT_PTR QuotesMenu_ExportAll(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRatesMenu_ImportAll(WPARAM wp, LPARAM lp); +INT_PTR CurrencyRatesMenu_ExportAll(WPARAM wp, LPARAM lp); #endif //__F86374E6_713C_4600_85FB_903A5CDF7251_IMPORT_EXPORT_H__ diff --git a/plugins/CurrencyRates/src/Locale.cpp b/plugins/CurrencyRates/src/Locale.cpp index f4515b847e..501015eb21 100644 --- a/plugins/CurrencyRates/src/Locale.cpp +++ b/plugins/CurrencyRates/src/Locale.cpp @@ -48,12 +48,12 @@ LPCTSTR time_win_2_boost(const tstring& sFrmt) return L"%H:%M:%S"; } -LPCTSTR Quotes_GetDateFormat(bool bShort) +LPCTSTR CurrencyRates_GetDateFormat(bool bShort) { return date_win_2_boost(get_int_registry_value(bShort ? L"sShortDate" : L"sLongDate")); } -LPCTSTR Quotes_GetTimeFormat(bool bShort) +LPCTSTR CurrencyRates_GetTimeFormat(bool bShort) { return time_win_2_boost(get_int_registry_value(bShort ? L"sShortTime" : L"sTimeFormat")); } diff --git a/plugins/CurrencyRates/src/Locale.h b/plugins/CurrencyRates/src/Locale.h index 1add176847..2ef5e320cb 100644 --- a/plugins/CurrencyRates/src/Locale.h +++ b/plugins/CurrencyRates/src/Locale.h @@ -3,7 +3,7 @@ // std::string GetLocaleInfoString(LCTYPE LCType,LCID Locale = LOCALE_USER_DEFAULT); const std::locale GetSystemLocale(); -LPCTSTR Quotes_GetDateFormat(bool bShort); -LPCTSTR Quotes_GetTimeFormat(bool bShort); +LPCTSTR CurrencyRates_GetDateFormat(bool bShort); +LPCTSTR CurrencyRates_GetTimeFormat(bool bShort); #endif //__11f7afd0_5a66_4029_8bf3_e3c66346b349_Locale_h_ diff --git a/plugins/CurrencyRates/src/Log.cpp b/plugins/CurrencyRates/src/Log.cpp index fcfb0adc35..ebc5e76a43 100644 --- a/plugins/CurrencyRates/src/Log.cpp +++ b/plugins/CurrencyRates/src/Log.cpp @@ -6,7 +6,7 @@ namespace tstring get_log_file_name() { - return CreateFilePath(L"Quotes.log"); + return CreateFilePath(L"CurrencyRates.log"); } bool is_log_enabled() @@ -14,7 +14,7 @@ namespace #ifdef _DEBUG return true; #else - return (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, DB_STR_ENABLE_LOG, false)); + return (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_ENABLE_LOG, false)); #endif } diff --git a/plugins/CurrencyRates/src/ModuleInfo.cpp b/plugins/CurrencyRates/src/ModuleInfo.cpp index f5679630f6..a44eda3d78 100644 --- a/plugins/CurrencyRates/src/ModuleInfo.cpp +++ b/plugins/CurrencyRates/src/ModuleInfo.cpp @@ -42,9 +42,9 @@ void CModuleInfo::OnMirandaShutdown() } } -CModuleInfo::TQuotesProvidersPtr CModuleInfo::GetQuoteProvidersPtr() +CModuleInfo::TCurrencyRatesProvidersPtr CModuleInfo::GetCurrencyRateProvidersPtr() { - static TQuotesProvidersPtr pProviders(new CQuotesProviders); + static TCurrencyRatesProvidersPtr pProviders(new CCurrencyRatesProviders); return pProviders; } @@ -84,13 +84,13 @@ bool CModuleInfo::Verify() return false; if (!GetXMLEnginePtr()) { - Quotes_MessageBox(nullptr, TranslateT("Miranda could not load Quotes plugin. XML parser is missing."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(nullptr, TranslateT("Miranda could not load CurrencyRates plugin. XML parser is missing."), MB_OK | MB_ICONERROR); return false; } if (!g_pHTMLEngine && (false == CHTMLParserMS::IsInstalled())) { - Quotes_MessageBox(nullptr, - TranslateT("Miranda could not load Quotes plugin. Microsoft HTML parser is missing."), + CurrencyRates_MessageBox(nullptr, + TranslateT("Miranda could not load CurrencyRates plugin. Microsoft HTML parser is missing."), MB_YESNO | MB_ICONQUESTION); return false; } diff --git a/plugins/CurrencyRates/src/ModuleInfo.h b/plugins/CurrencyRates/src/ModuleInfo.h index f33a68ff83..b8ee955dfb 100644 --- a/plugins/CurrencyRates/src/ModuleInfo.h +++ b/plugins/CurrencyRates/src/ModuleInfo.h @@ -1,7 +1,7 @@ #ifndef __d0f22b66_3135_4bbe_bee5_a31ea631ce58_ModuleInfo__ #define __d0f22b66_3135_4bbe_bee5_a31ea631ce58_ModuleInfo__ -class CQuotesProviders; +class CCurrencyRatesProviders; class IXMLEngine; class IHTMLEngine; // class IHTMLParser; @@ -9,7 +9,7 @@ class IHTMLEngine; class CModuleInfo { public: - typedef boost::shared_ptr<CQuotesProviders> TQuotesProvidersPtr; + typedef boost::shared_ptr<CCurrencyRatesProviders> TCurrencyRatesProvidersPtr; typedef boost::shared_ptr<IXMLEngine> TXMLEnginePtr; typedef boost::shared_ptr<IHTMLEngine> THTMLEnginePtr; @@ -25,7 +25,7 @@ public: static bool Verify(); - static TQuotesProvidersPtr GetQuoteProvidersPtr(); + static TCurrencyRatesProvidersPtr GetCurrencyRateProvidersPtr(); static TXMLEnginePtr GetXMLEnginePtr(); // static void SetXMLEnginePtr(TXMLEnginePtr pEngine); diff --git a/plugins/CurrencyRates/src/QuoteChart.h b/plugins/CurrencyRates/src/QuoteChart.h deleted file mode 100644 index f42ca17a53..0000000000 --- a/plugins/CurrencyRates/src/QuoteChart.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __39BE8775_A837_494f_925C_0ABF7910F238_QuoteChart_h__ -#define __39BE8775_A837_494f_925C_0ABF7910F238_QuoteChart_h__ - -#pragma once - -#ifdef CHART_IMPLEMENT - -INT_PTR QuotesMenu_Chart(WPARAM wp, LPARAM lp); - -#endif - -#endif //__39BE8775_A837_494f_925C_0ABF7910F238_QuoteChart_h__ diff --git a/plugins/CurrencyRates/src/QuoteInfoDlg.h b/plugins/CurrencyRates/src/QuoteInfoDlg.h deleted file mode 100644 index 51bcebbf64..0000000000 --- a/plugins/CurrencyRates/src/QuoteInfoDlg.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_QuoteInfoDlg_h__ -#define __aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_QuoteInfoDlg_h__ - -int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp); -INT_PTR QuotesMenu_EditSettings(WPARAM wp, LPARAM lp); -INT_PTR QuotesMenu_OpenLogFile(WPARAM wp, LPARAM lp); -INT_PTR QuotesMenu_RefreshContact(WPARAM wp, LPARAM lp); -int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM lp); -int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM lp); - -#endif //__aa849fa0_ff3f_49e9_b47a_e7dd34783dc2_QuoteInfoDlg_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitor.h b/plugins/CurrencyRates/src/QuotesProviderVisitor.h deleted file mode 100644 index 934e0f80d0..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviderVisitor.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __7fca59e7_17b2_4849_bd7a_02c7675f2d76_QuotesProviderVisitor_h__ -#define __7fca59e7_17b2_4849_bd7a_02c7675f2d76_QuotesProviderVisitor_h__ - -class CQuotesProviderBase; -class CQuotesProviderFinance; -class CQuotesProviderDukasCopy; -class CQuotesProviderGoogleFinance; -class CQuotesProviderYahoo; -class CQuotesProviderCurrencyConverter; - -class CQuotesProviderVisitor -{ -public: - CQuotesProviderVisitor() {} - virtual ~CQuotesProviderVisitor() {} - - virtual void Visit(const CQuotesProviderBase&){} - virtual void Visit(const CQuotesProviderFinance&){} - virtual void Visit(const CQuotesProviderDukasCopy&){} - virtual void Visit(const CQuotesProviderGoogleFinance&){} - virtual void Visit(const CQuotesProviderYahoo&){} - virtual void Visit(const CQuotesProviderCurrencyConverter&) {} -}; - -#endif //__7fca59e7_17b2_4849_bd7a_02c7675f2d76_QuotesProviderVisitor_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorFormatSpecificator.h b/plugins/CurrencyRates/src/QuotesProviderVisitorFormatSpecificator.h deleted file mode 100644 index 445a7d168c..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorFormatSpecificator.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __00c159f3_525a_41e9_8fc5_00464b6fafa3_QuotesProviderVisitorFormatSpecificator_h__ -#define __00c159f3_525a_41e9_8fc5_00464b6fafa3_QuotesProviderVisitorFormatSpecificator_h__ - -class CQuotesProviderVisitorFormatSpecificator : public CQuotesProviderVisitor -{ -public: - struct CFormatSpecificator - { - CFormatSpecificator(const tstring& rsSymbol = L"", const tstring& rsDec = L"") - : m_sSymbol(rsSymbol), m_sDesc(rsDec){} - - tstring m_sSymbol; - tstring m_sDesc; - }; - typedef std::vector<CFormatSpecificator> TFormatSpecificators; - -public: - CQuotesProviderVisitorFormatSpecificator(); - ~CQuotesProviderVisitorFormatSpecificator(); - - const TFormatSpecificators& GetSpecificators()const; - -private: - virtual void Visit(const CQuotesProviderDukasCopy& rProvider)override; - virtual void Visit(const CQuotesProviderBase& rProvider)override; - virtual void Visit(const CQuotesProviderGoogleFinance& rProvider)override; - virtual void Visit(const CQuotesProviderYahoo& rProvider)override; - virtual void Visit(const CQuotesProviderCurrencyConverter& rProvider)override; -private: - TFormatSpecificators m_aSpecificators; -}; - -#endif//__00c159f3_525a_41e9_8fc5_00464b6fafa3_QuotesProviderVisitorFormatSpecificator_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorFormater.cpp b/plugins/CurrencyRates/src/QuotesProviderVisitorFormater.cpp deleted file mode 100644 index 50d3b7e8cc..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorFormater.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "StdAfx.h" -#include "QuotesProviderCurrencyConverter.h" - -CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth) - : m_hContact(hContact), - m_chr(chr), - m_nWidth(nWidth) -{ -} - -CQuotesProviderVisitorFormater::~CQuotesProviderVisitorFormater() -{ -} - -const tstring& CQuotesProviderVisitorFormater::GetResult()const -{ - return m_sResult; -} - -static bool get_fetch_time(MCONTACT hContact, time_t& rTime) -{ - DBVARIANT dbv; - if (db_get(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type)) - return false; - - rTime = dbv.dVal; - return true; -} - -static tstring format_fetch_time(const CQuotesProviderBase&, MCONTACT hContact, const tstring& rsFormat) -{ - time_t nTime; - if (true == get_fetch_time(hContact, nTime)) { - boost::posix_time::ptime time = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(boost::posix_time::from_time_t(nTime)); - tostringstream k; - k.imbue(std::locale(GetSystemLocale(), new ttime_facet(rsFormat.c_str()))); - k << time; - return k.str(); - } - - return tstring(); -} - -void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderBase& rProvider) -{ - switch (m_chr) { - case '%': - case '\t': - case '\\': - m_sResult = m_chr; - break; - case 'S': - m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_PROVIDER); - break; - case 's': - m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_SYMBOL); - break; - case 'X': - m_sResult = format_fetch_time(rProvider, m_hContact, Quotes_GetTimeFormat(true)); - break; - case 'x': - m_sResult = format_fetch_time(rProvider, m_hContact, Quotes_GetDateFormat(true)); - break; - case 't': - { - tstring sFrmt = Quotes_GetDateFormat(true); - sFrmt += L" "; - sFrmt += Quotes_GetTimeFormat(true); - m_sResult = format_fetch_time(rProvider, m_hContact, sFrmt); - } - break; - case 'r': - case 'R': - FormatDoubleHelper(DB_STR_QUOTE_CURR_VALUE); - break; - case 'p': - FormatDoubleHelper(DB_STR_QUOTE_PREV_VALUE); - break; - } -} - - -tstring format_double(double dValue, int nWidth) -{ - tostringstream o; - o.imbue(GetSystemLocale()); - - if (nWidth > 0 && nWidth <= 9) - o << std::setprecision(nWidth) << std::showpoint << std::fixed; - - o << dValue; - - return o.str(); -} - -void CQuotesProviderVisitorFormater::FormatDoubleHelper(LPCSTR pszDbSet, - const tstring sInvalid/* = L"-"*/) -{ - double d = 0.0; - if (true == Quotes_DBReadDouble(m_hContact, QUOTES_MODULE_NAME, pszDbSet, d)) - m_sResult = format_double(d, m_nWidth); - else - m_sResult = sInvalid; -} - -void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderCurrencyConverter&) -{ - switch (m_chr) { - case 'F': - m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_FROM_DESCRIPTION); - break; - case 'f': - m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_FROM_ID); - break; - case 'I': - m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_TO_DESCRIPTION); - break; - case 'i': - m_sResult = Quotes_DBGetStringT(m_hContact, QUOTES_MODULE_NAME, DB_STR_TO_ID); - break; - } -}
\ No newline at end of file diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorFormater.h b/plugins/CurrencyRates/src/QuotesProviderVisitorFormater.h deleted file mode 100644 index 27890694ae..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorFormater.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __2b5ddd05_9255_4be0_9408_e59768b70568_QuotesProviderVisitorFormater_h__ -#define __2b5ddd05_9255_4be0_9408_e59768b70568_QuotesProviderVisitorFormater_h__ - -class CQuotesProviderVisitorFormater : public CQuotesProviderVisitor -{ -public: - CQuotesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth); - ~CQuotesProviderVisitorFormater(); - - const tstring& GetResult()const; - -private: - virtual void Visit(const CQuotesProviderBase& rProvider)override; - virtual void Visit(const CQuotesProviderCurrencyConverter& rProvider)override; - -private: - void FormatDoubleHelper(LPCSTR pszDbSet, const tstring sInvalid = L"-"); - // void FormatChangeValueHelper(bool bPercentage); - -private: - MCONTACT m_hContact; - wchar_t m_chr; - tstring m_sResult; - int m_nWidth; -}; - -#endif //__2b5ddd05_9255_4be0_9408_e59768b70568_QuotesProviderVisitorFormater_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorTendency.cpp b/plugins/CurrencyRates/src/QuotesProviderVisitorTendency.cpp deleted file mode 100644 index 123fed5015..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorTendency.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "stdafx.h" - -CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(MCONTACT hContact, wchar_t chr) - : m_hContact(hContact), m_chr(chr), m_bValid(false), m_dResult(0.0) -{ -} - -void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase&) -{ - switch (m_chr) { - case 'r': - case 'R': - GetValue(DB_STR_QUOTE_CURR_VALUE); - break; - case 'p': - GetValue(DB_STR_QUOTE_PREV_VALUE); - break; - } -} - -void CQuotesProviderVisitorTendency::GetValue(LPCSTR pszDbKeyName) -{ - m_bValid = Quotes_DBReadDouble(m_hContact, QUOTES_MODULE_NAME, pszDbKeyName, m_dResult); -} diff --git a/plugins/CurrencyRates/src/QuotesProviderVisitorTendency.h b/plugins/CurrencyRates/src/QuotesProviderVisitorTendency.h deleted file mode 100644 index ef867423d9..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviderVisitorTendency.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __AD721194_E9944366_9CF1_0307460EF32F_QuotesProviderVisitorTendency_h__ -#define __AD721194_E9944366_9CF1_0307460EF32F_QuotesProviderVisitorTendency_h__ - -class CQuotesProviderVisitorTendency : public CQuotesProviderVisitor -{ -public: - CQuotesProviderVisitorTendency(MCONTACT hContact, wchar_t chr); - - bool IsValid()const{ return m_bValid; } - double GetResult()const{ return m_dResult; } - -private: - virtual void Visit(const CQuotesProviderBase& rProvider); - -private: - void GetValue(LPCSTR pszDbKeyName); - -private: - MCONTACT m_hContact; - wchar_t m_chr; - bool m_bValid; - double m_dResult; -}; - -#endif //__AD721194_E9944366_9CF1_0307460EF32F_QuotesProviderVisitorTendency_h__ diff --git a/plugins/CurrencyRates/src/QuotesProviders.cpp b/plugins/CurrencyRates/src/QuotesProviders.cpp deleted file mode 100644 index 384df4277e..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviders.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "StdAfx.h" -#include "QuotesProviderCurrencyConverter.h" - -#define LAST_RUN_VERSION "LastRunVersion" - -CQuotesProviders::CQuotesProviders() -{ - InitProviders(); -} - -CQuotesProviders::~CQuotesProviders() -{ - ClearProviders(); -} - -const CQuotesProviders::TQuotesProviders& CQuotesProviders::GetProviders()const -{ - return m_apProviders; -} - -template<class T>void create_provider(CQuotesProviders::TQuotesProviders& apProviders) -{ - CQuotesProviders::TQuotesProviderPtr pProvider(new T); - if (pProvider->Init()) - apProviders.push_back(pProvider); -}; - -void CQuotesProviders::CreateProviders() -{ - create_provider<CQuotesProviderCurrencyConverter>(m_apProviders); -} - -void CQuotesProviders::ClearProviders() -{ - m_apProviders.clear(); -} - -void convert_contact_settings(MCONTACT hContact) -{ - WORD dwLogMode = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, static_cast<WORD>(lmDisabled)); - if ((dwLogMode&lmInternalHistory) || (dwLogMode&lmExternalFile)) - db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 1); -} - -void CQuotesProviders::InitProviders() -{ - CreateProviders(); - - const WORD nCurrentVersion = 17; - WORD nVersion = db_get_w(NULL, QUOTES_MODULE_NAME, LAST_RUN_VERSION, 1); - - for (auto &hContact : Contacts(QUOTES_MODULE_NAME)) { - TQuotesProviderPtr pProvider = GetContactProviderPtr(hContact); - if (pProvider) { - pProvider->AddContact(hContact); - if (nVersion < nCurrentVersion) - convert_contact_settings(hContact); - } - } - - db_set_w(NULL, QUOTES_MODULE_NAME, LAST_RUN_VERSION, nCurrentVersion); -} - -CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(MCONTACT hContact)const -{ - char* szProto = GetContactProto(hContact); - if (nullptr == szProto || 0 != ::_stricmp(szProto, QUOTES_PROTOCOL_NAME)) - return TQuotesProviderPtr(); - - tstring sProvider = Quotes_DBGetStringT(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_PROVIDER); - if (true == sProvider.empty()) - return TQuotesProviderPtr(); - - return FindProvider(sProvider); -} - -CQuotesProviders::TQuotesProviderPtr CQuotesProviders::FindProvider(const tstring& rsName)const -{ - TQuotesProviderPtr pResult; - for (TQuotesProviders::const_iterator i = m_apProviders.begin(); i != m_apProviders.end(); ++i) { - const TQuotesProviderPtr& pProvider = *i; - const IQuotesProvider::CProviderInfo& rInfo = pProvider->GetInfo(); - if (0 == ::mir_wstrcmpi(rsName.c_str(), rInfo.m_sName.c_str())) { - pResult = pProvider; - break; - } - } - - return pResult; -} diff --git a/plugins/CurrencyRates/src/QuotesProviders.h b/plugins/CurrencyRates/src/QuotesProviders.h deleted file mode 100644 index 71aca86303..0000000000 --- a/plugins/CurrencyRates/src/QuotesProviders.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __148306d1_da2a_43df_b1ad_0cdc8ef8a79e_QuotesProviders_h__ -#define __148306d1_da2a_43df_b1ad_0cdc8ef8a79e_QuotesProviders_h__ - -class IQuotesProvider; - -class CQuotesProviders -{ -public: - typedef boost::shared_ptr<IQuotesProvider> TQuotesProviderPtr; - typedef std::vector<TQuotesProviderPtr> TQuotesProviders; - -public: - CQuotesProviders(); - ~CQuotesProviders(); - - TQuotesProviderPtr FindProvider(const tstring& rsName)const; - TQuotesProviderPtr GetContactProviderPtr(MCONTACT hContact)const; - const TQuotesProviders& GetProviders()const; - -private: - void InitProviders(); - void CreateProviders(); - void ClearProviders(); - -private: - TQuotesProviders m_apProviders; -}; - -#endif //__148306d1_da2a_43df_b1ad_0cdc8ef8a79e_QuotesProviders_h__ diff --git a/plugins/CurrencyRates/src/SettingsDlg.cpp b/plugins/CurrencyRates/src/SettingsDlg.cpp index a3de4ddea1..e24b0e381c 100644 --- a/plugins/CurrencyRates/src/SettingsDlg.cpp +++ b/plugins/CurrencyRates/src/SettingsDlg.cpp @@ -2,7 +2,7 @@ #define WINDOW_PREFIX_SETTINGS "Edit Settings_" -LPCTSTR g_pszVariableQuoteName = L"%quotename%"; +LPCTSTR g_pszVariableCurrencyRateName = L"%currencyratename%"; LPCTSTR g_pszVariableUserProfile = L"%miranda_userdata%"; void update_file_controls(HWND hDlg) @@ -211,7 +211,7 @@ INT_PTR CALLBACK EditPopupSettingsDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM nModeDelay = CPopupSettings::delayCustom; else { prepare_edit_ctrl_for_error(::GetDlgItem(hWnd, IDC_DELAY)); - Quotes_MessageBox(hWnd, TranslateT("Enter integer value"), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter integer value"), MB_OK | MB_ICONERROR); bError = true; } } @@ -259,52 +259,52 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L tstring sName = GetContactName(hContact); ::SetDlgItemText(hWnd, IDC_EDIT_NAME, sName.c_str()); - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(hContact); - BYTE bUseContactSpecific = db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0); + BYTE bUseContactSpecific = db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0); ::CheckDlgButton(hWnd, IDC_CHECK_CONTACT_SPECIFIC, bUseContactSpecific ? BST_CHECKED : BST_UNCHECKED); CAdvProviderSettings setGlobal(pProvider.get()); // log to history - WORD dwLogMode = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, setGlobal.GetLogMode()); + WORD dwLogMode = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG, setGlobal.GetLogMode()); UINT nCheck = (dwLogMode&lmInternalHistory) ? 1 : 0; ::CheckDlgButton(hWnd, IDC_CHECK_INTERNAL_HISTORY, nCheck ? BST_CHECKED : BST_UNCHECKED); - tstring sHistoryFrmt = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_HISTORY, setGlobal.GetHistoryFormat().c_str()); + tstring sHistoryFrmt = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_HISTORY, setGlobal.GetHistoryFormat().c_str()); ::SetDlgItemText(hWnd, IDC_EDIT_HISTORY_FORMAT, sHistoryFrmt.c_str()); - WORD wOnlyIfChanged = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_HISTORY_CONDITION, setGlobal.GetHistoryOnlyChangedFlag()); + WORD wOnlyIfChanged = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_HISTORY_CONDITION, setGlobal.GetHistoryOnlyChangedFlag()); ::CheckDlgButton(hWnd, IDC_CHECK_HISTORY_CONDITION, (1 == wOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED); // log to file nCheck = (dwLogMode&lmExternalFile) ? 1 : 0; ::CheckDlgButton(hWnd, IDC_CHECK_EXTERNAL_FILE, nCheck ? BST_CHECKED : BST_UNCHECKED); - tstring sLogFileName = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE); + tstring sLogFileName = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE); if (true == sLogFileName.empty()) { - sLogFileName = GenerateLogFileName(setGlobal.GetLogFileName(), Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL), glfnResolveQuoteName); + sLogFileName = GenerateLogFileName(setGlobal.GetLogFileName(), CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL), glfnResolveCurrencyRateName); } ::SetDlgItemText(hWnd, IDC_EDIT_FILE_NAME, sLogFileName.c_str()); - tstring sLogFileFrmt = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_LOG_FILE, setGlobal.GetLogFormat().c_str()); + tstring sLogFileFrmt = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_LOG_FILE, setGlobal.GetLogFormat().c_str()); ::SetDlgItemText(hWnd, IDC_EDIT_LOG_FILE_FORMAT, sLogFileFrmt.c_str()); - wOnlyIfChanged = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE_CONDITION, setGlobal.GetLogOnlyChangedFlag()); + wOnlyIfChanged = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE_CONDITION, setGlobal.GetLogOnlyChangedFlag()); ::CheckDlgButton(hWnd, IDC_CHECK_LOG_FILE_CONDITION, (1 == wOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED); // popup nCheck = (dwLogMode&lmPopup) ? 1 : 0; ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP, nCheck ? BST_CHECKED : BST_UNCHECKED); - tstring sPopupFrmt = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_POPUP, setGlobal.GetPopupFormat().c_str()); + tstring sPopupFrmt = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_POPUP, setGlobal.GetPopupFormat().c_str()); ::SetDlgItemText(hWnd, IDC_EDIT_POPUP_FORMAT, sPopupFrmt.c_str()); - bool bOnlyIfChanged = 1 == db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_CONDITION, setGlobal.GetShowPopupIfValueChangedFlag()); + bool bOnlyIfChanged = 1 == db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_CONDITION, setGlobal.GetShowPopupIfValueChangedFlag()); ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED, (bOnlyIfChanged) ? BST_CHECKED : BST_UNCHECKED); update_all_controls(hWnd); CSettingWindowParam* pParam = new CSettingWindowParam(hContact); ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pParam)); - Utils_RestoreWindowPositionNoSize(hWnd, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_SETTINGS); + Utils_RestoreWindowPositionNoSize(hWnd, hContact, CURRENCYRATES_MODULE_NAME, WINDOW_PREFIX_SETTINGS); ::ShowWindow(hWnd, SW_SHOW); } break; @@ -315,7 +315,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L case IDC_BUTTON_LOG_FILE_DESCRIPTION: case IDC_BUTTON_POPUP_FORMAT_DESCRIPTION: if (BN_CLICKED == HIWORD(wp)) { - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(get_param(hWnd)->m_hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(get_param(hWnd)->m_hContact); show_variable_list(hWnd, pProvider.get()); } break; @@ -345,7 +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) { - CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(pParam->m_hContact); + CCurrencyRatesProviders::TCurrencyRatesProviderPtr pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(pParam->m_hContact); pParam->m_pPopupSettings = new CPopupSettings(pProvider.get()); pParam->m_pPopupSettings->InitForContact(pParam->m_hContact); @@ -388,19 +388,19 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L if ((nLogMode&lmExternalFile)) { if (true == sLogFile.empty()) { prepare_edit_ctrl_for_error(hwndLogFile); - Quotes_MessageBox(hWnd, TranslateT("Enter log file name."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter log file name."), MB_OK | MB_ICONERROR); bOk = false; } else if (true == sLogFileFormat.empty()) { prepare_edit_ctrl_for_error(hwndLogFileFrmt); - Quotes_MessageBox(hWnd, TranslateT("Enter log file format."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter log file format."), MB_OK | MB_ICONERROR); bOk = false; } } if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty())) { prepare_edit_ctrl_for_error(hwndHistoryFrmt); - Quotes_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR); bOk = false; } @@ -408,7 +408,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L tstring sPopupFormat = get_window_text(hwndPopupFrmt); if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty())) { prepare_edit_ctrl_for_error(hwndPopupFrmt); - Quotes_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR); bOk = false; } @@ -417,15 +417,15 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L UINT nIfChangedFile = IsDlgButtonChecked(hWnd, IDC_CHECK_LOG_FILE_CONDITION); bool bIfChangedPopup = (1 == IsDlgButtonChecked(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED)); - db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, bUseContactSpec); - db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG, nLogMode); - db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE_CONDITION, nIfChangedFile); - db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_HISTORY_CONDITION, nIfChangedHistory); - db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_CONDITION, bIfChangedPopup); - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE, sLogFile.c_str()); - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_LOG_FILE, sLogFileFormat.c_str()); - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_HISTORY, sHistoryFormat.c_str()); - db_set_ws(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FORMAT_POPUP, sPopupFormat.c_str()); + db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CONTACT_SPEC_SETTINGS, bUseContactSpec); + db_set_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG, nLogMode); + db_set_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE_CONDITION, nIfChangedFile); + db_set_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_HISTORY_CONDITION, nIfChangedHistory); + db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_CONDITION, bIfChangedPopup); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE, sLogFile.c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_LOG_FILE, sLogFileFormat.c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_HISTORY, sHistoryFormat.c_str()); + db_set_ws(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_FORMAT_POPUP, sPopupFormat.c_str()); if (pParam->m_pPopupSettings) { pParam->m_pPopupSettings->SaveForContact(hContact); @@ -453,7 +453,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L MWindowList hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS, false); assert(hWL); WindowList_Remove(hWL, hWnd); - Utils_SaveWindowPosition(hWnd, pParam->m_hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_SETTINGS); + Utils_SaveWindowPosition(hWnd, pParam->m_hContact, CURRENCYRATES_MODULE_NAME, WINDOW_PREFIX_SETTINGS); delete pParam; break; } @@ -545,12 +545,12 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, if ((nLogMode&lmExternalFile)) { if (true == sLogFile.empty()) { prepare_edit_ctrl_for_error(hwndLogFile); - Quotes_MessageBox(hWnd, TranslateT("Enter log file name."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter log file name."), MB_OK | MB_ICONERROR); bOk = false; } else if (true == sLogFileFormat.empty()) { prepare_edit_ctrl_for_error(hwndLogFileFrmt); - Quotes_MessageBox(hWnd, TranslateT("Enter log file format."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter log file format."), MB_OK | MB_ICONERROR); bOk = false; } } @@ -559,7 +559,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, tstring sHistoryFormat = get_window_text(hwndHistoryFrmt); if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty())) { prepare_edit_ctrl_for_error(hwndHistoryFrmt); - Quotes_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR); bOk = false; } @@ -567,7 +567,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, tstring sPopupFormat = get_window_text(hwndPopupFrmt); if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty())) { prepare_edit_ctrl_for_error(hwndPopupFrmt); - Quotes_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR); + CurrencyRates_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR); bOk = false; } @@ -634,18 +634,18 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, return FALSE; } -CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvider) - : m_pQuotesProvider(pQuotesProvider), +CAdvProviderSettings::CAdvProviderSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider) + : m_pCurrencyRatesProvider(pCurrencyRatesProvider), m_wLogMode(lmDisabled), m_bIsOnlyChangedHistory(false), m_bIsOnlyChangedLogFile(false), m_bShowPopupIfValueChanged(false), m_pPopupSettings(nullptr) { - assert(m_pQuotesProvider); + assert(m_pCurrencyRatesProvider); - CQuotesProviderVisitorDbSettings visitor; - m_pQuotesProvider->Accept(visitor); + CCurrencyRatesProviderVisitorDbSettings visitor; + m_pCurrencyRatesProvider->Accept(visitor); assert(visitor.m_pszDefLogFileFormat); assert(visitor.m_pszDefHistoryFormat); @@ -656,23 +656,23 @@ CAdvProviderSettings::CAdvProviderSettings(const IQuotesProvider* pQuotesProvide assert(visitor.m_pszDbLogFormat); assert(visitor.m_pszDbLogCondition); - m_wLogMode = db_get_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogMode, static_cast<WORD>(lmDisabled)); - m_sFormatHistory = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryFormat, visitor.m_pszDefHistoryFormat); - m_bIsOnlyChangedHistory = 1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryCondition, 0); + m_wLogMode = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, static_cast<WORD>(lmDisabled)); + m_sFormatHistory = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, visitor.m_pszDefHistoryFormat); + m_bIsOnlyChangedHistory = 1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, 0); - m_sLogFileName = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFile); + m_sLogFileName = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile); if (true == m_sLogFileName.empty()) { m_sLogFileName = g_pszVariableUserProfile; - m_sLogFileName += L"\\Quotes\\"; - m_sLogFileName += g_pszVariableQuoteName; + m_sLogFileName += L"\\CurrencyRates\\"; + m_sLogFileName += g_pszVariableCurrencyRateName; m_sLogFileName += L".log"; } - m_sFormatLogFile = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFormat, visitor.m_pszDefLogFileFormat); - m_bIsOnlyChangedLogFile = (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogCondition, 0)); + m_sFormatLogFile = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, visitor.m_pszDefLogFileFormat); + m_bIsOnlyChangedLogFile = (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, 0)); - m_sPopupFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupFormat, visitor.m_pszDefPopupFormat); - m_bShowPopupIfValueChanged = (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupCondition, 0)); + m_sPopupFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, visitor.m_pszDefPopupFormat); + m_bShowPopupIfValueChanged = (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, 0)); } CAdvProviderSettings::~CAdvProviderSettings() @@ -680,15 +680,15 @@ CAdvProviderSettings::~CAdvProviderSettings() delete m_pPopupSettings; } -const IQuotesProvider* CAdvProviderSettings::GetProviderPtr()const +const ICurrencyRatesProvider* CAdvProviderSettings::GetProviderPtr()const { - return m_pQuotesProvider; + return m_pCurrencyRatesProvider; } void CAdvProviderSettings::SaveToDb()const { - CQuotesProviderVisitorDbSettings visitor; - m_pQuotesProvider->Accept(visitor); + CCurrencyRatesProviderVisitorDbSettings visitor; + m_pCurrencyRatesProvider->Accept(visitor); assert(visitor.m_pszDbLogMode); assert(visitor.m_pszDbHistoryFormat); @@ -703,22 +703,22 @@ void CAdvProviderSettings::SaveToDb()const assert(visitor.m_pszDbPopupDelayTimeout); assert(visitor.m_pszDbPopupHistoryFlag); - db_set_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogMode, m_wLogMode); - db_set_ws(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryFormat, m_sFormatHistory.c_str()); - db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbHistoryCondition, m_bIsOnlyChangedHistory); - db_set_ws(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFile, m_sLogFileName.c_str()); - db_set_ws(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogFormat, m_sFormatLogFile.c_str()); - db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbLogCondition, m_bIsOnlyChangedLogFile); - db_set_ws(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupFormat, m_sPopupFormat.c_str()); - db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupCondition, m_bShowPopupIfValueChanged); + db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, m_wLogMode); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, m_sFormatHistory.c_str()); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, m_bIsOnlyChangedHistory); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile, m_sLogFileName.c_str()); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, m_sFormatLogFile.c_str()); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, m_bIsOnlyChangedLogFile); + db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, m_sPopupFormat.c_str()); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, m_bShowPopupIfValueChanged); if (nullptr != m_pPopupSettings) { - db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode())); - db_set_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupBkColour, m_pPopupSettings->GetColourBk()); - db_set_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupTextColour, m_pPopupSettings->GetColourText()); - db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode())); - db_set_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayTimeout, m_pPopupSettings->GetDelayTimeout()); - db_set_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupHistoryFlag, m_pPopupSettings->GetHistoryFlag()); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode())); + db_set_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_pPopupSettings->GetColourBk()); + db_set_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_pPopupSettings->GetColourText()); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode())); + db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_pPopupSettings->GetDelayTimeout()); + db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_pPopupSettings->GetHistoryFlag()); } } @@ -805,12 +805,12 @@ void CAdvProviderSettings::SetShowPopupIfValueChangedFlag(bool val) CPopupSettings* CAdvProviderSettings::GetPopupSettingsPtr()const { if (nullptr == m_pPopupSettings) - m_pPopupSettings = new CPopupSettings(m_pQuotesProvider); + m_pPopupSettings = new CPopupSettings(m_pCurrencyRatesProvider); return m_pPopupSettings; } -CPopupSettings::CPopupSettings(const IQuotesProvider* pQuotesProvider) +CPopupSettings::CPopupSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider) : m_modeColour(colourDefault), m_modeDelay(delayFromPopup), m_rgbBkg(GetDefColourBk()), @@ -819,8 +819,8 @@ CPopupSettings::CPopupSettings(const IQuotesProvider* pQuotesProvider) m_bUseHistory(false) { - CQuotesProviderVisitorDbSettings visitor; - pQuotesProvider->Accept(visitor); + CCurrencyRatesProviderVisitorDbSettings visitor; + pCurrencyRatesProvider->Accept(visitor); assert(visitor.m_pszDbPopupColourMode); assert(visitor.m_pszDbPopupBkColour); @@ -829,19 +829,19 @@ CPopupSettings::CPopupSettings(const IQuotesProvider* pQuotesProvider) assert(visitor.m_pszDbPopupDelayTimeout); assert(visitor.m_pszDbPopupHistoryFlag); - BYTE m = db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_modeColour)); + BYTE m = db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_modeColour)); if (m >= colourDefault && m <= colourUserDefined) m_modeColour = static_cast<EColourMode>(m); - m_rgbBkg = db_get_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupBkColour, m_rgbBkg); - m_rgbText = db_get_dw(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupTextColour, m_rgbText); + m_rgbBkg = db_get_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_rgbBkg); + m_rgbText = db_get_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_rgbText); - m = db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_modeDelay)); + m = db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_modeDelay)); if (m >= delayFromPopup && m <= delayPermanent) { m_modeDelay = static_cast<EDelayMode>(m); } - m_wDelay = db_get_w(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupDelayTimeout, m_wDelay); - m_bUseHistory = (1 == db_get_b(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbPopupHistoryFlag, m_bUseHistory)); + m_wDelay = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_wDelay); + m_bUseHistory = (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_bUseHistory)); } /*static */ @@ -858,30 +858,30 @@ COLORREF CPopupSettings::GetDefColourText() void CPopupSettings::InitForContact(MCONTACT hContact) { - BYTE m = db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour)); + BYTE m = db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour)); if (m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined) { m_modeColour = static_cast<CPopupSettings::EColourMode>(m); } - m_rgbBkg = db_get_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_BK, m_rgbBkg); - m_rgbText = db_get_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_TEXT, m_rgbText); + m_rgbBkg = db_get_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_BK, m_rgbBkg); + m_rgbText = db_get_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_TEXT, m_rgbText); - m = db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay)); + m = db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay)); if (m >= CPopupSettings::delayFromPopup && m <= CPopupSettings::delayPermanent) { m_modeDelay = static_cast<CPopupSettings::EDelayMode>(m); } - m_wDelay = db_get_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_TIMEOUT, m_wDelay); - m_bUseHistory = 1 == db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_HISTORY_FLAG, m_bUseHistory); + m_wDelay = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_DELAY_TIMEOUT, m_wDelay); + m_bUseHistory = 1 == db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_HISTORY_FLAG, m_bUseHistory); } void CPopupSettings::SaveForContact(MCONTACT hContact)const { - db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour)); - db_set_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_BK, m_rgbBkg); - db_set_dw(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_COLOUR_TEXT, m_rgbText); - db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay)); - db_set_w(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_DELAY_TIMEOUT, m_wDelay); - db_set_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_POPUP_HISTORY_FLAG, m_bUseHistory); + db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour)); + db_set_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_BK, m_rgbBkg); + db_set_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_TEXT, m_rgbText); + db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay)); + db_set_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_DELAY_TIMEOUT, m_wDelay); + db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_HISTORY_FLAG, m_bUseHistory); } CPopupSettings::EColourMode CPopupSettings::GetColourMode()const @@ -967,17 +967,17 @@ static void replace_invalid_char(tstring::value_type& rChar, tstring::value_type } } -tstring GenerateLogFileName(const tstring &rsLogFilePattern, const tstring &rsQuoteSymbol, int nFlags) +tstring GenerateLogFileName(const tstring &rsLogFilePattern, const tstring &rsCurrencyRateSymbol, int nFlags) { tstring sPath = rsLogFilePattern; - if (nFlags&glfnResolveQuoteName) { - assert(false == rsQuoteSymbol.empty()); + if (nFlags&glfnResolveCurrencyRateName) { + assert(false == rsCurrencyRateSymbol.empty()); - tstring::size_type n = sPath.find(g_pszVariableQuoteName); + tstring::size_type n = sPath.find(g_pszVariableCurrencyRateName); if (tstring::npos != n) { - tstring s = rsQuoteSymbol; + tstring s = rsCurrencyRateSymbol; std::for_each(s.begin(), s.end(), boost::bind(replace_invalid_char, _1, '_')); - sPath.replace(n, mir_wstrlen(g_pszVariableQuoteName), s.c_str()); + sPath.replace(n, mir_wstrlen(g_pszVariableCurrencyRateName), s.c_str()); } } @@ -996,18 +996,18 @@ tstring GetContactLogFileName(MCONTACT hContact) { tstring result; - const CQuotesProviders::TQuotesProviderPtr& pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); + const CCurrencyRatesProviders::TCurrencyRatesProviderPtr& pProvider = CModuleInfo::GetCurrencyRateProvidersPtr()->GetContactProviderPtr(hContact); if (pProvider) { tstring sPattern; - bool bUseContactSpecific = (db_get_b(hContact, QUOTES_PROTOCOL_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0) > 0); + bool bUseContactSpecific = (db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CONTACT_SPEC_SETTINGS, 0) > 0); if (bUseContactSpecific) - sPattern = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_LOG_FILE); + sPattern = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_LOG_FILE); else { CAdvProviderSettings global_settings(pProvider.get()); sPattern = global_settings.GetLogFileName(); } - result = GenerateLogFileName(sPattern, Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL)); + result = GenerateLogFileName(sPattern, CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL)); } return result; @@ -1015,9 +1015,9 @@ tstring GetContactLogFileName(MCONTACT hContact) tstring GetContactName(MCONTACT hContact) { - tstring sDescription = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_DESCRIPTION); + tstring sDescription = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_DESCRIPTION); if (sDescription.empty()) - sDescription = Quotes_DBGetStringT(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL); + sDescription = CurrencyRates_DBGetStringT(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_SYMBOL); return sDescription; } diff --git a/plugins/CurrencyRates/src/SettingsDlg.h b/plugins/CurrencyRates/src/SettingsDlg.h index b462d7a901..87c7ab697a 100644 --- a/plugins/CurrencyRates/src/SettingsDlg.h +++ b/plugins/CurrencyRates/src/SettingsDlg.h @@ -1,7 +1,7 @@ #ifndef __E211E4D9_383C_43BE_A787_7EF1D585B90D_SettingsDlg_h__ #define __E211E4D9_383C_43BE_A787_7EF1D585B90D_SettingsDlg_h__ -class IQuotesProvider; +class ICurrencyRatesProvider; class CPopupSettings { @@ -20,7 +20,7 @@ public: }; public: - CPopupSettings(const IQuotesProvider* pQuotesProvider); + CPopupSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider); static COLORREF GetDefColourBk(); static COLORREF GetDefColourText(); @@ -59,12 +59,12 @@ private: class CAdvProviderSettings { public: - CAdvProviderSettings(const IQuotesProvider* pQuotesProvider); + CAdvProviderSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider); ~CAdvProviderSettings(); void SaveToDb()const; - const IQuotesProvider* GetProviderPtr()const; + const ICurrencyRatesProvider* GetProviderPtr()const; WORD GetLogMode()const; void SetLogMode(WORD wMode); @@ -89,7 +89,7 @@ public: CPopupSettings* GetPopupSettingsPtr()const; private: - const IQuotesProvider* m_pQuotesProvider; + const ICurrencyRatesProvider* m_pCurrencyRatesProvider; WORD m_wLogMode; tstring m_sFormatHistory; bool m_bIsOnlyChangedHistory; @@ -106,11 +106,11 @@ bool ShowSettingsDlg(HWND hWndParent, CAdvProviderSettings* pAdvSettings); enum { - glfnResolveQuoteName = 0x0001, + glfnResolveCurrencyRateName = 0x0001, glfnResolveUserProfile = 0x0002, - glfnResolveAll = glfnResolveQuoteName | glfnResolveUserProfile, + glfnResolveAll = glfnResolveCurrencyRateName | glfnResolveUserProfile, }; -tstring GenerateLogFileName(const tstring& rsLogFilePattern, const tstring& rsQuoteSymbol, int nFlags = glfnResolveAll); +tstring GenerateLogFileName(const tstring& rsLogFilePattern, const tstring& rsCurrencyRateSymbol, int nFlags = glfnResolveAll); tstring GetContactLogFileName(MCONTACT hContact); tstring GetContactName(MCONTACT hContact); diff --git a/plugins/CurrencyRates/src/WinCtrlHelper.cpp b/plugins/CurrencyRates/src/WinCtrlHelper.cpp index 03da055dbe..636b7ae9b1 100644 --- a/plugins/CurrencyRates/src/WinCtrlHelper.cpp +++ b/plugins/CurrencyRates/src/WinCtrlHelper.cpp @@ -6,14 +6,14 @@ static INT_PTR CALLBACK VariableListDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPAR case WM_INITDIALOG: TranslateDialogDefault(hWnd); { - const IQuotesProvider* pProvider = reinterpret_cast<const IQuotesProvider*>(lp); - CQuotesProviderVisitorFormatSpecificator visitor; + const ICurrencyRatesProvider* pProvider = reinterpret_cast<const ICurrencyRatesProvider*>(lp); + CCurrencyRatesProviderVisitorFormatSpecificator visitor; pProvider->Accept(visitor); tostringstream o; - const CQuotesProviderVisitorFormatSpecificator::TFormatSpecificators& raSpec = visitor.GetSpecificators(); + const CCurrencyRatesProviderVisitorFormatSpecificator::TFormatSpecificators& raSpec = visitor.GetSpecificators(); std::for_each(raSpec.begin(), raSpec.end(), - [&o](const CQuotesProviderVisitorFormatSpecificator::CFormatSpecificator& spec) + [&o](const CCurrencyRatesProviderVisitorFormatSpecificator::CFormatSpecificator& spec) { o << spec.m_sSymbol << '\t' << spec.m_sDesc << L"\r\n"; }); @@ -30,7 +30,7 @@ static INT_PTR CALLBACK VariableListDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPAR return FALSE; } -void show_variable_list(HWND hwndParent, const IQuotesProvider* pProvider) +void show_variable_list(HWND hwndParent, const ICurrencyRatesProvider* pProvider) { ::DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DIALOG_VARIABLE_LIST), diff --git a/plugins/CurrencyRates/src/WinCtrlHelper.h b/plugins/CurrencyRates/src/WinCtrlHelper.h index 20444ce41e..c9e87e8ae5 100644 --- a/plugins/CurrencyRates/src/WinCtrlHelper.h +++ b/plugins/CurrencyRates/src/WinCtrlHelper.h @@ -1,7 +1,7 @@ #ifndef __a05d6852_4497_4f28_85e1_48a15a170738_WinCtrlHelper_h__ #define __a05d6852_4497_4f28_85e1_48a15a170738_WinCtrlHelper_h__ -class IQuotesProvider; +class ICurrencyRatesProvider; inline tstring get_window_text(HWND hWnd) { @@ -21,11 +21,11 @@ inline void prepare_edit_ctrl_for_error(HWND hwndEdit) ::SendMessage(hwndEdit, EM_SCROLLCARET, 0, 0); } -void show_variable_list(HWND hwndParent, const IQuotesProvider* pProvider); +void show_variable_list(HWND hwndParent, const ICurrencyRatesProvider* pProvider); -inline int Quotes_MessageBox(HWND hWnd, LPCTSTR pszText, UINT nType = MB_OK) +inline int CurrencyRates_MessageBox(HWND hWnd, LPCTSTR pszText, UINT nType = MB_OK) { - return ::MessageBox(hWnd, pszText, quotes_a2t(MIRANDANAME).c_str(), nType); + return ::MessageBox(hWnd, pszText, currencyrates_a2t(MIRANDANAME).c_str(), nType); } inline void spin_set_range(HWND hwndSpin, short nLower, short nUpper) diff --git a/plugins/CurrencyRates/src/resource.h b/plugins/CurrencyRates/src/resource.h index 46a35fe06e..ef87ff4a70 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\Quotes\res\Forex.rc +// Used by C:\Code\miranda-ng-from-github\plugins\CurrencyRates\res\Forex.rc // #define IDI_ICON_MAIN 102 -#define IDD_DIALOG_QUOTE_INFO 102 +#define IDD_DIALOG_CURRENCYRATE_INFO 102 #define IDD_DIALOG_OPT_GOOGLE 103 #define IDI_ICON_SECTION 110 -#define IDI_ICON_QUOTE 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_QUOTE_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_QUOTE_NAME 1008 +#define IDC_STATIC_CURRENCYRATE_NAME 1008 #define IDC_SYSLINK_PROVIDER 1009 #define IDC_STATIC_CHART 1010 -#define IDC_STATIC_QUOTE_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 diff --git a/plugins/CurrencyRates/src/stdafx.h b/plugins/CurrencyRates/src/stdafx.h index 83c696ad69..bae36819e7 100644 --- a/plugins/CurrencyRates/src/stdafx.h +++ b/plugins/CurrencyRates/src/stdafx.h @@ -50,7 +50,7 @@ typedef std::wistream tistream; typedef boost::posix_time::wtime_input_facet ttime_input_facet; typedef boost::posix_time::wtime_facet ttime_facet; -inline std::string quotes_t2a(const wchar_t* t) +inline std::string currencyrates_t2a(const wchar_t* t) { std::string s; char* p = mir_u2a(t); @@ -61,7 +61,7 @@ inline std::string quotes_t2a(const wchar_t* t) return s; } -inline tstring quotes_a2t(const char* s) +inline tstring currencyrates_a2t(const char* s) { tstring t; wchar_t* p = mir_a2u(s); @@ -75,7 +75,7 @@ inline tstring quotes_a2t(const char* s) #include "resource.h" #include "version.h" #include "IconLib.h" -#include "QuoteInfoDlg.h" +#include "CurrencyRateInfoDlg.h" #include "ModuleInfo.h" #include "DBUtils.h" #include "HTTPSession.h" @@ -91,17 +91,17 @@ inline tstring quotes_a2t(const char* s) #include "Locale.h" #include "ExtraImages.h" #include "IsWithinAccuracy.h" -#include "IQuotesProvider.h" -#include "QuotesProviders.h" -#include "QuotesProviderBase.h" -#include "QuotesProviderVisitor.h" -#include "QuotesProviderVisitorDbSettings.h" -#include "QuotesProviderVisitorFormater.h" -#include "QuotesProviderVisitorTendency.h" -#include "QuotesProviderVisitorFormatSpecificator.h" +#include "ICurrencyRatesProvider.h" +#include "CurrencyRatesProviders.h" +#include "CurrencyRatesProviderBase.h" +#include "CurrencyRatesProviderVisitor.h" +#include "CurrencyRatesProviderVisitorDbSettings.h" +#include "CurrencyRatesProviderVisitorFormater.h" +#include "CurrencyRatesProviderVisitorTendency.h" +#include "CurrencyRatesProviderVisitorFormatSpecificator.h" #define CHART_IMPLEMENT #ifdef CHART_IMPLEMENT -#include "QuoteChart.h" +#include "CurrencyRateChart.h" #include "Chart.h" #endif #include "IHTMLParser.h" diff --git a/plugins/ExternalAPI/m_CurrencyRates.h b/plugins/ExternalAPI/m_CurrencyRates.h index 5535b69571..f8cd8b159a 100644 --- a/plugins/ExternalAPI/m_CurrencyRates.h +++ b/plugins/ExternalAPI/m_CurrencyRates.h @@ -1,5 +1,5 @@ -#ifndef __7D8F07A4_72AF_4838_9C5C_6FDFF57D0DC6_m_Quotes_h__ -#define __7D8F07A4_72AF_4838_9C5C_6FDFF57D0DC6_m_Quotes_h__ +#ifndef __7D8F07A4_72AF_4838_9C5C_6FDFF57D0DC6_m_CurrencyRates_h__ +#define __7D8F07A4_72AF_4838_9C5C_6FDFF57D0DC6_m_CurrencyRates_h__ /* * Export the contact (or all contacts) to xml file @@ -10,7 +10,7 @@ * -1 if user canceled export and * value greater than zero if error occurred during exporting */ -#define MS_QUOTES_EXPORT "Quotes/Export" +#define MS_CURRENCYRATES_EXPORT "CurrencyRates/Export" /* * Import the contact (or all contacts) from xml file @@ -23,13 +23,13 @@ */ // if contact(s) exists user would be asked to overwrite these contacts -// #define QUOTES_IMPORT_PROMPT_TO_OVERWRITE_EXISTING_CONTACTS 0x0000 +// #define CURRENCYRATES_IMPORT_PROMPT_TO_OVERWRITE_EXISTING_CONTACTS 0x0000 // if contact(s) exists it would be overwrite without any prompt -// #define QUOTES_IMPORT_SILENT_OVERWRITE_EXISTING_CONTACTS 0x0001 +// #define CURRENCYRATES_IMPORT_SILENT_OVERWRITE_EXISTING_CONTACTS 0x0001 // if contact(s) exists during importing it would be ignored -#define QUOTES_IMPORT_SKIP_EXISTING_CONTACTS 0x0002 +#define CURRENCYRATES_IMPORT_SKIP_EXISTING_CONTACTS 0x0002 -#define MS_QUOTES_IMPORT "Quotes/Import" +#define MS_CURRENCYRATES_IMPORT "CurrencyRates/Import" -#endif //__7D8F07A4_72AF_4838_9C5C_6FDFF57D0DC6_m_Quotes_h__ +#endif //__7D8F07A4_72AF_4838_9C5C_6FDFF57D0DC6_m_CurrencyRates_h__ |