windows eventlog: Include images
This commit is contained in:
parent
f12118f51b
commit
5c683189f4
|
@ -347,8 +347,7 @@ namespace SparkleShare {
|
|||
existing_set.Deleted.AddRange (change_set.Deleted);
|
||||
existing_set.MovedFrom.AddRange (change_set.MovedFrom);
|
||||
existing_set.MovedTo.AddRange (change_set.MovedTo);
|
||||
existing_set.Notes.AddRange (change_set.Notes);
|
||||
|
||||
|
||||
existing_set.Added = existing_set.Added.Distinct ().ToList ();
|
||||
existing_set.Edited = existing_set.Edited.Distinct ().ToList ();
|
||||
existing_set.Deleted = existing_set.Deleted.Distinct ().ToList ();
|
||||
|
@ -401,42 +400,42 @@ namespace SparkleShare {
|
|||
event_entry += "<dd>Did something magical</dd>";
|
||||
|
||||
} else {
|
||||
if (change_set.Edited.Count > 0) {
|
||||
foreach (string file_path in change_set.Edited) {
|
||||
event_entry += "<dd class='document edited'>";
|
||||
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
);
|
||||
|
||||
event_entry += "</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
if (change_set.Added.Count > 0) {
|
||||
foreach (string file_path in change_set.Added) {
|
||||
event_entry += "<dd class='document added'>";
|
||||
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
);
|
||||
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
);
|
||||
event_entry += "</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
if (change_set.Edited.Count > 0) {
|
||||
foreach (string file_path in change_set.Edited) {
|
||||
event_entry += "<dd class='document edited'>";
|
||||
|
||||
event_entry += "</dd>";
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
);
|
||||
|
||||
event_entry += "</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
if (change_set.Deleted.Count > 0) {
|
||||
foreach (string file_path in change_set.Deleted) {
|
||||
event_entry += "<dd class='document deleted'>";
|
||||
event_entry += "<dd class='document deleted'>";
|
||||
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
);
|
||||
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
);
|
||||
|
||||
event_entry += "</dd>";
|
||||
event_entry += "</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,8 +443,8 @@ namespace SparkleShare {
|
|||
int i = 0;
|
||||
foreach (string file_path in change_set.MovedFrom) {
|
||||
string to_file_path = change_set.MovedTo [i];
|
||||
|
||||
event_entry += "<dd class='document moved'>";
|
||||
event_entry += "<dd class='document moved'>";
|
||||
|
||||
event_entry += FormatBreadCrumbs (
|
||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder),
|
||||
file_path
|
||||
|
@ -464,39 +463,14 @@ namespace SparkleShare {
|
|||
}
|
||||
}
|
||||
|
||||
string comments = "";
|
||||
comments = "<div class=\"comments\">";
|
||||
|
||||
if (change_set.Notes != null) {
|
||||
change_set.Notes.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp)));
|
||||
|
||||
foreach (SparkleNote note in change_set.Notes) {
|
||||
|
||||
string note_avatar = GetAvatar (note.User.Email, 48);
|
||||
if (File.Exists (note_avatar))
|
||||
note_avatar = "file://" + note_avatar;
|
||||
else
|
||||
note_avatar = "<!-- $no-buddy-icon-background-image -->";
|
||||
|
||||
comments += "<div class=\"comment-text\">" +
|
||||
"<p class=\"comment-author\"" +
|
||||
" style=\"background-image: url('" + note_avatar + "');\">" +
|
||||
note.User.Name + "</p>" +
|
||||
note.Body +
|
||||
"</div>";
|
||||
}
|
||||
}
|
||||
|
||||
comments += "</div>";
|
||||
|
||||
string change_set_avatar = GetAvatar (change_set.User.Email, 48);
|
||||
|
||||
if (File.Exists (change_set_avatar)) {
|
||||
change_set_avatar = "file://" + change_set_avatar.Replace ("\\", "/");
|
||||
|
||||
} else {
|
||||
change_set_avatar = Path.Combine ("<!-- $pixmaps-path -->",
|
||||
AssignAvatar (change_set.User.Email)); // TODO
|
||||
change_set_avatar = "file://<!-- $pixmaps-path -->/" +
|
||||
AssignAvatar (change_set.User.Email);
|
||||
}
|
||||
|
||||
event_entry += "</dl>";
|
||||
|
@ -514,8 +488,7 @@ namespace SparkleShare {
|
|||
.Replace ("<!-- $event-folder -->", change_set.Folder)
|
||||
.Replace ("<!-- $event-url -->", change_set.Url.ToString ())
|
||||
.Replace ("<!-- $event-revision -->", change_set.Revision)
|
||||
.Replace ("<!-- $event-folder-color -->", AssignColor (change_set.Folder))
|
||||
.Replace ("<!-- $event-comments -->", comments);
|
||||
.Replace ("<!-- $event-folder-color -->", AssignColor (change_set.Folder));
|
||||
}
|
||||
|
||||
string day_entry = "";
|
||||
|
@ -1071,9 +1044,10 @@ namespace SparkleShare {
|
|||
|
||||
this.fetcher.Dispose ();
|
||||
this.fetcher = null;
|
||||
|
||||
if (Directory.Exists (tmp_path))
|
||||
Directory.Delete (tmp_path, true);
|
||||
|
||||
// TODO: only remove stale repos
|
||||
//if (Directory.Exists (tmp_path))
|
||||
// Directory.Delete (tmp_path, true);
|
||||
};
|
||||
|
||||
this.fetcher.Failed += delegate {
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
/*
|
||||
* AssemblyInfo.cs
|
||||
*
|
||||
* This is free software. See COPYING for details.
|
||||
*/
|
||||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons (hylkebons@gmail.com)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see (http://www.gnu.org/licenses/).
|
||||
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Threading;
|
||||
|
@ -24,7 +25,8 @@ using System.Windows;
|
|||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using Shapes = System.Windows.Shapes;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
|
@ -55,7 +57,8 @@ namespace SparkleShare {
|
|||
Background = new SolidColorBrush (Color.FromRgb (240, 240, 240));
|
||||
AllowsTransparency = false;
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
|
||||
|
||||
WriteOutImages ();
|
||||
|
||||
Label size_label = new Label () {
|
||||
Content = "Size:",
|
||||
|
@ -81,16 +84,15 @@ namespace SparkleShare {
|
|||
history_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
||||
Rect history_label_rect = new Rect (history_label.DesiredSize);
|
||||
|
||||
Rectangle line = new Rectangle () {
|
||||
Width = Width,
|
||||
Shapes.Rectangle line = new Shapes.Rectangle () {
|
||||
Width = Width,
|
||||
Height = 1,
|
||||
Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
|
||||
Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
|
||||
};
|
||||
|
||||
this.web_browser = new WebBrowser () {
|
||||
Width = Width - 7,
|
||||
Height = Height - 36 - 12,
|
||||
|
||||
Height = Height - 36 - 12
|
||||
};
|
||||
|
||||
this.web_browser.ObjectForScripting = new SparkleScriptingObject ();;
|
||||
|
@ -100,7 +102,7 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
this.canvas = new Canvas ();
|
||||
Content = this.canvas;
|
||||
Content = this.canvas;
|
||||
|
||||
this.canvas.Children.Add (size_label);
|
||||
Canvas.SetLeft (size_label, 24);
|
||||
|
@ -119,11 +121,10 @@ namespace SparkleShare {
|
|||
Canvas.SetLeft (this.history_label_value, 130 + history_label_rect.Width);
|
||||
Canvas.SetTop (this.history_label_value, 4);
|
||||
|
||||
|
||||
this.canvas.Children.Add (line);
|
||||
Canvas.SetLeft (line, 0);
|
||||
Canvas.SetTop (line, 35);
|
||||
|
||||
|
||||
|
||||
Closing += Close;
|
||||
|
||||
|
@ -232,9 +233,12 @@ namespace SparkleShare {
|
|||
if (html == null)
|
||||
html = Controller.HTML;
|
||||
|
||||
string pixmaps_path = Path.Combine (
|
||||
SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps");
|
||||
|
||||
pixmaps_path = pixmaps_path.Replace ("\\", "/");
|
||||
|
||||
html = html.Replace ("<a href=", "<a class='windows' href=");
|
||||
|
||||
html = html.Replace ("<!-- $body-font-family -->", "sans-serif");
|
||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
||||
html = html.Replace ("<!-- $body-font-size -->", "13.4px");
|
||||
|
@ -243,25 +247,21 @@ namespace SparkleShare {
|
|||
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
|
||||
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
||||
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
||||
// html = html.Replace ("<!-- $pixmaps-path -->",
|
||||
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||
// "Pixmaps"));
|
||||
|
||||
// html = html.Replace ("<!-- $document-added-background-image -->",
|
||||
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||
// "Pixmaps", "document-added-12.png"));
|
||||
|
||||
// html = html.Replace ("<!-- $document-deleted-background-image -->",
|
||||
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||
// "Pixmaps", "document-deleted-12.png"));
|
||||
|
||||
//html = html.Replace ("<!-- $document-edited-background-image -->",
|
||||
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||
//"Pixmaps", "document-edited-12.png"));
|
||||
|
||||
//html = html.Replace ("<!-- $document-moved-background-image -->",
|
||||
// "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath,
|
||||
//"Pixmaps", "document-moved-12.png"));
|
||||
|
||||
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
|
||||
|
||||
html = html.Replace ("<!-- $document-added-background-image -->",
|
||||
pixmaps_path + "/document-added-12.png");
|
||||
|
||||
html = html.Replace ("<!-- $document-edited-background-image -->",
|
||||
pixmaps_path + "/document-edited-12.png");
|
||||
|
||||
html = html.Replace ("<!-- $document-deleted-background-image -->",
|
||||
pixmaps_path + "/document-deleted-12.png");
|
||||
|
||||
html = html.Replace ("<!-- $document-moved-background-image -->",
|
||||
pixmaps_path + "/document-moved-12.png");
|
||||
|
||||
|
||||
Dispatcher.Invoke ((Action) delegate {
|
||||
//if (this.progress_indicator.Superview == ContentView) TODO: spinner
|
||||
|
@ -280,6 +280,48 @@ namespace SparkleShare {
|
|||
thread.Start ();
|
||||
}
|
||||
|
||||
|
||||
private void WriteOutImages ()
|
||||
{
|
||||
string pixmaps_path = Path.Combine (
|
||||
SparkleLib.SparkleConfig.DefaultConfig.TmpPath,
|
||||
"Pixmaps"
|
||||
);
|
||||
|
||||
if (!Directory.Exists (pixmaps_path))
|
||||
Directory.CreateDirectory (pixmaps_path);
|
||||
|
||||
char [] letters = new char [] {'a', 'b', 'c',
|
||||
'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'};
|
||||
|
||||
foreach (char letter in letters) {
|
||||
BitmapSource image = SparkleUIHelpers.GetImageSource ("avatar-" + letter);
|
||||
string file_path = Path.Combine (pixmaps_path, "avatar-" + letter + ".png");
|
||||
|
||||
using (FileStream stream = new FileStream (file_path, FileMode.Create))
|
||||
{
|
||||
BitmapEncoder encoder = new PngBitmapEncoder ();
|
||||
encoder.Frames.Add (BitmapFrame.Create (image));
|
||||
encoder.Save (stream);
|
||||
}
|
||||
}
|
||||
|
||||
string [] actions = new string [] {"added",
|
||||
"deleted", "edited", "moved"};
|
||||
|
||||
foreach (string action in actions) {
|
||||
BitmapSource image = SparkleUIHelpers.GetImageSource ("document-" + action + "-12");
|
||||
string file_path = Path.Combine (pixmaps_path, "document-" + action + "-12.png");
|
||||
|
||||
using (FileStream stream = new FileStream (file_path, FileMode.Create))
|
||||
{
|
||||
BitmapEncoder encoder = new PngBitmapEncoder ();
|
||||
encoder.Frames.Add (BitmapFrame.Create (image));
|
||||
encoder.Save (stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Close (object sender, CancelEventArgs args)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue