Skip to content

Commit

Permalink
Merge branch 'better-folder-select-dialog'
Browse files Browse the repository at this point in the history
  • Loading branch information
bertyhell committed Dec 26, 2018
2 parents 4f379ae + 81f26bc commit fe91b94
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ dist/
/.vs
PlaylistDownloaderElectron/
PlaylistDownloader/.vs

*.rar
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.4.11\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Ookii.Dialogs.Wpf">
<HintPath>..\..\lib\Ookii.Dialogs.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
Expand Down Expand Up @@ -190,6 +193,7 @@
<Content Include="ffmpeg\swscale-4.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="img\gear.png" />
<Content Include="youtube-dl.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
27 changes: 15 additions & 12 deletions PlaylistDownloader/PlaylistDownloader/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@
<Grid Grid.ColumnSpan="2" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="204*"/>
<ColumnDefinition Width="224*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="120*"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="131*"/>
<ColumnDefinition Width="106*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="11*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>

<Label VerticalAlignment="Center">Search:</Label>
<TextBox VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" Text="{Binding Query, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="2">Number of results:</Label>
<TextBox VerticalAlignment="Center" Grid.Row="0" Grid.Column="3" Text="{Binding NumberOfResultsInput, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Row="0" Grid.Column="4" Click="ButtonSearchClick" IsEnabled="{Binding IsSearchButtonEnabled}" ToolTipService.ShowOnDisabled="true" Margin="10,0,0,0" IsDefault="True">
<Label VerticalAlignment="Center" Margin="0,7" Height="26">Search:</Label>
<TextBox VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" Text="{Binding Query, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,11" Height="18"></TextBox>
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="2" Margin="0,7" Height="26">Number of results:</Label>
<TextBox VerticalAlignment="Center" Grid.Row="0" Grid.Column="3" Text="{Binding NumberOfResultsInput, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,11" Height="18"></TextBox>
<Button Grid.Row="0" Grid.Column="4" Click="ButtonSearchClick" IsEnabled="{Binding IsSearchButtonEnabled}" ToolTipService.ShowOnDisabled="true" Margin="10,0,0,0" IsDefault="True" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal">
<Image Source="img/search.png" Width="26" Style="{StaticResource ImageEnabled}" />
<Label>Search</Label>
Expand All @@ -48,22 +49,24 @@

<TextBox Margin="0,10" Text="{Binding PlayList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" Grid.Column="0" IsManipulationEnabled="True"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" PreviewMouseDown="TextBoxMouseDown"
x:Name="PlaylistTextBox" Grid.ColumnSpan="5"/>
x:Name="PlaylistTextBox" Grid.ColumnSpan="6"/>

<Button Grid.Row="2" Click="DownloadButtonClick" Grid.Column="0" Grid.ColumnSpan="3" IsEnabled="{Binding IsDownloadButtonEnabled}"
ToolTip="{Binding DownloadButtonError}" ToolTipService.ShowOnDisabled="true" Margin="0,0,10,0">
ToolTip="{Binding DownloadButtonError}" ToolTipService.ShowOnDisabled="true">
<StackPanel Orientation="Horizontal">
<Image Source="img/download.png" Width="26" Style="{StaticResource ImageEnabled}" />
<Label>Download</Label>
</StackPanel>
</Button>
<Button Grid.Row="2" Grid.Column="4" Click="ButtonOpenFolderClick" ToolTip="Open the folder with downloaded music" Margin="10,0,0,0">
<Button Grid.Row="2" Grid.Column="3" Click="ButtonOpenFolderClick" ToolTip="Open the folder with downloaded music" Margin="10,0,0,0" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal">
<Image Source="img/folder_music.png" Width="26" />
<Label Content="Open folder"/>
</StackPanel>
</Button>
<Button Content="Set out folder" HorizontalAlignment="Left" Grid.Row="2" VerticalAlignment="Top" Width="111" Grid.Column="3" Margin="10,0,0,0" Height="40" Click="ChooseOutputPath_Click"/>
<Button Grid.Row="2" Grid.Column="5" Click="ChooseOutputPathClick" BorderThickness="0,1,1,1">
<Image Source="img/gear.png" Width="26" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Button>
</Grid>
</Grid>
</Window>
38 changes: 11 additions & 27 deletions PlaylistDownloader/PlaylistDownloader/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using System;
using System.Configuration;
using NLog;
using Microsoft.Win32;
using Ookii.Dialogs.Wpf;

namespace PlaylistDownloader
{
Expand Down Expand Up @@ -369,36 +371,18 @@ private void ChooseFfmpegPath_Click(object sender, RoutedEventArgs e)
}
}

private void ChooseOutputPath_Click(object sender, RoutedEventArgs e)
private void ChooseOutputPathClick(object sender, RoutedEventArgs e)
{
var forceChooseDialog = false;
if (sender != null)
{
// user clicked choose button
forceChooseDialog = true;
}

bool changed = false;

while (!Directory.Exists(Properties.Settings.Default.OutputPath) || forceChooseDialog)
var dialog = new VistaFolderBrowserDialog
{
forceChooseDialog = false;
var ret = Microsoft.VisualBasic.Interaction.InputBox(
"Please enter full path to output folder", "Choose output folder", Properties.Settings.Default.OutputPath);
if (string.IsNullOrEmpty(ret))
{
return;
}
else
{
Properties.Settings.Default.OutputPath = ret;
Directory.CreateDirectory(Properties.Settings.Default.OutputPath);
changed = true;
}
}

if (changed)
Description = "Select output folder",
UseDescriptionForTitle = true
};
bool? showDialog = dialog.ShowDialog(this);
if (showDialog != null && (bool)showDialog)
{
Properties.Settings.Default.OutputPath = dialog.SelectedPath;
Directory.CreateDirectory(Properties.Settings.Default.OutputPath);
Properties.Settings.Default.Save();
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/Ookii.Dialogs.Wpf.dll
Binary file not shown.

0 comments on commit fe91b94

Please sign in to comment.