Наследование: System.Windows.Controls.Label
Пример #1
0
        private void CreateAbout()
        {
            this.about_image      = NSImage.ImageNamed("about");
            this.about_image.Size = new SizeF(720, 260);

            this.about_image_view = new NSImageView()
            {
                Image = this.about_image,
                Frame = new RectangleF(0, 0, 720, 260)
            };

            this.version_text_field = new SparkleLabel("version " + Controller.RunningVersion, NSTextAlignment.Left)
            {
                DrawsBackground = false,
                Frame           = new RectangleF(295, 140, 318, 22),
                TextColor       = NSColor.White
            };

            this.updates_text_field = new SparkleLabel("Checking for updates...", NSTextAlignment.Left)
            {
                DrawsBackground = false,
                Frame           = new RectangleF(295, Frame.Height - 232, 318, 98),
                TextColor       = NSColor.FromCalibratedRgba(1.0f, 1.0f, 1.0f, 0.5f)
            };

            this.credits_text_field = new SparkleLabel(
                @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others" +
                "\n\n" +
                "SparkleShare is Open Source. You are free to use, modify, and redistribute it " +
                "under the GNU GPLv3", NSTextAlignment.Left)
            {
                DrawsBackground = false,
                Frame           = new RectangleF(295, Frame.Height - 260, 318, 98),
                TextColor       = NSColor.White
            };

            this.website_link       = new SparkleLink("Website", Controller.WebsiteLinkAddress);
            this.website_link.Frame = new RectangleF(new PointF(295, 25), this.website_link.Frame.Size);

            this.credits_link       = new SparkleLink("Credits", Controller.CreditsLinkAddress);
            this.credits_link.Frame = new RectangleF(
                new PointF(this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                this.credits_link.Frame.Size);

            this.report_problem_link       = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
            this.report_problem_link.Frame = new RectangleF(
                new PointF(this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                this.report_problem_link.Frame.Size);

            this.debug_log_link       = new SparkleLink("Debug log", Controller.DebugLogLinkAddress);
            this.debug_log_link.Frame = new RectangleF(
                new PointF(this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
                this.debug_log_link.Frame.Size);

            ContentView.AddSubview(this.about_image_view);
            ContentView.AddSubview(this.version_text_field);
            ContentView.AddSubview(this.updates_text_field);
            ContentView.AddSubview(this.credits_text_field);
            ContentView.AddSubview(this.website_link);
            ContentView.AddSubview(this.credits_link);
            ContentView.AddSubview(this.report_problem_link);
            ContentView.AddSubview(this.debug_log_link);
        }
Пример #2
0
        public SparkleAbout() : base()
        {
            using (var a = new NSAutoreleasePool())
            {
                SetFrame(new RectangleF(0, 0, 640, 281), true);
                Center();

                Delegate    = new SparkleAboutDelegate();
                StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
                Title       = "About SparkleShare";
                MaxSize     = new SizeF(640, 281);
                MinSize     = new SizeF(640, 281);
                HasShadow   = true;
                BackingType = NSBackingStore.Buffered;

                this.website_link       = new SparkleLink("Website", Controller.WebsiteLinkAddress);
                this.website_link.Frame = new RectangleF(new PointF(295, 25), this.website_link.Frame.Size);

                this.credits_link       = new SparkleLink("Credits", Controller.CreditsLinkAddress);
                this.credits_link.Frame = new RectangleF(
                    new PointF(this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                    this.credits_link.Frame.Size);

                this.report_problem_link       = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
                this.report_problem_link.Frame = new RectangleF(
                    new PointF(this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                    this.report_problem_link.Frame.Size);

                this.hidden_close_button = new NSButton()
                {
                    Frame = new RectangleF(0, 0, 0, 0),
                    KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                    KeyEquivalent             = "w"
                };

                this.hidden_close_button.Activated += delegate {
                    Controller.WindowClosed();
                };


                ContentView.AddSubview(this.hidden_close_button);

                CreateAbout();

                ContentView.AddSubview(this.website_link);
                ContentView.AddSubview(this.credits_link);
                ContentView.AddSubview(this.report_problem_link);
            }

            Controller.HideWindowEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        PerformClose(this);
                    });
                }
            };

            Controller.ShowWindowEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        OrderFrontRegardless();
                    });
                }
            };

            Controller.NewVersionEvent += delegate(string new_version) {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        this.updates_text_field.StringValue = "A newer version (" + new_version + ") is available!";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };

            Controller.VersionUpToDateEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        this.updates_text_field.StringValue = "You are running the latest version.";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };

            Controller.CheckingForNewVersionEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        this.updates_text_field.StringValue = "Checking for updates...";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };
        }
Пример #3
0
        private void CreateAbout()
        {
            this.about_image = NSImage.ImageNamed ("about");
            this.about_image.Size = new SizeF (720, 260);

            this.about_image_view = new NSImageView () {
                Image = this.about_image,
                Frame = new RectangleF (0, 0, 720, 260)
            };

            this.version_text_field = new SparkleLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) {
                DrawsBackground = false,
                Frame           = new RectangleF (295, 140, 318, 22),
                TextColor       = NSColor.White
            };

            this.updates_text_field = new SparkleLabel ("Checking for updates...", NSTextAlignment.Left) {
                DrawsBackground = false,
                Frame           = new RectangleF (295, Frame.Height - 232, 318, 98),
                TextColor       = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f)
            };

            this.credits_text_field = new SparkleLabel (
                @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others" +
                "\n\n" +
                "SparkleShare is Open Source. You are free to use, modify, and redistribute it " +
                "under the GNU GPLv3", NSTextAlignment.Left) {

                DrawsBackground = false,
                Frame           = new RectangleF (295, Frame.Height - 260, 318, 98),
                TextColor       = NSColor.White
            };

            this.website_link       = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
            this.website_link.Frame = new RectangleF (new PointF (295, 25), this.website_link.Frame.Size);

            this.credits_link       = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
            this.credits_link.Frame = new RectangleF (
                new PointF (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                this.credits_link.Frame.Size);

            this.report_problem_link       = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
            this.report_problem_link.Frame = new RectangleF (
                new PointF (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                this.report_problem_link.Frame.Size);

            this.debug_log_link       = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
            this.debug_log_link.Frame = new RectangleF (
                new PointF (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
                this.debug_log_link.Frame.Size);

            ContentView.AddSubview (this.about_image_view);
            ContentView.AddSubview (this.version_text_field);
            ContentView.AddSubview (this.updates_text_field);
            ContentView.AddSubview (this.credits_text_field);
            ContentView.AddSubview (this.website_link);
            ContentView.AddSubview (this.credits_link);
            ContentView.AddSubview (this.report_problem_link);
            ContentView.AddSubview (this.debug_log_link);
        }
Пример #4
0
        private void CreateAbout()
        {
            Image image = new Image()
            {
                Width  = 640,
                Height = 260
            };

            image.Source = SparkleUIHelpers.GetImageSource("about");


            Label version = new Label()
            {
                Content    = "version " + Controller.RunningVersion,
                FontSize   = 11,
                Foreground = new SolidColorBrush(Colors.White)
            };

            this.updates = new Label()
            {
                Content    = "Checking for updates...",
                FontSize   = 11,
                Foreground = new SolidColorBrush(Color.FromArgb(128, 255, 255, 255))
            };

            TextBlock credits = new TextBlock()
            {
                FontSize   = 11,
                Foreground = new SolidColorBrush(Colors.White),
                Text       = "Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" +
                             "\n" +
                             "SparkleShare is Open Source software. You are free to use, modify, " +
                             "and redistribute it under the GNU General Public License version 3 or later.",
                TextWrapping = TextWrapping.Wrap,
                Width        = 318
            };

            SparkleLink website_link        = new SparkleLink("Website", Controller.WebsiteLinkAddress);
            SparkleLink credits_link        = new SparkleLink("Credits", Controller.CreditsLinkAddress);
            SparkleLink report_problem_link = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
            SparkleLink debug_log_link      = new SparkleLink("Debug log", Controller.DebugLogLinkAddress);

            Canvas canvas = new Canvas();

            canvas.Children.Add(image);
            Canvas.SetLeft(image, 0);
            Canvas.SetTop(image, 0);

            canvas.Children.Add(version);
            Canvas.SetLeft(version, 289);
            Canvas.SetTop(version, 92);

            canvas.Children.Add(this.updates);
            Canvas.SetLeft(this.updates, 289);
            Canvas.SetTop(this.updates, 109);

            canvas.Children.Add(credits);
            Canvas.SetLeft(credits, 294);
            Canvas.SetTop(credits, 142);

            canvas.Children.Add(website_link);
            Canvas.SetLeft(website_link, 289);
            Canvas.SetTop(website_link, 222);

            canvas.Children.Add(credits_link);
            Canvas.SetLeft(credits_link, 289 + website_link.ActualWidth + 60);
            Canvas.SetTop(credits_link, 222);

            canvas.Children.Add(report_problem_link);
            Canvas.SetLeft(report_problem_link, 289 + website_link.ActualWidth + credits_link.ActualWidth + 115);
            Canvas.SetTop(report_problem_link, 222);

            canvas.Children.Add(debug_log_link);
            Canvas.SetLeft(debug_log_link, 289 + website_link.ActualWidth + credits_link.ActualWidth +
                           report_problem_link.ActualWidth + 220);
            Canvas.SetTop(debug_log_link, 222);

            Content = canvas;
        }
Пример #5
0
        private void CreateAbout()
        {
            Label version = new Label()
            {
                Markup = string.Format("<span font_size='small' fgcolor='white'>version {0}</span>",
                                       Controller.RunningVersion),
                Xalign = 0,
                Xpad   = 300
            };

            this.updates = new Label()
            {
                Markup = "<span font_size='small' fgcolor='#729fcf'>Checking for updates...</span>",
                Xalign = 0,
                Xpad   = 300
            };

            Label copyright = new Label()
            {
                Markup = "<span font_size='small' fgcolor='white'>" +
                         "Copyright © 2010–" + DateTime.Now.Year + " " +
                         "Hylke Bons and others." +
                         "</span>",
                Xalign = 0,
                Xpad   = 300
            };

            Label license = new Label()
            {
                LineWrap     = true,
                LineWrapMode = Pango.WrapMode.Word,
                Markup       = "<span font_size='small' fgcolor='white'>" +
                               "SparkleShare Open Source software. You are free to use, modify, " +
                               "and redistribute it under the GNU General Public License version 3 or later." +
                               "</span>",
                WidthRequest = 330,
                Wrap         = true,
                Xalign       = 0,
                Xpad         = 300,
            };

            VBox layout_vertical = new VBox(false, 0)
            {
                BorderWidth   = 0,
                HeightRequest = 260,
                WidthRequest  = 640
            };

            HBox links_layout = new HBox(false, 6);

            SparkleLink website_link        = new SparkleLink("Website", Controller.WebsiteLinkAddress);
            SparkleLink credits_link        = new SparkleLink("Credits", Controller.CreditsLinkAddress);
            SparkleLink report_problem_link = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);

            links_layout.PackStart(new Label(""), false, false, 143);
            links_layout.PackStart(website_link, false, false, 9);
            links_layout.PackStart(credits_link, false, false, 9);
            links_layout.PackStart(report_problem_link, false, false, 9);

            layout_vertical.PackStart(new Label(""), false, false, 42);
            layout_vertical.PackStart(version, false, false, 0);
            layout_vertical.PackStart(this.updates, false, false, 0);
            layout_vertical.PackStart(copyright, false, false, 9);
            layout_vertical.PackStart(license, false, false, 0);
            layout_vertical.PackStart(links_layout, false, false, 12);

            Add(layout_vertical);
        }
Пример #6
0
        private void CreateAbout()
        {
            Image image = new Image () {
                Width  = 640,
                Height = 260
            };

            image.Source = SparkleUIHelpers.GetImageSource ("about");

            Label version = new Label () {
                Content    = "version " + Controller.RunningVersion,
                FontSize   = 11,
                Foreground = new SolidColorBrush (Colors.White)
            };

            this.updates = new Label () {
                Content    = "Checking for updates...",
                FontSize   = 11,
                Foreground = new SolidColorBrush (Color.FromRgb (135, 178, 227))
            };

            TextBlock credits = new TextBlock () {
                FontSize     = 11,
                Foreground   = new SolidColorBrush (Colors.White),
                Text         = "Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" +
                    "\n" +
                    "SparkleShare is Open Source software. You are free to use, modify, " +
                    "and redistribute it under the GNU General Public License version 3 or later.",
                TextWrapping = TextWrapping.Wrap,
                Width        = 318
            };

            SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
            SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
            SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);

            Canvas canvas = new Canvas ();

            canvas.Children.Add (image);
            Canvas.SetLeft (image, 0);
            Canvas.SetTop (image, 0);

            canvas.Children.Add (version);
            Canvas.SetLeft (version, 289);
            Canvas.SetTop (version, 92);

            canvas.Children.Add (this.updates);
            Canvas.SetLeft (this.updates, 289);
            Canvas.SetTop (this.updates, 109);

            canvas.Children.Add (credits);
            Canvas.SetLeft (credits, 294);
            Canvas.SetTop (credits, 142);

            canvas.Children.Add (website_link);
            Canvas.SetLeft (website_link, 289);
            Canvas.SetTop (website_link, 222);

            canvas.Children.Add (credits_link);
            Canvas.SetLeft (credits_link, 289 + website_link.ActualWidth + 60);
            Canvas.SetTop (credits_link, 222);

            canvas.Children.Add (report_problem_link);
            Canvas.SetLeft (report_problem_link, 289 + website_link.ActualWidth + credits_link.ActualWidth + 115);
            Canvas.SetTop (report_problem_link, 222);

            Content = canvas;
        }
Пример #7
0
        private void CreateAbout()
        {
            Gdk.RGBA white = new Gdk.RGBA();
            white.Parse("#ffffff");

            Gdk.RGBA highlight = new Gdk.RGBA();
            highlight.Parse("#a8bbcf");

            Pango.FontDescription font = StyleContext.GetFont(StateFlags.Normal);
            font.Size = 9 * 1024;

            CssProvider css_provider = new CssProvider();
            string      image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine();

            css_provider.LoadFromData("GtkWindow {" +
                                      "background-image: url('" + image_path + "');" +
                                      "background-repeat: no-repeat;" +
                                      "background-position: left bottom;" +
                                      "}");

            StyleContext.AddProvider(css_provider, 800);

            VBox layout_vertical = new VBox(false, 0);
            HBox links_layout    = new HBox(false, 16);


            Label version = new Label()
            {
                Text   = "version " + Controller.RunningVersion,
                Xalign = 0, Xpad = 0
            };

            version.OverrideFont(font);
            version.OverrideColor(StateFlags.Normal, white);


            this.updates = new Label("Checking for updates…")
            {
                Xalign = 0, Xpad = 0
            };

            this.updates.OverrideFont(font);
            this.updates.OverrideColor(StateFlags.Normal, highlight);


            Label copyright = new Label()
            {
                Markup = string.Format("Copyright © 2010–{0} Hylke Bons and others.", DateTime.Now.Year),
                Xalign = 0, Xpad = 0
            };

            copyright.OverrideFont(font);
            copyright.OverrideColor(StateFlags.Normal, white);


            TextView   license        = new TextView();
            TextBuffer license_buffer = license.Buffer;

            license.WrapMode  = WrapMode.Word;
            license.Sensitive = false;

            license_buffer.Text = "SparkleShare is Open Source and you’re free to use, change, " +
                                  "and share it under the GNU GPLv3.";

            license.OverrideBackgroundColor(StateFlags.Normal, new Gdk.RGBA()
            {
                Alpha = 0
            });
            license.OverrideFont(font);
            license.OverrideColor(StateFlags.Normal, white);


            SparkleLink website_link        = new SparkleLink("Website", Controller.WebsiteLinkAddress);
            SparkleLink credits_link        = new SparkleLink("Credits", Controller.CreditsLinkAddress);
            SparkleLink report_problem_link = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
            SparkleLink debug_log_link      = new SparkleLink("Debug log", Controller.DebugLogLinkAddress);


            layout_vertical.PackStart(new Label(""), true, true, 0);
            layout_vertical.PackStart(version, false, false, 0);
            layout_vertical.PackStart(this.updates, false, false, 0);
            layout_vertical.PackStart(copyright, false, false, 6);
            layout_vertical.PackStart(license, false, false, 6);
            layout_vertical.PackStart(links_layout, false, false, 16);

            links_layout.PackStart(website_link, false, false, 0);
            links_layout.PackStart(credits_link, false, false, 0);
            links_layout.PackStart(report_problem_link, false, false, 0);
            links_layout.PackStart(debug_log_link, false, false, 0);

            HBox layout_horizontal = new HBox(false, 0);

            layout_horizontal.PackStart(new Label(""), false, false, 149);
            layout_horizontal.PackStart(layout_vertical, false, false, 0);

            Add(layout_horizontal);
        }
Пример #8
0
        private ScrolledWindow CreateEventLog()
        {
            List <SparkleCommit> commits = new List <SparkleCommit> ();

            foreach (SparkleRepo repo in SparkleShare.Controller.Repositories) {

                // Get commits from the repository
                if (repo.LocalPath.Equals (LocalPath)) {

                    commits = repo.GetCommits (25);
                    break;

                }

            }

            List <ActivityDay> activity_days = new List <ActivityDay> ();

            foreach (SparkleCommit commit in commits) {

                bool commit_inserted = false;
                foreach (ActivityDay stored_activity_day in activity_days) {

                    if (stored_activity_day.DateTime.Year  == commit.DateTime.Year &&
                        stored_activity_day.DateTime.Month == commit.DateTime.Month &&
                        stored_activity_day.DateTime.Day   == commit.DateTime.Day) {

                        stored_activity_day.Add (commit);
                        commit_inserted = true;
                        break;

                    }

                }

                if (!commit_inserted) {

                        ActivityDay activity_day = new ActivityDay (commit.DateTime);
                        activity_day.Add (commit);
                        activity_days.Add (activity_day);

                }

            }

            VBox layout_vertical = new VBox (false, 0);

            if (SparkleShare.Controller.Repositories.Find (
                    delegate (SparkleRepo r)
                        { return r.LocalPath.Equals (LocalPath) && r.HasUnsyncedChanges; }
                ) != null) {

                string title = _("This folder has unsynced changes");
                string text  = _("We will sync these once we’re connected again");

                SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text);

                layout_vertical.PackStart (infobar, false, false, 0);

            } else {

                if (SparkleShare.Controller.Repositories.Find (
                    delegate (SparkleRepo r)
                        { return r.LocalPath.Equals (LocalPath) && r.HasUnsyncedChanges; }
                    ) != null) {

                        string title = _("Could not sync with the remote folder");
                        string text  = _("Is the you and the server online?");

                        SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text);

                        layout_vertical.PackStart (infobar, false, false, 0);

                }

            }

            TreeView tree_view = new TreeView ();
            Gdk.Color background_color = tree_view.Style.Base (StateType.Normal);

            foreach (ActivityDay activity_day in activity_days) {

                EventBox box = new EventBox ();

                Label date_label = new Label ("") {
                    UseMarkup = true,
                    Xalign = 0,
                    Xpad = 9,
                    Ypad = 9
                };

                    DateTime today = DateTime.Now;
                    DateTime yesterday = DateTime.Now.AddDays (-1);

                    if (today.Day   == activity_day.DateTime.Day &&
                        today.Month == activity_day.DateTime.Month &&
                        today.Year  == activity_day.DateTime.Year) {

                        date_label.Markup = "<b>Today</b>";

                    } else if (yesterday.Day   == activity_day.DateTime.Day &&
                               yesterday.Month == activity_day.DateTime.Month &&
                               yesterday.Year  == activity_day.DateTime.Year) {

                        date_label.Markup = "<b>Yesterday</b>";

                    } else {

                        date_label.Markup = "<b>" + activity_day.DateTime.ToString ("ddd MMM d, yyyy") + "</b>";

                    }

                box.Add (date_label);
                layout_vertical.PackStart (box, false, false, 0);

                Gdk.Color color = Style.Foreground (StateType.Insensitive);
                string secondary_text_color = SparkleUIHelpers.GdkColorToHex (color);

                foreach (SparkleCommit change_set in activity_day) {

                    VBox log_entry     = new VBox (false, 0);
                    VBox deleted_files = new VBox (false, 0);
                    VBox edited_files  = new VBox (false, 0);
                    VBox added_files   = new VBox (false, 0);
                    VBox moved_files   = new VBox (false, 0);

                    foreach (string file_path in change_set.Edited) {

                        SparkleLink link = new SparkleLink (file_path,
                            SparkleHelpers.CombineMore (LocalPath, file_path));

                        link.ModifyBg (StateType.Normal, background_color);

                        edited_files.PackStart (link, false, false, 0);

                    }

                    foreach (string file_path in change_set.Added) {

                        SparkleLink link = new SparkleLink (file_path,
                            SparkleHelpers.CombineMore (LocalPath, file_path));

                        link.ModifyBg (StateType.Normal, background_color);

                        added_files.PackStart (link, false, false, 0);

                    }

                    foreach (string file_path in change_set.Deleted) {

                        SparkleLink link = new SparkleLink (file_path,
                            SparkleHelpers.CombineMore (LocalPath, file_path));

                        link.ModifyBg (StateType.Normal, background_color);

                        deleted_files.PackStart (link, false, false, 0);

                    }

                    for (int i = 0; i < change_set.MovedFrom.Count; i++) {

                        SparkleLink from_link = new SparkleLink (change_set.MovedFrom [i],
                            SparkleHelpers.CombineMore (LocalPath, change_set.MovedFrom [i]));

                        from_link.ModifyBg (StateType.Normal, background_color);

                        SparkleLink to_link = new SparkleLink (change_set.MovedTo [i],
                            SparkleHelpers.CombineMore (LocalPath, change_set.MovedTo [i]));

                        to_link.ModifyBg (StateType.Normal, background_color);

                        Label to_label = new Label ("<span fgcolor='" + secondary_text_color +"'>" +
                                                    "<small>to</small></span> ") {
                            UseMarkup = true,
                            Xalign = 0
                        };

                        HBox link_wrapper = new HBox (false, 0);
                        link_wrapper.PackStart (to_label, false, false, 0);
                        link_wrapper.PackStart (to_link, true, true, 0);

                        moved_files.PackStart (from_link, false, false, 0);
                        moved_files.PackStart (link_wrapper, false, false, 0);

                        if (change_set.MovedFrom.Count > 1)
                            moved_files.PackStart (new Label (""), false, false, 0);

                    }

                    HBox change_set_info_hbox = new HBox (false, 0);

                        Label change_set_info = new Label ("<b>" + change_set.UserName + "</b>") {
                            UseMarkup = true,
                            Xalign = 0
                        };

                        Label change_set_time = new Label ("<span fgcolor='" + secondary_text_color +"'><small>" +
                                                           change_set.DateTime.ToString ("H:mm") +
                                                           "</small></span>") {
                            Xalign = 1,
                            UseMarkup = true
                        };

                    change_set_info_hbox.PackStart (change_set_info, true, true, 0);
                    change_set_info_hbox.PackStart (change_set_time, false, false, 0);

                    log_entry.PackStart (change_set_info_hbox, false, false, 0);

                    if (edited_files.Children.Length > 0) {

                        Label edited_label = new Label ("\n<span fgcolor='" + secondary_text_color +"'><small>" +
                                                        _("Edited") +
                                                        "</small></span>") {
                            UseMarkup = true,
                            Xalign = 0
                        };

                        log_entry.PackStart (edited_label, false, false, 0);
                        log_entry.PackStart (edited_files, false, false, 0);

                    }

                    if (added_files.Children.Length > 0) {

                        Label added_label = new Label ("\n<span fgcolor='" + secondary_text_color +"'><small>" +
                                                        _("Added") +
                                                        "</small></span>") {
                            UseMarkup = true,
                            Xalign = 0
                        };

                        log_entry.PackStart (added_label, false, false, 0);
                        log_entry.PackStart (added_files, false, false, 0);

                    }

                    if (deleted_files.Children.Length > 0) {

                        Label deleted_label = new Label ("\n<span fgcolor='" + secondary_text_color +"'><small>" +
                                                        _("Deleted") +
                                                        "</small></span>") {
                            UseMarkup = true,
                            Xalign = 0
                        };

                        log_entry.PackStart (deleted_label, false, false, 0);
                        log_entry.PackStart (deleted_files, false, false, 0);

                    }

                    if (moved_files.Children.Length > 0) {

                        Label moved_label = new Label ("\n<span fgcolor='" + secondary_text_color +"'><small>" +
                                                         _("Moved") +
                                                         "</small></span>") {
                            UseMarkup = true,
                            Xalign = 0
                        };

                        log_entry.PackStart (moved_label, false, false, 0);
                        log_entry.PackStart (moved_files, false, false, 0);

                    }

                    HBox hbox = new HBox (false, 0);

                    Image avatar = new Image (SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32)) {
                        Yalign = 0
                    };

                    hbox.PackStart (avatar, false, false, 18);

                        VBox vbox = new VBox (false, 0);
                        vbox.PackStart (log_entry, false, false, 0);

                    hbox.PackStart (vbox, true, true, 0);
                    hbox.PackStart (new Label (""), false, false, 12);

                    layout_vertical.PackStart (hbox, false, false, 18);

                }

                layout_vertical.PackStart (new Label (""), false, false, 3);

            }

            ScrolledWindow = new ScrolledWindow ();

                EventBox wrapper = new EventBox ();
                wrapper.ModifyBg (StateType.Normal, background_color);
                wrapper.Add (layout_vertical);

            ScrolledWindow.AddWithViewport (wrapper);
            (ScrolledWindow.Child as Viewport).ShadowType = ShadowType.None;

            return ScrolledWindow;
        }
Пример #9
0
        private void CreateAbout()
        {
            Label version = new Label () {
                Markup = string.Format ("<span font_size='small' fgcolor='white'>version {0}</span>",
                    Controller.RunningVersion),
                Xalign = 0,
                Xpad = 300
            };

            this.updates = new Label () {
                Markup = "<span font_size='small' fgcolor='#729fcf'>Checking for updates...</span>",
                Xalign = 0,
                Xpad = 300
            };

            Label copyright = new Label () {
                Markup = "<span font_size='small' fgcolor='white'>" +
                         "Copyright © 2010–" + DateTime.Now.Year + " " +
                         "Hylke Bons and others." +
                         "</span>",
                Xalign = 0,
                Xpad   = 300
            };

            Label license = new Label () {
                LineWrap     = true,
                LineWrapMode = Pango.WrapMode.Word,
                Markup       = "<span font_size='small' fgcolor='white'>" +
                               "SparkleShare Open Source software. You are free to use, modify, " +
                               "and redistribute it under the GNU General Public License version 3 or later." +
                               "</span>",
                WidthRequest = 330,
                Wrap         = true,
                Xalign       = 0,
                Xpad         = 300,
            };

            VBox layout_vertical = new VBox (false, 0) {
                BorderWidth   = 0,
                HeightRequest = 260,
                WidthRequest  = 640
            };

            HBox links_layout = new HBox (false, 6);

            SparkleLink website_link        = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
            SparkleLink credits_link        = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
            SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
            SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);

            links_layout.PackStart (new Label (""), false, false, 143);
            links_layout.PackStart (website_link, false, false, 9);
            links_layout.PackStart (credits_link, false, false, 9);
            links_layout.PackStart (report_problem_link, false, false, 9);
            links_layout.PackStart (debug_log_link, false, false, 9);

            layout_vertical.PackStart (new Label (""), false, false, 42);
            layout_vertical.PackStart (version, false, false, 0);
            layout_vertical.PackStart (this.updates, false, false, 0);
            layout_vertical.PackStart (copyright, false, false, 9);
            layout_vertical.PackStart (license, false, false, 0);
            layout_vertical.PackStart (links_layout, false, false, 12);

            Add (layout_vertical);
        }
Пример #10
0
        private void CreateAbout()
        {
            string about_image_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "Pixmaps", "about.png");

            this.about_image = new NSImage(about_image_path)
            {
                Size = new SizeF(640, 260)
            };

            this.about_image_view = new NSImageView()
            {
                Image = this.about_image,
                Frame = new RectangleF(0, 0, 640, 260)
            };

            this.version_text_field = new SparkleLabel("version " + Controller.RunningVersion, NSTextAlignment.Left)
            {
                DrawsBackground = false,
                Frame           = new RectangleF(295, 140, 318, 22),
                TextColor       = NSColor.White,
                Font            = NSFontManager.SharedFontManager.FontWithFamily(
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
            };

            this.updates_text_field = new SparkleLabel("Checking for updates...", NSTextAlignment.Left)
            {
                DrawsBackground = false,
                Frame           = new RectangleF(295, Frame.Height - 232, 318, 98),
                TextColor       = NSColor.FromCalibratedRgba(1.0f, 1.0f, 1.0f, 0.5f),
                Font            = NSFontManager.SharedFontManager.FontWithFamily(
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
            };

            this.credits_text_field = new SparkleLabel(
                @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." +
                "\n" +
                "\n" +
                "SparkleShare is Open Source software. You are free to use, modify, and redistribute it " +
                "under the GNU General Public License version 3 or later.", NSTextAlignment.Left)
            {
                DrawsBackground = false,
                Frame           = new RectangleF(295, Frame.Height - 260, 318, 98),
                TextColor       = NSColor.White,
                Font            = NSFontManager.SharedFontManager.FontWithFamily(
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11),
            };

            this.website_link       = new SparkleLink("Website", Controller.WebsiteLinkAddress);
            this.website_link.Frame = new RectangleF(new PointF(295, 25), this.website_link.Frame.Size);

            this.credits_link       = new SparkleLink("Credits", Controller.CreditsLinkAddress);
            this.credits_link.Frame = new RectangleF(
                new PointF(this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                this.credits_link.Frame.Size);

            this.report_problem_link       = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
            this.report_problem_link.Frame = new RectangleF(
                new PointF(this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                this.report_problem_link.Frame.Size);

            this.debug_log_link       = new SparkleLink("Debug log", Controller.DebugLogLinkAddress);
            this.debug_log_link.Frame = new RectangleF(
                new PointF(this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
                this.debug_log_link.Frame.Size);

            ContentView.AddSubview(this.about_image_view);
            ContentView.AddSubview(this.version_text_field);
            ContentView.AddSubview(this.updates_text_field);
            ContentView.AddSubview(this.credits_text_field);
            ContentView.AddSubview(this.website_link);
            ContentView.AddSubview(this.credits_link);
            ContentView.AddSubview(this.report_problem_link);
            ContentView.AddSubview(this.debug_log_link);
        }
Пример #11
0
        public SparkleAbout()
            : base()
        {
            using (var a = new NSAutoreleasePool ())
            {
                SetFrame (new RectangleF (0, 0, 640, 281), true);
                Center ();

                Delegate    = new SparkleAboutDelegate ();
                StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
                Title       = "About SparkleShare";
                MaxSize     = new SizeF (640, 281);
                MinSize     = new SizeF (640, 281);
                HasShadow   = true;
                BackingType = NSBackingStore.Buffered;

                this.website_link       = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
                this.website_link.Frame = new RectangleF (new PointF (295, 25), this.website_link.Frame.Size);

                this.credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
                this.credits_link.Frame = new RectangleF (
                    new PointF (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                    this.credits_link.Frame.Size);

                this.report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
                this.report_problem_link.Frame = new RectangleF (
                    new PointF (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                    this.report_problem_link.Frame.Size);

                this.hidden_close_button = new NSButton () {
                    Frame                     = new RectangleF (0, 0, 0, 0),
                    KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                    KeyEquivalent             = "w"
                };

                this.hidden_close_button.Activated += delegate {
                    Controller.WindowClosed ();
                };

                ContentView.AddSubview (this.hidden_close_button);

                CreateAbout ();

                ContentView.AddSubview (this.website_link);
                ContentView.AddSubview (this.credits_link);
                ContentView.AddSubview (this.report_problem_link);
            }

            Controller.HideWindowEvent += delegate {
                using (var a = new NSAutoreleasePool ())
                {
                    InvokeOnMainThread (delegate {
                        PerformClose (this);
                    });
                }
            };

            Controller.ShowWindowEvent += delegate {
                using (var a = new NSAutoreleasePool ())
                {
                    InvokeOnMainThread (delegate {
                        OrderFrontRegardless ();
                    });
                }
            };

            Controller.NewVersionEvent += delegate (string new_version) {
                using (var a = new NSAutoreleasePool ())
                {
                    InvokeOnMainThread (delegate {
                        this.updates_text_field.StringValue = "A newer version (" + new_version + ") is available!";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };

            Controller.VersionUpToDateEvent += delegate {
                using (var a = new NSAutoreleasePool ())
                {
                    InvokeOnMainThread (delegate {
                        this.updates_text_field.StringValue = "You are running the latest version.";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };

            Controller.CheckingForNewVersionEvent += delegate {
                using (var a = new NSAutoreleasePool ())
                {
                    InvokeOnMainThread (delegate {
                        this.updates_text_field.StringValue = "Checking for updates...";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };
        }
Пример #12
0
        private void CreateAbout ()
        {
            Gdk.RGBA white = new Gdk.RGBA ();
            white.Parse ("#ffffff");

            Gdk.RGBA highlight = new Gdk.RGBA ();
            highlight.Parse ("#a8bbcf");

            Pango.FontDescription font = StyleContext.GetFont (StateFlags.Normal);
            font.Size = 9 * 1024;

            CssProvider css_provider = new CssProvider ();
            string image_path        = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine ();

            css_provider.LoadFromData ("GtkWindow {" +
                "background-image: url('" + image_path + "');" +
                "background-repeat: no-repeat;" +
                "background-position: left bottom;" +
                "}");
            
            StyleContext.AddProvider (css_provider, 800);

            VBox layout_vertical = new VBox (false, 0);            
            HBox links_layout = new HBox (false, 16);


            Label version = new Label () {
                Text   = "version " + Controller.RunningVersion,
                Xalign = 0, Xpad   = 0
            };

            version.OverrideFont (font);
            version.OverrideColor (StateFlags.Normal, white);


            this.updates = new Label ("Checking for updates…") {
                Xalign = 0, Xpad = 0
            };

            this.updates.OverrideFont (font);
            this.updates.OverrideColor (StateFlags.Normal, highlight);


            Label copyright = new Label () {
                Markup = string.Format ("Copyright © 2010–{0} Hylke Bons and others.", DateTime.Now.Year),
                Xalign = 0, Xpad   = 0
            };

            copyright.OverrideFont (font);
            copyright.OverrideColor (StateFlags.Normal, white);


            TextView license          = new TextView ();
            TextBuffer license_buffer = license.Buffer;
            license.WrapMode          = WrapMode.Word;
            license.Sensitive         = false;

            license_buffer.Text = "SparkleShare is Open Source and you’re free to use, change, " +
                "and share it under the GNU GPLv3.";

            license.OverrideBackgroundColor (StateFlags.Normal, new Gdk.RGBA () { Alpha = 0 });
            license.OverrideFont (font);
            license.OverrideColor (StateFlags.Normal, white);

            
            SparkleLink website_link        = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
            SparkleLink credits_link        = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
            SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
            SparkleLink debug_log_link      = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);


            layout_vertical.PackStart (new Label (""), true, true, 0);            
            layout_vertical.PackStart (version, false, false, 0);
            layout_vertical.PackStart (this.updates, false, false, 0);
            layout_vertical.PackStart (copyright, false, false, 6);
            layout_vertical.PackStart (license, false, false, 6);
            layout_vertical.PackStart (links_layout, false, false, 16);

            links_layout.PackStart (website_link, false, false, 0);
            links_layout.PackStart (credits_link, false, false, 0);
            links_layout.PackStart (report_problem_link, false, false, 0);
            links_layout.PackStart (debug_log_link, false, false, 0);
            
            HBox layout_horizontal = new HBox (false, 0);
            layout_horizontal.PackStart (new Label (""), false, false, 149);
            layout_horizontal.PackStart (layout_vertical, false, false, 0);

            Add (layout_horizontal);
        }
Пример #13
0
        private void CreateAbout()
        {
            string about_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "about.png");
            this.about_image        = new NSImage (about_image_path) { Size = new SizeF (640, 260) };

            this.about_image_view = new NSImageView () {
                Image = this.about_image,
                Frame = new RectangleF (0, 0, 640, 260)
            };

            this.version_text_field = new SparkleLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) {
                DrawsBackground = false,
                Frame           = new RectangleF (295, 140, 318, 22),
                TextColor       = NSColor.White,
                Font            = NSFontManager.SharedFontManager.FontWithFamily (
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
            };

            this.updates_text_field = new SparkleLabel ("Checking for updates...", NSTextAlignment.Left) {
                DrawsBackground = false,
                Frame           = new RectangleF (295, Frame.Height - 232, 318, 98),
                TextColor       = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f),
                Font            = NSFontManager.SharedFontManager.FontWithFamily (
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
            };

            this.credits_text_field = new SparkleLabel (
                @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." +
                "\n" +
                "\n" +
                "SparkleShare is Open Source software. You are free to use, modify, and redistribute it " +
                "under the GNU General Public License version 3 or later.", NSTextAlignment.Left) {

                DrawsBackground = false,
                Frame           = new RectangleF (295, Frame.Height - 260, 318, 98),
                TextColor       = NSColor.White,
                Font            = NSFontManager.SharedFontManager.FontWithFamily (
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11),
            };

            this.website_link       = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
            this.website_link.Frame = new RectangleF (new PointF (295, 25), this.website_link.Frame.Size);

            this.credits_link       = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
            this.credits_link.Frame = new RectangleF (
                new PointF (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                this.credits_link.Frame.Size);

            this.report_problem_link       = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
            this.report_problem_link.Frame = new RectangleF (
                new PointF (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                this.report_problem_link.Frame.Size);

            this.debug_log_link       = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
            this.debug_log_link.Frame = new RectangleF (
                new PointF (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
                this.debug_log_link.Frame.Size);

            ContentView.AddSubview (this.about_image_view);
            ContentView.AddSubview (this.version_text_field);
            ContentView.AddSubview (this.updates_text_field);
            ContentView.AddSubview (this.credits_text_field);
            ContentView.AddSubview (this.website_link);
            ContentView.AddSubview (this.credits_link);
            ContentView.AddSubview (this.report_problem_link);
            ContentView.AddSubview (this.debug_log_link);
        }