From e522a4edb1b815a99df9b4f820a10ba03261ebe2 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 7 Jul 2012 00:01:57 +0200 Subject: [PATCH 01/18] A little User Interface for PDFPC, with translation support --- CMakeLists.txt | 3 + cmake/Vala_CMake | 2 +- po/CMakeLists.txt | 15 ++ po/POTFILES.in | 3 + po/es.po | 63 +++++++++ po/gl.po | 63 +++++++++ po/untitled.pot | 61 ++++++++ po/update_mo_files | 6 + po/update_po_files | 6 + src/CMakeLists.txt | 10 ++ src/pdfpc.vala | 300 +++++++++++++++++++++++++++++++++++---- src/ui/about.ui | 39 ++++++ src/ui/main.ui | 343 +++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 885 insertions(+), 29 deletions(-) create mode 100644 po/CMakeLists.txt create mode 100644 po/POTFILES.in create mode 100644 po/es.po create mode 100644 po/gl.po create mode 100644 po/untitled.pot create mode 100755 po/update_mo_files create mode 100755 po/update_po_files create mode 100644 src/ui/about.ui create mode 100644 src/ui/main.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index e1be78d1..3e611f35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,10 @@ ensure_vala_version("0.11.0" MINIMUM) set(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE FILEPATH "sysconfdir") +set(top_srcdir ${PROJECT_DIRECTORY}) + add_subdirectory(src) add_subdirectory(icons) add_subdirectory(man) add_subdirectory(rc) +add_subdirectory(po) diff --git a/cmake/Vala_CMake b/cmake/Vala_CMake index 285255b4..277bb926 160000 --- a/cmake/Vala_CMake +++ b/cmake/Vala_CMake @@ -1 +1 @@ -Subproject commit 285255b42ad8a88993d8fe40ebb209cbe87ec4b8 +Subproject commit 277bb926ccadce43c3c2af1ec4f4db78f8c81372 diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 00000000..180c8a76 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,15 @@ +set(TOP_SRCDIR "${CMAKE_SOURCE_DIR}/../..") + +install(FILES + es.mo +DESTINATION + share/locale/es/LC_MESSAGES +RENAME pdfpc.mo +) + +install(FILES + gl.mo +DESTINATION + share/locale/gl/LC_MESSAGES +RENAME pdfpc.mo +) diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 00000000..90a4a599 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,3 @@ +src/pdfpc.vala +[type: gettext/glade]src/ui/about.ui +[type: gettext/glade]src/ui/main.ui diff --git a/po/es.po b/po/es.po new file mode 100644 index 00000000..8a6b104f --- /dev/null +++ b/po/es.po @@ -0,0 +1,63 @@ +# Copyright (C) 2012 +# This file is distributed under the same license as the pdf_presenter_console package. +# FULL NAME , 2012. +# Sergio Costas , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: 2.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-07-06 23:44+0200\n" +"PO-Revision-Date: 2012-07-06 23:45+0200\n" +"Last-Translator: Sergio Costas \n" +"Language-Team: Español; Castellano \n" +"Language: spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bits\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: ../src/pdfpc.vala:319 +#, c-format +msgid "Invalid parameter in config file %s (line %d)\n" +msgstr "Parámetro no válido en el fichero de configuración %s (línea %d)\n" + +#: ../src/ui/about.ui.h:1 +msgid "" +"2009-2011 Jakob Westhoff\n" +"2012 David Vilar Torres" +msgstr "" +"2009-2011 Jakob Westhoff\n" +"2012 David Vilar Torres" + +#: ../src/ui/main.ui.h:1 +msgid "PDF PC" +msgstr "PDF PC" + +#: ../src/ui/main.ui.h:2 +msgid "Presentation file: " +msgstr "Presentación:" + +#: ../src/ui/main.ui.h:3 +msgid "Duration (in minutes): " +msgstr "Duración (en minutos):" + +#: ../src/ui/main.ui.h:4 +msgid "Alert time (in minutes):" +msgstr "Instante de alerta (en minutos):" + +#: ../src/ui/main.ui.h:5 +msgid "Add additional slide in black at the end" +msgstr "Añadir al final una diapositiva en negro" + +#: ../src/ui/main.ui.h:6 +msgid "Switch screens" +msgstr "Intercambiar pantallas" + +#: ../src/ui/main.ui.h:7 +msgid "Size for current slide (percentage):" +msgstr "Tamaño para diapositiva actual (porcentaje):" + +#: ../src/ui/main.ui.h:8 +msgid "Advanced options" +msgstr "Opciones avanzadas" diff --git a/po/gl.po b/po/gl.po new file mode 100644 index 00000000..a1b1e64f --- /dev/null +++ b/po/gl.po @@ -0,0 +1,63 @@ +# Copyright (C) 2012 +# This file is distributed under the same license as the pdf_presenter_console package. +# FULL NAME , 2012. +# Sergio Costas , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: 2.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-07-06 23:44+0200\n" +"PO-Revision-Date: 2012-07-06 23:46+0200\n" +"Last-Translator: Sergio Costas \n" +"Language-Team: Español; Castellano \n" +"Language: spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bits\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: ../src/pdfpc.vala:319 +#, c-format +msgid "Invalid parameter in config file %s (line %d)\n" +msgstr "Parámetro non válido no arquivo de configurazón %s (liña %d)\n" + +#: ../src/ui/about.ui.h:1 +msgid "" +"2009-2011 Jakob Westhoff\n" +"2012 David Vilar Torres" +msgstr "" +"2009-2011 Jakob Westhoff\n" +"2012 David Vilar Torres" + +#: ../src/ui/main.ui.h:1 +msgid "PDF PC" +msgstr "PDF PC" + +#: ../src/ui/main.ui.h:2 +msgid "Presentation file: " +msgstr "Presentación: " + +#: ../src/ui/main.ui.h:3 +msgid "Duration (in minutes): " +msgstr "Durazón (en minutos):" + +#: ../src/ui/main.ui.h:4 +msgid "Alert time (in minutes):" +msgstr "Instante de alerta (en minutos):" + +#: ../src/ui/main.ui.h:5 +msgid "Add additional slide in black at the end" +msgstr "Engadir ó final unha diapositiva en negro" + +#: ../src/ui/main.ui.h:6 +msgid "Switch screens" +msgstr "Intercambiar pantaias" + +#: ../src/ui/main.ui.h:7 +msgid "Size for current slide (percentage):" +msgstr "Tamaño para a diapositiva actual (porcentaxe):" + +#: ../src/ui/main.ui.h:8 +msgid "Advanced options" +msgstr "Opcións avanzadas" diff --git a/po/untitled.pot b/po/untitled.pot new file mode 100644 index 00000000..b1cdabaf --- /dev/null +++ b/po/untitled.pot @@ -0,0 +1,61 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-07-06 23:44+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../src/pdfpc.vala:319 +#, c-format +msgid "Invalid parameter in config file %s (line %d)\n" +msgstr "" + +#: ../src/ui/about.ui.h:1 +msgid "" +"2009-2011 Jakob Westhoff\n" +"2012 David Vilar Torres" +msgstr "" + +#: ../src/ui/main.ui.h:1 +msgid "PDF PC" +msgstr "" + +#: ../src/ui/main.ui.h:2 +msgid "Presentation file: " +msgstr "" + +#: ../src/ui/main.ui.h:3 +msgid "Duration (in minutes): " +msgstr "" + +#: ../src/ui/main.ui.h:4 +msgid "Alert time (in minutes):" +msgstr "" + +#: ../src/ui/main.ui.h:5 +msgid "Add additional slide in black at the end" +msgstr "" + +#: ../src/ui/main.ui.h:6 +msgid "Switch screens" +msgstr "" + +#: ../src/ui/main.ui.h:7 +msgid "Size for current slide (percentage):" +msgstr "" + +#: ../src/ui/main.ui.h:8 +msgid "Advanced options" +msgstr "" diff --git a/po/update_mo_files b/po/update_mo_files new file mode 100755 index 00000000..b5fb80af --- /dev/null +++ b/po/update_mo_files @@ -0,0 +1,6 @@ +#!/bin/bash + +echo es +msgfmt es.po -o es.mo +echo gl +msgfmt gl.po -o gl.mo diff --git a/po/update_po_files b/po/update_po_files new file mode 100755 index 00000000..34c8d6a7 --- /dev/null +++ b/po/update_po_files @@ -0,0 +1,6 @@ +#!/bin/bash + +echo "es (spanish)" +intltool-update es +echo "gl (galego)" +intltool-update gl diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3495433a..dd850451 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,9 @@ set(CFLAGS ${GTHREAD_CFLAGS} ${GTHREAD_CFLAGS_OTHER} ${RSVG_CFLAGS} ${RSVG_CFLAGS_OTHER} ) + add_definitions(${CFLAGS}) +add_definitions( -D'GETTEXT_PACKAGE="pdfpc"' ) set(LIBS ${GOBJECT_LIBRARIES} @@ -82,3 +84,11 @@ add_library(pdf_presenter_console_test_library EXCLUDE_FROM_ALL ${VALA_C} presenter.h presenter.vapi ) + +install(FILES + ui/main.ui + ui/about.ui +DESTINATION + share/pdfpc +) + diff --git a/src/pdfpc.vala b/src/pdfpc.vala index be6716ec..0bd004f2 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -30,6 +30,13 @@ namespace pdfpc { * initializing the application, like commandline parsing and window creation. */ public class Application: GLib.Object { + + /** + * This string contains the path where the UI is stored + */ + + string basepath; + /** * Window which shows the current slide in fullscreen * @@ -57,6 +64,18 @@ namespace pdfpc { */ private CacheStatus cache_status; + /** + * Interface elements + */ + + private Button ui_go; + private CheckButton ui_sw_scr; + private CheckButton ui_add_black_slide; + private SpinButton ui_duration; + private SpinButton ui_alert; + private SpinButton ui_size; + private FileChooserButton ui_file; + /** * Commandline option parser entry definitions */ @@ -131,34 +150,13 @@ namespace pdfpc { * Main application function, which instantiates the windows and * initializes the Gtk system. */ - public void run( string[] args ) { - stdout.printf( "pdfpc v3.0\n" - + "(C) 2012 David Vilar\n" - + "(C) 2009-2011 Jakob Westhoff\n\n" ); - - Gdk.threads_init(); - Gtk.init( ref args ); - - string pdfFilename = this.parse_command_line_options( args ); - if (Options.list_actions) { - stdout.printf("Config file commands accepted by pdfpc:\n"); - string[] actions = PresentationController.getActionDescriptions(); - for (int i = 0; i < actions.length; i+=2) { - string tabAlignment = "\t"; - if (actions[i].length < 8) - tabAlignment += "\t"; - stdout.printf("\t%s%s=> %s\n", actions[i], tabAlignment, actions[i+1]); - } - return; - } + public void do_slide( string pdfFilename ) { + if (pdfFilename == null) { stderr.printf( "Error: No pdf file given\n"); Posix.exit(1); } - // Initialize the application wide mutex objects - MutexLocks.init(); - stdout.printf( "Initializing rendering...\n" ); var metadata = new Metadata.Pdf( pdfFilename ); @@ -168,11 +166,11 @@ namespace pdfpc { // Initialize global controller and CacheStatus, to manage // crosscutting concerns between the different windows. this.controller = new PresentationController( metadata, Options.black_on_end ); - this.cache_status = new CacheStatus(); ConfigFileReader configFileReader = new ConfigFileReader(this.controller); - configFileReader.readConfig(etc_path + "/pdfpcrc"); - configFileReader.readConfig(Environment.get_home_dir() + "/.pdfpcrc"); + configFileReader.readConfig(GLib.Path.build_filename(etc_path, "/pdfpcrc")); + configFileReader.readConfig(GLib.Path.build_filename(Environment.get_home_dir(),".pdfpcrc")); + configFileReader.readConfig(GLib.Path.build_filename(Environment.get_home_dir(),".config","pdfpc","pdfpcrc")); var screen = Gdk.Screen.get_default(); if ( !Options.windowed && !Options.single_screen && screen.get_n_monitors() > 1 ) { @@ -214,9 +212,255 @@ namespace pdfpc { // Enter the Glib eventloop // Everything from this point on is completely signal based - Gdk.threads_enter(); Gtk.main(); - Gdk.threads_leave(); + this.presentation_window.destroy(); + this.presenter_window.destroy(); + this.presentation_window=null; + this.presenter_window=null; + this.controller=null; + } + + public void refresh_status() { + + var fname = this.ui_file.get_file(); + if (fname!=null) { + var uri = fname.get_uri(); + if (uri==null) { + this.ui_go.sensitive=false; + } else { + this.ui_go.sensitive=true; + } + }else { + this.ui_go.sensitive=false; + } + } + + private int read_configuration() { + + /**************************************************************************************** + * This function will read the configuration from the file ~/.pdf_presenter.cfg * + * If not, it will use that file to get the configuration * + * Returns: * + * 0: on success * + * -1: the config file doesn't exists * + * -2: can't read the config file * + * +N: parse error at line N in config file * + ****************************************************************************************/ + + bool failed=false; + FileInputStream file_read; + + string home=Environment.get_home_dir(); + var config_file = File.new_for_path (GLib.Path.build_filename(home,".config","pdfpd","pdfpc.cfg")); + + if (!config_file.query_exists(null)) { + return -1; + } + + try { + file_read=config_file.read(null); + } catch { + return -2; + } + var in_stream = new DataInputStream (file_read); + string line; + int line_counter=0; + + while ((line = in_stream.read_line (null, null)) != null) { + line_counter++; + + // ignore comments + if (line[0]=='#') { + continue; + } + + // remove unwanted blank spaces + line.strip(); + + // ignore empty lines + if (line.length==0) { + continue; + } + + if (line.has_prefix("switch_screens ")) { + if (line.substring(15)=="1") { + Options.display_switch=true; + } else { + Options.display_switch=false; + } + continue; + } + if (line.has_prefix("duration ")) { + Options.duration=int.parse(line.substring(9).strip()); + continue; + } + if (line.has_prefix("last_minutes ")) { + Options.last_minutes=int.parse(line.substring(13).strip()); + continue; + } + if (line.has_prefix("current_size ")) { + Options.current_size=int.parse(line.substring(13).strip()); + continue; + } + failed=true; + break; + } + + try { + in_stream.close(null); + } catch { + } + try { + file_read.close(null); + } catch { + } + + if (failed) { + GLib.stderr.printf(_("Invalid parameter in config file %s (line %d)\n"),config_file.get_path(),line_counter); + return line_counter; + } + + return 0; + } + + public int write_configuration() { + + try { + FileOutputStream file_write; + + var home=Environment.get_home_dir(); + + var cfg_path=GLib.Path.build_filename(home,".config","pdfpd"); + GLib.DirUtils.create_with_parents(cfg_path,493); // 493 = 755 in octal (for directory permissions) + var config_file = File.new_for_path (GLib.Path.build_filename(cfg_path,"pdfpc.cfg")); + + try { + file_write=config_file.replace(null,false,0,null); + } catch { + return -2; + } + + var out_stream = new DataOutputStream (file_write); + + if (Options.display_switch) { + out_stream.put_string("switch_screens 1\n",null); + } else { + out_stream.put_string("switch_screens 0\n",null); + } + out_stream.put_string("duration %u\n".printf(Options.duration)); + out_stream.put_string("last_minutes %u\n".printf(Options.last_minutes)); + out_stream.put_string("current_size %u\n".printf(Options.current_size)); + + } catch (IOError e) { + } + return 0; + } + + + /** + * Main application function, which instantiates the windows and + * initializes the Gtk system. + */ + public void run( string[] args ) { + + stdout.printf( "pdfpc v3.2 alpha1\n" + + "(C) 2012 David Vilar\n" + + "(C) 2009-2011 Jakob Westhoff\n\n" ); + + Gdk.threads_init(); + Gtk.init( ref args ); + + this.read_configuration (); + + string pdfFilename = this.parse_command_line_options( args ); + if (Options.list_actions) { + stdout.printf("Config file commands accepted by pdfpc:\n"); + string[] actions = PresentationController.getActionDescriptions(); + for (int i = 0; i < actions.length; i+=2) { + string tabAlignment = "\t"; + if (actions[i].length < 8) + tabAlignment += "\t"; + stdout.printf("\t%s%s=> %s\n", actions[i], tabAlignment, actions[i+1]); + } + return; + } + + var file=File.new_for_path("/usr/share/pdfpc/main.ui"); + if (file.query_exists()) { + this.basepath="/usr/share/pdfpc/"; + Intl.bindtextdomain( "pdfpc", "/usr/share/locale"); + } else { + this.basepath="/usr/local/share/pdfpc/"; + Intl.bindtextdomain( "pdfpc", "/usr/local/share/locale"); + } + Intl.textdomain("pdfpc"); + Intl.bind_textdomain_codeset( "pdfpc", "UTF-8" ); + + // Initialize the application wide mutex objects + MutexLocks.init(); + + var builder = new Builder(); + builder.add_from_file(GLib.Path.build_filename(this.basepath,"main.ui")); + var main_w = (Dialog)builder.get_object("main_dialog"); + var builder2 = new Builder(); + builder2.add_from_file(GLib.Path.build_filename(this.basepath,"about.ui")); + var about_w = (Dialog)builder2.get_object("aboutdialog"); + + this.ui_go = (Button)builder.get_object("go_button"); + this.ui_sw_scr = (CheckButton)builder.get_object("switch_screens"); + this.ui_add_black_slide = (CheckButton)builder.get_object("add_black_slide"); + this.ui_duration = (SpinButton)builder.get_object("duration_time"); + this.ui_alert = (SpinButton)builder.get_object("alert_time"); + this.ui_size = (SpinButton)builder.get_object("size_slide"); + this.ui_file = (FileChooserButton)builder.get_object("pdf_file"); + this.ui_file.file_set.connect(this.refresh_status); + this.ui_file.selection_changed.connect(this.refresh_status); + + if (pdfFilename!=null) { + var fname = File.new_for_path(pdfFilename); + this.ui_file.set_file(fname); + } + + stdout.printf( "Initializing rendering... \n" ); + + // Initialize global controller and CacheStatus, to manage + // crosscutting concerns between the different windows. + this.cache_status = new CacheStatus(); + + Gdk.threads_enter(); + bool do_loop=true; + do { + this.ui_sw_scr.active=Options.display_switch; + this.ui_add_black_slide.active=Options.black_on_end; + this.ui_duration.value=Options.duration; + this.ui_alert.value=Options.last_minutes; + this.ui_size.value=Options.current_size; + main_w.show(); + this.refresh_status (); + var res=main_w.run(); + Options.display_switch=this.ui_sw_scr.active; + Options.black_on_end=this.ui_add_black_slide.active; + Options.duration=this.ui_duration.get_value_as_int(); + Options.last_minutes=this.ui_alert.get_value_as_int(); + Options.current_size=this.ui_size.get_value_as_int(); + this.write_configuration(); + main_w.hide(); + switch(res) { + case 1: + this.do_slide (this.ui_file.get_file().get_uri()); + break; + case 2: + about_w.show(); + about_w.run(); + about_w.hide(); + continue; + break; + default: + do_loop=false; + break; + } + } while (do_loop); + Gdk.threads_leave(); } /** diff --git a/src/ui/about.ui b/src/ui/about.ui new file mode 100644 index 00000000..8e5fdb1d --- /dev/null +++ b/src/ui/about.ui @@ -0,0 +1,39 @@ + + + + + + False + 5 + dialog + PDF Presenter + 2.1 + 2009-2011 Jakob Westhoff +2012 David Vilar Torres + Jakob Westhoff +David Vilar Torres + + + True + False + 2 + + + True + False + end + + + False + True + end + 0 + + + + + + + + + diff --git a/src/ui/main.ui b/src/ui/main.ui new file mode 100644 index 00000000..38f00a95 --- /dev/null +++ b/src/ui/main.ui @@ -0,0 +1,343 @@ + + + + + + 999 + 5 + 1 + 10 + + + 1 + 999 + 45 + 1 + 10 + + + 10 + 90 + 60 + 1 + 10 + + + 600 + 300 + False + 5 + PDF PC + center + normal + + + True + False + 2 + + + True + False + + + True + False + Presentation file: + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + + + True + False + Duration (in minutes): + + + False + True + 0 + + + + + True + True + 3 + + True + False + False + True + True + adjustment_duration + + + False + True + 4 + 1 + + + + + False + True + 2 + + + + + True + False + + + True + False + Alert time (in minutes): + + + False + True + 0 + + + + + True + True + 3 + + True + False + False + True + True + adjustment_alert + + + False + True + 4 + 1 + + + + + False + True + 3 + + + + + Add additional slide in black at the end + True + True + False + False + True + + + False + True + 4 + + + + + True + False + + + True + True + 5 + + + + + True + True + + + True + False + + + Switch screens + True + True + False + False + True + + + False + True + 0 + + + + + True + False + + + True + False + Size for current slide (percentage): + + + False + True + 0 + + + + + True + True + + True + False + False + True + True + adjustment_size_slide + + + False + True + 1 + + + + + False + True + 1 + + + + + + + True + False + Advanced options + + + + + False + True + 6 + + + + + True + False + end + + + gtk-about + True + True + True + False + True + + + + False + False + 0 + True + + + + + gtk-quit + True + True + True + False + True + + + False + False + 1 + + + + + gtk-go-forward + True + True + True + False + True + + + False + False + 2 + + + + + False + True + end + 7 + + + + + + button_about + button1 + go_button + + + From 78cedd0b6d756a68234d782ef3d135bf60785544 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 7 Jul 2012 00:08:18 +0200 Subject: [PATCH 02/18] Removed inutil lines from CMAKE files --- CMakeLists.txt | 2 -- po/CMakeLists.txt | 2 -- 2 files changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e611f35..a6933f23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,6 @@ ensure_vala_version("0.11.0" MINIMUM) set(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE FILEPATH "sysconfdir") -set(top_srcdir ${PROJECT_DIRECTORY}) - add_subdirectory(src) add_subdirectory(icons) add_subdirectory(man) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 180c8a76..89d9da2d 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,5 +1,3 @@ -set(TOP_SRCDIR "${CMAKE_SOURCE_DIR}/../..") - install(FILES es.mo DESTINATION From e947240d04c0835168b84590b79bc7e26d0e0c26 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 8 Jul 2012 11:27:33 +0200 Subject: [PATCH 03/18] Now allows to launch the presentation directly from command line (-r parameter) Added a command line parameter to specify to NOT switch the screens (-n parameter) --- src/classes/options.vala | 12 +++++ src/pdfpc.vala | 108 +++++++++++++++++++++++++-------------- 2 files changed, 81 insertions(+), 39 deletions(-) diff --git a/src/classes/options.vala b/src/classes/options.vala index 3f91367d..3dc81392 100644 --- a/src/classes/options.vala +++ b/src/classes/options.vala @@ -26,12 +26,24 @@ namespace pdfpc { * information and their default values. */ public class Options: GLib.Object { + + /** + * Commandline option to force launching the presentation without showing the GUI + */ + public static bool run_now = false; + /** * Commandline option specifying if the presenter and presentation screen * should be switched. */ public static bool display_switch = false; + /** + * Commandline option specifying if the presenter and presentation screen + * should not be switched. + */ + public static bool display_unswitch = false; + /** * Commandline option to force using only one screen. */ diff --git a/src/pdfpc.vala b/src/pdfpc.vala index 0bd004f2..5699375c 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -87,12 +87,14 @@ namespace pdfpc { { "current-size", 'u', 0, OptionArg.INT, ref Options.current_size, "Percentage of the presenter screen to be used for the current slide. (Default 60)", "N" }, { "overview-min-size", 'o', 0, OptionArg.INT, ref Options.min_overview_width, "Minimum width for the overview miniatures, in pixels. (Default 150)", "N" }, { "switch-screens", 's', 0, 0, ref Options.display_switch, "Switch the presentation and the presenter screen.", null }, + { "no-switch-screens", 'n', 0, 0, ref Options.display_unswitch, "Unswitch the presentation and the presenter screen. It disables a previous -s parameter.", null }, { "disable-cache", 'c', 0, 0, ref Options.disable_caching, "Disable caching and pre-rendering of slides to save memory at the cost of speed.", null }, { "disable-compression", 'z', 0, 0, ref Options.disable_cache_compression, "Disable the compression of slide images to trade memory consumption for speed. (Avg. factor 30)", null }, { "black-on-end", 'b', 0, 0, ref Options.black_on_end, "Add an additional black slide at the end of the presentation", null }, { "single-screen", 'S', 0, 0, ref Options.single_screen, "Force to use only one screen", null }, { "list-actions", 'L', 0, 0, ref Options.list_actions, "List actions supported in the config file(s)", null}, { "windowed", 'w', 0, 0, ref Options.windowed, "Run in windowed mode (devel tool)", null}, + { "run-now", 'r', 0, 0, ref Options.run_now, "Launch the presentation directly, without showing the user interface", null}, { null } }; @@ -166,6 +168,7 @@ namespace pdfpc { // Initialize global controller and CacheStatus, to manage // crosscutting concerns between the different windows. this.controller = new PresentationController( metadata, Options.black_on_end ); + this.cache_status = new CacheStatus(); ConfigFileReader configFileReader = new ConfigFileReader(this.controller); configFileReader.readConfig(GLib.Path.build_filename(etc_path, "/pdfpcrc")); @@ -217,7 +220,11 @@ namespace pdfpc { this.presenter_window.destroy(); this.presentation_window=null; this.presenter_window=null; + // controller and cache status should have a destructor method, to ensure + // that all the memory is freed here (I'm not sure, but seems to be a little + // memory leak when launching a presentation over and over again) this.controller=null; + this.cache_status=null; } public void refresh_status() { @@ -370,8 +377,12 @@ namespace pdfpc { Gdk.threads_init(); Gtk.init( ref args ); + // First, read the configuration with the last options used (to remember if we + // have to switch screens and so on) this.read_configuration (); - + + // Now, read the command line options, overwriting the ones set by the + // READ_CONFIGURATION function string pdfFilename = this.parse_command_line_options( args ); if (Options.list_actions) { stdout.printf("Config file commands accepted by pdfpc:\n"); @@ -384,7 +395,14 @@ namespace pdfpc { } return; } + + // This option is needed because the previously stored configuration could mandate + // to switch the screens, but now the user doesn't want to do it from command line + if (Options.display_unswitch) { + Options.display_switch=false; + } + // Find where the GUI definition files are (/usr or /usr/local) and set locale var file=File.new_for_path("/usr/share/pdfpc/main.ui"); if (file.query_exists()) { this.basepath="/usr/share/pdfpc/"; @@ -406,6 +424,7 @@ namespace pdfpc { builder2.add_from_file(GLib.Path.build_filename(this.basepath,"about.ui")); var about_w = (Dialog)builder2.get_object("aboutdialog"); + // Get access to all the important widgets in the GUI this.ui_go = (Button)builder.get_object("go_button"); this.ui_sw_scr = (CheckButton)builder.get_object("switch_screens"); this.ui_add_black_slide = (CheckButton)builder.get_object("add_black_slide"); @@ -421,45 +440,56 @@ namespace pdfpc { this.ui_file.set_file(fname); } - stdout.printf( "Initializing rendering... \n" ); - - // Initialize global controller and CacheStatus, to manage - // crosscutting concerns between the different windows. - this.cache_status = new CacheStatus(); - Gdk.threads_enter(); - bool do_loop=true; - do { - this.ui_sw_scr.active=Options.display_switch; - this.ui_add_black_slide.active=Options.black_on_end; - this.ui_duration.value=Options.duration; - this.ui_alert.value=Options.last_minutes; - this.ui_size.value=Options.current_size; - main_w.show(); - this.refresh_status (); - var res=main_w.run(); - Options.display_switch=this.ui_sw_scr.active; - Options.black_on_end=this.ui_add_black_slide.active; - Options.duration=this.ui_duration.get_value_as_int(); - Options.last_minutes=this.ui_alert.get_value_as_int(); - Options.current_size=this.ui_size.get_value_as_int(); - this.write_configuration(); - main_w.hide(); - switch(res) { - case 1: - this.do_slide (this.ui_file.get_file().get_uri()); - break; - case 2: - about_w.show(); - about_w.run(); - about_w.hide(); - continue; - break; - default: - do_loop=false; - break; - } - } while (do_loop); + + if (Options.run_now) { + // If the user set the -r option, launch the presentation just now + this.do_slide (pdfFilename); + } else { + bool do_loop=true; + do { + + // Set the GUI options acording to the ones currently active + this.ui_sw_scr.active=Options.display_switch; + this.ui_add_black_slide.active=Options.black_on_end; + this.ui_duration.value=Options.duration; + this.ui_alert.value=Options.last_minutes; + this.ui_size.value=Options.current_size; + + main_w.show(); + this.refresh_status(); + var result=main_w.run(); + + // Update internal options acording to the ones in the GUI + Options.display_switch=this.ui_sw_scr.active; + Options.black_on_end=this.ui_add_black_slide.active; + Options.duration=this.ui_duration.get_value_as_int(); + Options.last_minutes=this.ui_alert.get_value_as_int(); + Options.current_size=this.ui_size.get_value_as_int(); + + // Remember the last used options + this.write_configuration(); + + main_w.hide(); + switch(result) { + case 1: + // Launch the presentation + this.do_slide (this.ui_file.get_file().get_uri()); + break; + case 2: + // Show the ABOUT window + about_w.show(); + about_w.run(); + about_w.hide(); + continue; + break; + default: + // Exit, Sasha Kinski :) + do_loop=false; + break; + } + } while (do_loop); + } Gdk.threads_leave(); } From 8f324da648406792f6ffba3fcd1b6e0e9db4bb98 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 8 Jul 2012 19:15:55 +0200 Subject: [PATCH 04/18] Removed an invalid slash --- src/pdfpc.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pdfpc.vala b/src/pdfpc.vala index 5699375c..43035a55 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -171,8 +171,8 @@ namespace pdfpc { this.cache_status = new CacheStatus(); ConfigFileReader configFileReader = new ConfigFileReader(this.controller); - configFileReader.readConfig(GLib.Path.build_filename(etc_path, "/pdfpcrc")); - configFileReader.readConfig(GLib.Path.build_filename(Environment.get_home_dir(),".pdfpcrc")); + configFileReader.readConfig(GLib.Path.build_filename(etc_path, "pdfpcrc")); + configFileReader.readConfig(GLib.Path.build_filename(Environment.get_home_dir(),".pdfpcrc")); configFileReader.readConfig(GLib.Path.build_filename(Environment.get_home_dir(),".config","pdfpc","pdfpcrc")); var screen = Gdk.Screen.get_default(); From 79f95f4f87150d5ad65a827ee834545d426a8807 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Mon, 9 Jul 2012 20:39:41 +0200 Subject: [PATCH 05/18] Changed the interface to work with events, and not like a dialog (much more elegant) --- src/classes/presentation_controller.vala | 18 ++- src/classes/window/presentation.vala | 2 +- src/classes/window/presenter.vala | 2 +- src/pdfpc.vala | 178 +++++++++++++---------- src/ui/main.ui | 27 +--- 5 files changed, 132 insertions(+), 95 deletions(-) diff --git a/src/classes/presentation_controller.vala b/src/classes/presentation_controller.vala index f3ddcac2..d18b9f69 100644 --- a/src/classes/presentation_controller.vala +++ b/src/classes/presentation_controller.vala @@ -674,6 +674,22 @@ namespace pdfpc { } } + /** + * Callback to be notified when a presentation window has been closed by the user + */ + + public void closed_window() { + + signal_close_presentation (); + + } + + /** + * This signal is emited when the user wants to exit the presentation + */ + + public signal void signal_close_presentation(); + /** * Notify the controllables that they have to update the view */ @@ -828,7 +844,7 @@ namespace pdfpc { protected void quit() { this.metadata.save_to_disk(); - Gtk.main_quit(); + signal_close_presentation (); } /** diff --git a/src/classes/window/presentation.vala b/src/classes/window/presentation.vala index f7772f90..00c5f993 100644 --- a/src/classes/window/presentation.vala +++ b/src/classes/window/presentation.vala @@ -48,7 +48,7 @@ namespace pdfpc.Window { base( screen_num ); this.destroy.connect( (source) => { - Gtk.main_quit(); + this.presentation_controller.closed_window(); } ); this.presentation_controller = presentation_controller; diff --git a/src/classes/window/presenter.vala b/src/classes/window/presenter.vala index a8079448..4a2e69c0 100644 --- a/src/classes/window/presenter.vala +++ b/src/classes/window/presenter.vala @@ -141,7 +141,7 @@ namespace pdfpc.Window { base( screen_num ); this.destroy.connect( (source) => { - Gtk.main_quit(); + this.presentation_controller.closed_window(); } ); this.presentation_controller = presentation_controller; diff --git a/src/pdfpc.vala b/src/pdfpc.vala index 43035a55..a79d1e68 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -68,13 +68,16 @@ namespace pdfpc { * Interface elements */ - private Button ui_go; - private CheckButton ui_sw_scr; - private CheckButton ui_add_black_slide; - private SpinButton ui_duration; - private SpinButton ui_alert; - private SpinButton ui_size; - private FileChooserButton ui_file; + private Gtk.Window main_w; + private Gtk.Button ui_go; + private Gtk.Button ui_exit; + private Gtk.Button ui_about; + private Gtk.CheckButton ui_sw_scr; + private Gtk.CheckButton ui_add_black_slide; + private Gtk.SpinButton ui_duration; + private Gtk.SpinButton ui_alert; + private Gtk.SpinButton ui_size; + private Gtk.FileChooserButton ui_file; /** * Commandline option parser entry definitions @@ -148,6 +151,60 @@ namespace pdfpc { return presentation_window; } + /** + * This callback kills the current presentation and shows the main window + */ + + public void kill_presentation() { + + this.controller.signal_close_presentation.disconnect(this.kill_presentation); + if (this.presentation_window!=null) { + this.presentation_window.destroy(); + this.presentation_window=null; + } + if (this.presenter_window!=null) { + this.presenter_window.destroy(); + this.presenter_window=null; + } + // controller and cache status should have a destructor method, to ensure + // that all the memory is freed here (I'm not sure, but seems to be a little + // memory leak when launching a presentation over and over again) + this.controller=null; + this.cache_status=null; + + if (Options.run_now) { + // If we are running the presentation directly, now we have to exit + Gtk.main_quit(); + } else { + // If not, we have to show the main window + this.main_w.show(); + } + } + + + /** + * This callback starts a presentation from the main window + */ + + public void start_presentation() { + + this.main_w.hide(); + + // Update internal options acording to the ones in the GUI + Options.display_switch=this.ui_sw_scr.active; + Options.black_on_end=this.ui_add_black_slide.active; + Options.duration=this.ui_duration.get_value_as_int(); + Options.last_minutes=this.ui_alert.get_value_as_int(); + Options.current_size=this.ui_size.get_value_as_int(); + + // Remember the last used options + this.write_configuration(); + + // And launch the presentation + this.do_slide (this.ui_file.get_file().get_uri()); + + } + /** * Main application function, which instantiates the windows and * initializes the Gtk system. @@ -169,6 +226,7 @@ namespace pdfpc { // crosscutting concerns between the different windows. this.controller = new PresentationController( metadata, Options.black_on_end ); this.cache_status = new CacheStatus(); + this.controller.signal_close_presentation.connect(this.kill_presentation); ConfigFileReader configFileReader = new ConfigFileReader(this.controller); configFileReader.readConfig(GLib.Path.build_filename(etc_path, "pdfpcrc")); @@ -212,19 +270,6 @@ namespace pdfpc { this.presenter_window.show_all(); this.presenter_window.update(); } - - // Enter the Glib eventloop - // Everything from this point on is completely signal based - Gtk.main(); - this.presentation_window.destroy(); - this.presenter_window.destroy(); - this.presentation_window=null; - this.presenter_window=null; - // controller and cache status should have a destructor method, to ensure - // that all the memory is freed here (I'm not sure, but seems to be a little - // memory leak when launching a presentation over and over again) - this.controller=null; - this.cache_status=null; } public void refresh_status() { @@ -419,22 +464,39 @@ namespace pdfpc { var builder = new Builder(); builder.add_from_file(GLib.Path.build_filename(this.basepath,"main.ui")); - var main_w = (Dialog)builder.get_object("main_dialog"); - var builder2 = new Builder(); + this.main_w = (Gtk.Window)builder.get_object("main_window"); + + var builder2 = new Builder(); builder2.add_from_file(GLib.Path.build_filename(this.basepath,"about.ui")); - var about_w = (Dialog)builder2.get_object("aboutdialog"); + var about_w = (Gtk.Dialog)builder2.get_object("aboutdialog"); // Get access to all the important widgets in the GUI - this.ui_go = (Button)builder.get_object("go_button"); - this.ui_sw_scr = (CheckButton)builder.get_object("switch_screens"); - this.ui_add_black_slide = (CheckButton)builder.get_object("add_black_slide"); - this.ui_duration = (SpinButton)builder.get_object("duration_time"); - this.ui_alert = (SpinButton)builder.get_object("alert_time"); - this.ui_size = (SpinButton)builder.get_object("size_slide"); - this.ui_file = (FileChooserButton)builder.get_object("pdf_file"); + this.ui_go = (Gtk.Button)builder.get_object("button_go"); + this.ui_exit = (Gtk.Button)builder.get_object("button_exit"); + this.ui_about = (Gtk.Button)builder.get_object("button_about"); + this.ui_sw_scr = (Gtk.CheckButton)builder.get_object("switch_screens"); + this.ui_add_black_slide = (Gtk.CheckButton)builder.get_object("add_black_slide"); + this.ui_duration = (Gtk.SpinButton)builder.get_object("duration_time"); + this.ui_alert = (Gtk.SpinButton)builder.get_object("alert_time"); + this.ui_size = (Gtk.SpinButton)builder.get_object("size_slide"); + this.ui_file = (Gtk.FileChooserButton)builder.get_object("pdf_file"); this.ui_file.file_set.connect(this.refresh_status); this.ui_file.selection_changed.connect(this.refresh_status); - + this.ui_go.clicked.connect(this.start_presentation); + this.main_w.destroy.connect( (source) => { + Gtk.main_quit(); + } ); + this.ui_exit.clicked.connect( (source) => { + Gtk.main_quit(); + } ); + this.ui_about.clicked.connect( (source) => { + this.main_w.hide(); + about_w.show(); + about_w.run(); + about_w.hide(); + this.main_w.show(); + } ); + if (pdfFilename!=null) { var fname = File.new_for_path(pdfFilename); this.ui_file.set_file(fname); @@ -446,50 +508,20 @@ namespace pdfpc { // If the user set the -r option, launch the presentation just now this.do_slide (pdfFilename); } else { - bool do_loop=true; - do { - - // Set the GUI options acording to the ones currently active - this.ui_sw_scr.active=Options.display_switch; - this.ui_add_black_slide.active=Options.black_on_end; - this.ui_duration.value=Options.duration; - this.ui_alert.value=Options.last_minutes; - this.ui_size.value=Options.current_size; - - main_w.show(); - this.refresh_status(); - var result=main_w.run(); - - // Update internal options acording to the ones in the GUI - Options.display_switch=this.ui_sw_scr.active; - Options.black_on_end=this.ui_add_black_slide.active; - Options.duration=this.ui_duration.get_value_as_int(); - Options.last_minutes=this.ui_alert.get_value_as_int(); - Options.current_size=this.ui_size.get_value_as_int(); - - // Remember the last used options - this.write_configuration(); + // Set the GUI options acording to the ones currently active + this.ui_sw_scr.active=Options.display_switch; + this.ui_add_black_slide.active=Options.black_on_end; + this.ui_duration.value=Options.duration; + this.ui_alert.value=Options.last_minutes; + this.ui_size.value=Options.current_size; - main_w.hide(); - switch(result) { - case 1: - // Launch the presentation - this.do_slide (this.ui_file.get_file().get_uri()); - break; - case 2: - // Show the ABOUT window - about_w.show(); - about_w.run(); - about_w.hide(); - continue; - break; - default: - // Exit, Sasha Kinski :) - do_loop=false; - break; - } - } while (do_loop); + main_w.show(); + this.refresh_status(); } + + // Enter the Glib eventloop + // Everything from this point on is completely signal based + Gtk.main(); Gdk.threads_leave(); } diff --git a/src/ui/main.ui b/src/ui/main.ui index 38f00a95..d86b5955 100644 --- a/src/ui/main.ui +++ b/src/ui/main.ui @@ -22,19 +22,15 @@ 1 10 - + 600 300 False - 5 - PDF PC center - normal - - + + True False - 2 True @@ -272,8 +268,8 @@ 6 - - + + True False end @@ -285,7 +281,6 @@ True False True - False @@ -295,7 +290,7 @@ - + gtk-quit True True @@ -310,8 +305,8 @@ - - gtk-go-forward + + gtk-media-play True True True @@ -328,16 +323,10 @@ False True - end 7 - - button_about - button1 - go_button - From 1583df5a1ce4fffb673d9caf3ccc93af4b1a813c Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Tue, 10 Jul 2012 08:35:11 +0200 Subject: [PATCH 06/18] Fixed version number (let's see if this allows a direct merge) Fixed config path Fixed storing the duration of the file Added precompiled .mo files --- src/pdfpc.vala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pdfpc.vala b/src/pdfpc.vala index a79d1e68..5f8da9c9 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -342,8 +342,7 @@ namespace pdfpc { } continue; } - if (line.has_prefix("duration ")) { - Options.duration=int.parse(line.substring(9).strip()); + if (line.has_prefix("duration ")) { // old option. Don't use it any more continue; } if (line.has_prefix("last_minutes ")) { @@ -382,7 +381,7 @@ namespace pdfpc { var home=Environment.get_home_dir(); - var cfg_path=GLib.Path.build_filename(home,".config","pdfpd"); + var cfg_path=GLib.Path.build_filename(home,".config","pdfpc"); GLib.DirUtils.create_with_parents(cfg_path,493); // 493 = 755 in octal (for directory permissions) var config_file = File.new_for_path (GLib.Path.build_filename(cfg_path,"pdfpc.cfg")); @@ -399,7 +398,6 @@ namespace pdfpc { } else { out_stream.put_string("switch_screens 0\n",null); } - out_stream.put_string("duration %u\n".printf(Options.duration)); out_stream.put_string("last_minutes %u\n".printf(Options.last_minutes)); out_stream.put_string("current_size %u\n".printf(Options.current_size)); @@ -415,7 +413,7 @@ namespace pdfpc { */ public void run( string[] args ) { - stdout.printf( "pdfpc v3.2 alpha1\n" + stdout.printf( "pdfpc v3.1.1\n" + "(C) 2012 David Vilar\n" + "(C) 2009-2011 Jakob Westhoff\n\n" ); From 3e6528d9b1b9baf102b6d5ca28fad2a99bc57588 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Wed, 11 Jul 2012 22:34:24 +0200 Subject: [PATCH 07/18] Changed version --- src/pdfpc.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdfpc.vala b/src/pdfpc.vala index 77c95e8c..4bbe8cdc 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -413,7 +413,7 @@ namespace pdfpc { */ public void run( string[] args ) { - stdout.printf( "pdfpc v3.1.1\n" + stdout.printf( "pdfpc v3.2 beta2\n" + "(C) 2012 David Vilar\n" + "(C) 2009-2011 Jakob Westhoff\n\n" ); From 2afbc00e7b638f64b9e90dcf96ccbc651f3d85dd Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Wed, 11 Jul 2012 23:53:19 +0200 Subject: [PATCH 08/18] Added a .desktop and an icon, to allod to launch PDFPC from the applications menu Added es.mo and gl.mo files --- icons/CMakeLists.txt | 5 ++ icons/pdfpc.svg | 122 +++++++++++++++++++++++++++++++++++++++++++ po/es.mo | Bin 0 -> 1277 bytes po/gl.mo | Bin 0 -> 1275 bytes rc/CMakeLists.txt | 6 +++ rc/pdfpc.desktop | 17 ++++++ 6 files changed, 150 insertions(+) create mode 100644 icons/pdfpc.svg create mode 100644 po/es.mo create mode 100644 po/gl.mo create mode 100644 rc/pdfpc.desktop diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index f901b544..deba925e 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -6,3 +6,8 @@ DESTINATION share/pixmaps/pdfpc ) +install(FILES + pdfpc.svg +DESTINATION + share/pixmaps +) diff --git a/icons/pdfpc.svg b/icons/pdfpc.svg new file mode 100644 index 00000000..85835659 --- /dev/null +++ b/icons/pdfpc.svg @@ -0,0 +1,122 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/po/es.mo b/po/es.mo new file mode 100644 index 0000000000000000000000000000000000000000..793bd3d10ea172c1406d89197d85f5ccbf15c937 GIT binary patch literal 1277 zcmb7@&uUvo6vn4b+N3v7oD`ZYyf~o^$b@kv#ZBDnIJA~*aIvw7m2}h1@x4dV*jF=` znUV5`zCa%!50LJ<$Rdh$PES=*4otNsVV89sn}EB zc`reISC+(OX`*qKD+-k&7HS}1Z0saT zSjkm);yJmTT_&|_r;PMev*)oy@#&nx*?}3-z*Isv0yQdQF)3Fv)$8t1ucLaXQfypg zOl~=;L-SN<;5-!*G-2bvWjAW^Me-dA$~b&vVlkpncoCG_^X^!RsCP^KP<%jrIki_? z*?p;vr>u9-*BvkOV|AA!j!jpnn|E~cHnnf%Yil=~xNSJ<`!Y2t z;oJSbUij^Ch`R6DhKi%}IUR~08b=)$A_uzbu`mAH1%eyI)xwSMWqWLg6Evjz!sDE_ zL(Q|7uG*kZ@~XCtmm_n*{gG0NlkRb8>M8&r(g z2Z@^x`a634jbG|uAYO0V!j;Ajb6P(#F=V|8&tB;r=f@!@ThIT7&GrT@rkf3WeY3T) zk*W9B=TxdQ?B|vPR}_16wY+QMVz3)1~fTW@^Mn~F3R@>kBequmGEZy@$nd zV2coSa0aY_H^2kn26zm73LXWYgLB|(a3}ZyJOq9MPl8{;ecfpi+a|m#+-Unme7vO&I6?hhW2Ob7LgGeioR_ubsfs|s$WHx=o_&5^S z9vDKzZdmO7=V;dJmu0iwXwXgGuKboP8(Yp( zEBcou8~e}Lln`aK?ryWJ&u z>6c&Zpr@Q{o6P3g6e(R=*TE;964zeJCF=%0B~wja{X%n|rqhL*IkC`~olnGnYqV_& z&b6cQTj(UJbZGiax#r4x2zSH~C>d2aD{fbr9=|o77;4?*oIPZR14fesVRO_hQw{zT zz1kmo-9*qI%N=&(m(Z!RWFY3z_$9;}=fv*eP>*a(IF&CtpCp(Hc>IR{s^CdwP;Zw9 n@eU{d0sY Date: Sat, 14 Jul 2012 01:20:50 +0200 Subject: [PATCH 09/18] Support for "end time" in the GUI Moved the configuration to a window Now CMake automatically generates the .mo files from the .po files --- cmake/Vala_CMake | 2 +- po/CMakeLists.txt | 10 +++ po/es.mo | Bin 1277 -> 0 bytes po/gl.mo | Bin 1275 -> 0 bytes src/CMakeLists.txt | 3 +- src/pdfpc.vala | 84 +++++++++++++----- src/ui/main.ui | 215 +++++++++++++++++++++++++-------------------- src/ui/settings.ui | 129 +++++++++++++++++++++++++++ 8 files changed, 321 insertions(+), 122 deletions(-) delete mode 100644 po/es.mo delete mode 100644 po/gl.mo create mode 100644 src/ui/settings.ui diff --git a/cmake/Vala_CMake b/cmake/Vala_CMake index 277bb926..37e01c1a 160000 --- a/cmake/Vala_CMake +++ b/cmake/Vala_CMake @@ -1 +1 @@ -Subproject commit 277bb926ccadce43c3c2af1ec4f4db78f8c81372 +Subproject commit 37e01c1a2ace2a456c20efea44b253027ae914d3 diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 89d9da2d..ff4021dc 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,3 +1,13 @@ +file(GLOB list_po RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po) + +foreach(file_po ${list_po}) + string(REPLACE ".po" ".mo" file_mo ${file_po}) + add_custom_target(${file_mo} ALL + DEPENDS ${file_po} + COMMAND msgfmt ${file_po} -o ${file_mo} + ) +endforeach() + install(FILES es.mo DESTINATION diff --git a/po/es.mo b/po/es.mo deleted file mode 100644 index 793bd3d10ea172c1406d89197d85f5ccbf15c937..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1277 zcmb7@&uUvo6vn4b+N3v7oD`ZYyf~o^$b@kv#ZBDnIJA~*aIvw7m2}h1@x4dV*jF=` znUV5`zCa%!50LJ<$Rdh$PES=*4otNsVV89sn}EB zc`reISC+(OX`*qKD+-k&7HS}1Z0saT zSjkm);yJmTT_&|_r;PMev*)oy@#&nx*?}3-z*Isv0yQdQF)3Fv)$8t1ucLaXQfypg zOl~=;L-SN<;5-!*G-2bvWjAW^Me-dA$~b&vVlkpncoCG_^X^!RsCP^KP<%jrIki_? z*?p;vr>u9-*BvkOV|AA!j!jpnn|E~cHnnf%Yil=~xNSJ<`!Y2t z;oJSbUij^Ch`R6DhKi%}IUR~08b=)$A_uzbu`mAH1%eyI)xwSMWqWLg6Evjz!sDE_ zL(Q|7uG*kZ@~XCtmm_n*{gG0NlkRb8>M8&r(g z2Z@^x`a634jbG|uAYO0V!j;Ajb6P(#F=V|8&tB;r=f@!@ThIT7&GrT@rkf3WeY3T) zk*W9B=TxdQ?B|vPR}_16wY+QMVz3)1~fTW@^Mn~F3R@>kBequmGEZy@$nd zV2coSa0aY_H^2kn26zm73LXWYgLB|(a3}ZyJOq9MPl8{;ecfpi+a|m#+-Unme7vO&I6?hhW2Ob7LgGeioR_ubsfs|s$WHx=o_&5^S z9vDKzZdmO7=V;dJmu0iwXwXgGuKboP8(Yp( zEBcou8~e}Lln`aK?ryWJ&u z>6c&Zpr@Q{o6P3g6e(R=*TE;964zeJCF=%0B~wja{X%n|rqhL*IkC`~olnGnYqV_& z&b6cQTj(UJbZGiax#r4x2zSH~C>d2aD{fbr9=|o77;4?*oIPZR14fesVRO_hQw{zT zz1kmo-9*qI%N=&(m(Z!RWFY3z_$9;}=fv*eP>*a(IF&CtpCp(Hc>IR{s^CdwP;Zw9 n@eU{d0sY { Gtk.main_quit(); } ); this.ui_exit.clicked.connect( (source) => { Gtk.main_quit(); } ); + this.ui_about.clicked.connect( (source) => { - this.main_w.hide(); - about_w.show(); + + var builder2 = new Builder(); + builder2.add_from_file(GLib.Path.build_filename(this.basepath,"about.ui")); + var about_w = (Gtk.Dialog)builder2.get_object("aboutdialog"); + + about_w.show(); about_w.run(); about_w.hide(); - this.main_w.show(); + about_w.destroy(); } ); - + + this.ui_settings.clicked.connect( (source) => { + + var builder3 = new Builder(); + builder3.add_from_file(GLib.Path.build_filename(this.basepath,"settings.ui")); + var settings_w = (Gtk.Dialog)builder3.get_object("settings_dialog"); + + var ui_sw_scr = (Gtk.CheckButton)builder3.get_object("switch_screens"); + var ui_size = (Gtk.SpinButton)builder3.get_object("size_slide"); + + ui_sw_scr.active=Options.display_switch; + ui_size.value=Options.current_size; + + settings_w.show(); + if (settings_w.run()>0) { + Options.display_switch=ui_sw_scr.active; + Options.current_size=ui_size.get_value_as_int(); + this.write_configuration (); + } + settings_w.hide(); + settings_w.destroy(); + } ); + if (pdfFilename!=null) { var fname = File.new_for_path(pdfFilename); this.ui_file.set_file(fname); @@ -507,12 +548,9 @@ namespace pdfpc { this.do_slide (pdfFilename); } else { // Set the GUI options acording to the ones currently active - this.ui_sw_scr.active=Options.display_switch; this.ui_add_black_slide.active=Options.black_on_end; this.ui_duration.value=Options.duration; this.ui_alert.value=Options.last_minutes; - this.ui_size.value=Options.current_size; - main_w.show(); this.refresh_status(); } diff --git a/src/ui/main.ui b/src/ui/main.ui index d86b5955..780f4060 100644 --- a/src/ui/main.ui +++ b/src/ui/main.ui @@ -15,10 +15,13 @@ 1 10 - - 10 - 90 - 60 + + 23 + 1 + 10 + + + 59 1 10 @@ -26,15 +29,18 @@ 600 300 False + PDF Presentation Console center True False + 4 True False + 2 True @@ -62,6 +68,7 @@ False True + 6 0 @@ -77,14 +84,14 @@ - + True False - + True False - Duration (in minutes): + Alert time (in minutes): False @@ -93,7 +100,7 @@ - + True True 3 @@ -103,7 +110,7 @@ False True True - adjustment_duration + adjustment_alert False @@ -120,23 +127,27 @@ - + True False - + + Duration (in minutes): True - False - Alert time (in minutes): + True + False + False + True + True False - True + False 0 - + True True 3 @@ -146,7 +157,7 @@ False True True - adjustment_alert + adjustment_duration False @@ -163,13 +174,72 @@ - - Add additional slide in black at the end + True - True - False - False - True + False + + + End time: + True + True + False + False + True + use_duration_time + + + False + False + 0 + + + + + True + True + + False + False + True + True + end_hour + + + False + False + 1 + + + + + True + False + : + + + False + False + 3 + 2 + + + + + True + True + + False + False + True + True + end_minute + + + False + False + 3 + + False @@ -178,92 +248,27 @@ - + + Add additional slide in black at the end True - False + True + False + False + True - True + False True 5 - + True - True - - - True - False - - - Switch screens - True - True - False - False - True - - - False - True - 0 - - - - - True - False - - - True - False - Size for current slide (percentage): - - - False - True - 0 - - - - - True - True - - True - False - False - True - True - adjustment_size_slide - - - False - True - 1 - - - - - False - True - 1 - - - - - - - True - False - Advanced options - - + False - False + True True 6 @@ -319,6 +324,22 @@ 2 + + + gtk-preferences + True + True + True + False + True + + + False + False + 3 + True + + False diff --git a/src/ui/settings.ui b/src/ui/settings.ui new file mode 100644 index 00000000..18854cc5 --- /dev/null +++ b/src/ui/settings.ui @@ -0,0 +1,129 @@ + + + + + + 10 + 90 + 1 + 10 + + + False + 5 + Settings + True + center + dialog + + + True + False + 2 + + + True + False + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-apply + True + True + True + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + + + + Switch screens + True + True + False + False + True + + + False + True + 1 + + + + + True + False + + + True + False + Size for current slide (percentage): + + + False + True + 0 + + + + + True + True + + True + False + False + True + True + adjustment_size_slide + + + False + True + 1 + + + + + False + True + 2 + + + + + + button1 + button2 + + + From d17191debbd0562e98d17e296ea50c505faffa74 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 14 Jul 2012 01:38:40 +0200 Subject: [PATCH 10/18] Updated the translations --- po/POTFILES.in | 1 + po/es.po | 42 ++++++++++++++++++++++++++++-------------- po/gl.po | 42 ++++++++++++++++++++++++++++-------------- po/untitled.pot | 28 ++++++++++++++++++---------- 4 files changed, 75 insertions(+), 38 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 90a4a599..af42a182 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,3 +1,4 @@ src/pdfpc.vala [type: gettext/glade]src/ui/about.ui [type: gettext/glade]src/ui/main.ui +[type: gettext/glade]src/ui/settings.ui diff --git a/po/es.po b/po/es.po index 8a6b104f..7cf9d4e0 100644 --- a/po/es.po +++ b/po/es.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-06 23:44+0200\n" -"PO-Revision-Date: 2012-07-06 23:45+0200\n" +"POT-Creation-Date: 2012-07-14 01:37+0200\n" +"PO-Revision-Date: 2012-07-14 01:37+0200\n" "Last-Translator: Sergio Costas \n" "Language-Team: Español; Castellano \n" "Language: spanish\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bits\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: ../src/pdfpc.vala:319 +#: ../src/pdfpc.vala:383 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "Parámetro no válido en el fichero de configuración %s (línea %d)\n" @@ -31,33 +31,47 @@ msgstr "" "2012 David Vilar Torres" #: ../src/ui/main.ui.h:1 -msgid "PDF PC" -msgstr "PDF PC" +msgid "PDF Presentation Console" +msgstr "PDF Presentation Console" #: ../src/ui/main.ui.h:2 msgid "Presentation file: " msgstr "Presentación:" #: ../src/ui/main.ui.h:3 -msgid "Duration (in minutes): " -msgstr "Duración (en minutos):" - -#: ../src/ui/main.ui.h:4 msgid "Alert time (in minutes):" msgstr "Instante de alerta (en minutos):" +#: ../src/ui/main.ui.h:4 +msgid "Duration (in minutes): " +msgstr "Duración (en minutos):" + #: ../src/ui/main.ui.h:5 +msgid "End time:" +msgstr "Hora de fin:" + +#: ../src/ui/main.ui.h:6 +msgid ":" +msgstr ":" + +#: ../src/ui/main.ui.h:7 msgid "Add additional slide in black at the end" msgstr "Añadir al final una diapositiva en negro" -#: ../src/ui/main.ui.h:6 +#: ../src/ui/settings.ui.h:1 +msgid "Settings" +msgstr "Preferencias" + +#: ../src/ui/settings.ui.h:2 msgid "Switch screens" msgstr "Intercambiar pantallas" -#: ../src/ui/main.ui.h:7 +#: ../src/ui/settings.ui.h:3 msgid "Size for current slide (percentage):" msgstr "Tamaño para diapositiva actual (porcentaje):" -#: ../src/ui/main.ui.h:8 -msgid "Advanced options" -msgstr "Opciones avanzadas" +#~ msgid "PDF PC" +#~ msgstr "PDF PC" + +#~ msgid "Advanced options" +#~ msgstr "Opciones avanzadas" diff --git a/po/gl.po b/po/gl.po index a1b1e64f..16d2f1c0 100644 --- a/po/gl.po +++ b/po/gl.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-06 23:44+0200\n" -"PO-Revision-Date: 2012-07-06 23:46+0200\n" +"POT-Creation-Date: 2012-07-14 01:37+0200\n" +"PO-Revision-Date: 2012-07-14 01:37+0200\n" "Last-Translator: Sergio Costas \n" "Language-Team: Español; Castellano \n" "Language: spanish\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bits\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: ../src/pdfpc.vala:319 +#: ../src/pdfpc.vala:383 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "Parámetro non válido no arquivo de configurazón %s (liña %d)\n" @@ -31,33 +31,47 @@ msgstr "" "2012 David Vilar Torres" #: ../src/ui/main.ui.h:1 -msgid "PDF PC" -msgstr "PDF PC" +msgid "PDF Presentation Console" +msgstr "Pdf Presentation Console" #: ../src/ui/main.ui.h:2 msgid "Presentation file: " msgstr "Presentación: " #: ../src/ui/main.ui.h:3 -msgid "Duration (in minutes): " -msgstr "Durazón (en minutos):" - -#: ../src/ui/main.ui.h:4 msgid "Alert time (in minutes):" msgstr "Instante de alerta (en minutos):" +#: ../src/ui/main.ui.h:4 +msgid "Duration (in minutes): " +msgstr "Durazón (en minutos):" + #: ../src/ui/main.ui.h:5 +msgid "End time:" +msgstr "Hora de fin:" + +#: ../src/ui/main.ui.h:6 +msgid ":" +msgstr ":" + +#: ../src/ui/main.ui.h:7 msgid "Add additional slide in black at the end" msgstr "Engadir ó final unha diapositiva en negro" -#: ../src/ui/main.ui.h:6 +#: ../src/ui/settings.ui.h:1 +msgid "Settings" +msgstr "Preferencias" + +#: ../src/ui/settings.ui.h:2 msgid "Switch screens" msgstr "Intercambiar pantaias" -#: ../src/ui/main.ui.h:7 +#: ../src/ui/settings.ui.h:3 msgid "Size for current slide (percentage):" msgstr "Tamaño para a diapositiva actual (porcentaxe):" -#: ../src/ui/main.ui.h:8 -msgid "Advanced options" -msgstr "Opcións avanzadas" +#~ msgid "PDF PC" +#~ msgstr "PDF PC" + +#~ msgid "Advanced options" +#~ msgstr "Opcións avanzadas" diff --git a/po/untitled.pot b/po/untitled.pot index b1cdabaf..53b93405 100644 --- a/po/untitled.pot +++ b/po/untitled.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-06 23:44+0200\n" +"POT-Creation-Date: 2012-07-14 01:37+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/pdfpc.vala:319 +#: ../src/pdfpc.vala:383 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "" @@ -29,7 +29,7 @@ msgid "" msgstr "" #: ../src/ui/main.ui.h:1 -msgid "PDF PC" +msgid "PDF Presentation Console" msgstr "" #: ../src/ui/main.ui.h:2 @@ -37,25 +37,33 @@ msgid "Presentation file: " msgstr "" #: ../src/ui/main.ui.h:3 -msgid "Duration (in minutes): " +msgid "Alert time (in minutes):" msgstr "" #: ../src/ui/main.ui.h:4 -msgid "Alert time (in minutes):" +msgid "Duration (in minutes): " msgstr "" #: ../src/ui/main.ui.h:5 -msgid "Add additional slide in black at the end" +msgid "End time:" msgstr "" #: ../src/ui/main.ui.h:6 -msgid "Switch screens" +msgid ":" msgstr "" #: ../src/ui/main.ui.h:7 -msgid "Size for current slide (percentage):" +msgid "Add additional slide in black at the end" +msgstr "" + +#: ../src/ui/settings.ui.h:1 +msgid "Settings" msgstr "" -#: ../src/ui/main.ui.h:8 -msgid "Advanced options" +#: ../src/ui/settings.ui.h:2 +msgid "Switch screens" +msgstr "" + +#: ../src/ui/settings.ui.h:3 +msgid "Size for current slide (percentage):" msgstr "" From d23ded9ac69c6df991ac7ab2f8f0053a5fde8510 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 14 Jul 2012 22:48:01 +0200 Subject: [PATCH 11/18] Added option for pdfpcrc to allow to launch it without GUI directly --- src/classes/configFileReader.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/classes/configFileReader.vala b/src/classes/configFileReader.vala index d36d0ccb..bfcc44fc 100644 --- a/src/classes/configFileReader.vala +++ b/src/classes/configFileReader.vala @@ -158,6 +158,9 @@ namespace pdfpc { case "switch-screens": Options.display_switch = !Options.display_switch; break; + case "no-gui": + Options.run_now = !Options.run_now; + break; default: stderr.printf("Warning: Unknown command line \"%s\"\n", uncommentedLine); break; From a61472349791ce47c33175bc02961785658df120 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 14 Jul 2012 23:26:54 +0200 Subject: [PATCH 12/18] Now reads the duration from the .pdfpc metadata file --- src/pdfpc.vala | 64 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/src/pdfpc.vala b/src/pdfpc.vala index 5395751a..e98ed8a7 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -300,6 +300,49 @@ namespace pdfpc { } } + public void refresh_file() { + + var fname=this.ui_file.get_file(); + string pdf_basefname = fname.get_basename(); + int extension_index = pdf_basefname.last_index_of("."); + string pdfpc_basefname = pdf_basefname[0:extension_index] + ".pdfpc"; + var pdfpc_file = fname.get_parent().get_child(pdfpc_basefname); + + File file; + uint8[] raw_datau8; + + try { + file = File.new_for_uri(pdfpc_file.get_uri()); + file.load_contents(null, out raw_datau8, null); + GLib.stdout.printf("Found metadata file\n"); + } catch { + GLib.stdout.printf("No metadata file found\n"); + return; + } + + string[] lines = ((string) raw_datau8).split("\n"); + bool found=false; + + for (int i=0; i < lines.length; ++i) { + string l = lines[i].strip(); + if (found) { + GLib.stdout.printf("Found duration in metadata\n"); + Options.duration = int.parse(l); + break; + } else { + if (l == "[duration]") { + found=true; + } + } + } + + if (found) { + this.ui_duration.value=Options.duration; + this.ui_use_duration.set_active(true); + } + this.refresh_status (); + } + private int read_configuration() { /**************************************************************************************** @@ -489,9 +532,17 @@ namespace pdfpc { this.ui_end_hour = (Gtk.SpinButton)builder.get_object("end_hour_time"); this.ui_end_minute = (Gtk.SpinButton)builder.get_object("end_minute_time"); this.ui_use_duration = (Gtk.RadioButton)builder.get_object("use_duration_time"); + + var filter = new FileFilter(); + filter.set_name("PDF"); + filter.add_mime_type("text/pdf"); + filter.add_mime_type("text/x-pdf"); + filter.add_mime_type("application/pdf"); + filter.add_mime_type("application/x-pdf"); + this.ui_file.add_filter(filter); - this.ui_file.file_set.connect(this.refresh_status); - this.ui_file.selection_changed.connect(this.refresh_status); + this.ui_file.file_set.connect(this.refresh_file); + this.ui_file.selection_changed.connect(this.refresh_file); this.ui_go.clicked.connect(this.start_presentation); this.ui_use_duration.toggled.connect(this.refresh_status); @@ -536,13 +587,14 @@ namespace pdfpc { settings_w.destroy(); } ); - if (pdfFilename!=null) { - var fname = File.new_for_path(pdfFilename); - this.ui_file.set_file(fname); - } Gdk.threads_enter(); + if (pdfFilename!=null) { + var fname = File.new_for_path(pdfFilename); + this.ui_file.set_file(fname); + } + if (Options.run_now) { // If the user set the -r option, launch the presentation just now this.do_slide (pdfFilename); From 02e0e69bcbbad6520015656876fbc3a5bb49c7f6 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 14 Jul 2012 23:40:59 +0200 Subject: [PATCH 13/18] Added shadows to the icon --- icons/pdfpc.svg | 403 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 372 insertions(+), 31 deletions(-) diff --git a/icons/pdfpc.svg b/icons/pdfpc.svg index 85835659..3b25da90 100644 --- a/icons/pdfpc.svg +++ b/icons/pdfpc.svg @@ -7,6 +7,7 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg2" @@ -14,7 +15,7 @@ inkscape:version="0.48.3.1 r9886" width="300" height="430" - sodipodi:docname="speaking-in-church-lectern-speech.jpg"> + sodipodi:docname="pdfpc.svg"> @@ -23,12 +24,354 @@ image/svg+xml - + + id="defs6"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="g3938"> + style="fill:url(#linearGradient3936);fill-opacity:1;stroke:none" /> + style="fill:url(#linearGradient3933);fill-opacity:1;stroke:none" /> + style="fill:url(#linearGradient3930);fill-opacity:1;stroke:none" /> - - - - + style="fill:url(#linearGradient3927);fill-opacity:1;stroke:none" /> + + + style="fill:url(#linearGradient3918);fill-opacity:1;stroke:none" /> + style="fill:url(#linearGradient3915);fill-opacity:1;stroke:none" /> + style="fill:url(#linearGradient3912);fill-opacity:1;stroke:none" /> + d="M 46.182787,69.604124 58.35759,66.457428 210.28596,83.587167 200.15411,88.441542 z" + style="fill:url(#linearGradient3909);fill-opacity:1;stroke:none" /> + d="m 46.23057,110.56347 0,-40.939118 155.40155,18.102331 0,45.952077 z" + style="fill:url(#linearGradient3906);fill-opacity:1;stroke:none" /> From 359b8d7aa097e9b625494fe113c8783c5b7e478b Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 15 Jul 2012 00:33:57 +0200 Subject: [PATCH 14/18] Added file filters for PDF and ALL --- po/es.po | 10 +++++++--- po/gl.po | 10 +++++++--- po/untitled.pot | 8 ++++++-- src/pdfpc.vala | 5 +++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/po/es.po b/po/es.po index 7cf9d4e0..4bac2c6d 100644 --- a/po/es.po +++ b/po/es.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-14 01:37+0200\n" -"PO-Revision-Date: 2012-07-14 01:37+0200\n" +"POT-Creation-Date: 2012-07-15 00:30+0200\n" +"PO-Revision-Date: 2012-07-15 00:30+0200\n" "Last-Translator: Sergio Costas \n" "Language-Team: Español; Castellano \n" "Language: spanish\n" @@ -17,11 +17,15 @@ msgstr "" "Content-Transfer-Encoding: 8bits\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: ../src/pdfpc.vala:383 +#: ../src/pdfpc.vala:426 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "Parámetro no válido en el fichero de configuración %s (línea %d)\n" +#: ../src/pdfpc.vala:545 +msgid "All" +msgstr "Todos" + #: ../src/ui/about.ui.h:1 msgid "" "2009-2011 Jakob Westhoff\n" diff --git a/po/gl.po b/po/gl.po index 16d2f1c0..cb13f9c2 100644 --- a/po/gl.po +++ b/po/gl.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-14 01:37+0200\n" -"PO-Revision-Date: 2012-07-14 01:37+0200\n" +"POT-Creation-Date: 2012-07-15 00:30+0200\n" +"PO-Revision-Date: 2012-07-15 00:31+0200\n" "Last-Translator: Sergio Costas \n" "Language-Team: Español; Castellano \n" "Language: spanish\n" @@ -17,11 +17,15 @@ msgstr "" "Content-Transfer-Encoding: 8bits\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: ../src/pdfpc.vala:383 +#: ../src/pdfpc.vala:426 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "Parámetro non válido no arquivo de configurazón %s (liña %d)\n" +#: ../src/pdfpc.vala:545 +msgid "All" +msgstr "Todos" + #: ../src/ui/about.ui.h:1 msgid "" "2009-2011 Jakob Westhoff\n" diff --git a/po/untitled.pot b/po/untitled.pot index 53b93405..9dd37e5e 100644 --- a/po/untitled.pot +++ b/po/untitled.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-14 01:37+0200\n" +"POT-Creation-Date: 2012-07-15 00:30+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,11 +17,15 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/pdfpc.vala:383 +#: ../src/pdfpc.vala:426 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "" +#: ../src/pdfpc.vala:545 +msgid "All" +msgstr "" + #: ../src/ui/about.ui.h:1 msgid "" "2009-2011 Jakob Westhoff\n" diff --git a/src/pdfpc.vala b/src/pdfpc.vala index e98ed8a7..d556ae1f 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -540,6 +540,11 @@ namespace pdfpc { filter.add_mime_type("application/pdf"); filter.add_mime_type("application/x-pdf"); this.ui_file.add_filter(filter); + + var filter2 = new FileFilter(); + filter2.set_name(_("All")); + filter2.add_pattern("*"); + this.ui_file.add_filter(filter2); this.ui_file.file_set.connect(this.refresh_file); this.ui_file.selection_changed.connect(this.refresh_file); From c21981b9de86108cc9f3b6a4e321a8c0818310fd Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 15 Jul 2012 13:27:35 +0200 Subject: [PATCH 15/18] Now automatically installs all the .mo files in the right place, instead of having to add them manually to the CMakeLists.txt file --- po/CMakeLists.txt | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index ff4021dc..3b795165 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,4 +1,5 @@ file(GLOB list_po RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po) +file(GLOB list_mo RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.mo) foreach(file_po ${list_po}) string(REPLACE ".po" ".mo" file_mo ${file_po}) @@ -8,16 +9,13 @@ foreach(file_po ${list_po}) ) endforeach() -install(FILES - es.mo -DESTINATION - share/locale/es/LC_MESSAGES -RENAME pdfpc.mo -) +foreach(file_mo ${list_mo}) + string(REPLACE ".mo" "" file_lang ${file_mo}) + install(FILES + ${file_mo} + DESTINATION + share/locale/${file_lang}/LC_MESSAGES + RENAME pdfpc.mo + ) +endforeach() -install(FILES - gl.mo -DESTINATION - share/locale/gl/LC_MESSAGES -RENAME pdfpc.mo -) From e0619c13897ed0ebaffdf106b2e8c1ce4bb4476c Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 15 Jul 2012 13:31:20 +0200 Subject: [PATCH 16/18] The window status was not updated when choosing a PDF file without metadata. Fixed. --- src/pdfpc.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pdfpc.vala b/src/pdfpc.vala index d556ae1f..7ef3c96f 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -317,6 +317,7 @@ namespace pdfpc { GLib.stdout.printf("Found metadata file\n"); } catch { GLib.stdout.printf("No metadata file found\n"); + this.refresh_status (); return; } From 4c8508d1c90393b174d35439647b0693095ee40c Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 15 Jul 2012 13:55:03 +0200 Subject: [PATCH 17/18] Translated the "Until %H:%M" message --- po/POTFILES.in | 1 + po/es.po | 12 ++++++++---- po/gl.po | 12 ++++++++---- po/untitled.pot | 10 +++++++--- src/classes/timer_label.vala | 4 ++-- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index af42a182..0b1f4832 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,5 @@ src/pdfpc.vala +src/classes/timer_label.vala [type: gettext/glade]src/ui/about.ui [type: gettext/glade]src/ui/main.ui [type: gettext/glade]src/ui/settings.ui diff --git a/po/es.po b/po/es.po index 4bac2c6d..3336fd6c 100644 --- a/po/es.po +++ b/po/es.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-15 00:30+0200\n" -"PO-Revision-Date: 2012-07-15 00:30+0200\n" +"POT-Creation-Date: 2012-07-15 13:54+0200\n" +"PO-Revision-Date: 2012-07-15 13:54+0200\n" "Last-Translator: Sergio Costas \n" "Language-Team: Español; Castellano \n" "Language: spanish\n" @@ -17,15 +17,19 @@ msgstr "" "Content-Transfer-Encoding: 8bits\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: ../src/pdfpc.vala:426 +#: ../src/pdfpc.vala:427 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "Parámetro no válido en el fichero de configuración %s (línea %d)\n" -#: ../src/pdfpc.vala:545 +#: ../src/pdfpc.vala:546 msgid "All" msgstr "Todos" +#: ../src/classes/timer_label.vala:317 ../src/classes/timer_label.vala:323 +msgid "Until %H:%M" +msgstr "Hasta las %H:%M" + #: ../src/ui/about.ui.h:1 msgid "" "2009-2011 Jakob Westhoff\n" diff --git a/po/gl.po b/po/gl.po index cb13f9c2..231c9228 100644 --- a/po/gl.po +++ b/po/gl.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-15 00:30+0200\n" -"PO-Revision-Date: 2012-07-15 00:31+0200\n" +"POT-Creation-Date: 2012-07-15 13:54+0200\n" +"PO-Revision-Date: 2012-07-15 13:54+0200\n" "Last-Translator: Sergio Costas \n" "Language-Team: Español; Castellano \n" "Language: spanish\n" @@ -17,15 +17,19 @@ msgstr "" "Content-Transfer-Encoding: 8bits\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: ../src/pdfpc.vala:426 +#: ../src/pdfpc.vala:427 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "Parámetro non válido no arquivo de configurazón %s (liña %d)\n" -#: ../src/pdfpc.vala:545 +#: ../src/pdfpc.vala:546 msgid "All" msgstr "Todos" +#: ../src/classes/timer_label.vala:317 ../src/classes/timer_label.vala:323 +msgid "Until %H:%M" +msgstr "Ata as %H:%M" + #: ../src/ui/about.ui.h:1 msgid "" "2009-2011 Jakob Westhoff\n" diff --git a/po/untitled.pot b/po/untitled.pot index 9dd37e5e..848297e4 100644 --- a/po/untitled.pot +++ b/po/untitled.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-15 00:30+0200\n" +"POT-Creation-Date: 2012-07-15 13:54+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,15 +17,19 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/pdfpc.vala:426 +#: ../src/pdfpc.vala:427 #, c-format msgid "Invalid parameter in config file %s (line %d)\n" msgstr "" -#: ../src/pdfpc.vala:545 +#: ../src/pdfpc.vala:546 msgid "All" msgstr "" +#: ../src/classes/timer_label.vala:317 ../src/classes/timer_label.vala:323 +msgid "Until %H:%M" +msgstr "" + #: ../src/ui/about.ui.h:1 msgid "" "2009-2011 Jakob Westhoff\n" diff --git a/src/classes/timer_label.vala b/src/classes/timer_label.vala index 7173ae57..4580570a 100644 --- a/src/classes/timer_label.vala +++ b/src/classes/timer_label.vala @@ -314,13 +314,13 @@ namespace pdfpc { public override void stop() { base.stop(); - this.set_text(this.end_time_object.format("Until %H:%M")); + this.set_text(this.end_time_object.format(_("Until %H:%M"))); } public override void reset() { base.reset(); if ( this.timeout == 0 ) - this.set_text(this.end_time_object.format("Until %H:%M")); + this.set_text(this.end_time_object.format(_("Until %H:%M"))); } public override bool on_timeout() { From 766a2316826ad94b1f7bd5425cafbc9f67ebca2a Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 15 Jul 2012 13:59:42 +0200 Subject: [PATCH 18/18] The .mo installation changes only worked if the .mo files were already available when running cmake . (which is NOT the case, because they will be created AFTER running make). Fixed. --- po/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 3b795165..19e0fb2c 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,5 +1,4 @@ file(GLOB list_po RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po) -file(GLOB list_mo RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.mo) foreach(file_po ${list_po}) string(REPLACE ".po" ".mo" file_mo ${file_po}) @@ -9,7 +8,8 @@ foreach(file_po ${list_po}) ) endforeach() -foreach(file_mo ${list_mo}) +foreach(file_po ${list_po}) + string(REPLACE ".po" ".mo" file_mo ${file_po}) string(REPLACE ".mo" "" file_lang ${file_mo}) install(FILES ${file_mo}