Skip to content

Commit

Permalink
#4 fixed migration, prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
Milkitic committed Nov 11, 2019
1 parent 72581cc commit aea20cb
Show file tree
Hide file tree
Showing 22 changed files with 614 additions and 250 deletions.
1 change: 1 addition & 0 deletions OsuPlayer.Common/Domain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static Domain()
public static string MusicPath => Path.Combine(CurrentPath, "Music");
public static string BackgroundPath => Path.Combine(CurrentPath, "Background");
public static string ResourcePath => Path.Combine(CurrentPath, "Resources");
public static string OwnSongsPath => Path.Combine(CurrentPath, "Songs");
public static string PluginPath => Path.Combine(ExternalPath, "Plugins");

public static string CustomSongPath => AppSettings.Default == null ? null : new FileInfo(AppSettings.Default.General.CustomSongsPath).FullName;
Expand Down
2 changes: 2 additions & 0 deletions OsuPlayer.Common/Player/CurrentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class CurrentInfo : ViewModelBase
IsFavorite = isFavorite;
Path = path;
BgPath = bgPath;
TagString = string.Join(" ", Tags);
}

public string Artist
Expand Down Expand Up @@ -94,6 +95,7 @@ public string TitleUnicode
public string Creator { get; set; }
public string Source { get; set; }
public List<string> Tags { get; set; }
public string TagString { get; set; }
public int BeatmapId { get; set; }
public int BeatmapsetId { get; set; }
public double Stars { get; set; }
Expand Down
196 changes: 103 additions & 93 deletions OsuPlayer.ControlLibrary/Themes/Generic.xaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions OsuPlayer.Wpf/Control/Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
TargetType="{x:Type controls:CommonButton}">
<Setter Property="Height" Value="Auto" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="MouseDownBackground" Value="Transparent" />
<Setter Property="MouseOverBackground" Value="Transparent" />
Expand Down
30 changes: 18 additions & 12 deletions OsuPlayer.Wpf/Control/PlayController.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
Background="#5d9cec"
BorderBrush="White"
BorderRadius="14"
BorderThickness="2"
BorderThickness="1"
Click="OpenButton_Click"
ImageHeight="24"
ImageWidth="24"
Expand All @@ -177,21 +177,27 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Label
x:Name="LblTitle"
Content="{Binding Player.CurrentInfo.TitleAuto, Mode=OneWay}"
Foreground="#777" />
<!--<StackPanel Orientation="Horizontal">
<Label Content="{Binding Player.CurrentInfo.TitleAuto, Mode=OneWay}" Foreground="#777" />
<Label
x:Name="LblSeperate"
Margin="-5,0,-5,0"
Content="-"
Foreground="#858585" />
<Label
x:Name="LblArtist"
Content="{Binding Player.CurrentInfo.ArtistAuto, Mode=OneWay}"
Foreground="#AAA" />
</StackPanel>
<Label Content="{Binding Player.CurrentInfo.ArtistAuto, Mode=OneWay}" Foreground="#AAA" />
</StackPanel>-->
<local:CommonButton
Margin="3,0"
VerticalAlignment="Center"
Click="TitleArtist_Click"
MouseDownBackground="#80E0E0E0"
MouseOverBackground="#80F0F0F0"
Style="{StaticResource LinkButton}">
<TextBlock>
<Run Foreground="#777" Text="{Binding Player.CurrentInfo.TitleAuto, Mode=OneWay}" />
<Run Text="-" />
<Run Foreground="#AAA" Text="{Binding Player.CurrentInfo.ArtistAuto, Mode=OneWay}" />
</TextBlock>
</local:CommonButton>
<StackPanel
x:Name="LblProgress"
Grid.Column="1"
Expand Down
7 changes: 7 additions & 0 deletions OsuPlayer.Wpf/Control/PlayController.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,13 @@ private async void UserControl_Loaded(object sender, RoutedEventArgs e)
var playList = Services.Get<PlayerList>();
await SetPlayMode(playList.PlayerMode);
}

private void TitleArtist_Click(object sender, RoutedEventArgs e)
{
var playerList = Services.Get<PlayerList>();
var win = new BeatmapInfoWindow(playerList.CurrentInfo);
win.ShowDialog();
}
}

public class DragCompleteEventArgs : HandledEventArgs
Expand Down
12 changes: 9 additions & 3 deletions OsuPlayer.Wpf/OsuPlayer.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@
<Compile Include="Notification.cs" />
<Compile Include="Utils\NativeUser32.cs" />
<Compile Include="ViewModels\ListPageViewModel.cs" />
<Compile Include="Windows\BeatmapInfoWindow.xaml.cs">
<DependentUpon>BeatmapInfoWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\MiniWindow.xaml.cs">
<DependentUpon>MiniWindow.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -417,6 +420,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\BeatmapInfoWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\ConfigWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -628,9 +635,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="player.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="player.db" />
<Resource Include="Resources\gear.png" />
<Resource Include="Resources\gear_s.png" />
</ItemGroup>
Expand Down Expand Up @@ -772,6 +777,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
20 changes: 3 additions & 17 deletions OsuPlayer.Wpf/Pages/SearchPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,9 @@
Click="BtnQueueAll_Click"
Command="{Binding ItemFolderCommand}"
CommandParameter="{Binding ExportPath}"
Style="{StaticResource SettingsButton}">
<StackPanel Orientation="Horizontal">
<Viewbox
Width="16"
Height="16"
Stretch="Uniform">
<Canvas Width="1000" Height="1000">
<Path Fill="#303030">
<Path.Data>
<PathGeometry Figures="M102.5 919.2c-51 0-92.5-41.5-92.5-92.5V173.3c0-51 41.5-92.5 92.5-92.5h287.1c47.7 0 87.3 35.8 92 83.2l0.3 4.5c2.1 20.4 19.2 35.8 39.8 35.8h375.8c51 0 92.5 41.5 92.5 92.5v530c0 51-41.5 92.5-92.5 92.5H102.5z M80.3 809.4c0 22 17.9 40 40 40h758.6c22.1 0 40-18 40-40V388.7H80.3V809.4z M918.7 317.9c0-24.6-8.8-45.5-39.8-45.5H521.7c-46.4 0-85.1-33.8-91.6-79.3l-0.8-8.4c-2.1-20.4-19.2-35.8-39.8-35.8H120.3c-22.1 0-40 18-40 40v129H918.7z" FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="排队全部" />
</StackPanel>
</control:CommonButton>
Content="排队全部"
IconTemplate="{StaticResource FolderTempl}"
Style="{StaticResource SettingsButton}" />
</StackPanel>
<ListView
x:Name="ResultList"
Expand Down
22 changes: 12 additions & 10 deletions OsuPlayer.Wpf/Pages/Settings/ExportPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,24 @@
x:Name="LblMp3Path"
Width="250"
Height="27"
Margin="-5,0,5,0"
Margin="-5,0,-1,0"
VerticalContentAlignment="Center"
Background="White"
CornerRadius="5"
IsReadOnly="True"
Text="D:\asdf\asdf" />
<control:CommonButton
x:Name="BtnMp3Path"
Width="25"
Height="25"
Width="27"
Height="27"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="#E3E3E3"
BorderBrush="#B0B0B0"
Click="BtnMp3Path_Click"
Content="..."
CornerRadius="13"
IconMargin="0"
IconTemplate="{StaticResource FolderTempl}"
Style="{StaticResource SettingsButton}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Style="{StaticResource ConfigStackHoriStyle}">
Expand All @@ -56,23 +57,24 @@
x:Name="LblBgPath"
Width="250"
Height="27"
Margin="-5,0,5,0"
Margin="-5,0,-1,0"
VerticalContentAlignment="Center"
Background="White"
CornerRadius="5"
IsReadOnly="True"
Text="D:\asdf\asdf" />
<control:CommonButton
x:Name="BtnBgPath"
Width="25"
Height="25"
Width="27"
Height="27"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="#E3E3E3"
BorderBrush="#B0B0B0"
Click="BtnBgPath_Click"
Content="..."
CornerRadius="13"
IconMargin="0"
IconTemplate="{StaticResource FolderTempl}"
Style="{StaticResource SettingsButton}" />
</StackPanel>
<Label
Expand Down
57 changes: 32 additions & 25 deletions OsuPlayer.Wpf/Pages/Settings/ExportPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Dialogs;

namespace Milky.OsuPlayer.Pages.Settings
{
Expand Down Expand Up @@ -38,53 +39,59 @@ private void Page_Loaded(object sender, RoutedEventArgs e)

private void BtnMp3Path_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog
using (var dialog = new CommonOpenFileDialog
{
Description = @"选择音乐导出目录",
ShowNewFolderButton = true,
};
var result = dialog.ShowDialog();
if (result != DialogResult.OK) return;
AppSettings.Default.Export.MusicPath = dialog.SelectedPath;
LblMp3Path.Text = AppSettings.Default.Export.MusicPath;
AppSettings.SaveDefault();
IsFolderPicker = true,
Title = "选择音乐导出目录",
})
{
var result = dialog.ShowDialog();
if (result != CommonFileDialogResult.Ok) return;
AppSettings.Default.Export.MusicPath = dialog.FileName;
LblMp3Path.Text = AppSettings.Default.Export.MusicPath;
AppSettings.SaveDefault();
}
}

private void BtnBgPath_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog
using (var dialog = new CommonOpenFileDialog()
{
Description = @"选择背景导出目录",
ShowNewFolderButton = true,
};
var result = dialog.ShowDialog();
if (result != DialogResult.OK) return;
AppSettings.Default.Export.BgPath = dialog.SelectedPath;
LblBgPath.Text = AppSettings.Default.Export.BgPath;
AppSettings.SaveDefault();
IsFolderPicker = true,
Title = "选择背景导出目录"
})
{
var result = dialog.ShowDialog();
if (result != CommonFileDialogResult.Ok) return;
AppSettings.Default.Export.BgPath = dialog.FileName;
LblBgPath.Text = AppSettings.Default.Export.BgPath;
AppSettings.SaveDefault();
}
}

private void Naming_CheckChanged(object sender, RoutedEventArgs e)
{
var exportSection = AppSettings.Default.Export;
if (RadioT.IsChecked.HasValue && RadioT.IsChecked.Value)
AppSettings.Default.Export.NamingStyle = NamingStyle.Title;
exportSection.NamingStyle = NamingStyle.Title;
else if (RadioAt.IsChecked.HasValue && RadioAt.IsChecked.Value)
AppSettings.Default.Export.NamingStyle = NamingStyle.ArtistTitle;
exportSection.NamingStyle = NamingStyle.ArtistTitle;
else if (RadioTa.IsChecked.HasValue && RadioTa.IsChecked.Value)
AppSettings.Default.Export.NamingStyle = NamingStyle.TitleArtist;
exportSection.NamingStyle = NamingStyle.TitleArtist;
AppSettings.SaveDefault();
}

private void Sort_CheckChanged(object sender, RoutedEventArgs e)
{
var exportSection = AppSettings.Default.Export;
if (SortNone.IsChecked.HasValue && SortNone.IsChecked.Value)
AppSettings.Default.Export.SortStyle = SortStyle.None;
exportSection.SortStyle = SortStyle.None;
else if (SortArtist.IsChecked.HasValue && SortArtist.IsChecked.Value)
AppSettings.Default.Export.SortStyle = SortStyle.Artist;
exportSection.SortStyle = SortStyle.Artist;
else if (SortMapper.IsChecked.HasValue && SortMapper.IsChecked.Value)
AppSettings.Default.Export.SortStyle = SortStyle.Mapper;
exportSection.SortStyle = SortStyle.Mapper;
else if (SortSource.IsChecked.HasValue && SortSource.IsChecked.Value)
AppSettings.Default.Export.SortStyle = SortStyle.Source;
exportSection.SortStyle = SortStyle.Source;
AppSettings.SaveDefault();
}
}
Expand Down
25 changes: 15 additions & 10 deletions OsuPlayer.Wpf/Pages/Settings/GeneralPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,32 @@
x:Name="TbDbPath"
Width="250"
Height="27"
Margin="5,0"
Margin="5,0,-1,0"
VerticalContentAlignment="Center"
Background="White"
CornerRadius="5"
IsReadOnly="True"
Text="D:\asdf\asdf" />
<control:CommonButton
x:Name="BrowseDb"
Width="25"
Height="25"
Width="27"
Height="27"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="#E3E3E3"
BorderBrush="#B0B0B0"
Click="BrowseDb_Click"
Content="..."
CornerRadius="13"
IconMargin="0"
IconTemplate="{StaticResource FolderTempl}"
IsEnabled="{Binding IsScanning, Converter={StaticResource NegativeBooleanConverter}}"
Style="{StaticResource SettingsButton}" />
<control:CommonButton
x:Name="SyncNow"
Height="25"
Margin="6,0,0,0"
Padding="5,0"
VerticalAlignment="Center"
Background="#E3E3E3"
Click="SyncNow_Click"
Content="手动同步"
Expand All @@ -78,22 +81,24 @@
x:Name="TbCustomPath"
Width="250"
Height="27"
Margin="5,0"
Margin="5,0,-1,0"
VerticalContentAlignment="Center"
Background="White"
CornerRadius="5"
IsReadOnly="True"
Text="D:\asdf\asdf" />
<control:CommonButton
x:Name="BrowseCustom"
Width="25"
Height="25"
Width="27"
Height="27"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="#E3E3E3"
BorderBrush="#B0B0B0"
Click="BrowseCustom_Click"
Content="..."
CornerRadius="13"
IconMargin="0"
IconTemplate="{StaticResource FolderTempl}"
Style="{StaticResource SettingsButton}" />
<custom:Loader
Width="25"
Expand Down
Loading

0 comments on commit aea20cb

Please sign in to comment.