1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-12 14:34:08 +02:00

Move the 'Updates' tab into 'General'

This commit is contained in:
chylex 2017-03-21 00:17:43 +01:00
parent 96146e3dc8
commit 0cbcc8c9f3
6 changed files with 93 additions and 154 deletions

View File

@ -24,9 +24,8 @@ public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler up
this.browser.PauseNotification();
this.tabPanel.SetupTabPanel(100);
this.tabPanel.AddButton("General", SelectTab<TabSettingsGeneral>);
this.tabPanel.AddButton("General", () => SelectTab(() => new TabSettingsGeneral(updates)));
this.tabPanel.AddButton("Notifications", () => SelectTab(() => new TabSettingsNotifications(browser.CreateNotificationForm(NotificationFlags.DisableContextMenu), !hasFinishedLoading)));
this.tabPanel.AddButton("Updates", () => SelectTab(() => new TabSettingsUpdates(updates)));
this.tabPanel.AddButton("Advanced", () => SelectTab(() => new TabSettingsAdvanced(browser.ReinjectCustomCSS, plugins)));
this.tabPanel.SelectTab(tabPanel.Buttons.ElementAt(startTabIndex));

View File

@ -33,8 +33,12 @@ private void InitializeComponent() {
this.groupTray = new System.Windows.Forms.GroupBox();
this.labelTrayIcon = new System.Windows.Forms.Label();
this.groupInterface = new System.Windows.Forms.GroupBox();
this.groupUpdates = new System.Windows.Forms.GroupBox();
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
this.btnCheckUpdates = new System.Windows.Forms.Button();
this.groupTray.SuspendLayout();
this.groupInterface.SuspendLayout();
this.groupUpdates.SuspendLayout();
this.SuspendLayout();
//
// checkExpandLinks
@ -134,10 +138,47 @@ private void InitializeComponent() {
this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface";
//
// groupUpdates
//
this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
this.groupUpdates.Controls.Add(this.btnCheckUpdates);
this.groupUpdates.Location = new System.Drawing.Point(198, 9);
this.groupUpdates.Name = "groupUpdates";
this.groupUpdates.Size = new System.Drawing.Size(183, 75);
this.groupUpdates.TabIndex = 17;
this.groupUpdates.TabStop = false;
this.groupUpdates.Text = "Updates";
//
// checkUpdateNotifications
//
this.checkUpdateNotifications.AutoSize = true;
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 21);
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
this.checkUpdateNotifications.TabIndex = 14;
this.checkUpdateNotifications.Text = "Check Updates Automatically";
this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" +
"in.");
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
this.checkUpdateNotifications.CheckedChanged += new System.EventHandler(this.checkUpdateNotifications_CheckedChanged);
//
// btnCheckUpdates
//
this.btnCheckUpdates.Location = new System.Drawing.Point(6, 44);
this.btnCheckUpdates.Name = "btnCheckUpdates";
this.btnCheckUpdates.Size = new System.Drawing.Size(171, 23);
this.btnCheckUpdates.TabIndex = 15;
this.btnCheckUpdates.Text = "Check Updates Now";
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
this.btnCheckUpdates.UseVisualStyleBackColor = true;
this.btnCheckUpdates.Click += new System.EventHandler(this.btnCheckUpdates_Click);
//
// TabSettingsGeneral
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupUpdates);
this.Controls.Add(this.groupInterface);
this.Controls.Add(this.groupTray);
this.Name = "TabSettingsGeneral";
@ -146,6 +187,8 @@ private void InitializeComponent() {
this.groupTray.PerformLayout();
this.groupInterface.ResumeLayout(false);
this.groupInterface.PerformLayout();
this.groupUpdates.ResumeLayout(false);
this.groupUpdates.PerformLayout();
this.ResumeLayout(false);
}
@ -161,5 +204,8 @@ private void InitializeComponent() {
private System.Windows.Forms.CheckBox checkTrayHighlight;
private System.Windows.Forms.CheckBox checkSpellCheck;
private System.Windows.Forms.CheckBox checkScreenshotBorder;
private System.Windows.Forms.GroupBox groupUpdates;
private System.Windows.Forms.CheckBox checkUpdateNotifications;
private System.Windows.Forms.Button btnCheckUpdates;
}
}

View File

@ -1,9 +1,19 @@
using System;
using System.Windows.Forms;
using TweetDck.Updates;
using TweetDck.Updates.Events;
namespace TweetDck.Core.Other.Settings{
partial class TabSettingsGeneral : BaseTabSettings{
public TabSettingsGeneral(){
private readonly UpdateHandler updates;
private int updateCheckEventId = -1;
public TabSettingsGeneral(UpdateHandler updates){
InitializeComponent();
this.updates = updates;
this.updates.CheckFinished += updates_CheckFinished;
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
comboBoxTrayType.Items.Add("Disabled");
comboBoxTrayType.Items.Add("Display Icon Only");
@ -16,6 +26,8 @@ public TabSettingsGeneral(){
checkSpellCheck.Checked = Config.EnableSpellCheck;
checkScreenshotBorder.Checked = Config.ShowScreenshotBorder;
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
}
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
@ -48,5 +60,38 @@ private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
}
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
}
private void btnCheckUpdates_Click(object sender, EventArgs e){
if (!Ready)return;
updateCheckEventId = updates.Check(true);
if (updateCheckEventId == -1){
MessageBox.Show("Sorry, your system is no longer supported.", "Unsupported System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else{
btnCheckUpdates.Enabled = false;
updates.Settings.DismissedUpdate = string.Empty;
Config.DismissedUpdate = string.Empty;
Config.Save();
}
}
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
if (e.EventId == updateCheckEventId){
btnCheckUpdates.Enabled = true;
if (!e.UpdateAvailable){
MessageBox.Show("Your version of "+Program.BrandName+" is up to date.", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
}

View File

@ -1,90 +0,0 @@
namespace TweetDck.Core.Other.Settings {
partial class TabSettingsUpdates {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.btnCheckUpdates = new System.Windows.Forms.Button();
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.groupGeneral = new System.Windows.Forms.GroupBox();
this.groupGeneral.SuspendLayout();
this.SuspendLayout();
//
// btnCheckUpdates
//
this.btnCheckUpdates.Location = new System.Drawing.Point(6, 44);
this.btnCheckUpdates.Name = "btnCheckUpdates";
this.btnCheckUpdates.Size = new System.Drawing.Size(171, 23);
this.btnCheckUpdates.TabIndex = 15;
this.btnCheckUpdates.Text = "Check Updates Now";
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
this.btnCheckUpdates.UseVisualStyleBackColor = true;
this.btnCheckUpdates.Click += new System.EventHandler(this.btnCheckUpdates_Click);
//
// checkUpdateNotifications
//
this.checkUpdateNotifications.AutoSize = true;
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 21);
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
this.checkUpdateNotifications.TabIndex = 14;
this.checkUpdateNotifications.Text = "Check Updates Automatically";
this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" +
"in.");
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
this.checkUpdateNotifications.CheckedChanged += new System.EventHandler(this.checkUpdateNotifications_CheckedChanged);
//
// groupGeneral
//
this.groupGeneral.Controls.Add(this.checkUpdateNotifications);
this.groupGeneral.Controls.Add(this.btnCheckUpdates);
this.groupGeneral.Location = new System.Drawing.Point(9, 9);
this.groupGeneral.Name = "groupGeneral";
this.groupGeneral.Size = new System.Drawing.Size(183, 75);
this.groupGeneral.TabIndex = 16;
this.groupGeneral.TabStop = false;
this.groupGeneral.Text = "General";
//
// TabSettingsUpdates
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupGeneral);
this.Name = "TabSettingsUpdates";
this.Size = new System.Drawing.Size(478, 282);
this.groupGeneral.ResumeLayout(false);
this.groupGeneral.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnCheckUpdates;
private System.Windows.Forms.CheckBox checkUpdateNotifications;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.GroupBox groupGeneral;
}
}

View File

@ -1,55 +0,0 @@
using System;
using System.Windows.Forms;
using TweetDck.Updates;
using TweetDck.Updates.Events;
namespace TweetDck.Core.Other.Settings{
partial class TabSettingsUpdates : BaseTabSettings{
private readonly UpdateHandler updates;
private int updateCheckEventId = -1;
public TabSettingsUpdates(UpdateHandler updates){
InitializeComponent();
this.updates = updates;
this.updates.CheckFinished += updates_CheckFinished;
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
}
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
}
private void btnCheckUpdates_Click(object sender, EventArgs e){
if (!Ready)return;
updateCheckEventId = updates.Check(true);
if (updateCheckEventId == -1){
MessageBox.Show("Sorry, your system is no longer supported.", "Unsupported System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else{
btnCheckUpdates.Enabled = false;
updates.Settings.DismissedUpdate = string.Empty;
Config.DismissedUpdate = string.Empty;
Config.Save();
}
}
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
if (e.EventId == updateCheckEventId){
btnCheckUpdates.Enabled = true;
if (!e.UpdateAvailable){
MessageBox.Show("Your version of "+Program.BrandName+" is up to date.", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
}

View File

@ -193,12 +193,6 @@
<Compile Include="Core\Other\Settings\TabSettingsNotifications.Designer.cs">
<DependentUpon>TabSettingsNotifications.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\TabSettingsUpdates.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Core\Other\Settings\TabSettingsUpdates.Designer.cs">
<DependentUpon>TabSettingsUpdates.cs</DependentUpon>
</Compile>
<Compile Include="Core\Bridge\CallbackBridge.cs" />
<Compile Include="Core\Utils\CommandLineArgs.cs" />
<Compile Include="Core\Utils\CommandLineArgsParser.cs" />