mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-25 17:34:06 +02:00
Redesign Plugins form
This commit is contained in:
parent
6310711136
commit
073f1da5b4
@ -9,7 +9,7 @@
|
|||||||
namespace TweetDuck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormPlugins : Form{
|
sealed partial class FormPlugins : Form{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
|
|
||||||
public FormPlugins(){
|
public FormPlugins(){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ public FormPlugins(PluginManager pluginManager) : this(){
|
|||||||
|
|
||||||
Shown += (sender, args) => {
|
Shown += (sender, args) => {
|
||||||
Program.UserConfig.PluginsWindow.Restore(this, false);
|
Program.UserConfig.PluginsWindow.Restore(this, false);
|
||||||
ReloadPluginTab();
|
ReloadPluginList();
|
||||||
};
|
};
|
||||||
|
|
||||||
FormClosed += (sender, args) => {
|
FormClosed += (sender, args) => {
|
||||||
@ -30,21 +30,22 @@ public FormPlugins(PluginManager pluginManager) : this(){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadPluginTab(){
|
private int GetPluginOrderIndex(Plugin plugin){
|
||||||
|
return !plugin.CanRun ? 0 : pluginManager.Config.IsEnabled(plugin) ? 1 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReloadPluginList(){
|
||||||
flowLayoutPlugins.SuspendLayout();
|
flowLayoutPlugins.SuspendLayout();
|
||||||
flowLayoutPlugins.Controls.Clear();
|
flowLayoutPlugins.Controls.Clear();
|
||||||
|
|
||||||
Plugin[] plugins = pluginManager.Plugins.OrderBy(plugin => !plugin.CanRun ? 0 : pluginManager.Config.IsEnabled(plugin) ? 1 : 2).ThenBy(plugin => plugin.Name).ToArray();
|
foreach(Plugin plugin in pluginManager.Plugins.OrderBy(GetPluginOrderIndex).ThenBy(plugin => plugin.Name)){
|
||||||
|
flowLayoutPlugins.Controls.Add(new PluginControl(pluginManager, plugin));
|
||||||
|
|
||||||
for(int index = 0; index < plugins.Length; index++){
|
flowLayoutPlugins.Controls.Add(new Panel{
|
||||||
flowLayoutPlugins.Controls.Add(new PluginControl(pluginManager, plugins[index]));
|
BackColor = Color.DimGray,
|
||||||
|
Margin = new Padding(0),
|
||||||
if (index < plugins.Length-1){
|
Size = new Size(1, 1)
|
||||||
flowLayoutPlugins.Controls.Add(new Panel{
|
});
|
||||||
BackColor = Color.DimGray,
|
|
||||||
Size = new Size(1, 1)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flowLayoutPlugins.ResumeLayout(true);
|
flowLayoutPlugins.ResumeLayout(true);
|
||||||
@ -77,7 +78,7 @@ private void btnOpenFolder_Click(object sender, EventArgs e){
|
|||||||
private void btnReload_Click(object sender, EventArgs e){
|
private void btnReload_Click(object sender, EventArgs e){
|
||||||
if (MessageBox.Show("This will also reload the browser window. Do you want to proceed?", "Reloading Plugins", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
if (MessageBox.Show("This will also reload the browser window. Do you want to proceed?", "Reloading Plugins", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
pluginManager.Reload();
|
pluginManager.Reload();
|
||||||
ReloadPluginTab();
|
ReloadPluginList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
Plugins/Controls/PluginControl.Designer.cs
generated
35
Plugins/Controls/PluginControl.Designer.cs
generated
@ -32,6 +32,7 @@ private void InitializeComponent() {
|
|||||||
this.labelWebsite = new System.Windows.Forms.Label();
|
this.labelWebsite = new System.Windows.Forms.Label();
|
||||||
this.labelVersion = new System.Windows.Forms.Label();
|
this.labelVersion = new System.Windows.Forms.Label();
|
||||||
this.btnOpenConfig = new System.Windows.Forms.Button();
|
this.btnOpenConfig = new System.Windows.Forms.Button();
|
||||||
|
this.labelType = new TweetDuck.Core.Controls.LabelVertical();
|
||||||
this.panelDescription.SuspendLayout();
|
this.panelDescription.SuspendLayout();
|
||||||
this.flowLayoutInfo.SuspendLayout();
|
this.flowLayoutInfo.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -39,7 +40,7 @@ private void InitializeComponent() {
|
|||||||
// btnToggleState
|
// btnToggleState
|
||||||
//
|
//
|
||||||
this.btnToggleState.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.btnToggleState.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.btnToggleState.Location = new System.Drawing.Point(459, 80);
|
this.btnToggleState.Location = new System.Drawing.Point(456, 80);
|
||||||
this.btnToggleState.Name = "btnToggleState";
|
this.btnToggleState.Name = "btnToggleState";
|
||||||
this.btnToggleState.Size = new System.Drawing.Size(65, 23);
|
this.btnToggleState.Size = new System.Drawing.Size(65, 23);
|
||||||
this.btnToggleState.TabIndex = 5;
|
this.btnToggleState.TabIndex = 5;
|
||||||
@ -51,7 +52,7 @@ private void InitializeComponent() {
|
|||||||
//
|
//
|
||||||
this.labelName.AutoSize = true;
|
this.labelName.AutoSize = true;
|
||||||
this.labelName.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
this.labelName.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
this.labelName.Location = new System.Drawing.Point(7, 7);
|
this.labelName.Location = new System.Drawing.Point(24, 7);
|
||||||
this.labelName.Name = "labelName";
|
this.labelName.Name = "labelName";
|
||||||
this.labelName.Size = new System.Drawing.Size(61, 24);
|
this.labelName.Size = new System.Drawing.Size(61, 24);
|
||||||
this.labelName.TabIndex = 0;
|
this.labelName.TabIndex = 0;
|
||||||
@ -65,9 +66,9 @@ private void InitializeComponent() {
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.panelDescription.AutoScroll = true;
|
this.panelDescription.AutoScroll = true;
|
||||||
this.panelDescription.Controls.Add(this.labelDescription);
|
this.panelDescription.Controls.Add(this.labelDescription);
|
||||||
this.panelDescription.Location = new System.Drawing.Point(11, 35);
|
this.panelDescription.Location = new System.Drawing.Point(28, 35);
|
||||||
this.panelDescription.Name = "panelDescription";
|
this.panelDescription.Name = "panelDescription";
|
||||||
this.panelDescription.Size = new System.Drawing.Size(513, 39);
|
this.panelDescription.Size = new System.Drawing.Size(493, 39);
|
||||||
this.panelDescription.TabIndex = 2;
|
this.panelDescription.TabIndex = 2;
|
||||||
this.panelDescription.Resize += new System.EventHandler(this.panelDescription_Resize);
|
this.panelDescription.Resize += new System.EventHandler(this.panelDescription_Resize);
|
||||||
//
|
//
|
||||||
@ -101,9 +102,9 @@ private void InitializeComponent() {
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.flowLayoutInfo.Controls.Add(this.labelAuthor);
|
this.flowLayoutInfo.Controls.Add(this.labelAuthor);
|
||||||
this.flowLayoutInfo.Controls.Add(this.labelWebsite);
|
this.flowLayoutInfo.Controls.Add(this.labelWebsite);
|
||||||
this.flowLayoutInfo.Location = new System.Drawing.Point(11, 85);
|
this.flowLayoutInfo.Location = new System.Drawing.Point(28, 85);
|
||||||
this.flowLayoutInfo.Name = "flowLayoutInfo";
|
this.flowLayoutInfo.Name = "flowLayoutInfo";
|
||||||
this.flowLayoutInfo.Size = new System.Drawing.Size(368, 18);
|
this.flowLayoutInfo.Size = new System.Drawing.Size(348, 18);
|
||||||
this.flowLayoutInfo.TabIndex = 3;
|
this.flowLayoutInfo.TabIndex = 3;
|
||||||
this.flowLayoutInfo.WrapContents = false;
|
this.flowLayoutInfo.WrapContents = false;
|
||||||
//
|
//
|
||||||
@ -128,7 +129,7 @@ private void InitializeComponent() {
|
|||||||
this.labelVersion.Location = new System.Drawing.Point(14, 12);
|
this.labelVersion.Location = new System.Drawing.Point(14, 12);
|
||||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
this.labelVersion.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||||
this.labelVersion.Name = "labelVersion";
|
this.labelVersion.Name = "labelVersion";
|
||||||
this.labelVersion.Size = new System.Drawing.Size(513, 13);
|
this.labelVersion.Size = new System.Drawing.Size(510, 13);
|
||||||
this.labelVersion.TabIndex = 1;
|
this.labelVersion.TabIndex = 1;
|
||||||
this.labelVersion.Text = "Version";
|
this.labelVersion.Text = "Version";
|
||||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
@ -137,7 +138,7 @@ private void InitializeComponent() {
|
|||||||
// btnOpenConfig
|
// btnOpenConfig
|
||||||
//
|
//
|
||||||
this.btnOpenConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.btnOpenConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.btnOpenConfig.Location = new System.Drawing.Point(385, 80);
|
this.btnOpenConfig.Location = new System.Drawing.Point(382, 80);
|
||||||
this.btnOpenConfig.Name = "btnOpenConfig";
|
this.btnOpenConfig.Name = "btnOpenConfig";
|
||||||
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23);
|
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23);
|
||||||
this.btnOpenConfig.TabIndex = 4;
|
this.btnOpenConfig.TabIndex = 4;
|
||||||
@ -145,20 +146,35 @@ private void InitializeComponent() {
|
|||||||
this.btnOpenConfig.UseVisualStyleBackColor = true;
|
this.btnOpenConfig.UseVisualStyleBackColor = true;
|
||||||
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click);
|
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click);
|
||||||
//
|
//
|
||||||
|
// labelType
|
||||||
|
//
|
||||||
|
this.labelType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.labelType.BackColor = System.Drawing.Color.DarkGray;
|
||||||
|
this.labelType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
|
this.labelType.LineHeight = 9;
|
||||||
|
this.labelType.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.labelType.Name = "labelType";
|
||||||
|
this.labelType.Size = new System.Drawing.Size(18, 109);
|
||||||
|
this.labelType.TabIndex = 6;
|
||||||
|
this.labelType.Text = "TYPE";
|
||||||
|
//
|
||||||
// PluginControl
|
// PluginControl
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.labelType);
|
||||||
this.Controls.Add(this.btnOpenConfig);
|
this.Controls.Add(this.btnOpenConfig);
|
||||||
this.Controls.Add(this.flowLayoutInfo);
|
this.Controls.Add(this.flowLayoutInfo);
|
||||||
this.Controls.Add(this.panelDescription);
|
this.Controls.Add(this.panelDescription);
|
||||||
this.Controls.Add(this.labelName);
|
this.Controls.Add(this.labelName);
|
||||||
this.Controls.Add(this.btnToggleState);
|
this.Controls.Add(this.btnToggleState);
|
||||||
this.Controls.Add(this.labelVersion);
|
this.Controls.Add(this.labelVersion);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.MaximumSize = new System.Drawing.Size(65535, 109);
|
this.MaximumSize = new System.Drawing.Size(65535, 109);
|
||||||
this.MinimumSize = new System.Drawing.Size(0, 61);
|
this.MinimumSize = new System.Drawing.Size(0, 61);
|
||||||
this.Name = "PluginControl";
|
this.Name = "PluginControl";
|
||||||
this.Padding = new System.Windows.Forms.Padding(3);
|
this.Padding = new System.Windows.Forms.Padding(3, 3, 6, 3);
|
||||||
this.Size = new System.Drawing.Size(530, 109);
|
this.Size = new System.Drawing.Size(530, 109);
|
||||||
this.panelDescription.ResumeLayout(false);
|
this.panelDescription.ResumeLayout(false);
|
||||||
this.panelDescription.PerformLayout();
|
this.panelDescription.PerformLayout();
|
||||||
@ -180,5 +196,6 @@ private void InitializeComponent() {
|
|||||||
private System.Windows.Forms.Label labelWebsite;
|
private System.Windows.Forms.Label labelWebsite;
|
||||||
private System.Windows.Forms.Label labelVersion;
|
private System.Windows.Forms.Label labelVersion;
|
||||||
private System.Windows.Forms.Button btnOpenConfig;
|
private System.Windows.Forms.Button btnOpenConfig;
|
||||||
|
private Core.Controls.LabelVertical labelType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDuck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
partial class PluginControl : UserControl{
|
partial class PluginControl : UserControl{
|
||||||
@ -68,6 +70,15 @@ private void UpdatePluginState(){
|
|||||||
labelAuthor.ForeColor = textColor;
|
labelAuthor.ForeColor = textColor;
|
||||||
labelWebsite.ForeColor = isEnabled ? Color.Blue : Color.FromArgb(90, 90, 249);
|
labelWebsite.ForeColor = isEnabled ? Color.Blue : Color.FromArgb(90, 90, 249);
|
||||||
|
|
||||||
|
if (plugin.Group == PluginGroup.Official){
|
||||||
|
labelType.Text = "OFFICIAL";
|
||||||
|
labelType.BackColor = isEnabled ? Color.FromArgb(154, 195, 217) : Color.FromArgb(185, 185, 185);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
labelType.Text = "CUSTOM";
|
||||||
|
labelType.BackColor = isEnabled ? Color.FromArgb(208, 154, 217) : Color.FromArgb(185, 185, 185);
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.CanRun){
|
if (plugin.CanRun){
|
||||||
labelName.ForeColor = textColor;
|
labelName.ForeColor = textColor;
|
||||||
labelDescription.ForeColor = textColor;
|
labelDescription.ForeColor = textColor;
|
||||||
|
Loading…
Reference in New Issue
Block a user