From bb5d7b8a3395494b89a4485cde85eec48fe6588f Mon Sep 17 00:00:00 2001 From: fgerlits Date: Fri, 10 Aug 2007 18:01:53 +0000 Subject: [PATCH] refactoring, stage 5 (last, for now): sorted the remaining classes into either GuiWindow or GuiComponent --- campcaster/doc/gui/gladeConventions.html | 3 +- .../products/gLiveSupport/src/BackupView.cxx | 2 +- .../src/DateTimeChooserWindow.cxx | 21 +++--- .../gLiveSupport/src/DateTimeChooserWindow.h | 17 ++--- .../src/ExportFormatRadioButtons.cxx | 6 +- .../src/ExportFormatRadioButtons.h | 14 ++-- .../gLiveSupport/src/ExportPlaylistWindow.cxx | 26 +++----- .../gLiveSupport/src/ExportPlaylistWindow.h | 45 +++---------- .../gLiveSupport/src/LiveModeWindow.cxx | 44 ++++++------- .../gLiveSupport/src/MasterPanelWindow.h | 6 +- .../gLiveSupport/src/RestoreBackupWindow.cxx | 35 ++++------ .../gLiveSupport/src/RestoreBackupWindow.h | 41 ++++-------- .../src/SchedulePlaylistWindow.cxx | 22 +++---- .../gLiveSupport/src/SchedulePlaylistWindow.h | 39 ++--------- .../gLiveSupport/src/ScratchpadWindow.cxx | 43 +++--------- .../gLiveSupport/src/ScratchpadWindow.h | 4 +- .../gLiveSupport/src/SearchWindow.cxx | 52 +++++++-------- .../gLiveSupport/src/UploadFileWindow.cxx | 5 +- .../gLiveSupport/src/UploadFileWindow.h | 8 +-- .../var/glade/RestoreBackupWindow.glade | 65 +++++++++++++++++++ .../var/glade/UploadFileWindow.glade | 62 +----------------- 21 files changed, 208 insertions(+), 352 deletions(-) create mode 100644 campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade diff --git a/campcaster/doc/gui/gladeConventions.html b/campcaster/doc/gui/gladeConventions.html index b7b1e90a8..b7a4df0d4 100644 --- a/campcaster/doc/gui/gladeConventions.html +++ b/campcaster/doc/gui/gladeConventions.html @@ -37,7 +37,8 @@ based on the design documentation styleguide.pdf.

Each toplevel has its own file, named the same as the C++ class which controls it, with the extension .glade. For example: ScratchpadWindow.glade, LiveModeWindow.glade. -Pop-up dialogs go into the Glade file of the toplevel which pops them up. +Pop-up dialogs which do not have their own class go into the Glade file +of the toplevel which pops them up.

Each toplevel should be a GtkWindow, except for pop-ups like the Login window, confirmation dialogs etc., which are GtkDialogs or subclasses of it.

diff --git a/campcaster/src/products/gLiveSupport/src/BackupView.cxx b/campcaster/src/products/gLiveSupport/src/BackupView.cxx index 16bca4e61..ae522bf5f 100644 --- a/campcaster/src/products/gLiveSupport/src/BackupView.cxx +++ b/campcaster/src/products/gLiveSupport/src/BackupView.cxx @@ -101,7 +101,7 @@ BackupView :: BackupView (GuiObject * parent) constructCriteriaView(); constructBackupListView(); - dateTimeChooserWindow.reset(new DateTimeChooserWindow(gLiveSupport)); + dateTimeChooserWindow.reset(new DateTimeChooserWindow()); } diff --git a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx index 9874e5969..5088338eb 100644 --- a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx @@ -45,6 +45,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "dateTimeChooserWindow"; + /*------------------------------------------------------------------------------ * The name of the glade file. *----------------------------------------------------------------------------*/ @@ -60,21 +65,11 @@ const Glib::ustring gladeFileName = "DateTimeChooserWindow.glade"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -DateTimeChooserWindow :: DateTimeChooserWindow( - Ptr::Ref gLiveSupport) +DateTimeChooserWindow :: DateTimeChooserWindow (void) throw () + : GuiWindow(bundleName, + gladeFileName) { - Ptr::Ref - bundle = gLiveSupport->getBundle("dateTimeChooserWindow"); - setBundle(bundle); - - Glib::ustring gladeDir = gLiveSupport->getGladeDir(); - Glib::RefPtr - glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName); - - glade->get_widget("mainWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - Gtk::Label * hourLabel; Gtk::Label * minuteLabel; glade->get_widget("hourLabel1", hourLabel); diff --git a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h index 967e98bc1..c01a25fe8 100644 --- a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h +++ b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h @@ -40,15 +40,14 @@ #include "configure.h" #endif -#include -#include #include #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -74,15 +73,10 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class DateTimeChooserWindow : public LocalizedObject +class DateTimeChooserWindow : public GuiWindow { private: - /** - * The main window for this class. - */ - Gtk::Dialog * mainWindow; - /** * The calendar where the date is chosen. */ @@ -122,11 +116,8 @@ class DateTimeChooserWindow : public LocalizedObject /** * Constructor. - * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. */ - DateTimeChooserWindow(Ptr::Ref gLiveSupport) + DateTimeChooserWindow(void) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx index 511d86a8f..a0b5cc6f7 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx +++ b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx @@ -54,11 +54,9 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -ExportFormatRadioButtons :: ExportFormatRadioButtons( - Ptr::Ref bundle, - Glib::RefPtr glade) +ExportFormatRadioButtons :: ExportFormatRadioButtons(GuiObject * parent) throw () - : LocalizedObject(bundle) + : GuiComponent(parent) { glade->get_widget("internalFormatRadioButton1", internalFormatRadioButton); glade->get_widget("smilFormatRadioButton1", smilFormatRadioButton); diff --git a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h index de2055b57..e499a08fa 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h +++ b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h @@ -36,12 +36,10 @@ /* ============================================================ include files */ -#include -#include - -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/StorageClient/StorageClientInterface.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -64,7 +62,7 @@ using namespace LiveSupport::StorageClient; * @author $Author$ * @version $Revision$ */ -class ExportFormatRadioButtons : public LocalizedObject +class ExportFormatRadioButtons : public GuiComponent { private: @@ -84,11 +82,9 @@ class ExportFormatRadioButtons : public LocalizedObject /** * Constructor. * - * @param bundle the resource bundle holding the localized - * resources for this window. + * @param parent the GuiObject which contains this one. */ - ExportFormatRadioButtons(Ptr::Ref bundle, - Glib::RefPtr glade) + ExportFormatRadioButtons(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx index 2832b9882..1c83d315a 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx @@ -54,6 +54,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "exportPlaylistWindow"; + /*------------------------------------------------------------------------------ * The name of the glade file. *----------------------------------------------------------------------------*/ @@ -69,25 +74,12 @@ const Glib::ustring gladeFileName = "ExportPlaylistWindow.glade"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -ExportPlaylistWindow :: ExportPlaylistWindow( - Ptr::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr::Ref playlist) +ExportPlaylistWindow :: ExportPlaylistWindow(Ptr::Ref playlist) throw () - : gLiveSupport(gLiveSupport), + : GuiWindow(bundleName, + gladeFileName), playlist(playlist) { - Ptr::Ref bundle = gLiveSupport->getBundle( - "exportPlaylistWindow"); - setBundle(bundle); - - glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName); - - glade->get_widget("mainWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - mainWindow->signal_delete_event().connect(sigc::mem_fun(*this, - &ExportPlaylistWindow::onDeleteEvent)); - Gtk::Label * playlistTitleTextLabel; Gtk::Label * formatLabel; glade->get_widget("playlistTitleTextLabel1", playlistTitleTextLabel); @@ -105,7 +97,7 @@ ExportPlaylistWindow :: ExportPlaylistWindow( glade->connect_clicked("saveButton1", sigc::mem_fun(*this, &ExportPlaylistWindow::onSaveButtonClicked)); - formatButtons.reset(new ExportFormatRadioButtons(bundle, glade)); + formatButtons.reset(new ExportFormatRadioButtons(this)); } diff --git a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h index 1cca57c78..6c307084c 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h +++ b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h @@ -40,14 +40,12 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Playlist.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "ExportFormatRadioButtons.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -71,25 +69,10 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class ExportPlaylistWindow : public LocalizedObject +class ExportPlaylistWindow : public GuiWindow { private: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - - /** - * The Glade object, containing the visual design. - */ - Glib::RefPtr glade; - - /** - * The main window for this class. - */ - Gtk::Window * mainWindow; - /** * The playlist to be exported. */ @@ -129,8 +112,12 @@ class ExportPlaylistWindow : public LocalizedObject /** * Event handler called when the the window gets hidden. - * * It closes the exporting operations, if there is one in progress. + * + * Overrides GuiWindow::onDeleteEvent(). + * + * @param event attributes of the event. + * @return true if handled the event, false to continue deleting. */ virtual bool onDeleteEvent(GdkEventAny * event) throw (); @@ -141,14 +128,9 @@ class ExportPlaylistWindow : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param gladeDir the directory where the Glade files are. * @param playlist the playlist to be exported. */ - ExportPlaylistWindow(Ptr::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr::Ref playlist) + ExportPlaylistWindow(Ptr::Ref playlist) throw (); /** @@ -158,15 +140,6 @@ class ExportPlaylistWindow : public LocalizedObject ~ExportPlaylistWindow(void) throw () { } - - /** - * Get the underlying Gtk::Window. - */ - virtual Gtk::Window * - getWindow(void) throw () - { - return mainWindow; - } }; /* ================================================= external data structures */ diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index a5502e4d7..4ec96861e 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -400,17 +400,17 @@ LiveModeWindow :: onSchedulePlaylist(void) throw () { Gtk::TreeModel::iterator iter = getSelected(); - if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; - Ptr::Ref playlist = playable->getPlaylist(); - if (playlist) { - schedulePlaylistWindow.reset(new SchedulePlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*schedulePlaylistWindow->getWindow()); - } + if (!iter) { + return; + } + + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist)); + schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } } @@ -423,17 +423,17 @@ LiveModeWindow :: onExportPlaylist(void) throw () { Gtk::TreeModel::iterator iter = getSelected(); - if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; - Ptr::Ref playlist = playable->getPlaylist(); - if (playlist) { - exportPlaylistWindow.reset(new ExportPlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*exportPlaylistWindow->getWindow()); - } + if (!iter) { + return; + } + + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + + if (playlist) { + exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist)); + exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*exportPlaylistWindow->getWindow()); } } diff --git a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h index 635ba1def..b71ba194b 100644 --- a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h +++ b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h @@ -382,8 +382,10 @@ class MasterPanelWindow : public GuiWindow * Event handler for when the user closes the master panel. * It pops up a confirmation dialog. * - * @param event attributes for the event (?) - * @return true if handled the event, false to continue deleting + * Overrides GuiWindow::onDeleteEvent(). + * + * @param event attributes of the event. + * @return true if handled the event, false to continue deleting. */ virtual bool onDeleteEvent(GdkEventAny * event) throw (); diff --git a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx index f3a050197..1dcd44f08 100644 --- a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx @@ -44,6 +44,15 @@ using namespace LiveSupport::GLiveSupport; /* ================================================ local constants & macros */ namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "restoreBackupWindow"; + +/*------------------------------------------------------------------------------ + * The name of the glade file. + *----------------------------------------------------------------------------*/ +const Glib::ustring gladeFileName = "RestoreBackupWindow.glade"; /*------------------------------------------------------------------------------ * The interval between two calls to restoreBackupCheck(), in milliseconds. @@ -61,28 +70,18 @@ const unsigned int timerInterval = 10000; * Constructor. *----------------------------------------------------------------------------*/ RestoreBackupWindow :: RestoreBackupWindow ( - Ptr::Ref gLiveSupport, - Glib::RefPtr glade, Ptr::Ref fileName) throw () - : gLiveSupport(gLiveSupport), + : GuiWindow(bundleName, + gladeFileName), fileName(fileName), currentState(AsyncState::pendingState) { - Ptr::Ref bundle = gLiveSupport->getBundle( - "restoreBackupWindow"); - setBundle(bundle); - - glade->get_widget("restoreBackupWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - Gtk::Button * cancelButton; glade->get_widget("restoreBackupMessageLabel1", messageLabel); glade->get_widget("restoreBackupCancelButton1", cancelButton); glade->get_widget("restoreBackupOkButton1", okButton); - mainWindow->signal_delete_event().connect(sigc::mem_fun(*this, - &RestoreBackupWindow::onDeleteEvent)); cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &RestoreBackupWindow::onCancelButtonClicked)); okButton->signal_clicked().connect(sigc::mem_fun(*this, @@ -265,16 +264,6 @@ RestoreBackupWindow :: resetTimer(void) throw () } -/*------------------------------------------------------------------------------ - * Show the window. - *----------------------------------------------------------------------------*/ -void -RestoreBackupWindow :: show(void) throw () -{ - mainWindow->show(); -} - - /*------------------------------------------------------------------------------ * Close the connection and hide the window. *----------------------------------------------------------------------------*/ @@ -282,7 +271,7 @@ void RestoreBackupWindow :: hide(void) throw () { restoreBackupClose(); - mainWindow->hide(); + GuiWindow::hide(); } diff --git a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h index 53497a393..133b6ca2a 100644 --- a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h +++ b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h @@ -40,14 +40,12 @@ #include "configure.h" #endif -#include -#include -#include - #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/StorageClient/StorageClientInterface.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -69,20 +67,10 @@ using namespace LiveSupport::StorageClient; * @author $Author$ * @version $Revision$ */ -class RestoreBackupWindow : public LocalizedObject +class RestoreBackupWindow : public GuiWindow { private: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - - /** - * The main window for this class. - */ - Gtk::Window * mainWindow; - /** * The label holding the current message displayed by the window. */ @@ -130,6 +118,12 @@ class RestoreBackupWindow : public LocalizedObject /** * Event handler for closing the window from the window manager. + * Calls StorageClientInterface::restoreBackupClose(). + * + * Overrides GuiWindow::onDeleteEvent(). + * + * @param event attributes of the event. + * @return true if handled the event, false to continue deleting. */ virtual bool onDeleteEvent(GdkEventAny * event) throw (); @@ -220,15 +214,9 @@ class RestoreBackupWindow : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param glade the Glade object, which contains the - * visual design. * @param fileName the file name of the backup to be restored. */ - RestoreBackupWindow(Ptr::Ref gLiveSupport, - Glib::RefPtr glade, - Ptr::Ref fileName) + RestoreBackupWindow(Ptr::Ref fileName) throw (); /** @@ -239,14 +227,11 @@ class RestoreBackupWindow : public LocalizedObject { } - /** - * Show the window. - */ - virtual void - show(void) throw (); - /** * Close the connection and hide the window. + * Calls StorageClientInterface::restoreBackupClose(). + * + * Overrides GuiWindow::hide(). */ virtual void hide(void) throw (); diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx index 86cc4fe85..d3b9c88bc 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx @@ -51,6 +51,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "schedulePlaylistWindow"; + /*------------------------------------------------------------------------------ * The name of the glade file. *----------------------------------------------------------------------------*/ @@ -66,23 +71,12 @@ const Glib::ustring gladeFileName = "SchedulePlaylistWindow.glade"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -SchedulePlaylistWindow :: SchedulePlaylistWindow ( - Ptr::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr::Ref playlist) +SchedulePlaylistWindow :: SchedulePlaylistWindow (Ptr::Ref playlist) throw () - : gLiveSupport(gLiveSupport), + : GuiWindow(bundleName, + gladeFileName), playlist(playlist) { - Ptr::Ref bundle = gLiveSupport->getBundle( - "schedulePlaylistWindow"); - setBundle(bundle); - - glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName); - - glade->get_widget("mainWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - Gtk::Label * playlistLabel; glade->get_widget("playlistLabel1", playlistLabel); playlistLabel->set_label(*playlist->getTitle()); diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h index 2e43e2e57..0ab469388 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h @@ -41,14 +41,12 @@ #endif #include -#include -#include -#include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -84,25 +82,10 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class SchedulePlaylistWindow : public LocalizedObject +class SchedulePlaylistWindow : public GuiWindow { private: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - - /** - * The Glade object, containing the visual design. - */ - Glib::RefPtr glade; - - /** - * The main window for this class. - */ - Gtk::Window * mainWindow; - /** * The playlist to schedule. */ @@ -143,14 +126,9 @@ class SchedulePlaylistWindow : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param gladeDir the directory where the Glade files are. * @param playlist the playlist to schedule. */ - SchedulePlaylistWindow(Ptr::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr::Ref playlist) + SchedulePlaylistWindow(Ptr::Ref playlist) throw (); /** @@ -160,15 +138,6 @@ class SchedulePlaylistWindow : public LocalizedObject ~SchedulePlaylistWindow(void) throw () { } - - /** - * Get the underlying Gtk::Window. - */ - virtual Gtk::Window * - getWindow(void) throw () - { - return mainWindow; - } }; /* ================================================= external data structures */ diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx index da8702022..43a6d1b8f 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -293,31 +293,13 @@ void ScratchpadWindow :: onSchedulePlaylist(void) throw () { Ptr::Ref playable = currentRow[modelColumns.playableColumn]; - Ptr::Ref uid = playable->getId(); + Ptr::Ref playlist = playable->getPlaylist(); - Ptr::Ref playlist; - - try { - if (!gLiveSupport->existsPlaylist(uid)) { - return; - } - - playlist = gLiveSupport->getPlaylist(uid); - - } catch (std::invalid_argument &e) { - std::cerr << e.what() << std::endl; - return; - } catch (XmlRpcException &e) { - std::cerr << "error in ScratchpadWindow::onSchedulePlaylist(): " - << e.what() << std::endl; - return; + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist)); + schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } - - schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - - Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } @@ -330,17 +312,10 @@ ScratchpadWindow :: onExportPlaylist(void) throw () Ptr::Ref playable = currentRow[modelColumns.playableColumn]; Ptr::Ref playlist = playable->getPlaylist(); - try { - if (playlist) { - exportPlaylistWindow.reset(new ExportPlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*exportPlaylistWindow->getWindow()); - } - } catch (std::invalid_argument &e) { - std::cerr << e.what() << std::endl; + if (playlist) { + exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist)); + exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*exportPlaylistWindow->getWindow()); } } diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h index cd5bc08c0..a670dc55f 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h @@ -45,12 +45,14 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeView.h" -#include "GuiWindow.h" #include "CuePlayer.h" #include "ContentsStorable.h" #include "ExportPlaylistWindow.h" #include "SchedulePlaylistWindow.h" +#include "GuiWindow.h" + + namespace LiveSupport { namespace GLiveSupport { diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx index dbf15b8ee..4949d8881 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx @@ -754,17 +754,17 @@ SearchWindow :: onSchedulePlaylist(void) throw () Gtk::TreeModel::iterator iter = refSelection->get_selected(); - if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; - Ptr::Ref playlist = playable->getPlaylist(); - if (playlist) { - schedulePlaylistWindow.reset(new SchedulePlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*schedulePlaylistWindow->getWindow()); - } + if (!iter) { + return; + } + + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist)); + schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } } @@ -780,25 +780,17 @@ SearchWindow :: onExportPlaylist(void) throw () Gtk::TreeModel::iterator iter = refSelection->get_selected(); - if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; - if (playable) { - Ptr::Ref playlist = playable->getPlaylist(); - if (playlist) { - try { - exportPlaylistWindow.reset(new ExportPlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - } catch (std::invalid_argument &e) { - std::cerr << e.what() << std::endl; - return; - } - exportPlaylistWindow->getWindow()->set_transient_for( - *mainWindow); - Gtk::Main::run(*exportPlaylistWindow->getWindow()); - } - } + if (!iter) { + return; + } + + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr::Ref playlist = playable->getPlaylist(); + + if (playlist) { + exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist)); + exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*exportPlaylistWindow->getWindow()); } } diff --git a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx index b82db0198..41b8b4d51 100644 --- a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx @@ -455,10 +455,7 @@ UploadFileWindow :: uploadStorageArchive(void) throw () fileNameEntry->get_text() )); Ptr::Ref restoreBackupWindow( - new RestoreBackupWindow( - gLiveSupport, - glade, - path)); + new RestoreBackupWindow(path)); restoreBackupWindow->show(); restoreBackupWindowList.push_back(restoreBackupWindow); diff --git a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h index ad1200282..8a640c1e6 100644 --- a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h +++ b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h @@ -40,15 +40,15 @@ #include "configure.h" #endif -#include "GuiWindow.h" -#include "LiveSupport/Core/NumericTools.h" - #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Widgets/ComboBoxText.h" #include "RestoreBackupWindow.h" #include "GLiveSupport.h" +#include "GuiWindow.h" +#include "LiveSupport/Core/NumericTools.h" + + namespace LiveSupport { namespace GLiveSupport { diff --git a/campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade b/campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade new file mode 100644 index 000000000..d07df13d0 --- /dev/null +++ b/campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade @@ -0,0 +1,65 @@ + + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8 + GTK_WIN_POS_CENTER_ALWAYS + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + uploading backup file +please wait... + GTK_JUSTIFY_CENTER + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8 + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-cancel + True + -6 + + + + + True + False + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-ok + True + -5 + + + 1 + + + + + False + False + 1 + + + + + + diff --git a/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade b/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade index 984634ea7..627e74300 100644 --- a/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade +++ b/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade @@ -1,6 +1,6 @@ - + 380 @@ -1694,64 +1694,4 @@ - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8 - GTK_WIN_POS_CENTER_ALWAYS - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - uploading backup file -please wait... - GTK_JUSTIFY_CENTER - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8 - GTK_BUTTONBOX_END - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-cancel - True - -6 - - - - - True - False - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok - True - -5 - - - 1 - - - - - False - False - 1 - - - - -