mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Compare commits
No commits in common. "1c345df37db53e416d98887d860c919ef8c8311e" and "e4cfca0ffdb85980b3221d30febea5997a48c384" have entirely different histories.
1c345df37d
...
e4cfca0ffd
17 changed files with 164 additions and 247 deletions
|
@ -25,18 +25,6 @@ namespace SourceGit
|
|||
private Action<object> _action = null;
|
||||
}
|
||||
|
||||
public static bool IsCheckForUpdateCommandVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DISABLE_UPDATE_DETECTION
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly Command OpenPreferenceCommand = new Command(_ => OpenDialog(new Views.Preference()));
|
||||
public static readonly Command OpenHotkeysCommand = new Command(_ => OpenDialog(new Views.Hotkeys()));
|
||||
public static readonly Command OpenAppDataDirCommand = new Command(_ => Native.OS.OpenInFileManager(Native.OS.DataDir));
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<NativeMenu>
|
||||
<NativeMenuItem Header="{DynamicResource Text.About.Menu}" Command="{x:Static s:App.OpenAboutCommand}"/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.Hotkeys}" Command="{x:Static s:App.OpenHotkeysCommand}"/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}" IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}"/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}"/>
|
||||
<NativeMenuItemSeparator/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.Preference}" Command="{x:Static s:App.OpenPreferenceCommand}" Gesture="⌘+,"/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.OpenAppDataDir}" Command="{x:Static s:App.OpenAppDataDirCommand}"/>
|
||||
|
|
|
@ -548,11 +548,9 @@ namespace SourceGit
|
|||
_launcher = new ViewModels.Launcher(startupRepo);
|
||||
desktop.MainWindow = new Views.Launcher() { DataContext = _launcher };
|
||||
|
||||
#if !DISABLE_UPDATE_DETECTION
|
||||
var pref = ViewModels.Preference.Instance;
|
||||
if (pref.ShouldCheck4UpdateOnStartup())
|
||||
Check4Update();
|
||||
#endif
|
||||
}
|
||||
|
||||
private ViewModels.Launcher _launcher = null;
|
||||
|
|
|
@ -273,7 +273,7 @@
|
|||
<x:String x:Key="Text.FastForwardWithoutCheck" xml:space="preserve">Fast-Forward (without checkout)</x:String>
|
||||
<x:String x:Key="Text.Fetch" xml:space="preserve">Fetch</x:String>
|
||||
<x:String x:Key="Text.Fetch.AllRemotes" xml:space="preserve">Fetch all remotes</x:String>
|
||||
<x:String x:Key="Text.Fetch.Force" xml:space="preserve">Override refs check</x:String>
|
||||
<x:String x:Key="Text.Fetch.Force" xml:space="preserve">Enable '--force' option</x:String>
|
||||
<x:String x:Key="Text.Fetch.NoTags" xml:space="preserve">Fetch without tags</x:String>
|
||||
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">Remote:</x:String>
|
||||
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">Fetch Remote Changes</x:String>
|
||||
|
|
|
@ -276,7 +276,7 @@
|
|||
<x:String x:Key="Text.FastForwardWithoutCheck" xml:space="preserve">快进(fast-forward,无需checkout)</x:String>
|
||||
<x:String x:Key="Text.Fetch" xml:space="preserve">拉取(fetch)</x:String>
|
||||
<x:String x:Key="Text.Fetch.AllRemotes" xml:space="preserve">拉取所有的远程仓库</x:String>
|
||||
<x:String x:Key="Text.Fetch.Force" xml:space="preserve">覆盖REF检查</x:String>
|
||||
<x:String x:Key="Text.Fetch.Force" xml:space="preserve">启用 --force 选项</x:String>
|
||||
<x:String x:Key="Text.Fetch.NoTags" xml:space="preserve">不拉取远程标签</x:String>
|
||||
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">远程仓库 :</x:String>
|
||||
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">拉取远程仓库内容</x:String>
|
||||
|
|
|
@ -276,7 +276,7 @@
|
|||
<x:String x:Key="Text.FastForwardWithoutCheck" xml:space="preserve">快進 (fast-forward,無需 checkout)</x:String>
|
||||
<x:String x:Key="Text.Fetch" xml:space="preserve">提取 (fetch)</x:String>
|
||||
<x:String x:Key="Text.Fetch.AllRemotes" xml:space="preserve">提取所有的遠端存放庫</x:String>
|
||||
<x:String x:Key="Text.Fetch.Force" xml:space="preserve">覆寫 REFs 檢查</x:String>
|
||||
<x:String x:Key="Text.Fetch.Force" xml:space="preserve">啟用 [--force] 選項</x:String>
|
||||
<x:String x:Key="Text.Fetch.NoTags" xml:space="preserve">不提取遠端標籤</x:String>
|
||||
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">遠端存放庫:</x:String>
|
||||
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">提取遠端存放庫內容</x:String>
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
<TrimMode>link</TrimMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(DisableUpdateDetection)' == 'true'">
|
||||
<DefineConstants>$(DefineConstants);DISABLE_UPDATE_DETECTION</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="App.ico" />
|
||||
<AvaloniaResource Include="Resources/Fonts/*" />
|
||||
|
|
|
@ -11,12 +11,6 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
public class Launcher : ObservableObject
|
||||
{
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
private set => SetProperty(ref _title, value);
|
||||
}
|
||||
|
||||
public AvaloniaList<LauncherPage> Pages
|
||||
{
|
||||
get;
|
||||
|
@ -37,10 +31,9 @@ namespace SourceGit.ViewModels
|
|||
if (SetProperty(ref _activePage, value))
|
||||
{
|
||||
PopupHost.Active = value;
|
||||
UpdateTitle();
|
||||
|
||||
if (!_ignoreIndexChange && value is { Data: Repository repo })
|
||||
_activeWorkspace.ActiveIdx = _activeWorkspace.Repositories.IndexOf(repo.FullPath);
|
||||
ActiveWorkspace.ActiveIdx = ActiveWorkspace.Repositories.IndexOf(repo.FullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,9 +105,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
_ignoreIndexChange = false;
|
||||
|
||||
if (string.IsNullOrEmpty(_title))
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public void Quit(double width, double height)
|
||||
|
@ -195,7 +185,6 @@ namespace SourceGit.ViewModels
|
|||
last.Node = new RepositoryNode() { Id = Guid.NewGuid().ToString() };
|
||||
last.Data = Welcome.Instance;
|
||||
last.Popup = null;
|
||||
UpdateTitle();
|
||||
|
||||
GC.Collect();
|
||||
}
|
||||
|
@ -204,6 +193,7 @@ namespace SourceGit.ViewModels
|
|||
App.Quit(0);
|
||||
}
|
||||
|
||||
_ignoreIndexChange = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -318,10 +308,7 @@ namespace SourceGit.ViewModels
|
|||
page.Data = repo;
|
||||
}
|
||||
|
||||
if (page != _activePage)
|
||||
ActivePage = page;
|
||||
else
|
||||
UpdateTitle();
|
||||
|
||||
ActiveWorkspace.Repositories.Clear();
|
||||
foreach (var p in Pages)
|
||||
|
@ -543,37 +530,8 @@ namespace SourceGit.ViewModels
|
|||
page.Data = null;
|
||||
}
|
||||
|
||||
private void UpdateTitle()
|
||||
{
|
||||
if (_activeWorkspace == null)
|
||||
return;
|
||||
|
||||
var workspace = _activeWorkspace.Name;
|
||||
if (_activePage is { Data: Repository repo })
|
||||
{
|
||||
var node = _activePage.Node;
|
||||
var name = node.Name;
|
||||
var path = node.Id;
|
||||
|
||||
if (!OperatingSystem.IsWindows())
|
||||
{
|
||||
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var prefixLen = home.EndsWith('/') ? home.Length - 1 : home.Length;
|
||||
if (path.StartsWith(home, StringComparison.Ordinal))
|
||||
path = "~" + path.Substring(prefixLen);
|
||||
}
|
||||
|
||||
Title = $"[{workspace}] {name} ({path})";
|
||||
}
|
||||
else
|
||||
{
|
||||
Title = $"[{workspace}] Repositories";
|
||||
}
|
||||
}
|
||||
|
||||
private Workspace _activeWorkspace = null;
|
||||
private LauncherPage _activePage = null;
|
||||
private bool _ignoreIndexChange = false;
|
||||
private string _title = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,7 @@
|
|||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Apply.IgnoreWS}"
|
||||
IsChecked="{Binding IgnoreWhiteSpace, Mode=TwoWay}"
|
||||
ToolTip.Tip="--ignore-whitespace"/>
|
||||
IsChecked="{Binding IgnoreWhiteSpace, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -5,7 +5,6 @@ using Avalonia.Collections;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -125,7 +124,7 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnSHAPointerEntered(object sender, PointerEventArgs e)
|
||||
private async void OnSHAPointerEntered(object sender, PointerEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha } ctl)
|
||||
{
|
||||
|
@ -133,22 +132,14 @@ namespace SourceGit.Views
|
|||
if (tooltip is Models.Commit commit && commit.SHA == sha)
|
||||
return;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var c = detail.GetParent(sha);
|
||||
if (c == null) return;
|
||||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
if (ctl.IsEffectivelyVisible && ctl.DataContext is string newSHA && newSHA == sha)
|
||||
var c = await Task.Run(() => detail.GetParent(sha));
|
||||
if (c != null && ctl.IsVisible && ctl.DataContext is string newSHA && newSHA == sha)
|
||||
{
|
||||
ToolTip.SetTip(ctl, c);
|
||||
|
||||
if (ctl.IsPointerOver)
|
||||
ToolTip.SetIsOpen(ctl, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
|
|
@ -34,18 +34,15 @@
|
|||
|
||||
<CheckBox Grid.Row="1" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Fetch.Force}"
|
||||
IsChecked="{Binding Force, Mode=TwoWay}"
|
||||
ToolTip.Tip="--force"/>
|
||||
IsChecked="{Binding Force, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Fetch.AllRemotes}"
|
||||
IsChecked="{Binding FetchAllRemotes, Mode=TwoWay}"
|
||||
ToolTip.Tip="--all"/>
|
||||
IsChecked="{Binding FetchAllRemotes, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Fetch.NoTags}"
|
||||
IsChecked="{Binding NoTags, Mode=TwoWay}"
|
||||
ToolTip.Tip="--no-tags"/>
|
||||
IsChecked="{Binding NoTags, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
x:DataType="vm:Launcher"
|
||||
x:Name="ThisControl"
|
||||
Icon="/App.ico"
|
||||
Title="{Binding Title}"
|
||||
Title="SourceGit"
|
||||
MinWidth="1024" MinHeight="600"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
|
@ -51,12 +51,12 @@
|
|||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="-"/>
|
||||
<MenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}" IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}">
|
||||
<MenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.SoftwareUpdate}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="-" IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}"/>
|
||||
<MenuItem Header="-"/>
|
||||
<MenuItem Header="{DynamicResource Text.About}" Command="{x:Static s:App.OpenAboutCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}"/>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="using:SourceGit"
|
||||
xmlns:m="using:SourceGit.Models"
|
||||
xmlns:c="using:SourceGit.Converters"
|
||||
xmlns:vm="using:SourceGit.ViewModels"
|
||||
|
@ -46,7 +45,7 @@
|
|||
<TabItem.Header>
|
||||
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preference.General}"/>
|
||||
</TabItem.Header>
|
||||
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
|
||||
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32" ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preference.General.Locale}"
|
||||
HorizontalAlignment="Right"
|
||||
|
@ -119,7 +118,6 @@
|
|||
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preference.General.Check4UpdatesOnStartup}"
|
||||
IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}"
|
||||
IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=Check4UpdatesOnStartup, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
|
|
@ -99,13 +99,11 @@
|
|||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Pull.NoTags}"
|
||||
IsChecked="{Binding NoTags, Mode=TwoWay}"
|
||||
ToolTip.Tip="--no-tags"/>
|
||||
IsChecked="{Binding NoTags, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Pull.UseRebase}"
|
||||
IsChecked="{Binding UseRebase, Mode=TwoWay}"
|
||||
ToolTip.Tip="--rebase"/>
|
||||
IsChecked="{Binding UseRebase, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -83,25 +83,21 @@
|
|||
Height="32"
|
||||
Content="{DynamicResource Text.Push.Tracking}"
|
||||
IsChecked="{Binding Tracking, Mode=TwoWay}"
|
||||
IsVisible="{Binding IsSetTrackOptionVisible}"
|
||||
ToolTip.Tip="-u"/>
|
||||
IsVisible="{Binding IsSetTrackOptionVisible}"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Push.CheckSubmodules}"
|
||||
IsChecked="{Binding CheckSubmodules, Mode=TwoWay}"
|
||||
IsVisible="{Binding IsCheckSubmodulesVisible}"
|
||||
ToolTip.Tip="--recurse-submodules=check"/>
|
||||
IsVisible="{Binding IsCheckSubmodulesVisible}"/>
|
||||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Push.WithAllTags}"
|
||||
IsChecked="{Binding PushAllTags, Mode=TwoWay}"
|
||||
ToolTip.Tip="--tags"/>
|
||||
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Push.Force}"
|
||||
IsChecked="{Binding ForcePush, Mode=TwoWay}"
|
||||
ToolTip.Tip="--force-with-lease"/>
|
||||
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -27,21 +27,18 @@
|
|||
Height="32"
|
||||
Content="{DynamicResource Text.Stash.IncludeUntracked}"
|
||||
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"
|
||||
IsVisible="{Binding !HasSelectedFiles}"
|
||||
ToolTip.Tip="--include-untracked"/>
|
||||
IsVisible="{Binding !HasSelectedFiles}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Stash.OnlyStagedChanges}"
|
||||
IsChecked="{Binding OnlyStaged, Mode=TwoWay}"
|
||||
IsVisible="{Binding !HasSelectedFiles}"
|
||||
ToolTip.Tip="--staged"/>
|
||||
IsVisible="{Binding !HasSelectedFiles}"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Stash.KeepIndex}"
|
||||
IsChecked="{Binding KeepIndex, Mode=TwoWay}"
|
||||
ToolTip.Tip="--keep-index"/>
|
||||
IsChecked="{Binding KeepIndex, Mode=TwoWay}"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="1"
|
||||
Margin="0,4,0,0"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
x:Class="SourceGit.Views.Welcome"
|
||||
x:DataType="vm:Welcome">
|
||||
<Grid RowDefinitions="*,36">
|
||||
<!-- Managed Repositories -->
|
||||
<Grid Grid.Column="1" MinWidth="600" Margin="8" RowDefinitions="Auto,*" HorizontalAlignment="Center">
|
||||
<Grid Grid.Row="0" Margin="0,8" ColumnDefinitions="*,600,*">
|
||||
<Grid Grid.Column="1" RowDefinitions="Auto,*">
|
||||
<!-- Search Box -->
|
||||
<TextBox Grid.Row="0"
|
||||
x:Name="SearchBox"
|
||||
|
@ -140,18 +140,19 @@
|
|||
IsVisible="{Binding IsInvalid}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Border Grid.Column="3" Margin="8,0" VerticalAlignment="Center" ClipToBounds="True">
|
||||
<TextBlock Classes="primary"
|
||||
HorizontalAlignment="Right"
|
||||
<TextBlock Grid.Column="3"
|
||||
Classes="primary"
|
||||
Margin="8,0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource Brush.FG2}"
|
||||
Text="{Binding Id, Converter={x:Static c:PathConverters.RelativeToHome}}"
|
||||
IsVisible="{Binding IsRepository}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</v:RepositoryListBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- Tips -->
|
||||
<TextBlock Grid.Row="1"
|
||||
|
|
Loading…
Reference in a new issue