setup mac: prettier text fields for initial setup
This commit is contained in:
parent
dc3258a5f9
commit
235be36e8c
|
@ -45,9 +45,13 @@ namespace SparkleShare {
|
||||||
private NSImageView SlideImageView;
|
private NSImageView SlideImageView;
|
||||||
private NSForm UserInfoForm;
|
private NSForm UserInfoForm;
|
||||||
private NSProgressIndicator ProgressIndicator;
|
private NSProgressIndicator ProgressIndicator;
|
||||||
|
private NSTextField EmailLabel;
|
||||||
|
private NSTextField EmailTextField;
|
||||||
|
private NSTextField FullNameTextField;
|
||||||
|
private NSTextField FullNameLabel;
|
||||||
private NSTextField AddressTextField;
|
private NSTextField AddressTextField;
|
||||||
private NSTextField PathTextField;
|
|
||||||
private NSTextField AddressLabel;
|
private NSTextField AddressLabel;
|
||||||
|
private NSTextField PathTextField;
|
||||||
private NSTextField PathLabel;
|
private NSTextField PathLabel;
|
||||||
private NSTextField PathHelpLabel;
|
private NSTextField PathHelpLabel;
|
||||||
private NSTextField AddProjectTextField;
|
private NSTextField AddProjectTextField;
|
||||||
|
@ -72,18 +76,36 @@ namespace SparkleShare {
|
||||||
Description = "Before we can create a SparkleShare folder on this " +
|
Description = "Before we can create a SparkleShare folder on this " +
|
||||||
"computer, we need some information from you.";
|
"computer, we need some information from you.";
|
||||||
|
|
||||||
UserInfoForm = new NSForm (new RectangleF (250, Frame.Height - 280, 350, 64));
|
|
||||||
|
|
||||||
UserInfoForm.AddEntry ("Full Name:");
|
FullNameLabel = new NSTextField () {
|
||||||
UserInfoForm.AddEntry ("Email Address:");
|
Alignment = NSTextAlignment.Right,
|
||||||
|
BackgroundColor = NSColor.WindowBackground,
|
||||||
|
Bordered = false,
|
||||||
|
Editable = false,
|
||||||
|
Frame = new RectangleF (165, Frame.Height - 234, 160, 17),
|
||||||
|
StringValue = "Full Name:",
|
||||||
|
Font = SparkleUI.Font
|
||||||
|
};
|
||||||
|
|
||||||
UserInfoForm.CellSize = new SizeF (280, 22);
|
FullNameTextField = new NSTextField () {
|
||||||
UserInfoForm.IntercellSpacing = new SizeF (4, 4);
|
Frame = new RectangleF (330, Frame.Height - 238, 196, 22),
|
||||||
UserInfoForm.Cells [0].LineBreakMode = NSLineBreakMode.TruncatingTail;
|
StringValue = Controller.GuessedUserName
|
||||||
UserInfoForm.Cells [1].LineBreakMode = NSLineBreakMode.TruncatingTail;
|
};
|
||||||
|
|
||||||
UserInfoForm.Cells [0].StringValue = Controller.GuessedUserName;
|
EmailLabel = new NSTextField () {
|
||||||
UserInfoForm.Cells [1].StringValue = Controller.GuessedUserEmail;
|
Alignment = NSTextAlignment.Right,
|
||||||
|
BackgroundColor = NSColor.WindowBackground,
|
||||||
|
Bordered = false,
|
||||||
|
Editable = false,
|
||||||
|
Frame = new RectangleF (165, Frame.Height - 264, 160, 17),
|
||||||
|
StringValue = "Email:",
|
||||||
|
Font = SparkleUI.Font
|
||||||
|
};
|
||||||
|
|
||||||
|
EmailTextField = new NSTextField () {
|
||||||
|
Frame = new RectangleF (330, Frame.Height - 268, 196, 22),
|
||||||
|
StringValue = Controller.GuessedUserEmail
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: Ugly hack, do properly with events
|
// TODO: Ugly hack, do properly with events
|
||||||
timer = new Timer () {
|
timer = new Timer () {
|
||||||
|
@ -99,18 +121,18 @@ namespace SparkleShare {
|
||||||
timer.Stop ();
|
timer.Stop ();
|
||||||
timer = null;
|
timer = null;
|
||||||
|
|
||||||
string full_name = UserInfoForm.Cells [0].StringValue.Trim ();
|
string full_name = FullNameTextField.StringValue.Trim ();
|
||||||
string email = UserInfoForm.Cells [1].StringValue.Trim ();
|
string email = EmailTextField.StringValue.Trim ();
|
||||||
|
|
||||||
Controller.SetupPageCompleted (full_name, email);
|
Controller.SetupPageCompleted (full_name, email);
|
||||||
};
|
};
|
||||||
|
|
||||||
timer.Elapsed += delegate {
|
timer.Elapsed += delegate {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
bool name_is_valid = !UserInfoForm.Cells [0].StringValue.Trim ().Equals ("");
|
bool name_is_valid = !FullNameTextField.StringValue.Trim ().Equals ("");
|
||||||
|
|
||||||
bool email_is_valid = Program.Controller.IsValidEmail (
|
bool email_is_valid = Program.Controller.IsValidEmail (
|
||||||
UserInfoForm.Cells [1].StringValue.Trim ());
|
EmailTextField.StringValue.Trim ());
|
||||||
|
|
||||||
ContinueButton.Enabled = (name_is_valid && email_is_valid);
|
ContinueButton.Enabled = (name_is_valid && email_is_valid);
|
||||||
});
|
});
|
||||||
|
@ -118,7 +140,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
timer.Start ();
|
timer.Start ();
|
||||||
|
|
||||||
ContentView.AddSubview (UserInfoForm);
|
ContentView.AddSubview (FullNameLabel);
|
||||||
|
ContentView.AddSubview (FullNameTextField);
|
||||||
|
ContentView.AddSubview (EmailLabel);
|
||||||
|
ContentView.AddSubview (EmailTextField);
|
||||||
|
|
||||||
Buttons.Add (ContinueButton);
|
Buttons.Add (ContinueButton);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -160,7 +186,8 @@ namespace SparkleShare {
|
||||||
PathTextField = new NSTextField () {
|
PathTextField = new NSTextField () {
|
||||||
Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22),
|
Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22),
|
||||||
StringValue = Controller.PreviousPath,
|
StringValue = Controller.PreviousPath,
|
||||||
Enabled = (Controller.SelectedPlugin.Path == null)
|
Enabled = (Controller.SelectedPlugin.Path == null),
|
||||||
|
Bezeled = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,8 @@ namespace SparkleShare {
|
||||||
FolderMenuItems = new NSMenuItem [1];
|
FolderMenuItems = new NSMenuItem [1];
|
||||||
|
|
||||||
FolderMenuItems [0] = new NSMenuItem () {
|
FolderMenuItems [0] = new NSMenuItem () {
|
||||||
Title = "No projects yet"
|
Title = "No projects yet",
|
||||||
|
Enabled = false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue