Skip to content

Commit

Permalink
Fixed skin creation dialog and language selection
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackTasty committed Aug 15, 2018
1 parent 355faa1 commit 1e78bc7
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 25 deletions.
3 changes: 2 additions & 1 deletion Osmo/Converters/EnumToIntConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class EnumToIntConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var underlyingType = Enum.GetUnderlyingType(value.GetType());
return System.Convert.ChangeType(value, underlyingType);
int test = (int)System.Convert.ChangeType(value, underlyingType);
return (int)System.Convert.ChangeType(value, underlyingType);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
2 changes: 2 additions & 0 deletions Osmo/Core/AudioEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace Osmo.Core
{
class AudioEngine
{
private static AudioEngine instance;

private int _stream;
private BASSTimer _timer;
private bool paused;
Expand Down
13 changes: 13 additions & 0 deletions Osmo/Localisation/StringResources.es.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<system:String o:Freeze="True" x:Key="yes">_SÍ</system:String>
<system:String o:Freeze="True" x:Key="no">_NO</system:String>
<system:String o:Freeze="True" x:Key="import">_IMPORTAR</system:String>
<system:String o:Freeze="True" x:Key="retry">_RETRY</system:String>
<system:String o:Freeze="True" x:Key="loadTemplate">_CARGAR PLANTILLA</system:String>
<system:String o:Freeze="True" x:Key="newTemplate">_NUEVA PLANTILLA</system:String>
<system:String o:Freeze="True" x:Key="loadSkin">_CARGAR SKIN</system:String>
Expand Down Expand Up @@ -148,6 +149,13 @@
<system:String o:Freeze="True" x:Key="settings_header_editor">Editor</system:String>
<system:String o:Freeze="True" x:Key="settings_header_shortcuts">Keyboard shortcuts</system:String>
<system:String o:Freeze="True" x:Key="settings_header_shortcutsCheatSheet">Cheat sheet</system:String>
<system:String o:Freeze="True" x:Key="settings_title_autodetectNoOsuInstalled">osu! is not installed!</system:String>
<system:String o:Freeze="True" x:Key="settings_descr_autodetectNoOsuInstalled">Should osu! be installed make sure it has been installed correctly, otherwise select it manually.</system:String>
<system:String o:Freeze="True" x:Key="settings_title_autodetectOsu">Auto-detect osu! folder</system:String>
<system:String o:Freeze="True" x:Key="settings_descr_autodetectOsu">Do you wish for Osmo to find your osu! installation folder?</system:String>
<system:String o:Freeze="True" x:Key="settings_title_autodetectFailed">Auto-detect failed!</system:String>
<system:String o:Freeze="True" x:Key="settings_descr_autodetectFailed">Are you sure you have osu! installed correctly?</system:String>
<system:String o:Freeze="True" x:Key="settings_unsavedChangesDescription">You have unsaved changes to your settings! Do you want to save them first? (Selecting No reverts all changes to your settings)</system:String>

<!--DragDropArea-->
<system:String o:Freeze="True" x:Key="dragDrop_filter">Archivo skin ejecutable</system:String>
Expand All @@ -168,6 +176,7 @@
<system:String o:Freeze="True" x:Key="skinSelect_deleteTitle">¿Eliminar skin?</system:String>
<system:String o:Freeze="True" x:Key="skinSelect_deleteDescription">¿Seguro que desea eliminar este skin?</system:String>
<system:String o:Freeze="True" x:Key="skinSelect_exportTitle">Seleccione el directorio al que desea exportar su skin</system:String>
<system:String o:Freeze="True" x:Key="skinSelect_loadSkins">Loading skins...</system:String>

<!--ResizeTool-->
<system:String o:Freeze="True" x:Key="header_dimensionWidth">Width</system:String>
Expand Down Expand Up @@ -205,6 +214,10 @@
<system:String o:Freeze="True" x:Key="about_openSource1">¡Osmo es de código abierto!</system:String>
<system:String o:Freeze="True" x:Key="about_openSource2">Haga clic aquí</system:String>
<system:String o:Freeze="True" x:Key="about_openSource3">para ir al repositorio de GitHub.</system:String>
<system:String o:Freeze="True" x:Key="about_sessionId">Session id:</system:String>
<system:String o:Freeze="True" x:Key="tip_sessionId">The session id is used inside your log files. This is especially useful if you have multiple instances of Osmo open and one of them crashes or generates errors.</system:String>
<system:String o:Freeze="True" x:Key="tip_copySessionId">Copy the session id to your clipboard.</system:String>
<system:String o:Freeze="True" x:Key="snackbar_sessionId">Session id copied to clipboard!</system:String>

<!--New template dialog-->
<system:String o:Freeze="True" x:Key="newTemplate_title">Crear una nueva plantilla</system:String>
Expand Down
3 changes: 0 additions & 3 deletions Osmo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@

<!--SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"-->
<material:DialogHost Identifier="RootDialog" Loaded="DialogHost_Loaded">
<material:DialogHost.DialogContent>
<ui:NewSkinDialog x:Name="dialg_newSkin" Margin="16"/>
</material:DialogHost.DialogContent>
<material:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
<material:DrawerHost.LeftDrawerContent>
<DockPanel MinWidth="212">
Expand Down
2 changes: 0 additions & 2 deletions Osmo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ private void sidebarMenu_Loaded(object sender, RoutedEventArgs e)
{
if (!configuration.IsValid)
sidebarMenu.SelectedIndex = FixedValues.CONFIG_INDEX;

dialg_newSkin.SetMasterViewModel(DataContext as OsmoViewModel);
}

private async void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions Osmo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.3.94")]
[assembly: AssemblyFileVersion("0.0.3.94")]
[assembly: AssemblyVersion("0.0.3.96")]
[assembly: AssemblyFileVersion("0.0.3.96")]
11 changes: 0 additions & 11 deletions Osmo/UI/NewSkinDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
using MaterialDesignThemes.Wpf;
using Osmo.Core;
using Osmo.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Osmo.UI
{
Expand Down
6 changes: 4 additions & 2 deletions Osmo/UI/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</Grid.DataContext>
<Grid.Resources>
<converter:EnumToIntConverter x:Key="EnumToInt"/>
<converter:StringNotEmptyConverter x:Key="StringNotEmpty"/>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition />
Expand Down Expand Up @@ -117,7 +118,7 @@
Foreground="{Binding ElementName=combo_language, Path=BorderBrush}" Kind="Flag" />
<ComboBox x:Name="combo_language" Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3"
VerticalAlignment="Stretch" material:HintAssist.Hint="{DynamicResource settings_hint_language}"
SelectedIndex="{Binding Language, Converter={StaticResource EnumToInt}}" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
SelectedIndex="{Binding Language}" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
<ComboBoxItem Content="English (Default)" />
<ComboBoxItem Content="Español" />
</ComboBox>
Expand Down Expand Up @@ -165,6 +166,7 @@
<Button Grid.Row="2" Grid.Column="1" Width="130" Margin="10,5" Click="Abort_Click" Content="{DynamicResource abort}"
Style="{StaticResource MaterialDesignRaisedDarkButton}" ToolTip="{DynamicResource tip_settings_abort}"/>
<Button Grid.Row="2" Grid.Column="2" Width="130" Margin="10,5" Click="Save_Click" Content="{DynamicResource save}"
Style="{StaticResource MaterialDesignRaisedDarkButton}" ToolTip="{DynamicResource tip_settings_save}"/>
Style="{StaticResource MaterialDesignRaisedDarkButton}" ToolTip="{DynamicResource tip_settings_save}"
IsEnabled="{Binding ElementName=txt_osuPath, Path=Text, Converter={StaticResource StringNotEmpty}}" />
<material:Snackbar x:Name="snackbar" Grid.Row="2" Grid.ColumnSpan="3" MessageQueue="{material:MessageQueue}"/>
</Grid>
2 changes: 1 addition & 1 deletion Osmo/UI/SkinSelect.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<Button Style="{StaticResource MaterialDesignRaisedDarkButton}" Command="{x:Static material:DialogHost.OpenDialogCommand}" Content="{DynamicResource newSkin}"
x:Name="btn_newSkin" ToolTip="{DynamicResource tip_skinSelect_new}" Grid.Column="2" Grid.Row="2" Margin="5">
<Button.CommandParameter>
<local:NewSkinDialog Margin="16"/>
<local:NewSkinDialog Margin="16" x:Name="dlg_newSkin"/>
</Button.CommandParameter>
</Button>
<Button Style="{StaticResource MaterialDesignRaisedDarkButton}" Click="MixSkins_Click" IsEnabled="{Binding SelectedIndex, ConverterParameter=1, Converter={StaticResource IntToBoolean}, ElementName=lv_skins}"
Expand Down
1 change: 1 addition & 0 deletions Osmo/UI/SkinSelect.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private void Grid_Loaded(object sender, RoutedEventArgs e)
//{
// uniGrid_skins.Children.Add(new SkinCard().InitializeSkin(skin));
//}
dlg_newSkin.SetMasterViewModel(DataContext as OsmoViewModel);
}

public async Task<bool> ForwardKeyboardInput(KeyEventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions Osmo/ViewModel/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public bool ReopenLastSkin
}
}

public Language Language
public int Language
{
get => config.Language;
get => (int)config.Language;
set
{
config.Language = value;
config.Language = (Language)value;
InvokePropertyChanged("Language");
}
}
Expand Down

0 comments on commit 1e78bc7

Please sign in to comment.