Fix whitespace for last commit

This commit is contained in:
Hylke Bons 2011-08-27 17:53:17 +02:00
parent f3cb3e6e0f
commit f3b53db8ab
6 changed files with 97 additions and 97 deletions

View file

@ -88,44 +88,44 @@ namespace SparkleLib {
{
this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath,
"clone " +
"--progress " + // Redirects progress stats to standarderror
"\"" + base.remote_url + "\" " + "\"" + base.target_folder + "\"");
this.git.StartInfo.RedirectStandardError = true;
"--progress " + // Redirects progress stats to standarderror
"\"" + base.remote_url + "\" " + "\"" + base.target_folder + "\"");
this.git.StartInfo.RedirectStandardError = true;
this.git.Start ();
double percentage = 1.0;
double percentage = 1.0;
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
while (!this.git.StandardError.EndOfStream) {
string line = this.git.StandardError.ReadLine ();
Match match = progress_regex.Match (line);
double number = 0.0;
while (!this.git.StandardError.EndOfStream) {
string line = this.git.StandardError.ReadLine ();
Match match = progress_regex.Match (line);
double number = 0.0;
if (match.Success) {
number = double.Parse (match.Groups [1].Value);
// The cloning progress consists of two stages: the "Compressing
// objects" stage which we count as 20% of the total progress, and
// the "Receiving objects" stage which we count as the last 80%
if (line.Contains ("|"))
// "Receiving objects" stage
number = (number / 100 * 75 + 20);
else
// "Compressing objects" stage
number = (number / 100 * 20);
}
if (number >= percentage) {
percentage = number;
// FIXME: for some reason it doesn't go above 95%
base.OnProgressChanged (percentage);
}
System.Threading.Thread.Sleep (100);
}
// The cloning progress consists of two stages: the "Compressing
// objects" stage which we count as 20% of the total progress, and
// the "Receiving objects" stage which we count as the last 80%
if (line.Contains ("|"))
// "Receiving objects" stage
number = (number / 100 * 75 + 20);
else
// "Compressing objects" stage
number = (number / 100 * 20);
}
if (number >= percentage) {
percentage = number;
// FIXME: for some reason it doesn't go above 95%
base.OnProgressChanged (percentage);
}
System.Threading.Thread.Sleep (100);
}
this.git.WaitForExit ();
SparkleHelpers.DebugInfo ("Git", "Exit code " + this.git.ExitCode.ToString ());

View file

@ -31,12 +31,12 @@ namespace SparkleLib {
public delegate void StartedEventHandler ();
public delegate void FinishedEventHandler ();
public delegate void FailedEventHandler ();
public delegate void ProgressChangedEventHandler (double percentage);
public delegate void ProgressChangedEventHandler (double percentage);
public event StartedEventHandler Started;
public event FinishedEventHandler Finished;
public event FailedEventHandler Failed;
public event ProgressChangedEventHandler ProgressChanged;
public event ProgressChangedEventHandler ProgressChanged;
protected string target_folder;
protected string remote_url;
@ -119,13 +119,13 @@ namespace SparkleLib {
}
}
protected void OnProgressChanged (double percentage) {
if (ProgressChanged != null)
ProgressChanged (percentage);
}
protected void OnProgressChanged (double percentage) {
if (ProgressChanged != null)
ProgressChanged (percentage);
}
private void DisableHostKeyCheckingForHost (string host)
{
string path = SparkleConfig.DefaultConfig.HomePath;

View file

@ -28,32 +28,32 @@ using MonoMac.WebKit;
namespace SparkleShare {
public class SparkleSetup : SparkleSetupWindow {
public class SparkleSetup : SparkleSetupWindow {
public SparkleSetupController Controller = new SparkleSetupController ();
private NSButton ContinueButton;
private NSButton SyncButton;
private NSButton TryAgainButton;
private NSButton CancelButton;
private NSButton OpenFolderButton;
private NSButton FinishButton;
private NSForm UserInfoForm;
private NSProgressIndicator ProgressIndicator;
private NSTextField AddressTextField;
private NSTextField FolderNameTextField;
private NSTextField ServerTypeLabel;
private NSTextField AddressLabel;
private NSTextField FolderNameLabel;
private NSTextField FolderNameHelpLabel;
private NSButtonCell ButtonCellProto;
private NSMatrix Matrix;
private int ServerType;
private NSButton ContinueButton;
private NSButton SyncButton;
private NSButton TryAgainButton;
private NSButton CancelButton;
private NSButton OpenFolderButton;
private NSButton FinishButton;
private NSForm UserInfoForm;
private NSProgressIndicator ProgressIndicator;
private NSTextField AddressTextField;
private NSTextField FolderNameTextField;
private NSTextField ServerTypeLabel;
private NSTextField AddressLabel;
private NSTextField FolderNameLabel;
private NSTextField FolderNameHelpLabel;
private NSButtonCell ButtonCellProto;
private NSMatrix Matrix;
private int ServerType;
private Timer timer;
public SparkleSetup () : base ()
{
public SparkleSetup () : base ()
{
Controller.ChangePageEvent += delegate (PageType type) {
InvokeOnMainThread (delegate {
Reset ();
@ -297,18 +297,18 @@ namespace SparkleShare {
ProgressIndicator = new NSProgressIndicator () {
Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20),
Style = NSProgressIndicatorStyle.Bar,
MinValue = 0.0,
MaxValue = 100.0
MinValue = 0.0,
MaxValue = 100.0
};
// ProgressIndicator.StartAnimation (this);
Controller.UpdateProgressBarEvent += delegate (double percentage) {
InvokeOnMainThread (delegate {
Controller.UpdateProgressBarEvent += delegate (double percentage) {
InvokeOnMainThread (delegate {
ProgressIndicator.DoubleValue = percentage;
});
};
});
};
ContentView.AddSubview (ProgressIndicator);
FinishButton = new NSButton () {
@ -317,12 +317,12 @@ namespace SparkleShare {
};
CancelButton = new NSButton () {
Title = "Cancel"
};
Title = "Cancel"
};
CancelButton.Activated += delegate {
CancelButton.Activated += delegate {
Controller.SyncingCancelled ();
};
};
Buttons.Add (FinishButton);
Buttons.Add (CancelButton);
@ -387,5 +387,5 @@ namespace SparkleShare {
});
};
}
}
}
}

View file

@ -46,8 +46,8 @@ namespace SparkleShare {
public event FolderFetchErrorEventHandler FolderFetchError;
public delegate void FolderFetchErrorEventHandler ();
public event FolderFetchingEventHandler FolderFetching;
public event FolderFetchingEventHandler FolderFetching;
public delegate void FolderFetchingEventHandler (double percentage);
public event FolderListChangedEventHandler FolderListChanged;
@ -1058,12 +1058,12 @@ namespace SparkleShare {
if (Directory.Exists (tmp_path))
Directory.Delete (tmp_path, true);
};
this.fetcher.ProgressChanged += delegate (double percentage) {
if (FolderFetching != null)
FolderFetching (percentage);
};
this.fetcher.ProgressChanged += delegate (double percentage) {
if (FolderFetching != null)
FolderFetching (percentage);
};
this.fetcher.Start ();

View file

@ -313,10 +313,10 @@ namespace SparkleShare {
AddButton (finish_button);
Controller.UpdateProgressBarEvent += delegate (double percentage) {
Application.Invoke (delegate {
this.progress_bar.Fraction = percentage / 100;
});
};
Application.Invoke (delegate {
this.progress_bar.Fraction = percentage / 100;
});
};
if (this.progress_bar.Parent != null)
(this.progress_bar.Parent as Container).Remove (this.progress_bar);

View file

@ -33,8 +33,8 @@ namespace SparkleShare {
public event ChangePageEventHandler ChangePageEvent;
public delegate void ChangePageEventHandler (PageType page);
public event UpdateProgressBarEventHandler UpdateProgressBarEvent;
public event UpdateProgressBarEventHandler UpdateProgressBarEvent;
public delegate void UpdateProgressBarEventHandler (double percentage);
public string PreviousServer {
@ -123,11 +123,11 @@ namespace SparkleShare {
this.syncing_folder = "";
};
SparkleShare.Controller.FolderFetching += delegate (double percentage) {
if (UpdateProgressBarEvent != null)
UpdateProgressBarEvent (percentage);
};
SparkleShare.Controller.FolderFetching += delegate (double percentage) {
if (UpdateProgressBarEvent != null)
UpdateProgressBarEvent (percentage);
};
SparkleShare.Controller.FetchFolder (server, folder_name);
}