Added an "Update all" button for the plugin window

This commit is contained in:
niksedk 2014-03-19 20:49:12 +01:00
parent 26f335bb2b
commit 04e2d5d670
7 changed files with 125 additions and 18 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@
/SubtitleEdit-*-setup.exe
/src/SubtitleEdit.csproj.user
/src/Languages/Language.xml
/src/Languages/LanguageMaster.xml
/src/Languages/XmlContentTranslator.exe

View File

@ -9,6 +9,7 @@
* Added shortcut for Tools -> "Split long lines" - thx John
* Added shortcut for Sync -> "Change frame rate" - thx Alfonso
* Added setting regarding "Fix short display times" - thx S1l3nc0r
* Added an "Update all" button for the plugin window
* IMPROVED:
* Updated French language file - thx JM GBT
* Updated Dutch language file - thx Quetsbeek
@ -22,6 +23,7 @@
* Some fixes for move word up/down - thx rebawest
* Delete custom export format now works - thx Leon
* Possible crash in OCR window - thx grfilho
* Dcinema smpte sometimes generated illegal frame numbers - thx knut
3.3.14 (23rd February 2014)

View File

@ -48,6 +48,7 @@
this.columnHeaderInsType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tabPageGetPlugins = new System.Windows.Forms.TabPage();
this.labelPleaseWait = new System.Windows.Forms.Label();
this.buttonUpdateAll = new System.Windows.Forms.Button();
this.tabControlPlugins.SuspendLayout();
this.tabPageInstalledPlugins.SuspendLayout();
this.tabPageGetPlugins.SuspendLayout();
@ -160,6 +161,7 @@
//
// tabPageInstalledPlugins
//
this.tabPageInstalledPlugins.Controls.Add(this.buttonUpdateAll);
this.tabPageInstalledPlugins.Controls.Add(this.buttonRemove);
this.tabPageInstalledPlugins.Controls.Add(this.listViewInstalledPlugins);
this.tabPageInstalledPlugins.Location = new System.Drawing.Point(4, 22);
@ -246,6 +248,17 @@
this.labelPleaseWait.TabIndex = 28;
this.labelPleaseWait.Text = "Please wait...";
//
// buttonUpdateAll
//
this.buttonUpdateAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUpdateAll.Location = new System.Drawing.Point(510, 375);
this.buttonUpdateAll.Name = "buttonUpdateAll";
this.buttonUpdateAll.Size = new System.Drawing.Size(134, 25);
this.buttonUpdateAll.TabIndex = 30;
this.buttonUpdateAll.Text = "Updata all";
this.buttonUpdateAll.UseVisualStyleBackColor = true;
this.buttonUpdateAll.Click += new System.EventHandler(this.buttonUpdateAll_Click);
//
// PluginsGet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -295,5 +308,6 @@
private System.Windows.Forms.ColumnHeader columnHeaderInsType;
private System.Windows.Forms.TabPage tabPageGetPlugins;
private System.Windows.Forms.Label labelPleaseWait;
private System.Windows.Forms.Button buttonUpdateAll;
}
}

View File

@ -16,13 +16,17 @@ namespace Nikse.SubtitleEdit.Forms
private XmlDocument _pluginDoc = new XmlDocument();
private string _downloadedPluginName;
readonly LanguageStructure.PluginsGet _language;
bool _firstTry = true;
// bool _firstTry = true;
List<string> _updateAllListUrls;
List<string> _updateAllListNames;
bool _updatingAllPlugins = false;
int _updatingAllPluginsCount = 0;
private string GetPluginXmlFileUrl()
{
if (Environment.Version.Major < 4)
return "https://raw.github.com/SubtitleEdit/plugins/master/Plugins2.xml";
return "https://raw.github.com/SubtitleEdit/plugins/master/Plugins4.xml";
return "https://raw.github.com/SubtitleEdit/plugins/master/Plugins2.xml"; // .net 2-3.5
return "https://raw.github.com/SubtitleEdit/plugins/master/Plugins4.xml"; // .net 4-?
}
public PluginsGet()
@ -50,6 +54,7 @@ namespace Nikse.SubtitleEdit.Forms
columnHeaderInsVersion.Text = _language.Version;
columnHeaderInsType.Text = _language.Type;
buttonUpdateAll.Visible = false;
try
{
labelPleaseWait.Text = Configuration.Settings.Language.General.PleaseWait;
@ -74,17 +79,17 @@ namespace Nikse.SubtitleEdit.Forms
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null && _firstTry)
{
_firstTry = false;
string url = "http://www.nikse.dk/Content/SubtitleEdit/Plugins/Plugins.xml"; // retry with alternate download url
var wc = new WebClient { Proxy = Utilities.GetProxy() };
wc.Encoding = System.Text.Encoding.UTF8;
wc.Headers.Add("Accept-Encoding", "");
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
wc.DownloadStringAsync(new Uri(url));
return;
}
//if (e.Error != null && _firstTry)
//{
// _firstTry = false;
// string url = "http://www.nikse.dk/Content/SubtitleEdit/Plugins/Plugins.xml"; // retry with alternate download url
// var wc = new WebClient { Proxy = Utilities.GetProxy() };
// wc.Encoding = System.Text.Encoding.UTF8;
// wc.Headers.Add("Accept-Encoding", "");
// wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
// wc.DownloadStringAsync(new Uri(url));
// return;
//}
labelPleaseWait.Text = string.Empty;
if (e.Error != null)
@ -96,6 +101,8 @@ namespace Nikse.SubtitleEdit.Forms
}
return;
}
_updateAllListUrls = new List<string>();
_updateAllListNames = new List<string>();
try
{
_pluginDoc.LoadXml(e.Result);
@ -125,9 +132,12 @@ namespace Nikse.SubtitleEdit.Forms
if (installed.Text.TrimEnd('.') == node.SelectSingleNode("Name").InnerText.TrimEnd('.') &&
installed.SubItems[2].Text.Replace(",", ".") != node.SelectSingleNode("Version").InnerText.Replace(",", "."))
{
item.BackColor = Color.LightGreen;
// item.BackColor = Color.LightGreen;
installed.BackColor = Color.LightPink;
installed.SubItems[1].Text = _language.UpdateAvailable + " " + installed.SubItems[1].Text;
buttonUpdateAll.Visible = true;
_updateAllListUrls.Add(node.SelectSingleNode("Url").InnerText);
_updateAllListNames.Add(node.SelectSingleNode("Name").InnerText);
}
}
}
@ -136,6 +146,20 @@ namespace Nikse.SubtitleEdit.Forms
{
MessageBox.Show(string.Format(_language.UnableToDownloadPluginListX, exception.Source + ": " + exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace));
}
if (_updateAllListUrls.Count > 0)
{
buttonUpdateAll.BackColor = Color.LightGreen;
if (!string.IsNullOrEmpty(Configuration.Settings.Language.PluginsGet.UpdateAllX))
{
buttonUpdateAll.Text = string.Format(Configuration.Settings.Language.PluginsGet.UpdateAllX, _updateAllListUrls.Count);
buttonUpdateAll.Visible = true;
}
else if (!string.IsNullOrEmpty(Configuration.Settings.Language.PluginsGet.UpdateAll))
{
buttonUpdateAll.Text = Configuration.Settings.Language.PluginsGet.UpdateAll;
buttonUpdateAll.Visible = true;
}
}
}
private void ShowInstalledPlugins()
@ -264,7 +288,18 @@ namespace Nikse.SubtitleEdit.Forms
buttonOK.Enabled = true;
buttonDownload.Enabled = true;
listViewGetPlugins.Enabled = true;
MessageBox.Show(string.Format(_language.PluginXDownloaded, _downloadedPluginName));
if (_updatingAllPlugins)
{
_updatingAllPluginsCount++;
if (_updatingAllPluginsCount == _updateAllListUrls.Count)
{
MessageBox.Show(string.Format(_language.XPluginsUpdated, _updatingAllPluginsCount));
}
}
else
{
MessageBox.Show(string.Format(_language.PluginXDownloaded, _downloadedPluginName));
}
ShowInstalledPlugins();
}
@ -335,5 +370,38 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void buttonUpdateAll_Click(object sender, EventArgs e)
{
buttonUpdateAll.Enabled = false;
buttonUpdateAll.BackColor = Control.DefaultBackColor;
try
{
labelPleaseWait.Text = Configuration.Settings.Language.General.PleaseWait;
buttonOK.Enabled = false;
buttonDownload.Enabled = false;
listViewGetPlugins.Enabled = false;
this.Refresh();
Cursor = Cursors.WaitCursor;
_updatingAllPluginsCount = 0;
_updatingAllPlugins = true;
for (int i = 0; i < _updateAllListUrls.Count; i++)
{
var wc = new WebClient { Proxy = Utilities.GetProxy() };
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
wc.DownloadDataAsync(new Uri(_updateAllListUrls[i]));
}
Cursor = Cursors.Default;
}
catch (Exception exception)
{
labelPleaseWait.Text = string.Empty;
buttonOK.Enabled = true;
buttonDownload.Enabled = true;
listViewGetPlugins.Enabled = true;
Cursor = Cursors.Default;
MessageBox.Show(exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace);
}
}
}
}

View File

@ -248,6 +248,9 @@ E-mail: mailto:nikse.dk@gmail.com</AboutText1>
<FontEffect>Effekt</FontEffect>
<FontEffectColor>Effekt farve</FontEffectColor>
<FontSize>Str.</FontSize>
<TopBottomMargin>Top/bund margin</TopBottomMargin>
<ZPosition>Z-position</ZPosition>
<ZPositionHelp>positive tal flytter tekst væk, negative tal flytter tekst tættere på, hvis z-position er nul så er det 2D</ZPositionHelp>
<ChooseColor>Vælg farve...</ChooseColor>
<Generate>Generer</Generate>
</DCinemaProperties>
@ -365,6 +368,7 @@ E-mail: mailto:nikse.dk@gmail.com</AboutText1>
<Transparency>Alpha</Transparency>
<ImageFormat>Billed format</ImageFormat>
<SimpleRendering>Simpel rendering</SimpleRendering>
<AntiAliasingWithTransparency>Anti-aliasing med gennemsigtighed</AntiAliasingWithTransparency>
<Text3D>3D</Text3D>
<SideBySide3D>Half-Side-by-side</SideBySide3D>
<HalfTopBottom3D>Half-Top/Bottom</HalfTopBottom3D>
@ -812,6 +816,7 @@ E-mail: mailto:nikse.dk@gmail.com</AboutText1>
<SaveAs>Gem som</SaveAs>
<Find>Find</Find>
<Replace>Erstat</Replace>
<FixCommonErrors>Fix almindelige fejl</FixCommonErrors>
<VisualSync>Visuel synkroniser</VisualSync>
<SpellCheck>Stavekontrol</SpellCheck>
<Settings>Indstillinger</Settings>
@ -1119,6 +1124,7 @@ Fortsæt?</SubtitleAppendPrompt>
<OcrReplacePairXNotAdded>'{0} -&gt; {1}' blev IKKE tilføjet til OCR erstat listen</OcrReplacePairXNotAdded>
<XLinesSelected>{0} linjer valgt</XLinesSelected>
<UnicodeMusicSymbolsAnsiWarning>Undertekst indeholder unicode tegn. Gemmes i ANSI filformat vil disse gå tabt. Fortsæt?</UnicodeMusicSymbolsAnsiWarning>
<UnicodeCharactersAnsiWarning>Undertekst indeholder Unicode-tegn. Ved gem i ANSI filkodning vil disse gå tabt. Fortsæt gem?</UnicodeCharactersAnsiWarning>
<NegativeTimeWarning>Undertekst indeholder negative tidskoder. Gem?</NegativeTimeWarning>
<BeforeMergeShortLines>Før fusionere korte linjer</BeforeMergeShortLines>
<BeforeSplitLongLines>Før split lange linjer</BeforeSplitLongLines>
@ -1178,6 +1184,7 @@ Fortsæt?</SubtitleAppendPrompt>
<NotAValidXSubFile>Ikke en valid xsub fil!</NotAValidXSubFile>
<BeforeMergeLinesWithSameText>Før fusioner linjer med samme tekst</BeforeMergeLinesWithSameText>
<ImportTimeCodesDifferentNumberOfLinesWarning>Undertekst med tidskoder har et forskelligt antal linier ({0}) end nuværende undertekst ({1}) - fortsæt alligevel?</ImportTimeCodesDifferentNumberOfLinesWarning>
<ParsingTransportStream>Læser transport stream - vent venligst...</ParsingTransportStream>
<ErrorLoadIdx>Subtitle Edit kan ikke læse/redigere .idx filer. Idx filer er en del af et idx/sub fil par (også kaldet VobSub), og SE kan kun åbne .sub filen.</ErrorLoadIdx>
<ErrorLoadRar>Denne fil er sandsynligvis en komprimeret .rar fil. SE kan ikke åbne komprimerede filer.</ErrorLoadRar>
<ErrorLoadZip>Denne fil er sandsynligvis en komprimeret .zip fil. SE kan ikke åbne komprimerede filer.</ErrorLoadZip>
@ -1297,9 +1304,11 @@ Fortsæt?</SubtitleAppendPrompt>
<PluginXDownloaded>Plugin {0} downloadet</PluginXDownloaded>
<Download>&amp;Download</Download>
<Remove>&amp;Fjern</Remove>
<UpdateAllX>Opdater alle ({0})</UpdateAllX>
<UnableToDownloadPluginListX>Kunne ikke downloade plug liste: {0}</UnableToDownloadPluginListX>
<NewVersionOfSubtitleEditRequired>Nyere version af Subtitle Edit kræves!</NewVersionOfSubtitleEditRequired>
<UpdateAvailable>[Ny version findes!]</UpdateAvailable>
<UpdateAll>Opdater alle</UpdateAll>
</PluginsGet>
<RemoveTextFromHearImpaired>
<Title>Fjern tekst for hørehæmmede</Title>
@ -1392,6 +1401,8 @@ Fortsæt?</SubtitleAppendPrompt>
<AutoWrapWhileTyping>Auto-ombryd tekst mens du skriver</AutoWrapWhileTyping>
<DurationMinimumMilliseconds>Min. varighed, millisekunder</DurationMinimumMilliseconds>
<DurationMaximumMilliseconds>Max. varighed, millisekunder</DurationMaximumMilliseconds>
<MinimumGapMilliseconds>
</MinimumGapMilliseconds>
<SubtitleFont>undertekst skrifttype</SubtitleFont>
<SubtitleFontSize>undertekst skriftstørrelse</SubtitleFontSize>
<SubtitleBold>Fed</SubtitleBold>
@ -1433,6 +1444,8 @@ Fortsæt?</SubtitleAppendPrompt>
<MPlayerDescription>MPlayer2/Mplayer</MPlayerDescription>
<VlcMediaPlayer>VLC Media Player</VlcMediaPlayer>
<VlcMediaPlayerDescription>libvlc.dll fra VLC Media Player 1.1.0 eller nyere</VlcMediaPlayerDescription>
<VlcBrowseToLabel>
</VlcBrowseToLabel>
<ShowStopButton>Vis stop-knap</ShowStopButton>
<ShowMuteButton>Vis mute-knap</ShowMuteButton>
<ShowFullscreenButton>Vis fuldskærm knap</ShowFullscreenButton>
@ -1462,6 +1475,8 @@ Fortsæt?</SubtitleAppendPrompt>
<WaveformUseFFMPEG>Benyt FFMPEG til at udtrække lydfiler</WaveformUseFFMPEG>
<WaveformFFMPEGPath>Sti til FFMPEG</WaveformFFMPEGPath>
<WaveformBrowseToFFMPEG>Vælg sti stil FFMPEG</WaveformBrowseToFFMPEG>
<WaveformBrowseToVLC>
</WaveformBrowseToVLC>
<SubStationAlphaStyle>Sub Station Alpha Style</SubStationAlphaStyle>
<ChooseFont>Vælg skrifttype</ChooseFont>
<ChooseColor>Vælg farve</ChooseColor>
@ -1500,6 +1515,8 @@ Fortsæt?</SubtitleAppendPrompt>
<MusicSymbol>Musik symbol</MusicSymbol>
<MusicSymbolsToReplace>Musik symboler der skal erstattes (adskilt af mellemrum)</MusicSymbolsToReplace>
<FixCommonOcrErrorsUseHardcodedRules>Ret normale OCR fejl - Inkluder hardcodede regler</FixCommonOcrErrorsUseHardcodedRules>
<FixCommonerrorsFixShortDisplayTimesAllowMoveStartTime>
</FixCommonerrorsFixShortDisplayTimesAllowMoveStartTime>
<Shortcuts>Genveje</Shortcuts>
<Shortcut>Genvej</Shortcut>
<Control>Control</Control>

View File

@ -1558,10 +1558,12 @@ can edit in same subtitle file (collaboration)",
PluginXDownloaded = "Plugin {0} downloaded",
Download = "&Download",
Remove = "&Remove",
UpdateAllX = "Update all ({0})",
UnableToDownloadPluginListX = "Unable to download plug list: {0}",
NewVersionOfSubtitleEditRequired = "Newer version of Subtitle Edit required!",
UpdateAvailable = "[Update available!]",
UpdateAll = "Update all",
XPluginsUpdated = "{0} plugin(s) updated",
};
RemoveTextFromHearImpaired = new LanguageStructure.RemoveTextFromHearImpaired
@ -1710,7 +1712,7 @@ can edit in same subtitle file (collaboration)",
MPlayerDescription = "MPlayer2/Mplayer",
VlcMediaPlayer = "VLC Media Player",
VlcMediaPlayerDescription = "libvlc.dll from VLC Media Player 1.1.0 or newer",
VlcBrowseToLabel = "VLC path (only needed if you using the portable version of VLC)",
VlcBrowseToLabel = "VLC path (only needed if you're using the portable version of VLC)",
ShowStopButton = "Show stop button",
ShowMuteButton = "Show mute button",
ShowFullscreenButton = "Show fullscreen button",

View File

@ -1453,10 +1453,12 @@
public string PluginXDownloaded { get; set; }
public string Download { get; set; }
public string Remove { get; set; }
public string UpdateAllX { get; set; }
public string UnableToDownloadPluginListX { get; set; }
public string NewVersionOfSubtitleEditRequired { get; set; }
public string UpdateAvailable { get; set; }
public string UpdateAll { get; set; }
public string XPluginsUpdated { get; set; }
}
public class RemoveTextFromHearImpaired