Skip to content

Commit

Permalink
feat: 实现用户界面
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Dec 30, 2024
1 parent 2ca4732 commit 1ec028b
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 109 deletions.
5 changes: 5 additions & 0 deletions src/Magpie/HomePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ void HomePage::SimulateExclusiveFullscreenToggleSwitch_Toggled(IInspectable cons
});
}

void HomePage::MinFrameRateNumberBox_Loading(FrameworkElement const& sender, IInspectable const&) {
// 不知为何在 XAML 中设置会导致加载失败
sender.as<MUXC::NumberBox>().NumberFormatter(App::Get().DoubleFormatter());
}

}
2 changes: 2 additions & 0 deletions src/Magpie/HomePage.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct HomePage : HomePageT<HomePage> {

void SimulateExclusiveFullscreenToggleSwitch_Toggled(IInspectable const& sender, RoutedEventArgs const&);

void MinFrameRateNumberBox_Loading(FrameworkElement const& sender, IInspectable const&);

private:
com_ptr<HomeViewModel> _viewModel = make_self<HomeViewModel>();
};
Expand Down
53 changes: 35 additions & 18 deletions src/Magpie/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,25 @@
IsOn="{x:Bind ViewModel.IsDeveloperMode, Mode=TwoWay}" />
</local:SettingsExpander.Content>
<local:SettingsExpander.Items>
<local:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_DebugMode"
IsChecked="{x:Bind ViewModel.IsDebugMode, Mode=TwoWay}" />
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_DebugMode">
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsDebugMode, Mode=TwoWay}" />
</local:SettingsCard>
<local:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_DisableEffectCache"
IsChecked="{x:Bind ViewModel.IsEffectCacheDisabled, Mode=TwoWay}" />
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_DisableEffectCache">
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsEffectCacheDisabled, Mode=TwoWay}" />
</local:SettingsCard>
<local:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_DisableFontCache"
IsChecked="{x:Bind ViewModel.IsFontCacheDisabled, Mode=TwoWay}" />
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_DisableFontCache">
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsFontCacheDisabled, Mode=TwoWay}" />
</local:SettingsCard>
<local:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_SaveEffectSources"
IsChecked="{x:Bind ViewModel.IsSaveEffectSources, Mode=TwoWay}" />
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_SaveEffectSources">
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsSaveEffectSources, Mode=TwoWay}" />
</local:SettingsCard>
<local:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_WarningsAreErrors"
IsChecked="{x:Bind ViewModel.IsWarningsAreErrors, Mode=TwoWay}" />
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_WarningsAreErrors">
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsWarningsAreErrors, Mode=TwoWay}" />
</local:SettingsCard>
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_DuplicateFrameDetection"
IsWrapEnabled="True">
Expand All @@ -219,10 +219,27 @@
<ComboBoxItem x:Uid="Home_Advanced_DeveloperOptions_DuplicateFrameDetection_Never" />
</ComboBox>
</local:SettingsCard>
<local:SettingsCard ContentAlignment="Left"
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection"
IsEnabled="{x:Bind ViewModel.IsDynamicDection, Mode=OneWay}">
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection"
IsChecked="{x:Bind ViewModel.IsStatisticsForDynamicDetectionEnabled, Mode=TwoWay}" />
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsStatisticsForDynamicDetectionEnabled, Mode=TwoWay}" />
</local:SettingsCard>
<local:SettingsCard x:Uid="Home_Advanced_DeveloperOptions_MinFrameRate"
IsWrapEnabled="True">
<local:SimpleStackPanel Orientation="Horizontal"
Spacing="8">
<!-- 不知为何在 XAML 中设置 NumberFormatter 会导致加载失败,改为在 Loading 事件中设置 -->
<muxc:NumberBox VerticalAlignment="Center"
LargeChange="10"
Loading="MinFrameRateNumberBox_Loading"
Maximum="1000"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Inline"
Value="{x:Bind ViewModel.MinFrameRate, Mode=TwoWay}" />
<TextBlock VerticalAlignment="Center"
Text="FPS" />
</local:SimpleStackPanel>
</local:SettingsCard>
</local:SettingsExpander.Items>
</local:SettingsExpander>
Expand Down
12 changes: 6 additions & 6 deletions src/Magpie/Resources.language-de.resw
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,10 @@
<data name="Home_Advanced_DeveloperOptions.Header" xml:space="preserve">
<value>Entwickleroptionen</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DebugMode.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DebugMode.Header" xml:space="preserve">
<value>Debug Modus</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Header" xml:space="preserve">
<value>Effektcache deaktivieren</value>
</data>
<data name="AppSettings_Dialog_Exit" xml:space="preserve">
Expand Down Expand Up @@ -678,7 +678,7 @@
<data name="Overlay_Profiler_Timings_Total" xml:space="preserve">
<value>Gesamt</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Header" xml:space="preserve">
<value>Schrift-Cache deaktivieren</value>
</data>
<data name="Home_Activation_AllowScalingMaximized.Header" xml:space="preserve">
Expand All @@ -705,10 +705,10 @@
<data name="Home_Activation_AutoRestore_EmptyTitle" xml:space="preserve">
<value>Titel ist leer</value>
</data>
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Header" xml:space="preserve">
<value>Quellcode beim Parsen von Effekten speichern</value>
</data>
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Header" xml:space="preserve">
<value>Warnungen beim Kompilieren von Effekten als Fehler betrachten</value>
</data>
<data name="AppSettings_ErrorDialog_ConfigLocation" xml:space="preserve">
Expand Down Expand Up @@ -802,7 +802,7 @@
<data name="Home_Advanced_DeveloperOptions_DuplicateFrameDetection_Dynamic.Content" xml:space="preserve">
<value>Dynamisch</value>
</data>
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Header" xml:space="preserve">
<value>Statistik für die dynamische Erkennung aktivieren</value>
</data>
<data name="Home_TouchSupport_EnableTouchSupport_Description.Text" xml:space="preserve">
Expand Down
15 changes: 9 additions & 6 deletions src/Magpie/Resources.language-en-US.resw
Original file line number Diff line number Diff line change
Expand Up @@ -669,16 +669,16 @@
<data name="Home_Advanced_DeveloperOptions.Header" xml:space="preserve">
<value>Developer options</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DebugMode.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DebugMode.Header" xml:space="preserve">
<value>Debug mode</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Header" xml:space="preserve">
<value>Disable effect cache</value>
</data>
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Header" xml:space="preserve">
<value>Save source code when parsing effects</value>
</data>
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Header" xml:space="preserve">
<value>Treat warnings as errors when compiling effects</value>
</data>
<data name="AppSettings_Dialog_Exit" xml:space="preserve">
Expand Down Expand Up @@ -760,7 +760,7 @@
<data name="Overlay_Profiler_Timings_Total" xml:space="preserve">
<value>Total</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Header" xml:space="preserve">
<value>Disable font cache</value>
</data>
<data name="Home_Activation_AllowScalingMaximized.Header" xml:space="preserve">
Expand Down Expand Up @@ -808,7 +808,7 @@
<data name="Home_Advanced_DeveloperOptions_DuplicateFrameDetection_Never.Content" xml:space="preserve">
<value>Never</value>
</data>
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Header" xml:space="preserve">
<value>Enable statistics for dynamic detection</value>
</data>
<data name="Overlay_Profiler_DynamicDetection" xml:space="preserve">
Expand Down Expand Up @@ -865,4 +865,7 @@
<data name="Profile_Performance_NoGraphicsCard.Title" xml:space="preserve">
<value>No compatible graphics card was found, so CPU rendering will be used instead. Performance may not meet expectations.</value>
</data>
<data name="Home_Advanced_DeveloperOptions_MinFrameRate.Header" xml:space="preserve">
<value>Minimum frame rate</value>
</data>
</root>
12 changes: 6 additions & 6 deletions src/Magpie/Resources.language-es.resw
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,13 @@
<data name="AppSettings_Dialog_Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DebugMode.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DebugMode.Header" xml:space="preserve">
<value>Modo de depuración</value>
</data>
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Header" xml:space="preserve">
<value>Guarde el código fuente al analizar los efectos</value>
</data>
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Header" xml:space="preserve">
<value>Tratar las advertencias como errores al compilar efectos</value>
</data>
<data name="AppSettings_Dialog_Exit" xml:space="preserve">
Expand Down Expand Up @@ -717,7 +717,7 @@
<data name="Home_Advanced_DeveloperOptions.Header" xml:space="preserve">
<value>Opciones de desarrollador</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Header" xml:space="preserve">
<value>Desactivar caché de los efectos</value>
</data>
<data name="AppSettings_ErrorDialog_ConfigLocation" xml:space="preserve">
Expand Down Expand Up @@ -757,7 +757,7 @@
<data name="Overlay_Profiler_Timings_SwitchToPasses" xml:space="preserve">
<value>Cambiar a pases</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Header" xml:space="preserve">
<value>Desactivar la caché de fuentes</value>
</data>
<data name="Overlay_Profiler_Timings_Total" xml:space="preserve">
Expand Down Expand Up @@ -808,7 +808,7 @@
<data name="Home_Advanced_DeveloperOptions_DuplicateFrameDetection_Never.Content" xml:space="preserve">
<value>Nunca</value>
</data>
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Header" xml:space="preserve">
<value>Activar estadísticas para detección dinámica</value>
</data>
<data name="Overlay_Profiler_DynamicDetection" xml:space="preserve">
Expand Down
12 changes: 6 additions & 6 deletions src/Magpie/Resources.language-fr.resw
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<data name="Overlay_Profiler_Timings_Total" xml:space="preserve">
<value>Total</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Header" xml:space="preserve">
<value>Désactiver le cache des polices</value>
</data>
<data name="About_PageFrame.Title" xml:space="preserve">
Expand Down Expand Up @@ -427,7 +427,7 @@
<data name="Home_UpdateCard_ReleaseNotes.Content" xml:space="preserve">
<value>Notes de mise à jour</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Header" xml:space="preserve">
<value>Désactiver le cache d'effet</value>
</data>
<data name="About_Feedback_ReportBug.Header" xml:space="preserve">
Expand Down Expand Up @@ -460,7 +460,7 @@
<data name="Profile_Cursor_DrawCursor_ScalingFactor_NoScaling.Content" xml:space="preserve">
<value>Pas de mise à l'échelle</value>
</data>
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Header" xml:space="preserve">
<value>Sauvegarde du code source lors de l'analyse des effets</value>
</data>
<data name="ScalingModes_ScaleFlyout_Type_Factor" xml:space="preserve">
Expand Down Expand Up @@ -535,7 +535,7 @@
<data name="Profile_MoreOptions_RenameFlyout_OK.Content" xml:space="preserve">
<value>OK</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DebugMode.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DebugMode.Header" xml:space="preserve">
<value>Mode debug</value>
</data>
<data name="Profile_General_CaptureMethod_Default" xml:space="preserve">
Expand Down Expand Up @@ -634,7 +634,7 @@
<data name="About_Version_CheckingForUpdates.Text" xml:space="preserve">
<value>Recherche de mises à jour</value>
</data>
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Header" xml:space="preserve">
<value>Traiter les avertissements comme des erreurs lors de la compilation des effets</value>
</data>
<data name="About_Version_UpdateToDate_Installing.Text" xml:space="preserve">
Expand Down Expand Up @@ -793,7 +793,7 @@
<data name="Home_Advanced_DeveloperOptions_DuplicateFrameDetection_Always.Content" xml:space="preserve">
<value>Toujours</value>
</data>
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_EnableStatisticsForDynamicDetection.Header" xml:space="preserve">
<value>Activer les statistiques pour la détection dynamique</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DuplicateFrameDetection_Dynamic.Content" xml:space="preserve">
Expand Down
8 changes: 4 additions & 4 deletions src/Magpie/Resources.language-id.resw
Original file line number Diff line number Diff line change
Expand Up @@ -666,19 +666,19 @@
<data name="AppSettings_Dialog_Exit" xml:space="preserve">
<value>Keluar</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Header" xml:space="preserve">
<value>Nonaktifkan cache efek</value>
</data>
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Header" xml:space="preserve">
<value>Simpan kode sumber ketika efek parsing</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DebugMode.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DebugMode.Header" xml:space="preserve">
<value>Mode debug</value>
</data>
<data name="Home_Advanced_DeveloperOptions.Header" xml:space="preserve">
<value>Pilihan pengembang</value>
</data>
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Header" xml:space="preserve">
<value>Perlakukan peringatan sebagai eror saat menyusun efek</value>
</data>
<data name="AppSettings_Dialog_Error" xml:space="preserve">
Expand Down
10 changes: 5 additions & 5 deletions src/Magpie/Resources.language-it.resw
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,10 @@
<data name="Home_Advanced_DeveloperOptions.Description" xml:space="preserve">
<value>Queste impostazioni sono solo per gli sviluppatori</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableEffectCache.Header" xml:space="preserve">
<value>Disabilita la cache degli effetti</value>
</data>
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_SaveEffectSources.Header" xml:space="preserve">
<value>Salva il codice sorgente durante l'analisi degli effetti</value>
</data>
<data name="AppSettings_Dialog_Exit" xml:space="preserve">
Expand Down Expand Up @@ -565,7 +565,7 @@
<data name="Overlay_Profiler_Timings_Total" xml:space="preserve">
<value>Totale</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DisableFontCache.Header" xml:space="preserve">
<value>Disabilita la cache dei caratteri</value>
</data>
<data name="Overlay_Profiler_Timings_SwitchToPasses" xml:space="preserve">
Expand Down Expand Up @@ -757,10 +757,10 @@
<data name="Home_Advanced_DeveloperOptions.Header" xml:space="preserve">
<value>Impostazioni sviluppatore</value>
</data>
<data name="Home_Advanced_DeveloperOptions_DebugMode.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_DebugMode.Header" xml:space="preserve">
<value>Modalità di debug</value>
</data>
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Content" xml:space="preserve">
<data name="Home_Advanced_DeveloperOptions_WarningsAreErrors.Header" xml:space="preserve">
<value>Considera gli avvisi come errori durante la compilazione degli effetti</value>
</data>
<data name="Settings_General_RequireRestart_ActionButton.Content" xml:space="preserve">
Expand Down
Loading

0 comments on commit 1ec028b

Please sign in to comment.