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 NSForm UserInfoForm;
|
||||
private NSProgressIndicator ProgressIndicator;
|
||||
private NSTextField EmailLabel;
|
||||
private NSTextField EmailTextField;
|
||||
private NSTextField FullNameTextField;
|
||||
private NSTextField FullNameLabel;
|
||||
private NSTextField AddressTextField;
|
||||
private NSTextField PathTextField;
|
||||
private NSTextField AddressLabel;
|
||||
private NSTextField PathTextField;
|
||||
private NSTextField PathLabel;
|
||||
private NSTextField PathHelpLabel;
|
||||
private NSTextField AddProjectTextField;
|
||||
|
@ -72,18 +76,36 @@ namespace SparkleShare {
|
|||
Description = "Before we can create a SparkleShare folder on this " +
|
||||
"computer, we need some information from you.";
|
||||
|
||||
UserInfoForm = new NSForm (new RectangleF (250, Frame.Height - 280, 350, 64));
|
||||
|
||||
UserInfoForm.AddEntry ("Full Name:");
|
||||
UserInfoForm.AddEntry ("Email Address:");
|
||||
FullNameLabel = new NSTextField () {
|
||||
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);
|
||||
UserInfoForm.IntercellSpacing = new SizeF (4, 4);
|
||||
UserInfoForm.Cells [0].LineBreakMode = NSLineBreakMode.TruncatingTail;
|
||||
UserInfoForm.Cells [1].LineBreakMode = NSLineBreakMode.TruncatingTail;
|
||||
FullNameTextField = new NSTextField () {
|
||||
Frame = new RectangleF (330, Frame.Height - 238, 196, 22),
|
||||
StringValue = Controller.GuessedUserName
|
||||
};
|
||||
|
||||
UserInfoForm.Cells [0].StringValue = Controller.GuessedUserName;
|
||||
UserInfoForm.Cells [1].StringValue = Controller.GuessedUserEmail;
|
||||
EmailLabel = new NSTextField () {
|
||||
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
|
||||
timer = new Timer () {
|
||||
|
@ -99,18 +121,18 @@ namespace SparkleShare {
|
|||
timer.Stop ();
|
||||
timer = null;
|
||||
|
||||
string full_name = UserInfoForm.Cells [0].StringValue.Trim ();
|
||||
string email = UserInfoForm.Cells [1].StringValue.Trim ();
|
||||
string full_name = FullNameTextField.StringValue.Trim ();
|
||||
string email = EmailTextField.StringValue.Trim ();
|
||||
|
||||
Controller.SetupPageCompleted (full_name, email);
|
||||
};
|
||||
|
||||
timer.Elapsed += 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 (
|
||||
UserInfoForm.Cells [1].StringValue.Trim ());
|
||||
EmailTextField.StringValue.Trim ());
|
||||
|
||||
ContinueButton.Enabled = (name_is_valid && email_is_valid);
|
||||
});
|
||||
|
@ -118,7 +140,11 @@ namespace SparkleShare {
|
|||
|
||||
timer.Start ();
|
||||
|
||||
ContentView.AddSubview (UserInfoForm);
|
||||
ContentView.AddSubview (FullNameLabel);
|
||||
ContentView.AddSubview (FullNameTextField);
|
||||
ContentView.AddSubview (EmailLabel);
|
||||
ContentView.AddSubview (EmailTextField);
|
||||
|
||||
Buttons.Add (ContinueButton);
|
||||
|
||||
break;
|
||||
|
@ -160,7 +186,8 @@ namespace SparkleShare {
|
|||
PathTextField = new NSTextField () {
|
||||
Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22),
|
||||
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 [0] = new NSMenuItem () {
|
||||
Title = "No projects yet"
|
||||
Title = "No projects yet",
|
||||
Enabled = false
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue