Skip to content

Commit

Permalink
fixd bug of settings
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronzz committed Oct 9, 2019
1 parent 0e3ede7 commit 00b3dff
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 10 deletions.
20 changes: 16 additions & 4 deletions TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<materialDesign:DialogHost Identifier="RootDialog" SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}" Background="{x:Null}">
<Grid>
<!--Head Part-->
<materialDesign:ColorZone Mode="PrimaryMid" Padding="10" MouseLeftButtonDown="ColorZone_MouseLeftButtonDown" >
<materialDesign:ColorZone Mode="PrimaryMid" Padding="10" MouseLeftButtonDown="ColorZone_MouseLeftButtonDown" >
<DockPanel>
<Button DockPanel.Dock="Right" Command="{s:Action WindowClose}" s:View.ActionTarget="{Binding}" Padding="0" Width="24" Height="24" Background="Red">
<materialDesign:PackIcon Kind="Close" Height="22" Width="22" Foreground="White" />
Expand All @@ -44,7 +44,7 @@
<Button Content="FeedBack" Click="{s:Action FeedBack}"></Button>
</StackPanel>
</materialDesign:PopupBox>

<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" materialDesign:RippleAssist.IsCentered="True">
<materialDesign:PackIcon Kind="MusicCircleOutline" Height="Auto" Width="30" HorizontalAlignment="Left" Padding="0,4" VerticalAlignment="Stretch"/>
<TextBlock Text="TIDAL-GUI" FontWeight="Bold" VerticalAlignment="Center" Margin="0 0 0 0" FontSize="18" Padding="4,0,0,0"/>
Expand Down Expand Up @@ -81,7 +81,7 @@
</materialDesign:ColorZone>

<!--Content-->
<Grid Margin="0,52,0,0">
<Grid Margin="0,52,0,35">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"
Visibility="{Binding ItemList.Count, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<ItemsControl Padding="8" Background="{DynamicResource MaterialDesignCardBackground}"
Expand All @@ -96,9 +96,21 @@
</Grid>

<!--Err Label IsActive="{Binding ShowErrlabel}"-->
<materialDesign:Snackbar IsActive='{Binding Path=Errlabel, Converter={StaticResource ConverterStringNotEmpty}}' Margin="0,0,0,0" Width="560">
<materialDesign:Snackbar IsActive='{Binding Path=Errlabel, Converter={StaticResource ConverterStringNotEmpty}}' Margin="230,0,230,35" Width="560">
<materialDesign:SnackbarMessage Content="{Binding Errlabel}" ActionContent="OK" ActionClick="{s:Action CloseErrlabel}"/>
</materialDesign:Snackbar>
<StatusBar HorizontalAlignment="Left" Height="35" Margin="0,635,0,0" VerticalAlignment="Bottom" Width="1020" Background="White" BorderThickness="0,1,0,0" BorderBrush="#FF999191">
<materialDesign:PackIcon Kind="Music" />
<ComboBox ItemsSource="{Binding QualityList}"
SelectedIndex="{Binding SelectQualityIndex , UpdateSourceTrigger=PropertyChanged}"
SelectionChanged="{s:Action QualityChanged}"
VerticalAlignment="Top" Height="30" Padding="6,6,0,6"/>
<materialDesign:PackIcon Kind="VideoFilm" />
<ComboBox ItemsSource="{Binding ResolutionList}"
SelectedIndex="{Binding SelectResolutionIndex , UpdateSourceTrigger=PropertyChanged}"
SelectionChanged="{s:Action ResolutionChanged}"
VerticalAlignment="Top" Height="30" Padding="6,6,0,6"/>
</StatusBar>
</Grid>
</materialDesign:DialogHost>
</materialDesign:Card>
Expand Down
1 change: 1 addition & 0 deletions TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ private void TextBox_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs
TextBox ctrl = (TextBox)sender;
ctrl.SelectAll();
}

}
}
33 changes: 33 additions & 0 deletions TIDALDL-UI/TIDALDL-UI/Pages/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Collections.ObjectModel;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using System.Windows.Controls;

namespace TIDALDL_UI.Pages
{
Expand All @@ -35,6 +36,14 @@ public class MainViewModel : Screen
public BindableCollection<MainListItemViewModel> ItemList { get; } = new BindableCollection<MainListItemViewModel>();
public Thread UpdateThread;

/// <summary>
/// Combox
/// </summary>
public List<string> QualityList { get; set; }
public int SelectQualityIndex { get; set; }
public List<string> ResolutionList { get; set; }
public int SelectResolutionIndex { get; set; }

private IWindowManager Manager;
private LoginViewModel VMLogin;
private SettingViewModel VMSetting;
Expand Down Expand Up @@ -62,6 +71,16 @@ public MainViewModel(IWindowManager manager,
UpdateThread.IsBackground = true;
UpdateThread.Start();

QualityList = TidalTool.getQualityList();
SelectQualityIndex = QualityList.IndexOf(Config.Quality().ToUpper());
if (SelectQualityIndex < 0)
SelectQualityIndex = 0;

ResolutionList = TidalTool.getResolutionList();
SelectResolutionIndex = ResolutionList.IndexOf(Config.Resolution().ToUpper());
if (SelectResolutionIndex < 0)
SelectResolutionIndex = 0;

TidalTool.SetSearchMaxNum(int.Parse(Config.SearchNum()));

//test
Expand Down Expand Up @@ -94,6 +113,16 @@ public void WindowClose()
// }
//}

public void QualityChanged(object sender, SelectionChangedEventArgs e)
{
Config.Quality(QualityList[SelectQualityIndex].ToLower());
}

public void ResolutionChanged(object sender, SelectionChangedEventArgs e)
{
Config.Resolution(ResolutionList[SelectResolutionIndex]);
}

#region Button
public async void Search()
{
Expand Down Expand Up @@ -157,9 +186,13 @@ public void Logout()
}
public void Setting()
{
VMSetting.RefreshSetting();
Manager.ShowDialog(VMSetting);
string sValue = Config.ThreadNum();
ThreadTool.SetThreadNum(int.Parse(sValue));

SelectQualityIndex = QualityList.IndexOf(Config.Quality().ToUpper());
SelectResolutionIndex = ResolutionList.IndexOf(Config.Resolution().ToUpper());
}
public void About()
{
Expand Down
3 changes: 1 addition & 2 deletions TIDALDL-UI/TIDALDL-UI/Pages/SettingView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
<RadioButton Content="VIDEO" IsChecked="{Binding CheckVideo}" Style="{StaticResource MaterialDesignTabRadioButton}" HorizontalContentAlignment="Right" BorderBrush="#FF0C2C53"/>
</StackPanel>
</Border>
<!--Visibility="{Binding CheckCommon, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"-->
<Grid Grid.Column="1">
<Grid Grid.Column="1" Visibility="{Binding CheckCommon, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Label Content="OutputDir" FontSize="15" VerticalAlignment="Top" HorizontalContentAlignment="Right" Margin="10,33,312,0" />
<Button Style="{StaticResource MaterialDesignFlatButton}"
Name="m_CPath"
Expand Down
5 changes: 5 additions & 0 deletions TIDALDL-UI/TIDALDL-UI/Pages/SettingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class SettingViewModel: Stylet.Screen
public List<string> ResolutionList { get; set; }

public SettingViewModel()
{
RefreshSetting();
}

public void RefreshSetting()
{
OutputDir = Config.OutputDir();
OnlyM4a = Config.OnlyM4a();
Expand Down
4 changes: 2 additions & 2 deletions TIDALDL-UI/TIDALDL-UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.7")]
[assembly: AssemblyFileVersion("1.1.0.7")]
[assembly: AssemblyVersion("1.1.0.8")]
[assembly: AssemblyFileVersion("1.1.0.8")]
5 changes: 3 additions & 2 deletions TIDALDL-UI/TIDALDL-UI/updateLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- Search box: select all when double click
- Settings: search max num
#### v1.1.0.8
- Search box: select all when double click
- Settings: fixd bug, add search max num, add to chinese
- Settings: to chinese
- Fix bug of playlist video savepath

Expand Down

0 comments on commit 00b3dff

Please sign in to comment.