From 8b9ad7968d2f7bff59c83cd39d39c2ac5f4aef10 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Fri, 10 Aug 2007 13:49:12 +0000 Subject: [PATCH] refactoring, stage 4: sub-windows now just get one pointer to their parent, as the first parameter to their constructor, instead of various collections of gLiveSupport, bundle and glade, in various orders. --- .../AudioPlayerEventListener.h | 1 + .../src/products/gLiveSupport/etc/Makefile.in | 1 + .../gLiveSupport/src/AdvancedSearchEntry.cxx | 25 ++-- .../gLiveSupport/src/AdvancedSearchEntry.h | 21 +--- .../gLiveSupport/src/AdvancedSearchItem.cxx | 9 +- .../gLiveSupport/src/AdvancedSearchItem.h | 19 ++- .../products/gLiveSupport/src/BackupList.cxx | 7 +- .../products/gLiveSupport/src/BackupList.h | 25 +--- .../products/gLiveSupport/src/BackupView.cxx | 26 ++--- .../products/gLiveSupport/src/BackupView.h | 26 +---- .../products/gLiveSupport/src/BrowseEntry.cxx | 24 ++-- .../products/gLiveSupport/src/BrowseEntry.h | 18 +-- .../products/gLiveSupport/src/BrowseItem.cxx | 11 +- .../products/gLiveSupport/src/BrowseItem.h | 34 ++---- .../products/gLiveSupport/src/CuePlayer.cxx | 7 +- .../src/products/gLiveSupport/src/CuePlayer.h | 29 ++--- .../gLiveSupport/src/GuiComponent.cxx | 71 +++++++++++ .../products/gLiveSupport/src/GuiComponent.h | 110 ++++++++++++++++++ .../products/gLiveSupport/src/GuiObject.cxx | 10 +- .../src/products/gLiveSupport/src/GuiObject.h | 21 +++- .../products/gLiveSupport/src/GuiWindow.cxx | 10 +- .../src/products/gLiveSupport/src/GuiWindow.h | 7 +- .../gLiveSupport/src/LiveModeWindow.cxx | 5 +- .../gLiveSupport/src/MasterPanelWindow.cxx | 6 +- .../products/gLiveSupport/src/NowPlaying.cxx | 12 +- .../products/gLiveSupport/src/NowPlaying.h | 58 ++++----- .../gLiveSupport/src/OptionsWindow.cxx | 4 +- .../products/gLiveSupport/src/RdsEntry.cxx | 13 +-- .../src/products/gLiveSupport/src/RdsEntry.h | 26 ++--- .../src/products/gLiveSupport/src/RdsView.cxx | 25 ++-- .../src/products/gLiveSupport/src/RdsView.h | 22 ++-- .../gLiveSupport/src/ScratchpadWindow.cxx | 5 +- .../gLiveSupport/src/SearchWindow.cxx | 9 +- .../gLiveSupport/src/TransportList.cxx | 13 ++- .../products/gLiveSupport/src/TransportList.h | 25 +--- 35 files changed, 394 insertions(+), 341 deletions(-) create mode 100644 campcaster/src/products/gLiveSupport/src/GuiComponent.cxx create mode 100644 campcaster/src/products/gLiveSupport/src/GuiComponent.h diff --git a/campcaster/src/modules/playlistExecutor/include/LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h b/campcaster/src/modules/playlistExecutor/include/LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h index dfa5736cd..2fe470ea7 100644 --- a/campcaster/src/modules/playlistExecutor/include/LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h +++ b/campcaster/src/modules/playlistExecutor/include/LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h @@ -42,6 +42,7 @@ #include #include +#include #include "LiveSupport/Core/Ptr.h" diff --git a/campcaster/src/products/gLiveSupport/etc/Makefile.in b/campcaster/src/products/gLiveSupport/etc/Makefile.in index d4303913e..831f767cd 100644 --- a/campcaster/src/products/gLiveSupport/etc/Makefile.in +++ b/campcaster/src/products/gLiveSupport/etc/Makefile.in @@ -260,6 +260,7 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \ ${TMP_DIR}/NowPlaying.o \ ${TMP_DIR}/GuiObject.o \ ${TMP_DIR}/GuiWindow.o \ + ${TMP_DIR}/GuiComponent.o \ ${TMP_DIR}/LoginWindow.o \ ${TMP_DIR}/UploadFileWindow.o \ ${TMP_DIR}/ScratchpadWindow.o \ diff --git a/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.cxx b/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.cxx index 7ba48d490..daaf4126d 100644 --- a/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.cxx +++ b/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.cxx @@ -48,10 +48,15 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "advancedSearchEntry"; + /*------------------------------------------------------------------------------ * The maximum number of AdvancedSearchItem children. *----------------------------------------------------------------------------*/ -const int maxChildren = 5; +const int maxChildren = 5; } @@ -63,16 +68,11 @@ const int maxChildren = 5; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -AdvancedSearchEntry :: AdvancedSearchEntry( - Ptr::Ref gLiveSupport, - Glib::RefPtr glade) +AdvancedSearchEntry :: AdvancedSearchEntry(GuiObject * parent) throw () - : gLiveSupport(gLiveSupport) + : GuiComponent(parent, + bundleName) { - Ptr::Ref bundle = gLiveSupport->getBundle( - "advancedSearchEntry"); - setBundle(bundle); - metadataTypes = gLiveSupport->getMetadataTypeContainer(); Gtk::Label * fileTypeLabel; @@ -87,10 +87,9 @@ AdvancedSearchEntry :: AdvancedSearchEntry( for (int i = 0; i < maxChildren; ++i) { Ptr::Ref searchItem(new AdvancedSearchItem( - i, - metadataTypes, - getBundle(), - glade)); + this, + i, + metadataTypes)); children.push_back(searchItem); } diff --git a/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.h b/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.h index ae7a56801..e1ffd97d6 100644 --- a/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.h +++ b/campcaster/src/products/gLiveSupport/src/AdvancedSearchEntry.h @@ -41,17 +41,17 @@ #endif #include -#include -#include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/MetadataTypeContainer.h" #include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Widgets/ComboBoxText.h" #include "AdvancedSearchItem.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + + namespace LiveSupport { namespace GLiveSupport { @@ -72,14 +72,9 @@ using namespace LiveSupport::Widgets; * @author $Author$ * @version $Revision$ */ -class AdvancedSearchEntry : public LocalizedObject +class AdvancedSearchEntry : public GuiComponent { private: - - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; /** * A container holding all known metadata types. @@ -102,13 +97,9 @@ class AdvancedSearchEntry : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the GLiveSupport object, containing - * all the vital info. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - AdvancedSearchEntry(Ptr::Ref gLiveSupport, - Glib::RefPtr glade) + AdvancedSearchEntry(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.cxx b/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.cxx index b9a0b8575..5e1605e61 100644 --- a/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.cxx +++ b/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.cxx @@ -56,12 +56,11 @@ using namespace LiveSupport::GLiveSupport; * Constructor. *----------------------------------------------------------------------------*/ AdvancedSearchItem :: AdvancedSearchItem( + GuiObject * parent, int index, - Ptr::Ref metadataTypes, - Ptr::Ref bundle, - Glib::RefPtr glade) + Ptr::Ref metadataTypes) throw () - : LocalizedObject(bundle) + : GuiComponent(parent) { glade->get_widget(addIndex("advancedSearchItem", index), enclosingBox); @@ -75,7 +74,7 @@ AdvancedSearchItem :: AdvancedSearchItem( glade->get_widget_derived(addIndex("advancedOperatorEntry", index), operatorEntry); - operatorEntry->setContents(bundle); + operatorEntry->setContents(getBundle()); glade->get_widget(addIndex("advancedValueEntry", index), valueEntry); diff --git a/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.h b/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.h index 8fcc47c11..42f01b72e 100644 --- a/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.h +++ b/campcaster/src/products/gLiveSupport/src/AdvancedSearchItem.h @@ -42,17 +42,16 @@ #include #include -#include -#include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/NumericTools.h" #include "LiveSupport/Core/MetadataTypeContainer.h" #include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Widgets/MetadataComboBoxText.h" #include "LiveSupport/Widgets/OperatorComboBoxText.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -74,7 +73,7 @@ using namespace LiveSupport::Widgets; * @author $Author$ * @version $Revision$ */ -class AdvancedSearchItem : public LocalizedObject, +class AdvancedSearchItem : public GuiComponent, private NumericTools { private: @@ -138,18 +137,14 @@ class AdvancedSearchItem : public LocalizedObject, /** * Constructor. * + * @param parent the GuiObject which contains this one. * @param index the position of this item in the list of * advanced search items. * @param metadataTypes container holding all known metadata types - * @param bundle the resource bundle holding the localized - * resources for this widget. - * @param glade the Glade file which specifies the visual - * components for this class. */ - AdvancedSearchItem(int index, - Ptr::Ref metadataTypes, - Ptr::Ref bundle, - Glib::RefPtr glade) + AdvancedSearchItem(GuiObject * parent, + int index, + Ptr::Ref metadataTypes) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/BackupList.cxx b/campcaster/src/products/gLiveSupport/src/BackupList.cxx index a4b0452a1..26a3586bd 100644 --- a/campcaster/src/products/gLiveSupport/src/BackupList.cxx +++ b/campcaster/src/products/gLiveSupport/src/BackupList.cxx @@ -77,12 +77,9 @@ const Glib::ustring userPreferencesKeyName = "activeBackups"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -BackupList :: BackupList (Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) +BackupList :: BackupList (GuiObject * parent) throw () - : LocalizedObject(bundle), - gLiveSupport(gLiveSupport) + : GuiComponent(parent) { // create the tree view treeModel = Gtk::ListStore::create(modelColumns); diff --git a/campcaster/src/products/gLiveSupport/src/BackupList.h b/campcaster/src/products/gLiveSupport/src/BackupList.h index bf3a2c994..3535c3a52 100644 --- a/campcaster/src/products/gLiveSupport/src/BackupList.h +++ b/campcaster/src/products/gLiveSupport/src/BackupList.h @@ -40,16 +40,15 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/XmlRpcException.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeView.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + + namespace LiveSupport { namespace GLiveSupport { @@ -88,7 +87,7 @@ using namespace LiveSupport::Widgets; * @author $Author$ * @version $Revision$ */ -class BackupList : public LocalizedObject, +class BackupList : public GuiComponent, public ContentsStorable { private: @@ -144,11 +143,6 @@ class BackupList : public LocalizedObject, protected: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - /** * The columns model needed by ZebraTreeView. * @@ -224,16 +218,9 @@ class BackupList : public LocalizedObject, /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param bundle the resource bundle holding the localized - * resources for this window. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - BackupList(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) + BackupList(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/BackupView.cxx b/campcaster/src/products/gLiveSupport/src/BackupView.cxx index c3fb21719..16bca4e61 100644 --- a/campcaster/src/products/gLiveSupport/src/BackupView.cxx +++ b/campcaster/src/products/gLiveSupport/src/BackupView.cxx @@ -39,10 +39,6 @@ #error need pwd.h #endif -#include -#include -#include - #include "LiveSupport/Core/FileTools.h" #include "BackupView.h" @@ -57,6 +53,14 @@ using namespace boost::posix_time; /* ================================================ local constants & macros */ +namespace { + +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "backupView"; + +} /* =============================================== local function prototypes */ @@ -66,15 +70,11 @@ using namespace boost::posix_time; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -BackupView :: BackupView (Ptr::Ref gLiveSupport, - Glib::RefPtr glade) +BackupView :: BackupView (GuiObject * parent) throw () - : gLiveSupport(gLiveSupport), - glade(glade) + : GuiComponent(parent, + bundleName) { - Ptr::Ref bundle = gLiveSupport->getBundle("backupView"); - setBundle(bundle); - Gtk::Label * backupTitleLabel; Gtk::Label * mtimeLabel; Gtk::Button * chooseTimeButton; @@ -111,7 +111,7 @@ BackupView :: BackupView (Ptr::Ref gLiveSupport, void BackupView :: constructCriteriaView(void) throw () { - criteriaEntry.reset(new AdvancedSearchEntry(gLiveSupport, glade)); + criteriaEntry.reset(new AdvancedSearchEntry(this)); criteriaEntry->connectCallback(sigc::mem_fun(*this, &BackupView::onCreateBackup)); @@ -129,7 +129,7 @@ BackupView :: constructCriteriaView(void) throw () void BackupView :: constructBackupListView(void) throw () { - backupList.reset(new BackupList(gLiveSupport, getBundle(), glade)); + backupList.reset(new BackupList(this)); glade->connect_clicked("backupDeleteButton1", sigc::mem_fun(*this, &BackupView::onDeleteButtonClicked)); diff --git a/campcaster/src/products/gLiveSupport/src/BackupView.h b/campcaster/src/products/gLiveSupport/src/BackupView.h index 48631d78a..abaff7347 100644 --- a/campcaster/src/products/gLiveSupport/src/BackupView.h +++ b/campcaster/src/products/gLiveSupport/src/BackupView.h @@ -40,18 +40,18 @@ #include "configure.h" #endif -#include -#include #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/TimeConversion.h" #include "DateTimeChooserWindow.h" #include "AdvancedSearchEntry.h" #include "BackupList.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + + namespace LiveSupport { namespace GLiveSupport { @@ -88,7 +88,7 @@ using namespace boost::posix_time; * @author $Author$ * @version $Revision$ */ -class BackupView : public LocalizedObject +class BackupView : public GuiComponent { private: @@ -156,16 +156,6 @@ class BackupView : public LocalizedObject protected: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - - /** - * The Glade object, which specifies the visual components. - */ - Glib::RefPtr glade; - /** * Event handler for the time chooser button being clicked. */ @@ -202,13 +192,9 @@ class BackupView : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - BackupView(Ptr::Ref gLiveSupport, - Glib::RefPtr glade) + BackupView(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/BrowseEntry.cxx b/campcaster/src/products/gLiveSupport/src/BrowseEntry.cxx index 6e6d29971..4c0f08dcf 100644 --- a/campcaster/src/products/gLiveSupport/src/BrowseEntry.cxx +++ b/campcaster/src/products/gLiveSupport/src/BrowseEntry.cxx @@ -55,26 +55,18 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -BrowseEntry :: BrowseEntry(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) +BrowseEntry :: BrowseEntry(GuiObject * parent) throw () - : LocalizedObject(bundle) + : GuiComponent(parent) { - browseItemOne.reset(new BrowseItem(0, - gLiveSupport, - bundle, - glade, + browseItemOne.reset(new BrowseItem(this, + 0, 4 /* Genre */)); - browseItemTwo.reset(new BrowseItem(1, - gLiveSupport, - bundle, - glade, + browseItemTwo.reset(new BrowseItem(this, + 1, 1 /* Creator */)); - browseItemThree.reset(new BrowseItem(2, - gLiveSupport, - bundle, - glade, + browseItemThree.reset(new BrowseItem(this, + 2, 2 /* Album */)); // TODO: change hard-coded indices to stuff read from config diff --git a/campcaster/src/products/gLiveSupport/src/BrowseEntry.h b/campcaster/src/products/gLiveSupport/src/BrowseEntry.h index 2f59de278..947d43c16 100644 --- a/campcaster/src/products/gLiveSupport/src/BrowseEntry.h +++ b/campcaster/src/products/gLiveSupport/src/BrowseEntry.h @@ -40,15 +40,13 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/SearchCriteria.h" #include "BrowseItem.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -69,7 +67,7 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class BrowseEntry : public LocalizedObject +class BrowseEntry : public GuiComponent { private: @@ -99,15 +97,9 @@ class BrowseEntry : public LocalizedObject /** * Constructor with localization parameter. * - * @param gLiveSupport the GLiveSupport object, containing - * all the vital info. - * @param bundle the resource bundle for localization. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - BrowseEntry(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) + BrowseEntry(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx b/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx index 6cd36ed32..14c573526 100644 --- a/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx +++ b/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx @@ -56,14 +56,11 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -BrowseItem :: BrowseItem(int index, - Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade, - int defaultIndex) +BrowseItem :: BrowseItem(GuiObject * parent, + int index, + int defaultIndex) throw () - : LocalizedObject(bundle), - gLiveSupport(gLiveSupport) + : GuiComponent(parent) { parentCriteria.reset(new SearchCriteria); diff --git a/campcaster/src/products/gLiveSupport/src/BrowseItem.h b/campcaster/src/products/gLiveSupport/src/BrowseItem.h index efa38dc43..569b2af2e 100644 --- a/campcaster/src/products/gLiveSupport/src/BrowseItem.h +++ b/campcaster/src/products/gLiveSupport/src/BrowseItem.h @@ -42,19 +42,17 @@ #include #include -#include -#include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/NumericTools.h" #include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Widgets/MetadataComboBoxText.h" #include "LiveSupport/Widgets/ZebraTreeView.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" - #include "GLiveSupport.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -83,7 +81,7 @@ using namespace LiveSupport::Widgets; * @author $Author$ * @version $Revision$ */ -class BrowseItem : public LocalizedObject, +class BrowseItem : public GuiComponent, private NumericTools { private: @@ -150,11 +148,6 @@ class BrowseItem : public LocalizedObject, */ Glib::ustring allString; - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - /** * The criteria from the browse items to the left of this one. */ @@ -188,20 +181,15 @@ class BrowseItem : public LocalizedObject, /** * Constructor with parent and localization parameter. * - * @param index the position of this item in the list of - * browse items. - * @param gLiveSupport the main program object - * @param bundle the resource bundle for localization - * @param glade the Glade file which specifies the visual - * components for this class. - * @param defaultIndex the index of the metadata entry to display - * initially + * @param parent the GuiObject which contains this one. + * @param index the position of this item in the list of + * browse items. + * @param defaultIndex the index of the metadata entry to display + * initially */ - BrowseItem(int index, - Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade, - int defaultIndex) + BrowseItem(GuiObject * parent, + int index, + int defaultIndex) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/CuePlayer.cxx b/campcaster/src/products/gLiveSupport/src/CuePlayer.cxx index 83fd2863a..329484ce9 100644 --- a/campcaster/src/products/gLiveSupport/src/CuePlayer.cxx +++ b/campcaster/src/products/gLiveSupport/src/CuePlayer.cxx @@ -68,12 +68,11 @@ const Glib::ustring pauseStockImageName = "gtk-media-pause"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -CuePlayer :: CuePlayer(Ptr::Ref gLiveSupport, +CuePlayer :: CuePlayer(GuiObject * parent, Gtk::TreeView * treeView, - const PlayableTreeModelColumnRecord & modelColumns, - Glib::RefPtr glade) + const PlayableTreeModelColumnRecord & modelColumns) throw () - : gLiveSupport(gLiveSupport), + : GuiComponent(parent), treeView(treeView), modelColumns(modelColumns) { diff --git a/campcaster/src/products/gLiveSupport/src/CuePlayer.h b/campcaster/src/products/gLiveSupport/src/CuePlayer.h index 6c021ec12..e9ebb308a 100644 --- a/campcaster/src/products/gLiveSupport/src/CuePlayer.h +++ b/campcaster/src/products/gLiveSupport/src/CuePlayer.h @@ -40,15 +40,13 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h" #include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h" - #include "GLiveSupport.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -71,9 +69,11 @@ using namespace LiveSupport::Widgets; * @author $Author$ * @version $Revision$ */ -class CuePlayer : public PlaylistExecutor::AudioPlayerEventListener +class CuePlayer : public GuiComponent, + public PlaylistExecutor::AudioPlayerEventListener { private: + /** * The possible states of the (cue) audio player. */ @@ -94,11 +94,6 @@ class CuePlayer : public PlaylistExecutor::AudioPlayerEventListener */ Gtk::Button * stopButton; - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - /** * The Gtk::TreeView of the parent. */ @@ -145,19 +140,17 @@ class CuePlayer : public PlaylistExecutor::AudioPlayerEventListener public: + /** * Constructor with parent parameters. * - * @param gLiveSupport the GLiveSupport, application object. - * @param treeView the TreeView object showing the selection. - * @param modelColumns the object holding the types of the columns. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. + * @param treeView the TreeView object showing the selection. + * @param modelColumns the object holding the types of the columns. */ - CuePlayer(Ptr::Ref gLiveSupport, + CuePlayer(GuiObject * parent, Gtk::TreeView * treeView, - const PlayableTreeModelColumnRecord & modelColumns, - Glib::RefPtr glade) + const PlayableTreeModelColumnRecord & modelColumns) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/GuiComponent.cxx b/campcaster/src/products/gLiveSupport/src/GuiComponent.cxx new file mode 100644 index 000000000..463a5bc18 --- /dev/null +++ b/campcaster/src/products/gLiveSupport/src/GuiComponent.cxx @@ -0,0 +1,71 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the Campcaster project. + http://campcaster.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + Campcaster is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Campcaster is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Campcaster; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 3204 $ + Location : $URL: svn://code.campware.org/campcaster/trunk/campcaster/src/products/gLiveSupport/src/GuiComponent.cxx $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "GLiveSupport.h" +#include "GuiComponent.h" + + +using namespace LiveSupport::Core; +using namespace LiveSupport::GLiveSupport; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Protected constructor. + *----------------------------------------------------------------------------*/ +GuiComponent :: GuiComponent (GuiObject * parent, + const Glib::ustring & bundleName) + throw () + : GuiObject(), + parent(parent) +{ + if (bundleName == "") { + setBundle(parent->getBundle()); + } else { + setBundle(gLiveSupport->getBundle(bundleName)); + } + + glade = parent->getGlade(); +} + diff --git a/campcaster/src/products/gLiveSupport/src/GuiComponent.h b/campcaster/src/products/gLiveSupport/src/GuiComponent.h new file mode 100644 index 000000000..179fd1b71 --- /dev/null +++ b/campcaster/src/products/gLiveSupport/src/GuiComponent.h @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the Campcaster project. + http://campcaster.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + Campcaster is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Campcaster is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Campcaster; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author$ + Version : $Revision$ + Location : $URL$ + +------------------------------------------------------------------------------*/ +#ifndef GuiComponent_h +#define GuiComponent_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "GuiObject.h" + + +namespace LiveSupport { +namespace GLiveSupport { + +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * The common ancestor of all window components in the GUI. + * These are non-standalone sub-windows, like the AdvancedSearchEntry, and + * sub-widgets of those, like the AdvancedSearchItem. + * + * @author $Author$ + * @version $Revision$ + */ +class GuiComponent : public GuiObject +{ + protected: + + /** + * The parent object. + */ + GuiObject * parent; + + /** + * Protected constructor. + * + * @param parent the GuiObject which contains this one. + * @param bundleName the name of the localization resource bundle + * (optional); if missing, the parent's bundle + * is used. + */ + GuiComponent(GuiObject * parent, + const Glib::ustring & bundleName = "") + throw (); + + + public: + + /** + * Virtual destructor. + */ + virtual + ~GuiComponent(void) throw () + { + } +}; + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace GLiveSupport +} // namespace LiveSupport + +#endif // GuiComponent_h + diff --git a/campcaster/src/products/gLiveSupport/src/GuiObject.cxx b/campcaster/src/products/gLiveSupport/src/GuiObject.cxx index 88683aed4..39f1a95c7 100644 --- a/campcaster/src/products/gLiveSupport/src/GuiObject.cxx +++ b/campcaster/src/products/gLiveSupport/src/GuiObject.cxx @@ -52,18 +52,12 @@ using namespace LiveSupport::GLiveSupport; /* ============================================================= module code */ /*------------------------------------------------------------------------------ - * Constructor. + * Protected constructor. *----------------------------------------------------------------------------*/ -GuiObject :: GuiObject (const Glib::ustring & bundleName) +GuiObject :: GuiObject (void) throw () : LocalizedObject() { gLiveSupport = GLiveSupport::getInstance(); - - if (bundleName == "") { - setBundle(gLiveSupport->getBundle()); - } else { - setBundle(gLiveSupport->getBundle(bundleName)); - } } diff --git a/campcaster/src/products/gLiveSupport/src/GuiObject.h b/campcaster/src/products/gLiveSupport/src/GuiObject.h index 1b1c410c4..bdb02348f 100644 --- a/campcaster/src/products/gLiveSupport/src/GuiObject.h +++ b/campcaster/src/products/gLiveSupport/src/GuiObject.h @@ -77,12 +77,14 @@ class GuiObject : public LocalizedObject Ptr::Ref gLiveSupport; /** - * Constructor. - * - * @param bundleName the name of the sub-bundle for this object; - * can be "" to indicate the outermost bundle. + * The Glade object, containing the visual design. */ - GuiObject(const Glib::ustring & bundleName) throw (); + Glib::RefPtr glade; + + /** + * Protected constructor. + */ + GuiObject(void) throw (); public: @@ -94,6 +96,15 @@ class GuiObject : public LocalizedObject ~GuiObject(void) throw () { } + + /** + * Get the Glade object. + */ + virtual Glib::RefPtr + getGlade(void) const throw () + { + return glade; + } }; /* ================================================= external data structures */ diff --git a/campcaster/src/products/gLiveSupport/src/GuiWindow.cxx b/campcaster/src/products/gLiveSupport/src/GuiWindow.cxx index 77e0f4e7c..ac109e19c 100644 --- a/campcaster/src/products/gLiveSupport/src/GuiWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/GuiWindow.cxx @@ -60,15 +60,21 @@ const Glib::ustring applicationTitle = "Campcaster"; /* ============================================================= module code */ /*------------------------------------------------------------------------------ - * Constructor. + * Protected constructor. *----------------------------------------------------------------------------*/ GuiWindow :: GuiWindow (const Glib::ustring & bundleName, const Glib::ustring & gladeFileName, Gtk::ToggleButton * windowOpenerButton) throw () - : GuiObject(bundleName), + : GuiObject(), windowOpenerButton(windowOpenerButton) { + if (bundleName == "") { + setBundle(gLiveSupport->getBundle()); + } else { + setBundle(gLiveSupport->getBundle(bundleName)); + } + glade = Gnome::Glade::Xml::create(gLiveSupport->getGladeDir() + gladeFileName); diff --git a/campcaster/src/products/gLiveSupport/src/GuiWindow.h b/campcaster/src/products/gLiveSupport/src/GuiWindow.h index 109d16f00..43a54dddc 100644 --- a/campcaster/src/products/gLiveSupport/src/GuiWindow.h +++ b/campcaster/src/products/gLiveSupport/src/GuiWindow.h @@ -86,11 +86,6 @@ class GuiWindow : public GuiObject protected: - /** - * The Glade object, containing the visual design. - */ - Glib::RefPtr glade; - /** * The button which was used to open this window. */ @@ -108,7 +103,7 @@ class GuiWindow : public GuiObject onDeleteEvent(GdkEventAny * event) throw (); /** - * Constructor. + * Protected constructor. * * @param bundleName the name of the sub-bundle for this object; * can be "" to indicate the outermost bundle. diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index 0b3d19c5c..a5502e4d7 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -106,10 +106,9 @@ LiveModeWindow :: LiveModeWindow (Gtk::ToggleButton * windowOpenerButton) glade->get_widget("cueLabel1", cueLabel); cueLabel->set_label(*getResourceUstring("cuePlayerLabel")); - cuePlayer.reset(new CuePlayer(gLiveSupport, + cuePlayer.reset(new CuePlayer(this, treeView, - modelColumns, - glade)); + modelColumns)); glade->get_widget("autoPlayNext1", autoPlayNext); autoPlayNext->set_label(*getResourceUstring("autoPlayNextLabel")); diff --git a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx index 250da6e39..9833a3e52 100644 --- a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -129,9 +129,7 @@ MasterPanelWindow :: MasterPanelWindow (void) // create the Now Playing widget Gtk::Box * nowPlayingBox; glade->get_widget("nowPlayingWidget1", nowPlayingBox); - nowPlayingWidget.reset(new NowPlaying(gLiveSupport, - getBundle(), - glade)); + nowPlayingWidget.reset(new NowPlaying(this)); // get a reference for the window-opener buttons glade->get_widget("liveModeButton1", liveModeButton); @@ -209,7 +207,7 @@ MasterPanelWindow :: changeLanguage(void) Ptr::Ref newBundle = gLiveSupport->getBundle( bundleName); setBundle(newBundle); - nowPlayingWidget->changeLanguage(newBundle); + nowPlayingWidget->changeLanguage(); setTitle(getResourceUstring("windowTitle")); diff --git a/campcaster/src/products/gLiveSupport/src/NowPlaying.cxx b/campcaster/src/products/gLiveSupport/src/NowPlaying.cxx index d25681c67..fbc87e1bd 100644 --- a/campcaster/src/products/gLiveSupport/src/NowPlaying.cxx +++ b/campcaster/src/products/gLiveSupport/src/NowPlaying.cxx @@ -77,13 +77,9 @@ const Glib::ustring pauseStockImageName = "gtk-media-pause"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -NowPlaying :: NowPlaying(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) +NowPlaying :: NowPlaying(GuiObject * parent) throw () - : LocalizedObject(bundle), - glade(glade), - gLiveSupport(gLiveSupport) + : GuiComponent(parent) { glade->get_widget("playButton1", playButton); glade->get_widget("stopButton1", stopButton); @@ -352,10 +348,10 @@ NowPlaying :: resetRemainsTimeState(void) throw () * Change the language of the widget. *----------------------------------------------------------------------------*/ void -NowPlaying :: changeLanguage(Ptr::Ref bundle) +NowPlaying :: changeLanguage(void) throw () { - setBundle(bundle); + setBundle(parent->getBundle()); elapsedTimeText->set_text(*getResourceUstring("elapsedTimeLabel")); remainsTimeText->set_text(*getResourceUstring("remainingTimeLabel")); diff --git a/campcaster/src/products/gLiveSupport/src/NowPlaying.h b/campcaster/src/products/gLiveSupport/src/NowPlaying.h index b4dfc0582..b4ffc0020 100644 --- a/campcaster/src/products/gLiveSupport/src/NowPlaying.h +++ b/campcaster/src/products/gLiveSupport/src/NowPlaying.h @@ -40,15 +40,12 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/Mutex.h" - #include "GLiveSupport.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -69,14 +66,9 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class NowPlaying : public LocalizedObject +class NowPlaying : public GuiComponent { private: - - /** - * The Glade object, containing the visual design. - */ - Glib::RefPtr glade; /** * Whether anything is shown in the widget. @@ -166,11 +158,6 @@ class NowPlaying : public LocalizedObject */ int remainsTimeCounter; - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - /** * A mutex to make the writing, and some reading, of the * 'playable' variable atomic. @@ -180,19 +167,19 @@ class NowPlaying : public LocalizedObject /** * Default constructor. */ - NowPlaying(void) throw (); + NowPlaying(void) throw (); /** * Event handler for the Play button being clicked. */ void - onPlayButtonClicked(void) throw (); + onPlayButtonClicked(void) throw (); /** * Event handler for the Stop button being clicked. */ void - onStopButtonClicked(void) throw (); + onStopButtonClicked(void) throw (); /** * Set the color of the 'remains time' label. @@ -205,7 +192,7 @@ class NowPlaying : public LocalizedObject */ void setRemainsTimeColor(RemainsTimeStateType state) - throw (); + throw (); /** * Reset all remains-time-blinking related variables. @@ -214,7 +201,7 @@ class NowPlaying : public LocalizedObject * and the background color of the label to blue. */ void inline - resetRemainsTimeState(void) throw (); + resetRemainsTimeState(void) throw (); public: @@ -222,22 +209,16 @@ class NowPlaying : public LocalizedObject /** * Constructor with parent and localization parameter. * - * @param gLiveSupport the GLiveSupport, application object. - * @param bundle the resource bundle holding the localized - * resources for this widget - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - NowPlaying(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) - throw (); + NowPlaying(GuiObject * parent) + throw (); /** * A virtual destructor. */ virtual - ~NowPlaying(void) throw () + ~NowPlaying(void) throw () { } @@ -247,14 +228,14 @@ class NowPlaying : public LocalizedObject * @param playable the playable to be displayed */ void - setPlayable(Ptr::Ref playable) throw (); + setPlayable(Ptr::Ref playable) throw (); /** * Function that updates the elapsed and remaining time displays. * This is called by the MasterPanelWindow every second. */ void - onUpdateTime(void) throw (); + onUpdateTime(void) throw (); /** * Public interface for restarting the audio. @@ -262,7 +243,7 @@ class NowPlaying : public LocalizedObject * This is used by MasterPanelWindow::onKeyPressed(). */ void - onPlayAudio(void) throw () + onPlayAudio(void) throw () { onPlayButtonClicked(); } @@ -273,7 +254,7 @@ class NowPlaying : public LocalizedObject * This is used by MasterPanelWindow::onKeyPressed(). */ void - onStopAudio(void) throw () + onStopAudio(void) throw () { onStopButtonClicked(); } @@ -288,7 +269,7 @@ class NowPlaying : public LocalizedObject * @return the currently playing item; 0 if nothing is playing. */ Ptr::Ref - getCurrentInnerPlayable(void) throw () + getCurrentInnerPlayable(void) throw () { return currentInnerPlayable; } @@ -296,10 +277,11 @@ class NowPlaying : public LocalizedObject /** * Change the user interface language of the widget. * - * @param bundle the new resource bundle. + * This is called by the parent when its locale has changed; + * NowPlaying then updates its own bundle to match the parent's. */ void - changeLanguage(Ptr::Ref bundle) throw (); + changeLanguage() throw (); }; diff --git a/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx b/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx index c23c988e2..151b48b8d 100644 --- a/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx @@ -559,7 +559,7 @@ OptionsWindow :: constructSchedulerSection(void) throw () void OptionsWindow :: constructBackupSection(void) throw () { - backupView.reset(new BackupView(gLiveSupport, glade)); + backupView.reset(new BackupView(this)); } @@ -569,7 +569,7 @@ OptionsWindow :: constructBackupSection(void) throw () void OptionsWindow :: constructRdsSection(void) throw () { - rdsView.reset(new RdsView(gLiveSupport, glade)); + rdsView.reset(new RdsView(this)); } diff --git a/campcaster/src/products/gLiveSupport/src/RdsEntry.cxx b/campcaster/src/products/gLiveSupport/src/RdsEntry.cxx index c98a6cf18..dfd2f74da 100644 --- a/campcaster/src/products/gLiveSupport/src/RdsEntry.cxx +++ b/campcaster/src/products/gLiveSupport/src/RdsEntry.cxx @@ -54,13 +54,12 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -RdsEntry :: RdsEntry(Ptr::Ref bundle, - Glib::RefPtr glade, - int index, - const Glib::ustring & type, - int width) +RdsEntry :: RdsEntry(GuiObject * parent, + int index, + const Glib::ustring & type, + int width) throw () - : LocalizedObject(bundle) + : GuiComponent(parent) { this->type.reset(new const Glib::ustring(type)); @@ -91,7 +90,7 @@ RdsEntry :: setOptions(bool enabled, * Save the changes made by the user. *----------------------------------------------------------------------------*/ bool -RdsEntry :: saveChanges(Ptr::Ref gLiveSupport) throw () +RdsEntry :: saveChanges(void) throw () { bool checkButtonNow = checkButton->get_active(); Ptr::Ref diff --git a/campcaster/src/products/gLiveSupport/src/RdsEntry.h b/campcaster/src/products/gLiveSupport/src/RdsEntry.h index 465230898..b85aaaa8d 100644 --- a/campcaster/src/products/gLiveSupport/src/RdsEntry.h +++ b/campcaster/src/products/gLiveSupport/src/RdsEntry.h @@ -40,14 +40,12 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/NumericTools.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -69,7 +67,7 @@ using namespace LiveSupport::GLiveSupport; * @author $Author$ * @version $Revision$ */ -class RdsEntry : public LocalizedObject, +class RdsEntry : public GuiComponent, private NumericTools { private: @@ -110,20 +108,16 @@ class RdsEntry : public LocalizedObject, * The type parameter is a string of 2 or 3 upper-case characters, * see http://en.wikipedia.org/wiki/Radio_Data_System. * - * @param bundle the resource bundle holding the localized - * resources for this window. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. * @param index the position of this item in the list of * RDS entries. * @param type the type of RDS data (PS, PI, RT, etc). * @param width the width of the entry, in characters. */ - RdsEntry(Ptr::Ref bundle, - Glib::RefPtr glade, - int index, - const Glib::ustring & type, - int width) throw (); + RdsEntry(GuiObject * parent, + int index, + const Glib::ustring & type, + int width) throw (); /** * A virtual destructor. @@ -158,12 +152,10 @@ class RdsEntry : public LocalizedObject, /** * Save the changes made by the user. * - * @param gLiveSupport the GLiveSupport object holding the - * RDS options to be modified. * @return true if any changes were saved; false otherwise. */ bool - saveChanges(Ptr::Ref gLiveSupport) throw (); + saveChanges(void) throw (); /** * Clear the entries of the widget. diff --git a/campcaster/src/products/gLiveSupport/src/RdsView.cxx b/campcaster/src/products/gLiveSupport/src/RdsView.cxx index 4d64a23ec..006e8faa2 100644 --- a/campcaster/src/products/gLiveSupport/src/RdsView.cxx +++ b/campcaster/src/products/gLiveSupport/src/RdsView.cxx @@ -44,6 +44,14 @@ using namespace LiveSupport::GLiveSupport; /* ================================================ local constants & macros */ +namespace { + +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "rdsView"; + +} /* =============================================== local function prototypes */ @@ -53,23 +61,20 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -RdsView :: RdsView (Ptr::Ref gLiveSupport, - Glib::RefPtr glade) +RdsView :: RdsView (GuiObject * parent) throw () - : gLiveSupport(gLiveSupport) + : GuiComponent(parent, + bundleName) { - Ptr::Ref bundle = gLiveSupport->getBundle("rdsView"); - setBundle(bundle); - Gtk::Label * deviceLabel; glade->get_widget("rdsDeviceLabel1", deviceLabel); deviceLabel->set_label(*getResourceUstring("deviceLabel")); glade->get_widget("rdsDeviceEntry1", deviceEntry); - Ptr::Ref psEntry(new RdsEntry(getBundle(), glade, 0, "PS", 8)); - Ptr::Ref piEntry(new RdsEntry(getBundle(), glade, 1, "PI", 4)); - Ptr::Ref rtEntry(new RdsEntry(getBundle(), glade, 2, "RT", 32)); + Ptr::Ref psEntry(new RdsEntry(this, 0, "PS", 8)); + Ptr::Ref piEntry(new RdsEntry(this, 1, "PI", 4)); + Ptr::Ref rtEntry(new RdsEntry(this, 2, "RT", 32)); rdsEntryList.push_back(psEntry); rdsEntryList.push_back(piEntry); @@ -100,7 +105,7 @@ RdsView :: saveChanges(void) throw () RdsEntryListType::const_iterator it; for (it = rdsEntryList.begin(); it != rdsEntryList.end(); ++it) { Ptr::Ref rdsEntry = *it; - touched |= rdsEntry->saveChanges(gLiveSupport); + touched |= rdsEntry->saveChanges(); } return touched; diff --git a/campcaster/src/products/gLiveSupport/src/RdsView.h b/campcaster/src/products/gLiveSupport/src/RdsView.h index c8171b81a..88bd365a5 100644 --- a/campcaster/src/products/gLiveSupport/src/RdsView.h +++ b/campcaster/src/products/gLiveSupport/src/RdsView.h @@ -40,15 +40,15 @@ #include "configure.h" #endif -#include -#include #include #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "RdsEntry.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + + namespace LiveSupport { namespace GLiveSupport { @@ -88,7 +88,7 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class RdsView : public LocalizedObject +class RdsView : public GuiComponent { private: @@ -113,11 +113,6 @@ class RdsView : public LocalizedObject protected: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - /** * The entry field for the serial device. */ @@ -125,16 +120,13 @@ class RdsView : public LocalizedObject public: + /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - RdsView(Ptr::Ref gLiveSupport, - Glib::RefPtr glade) + RdsView(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx index 817cbf65a..da8702022 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -108,10 +108,9 @@ ScratchpadWindow :: ScratchpadWindow ( &ScratchpadWindow::onKeyPressed)); // create the cue player widget - cuePlayer.reset(new CuePlayer(gLiveSupport, + cuePlayer.reset(new CuePlayer(this, treeView, - modelColumns, - glade)); + modelColumns)); // create the right-click entry context menu for audio clips audioClipMenu.reset(new Gtk::Menu()); diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx index 0eb345c87..dbf15b8ee 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx @@ -166,7 +166,7 @@ SearchWindow :: constructSimpleSearchView(void) throw () void SearchWindow :: constructAdvancedSearchView(void) throw () { - advancedSearchEntry.reset(new AdvancedSearchEntry(gLiveSupport, glade)); + advancedSearchEntry.reset(new AdvancedSearchEntry(this)); advancedSearchEntry->connectCallback(sigc::mem_fun(*this, &SearchWindow::onAdvancedSearch )); @@ -184,7 +184,7 @@ SearchWindow :: constructAdvancedSearchView(void) throw () void SearchWindow :: constructBrowseView(void) throw () { - browseEntry.reset(new BrowseEntry(gLiveSupport, getBundle(), glade)); + browseEntry.reset(new BrowseEntry(this)); browseEntry->signalChanged().connect(sigc::mem_fun(*this, &SearchWindow::onBrowse)); } @@ -196,10 +196,7 @@ SearchWindow :: constructBrowseView(void) throw () void SearchWindow :: constructTransportsView(void) throw () { - transportList.reset(new TransportList( - gLiveSupport, - gLiveSupport->getBundle("transportList"), - glade)); + transportList.reset(new TransportList(this)); } diff --git a/campcaster/src/products/gLiveSupport/src/TransportList.cxx b/campcaster/src/products/gLiveSupport/src/TransportList.cxx index 41a67d628..8305aa53f 100644 --- a/campcaster/src/products/gLiveSupport/src/TransportList.cxx +++ b/campcaster/src/products/gLiveSupport/src/TransportList.cxx @@ -48,6 +48,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "transportList"; + /*------------------------------------------------------------------------------ * The localization key for the 'working' status. *----------------------------------------------------------------------------*/ @@ -88,12 +93,10 @@ const Glib::ustring downloadSymbol = "⇩"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -TransportList :: TransportList(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) +TransportList :: TransportList(GuiObject * parent) throw () - : LocalizedObject(bundle), - gLiveSupport(gLiveSupport) + : GuiComponent(parent, + bundleName) { // create the tree view treeModel = Gtk::ListStore::create(modelColumns); diff --git a/campcaster/src/products/gLiveSupport/src/TransportList.h b/campcaster/src/products/gLiveSupport/src/TransportList.h index 601454ab1..d2bb51c9b 100644 --- a/campcaster/src/products/gLiveSupport/src/TransportList.h +++ b/campcaster/src/products/gLiveSupport/src/TransportList.h @@ -40,17 +40,16 @@ #include "configure.h" #endif -#include -#include - #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/UniqueId.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/XmlRpcException.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeView.h" #include "GLiveSupport.h" +#include "GuiComponent.h" + + namespace LiveSupport { namespace GLiveSupport { @@ -90,7 +89,7 @@ using namespace LiveSupport::Widgets; * @author $Author$ * @version $Revision$ */ -class TransportList : public LocalizedObject, +class TransportList : public GuiComponent, public ContentsStorable { private: @@ -160,11 +159,6 @@ class TransportList : public LocalizedObject, protected: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr::Ref gLiveSupport; - /** * The columns model needed by ZebraTreeView. * @@ -266,16 +260,9 @@ class TransportList : public LocalizedObject, /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param bundle the resource bundle holding the localized - * resources for this window. - * @param glade the Glade file which specifies the visual - * components for this class. + * @param parent the GuiObject which contains this one. */ - TransportList(Ptr::Ref gLiveSupport, - Ptr::Ref bundle, - Glib::RefPtr glade) throw (); + TransportList(GuiObject * parent) throw (); /** * Virtual destructor.