Small improvements of the file configuration and some others.

This commit is contained in:
Robin 2018-04-15 09:36:07 +02:00
commit 0aa4aa2d0e
4 changed files with 25 additions and 13 deletions

View file

@ -169,7 +169,7 @@ namespace Greenshot.Addon.Confluence
{ {
// TODO: Create content // TODO: Create content
new PleaseWaitForm().ShowAndWait(Description, _confluenceLanguage.CommunicationWait, new PleaseWaitForm().ShowAndWait(Description, _confluenceLanguage.CommunicationWait,
() => _confluenceClient.Attachment.AttachAsync(""+page.Id, surfaceToUpload, filename, null, "image/" + _confluenceConfiguration.UploadFormat.ToString().ToLower()) () => _confluenceClient.Attachment.AttachAsync(page.Id, surfaceToUpload, filename, null, "image/" + _confluenceConfiguration.UploadFormat.ToString().ToLower())
); );
Log.Debug().WriteLine("Uploaded to Confluence."); Log.Debug().WriteLine("Uploaded to Confluence.");
if (!_confluenceConfiguration.CopyWikiMarkupForImageToClipboard) if (!_confluenceConfiguration.CopyWikiMarkupForImageToClipboard)

View file

@ -77,6 +77,7 @@ namespace Greenshot.Addons.ViewModels
_destinationFileConfiguration = value; _destinationFileConfiguration = value;
NotifyOfPropertyChange(nameof(DestinationFileConfigurationVisiblity)); NotifyOfPropertyChange(nameof(DestinationFileConfigurationVisiblity));
NotifyOfPropertyChange(nameof(AreGlobalSettingsEnabled)); NotifyOfPropertyChange(nameof(AreGlobalSettingsEnabled));
NotifyOfPropertyChange(nameof(OwnSettingsVisibility));
} }
} }
@ -86,9 +87,19 @@ namespace Greenshot.Addons.ViewModels
public bool AreGlobalSettingsEnabled => DestinationFileConfiguration == null; public bool AreGlobalSettingsEnabled => DestinationFileConfiguration == null;
/// <summary> /// <summary>
/// If there is a DestinationFileConfiguration, the configuration is shown /// If there is a DestinationFileConfiguration, the checkbox is shown
/// </summary> /// </summary>
public Visibility DestinationFileConfigurationVisiblity => DestinationFileConfiguration == null ? Visibility.Collapsed : Visibility.Visible; public Visibility OwnSettingsVisibility => DestinationFileConfiguration != null? Visibility.Visible : Visibility.Collapsed;
/// <summary>
/// If there is a DestinationFileConfiguration and use own settings is set the configuration is shown
/// </summary>
public Visibility DestinationFileConfigurationVisiblity => DestinationFileConfiguration != null && _useOwnSettings ? Visibility.Visible : Visibility.Collapsed;
/// <summary>
/// If there is a DestinationFileConfiguration, the global configuration is not shown
/// </summary>
public Visibility GlobalFileConfigurationVisiblity => AreGlobalSettingsEnabled || !_useOwnSettings ? Visibility.Visible : Visibility.Collapsed;
/// <summary> /// <summary>
/// The globally selected format /// The globally selected format

View file

@ -8,7 +8,7 @@
d:DataContext="{d:DesignInstance viewModels:FileConfigPartViewModel,IsDesignTimeCreatable=False}" d:DataContext="{d:DesignInstance viewModels:FileConfigPartViewModel,IsDesignTimeCreatable=False}"
> >
<StackPanel> <StackPanel>
<StackPanel Visibility="{Binding DestinationFileConfigurationVisiblity}"> <StackPanel Visibility="{Binding OwnSettingsVisibility}">
<CheckBox Content="Use destination settings" IsChecked="{Binding UseOwnSettings}" /> <CheckBox Content="Use destination settings" IsChecked="{Binding UseOwnSettings}" />
</StackPanel> </StackPanel>
<StackPanel Visibility="{Binding DestinationFileConfigurationVisiblity}" IsEnabled="{Binding UseOwnSettings}"> <StackPanel Visibility="{Binding DestinationFileConfigurationVisiblity}" IsEnabled="{Binding UseOwnSettings}">
@ -21,8 +21,7 @@
<Slider Maximum="100" Value="{Binding DestinationFileConfiguration.OutputFileJpegQuality}"/> <Slider Maximum="100" Value="{Binding DestinationFileConfiguration.OutputFileJpegQuality}"/>
</DockPanel> </DockPanel>
</StackPanel> </StackPanel>
<Separator Visibility="{Binding DestinationFileConfigurationVisiblity}"/> <StackPanel IsEnabled="{Binding AreGlobalSettingsEnabled}" Visibility="{Binding GlobalFileConfigurationVisiblity}">
<StackPanel IsEnabled="{Binding AreGlobalSettingsEnabled}">
<DockPanel LastChildFill="True"> <DockPanel LastChildFill="True">
<Label Content="{Binding GreenshotLanguage.SettingsPrimaryimageformat}" Width="100" /> <Label Content="{Binding GreenshotLanguage.SettingsPrimaryimageformat}" Width="100" />
<ComboBox SelectedValue="{Binding SelectedFormat}" ItemsSource="{Binding Formats}" SelectedValuePath="Key" DisplayMemberPath="Value" /> <ComboBox SelectedValue="{Binding SelectedFormat}" ItemsSource="{Binding Formats}" SelectedValuePath="Key" DisplayMemberPath="Value" />

View file

@ -86,13 +86,15 @@ namespace GreenshotOCRCommand
{ {
foreach (var word in ToEnumerable(layout.Words)) foreach (var word in ToEnumerable(layout.Words))
{ {
if (word.Rects != null) if (word.Rects == null)
{ {
foreach (var rect in ToEnumerable(word.Rects)) continue;
{ }
Debug.WriteLine($"Rect {rect.Left},{rect.Top},{rect.Right},{rect.Bottom} - Word {word.Text} : Confidence: {word.RecognitionConfidence}");
} foreach (var rect in ToEnumerable(word.Rects))
} {
Debug.WriteLine($"Rect {rect.Left},{rect.Top},{rect.Right},{rect.Bottom} - Word {word.Text} : Confidence: {word.RecognitionConfidence}");
}
} }
} }
#endif #endif