mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Rejig update dialog to provide a bit more info and display RTF notes
This commit is contained in:
+69
-20
@@ -29,11 +29,14 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.updateVer = new System.Windows.Forms.Label();
|
||||
this.updateNotes = new System.Windows.Forms.TextBox();
|
||||
this.progressBar = new System.Windows.Forms.ProgressBar();
|
||||
this.doupdate = new System.Windows.Forms.Button();
|
||||
this.progressText = new System.Windows.Forms.Label();
|
||||
this.close = new System.Windows.Forms.Button();
|
||||
this.updateNotes = new System.Windows.Forms.RichTextBox();
|
||||
this.updateMetadata = new System.Windows.Forms.Label();
|
||||
this.metaDataLabel = new System.Windows.Forms.Label();
|
||||
this.rlsNotes = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// updateVer
|
||||
@@ -43,25 +46,16 @@
|
||||
this.updateVer.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.updateVer.Location = new System.Drawing.Point(10, 9);
|
||||
this.updateVer.Name = "updateVer";
|
||||
this.updateVer.Size = new System.Drawing.Size(376, 25);
|
||||
this.updateVer.Size = new System.Drawing.Size(378, 25);
|
||||
this.updateVer.TabIndex = 1;
|
||||
this.updateVer.Text = "Update Available - v0.00-betahash";
|
||||
this.updateVer.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// updateNotes
|
||||
//
|
||||
this.updateNotes.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.updateNotes.Location = new System.Drawing.Point(15, 37);
|
||||
this.updateNotes.Multiline = true;
|
||||
this.updateNotes.Name = "updateNotes";
|
||||
this.updateNotes.ReadOnly = true;
|
||||
this.updateNotes.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.updateNotes.Size = new System.Drawing.Size(363, 194);
|
||||
this.updateNotes.TabIndex = 2;
|
||||
//
|
||||
// progressBar
|
||||
//
|
||||
this.progressBar.Location = new System.Drawing.Point(131, 244);
|
||||
this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.progressBar.Location = new System.Drawing.Point(131, 289);
|
||||
this.progressBar.Name = "progressBar";
|
||||
this.progressBar.Size = new System.Drawing.Size(249, 23);
|
||||
this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||
@@ -69,7 +63,8 @@
|
||||
//
|
||||
// doupdate
|
||||
//
|
||||
this.doupdate.Location = new System.Drawing.Point(212, 273);
|
||||
this.doupdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.doupdate.Location = new System.Drawing.Point(212, 318);
|
||||
this.doupdate.Name = "doupdate";
|
||||
this.doupdate.Size = new System.Drawing.Size(168, 23);
|
||||
this.doupdate.TabIndex = 4;
|
||||
@@ -79,8 +74,9 @@
|
||||
//
|
||||
// progressText
|
||||
//
|
||||
this.progressText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.progressText.AutoSize = true;
|
||||
this.progressText.Location = new System.Drawing.Point(15, 249);
|
||||
this.progressText.Location = new System.Drawing.Point(15, 294);
|
||||
this.progressText.Name = "progressText";
|
||||
this.progressText.Size = new System.Drawing.Size(78, 13);
|
||||
this.progressText.TabIndex = 5;
|
||||
@@ -88,7 +84,8 @@
|
||||
//
|
||||
// close
|
||||
//
|
||||
this.close.Location = new System.Drawing.Point(131, 273);
|
||||
this.close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.close.Location = new System.Drawing.Point(131, 318);
|
||||
this.close.Name = "close";
|
||||
this.close.Size = new System.Drawing.Size(75, 23);
|
||||
this.close.TabIndex = 6;
|
||||
@@ -96,16 +93,65 @@
|
||||
this.close.UseVisualStyleBackColor = true;
|
||||
this.close.Click += new System.EventHandler(this.close_Click);
|
||||
//
|
||||
// updateNotes
|
||||
//
|
||||
this.updateNotes.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)));
|
||||
this.updateNotes.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.updateNotes.Location = new System.Drawing.Point(18, 37);
|
||||
this.updateNotes.Name = "updateNotes";
|
||||
this.updateNotes.ReadOnly = true;
|
||||
this.updateNotes.ShortcutsEnabled = false;
|
||||
this.updateNotes.Size = new System.Drawing.Size(362, 201);
|
||||
this.updateNotes.TabIndex = 7;
|
||||
this.updateNotes.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.updateNotes_LinkClicked);
|
||||
//
|
||||
// updateMetadata
|
||||
//
|
||||
this.updateMetadata.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.updateMetadata.AutoSize = true;
|
||||
this.updateMetadata.Location = new System.Drawing.Point(314, 247);
|
||||
this.updateMetadata.Name = "updateMetadata";
|
||||
this.updateMetadata.Size = new System.Drawing.Size(54, 65);
|
||||
this.updateMetadata.TabIndex = 8;
|
||||
this.updateMetadata.Text = "v0.xx\r\n\r\nv0.yy\r\n\r\nAA.BBMB";
|
||||
//
|
||||
// metaDataLabel
|
||||
//
|
||||
this.metaDataLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.metaDataLabel.AutoSize = true;
|
||||
this.metaDataLabel.Location = new System.Drawing.Point(226, 247);
|
||||
this.metaDataLabel.Name = "metaDataLabel";
|
||||
this.metaDataLabel.Size = new System.Drawing.Size(82, 65);
|
||||
this.metaDataLabel.TabIndex = 9;
|
||||
this.metaDataLabel.Text = "Current Version:\r\n\r\nNew Version:\r\n\r\nDownload Size:";
|
||||
this.metaDataLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// rlsNotes
|
||||
//
|
||||
this.rlsNotes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.rlsNotes.Location = new System.Drawing.Point(15, 318);
|
||||
this.rlsNotes.Name = "rlsNotes";
|
||||
this.rlsNotes.Size = new System.Drawing.Size(110, 23);
|
||||
this.rlsNotes.TabIndex = 10;
|
||||
this.rlsNotes.Text = "Full Release Notes";
|
||||
this.rlsNotes.UseVisualStyleBackColor = true;
|
||||
this.rlsNotes.Click += new System.EventHandler(this.rlsNotes_Click);
|
||||
//
|
||||
// UpdateDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(392, 308);
|
||||
this.ClientSize = new System.Drawing.Size(394, 354);
|
||||
this.Controls.Add(this.rlsNotes);
|
||||
this.Controls.Add(this.metaDataLabel);
|
||||
this.Controls.Add(this.updateMetadata);
|
||||
this.Controls.Add(this.updateNotes);
|
||||
this.Controls.Add(this.close);
|
||||
this.Controls.Add(this.progressText);
|
||||
this.Controls.Add(this.doupdate);
|
||||
this.Controls.Add(this.progressBar);
|
||||
this.Controls.Add(this.updateNotes);
|
||||
this.Controls.Add(this.updateVer);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
@@ -124,10 +170,13 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label updateVer;
|
||||
private System.Windows.Forms.TextBox updateNotes;
|
||||
private System.Windows.Forms.ProgressBar progressBar;
|
||||
private System.Windows.Forms.Button doupdate;
|
||||
private System.Windows.Forms.Label progressText;
|
||||
private System.Windows.Forms.Button close;
|
||||
private System.Windows.Forms.RichTextBox updateNotes;
|
||||
private System.Windows.Forms.Label updateMetadata;
|
||||
private System.Windows.Forms.Label metaDataLabel;
|
||||
private System.Windows.Forms.Button rlsNotes;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using renderdocui.Code;
|
||||
using System.Diagnostics;
|
||||
using renderdoc;
|
||||
|
||||
namespace renderdocui.Windows.Dialogs
|
||||
{
|
||||
@@ -23,6 +24,7 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
internal const int BCM_SETSHIELD = 0x160C; // Button needs elevation
|
||||
|
||||
string m_NewVer = "";
|
||||
string m_URL = "";
|
||||
int m_Size = 0;
|
||||
|
||||
@@ -36,17 +38,35 @@ namespace renderdocui.Windows.Dialogs
|
||||
string[] response_split = core.Config.CheckUpdate_UpdateResponse.Split('\n');
|
||||
|
||||
progressText.Text = "";
|
||||
progressBar.Visible = false;
|
||||
|
||||
updateVer.Text = String.Format("Update Available - v{0}", response_split[0]);
|
||||
Text = updateVer.Text = String.Format("Update Available - v{0}", response_split[0]);
|
||||
m_NewVer = response_split[0];
|
||||
m_URL = response_split[1];
|
||||
int.TryParse(response_split[2], out m_Size);
|
||||
|
||||
string notes = "";
|
||||
for(int i=3; i < response_split.Length; i++)
|
||||
notes += response_split[i] + Environment.NewLine;
|
||||
updateNotes.Text = notes.Trim();
|
||||
|
||||
try
|
||||
{
|
||||
updateNotes.Rtf = notes.Trim();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// most likely invalid formatting, so fall back to a sensible default
|
||||
updateNotes.Rtf = @"{\rtf1\ansi\fs36\sa200\sl276\slmult1RenderDoc v" + m_NewVer + @" \fs16" +
|
||||
@"\par A new version of RenderDoc is available and it's recommended that you update.}";
|
||||
}
|
||||
|
||||
updateNotes.Select(0, 0);
|
||||
|
||||
updateMetadata.Text = "v" + StaticExports.GetVersionString() +
|
||||
Environment.NewLine + Environment.NewLine +
|
||||
String.Format("v{0}", response_split[0]) +
|
||||
Environment.NewLine + Environment.NewLine +
|
||||
String.Format("{0:0.00} MB", (float)m_Size/1024.0f/1024.0f);
|
||||
}
|
||||
|
||||
void SetDownloadProgress(int bytes_received)
|
||||
@@ -62,6 +82,9 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
progressBar.Visible = true;
|
||||
updateMetadata.Visible = metaDataLabel.Visible = false;
|
||||
|
||||
progressText.Text = "Preparing";
|
||||
|
||||
close.Enabled = false;
|
||||
@@ -199,5 +222,15 @@ namespace renderdocui.Windows.Dialogs
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void updateNotes_LinkClicked(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start(e.LinkText);
|
||||
}
|
||||
|
||||
private void rlsNotes_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start(String.Format("https://github.com/baldurk/renderdoc/releases/tag/v{0}", m_NewVer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1260,7 +1260,7 @@ namespace renderdocui.Windows
|
||||
var updateThread = Helpers.NewThread(new ThreadStart(() =>
|
||||
{
|
||||
// spawn thread to check update
|
||||
WebRequest g = HttpWebRequest.Create(String.Format("https://renderdoc.org/getupdateurl/{0}/{1}", IntPtr.Size == 4 ? "32" : "64", versionCheck));
|
||||
WebRequest g = HttpWebRequest.Create(String.Format("https://renderdoc.org/getupdateurl/{0}/{1}?rtfnotes=1", IntPtr.Size == 4 ? "32" : "64", versionCheck));
|
||||
|
||||
UpdateResult result = UpdateResult.Disabled;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user