From 9394fab3f366b5cc7e48ad421e861f7a0799ed8f Mon Sep 17 00:00:00 2001 From: chudov Date: Thu, 26 May 2011 23:19:20 +0000 Subject: [PATCH] CTDB EAC Plugin: show progress bar --- .../FormSubmitParity.Designer.cs | 75 +++++++++++ CUETools.CTDB.EACPlugin/FormSubmitParity.cs | 73 +++++++++++ CUETools.CTDB.EACPlugin/FormSubmitParity.resx | 123 ++++++++++++++++++ CUETools.CTDB.EACPlugin/Resources/ctdb32.png | Bin 0 -> 5331 bytes 4 files changed, 271 insertions(+) create mode 100644 CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs create mode 100644 CUETools.CTDB.EACPlugin/FormSubmitParity.cs create mode 100644 CUETools.CTDB.EACPlugin/FormSubmitParity.resx create mode 100644 CUETools.CTDB.EACPlugin/Resources/ctdb32.png diff --git a/CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs b/CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs new file mode 100644 index 0000000..7fc3c9d --- /dev/null +++ b/CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs @@ -0,0 +1,75 @@ +namespace CUETools.CTDB.EACPlugin +{ + partial class FormSubmitParity + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); + this.SuspendLayout(); + // + // progressBar1 + // + this.progressBar1.Dock = System.Windows.Forms.DockStyle.Top; + this.progressBar1.Location = new System.Drawing.Point(10, 10); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(329, 23); + this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + this.progressBar1.TabIndex = 0; + // + // backgroundWorker1 + // + this.backgroundWorker1.WorkerReportsProgress = true; + this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); + this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); + this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged); + // + // FormSubmitParity + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(349, 49); + this.ControlBox = false; + this.Controls.Add(this.progressBar1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormSubmitParity"; + this.Padding = new System.Windows.Forms.Padding(10); + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Contacting CTDB..."; + this.Load += new System.EventHandler(this.FormMetadata_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ProgressBar progressBar1; + private System.ComponentModel.BackgroundWorker backgroundWorker1; + } +} \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/FormSubmitParity.cs b/CUETools.CTDB.EACPlugin/FormSubmitParity.cs new file mode 100644 index 0000000..6818cbe --- /dev/null +++ b/CUETools.CTDB.EACPlugin/FormSubmitParity.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using CUETools.CTDB.EACPlugin.Properties; + +namespace CUETools.CTDB.EACPlugin +{ + public partial class FormSubmitParity : Form + { + private CUEToolsDB ctdb; + private int confidence, quality; + private string artist, title, agent, drivename; + + public FormSubmitParity(CUEToolsDB ctdb, int confidence, int quality, string artist, string title) + { + this.ctdb = ctdb; + this.confidence = confidence; + this.quality = quality; + this.artist = artist; + this.title = title; + this.InitializeComponent(); + } + + public FormSubmitParity(CUEToolsDB ctdb, string agent, string drivename) + { + this.ctdb = ctdb; + this.agent = agent; + this.drivename = drivename; + this.InitializeComponent(); + } + + private void FormMetadata_Load(object sender, EventArgs e) + { + this.Icon = Resources.ctdb; + this.backgroundWorker1.RunWorkerAsync(); + } + + private void UploadProgress(object sender, Krystalware.UploadHelper.UploadProgressEventArgs e) + { + this.backgroundWorker1.ReportProgress((int)e.percent, e.uri); + } + + private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) + { + this.ctdb.UploadHelper.onProgress += UploadProgress; + if (this.agent != null) + { + this.ctdb.ContactDB(this.agent, this.drivename, false, false); + } + else + { + this.ctdb.DoVerify(); + this.ctdb.Submit(this.confidence, this.quality, this.artist, this.title); + } + this.ctdb.UploadHelper.onProgress -= UploadProgress; + } + + private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + this.DialogResult = DialogResult.OK; + } + + private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + this.progressBar1.Style = e.ProgressPercentage != 0 ? ProgressBarStyle.Continuous : ProgressBarStyle.Marquee; + this.progressBar1.Value = Math.Max(0, Math.Min(100, e.ProgressPercentage)); + } + } +} diff --git a/CUETools.CTDB.EACPlugin/FormSubmitParity.resx b/CUETools.CTDB.EACPlugin/FormSubmitParity.resx new file mode 100644 index 0000000..7aafc39 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/FormSubmitParity.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/Resources/ctdb32.png b/CUETools.CTDB.EACPlugin/Resources/ctdb32.png new file mode 100644 index 0000000000000000000000000000000000000000..cfe050abd891072831dc6b20f01cdc2d6e081018 GIT binary patch literal 5331 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}oCO|{#S9Fdmq3_tg=^Oj z1_mzwOlRkSfQjkW+Vq$V4?QMNR>)4#kBxMFS5Cy1KGRpIFer+}GF8BO0i~)5Udz{fXkDzUIXp zU8jCOtX`abZO`{-Xa8-zZufl6=ee8DvmfB#ndV^}XxhND(n(J6LG$q=#~wb>b7d=7!LT(K42iz{-6Jq)65vgh8D&HB@->Y zIT}P59IE=9mN7WEF*eMdp%%=rfQ2F9baK*Th5%iL1oir7ml+!7{+LO86pfAMAE#ESTfwuWiapzPxD~du$|$+IRWlX3>-WR27w)| znhY$}3<)Qcl`9xpW-^GleG0evsJ%|$xfTOM#mr4MJ5?-Q8>2aN3)#cN_2e|pd5UX` zm?bhL&T`N@R5?@9sL_P~!RIp!3=1ZT3O;E5{I}v9-@0?>%=)(R#p}M>&-Py_De3XQ zr{`A}I503gEUCNrPe*^VRD(5JL+-yts_$4b;Q;wm;6nz~Hi=QEP*v^p}GYItSQf4zk`k$o(h5ti?&?$RQ^IC$5wR znW6;EHBC+$ZD%*gY9;7jaga4R5SY<6xqwgaQ0NXm+XDVyi5&9|YV2v`WN|#fA)Kgq ztAjDAD?+)CLwsiI5524k8#^I(fR~~ zQPZEcJ?@568aD;nUg6p5ymN)QREygp?h7d;hO_#`7Ra3h?;vuCx`Q)vX>`m;JQ*;!xPqaRn z`{eKw<0sNj6hB3C%}sJBT=FCMkw(y|EHBBY0#8kzvZc;2atvKOE9mZug&~5b{ZUS9 z7j6q$AK1P^*rarp<=JL2Pw%B`7frn^l_8$-J#+nwl3jv#r^@+FzYu=u^h@^_(_b)u zDd*vB6Ky`;k**;*TY_C8U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