setup mac: change the last tutorial page. present link code with copy button

This commit is contained in:
Hylke Bons 2012-10-26 23:26:15 +01:00
parent d79f093996
commit c88a0a5a4b
4 changed files with 48 additions and 33 deletions

View file

@ -131,19 +131,16 @@ namespace SparkleLib {
public SparkleUser User { public SparkleUser User {
get { get {
XmlNode name_node = SelectSingleNode ("/sparkleshare/user/name/text()"); XmlNode name_node = SelectSingleNode ("/sparkleshare/user/name/text()");
string name = name_node.Value;
XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()"); XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()");
string email = email_node.Value; string user_name = name_node.Value;
string user_email = email_node.Value;
string pubkey_file_path = Path.Combine ( SparkleUser user = new SparkleUser (user_name, user_email);
Path.GetDirectoryName (FullPath), "sparkleshare." + email + ".key.pub"); string [] pubkey_file_paths = Directory.GetFiles (Path.GetDirectoryName (FullPath), "*.pub");
SparkleUser user = new SparkleUser (name, email); if (pubkey_file_paths.Length > 0)
user.PublicKey = File.ReadAllText (pubkey_file_paths [0]);
if (File.Exists (pubkey_file_path))
user.PublicKey = File.ReadAllText (pubkey_file_path);
return user; return user;
} }
@ -151,10 +148,9 @@ namespace SparkleLib {
set { set {
SparkleUser user = (SparkleUser) value; SparkleUser user = (SparkleUser) value;
XmlNode name_node = SelectSingleNode ("/sparkleshare/user/name/text()"); XmlNode name_node = SelectSingleNode ("/sparkleshare/user/name/text()");
name_node.InnerText = user.Name;
XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()"); XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()");
name_node.InnerText = user.Name;
email_node.InnerText = user.Email; email_node.InnerText = user.Email;
Save (); Save ();

View file

@ -1,5 +1,4 @@
dist_pixmaps_DATA = \ dist_pixmaps_DATA = \
tutorial-slide-4.png \
side-splash.png \ side-splash.png \
user-icon-default.png \ user-icon-default.png \
about.png about.png

View file

@ -35,6 +35,7 @@ namespace SparkleShare {
private NSButton ContinueButton; private NSButton ContinueButton;
private NSButton AddButton; private NSButton AddButton;
private NSButton CopyButton;
private NSButton TryAgainButton; private NSButton TryAgainButton;
private NSButton CancelButton; private NSButton CancelButton;
private NSButton SkipTutorialButton; private NSButton SkipTutorialButton;
@ -51,6 +52,7 @@ namespace SparkleShare {
private NSTextField EmailHelpLabel; private NSTextField EmailHelpLabel;
private NSTextField FullNameTextField; private NSTextField FullNameTextField;
private NSTextField FullNameLabel; private NSTextField FullNameLabel;
private NSTextField LinkCodeTextField;
private NSTextField AddressTextField; private NSTextField AddressTextField;
private NSTextField AddressLabel; private NSTextField AddressLabel;
private NSTextField AddressHelpLabel; private NSTextField AddressHelpLabel;
@ -832,17 +834,18 @@ namespace SparkleShare {
string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"Pixmaps", "tutorial-slide-" + Controller.TutorialPageNumber + ".png"); "Pixmaps", "tutorial-slide-" + Controller.TutorialPageNumber + ".png");
SlideImage = new NSImage (slide_image_path) { if (File.Exists (slide_image_path)) {
Size = new SizeF (350, 200) SlideImage = new NSImage (slide_image_path) {
}; Size = new SizeF (350, 200)
};
SlideImageView = new NSImageView () { SlideImageView = new NSImageView () {
Image = SlideImage, Image = SlideImage,
Frame = new RectangleF (215, Frame.Height - 350, 350, 200) Frame = new RectangleF (215, Frame.Height - 350, 350, 200)
}; };
ContentView.AddSubview (SlideImageView);
ContentView.AddSubview (SlideImageView);
}
switch (Controller.TutorialPageNumber) { switch (Controller.TutorialPageNumber) {
@ -915,11 +918,26 @@ namespace SparkleShare {
} }
case 4: { case 4: {
Header = "Adding projects to SparkleShare"; Header = "Here's your unique link code";
Description = "You can do this through the status icon menu, or by clicking " + Description = "You'll need it whenever you want to link this computer to a host" +
"magic buttons on webpages that look like this:"; " (we keep a copy in your SparkleShare folder).";
LinkCodeTextField = new NSTextField () {
StringValue = Program.Controller.CurrentUser.PublicKey,
Enabled = false,
Selectable = false,
Frame = new RectangleF (230, Frame.Height - 238, 246, 22)
};
LinkCodeTextField.Cell.UsesSingleLineMode = true;
LinkCodeTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
CopyButton = new NSButton () {
Title = "Copy",
BezelStyle = NSBezelStyle.RoundRect,
Frame = new RectangleF (480, Frame.Height - 238, 60, 22)
};
StartupCheckButton = new NSButton () { StartupCheckButton = new NSButton () {
Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Frame = new RectangleF (190, Frame.Height - 400, 300, 18),
Title = "Add SparkleShare to startup items", Title = "Add SparkleShare to startup items",
@ -932,8 +950,11 @@ namespace SparkleShare {
Title = "Finish" Title = "Finish"
}; };
SlideImage.Size = new SizeF (350, 64); CopyButton.Activated += delegate {
NSPasteboard.GeneralPasteboard.ClearContents ();
NSPasteboard.GeneralPasteboard.SetStringForType (LinkCodeTextField.StringValue,
"NSStringPboardType");
};
StartupCheckButton.Activated += delegate { StartupCheckButton.Activated += delegate {
Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On); Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On);
@ -942,9 +963,11 @@ namespace SparkleShare {
FinishButton.Activated += delegate { FinishButton.Activated += delegate {
Controller.TutorialPageCompleted (); Controller.TutorialPageCompleted ();
}; };
ContentView.AddSubview (LinkCodeTextField);
ContentView.AddSubview (CopyButton);
ContentView.AddSubview (StartupCheckButton); ContentView.AddSubview (StartupCheckButton);
Buttons.Add (FinishButton); Buttons.Add (FinishButton);
break; break;

View file

@ -157,9 +157,6 @@
<Content Include="Pixmaps\tutorial-slide-3.png"> <Content Include="Pixmaps\tutorial-slide-3.png">
<Link>Pixmaps\tutorial-slide-3.png</Link> <Link>Pixmaps\tutorial-slide-3.png</Link>
</Content> </Content>
<Content Include="..\Common\Pixmaps\tutorial-slide-4.png">
<Link>Pixmaps\tutorial-slide-4.png</Link>
</Content>
<Content Include="..\Common\Plugins\bitbucket.xml"> <Content Include="..\Common\Plugins\bitbucket.xml">
<Link>Plugins\bitbucket.xml</Link> <Link>Plugins\bitbucket.xml</Link>
</Content> </Content>