[longomatch] Factorize messages and file chooser dialog using helpers
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Factorize messages and file chooser dialog using helpers
- Date: Tue, 16 Apr 2013 19:50:05 +0000 (UTC)
commit e8670abd4379d62a9fb1f714ffcf8f0ef4d8aa49
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Apr 15 13:32:42 2013 +0200
Factorize messages and file chooser dialog using helpers
LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs | 18 ++--
LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic | 1 +
LongoMatch.GUI/Gui/Base/TemplatesEditorBase.cs | 16 +--
LongoMatch.GUI/Gui/Component/ButtonsWidget.cs | 4 +-
.../Gui/Component/CategoriesTemplateEditor.cs | 16 ++-
LongoMatch.GUI/Gui/Component/CategoryProperties.cs | 13 +--
LongoMatch.GUI/Gui/Component/DrawingToolBox.cs | 2 +-
.../Gui/Component/ProjectDetailsWidget.cs | 4 +-
LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs | 20 ++--
.../Gui/Component/TimelineLabelsWidget.cs | 2 +-
LongoMatch.GUI/Gui/Dialog/DrawingTool.cs | 24 ++---
LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs | 5 +-
LongoMatch.GUI/Gui/Dialog/ProjectsManager.cs | 23 ++--
LongoMatch.GUI/Gui/Dialog/TemplatesManager.cs | 26 ++---
LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs | 16 +--
LongoMatch.GUI/Gui/GUIToolkit.cs | 102 +++++-------------
LongoMatch.GUI/Gui/Helpers/FileChooserHelper.cs | 120 +++++++++++++++++++++
LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs | 107 ++++++++++++++++++
LongoMatch.GUI/Gui/{Helpers.cs => Helpers/Misc.cs} | 4 +-
LongoMatch.GUI/Gui/MainWindow.cs | 4 +-
LongoMatch.GUI/Gui/Popup/MessagePopup.cs | 54 ----------
LongoMatch.GUI/Gui/TreeView/CategoriesTreeView.cs | 2 +-
LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs | 16 +--
LongoMatch.GUI/LongoMatch.GUI.mdp | 6 +-
LongoMatch.GUI/Makefile.am | 5 +-
.../gtk-gui/LongoMatch.Gui.MainWindow.cs | 2 +-
LongoMatch.GUI/gtk-gui/gui.stetic | 3 +-
LongoMatch.GUI/gtk-gui/objects.xml | 34 +++---
LongoMatch.Plugins/CSVExporter.cs | 3 +-
LongoMatch.Services/Services/PlaylistManager.cs | 4 +-
LongoMatch.Services/Services/ProjectsManager.cs | 6 +-
LongoMatch/Main.cs | 9 +-
32 files changed, 387 insertions(+), 284 deletions(-)
---
diff --git a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
index f14b62a..b02d3ac 100644
--- a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
@@ -16,12 +16,14 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
using System;
+using Gtk;
using System.Collections.Generic;
using LongoMatch.Interfaces;
using LongoMatch.Common;
using LongoMatch.Store;
using LongoMatch.Store.Templates;
+using Image = LongoMatch.Common.Image;
namespace LongoMatch.Interfaces.GUI
{
@@ -31,20 +33,20 @@ namespace LongoMatch.Interfaces.GUI
Version Version {get;}
/* Messages */
- void InfoMessage(string message);
- void WarningMessage(string message);
- void ErrorMessage(string message);
- bool QuestionMessage(string message, string title);
+ void InfoMessage(string message, Widget parent=null);
+ void WarningMessage(string message, Widget parent=null);
+ void ErrorMessage(string message, Widget parent=null);
+ bool QuestionMessage(string message, string title, Widget parent=null);
/* Files/Folders IO */
string SaveFile(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter);
+ string filterName, string[] extensionFilter);
string OpenFile(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter);
+ string filterName, string[] extensionFilter);
List<string> OpenFiles(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter);
+ string filterName, string[] extensionFilter);
string SelectFolder(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter);
+ string filterName, string[] extensionFilter);
IBusyDialog BusyDialog(string message);
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index 073240c..42c6384 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -6,6 +6,7 @@
</configuration>
<import>
<widget-library name="../../bin/LongoMatch.Multimedia.dll" />
+ <widget-library name="../../bin/LongoMatch.dll" />
<widget-library name="../../bin/LongoMatch.GUI.Multimedia.dll" internal="true" />
</import>
<widget class="Gtk.Window" id="LongoMatch.Gui.VolumeWindow" design-size="31 204">
diff --git a/LongoMatch.GUI/Gui/Base/TemplatesEditorBase.cs b/LongoMatch.GUI/Gui/Base/TemplatesEditorBase.cs
index 6e3f3a6..5fcc0a1 100644
--- a/LongoMatch.GUI/Gui/Base/TemplatesEditorBase.cs
+++ b/LongoMatch.GUI/Gui/Base/TemplatesEditorBase.cs
@@ -24,6 +24,7 @@ using Mono.Unix;
using LongoMatch.Gui.Dialog;
using LongoMatch.Interfaces;
using LongoMatch.Store;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Base
@@ -178,21 +179,14 @@ namespace LongoMatch.Gui.Base
dialog.Text = Catalog.GetString("New template");
if(dialog.Run() == (int)ResponseType.Ok) {
if(dialog.Text == "")
- MessagePopup.PopupMessage(dialog, MessageType.Error,
- Catalog.GetString("The template name is
void."));
+ MessagesHelpers.ErrorMessage (dialog, Catalog.GetString("The template
name is void."));
else if(provider.Exists(dialog.Text)) {
- MessageDialog md = new MessageDialog(null,
- DialogFlags.Modal,
- MessageType.Question,
- Gtk.ButtonsType.YesNo,
- Catalog.GetString("The template
already exists. " +
- "Do you want to
overwrite it ?")
- );
- if(md.Run() == (int)ResponseType.Yes){
+ var msg = Catalog.GetString("The template already exists. " +
+ "Do you want to overwrite it ?");
+ if (MessagesHelpers.QuestionMessage (this, msg)) {
Template.Name = dialog.Text;
provider.Update (Template);
}
- md.Destroy();
}
else {
Template.Name = dialog.Text;
diff --git a/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs b/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs
index 158d20a..c3905d4 100644
--- a/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ButtonsWidget.cs
@@ -95,14 +95,14 @@ namespace LongoMatch.Gui.Component
var c = new Color();
Color.Parse("black", ref c);
l.ModifyFg(StateType.Normal, c);
- l.ModifyFg(StateType.Prelight, Helpers.ToGdkColor(cat.Color));
+ l.ModifyFg(StateType.Prelight, Helpers.Misc.ToGdkColor(cat.Color));
l.Markup = cat.Name;
b.Add(l);
b.Name = i.ToString();
b.Clicked += new EventHandler(OnButtonClicked);
b.CanFocus = false;
- b.ModifyBg(StateType.Normal, Helpers.ToGdkColor(cat.Color));
+ b.ModifyBg(StateType.Normal, Helpers.Misc.ToGdkColor(cat.Color));
l.Show();
b.Show();
diff --git a/LongoMatch.GUI/Gui/Component/CategoriesTemplateEditor.cs
b/LongoMatch.GUI/Gui/Component/CategoriesTemplateEditor.cs
index e9895cd..9969615 100644
--- a/LongoMatch.GUI/Gui/Component/CategoriesTemplateEditor.cs
+++ b/LongoMatch.GUI/Gui/Component/CategoriesTemplateEditor.cs
@@ -24,6 +24,7 @@ using LongoMatch.Gui.Dialog;
using LongoMatch.Interfaces;
using LongoMatch.Store;
using LongoMatch.Store.Templates;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Component
{
@@ -75,24 +76,21 @@ namespace LongoMatch.Gui.Component
protected override void RemoveSelected (){
if(Project != null) {
- MessageDialog dialog = new
MessageDialog((Gtk.Window)this.Toplevel,DialogFlags.Modal,MessageType.Question,
- ButtonsType.YesNo,true,
- Catalog.GetString("You are about to
delete a category and all the plays added to this category. Do you want to proceed?"));
- if(dialog.Run() == (int)ResponseType.Yes) {
+ var msg = Catalog.GetString("You are about to delete a category and all the
plays added to this category. Do you want to proceed?");
+ if (MessagesHelpers.QuestionMessage (this, msg)) {
try {
foreach(var cat in selected)
Project.RemoveCategory (cat);
} catch {
- MessagePopup.PopupMessage(this,MessageType.Warning,
- Catalog.GetString("A template needs
at least one category"));
+ MessagesHelpers.WarningMessage (this,
+ Catalog.GetString("A template
needs at least one category"));
}
}
- dialog.Destroy();
} else {
foreach(Category cat in selected) {
if(template.Count == 1) {
- MessagePopup.PopupMessage(this,MessageType.Warning,
- Catalog.GetString("A template needs
at least one category"));
+ MessagesHelpers.WarningMessage (this,
+ Catalog.GetString("A template
needs at least one category"));
} else
template.Remove(cat);
}
diff --git a/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
b/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
index 82a4ef3..e7d68c0 100644
--- a/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
+++ b/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
@@ -30,6 +30,7 @@ using LongoMatch.Store;
using LongoMatch.Store.Templates;
using LongoMatch.Gui.Dialog;
using LongoMatch.Gui.Popup;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Component
{
@@ -127,7 +128,7 @@ namespace LongoMatch.Gui.Component
leadtimebutton.Value = cat.Start.Seconds;
lagtimebutton.Value = cat.Stop.Seconds;
- colorbutton1.Color = Helpers.ToGdkColor(cat.Color);
+ colorbutton1.Color = Helpers.Misc.ToGdkColor(cat.Color);
sortmethodcombobox.Active = (int)cat.SortMethod;
if(cat.HotKey.Defined)
@@ -176,7 +177,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnColorbutton1ColorSet(object sender, System.EventArgs e)
{
if(cat != null)
- cat.Color= Helpers.ToDrawingColor(colorbutton1.Color);
+ cat.Color= Helpers.Misc.ToDrawingColor(colorbutton1.Color);
}
protected virtual void OnLeadTimeChanged(object sender, System.EventArgs e)
@@ -206,11 +207,11 @@ namespace LongoMatch.Gui.Component
protected virtual void OnSubcategoriesDeleted (List<ISubCategory> subcats)
{
if (Project != null) {
- int ret = MessagePopup.PopupMessage(this, MessageType.Question,
- Catalog.GetString("If you delete this
subcategory you will loose" +
- "all the tags associated with it. Do
you want to proceed?"));
- if (ret == (int)ResponseType.No)
+ var msg = Catalog.GetString("If you delete this subcategory you will loose" +
+ "all the tags associated with it. Do you want to
proceed?");
+ if (!MessagesHelpers.QuestionMessage (this, msg)) {
return;
+ }
Project.DeleteSubcategoryTags(Category, subcats);
}
Category.SubCategories.RemoveAll(s => subcats.Contains(s));
diff --git a/LongoMatch.GUI/Gui/Component/DrawingToolBox.cs b/LongoMatch.GUI/Gui/Component/DrawingToolBox.cs
index c641567..d080758 100644
--- a/LongoMatch.GUI/Gui/Component/DrawingToolBox.cs
+++ b/LongoMatch.GUI/Gui/Component/DrawingToolBox.cs
@@ -123,7 +123,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnColorbuttonColorSet(object sender, System.EventArgs e)
{
if(ColorChanged != null)
- ColorChanged(Helpers.ToDrawingColor(colorbutton.Color));
+ ColorChanged(Helpers.Misc.ToDrawingColor(colorbutton.Color));
}
}
}
diff --git a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
index c79fe94..c7dd792 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
@@ -30,6 +30,7 @@ using LongoMatch.Store;
using LongoMatch.Store.Templates;
using LongoMatch.Video.Utils;
using Mono.Unix;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Component
{
@@ -517,8 +518,7 @@ namespace LongoMatch.Gui.Component
fileEntry.Text = filename;
}
catch(Exception ex) {
- MessagePopup.PopupMessage(this, MessageType.Error,
- ex.Message);
+ MessagesHelpers.ErrorMessage (this, ex.Message);
}
finally {
md.Destroy();
diff --git a/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
b/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
index 58df7e4..ef47ccf 100644
--- a/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
+++ b/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
@@ -30,6 +30,7 @@ using LongoMatch.Gui.Dialog;
using LongoMatch.Interfaces;
using LongoMatch.Store;
using LongoMatch.Store.Templates;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Component
{
@@ -115,7 +116,7 @@ namespace LongoMatch.Gui.Component
{
Pixbuf shield;
- shield = Helpers.OpenImage((Gtk.Window)this.Toplevel);
+ shield = Helpers.Misc.OpenImage((Gtk.Window)this.Toplevel);
if (shield != null) {
Image img = new Image(shield);
img.Scale();
@@ -146,27 +147,24 @@ namespace LongoMatch.Gui.Component
protected override void RemoveSelected (){
if(Project != null) {
- MessageDialog dialog = new
MessageDialog((Gtk.Window)this.Toplevel,DialogFlags.Modal,MessageType.Question,
- ButtonsType.YesNo,true,
- Catalog.GetString("You are about to
delete a player and all " +
- "its tags. Do you want to
proceed?"));
- if(dialog.Run() == (int)ResponseType.Yes) {
+ var msg = Catalog.GetString("You are about to delete a player and all " +
+ "its tags. Do you want to proceed?");
+ if (MessagesHelpers.QuestionMessage (this, msg)) {
try {
foreach(var player in selected)
Project.RemovePlayer (template, player);
} catch {
- MessagePopup.PopupMessage(this,MessageType.Warning,
- Catalog.GetString("A template needs
at least one category"));
+ MessagesHelpers.WarningMessage (this,
+ Catalog.GetString("A template
needs at least one category"));
}
}
- dialog.Destroy();
} else {
try {
foreach(var player in selected)
Template.Remove(player);
} catch {
- MessagePopup.PopupMessage(this,MessageType.Warning,
- Catalog.GetString("A template needs at
least one category"));
+ MessagesHelpers.WarningMessage (this,
+ Catalog.GetString("A template needs
at least one category"));
}
}
base.RemoveSelected();
diff --git a/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
b/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
index 71f78a6..79cbd9c 100644
--- a/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/TimelineLabelsWidget.cs
@@ -58,7 +58,7 @@ namespace LongoMatch.Gui.Component
set {
labelsDict.Clear();
foreach (Category cat in value)
- labelsDict.Add(new Label(cat.Name), Helpers.ToGdkColor(cat.Color));
+ labelsDict.Add(new Label(cat.Name),
Helpers.Misc.ToGdkColor(cat.Color));
}
}
diff --git a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
index a8c2f27..33e93b7 100644
--- a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
@@ -25,6 +25,7 @@ using Image = LongoMatch.Common.Image;
using LongoMatch.Common;
using LongoMatch.Gui.Component;
using LongoMatch.Store;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Dialog
{
@@ -71,7 +72,7 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnDrawingtoolbox1ColorChanged(System.Drawing.Color color)
{
- drawingwidget1.LineColor = Helpers.ToGdkColor(color);
+ drawingwidget1.LineColor = Helpers.Misc.ToGdkColor(color);
}
protected virtual void OnDrawingtoolbox1VisibilityChanged(bool visible)
@@ -97,27 +98,14 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
{
string filename;
- FileChooserDialog fChooser;
- FileFilter filter = new FileFilter();
- filter.Name = "PNG Images";
- filter.AddPattern("*.png");
-
- fChooser = new FileChooserDialog(Catalog.GetString("Save File as..."),
- (Gtk.Window)this.Toplevel,
- FileChooserAction.Save,
- "gtk-cancel",ResponseType.Cancel,
- "gtk-save",ResponseType.Accept);
- fChooser.SetCurrentFolder(Config.SnapshotsDir);
- fChooser.Filter = filter;
- fChooser.DoOverwriteConfirmation = true;
-
- if(fChooser.Run() == (int)ResponseType.Accept) {
- filename = fChooser.Filename;
+
+ filename = FileChooserHelper.OpenFile (this, Catalog.GetString("Save File as..."),
+ null, Config.SnapshotsDir, "PNG Images", new
string[] {"*.png"});
+ if (filename != null) {
if(System.IO.Path.GetExtension(filename) != "png")
filename += ".png";
drawingwidget1.SaveAll(filename);
}
- fChooser.Destroy();
}
protected virtual void OnSavetoprojectbuttonClicked(object sender, System.EventArgs e)
diff --git a/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs b/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs
index d8dfdaa..1ed3600 100644
--- a/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs
@@ -28,6 +28,7 @@ using Mono.Unix;
using LongoMatch.Store;
using LongoMatch.Store.Templates;
using LongoMatch.Interfaces;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Dialog
{
@@ -65,8 +66,8 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnHotKeyChanged(HotKey prevHotKey, Category category) {
if(hkList.Contains(category.HotKey)) {
- MessagePopup.PopupMessage(this,MessageType.Warning,
- Catalog.GetString("This hotkey is already in
use."));
+ MessagesHelpers.WarningMessage(this,
+ Catalog.GetString("This hotkey is already in
use."));
category.HotKey=prevHotKey;
timenodeproperties2.Category = category; //Update Gui
}
diff --git a/LongoMatch.GUI/Gui/Dialog/ProjectsManager.cs b/LongoMatch.GUI/Gui/Dialog/ProjectsManager.cs
index d8b0c08..c1ad76b 100644
--- a/LongoMatch.GUI/Gui/Dialog/ProjectsManager.cs
+++ b/LongoMatch.GUI/Gui/Dialog/ProjectsManager.cs
@@ -25,6 +25,7 @@ using LongoMatch.Common;
using LongoMatch.Interfaces;
using LongoMatch.Store;
using Mono.Unix;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Dialog
{
@@ -65,14 +66,11 @@ namespace LongoMatch.Gui.Dialog
}
private void PromptToSaveEditedProject() {
- MessageDialog md = new MessageDialog((Window)this.Toplevel,DialogFlags.Modal,
- MessageType.Question, ButtonsType.YesNo,
- Catalog.GetString("The Project has been edited,
do you want to save the changes?"));
- if(md.Run() == (int)ResponseType.Yes) {
+ var msg = Catalog.GetString("The Project has been edited, do you want to save the
changes?");
+ if (MessagesHelpers.QuestionMessage (this, msg)) {
SaveProject();
projectdetails.Edited=false;
}
- md.Destroy();
}
private void SaveProject() {
@@ -97,21 +95,16 @@ namespace LongoMatch.Gui.Dialog
foreach(ProjectDescription selectedProject in selectedProjects) {
if(openedProject != null &&
selectedProject.File.FilePath ==
openedProject.Description.File.FilePath) {
- MessagePopup.PopupMessage(this, MessageType.Warning,
+ MessagesHelpers.WarningMessage (this,
Catalog.GetString("This Project is actually
in use.")+"\n"+
Catalog.GetString("Close it first to allow
its removal from the database"));
continue;
}
- MessageDialog md = new MessageDialog(this,DialogFlags.Modal,
- MessageType.Question,
- ButtonsType.YesNo,
- Catalog.GetString("Do you really want to
delete:")+
- "\n"+selectedProject.Title);
- if(md.Run()== (int)ResponseType.Yes) {
+ var msg = Catalog.GetString("Do you really want to delete:") + "\n" +
selectedProject.Title;
+ if (MessagesHelpers.QuestionMessage (this, msg)) {
DB.RemoveProject(selectedProject.UUID);
deletedProjects.Add(selectedProject);
}
- md.Destroy();
}
projectlistwidget1.RemoveProjects(deletedProjects);
Clear();
@@ -162,8 +155,8 @@ namespace LongoMatch.Gui.Dialog
if(openedProject != null &&
project.File.FilePath == openedProject.Description.File.FilePath) {
- MessagePopup.PopupMessage(this, MessageType.Warning,
- Catalog.GetString("The Project you are trying to
load is actually in use.")+"\n" +Catalog.GetString("Close it first to edit it"));
+ MessagesHelpers.WarningMessage (this,
+ Catalog.GetString("The Project you are trying
to load is actually in use.")+"\n" +Catalog.GetString("Close it first to edit it"));
Clear();
}
else {
diff --git a/LongoMatch.GUI/Gui/Dialog/TemplatesManager.cs b/LongoMatch.GUI/Gui/Dialog/TemplatesManager.cs
index 63a622b..247e6e7 100644
--- a/LongoMatch.GUI/Gui/Dialog/TemplatesManager.cs
+++ b/LongoMatch.GUI/Gui/Dialog/TemplatesManager.cs
@@ -27,6 +27,7 @@ using Mono.Unix;
using LongoMatch.Interfaces;
using LongoMatch.Gui.Component;
using LongoMatch.Store.Templates;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Dialog
{
@@ -135,8 +136,7 @@ namespace LongoMatch.Gui.Dialog
templatesWidget.Template = templatesProvider.Load(templateName);
} catch (Exception e) {
Log.Exception (e);
- MessagePopup.PopupMessage(this.Toplevel, Gtk.MessageType.Error,
- "Error loading template");
+ MessagesHelpers.ErrorMessage(this, "Error loading template");
}
}
@@ -163,15 +163,11 @@ namespace LongoMatch.Gui.Dialog
}
private void PromptForSave() {
- MessageDialog mes = new MessageDialog(this,DialogFlags.Modal,
- MessageType.Question,
- ButtonsType.YesNo,
- Catalog.GetString("The template has been
modified. " +
- "Do you want to save it? "));
- if(mes.Run() == (int)ResponseType.Yes) {
+ var msg = Catalog.GetString("The template has been modified. " +
+ "Do you want to save it? ");
+ if (MessagesHelpers.QuestionMessage (this, msg)) {
SaveTemplate();
}
- mes.Destroy();
}
protected override void OnSavebuttonClicked(object sender, System.EventArgs e)
@@ -201,13 +197,13 @@ namespace LongoMatch.Gui.Dialog
name = ed.Text;
count = ed.Count;
if(name == "") {
- MessagePopup.PopupMessage(ed, MessageType.Warning,
- Catalog.GetString("You cannot create a
template with a void name"));
+ MessagesHelpers.WarningMessage(ed,
+ Catalog.GetString("You cannot create a
template with a void name"));
ed.Destroy();
return;
} else if (templatesProvider.Exists(name)) {
- MessagePopup.PopupMessage(ed, MessageType.Warning,
- Catalog.GetString("A template with this
name already exists"));
+ MessagesHelpers.WarningMessage (ed,
+ Catalog.GetString("A template with
this name already exists"));
ed.Destroy();
return;
}
@@ -227,8 +223,8 @@ namespace LongoMatch.Gui.Dialog
protected override void OnDeletebuttonClicked(object sender, System.EventArgs e)
{
if(templateName =="default") {
- MessagePopup.PopupMessage(this,MessageType.Warning,
- Catalog.GetString("You can't delete the 'default'
template"));
+ MessagesHelpers.WarningMessage(this,
+ Catalog.GetString("You can't delete the
'default' template"));
return;
}
diff --git a/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
b/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
index 1287991..707c471 100644
--- a/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/VideoConversionTool.cs
@@ -25,6 +25,7 @@ using LongoMatch.Gui;
using LongoMatch.Video.Utils;
using LongoMatch.Store;
using LongoMatch.Interfaces;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Dialog
{
@@ -79,8 +80,9 @@ namespace LongoMatch.Gui.Dialog
protected void OnAddbuttonClicked (object sender, System.EventArgs e)
{
- List<string> paths = GUIToolkit.Instance.OpenFiles (Catalog.GetString("Add file"),
null,
- Config.HomeDir, null, null);
+ var msg = Catalog.GetString("Add file");
+ List<string> paths = FileChooserHelper.OpenFiles (this, msg, null,
+ Config.HomeDir, null, null);
List<string> errors = new List<string>();
foreach (string path in paths) {
try {
@@ -113,11 +115,11 @@ namespace LongoMatch.Gui.Dialog
protected void OnOpenbuttonClicked (object sender, System.EventArgs e)
{
- string path = GUIToolkit.Instance.SaveFile (Catalog.GetString("Add file"),
- "NewVideo.mp4",
- Config.VideosDir,
- Catalog.GetString("MP4 file"),
- "mp4");
+ string path = FileChooserHelper.SaveFile(this, Catalog.GetString("Add file"),
+ "NewVideo.mp4",
+ Config.VideosDir,
+ Catalog.GetString("MP4 file"),
+ new string[] {"mp4"});
outputFile = System.IO.Path.ChangeExtension (path, "mp4");
filelabel.Text = outputFile;
CheckStatus ();
diff --git a/LongoMatch.GUI/Gui/GUIToolkit.cs b/LongoMatch.GUI/Gui/GUIToolkit.cs
index a2efde4..b5368c4 100644
--- a/LongoMatch.GUI/Gui/GUIToolkit.cs
+++ b/LongoMatch.GUI/Gui/GUIToolkit.cs
@@ -32,6 +32,7 @@ using LongoMatch.Gui.Popup;
using LongoMatch.Store;
using LongoMatch.Store.Templates;
using LongoMatch.Video.Utils;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui
{
@@ -65,53 +66,56 @@ namespace LongoMatch.Gui
set;
}
- public void InfoMessage(string message) {
- MessagePopup.PopupMessage(mainWindow as Gtk.Widget, Gtk.MessageType.Info, message);
+ public void InfoMessage(string message, Widget parent=null) {
+ if (parent == null)
+ parent = mainWindow as Widget;
+ MessagesHelpers.InfoMessage(parent, message);
}
- public void ErrorMessage(string message) {
- MessagePopup.PopupMessage(mainWindow as Gtk.Widget, Gtk.MessageType.Error, message);
+ public void ErrorMessage(string message, Widget parent=null) {
+ if (parent == null)
+ parent = mainWindow as Widget;
+ MessagesHelpers.ErrorMessage (parent, message);
}
- public void WarningMessage(string message) {
- MessagePopup.PopupMessage(mainWindow as Gtk.Widget, Gtk.MessageType.Warning, message);
+ public void WarningMessage(string message, Widget parent=null) {
+ if (parent == null)
+ parent = mainWindow as Widget;
+ MessagesHelpers.WarningMessage (parent, message);
}
- public bool QuestionMessage(string question, string title) {
- MessageDialog md = new MessageDialog(mainWindow as Gtk.Window, DialogFlags.Modal,
- MessageType.Question, Gtk.ButtonsType.YesNo, question);
- md.Icon = Stetic.IconLoader.LoadIcon(mainWindow as Widget, "longomatch",
IconSize.Button);
- var res = md.Run();
- md.Destroy();
- return (res == (int)ResponseType.Yes);
+ public bool QuestionMessage(string question, string title, Widget parent=null) {
+ if (parent == null)
+ parent = mainWindow as Widget;
+ return MessagesHelpers.QuestionMessage (parent, question, title);
}
public string SaveFile(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter)
+ string filterName, string[] extensionFilter)
{
- return FileChooser(title, defaultName, defaultFolder, filterName,
- extensionFilter, FileChooserAction.Save);
+ return FileChooserHelper.SaveFile (mainWindow as Widget, title, defaultName,
+ defaultFolder, filterName, extensionFilter);
}
public string SelectFolder(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter)
+ string filterName, string[] extensionFilter)
{
- return FileChooser(title, defaultName, defaultFolder, filterName,
- extensionFilter, FileChooserAction.SelectFolder);
+ return FileChooserHelper.SelectFolder (mainWindow as Widget, title, defaultName,
+ defaultFolder, filterName, extensionFilter);
}
public string OpenFile(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter)
+ string filterName, string[] extensionFilter)
{
- return FileChooser(title, defaultName, defaultFolder, filterName,
- extensionFilter, FileChooserAction.Open);
+ return FileChooserHelper.OpenFile (mainWindow as Widget, title, defaultName,
+ defaultFolder, filterName, extensionFilter);
}
public List<string> OpenFiles(string title, string defaultName, string defaultFolder,
- string filterName, string extensionFilter)
+ string filterName, string[] extensionFilter)
{
- return MultiFileChooser(title, defaultName, defaultFolder, filterName,
- extensionFilter, FileChooserAction.Open);
+ return FileChooserHelper.OpenFiles (mainWindow as Widget, title, defaultName,
+ defaultFolder, filterName, extensionFilter);
}
public List<EditionJob> ConfigureRenderingJob (IPlayList playlist)
@@ -339,54 +343,6 @@ namespace LongoMatch.Gui
return project;
}
- string FileChooser(string title, string defaultName,
- string defaultFolder, string filterName, string extensionFilter,
- FileChooserAction action)
- {
- List<string> res = MultiFileChooser(title, defaultName, defaultFolder, filterName,
- extensionFilter, action, false);
- if (res.Count == 1)
- return res[0];
- return null;
- }
-
- List<string> MultiFileChooser(string title, string defaultName,
- string defaultFolder, string filterName, string
extensionFilter,
- FileChooserAction action, bool allowMultiple=true)
- {
- FileChooserDialog fChooser;
- FileFilter filter;
- string button;
- List<string> path;
-
- if (action == FileChooserAction.Save)
- button = "gtk-save";
- else
- button = "gtk-open";
-
- fChooser = new FileChooserDialog(title, mainWindow as Gtk.Window, action,
- "gtk-cancel",ResponseType.Cancel, button, ResponseType.Accept);
-
- fChooser.SelectMultiple = allowMultiple;
- if (defaultFolder != null)
- fChooser.SetCurrentFolder(defaultFolder);
- if (defaultName != null)
- fChooser.CurrentName = defaultName;
- if (filterName != null) {
- filter = new FileFilter();
- filter.Name = filterName;
- filter.AddPattern(extensionFilter);
- fChooser.Filter = filter;
- }
-
- if (fChooser.Run() != (int)ResponseType.Accept)
- path = new List<string>();
- else
- path = new List<string>(fChooser.Filenames);
-
- fChooser.Destroy();
- return path;
- }
}
}
diff --git a/LongoMatch.GUI/Gui/Helpers/FileChooserHelper.cs b/LongoMatch.GUI/Gui/Helpers/FileChooserHelper.cs
new file mode 100644
index 0000000..8ccc461
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Helpers/FileChooserHelper.cs
@@ -0,0 +1,120 @@
+//
+// Copyright (C) 2013 Andoni Morales Alastruey
+//
+// 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 2 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, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using Gtk;
+using System.Collections.Generic;
+
+namespace LongoMatch.Gui.Helpers
+{
+ public class FileChooserHelper
+ {
+
+ static public string SaveFile (Widget parent, string title, string defaultName,
+ string defaultFolder, string filterName,
+ string[] extensions)
+ {
+ return FileChooser(parent, title, defaultName, defaultFolder, filterName,
+ extensions, FileChooserAction.Save);
+ }
+
+ static public string SelectFolder (Widget parent, string title, string defaultName,
+ string defaultFolder, string filterName,
+ string[] extensions)
+ {
+ return FileChooser(parent, title, defaultName, defaultFolder, filterName,
+ extensions, FileChooserAction.SelectFolder);
+ }
+
+ static public string OpenFile (Widget parent, string title, string defaultName,
+ string defaultFolder, string filterName,
+ string[] extensions)
+ {
+ return FileChooser(parent, title, defaultName, defaultFolder, filterName,
+ extensions, FileChooserAction.Open);
+ }
+
+ static public List<string> OpenFiles(Widget parent, string title, string defaultName,
+ string defaultFolder, string filterName,
+ string[] extensions)
+ {
+ return MultiFileChooser (parent, title, defaultName, defaultFolder, filterName,
+ extensions, FileChooserAction.Open);
+ }
+
+ static string FileChooser(Widget parent, string title, string defaultName,
+ string defaultFolder, string filterName,
+ string[] extensions, FileChooserAction action)
+ {
+ List<string> res = MultiFileChooser(parent, title, defaultName, defaultFolder,
+ filterName, extensions, action, false);
+ if (res.Count == 1)
+ return res[0];
+ return null;
+ }
+
+ static List<string> MultiFileChooser(Widget parent, string title, string defaultName,
+ string defaultFolder, string filterName,
+ string[] extensions, FileChooserAction action,
+ bool allowMultiple=true)
+ {
+ Window toplevel;
+ FileChooserDialog fChooser;
+ FileFilter filter;
+ string button;
+ List<string> path;
+
+ if (action == FileChooserAction.Save)
+ button = "gtk-save";
+ else
+ button = "gtk-open";
+
+ if(parent != null)
+ toplevel = parent.Toplevel as Window;
+ else
+ toplevel = null;
+
+ fChooser = new FileChooserDialog(title, toplevel, action,
+ "gtk-cancel",ResponseType.Cancel, button, ResponseType.Accept);
+
+ fChooser.SelectMultiple = allowMultiple;
+ if (defaultFolder != null)
+ fChooser.SetCurrentFolder(defaultFolder);
+ if (defaultName != null)
+ fChooser.CurrentName = defaultName;
+ if (filterName != null) {
+ filter = new FileFilter();
+ filter.Name = filterName;
+ if (extensions != null) {
+ foreach (string p in extensions) {
+ filter.AddPattern(p);
+ }
+ }
+ fChooser.Filter = filter;
+ }
+
+ if (fChooser.Run() != (int)ResponseType.Accept)
+ path = new List<string>();
+ else
+ path = new List<string>(fChooser.Filenames);
+
+ fChooser.Destroy();
+ return path;
+ }
+ }
+}
+
diff --git a/LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs b/LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs
new file mode 100644
index 0000000..0b1ada7
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs
@@ -0,0 +1,107 @@
+
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// 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 2 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, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using Gtk;
+using Dialog = Gtk.Dialog;
+using Mono.Unix;
+
+namespace LongoMatch.Gui.Helpers
+{
+
+ public class MessagesHelpers
+ {
+
+ static public void InfoMessage (Widget parent, string message) {
+ PopupMessage(parent, MessageType.Info, message);
+ }
+
+ static public void ErrorMessage(Widget parent, string message) {
+ PopupMessage(parent, MessageType.Error, message);
+ }
+
+ static public void WarningMessage(Widget parent, string message) {
+ PopupMessage(parent, Gtk.MessageType.Warning, message);
+ }
+
+ static public bool QuestionMessage(Widget parent, string question, string title=null) {
+ Window toplevel;
+
+ if(parent != null)
+ toplevel = parent.Toplevel as Window;
+ else
+ toplevel = null;
+
+ MessageDialog md = new MessageDialog(toplevel, DialogFlags.Modal,
+ MessageType.Question, ButtonsType.YesNo,
+ question);
+
+ md.Icon = Stetic.IconLoader.LoadIcon(md, "longomatch", IconSize.Button);
+ md.Title = title;
+ var res = md.Run();
+ md.Destroy();
+ return (res == (int)ResponseType.Yes);
+ }
+
+ public static int PopupMessage(Widget sender,MessageType type, String errorMessage) {
+ Window toplevel;
+ int ret;
+
+ if(sender != null)
+ toplevel = (Window)sender.Toplevel;
+ else
+ toplevel = null;
+
+ MessageDialog md = new MessageDialog(toplevel,
+ DialogFlags.Modal,
+ type,
+ ButtonsType.Ok,
+ errorMessage);
+ md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
+ ret = md.Run();
+ md.Destroy();
+ return ret;
+ }
+
+ static public string QueryMessage (Widget sender, string key, string title=null) {
+ string ret = null;
+ Window parent;
+
+ if(sender != null)
+ parent = (Window)sender.Toplevel;
+ else
+ parent = null;
+
+ Label label = new Label(key);
+ Entry entry = new Entry("");
+ Gtk.Dialog dialog = new Gtk.Dialog (title, parent, DialogFlags.DestroyWithParent);
+ dialog.Modal = true;
+ dialog.AddButton (Catalog.GetString("Add"), ResponseType.Ok);
+ dialog.VBox.PackStart (label, false, false, 0);
+ dialog.VBox.PackStart (entry, true, true, 0);
+ dialog.Icon = Stetic.IconLoader.LoadIcon (parent, "longomatch", Gtk.IconSize.Dialog);
+ dialog.ShowAll ();
+ if (dialog.Run () == (int) ResponseType.Ok) {
+ ret = entry.Text;
+ }
+ dialog.Destroy ();
+ return ret;
+ }
+ }
+}
diff --git a/LongoMatch.GUI/Gui/Helpers.cs b/LongoMatch.GUI/Gui/Helpers/Misc.cs
similarity index 98%
rename from LongoMatch.GUI/Gui/Helpers.cs
rename to LongoMatch.GUI/Gui/Helpers/Misc.cs
index 9483ce9..983b715 100644
--- a/LongoMatch.GUI/Gui/Helpers.cs
+++ b/LongoMatch.GUI/Gui/Helpers/Misc.cs
@@ -23,9 +23,9 @@ using Mono.Unix;
using LongoMatch.Common;
-namespace LongoMatch.Gui
+namespace LongoMatch.Gui.Helpers
{
- public class Helpers
+ public class Misc
{
public static FileFilter GetFileFilter() {
FileFilter filter = new FileFilter();
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index 9b39799..2920360 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -35,6 +35,7 @@ using LongoMatch.Store;
using LongoMatch.Store.Templates;
using LongoMatch.Video.Common;
using LongoMatch.Gui.Component;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui
@@ -733,7 +734,7 @@ namespace LongoMatch.Gui
protected virtual void OnMultimediaError(object o, string message)
{
- MessagePopup.PopupMessage(this, MessageType.Error,
+ MessagesHelpers.ErrorMessage (this,
Catalog.GetString("The following error happened and" +
" the current project will be closed:")+"\n" + message);
EmitCloseOpenedProject(true);
@@ -926,7 +927,6 @@ namespace LongoMatch.Gui
if (KeyPressed != null)
KeyPressed(sender, key, modifier);
}
-
#endregion
}
}
diff --git a/LongoMatch.GUI/Gui/TreeView/CategoriesTreeView.cs
b/LongoMatch.GUI/Gui/TreeView/CategoriesTreeView.cs
index 33ab0d8..8611e8c 100644
--- a/LongoMatch.GUI/Gui/TreeView/CategoriesTreeView.cs
+++ b/LongoMatch.GUI/Gui/TreeView/CategoriesTreeView.cs
@@ -116,7 +116,7 @@ namespace LongoMatch.Gui.Component
{
Category tNode = (Category) model.GetValue(iter, 0);
- (cell as Gtk.CellRendererText).CellBackgroundGdk = Helpers.ToGdkColor(tNode.Color);
+ (cell as Gtk.CellRendererText).CellBackgroundGdk =
Helpers.Misc.ToGdkColor(tNode.Color);
}
private void RenderHotKey(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel
model, Gtk.TreeIter iter)
diff --git a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
index eaa8093..faa4474 100644
--- a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
@@ -26,6 +26,7 @@ using Image = LongoMatch.Common.Image;
using LongoMatch.Common;
using LongoMatch.Handlers;
using LongoMatch.Store;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch.Gui.Component
{
@@ -215,7 +216,7 @@ namespace LongoMatch.Gui.Component
Image img = (item as Play).Miniature;
c.Pixbuf = img != null ? img.Value : null;
if(Colors) {
- c.CellBackgroundGdk = Helpers.ToGdkColor((item as
Play).Category.Color);
+ c.CellBackgroundGdk = Helpers.Misc.ToGdkColor((item as
Play).Category.Color);
} else {
c.CellBackground = "white";
}
@@ -249,7 +250,7 @@ namespace LongoMatch.Gui.Component
if(o is Play) {
var mtn = o as Play;
if(Colors) {
- Color col = Helpers.ToGdkColor(mtn.Category.Color);
+ Color col = Helpers.Misc.ToGdkColor(mtn.Category.Color);
c.CellBackgroundGdk = col;
c.BackgroundGdk = col;
} else {
@@ -330,14 +331,8 @@ namespace LongoMatch.Gui.Component
}
protected void OnDeleteKeyFrame(object obj, EventArgs args) {
- MessageDialog md = new MessageDialog((Gtk.Window)Toplevel,
- DialogFlags.Modal,
- MessageType.Question,
- ButtonsType.YesNo,
- false,
- Catalog.GetString("Do you want to delete the key
frame for this play?")
- );
- if(md.Run() == (int)ResponseType.Yes) {
+ var msg = Catalog.GetString("Do you want to delete the key frame for this play?");
+ if (MessagesHelpers.QuestionMessage (Toplevel, msg)) {
TreePath[] paths = Selection.GetSelectedRows();
for(int i=0; i<paths.Length; i++) {
Play tNode = (Play)GetValueFromPath(paths[i]);
@@ -346,7 +341,6 @@ namespace LongoMatch.Gui.Component
// Refresh the thumbnails
QueueDraw();
}
- md.Destroy();
}
protected virtual void OnEdit(object obj, EventArgs args) {
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index 1a639eb..b04ad80 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -41,7 +41,6 @@
<File subtype="Code" buildaction="Compile" name="Gui/Dialog/Win32CalendarDialog.cs" />
<File subtype="Directory" buildaction="Compile" name="Gui/Popup" />
<File subtype="Code" buildaction="Compile" name="Gui/Popup/CalendarPopup.cs" />
- <File subtype="Code" buildaction="Compile" name="Gui/Popup/MessagePopup.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Dialog/TemplateEditorDialog.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Component/PlayersListTreeWidget.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Dialog/ProjectsManager.cs" />
@@ -146,7 +145,6 @@
<File subtype="Directory" buildaction="Compile" name="." />
<File subtype="Directory" buildaction="Compile" name=".." />
<File subtype="Directory" buildaction="Compile" name="Gui" />
- <File subtype="Code" buildaction="Compile" name="Gui/Helpers.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Cairo.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Component/PlayersTagger.cs" />
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.PlayersTagger.cs" />
@@ -161,6 +159,10 @@
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.VideoConversionTool.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Dialog/DatabasesManager.cs" />
<File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.DatabasesManager.cs" />
+ <File subtype="Directory" buildaction="Compile" name="Gui/Helpers" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Helpers/Misc.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Helpers/FileChooserHelper.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Helpers/MessagesHelpers.cs" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral,
PublicKeyToken=35e10195dab3c99f" />
diff --git a/LongoMatch.GUI/Makefile.am b/LongoMatch.GUI/Makefile.am
index 3db5942..9cc2ff9 100644
--- a/LongoMatch.GUI/Makefile.am
+++ b/LongoMatch.GUI/Makefile.am
@@ -112,8 +112,10 @@ SOURCES = \
Gui/Dialog/VideoEditionProperties.cs \
Gui/Dialog/VideoConversionTool.cs \
Gui/Dialog/Win32CalendarDialog.cs \
+ Gui/Helpers/FileChooserHelper.cs \
+ Gui/Helpers/MessagesHelpers.cs \
+ Gui/Helpers/Misc.cs \
Gui/Popup/CalendarPopup.cs \
- Gui/Popup/MessagePopup.cs \
Gui/TransparentDrawingArea.cs \
Gui/TreeView/CategoriesFilterTreeView.cs \
Gui/TreeView/CategoriesTreeView.cs \
@@ -128,7 +130,6 @@ SOURCES = \
Gui/TreeView/SubCategoriesTreeView.cs \
Gui/Cairo.cs \
Gui/GUIToolkit.cs \
- Gui/Helpers.cs \
Gui/MainWindow.cs
RESOURCES = \
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
index f8a5156..7e20746 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
@@ -144,7 +144,7 @@ namespace LongoMatch.Gui
this.ManualTaggingViewAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Free
Capture Mode");
w1.Add (this.ManualTaggingViewAction, "<Control>f");
this.GameUnitsViewAction = new global::Gtk.RadioAction ("GameUnitsViewAction",
global::Mono.Unix.Catalog.GetString ("Game units view"), null, null, 0);
- this.GameUnitsViewAction.Group = this.ManualTaggingViewAction.Group;
+ this.GameUnitsViewAction.Group = this.TaggingViewAction.Group;
this.GameUnitsViewAction.Sensitive = false;
this.GameUnitsViewAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Game
units view");
w1.Add (this.GameUnitsViewAction, null);
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index ceef73c..f5aa1eb 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -7,6 +7,7 @@
<import>
<widget-library name="../../bin/LongoMatch.GUI.Multimedia.dll" />
<widget-library name="../../bin/LongoMatch.Multimedia.dll" />
+ <widget-library name="../../bin/LongoMatch.dll" />
<widget-library name="../../bin/LongoMatch.Gui.dll" internal="true" />
</import>
<icon-factory>
@@ -2816,7 +2817,7 @@ new one.</property>
</widget>
</child>
</widget>
- <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.EntryDialog" design-size="339 178">
+ <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.EntryDialog" design-size="339 195">
<property name="MemberName" />
<property name="Title" translatable="yes">Select template name</property>
<property name="Icon">stock:longomatch Dialog</property>
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index 709b482..27a7d6d 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -118,15 +118,6 @@
</itemgroups>
<signals />
</object>
- <object type="LongoMatch.Gui.Base.TemplatesEditorBase" palette-category="LongoMatch"
allow-children="false" base-type="Gtk.Bin">
- <itemgroups>
- <itemgroup label="TemplatesEditorBase Properties">
- <property name="CanExport" />
- <property name="Edited" />
- </itemgroup>
- </itemgroups>
- <signals />
- </object>
<object type="LongoMatch.Gui.Component.GameUnitTimeScale" palette-category="LongoMatch"
allow-children="false" base-type="Gtk.DrawingArea">
<itemgroups>
<itemgroup label="TimeScaleBase[LongoMatch.Store.TimelineNode] Properties">
@@ -176,14 +167,6 @@
<itemgroups />
<signals />
</object>
- <object type="LongoMatch.Gui.Component.CategoryProperties" palette-category="LongoMatch"
allow-children="false" base-type="Gtk.Bin">
- <itemgroups />
- <signals>
- <itemgroup label="CategoryProperties Signals">
- <signal name="HotKeyChanged" />
- </itemgroup>
- </signals>
- </object>
<object type="LongoMatch.Gui.Component.PlayersTagger" palette-category="General" allow-children="false"
base-type="Gtk.Bin">
<itemgroups />
<signals />
@@ -345,4 +328,21 @@
</itemgroup>
</signals>
</object>
+ <object type="LongoMatch.Gui.Component.CategoryProperties" palette-category="LongoMatch"
allow-children="false" base-type="Gtk.Bin">
+ <itemgroups />
+ <signals>
+ <itemgroup label="CategoryProperties Signals">
+ <signal name="HotKeyChanged" />
+ </itemgroup>
+ </signals>
+ </object>
+ <object type="LongoMatch.Gui.Base.TemplatesEditorBase" palette-category="LongoMatch"
allow-children="false" base-type="Gtk.Bin">
+ <itemgroups>
+ <itemgroup label="TemplatesEditorBase Properties">
+ <property name="CanExport" />
+ <property name="Edited" />
+ </itemgroup>
+ </itemgroups>
+ <signals />
+ </object>
</objects>
\ No newline at end of file
diff --git a/LongoMatch.Plugins/CSVExporter.cs b/LongoMatch.Plugins/CSVExporter.cs
index 573f56c..4a89d18 100644
--- a/LongoMatch.Plugins/CSVExporter.cs
+++ b/LongoMatch.Plugins/CSVExporter.cs
@@ -44,7 +44,8 @@ namespace LongoMatch.Plugins
public void ExportProject (Project project, IGUIToolkit guiToolkit) {
string filename = guiToolkit.SaveFile(Catalog.GetString("Output file"), null,
- Config.HomeDir, "CSV", ".csv");
+ Config.HomeDir, "CSV",
+ new string[] {".csv"});
if (filename == null)
return;
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index 74894f7..5aaba80 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -201,7 +201,7 @@ namespace LongoMatch.Services
filename = guiToolkit.OpenFile(Catalog.GetString("Open playlist"), null,
Config.PlayListDir,
Constants.PROJECT_NAME + Catalog.GetString("playlists"),
- "*" + Constants.PLAYLIST_EXT);
+ new string [] {"*" + Constants.PLAYLIST_EXT});
if (filename != null)
Load(filename);
}
@@ -212,7 +212,7 @@ namespace LongoMatch.Services
filename = guiToolkit.SaveFile(Catalog.GetString("New playlist"), null,
Config.PlayListDir,
Constants.PROJECT_NAME + Catalog.GetString("playlists"),
- "*" + Constants.PLAYLIST_EXT);
+ new string [] {"*" + Constants.PLAYLIST_EXT});
if (filename != null)
Load(filename);
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 615a15a..c20b811 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -127,8 +127,8 @@ namespace LongoMatch.Services
Log.Debug("Importing project");
/* Show a file chooser dialog to select the file to import */
- fileName = guiToolkit.OpenFile(name, null,
- Config.HomeDir, filterName, filter);
+ fileName = guiToolkit.OpenFile(name, null, Config.HomeDir, filterName,
+ new string[] {filter});
if(fileName == null)
return;
@@ -389,7 +389,7 @@ namespace LongoMatch.Services
}
string filename = guiToolkit.SaveFile(Catalog.GetString("Save project"), null,
- Config.HomeDir, Constants.PROJECT_NAME, Constants.PROJECT_EXT);
+ Config.HomeDir, Constants.PROJECT_NAME, new string[] {Constants.PROJECT_EXT});
if (filename == null)
return;
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 573bc59..5ca9758 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -34,6 +34,7 @@ using LongoMatch.Common;
using LongoMatch.Video;
using LongoMatch.Multimedia;
using LongoMatch.Multimedia.Utils;
+using LongoMatch.Gui.Helpers;
namespace LongoMatch
@@ -97,10 +98,10 @@ namespace LongoMatch
}
Log.Exception(ex);
//TODO Add bug reports link
- MessagePopup.PopupMessage(null, MessageType.Error,
- Catalog.GetString("The application has finished with an
unexpected error.")+"\n"+
- Catalog.GetString("A log has been saved at: ")+logFile+
"\n"+
- Catalog.GetString("Please, fill a bug report "));
+ MessagesHelpers.ErrorMessage (null,
+ Catalog.GetString("The application has finished with an
unexpected error.")+"\n"+
+ Catalog.GetString("A log has been saved at: ")+logFile+
"\n"+
+ Catalog.GetString("Please, fill a bug report "));
Application.Quit();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]