Cleanup of plugin names and made sure the plugin writer gets credit for his work.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1728 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-03-31 20:18:17 +00:00
commit 9a6bc91c00
14 changed files with 60 additions and 33 deletions

View file

@ -34,7 +34,7 @@ using Greenshot.Plugin;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("GreenshotOCR")]
[assembly: AssemblyProduct("OCR Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -61,7 +61,7 @@ namespace Greenshot.Destinations {
public override bool isActive {
get {
return conf.isExperimentalFeatureEnabled("Picker");
return true;
}
}

View file

@ -28,6 +28,7 @@ using System.IO;
using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Destinations;
using Greenshot.Drawing;
using Greenshot.Drawing.Fields;
using Greenshot.Drawing.Fields.Binding;
@ -49,7 +50,7 @@ namespace Greenshot {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImageEditorForm));
private static EditorConfiguration editorConfiguration = IniConfig.GetIniSection<EditorConfiguration>();
private static CoreConfiguration coreConf = IniConfig.GetIniSection<CoreConfiguration>();
private static List<string> ignoreDestinations = new List<string>() {"Picker", "Editor"};
private static List<string> ignoreDestinations = new List<string>() {PickerDestination.DESIGNATION, EditorDestination.DESIGNATION};
private static List<IImageEditor> editorList = new List<IImageEditor>();
private ILanguage lang;

View file

@ -40,6 +40,7 @@ using GreenshotPlugin.UnmanagedHelpers;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
using Greenshot.Destinations;
namespace Greenshot {
/// <summary>
@ -957,12 +958,12 @@ namespace Greenshot {
void QuickSettingDestinationChanged(object sender, EventArgs e) {
ToolStripMenuSelectListItem item = ((ItemCheckedChangedEventArgs)e).Item;
IDestination selectedDestination = (IDestination)item.Data;
if (item.Checked && selectedDestination.Designation.Equals("Picker")) {
if (item.Checked && selectedDestination.Designation.Equals(PickerDestination.DESIGNATION)) {
foreach(ToolStripMenuSelectList ddi in contextmenu_quicksettings.DropDownItems) {
if (ddi.Identifier.Equals("destinations")) {
foreach(ToolStripMenuSelectListItem dropDownItem in ddi.DropDownItems) {
IDestination destination = dropDownItem.Data as IDestination;
if (!destination.Designation.Equals("Picker")) {
if (!destination.Designation.Equals(PickerDestination.DESIGNATION)) {
if (dropDownItem.CheckState == CheckState.Checked) {
dropDownItem.CheckState = CheckState.Unchecked;
}

View file

@ -25,6 +25,7 @@ using System.IO;
using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Destinations;
using Greenshot.Helpers;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
@ -133,7 +134,7 @@ namespace Greenshot {
listview_plugins.BeginUpdate();
listview_plugins.Items.Clear();
listview_plugins.Columns.Clear();
string[] columns = { "Name", "Version", "DLL Path"};
string[] columns = { "Name", "Version", "Created by", "DLL path"};
foreach (string column in columns) {
listview_plugins.Columns.Add(column);
}
@ -487,17 +488,17 @@ namespace Greenshot {
bool clipboardDestinationChecked = false;
bool pickerSelected = false;
foreach(IDestination destination in checkedDestinationsListBox.CheckedItems) {
if (destination.Designation.Equals("Clipboard")) {
if (destination.Designation.Equals(ClipboardDestination.DESIGNATION)) {
clipboardDestinationChecked = true;
}
if (destination.Designation.Equals("Picker")) {
if (destination.Designation.Equals(PickerDestination.DESIGNATION)) {
pickerSelected = true;
}
}
if (pickerSelected) {
foreach(int index in checkedDestinationsListBox.CheckedIndices) {
IDestination destination = (IDestination)checkedDestinationsListBox.Items[index];
if (!destination.Designation.Equals("Picker")) {
if (!destination.Designation.Equals(PickerDestination.DESIGNATION)) {
checkedDestinationsListBox.SetItemCheckState(index, CheckState.Indeterminate);
}
}

View file

@ -29,6 +29,7 @@ using System.Threading;
using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Destinations;
using Greenshot.Drawing;
using Greenshot.Forms;
using Greenshot.Helpers;
@ -266,13 +267,13 @@ namespace Greenshot.Helpers {
capture = new Capture(fileBitmap);
}
// Force Editor, keep picker, this is currently the only usefull destination
if (capture.CaptureDetails.HasDestination("Picker")) {
if (capture.CaptureDetails.HasDestination(PickerDestination.DESIGNATION)) {
capture.CaptureDetails.ClearDestinations();
capture.CaptureDetails.AddDestination(DestinationHelper.GetDestination(Destinations.EditorDestination.DESIGNATION));
capture.CaptureDetails.AddDestination(DestinationHelper.GetDestination(Destinations.PickerDestination.DESIGNATION));
capture.CaptureDetails.AddDestination(DestinationHelper.GetDestination(EditorDestination.DESIGNATION));
capture.CaptureDetails.AddDestination(DestinationHelper.GetDestination(PickerDestination.DESIGNATION));
} else {
capture.CaptureDetails.ClearDestinations();
capture.CaptureDetails.AddDestination(DestinationHelper.GetDestination(Destinations.EditorDestination.DESIGNATION));
capture.CaptureDetails.AddDestination(DestinationHelper.GetDestination(EditorDestination.DESIGNATION));
}
HandleCapture();
}
@ -499,7 +500,7 @@ namespace Greenshot.Helpers {
// Flag to detect if we need to create a temp file for the email
// or use the file that was written
foreach(IDestination destination in captureDetails.CaptureDestinations) {
if ("Picker".Equals(destination.Designation)) {
if (PickerDestination.DESIGNATION.Equals(destination.Designation)) {
continue;
}
LOG.InfoFormat("Calling destination {0}", destination.Description);

View file

@ -44,7 +44,7 @@ namespace Greenshot.Helpers {
public static string pafPath = Path.Combine(Application.StartupPath, @"App\Greenshot");
public static readonly PluginHelper instance = new PluginHelper();
private static Dictionary<PluginAttribute, IGreenshotPlugin> plugins = new Dictionary<PluginAttribute, IGreenshotPlugin>();
private static IDictionary<PluginAttribute, IGreenshotPlugin> plugins = new SortedDictionary<PluginAttribute, IGreenshotPlugin>();
private PluginHelper() {
}
@ -65,6 +65,7 @@ namespace Greenshot.Helpers {
foreach(PluginAttribute pluginAttribute in plugins.Keys) {
ListViewItem item = new ListViewItem(pluginAttribute.Name);
item.SubItems.Add(pluginAttribute.Version);
item.SubItems.Add(pluginAttribute.CreatedBy);
item.SubItems.Add(pluginAttribute.DllFile);
item.Tag = pluginAttribute;
listview.Items.Add(item);
@ -141,7 +142,7 @@ namespace Greenshot.Helpers {
get { return mainMenu;}
}
public Dictionary<PluginAttribute, IGreenshotPlugin> Plugins {
public IDictionary<PluginAttribute, IGreenshotPlugin> Plugins {
get {return plugins;}
}
@ -238,12 +239,22 @@ namespace Greenshot.Helpers {
PluginAttribute[] pluginAttributes = assembly.GetCustomAttributes(typeof(PluginAttribute), false) as PluginAttribute[];
if (pluginAttributes.Length > 0) {
PluginAttribute pluginAttribute = pluginAttributes[0];
AssemblyProductAttribute[] assemblyProductAttributes = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false) as AssemblyProductAttribute[];
if (assemblyProductAttributes.Length > 0) {
pluginAttribute.Name = assemblyProductAttributes[0].Product;
} else {
continue;
if (string.IsNullOrEmpty(pluginAttribute.Name)) {
AssemblyProductAttribute[] assemblyProductAttributes = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false) as AssemblyProductAttribute[];
if (assemblyProductAttributes.Length > 0) {
pluginAttribute.Name = assemblyProductAttributes[0].Product;
} else {
continue;
}
}
if (string.IsNullOrEmpty(pluginAttribute.CreatedBy)) {
AssemblyCompanyAttribute[] assemblyCompanyAttributes = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false) as AssemblyCompanyAttribute[];
if (assemblyCompanyAttributes.Length > 0) {
pluginAttribute.CreatedBy = assemblyCompanyAttributes[0].Company;
} else {
continue;
}
}
pluginAttribute.Version = assembly.GetName().Version.ToString();
pluginAttribute.DllFile = pluginFile;

View file

@ -34,7 +34,7 @@ using Greenshot.Plugin;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("GreenshotConfluencePlugin")]
[assembly: AssemblyProduct("Confluence Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -33,8 +33,8 @@ using Greenshot.Plugin;
[assembly: AssemblyTitle("GreenshotExternalCommandPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GreenshotExternalCommandPlugin")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("External command Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -34,7 +34,7 @@ using Greenshot.Plugin;
[assembly: AssemblyDescription("A plugin to upload images to Imgur")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("Greenshot-Imgur-Plugin")]
[assembly: AssemblyProduct("Imgur Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -34,7 +34,7 @@ using Greenshot.Plugin;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("GreenshotJiraPlugin")]
[assembly: AssemblyProduct("Jira Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -33,8 +33,8 @@ using Greenshot.Plugin;
[assembly: AssemblyTitle("GreenshotNetworkImportPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GreenshotNetworkImportPlugin")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("Network import Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -29,11 +29,15 @@ using GreenshotPlugin.Core;
namespace Greenshot.Plugin {
[Serializable]
[AttributeUsageAttribute(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
sealed public class PluginAttribute : Attribute {
sealed public class PluginAttribute : Attribute, IComparable {
public string Name {
get;
set;
}
public string CreatedBy {
get;
set;
}
public string Version {
get;
set;
@ -56,6 +60,14 @@ namespace Greenshot.Plugin {
this.EntryType = entryType;
this.Configurable = configurable;
}
public int CompareTo(object obj) {
PluginAttribute other = obj as PluginAttribute;
if (other != null) {
return Name.CompareTo(other.Name);
}
throw new ArgumentException("object is not a PluginAttribute");
}
}
// Delegates for hooking up events.
@ -118,7 +130,7 @@ namespace Greenshot.Plugin {
/// List of available plugins with their PluginAttributes
/// This can be usefull for a plugin manager plugin...
/// </summary>
Dictionary<PluginAttribute, IGreenshotPlugin> Plugins {
IDictionary<PluginAttribute, IGreenshotPlugin> Plugins {
get;
}

View file

@ -33,8 +33,8 @@ using Greenshot.Plugin;
[assembly: AssemblyTitle("PluginExample")]
[assembly: AssemblyDescription("An example plugin")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PluginExample")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("Example Plugin")]
[assembly: AssemblyCopyright("Copyright 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]