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.
This commit is contained in:
fgerlits 2007-08-10 13:49:12 +00:00
parent 2f233f9aec
commit 8b9ad7968d
35 changed files with 394 additions and 341 deletions

View file

@ -42,6 +42,7 @@
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
#include <glibmm/ustring.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"

View file

@ -260,6 +260,7 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
${TMP_DIR}/NowPlaying.o \ ${TMP_DIR}/NowPlaying.o \
${TMP_DIR}/GuiObject.o \ ${TMP_DIR}/GuiObject.o \
${TMP_DIR}/GuiWindow.o \ ${TMP_DIR}/GuiWindow.o \
${TMP_DIR}/GuiComponent.o \
${TMP_DIR}/LoginWindow.o \ ${TMP_DIR}/LoginWindow.o \
${TMP_DIR}/UploadFileWindow.o \ ${TMP_DIR}/UploadFileWindow.o \
${TMP_DIR}/ScratchpadWindow.o \ ${TMP_DIR}/ScratchpadWindow.o \

View file

@ -48,10 +48,15 @@ using namespace LiveSupport::GLiveSupport;
namespace { namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "advancedSearchEntry";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The maximum number of AdvancedSearchItem children. * The maximum number of AdvancedSearchItem children.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const int maxChildren = 5; const int maxChildren = 5;
} }
@ -63,16 +68,11 @@ const int maxChildren = 5;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
AdvancedSearchEntry :: AdvancedSearchEntry( AdvancedSearchEntry :: AdvancedSearchEntry(GuiObject * parent)
Ptr<GLiveSupport>::Ref gLiveSupport,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: gLiveSupport(gLiveSupport) : GuiComponent(parent,
bundleName)
{ {
Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle(
"advancedSearchEntry");
setBundle(bundle);
metadataTypes = gLiveSupport->getMetadataTypeContainer(); metadataTypes = gLiveSupport->getMetadataTypeContainer();
Gtk::Label * fileTypeLabel; Gtk::Label * fileTypeLabel;
@ -87,10 +87,9 @@ AdvancedSearchEntry :: AdvancedSearchEntry(
for (int i = 0; i < maxChildren; ++i) { for (int i = 0; i < maxChildren; ++i) {
Ptr<AdvancedSearchItem>::Ref searchItem(new AdvancedSearchItem( Ptr<AdvancedSearchItem>::Ref searchItem(new AdvancedSearchItem(
i, this,
metadataTypes, i,
getBundle(), metadataTypes));
glade));
children.push_back(searchItem); children.push_back(searchItem);
} }

View file

@ -41,17 +41,17 @@
#endif #endif
#include <vector> #include <vector>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/MetadataTypeContainer.h" #include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Core/SearchCriteria.h"
#include "LiveSupport/Widgets/ComboBoxText.h" #include "LiveSupport/Widgets/ComboBoxText.h"
#include "AdvancedSearchItem.h" #include "AdvancedSearchItem.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -72,14 +72,9 @@ using namespace LiveSupport::Widgets;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class AdvancedSearchEntry : public LocalizedObject class AdvancedSearchEntry : public GuiComponent
{ {
private: private:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* A container holding all known metadata types. * A container holding all known metadata types.
@ -102,13 +97,9 @@ class AdvancedSearchEntry : public LocalizedObject
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the GLiveSupport object, containing * @param parent the GuiObject which contains this one.
* all the vital info.
* @param glade the Glade file which specifies the visual
* components for this class.
*/ */
AdvancedSearchEntry(Ptr<GLiveSupport>::Ref gLiveSupport, AdvancedSearchEntry(GuiObject * parent)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -56,12 +56,11 @@ using namespace LiveSupport::GLiveSupport;
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
AdvancedSearchItem :: AdvancedSearchItem( AdvancedSearchItem :: AdvancedSearchItem(
GuiObject * parent,
int index, int index,
Ptr<MetadataTypeContainer>::Ref metadataTypes, Ptr<MetadataTypeContainer>::Ref metadataTypes)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: LocalizedObject(bundle) : GuiComponent(parent)
{ {
glade->get_widget(addIndex("advancedSearchItem", index), enclosingBox); glade->get_widget(addIndex("advancedSearchItem", index), enclosingBox);
@ -75,7 +74,7 @@ AdvancedSearchItem :: AdvancedSearchItem(
glade->get_widget_derived(addIndex("advancedOperatorEntry", index), glade->get_widget_derived(addIndex("advancedOperatorEntry", index),
operatorEntry); operatorEntry);
operatorEntry->setContents(bundle); operatorEntry->setContents(getBundle());
glade->get_widget(addIndex("advancedValueEntry", index), valueEntry); glade->get_widget(addIndex("advancedValueEntry", index), valueEntry);

View file

@ -42,17 +42,16 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/NumericTools.h" #include "LiveSupport/Core/NumericTools.h"
#include "LiveSupport/Core/MetadataTypeContainer.h" #include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Core/SearchCriteria.h"
#include "LiveSupport/Widgets/MetadataComboBoxText.h" #include "LiveSupport/Widgets/MetadataComboBoxText.h"
#include "LiveSupport/Widgets/OperatorComboBoxText.h" #include "LiveSupport/Widgets/OperatorComboBoxText.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -74,7 +73,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class AdvancedSearchItem : public LocalizedObject, class AdvancedSearchItem : public GuiComponent,
private NumericTools private NumericTools
{ {
private: private:
@ -138,18 +137,14 @@ class AdvancedSearchItem : public LocalizedObject,
/** /**
* Constructor. * Constructor.
* *
* @param parent the GuiObject which contains this one.
* @param index the position of this item in the list of * @param index the position of this item in the list of
* advanced search items. * advanced search items.
* @param metadataTypes container holding all known metadata types * @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, AdvancedSearchItem(GuiObject * parent,
Ptr<MetadataTypeContainer>::Ref metadataTypes, int index,
Ptr<ResourceBundle>::Ref bundle, Ptr<MetadataTypeContainer>::Ref metadataTypes)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -77,12 +77,9 @@ const Glib::ustring userPreferencesKeyName = "activeBackups";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
BackupList :: BackupList (Ptr<GLiveSupport>::Ref gLiveSupport, BackupList :: BackupList (GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: LocalizedObject(bundle), : GuiComponent(parent)
gLiveSupport(gLiveSupport)
{ {
// create the tree view // create the tree view
treeModel = Gtk::ListStore::create(modelColumns); treeModel = Gtk::ListStore::create(modelColumns);

View file

@ -40,16 +40,15 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/XmlRpcException.h" #include "LiveSupport/Core/XmlRpcException.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h" #include "LiveSupport/Widgets/ZebraTreeView.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -88,7 +87,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class BackupList : public LocalizedObject, class BackupList : public GuiComponent,
public ContentsStorable public ContentsStorable
{ {
private: private:
@ -144,11 +143,6 @@ class BackupList : public LocalizedObject,
protected: protected:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* The columns model needed by ZebraTreeView. * The columns model needed by ZebraTreeView.
* *
@ -224,16 +218,9 @@ class BackupList : public LocalizedObject,
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing * @param parent the GuiObject which contains this one.
* 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.
*/ */
BackupList(Ptr<GLiveSupport>::Ref gLiveSupport, BackupList(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -39,10 +39,6 @@
#error need pwd.h #error need pwd.h
#endif #endif
#include <gtkmm/filechooserdialog.h>
#include <gtkmm/stock.h>
#include <gtkmm/paned.h>
#include "LiveSupport/Core/FileTools.h" #include "LiveSupport/Core/FileTools.h"
#include "BackupView.h" #include "BackupView.h"
@ -57,6 +53,14 @@ using namespace boost::posix_time;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "backupView";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */
@ -66,15 +70,11 @@ using namespace boost::posix_time;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
BackupView :: BackupView (Ptr<GLiveSupport>::Ref gLiveSupport, BackupView :: BackupView (GuiObject * parent)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: gLiveSupport(gLiveSupport), : GuiComponent(parent,
glade(glade) bundleName)
{ {
Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle("backupView");
setBundle(bundle);
Gtk::Label * backupTitleLabel; Gtk::Label * backupTitleLabel;
Gtk::Label * mtimeLabel; Gtk::Label * mtimeLabel;
Gtk::Button * chooseTimeButton; Gtk::Button * chooseTimeButton;
@ -111,7 +111,7 @@ BackupView :: BackupView (Ptr<GLiveSupport>::Ref gLiveSupport,
void void
BackupView :: constructCriteriaView(void) throw () BackupView :: constructCriteriaView(void) throw ()
{ {
criteriaEntry.reset(new AdvancedSearchEntry(gLiveSupport, glade)); criteriaEntry.reset(new AdvancedSearchEntry(this));
criteriaEntry->connectCallback(sigc::mem_fun(*this, criteriaEntry->connectCallback(sigc::mem_fun(*this,
&BackupView::onCreateBackup)); &BackupView::onCreateBackup));
@ -129,7 +129,7 @@ BackupView :: constructCriteriaView(void) throw ()
void void
BackupView :: constructBackupListView(void) throw () BackupView :: constructBackupListView(void) throw ()
{ {
backupList.reset(new BackupList(gLiveSupport, getBundle(), glade)); backupList.reset(new BackupList(this));
glade->connect_clicked("backupDeleteButton1", sigc::mem_fun(*this, glade->connect_clicked("backupDeleteButton1", sigc::mem_fun(*this,
&BackupView::onDeleteButtonClicked)); &BackupView::onDeleteButtonClicked));

View file

@ -40,18 +40,18 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/TimeConversion.h"
#include "DateTimeChooserWindow.h" #include "DateTimeChooserWindow.h"
#include "AdvancedSearchEntry.h" #include "AdvancedSearchEntry.h"
#include "BackupList.h" #include "BackupList.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -88,7 +88,7 @@ using namespace boost::posix_time;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class BackupView : public LocalizedObject class BackupView : public GuiComponent
{ {
private: private:
@ -156,16 +156,6 @@ class BackupView : public LocalizedObject
protected: protected:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/**
* The Glade object, which specifies the visual components.
*/
Glib::RefPtr<Gnome::Glade::Xml> glade;
/** /**
* Event handler for the time chooser button being clicked. * Event handler for the time chooser button being clicked.
*/ */
@ -202,13 +192,9 @@ class BackupView : public LocalizedObject
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing * @param parent the GuiObject which contains this one.
* all the vital info.
* @param glade the Glade file which specifies the visual
* components for this class.
*/ */
BackupView(Ptr<GLiveSupport>::Ref gLiveSupport, BackupView(GuiObject * parent)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -55,26 +55,18 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
BrowseEntry :: BrowseEntry(Ptr<GLiveSupport>::Ref gLiveSupport, BrowseEntry :: BrowseEntry(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: LocalizedObject(bundle) : GuiComponent(parent)
{ {
browseItemOne.reset(new BrowseItem(0, browseItemOne.reset(new BrowseItem(this,
gLiveSupport, 0,
bundle,
glade,
4 /* Genre */)); 4 /* Genre */));
browseItemTwo.reset(new BrowseItem(1, browseItemTwo.reset(new BrowseItem(this,
gLiveSupport, 1,
bundle,
glade,
1 /* Creator */)); 1 /* Creator */));
browseItemThree.reset(new BrowseItem(2, browseItemThree.reset(new BrowseItem(this,
gLiveSupport, 2,
bundle,
glade,
2 /* Album */)); 2 /* Album */));
// TODO: change hard-coded indices to stuff read from config // TODO: change hard-coded indices to stuff read from config

View file

@ -40,15 +40,13 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Core/SearchCriteria.h"
#include "BrowseItem.h" #include "BrowseItem.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -69,7 +67,7 @@ using namespace LiveSupport::Core;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class BrowseEntry : public LocalizedObject class BrowseEntry : public GuiComponent
{ {
private: private:
@ -99,15 +97,9 @@ class BrowseEntry : public LocalizedObject
/** /**
* Constructor with localization parameter. * Constructor with localization parameter.
* *
* @param gLiveSupport the GLiveSupport object, containing * @param parent the GuiObject which contains this one.
* all the vital info.
* @param bundle the resource bundle for localization.
* @param glade the Glade file which specifies the visual
* components for this class.
*/ */
BrowseEntry(Ptr<GLiveSupport>::Ref gLiveSupport, BrowseEntry(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -56,14 +56,11 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
BrowseItem :: BrowseItem(int index, BrowseItem :: BrowseItem(GuiObject * parent,
Ptr<GLiveSupport>::Ref gLiveSupport, int index,
Ptr<ResourceBundle>::Ref bundle, int defaultIndex)
Glib::RefPtr<Gnome::Glade::Xml> glade,
int defaultIndex)
throw () throw ()
: LocalizedObject(bundle), : GuiComponent(parent)
gLiveSupport(gLiveSupport)
{ {
parentCriteria.reset(new SearchCriteria); parentCriteria.reset(new SearchCriteria);

View file

@ -42,19 +42,17 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/NumericTools.h" #include "LiveSupport/Core/NumericTools.h"
#include "LiveSupport/Core/SearchCriteria.h" #include "LiveSupport/Core/SearchCriteria.h"
#include "LiveSupport/Widgets/MetadataComboBoxText.h" #include "LiveSupport/Widgets/MetadataComboBoxText.h"
#include "LiveSupport/Widgets/ZebraTreeView.h" #include "LiveSupport/Widgets/ZebraTreeView.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -83,7 +81,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class BrowseItem : public LocalizedObject, class BrowseItem : public GuiComponent,
private NumericTools private NumericTools
{ {
private: private:
@ -150,11 +148,6 @@ class BrowseItem : public LocalizedObject,
*/ */
Glib::ustring allString; Glib::ustring allString;
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* The criteria from the browse items to the left of this one. * 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. * Constructor with parent and localization parameter.
* *
* @param index the position of this item in the list of * @param parent the GuiObject which contains this one.
* browse items. * @param index the position of this item in the list of
* @param gLiveSupport the main program object * browse items.
* @param bundle the resource bundle for localization * @param defaultIndex the index of the metadata entry to display
* @param glade the Glade file which specifies the visual * initially
* components for this class.
* @param defaultIndex the index of the metadata entry to display
* initially
*/ */
BrowseItem(int index, BrowseItem(GuiObject * parent,
Ptr<GLiveSupport>::Ref gLiveSupport, int index,
Ptr<ResourceBundle>::Ref bundle, int defaultIndex)
Glib::RefPtr<Gnome::Glade::Xml> glade,
int defaultIndex)
throw (); throw ();
/** /**

View file

@ -68,12 +68,11 @@ const Glib::ustring pauseStockImageName = "gtk-media-pause";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
CuePlayer :: CuePlayer(Ptr<GLiveSupport>::Ref gLiveSupport, CuePlayer :: CuePlayer(GuiObject * parent,
Gtk::TreeView * treeView, Gtk::TreeView * treeView,
const PlayableTreeModelColumnRecord & modelColumns, const PlayableTreeModelColumnRecord & modelColumns)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: gLiveSupport(gLiveSupport), : GuiComponent(parent),
treeView(treeView), treeView(treeView),
modelColumns(modelColumns) modelColumns(modelColumns)
{ {

View file

@ -40,15 +40,13 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h" #include "LiveSupport/PlaylistExecutor/AudioPlayerEventListener.h"
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h" #include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -71,9 +69,11 @@ using namespace LiveSupport::Widgets;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class CuePlayer : public PlaylistExecutor::AudioPlayerEventListener class CuePlayer : public GuiComponent,
public PlaylistExecutor::AudioPlayerEventListener
{ {
private: private:
/** /**
* The possible states of the (cue) audio player. * The possible states of the (cue) audio player.
*/ */
@ -94,11 +94,6 @@ class CuePlayer : public PlaylistExecutor::AudioPlayerEventListener
*/ */
Gtk::Button * stopButton; Gtk::Button * stopButton;
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* The Gtk::TreeView of the parent. * The Gtk::TreeView of the parent.
*/ */
@ -145,19 +140,17 @@ class CuePlayer : public PlaylistExecutor::AudioPlayerEventListener
public: public:
/** /**
* Constructor with parent parameters. * Constructor with parent parameters.
* *
* @param gLiveSupport the GLiveSupport, application object. * @param parent the GuiObject which contains this one.
* @param treeView the TreeView object showing the selection. * @param treeView the TreeView object showing the selection.
* @param modelColumns the object holding the types of the columns. * @param modelColumns the object holding the types of the columns.
* @param glade the Glade file which specifies the visual
* components for this class.
*/ */
CuePlayer(Ptr<GLiveSupport>::Ref gLiveSupport, CuePlayer(GuiObject * parent,
Gtk::TreeView * treeView, Gtk::TreeView * treeView,
const PlayableTreeModelColumnRecord & modelColumns, const PlayableTreeModelColumnRecord & modelColumns)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -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();
}

View file

@ -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

View file

@ -52,18 +52,12 @@ using namespace LiveSupport::GLiveSupport;
/* ============================================================= module code */ /* ============================================================= module code */
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Protected constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
GuiObject :: GuiObject (const Glib::ustring & bundleName) GuiObject :: GuiObject (void)
throw () throw ()
: LocalizedObject() : LocalizedObject()
{ {
gLiveSupport = GLiveSupport::getInstance(); gLiveSupport = GLiveSupport::getInstance();
if (bundleName == "") {
setBundle(gLiveSupport->getBundle());
} else {
setBundle(gLiveSupport->getBundle(bundleName));
}
} }

View file

@ -77,12 +77,14 @@ class GuiObject : public LocalizedObject
Ptr<GLiveSupport>::Ref gLiveSupport; Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* Constructor. * The Glade object, containing the visual design.
*
* @param bundleName the name of the sub-bundle for this object;
* can be "" to indicate the outermost bundle.
*/ */
GuiObject(const Glib::ustring & bundleName) throw (); Glib::RefPtr<Gnome::Glade::Xml> glade;
/**
* Protected constructor.
*/
GuiObject(void) throw ();
public: public:
@ -94,6 +96,15 @@ class GuiObject : public LocalizedObject
~GuiObject(void) throw () ~GuiObject(void) throw ()
{ {
} }
/**
* Get the Glade object.
*/
virtual Glib::RefPtr<Gnome::Glade::Xml>
getGlade(void) const throw ()
{
return glade;
}
}; };
/* ================================================= external data structures */ /* ================================================= external data structures */

View file

@ -60,15 +60,21 @@ const Glib::ustring applicationTitle = "Campcaster";
/* ============================================================= module code */ /* ============================================================= module code */
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Protected constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
GuiWindow :: GuiWindow (const Glib::ustring & bundleName, GuiWindow :: GuiWindow (const Glib::ustring & bundleName,
const Glib::ustring & gladeFileName, const Glib::ustring & gladeFileName,
Gtk::ToggleButton * windowOpenerButton) Gtk::ToggleButton * windowOpenerButton)
throw () throw ()
: GuiObject(bundleName), : GuiObject(),
windowOpenerButton(windowOpenerButton) windowOpenerButton(windowOpenerButton)
{ {
if (bundleName == "") {
setBundle(gLiveSupport->getBundle());
} else {
setBundle(gLiveSupport->getBundle(bundleName));
}
glade = Gnome::Glade::Xml::create(gLiveSupport->getGladeDir() + glade = Gnome::Glade::Xml::create(gLiveSupport->getGladeDir() +
gladeFileName); gladeFileName);

View file

@ -86,11 +86,6 @@ class GuiWindow : public GuiObject
protected: protected:
/**
* The Glade object, containing the visual design.
*/
Glib::RefPtr<Gnome::Glade::Xml> glade;
/** /**
* The button which was used to open this window. * The button which was used to open this window.
*/ */
@ -108,7 +103,7 @@ class GuiWindow : public GuiObject
onDeleteEvent(GdkEventAny * event) throw (); onDeleteEvent(GdkEventAny * event) throw ();
/** /**
* Constructor. * Protected constructor.
* *
* @param bundleName the name of the sub-bundle for this object; * @param bundleName the name of the sub-bundle for this object;
* can be "" to indicate the outermost bundle. * can be "" to indicate the outermost bundle.

View file

@ -106,10 +106,9 @@ LiveModeWindow :: LiveModeWindow (Gtk::ToggleButton * windowOpenerButton)
glade->get_widget("cueLabel1", cueLabel); glade->get_widget("cueLabel1", cueLabel);
cueLabel->set_label(*getResourceUstring("cuePlayerLabel")); cueLabel->set_label(*getResourceUstring("cuePlayerLabel"));
cuePlayer.reset(new CuePlayer(gLiveSupport, cuePlayer.reset(new CuePlayer(this,
treeView, treeView,
modelColumns, modelColumns));
glade));
glade->get_widget("autoPlayNext1", autoPlayNext); glade->get_widget("autoPlayNext1", autoPlayNext);
autoPlayNext->set_label(*getResourceUstring("autoPlayNextLabel")); autoPlayNext->set_label(*getResourceUstring("autoPlayNextLabel"));

View file

@ -129,9 +129,7 @@ MasterPanelWindow :: MasterPanelWindow (void)
// create the Now Playing widget // create the Now Playing widget
Gtk::Box * nowPlayingBox; Gtk::Box * nowPlayingBox;
glade->get_widget("nowPlayingWidget1", nowPlayingBox); glade->get_widget("nowPlayingWidget1", nowPlayingBox);
nowPlayingWidget.reset(new NowPlaying(gLiveSupport, nowPlayingWidget.reset(new NowPlaying(this));
getBundle(),
glade));
// get a reference for the window-opener buttons // get a reference for the window-opener buttons
glade->get_widget("liveModeButton1", liveModeButton); glade->get_widget("liveModeButton1", liveModeButton);
@ -209,7 +207,7 @@ MasterPanelWindow :: changeLanguage(void)
Ptr<ResourceBundle>::Ref newBundle = gLiveSupport->getBundle( Ptr<ResourceBundle>::Ref newBundle = gLiveSupport->getBundle(
bundleName); bundleName);
setBundle(newBundle); setBundle(newBundle);
nowPlayingWidget->changeLanguage(newBundle); nowPlayingWidget->changeLanguage();
setTitle(getResourceUstring("windowTitle")); setTitle(getResourceUstring("windowTitle"));

View file

@ -77,13 +77,9 @@ const Glib::ustring pauseStockImageName = "gtk-media-pause";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
NowPlaying :: NowPlaying(Ptr<GLiveSupport>::Ref gLiveSupport, NowPlaying :: NowPlaying(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: LocalizedObject(bundle), : GuiComponent(parent)
glade(glade),
gLiveSupport(gLiveSupport)
{ {
glade->get_widget("playButton1", playButton); glade->get_widget("playButton1", playButton);
glade->get_widget("stopButton1", stopButton); glade->get_widget("stopButton1", stopButton);
@ -352,10 +348,10 @@ NowPlaying :: resetRemainsTimeState(void) throw ()
* Change the language of the widget. * Change the language of the widget.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
NowPlaying :: changeLanguage(Ptr<ResourceBundle>::Ref bundle) NowPlaying :: changeLanguage(void)
throw () throw ()
{ {
setBundle(bundle); setBundle(parent->getBundle());
elapsedTimeText->set_text(*getResourceUstring("elapsedTimeLabel")); elapsedTimeText->set_text(*getResourceUstring("elapsedTimeLabel"));
remainsTimeText->set_text(*getResourceUstring("remainingTimeLabel")); remainsTimeText->set_text(*getResourceUstring("remainingTimeLabel"));

View file

@ -40,15 +40,12 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/Mutex.h" #include "LiveSupport/Core/Mutex.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -69,14 +66,9 @@ using namespace LiveSupport::Core;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class NowPlaying : public LocalizedObject class NowPlaying : public GuiComponent
{ {
private: private:
/**
* The Glade object, containing the visual design.
*/
Glib::RefPtr<Gnome::Glade::Xml> glade;
/** /**
* Whether anything is shown in the widget. * Whether anything is shown in the widget.
@ -166,11 +158,6 @@ class NowPlaying : public LocalizedObject
*/ */
int remainsTimeCounter; int remainsTimeCounter;
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* A mutex to make the writing, and some reading, of the * A mutex to make the writing, and some reading, of the
* 'playable' variable atomic. * 'playable' variable atomic.
@ -180,19 +167,19 @@ class NowPlaying : public LocalizedObject
/** /**
* Default constructor. * Default constructor.
*/ */
NowPlaying(void) throw (); NowPlaying(void) throw ();
/** /**
* Event handler for the Play button being clicked. * Event handler for the Play button being clicked.
*/ */
void void
onPlayButtonClicked(void) throw (); onPlayButtonClicked(void) throw ();
/** /**
* Event handler for the Stop button being clicked. * Event handler for the Stop button being clicked.
*/ */
void void
onStopButtonClicked(void) throw (); onStopButtonClicked(void) throw ();
/** /**
* Set the color of the 'remains time' label. * Set the color of the 'remains time' label.
@ -205,7 +192,7 @@ class NowPlaying : public LocalizedObject
*/ */
void void
setRemainsTimeColor(RemainsTimeStateType state) setRemainsTimeColor(RemainsTimeStateType state)
throw (); throw ();
/** /**
* Reset all remains-time-blinking related variables. * Reset all remains-time-blinking related variables.
@ -214,7 +201,7 @@ class NowPlaying : public LocalizedObject
* and the background color of the label to blue. * and the background color of the label to blue.
*/ */
void inline void inline
resetRemainsTimeState(void) throw (); resetRemainsTimeState(void) throw ();
public: public:
@ -222,22 +209,16 @@ class NowPlaying : public LocalizedObject
/** /**
* Constructor with parent and localization parameter. * Constructor with parent and localization parameter.
* *
* @param gLiveSupport the GLiveSupport, application object. * @param parent the GuiObject which contains this one.
* @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.
*/ */
NowPlaying(Ptr<GLiveSupport>::Ref gLiveSupport, NowPlaying(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle, throw ();
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw ();
/** /**
* A virtual destructor. * A virtual destructor.
*/ */
virtual virtual
~NowPlaying(void) throw () ~NowPlaying(void) throw ()
{ {
} }
@ -247,14 +228,14 @@ class NowPlaying : public LocalizedObject
* @param playable the playable to be displayed * @param playable the playable to be displayed
*/ */
void void
setPlayable(Ptr<Playable>::Ref playable) throw (); setPlayable(Ptr<Playable>::Ref playable) throw ();
/** /**
* Function that updates the elapsed and remaining time displays. * Function that updates the elapsed and remaining time displays.
* This is called by the MasterPanelWindow every second. * This is called by the MasterPanelWindow every second.
*/ */
void void
onUpdateTime(void) throw (); onUpdateTime(void) throw ();
/** /**
* Public interface for restarting the audio. * Public interface for restarting the audio.
@ -262,7 +243,7 @@ class NowPlaying : public LocalizedObject
* This is used by MasterPanelWindow::onKeyPressed(). * This is used by MasterPanelWindow::onKeyPressed().
*/ */
void void
onPlayAudio(void) throw () onPlayAudio(void) throw ()
{ {
onPlayButtonClicked(); onPlayButtonClicked();
} }
@ -273,7 +254,7 @@ class NowPlaying : public LocalizedObject
* This is used by MasterPanelWindow::onKeyPressed(). * This is used by MasterPanelWindow::onKeyPressed().
*/ */
void void
onStopAudio(void) throw () onStopAudio(void) throw ()
{ {
onStopButtonClicked(); onStopButtonClicked();
} }
@ -288,7 +269,7 @@ class NowPlaying : public LocalizedObject
* @return the currently playing item; 0 if nothing is playing. * @return the currently playing item; 0 if nothing is playing.
*/ */
Ptr<Playable>::Ref Ptr<Playable>::Ref
getCurrentInnerPlayable(void) throw () getCurrentInnerPlayable(void) throw ()
{ {
return currentInnerPlayable; return currentInnerPlayable;
} }
@ -296,10 +277,11 @@ class NowPlaying : public LocalizedObject
/** /**
* Change the user interface language of the widget. * 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 void
changeLanguage(Ptr<ResourceBundle>::Ref bundle) throw (); changeLanguage() throw ();
}; };

View file

@ -559,7 +559,7 @@ OptionsWindow :: constructSchedulerSection(void) throw ()
void void
OptionsWindow :: constructBackupSection(void) throw () OptionsWindow :: constructBackupSection(void) throw ()
{ {
backupView.reset(new BackupView(gLiveSupport, glade)); backupView.reset(new BackupView(this));
} }
@ -569,7 +569,7 @@ OptionsWindow :: constructBackupSection(void) throw ()
void void
OptionsWindow :: constructRdsSection(void) throw () OptionsWindow :: constructRdsSection(void) throw ()
{ {
rdsView.reset(new RdsView(gLiveSupport, glade)); rdsView.reset(new RdsView(this));
} }

View file

@ -54,13 +54,12 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
RdsEntry :: RdsEntry(Ptr<ResourceBundle>::Ref bundle, RdsEntry :: RdsEntry(GuiObject * parent,
Glib::RefPtr<Gnome::Glade::Xml> glade, int index,
int index, const Glib::ustring & type,
const Glib::ustring & type, int width)
int width)
throw () throw ()
: LocalizedObject(bundle) : GuiComponent(parent)
{ {
this->type.reset(new const Glib::ustring(type)); this->type.reset(new const Glib::ustring(type));
@ -91,7 +90,7 @@ RdsEntry :: setOptions(bool enabled,
* Save the changes made by the user. * Save the changes made by the user.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
bool bool
RdsEntry :: saveChanges(Ptr<GLiveSupport>::Ref gLiveSupport) throw () RdsEntry :: saveChanges(void) throw ()
{ {
bool checkButtonNow = checkButton->get_active(); bool checkButtonNow = checkButton->get_active();
Ptr<const Glib::ustring>::Ref Ptr<const Glib::ustring>::Ref

View file

@ -40,14 +40,12 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/NumericTools.h" #include "LiveSupport/Core/NumericTools.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -69,7 +67,7 @@ using namespace LiveSupport::GLiveSupport;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class RdsEntry : public LocalizedObject, class RdsEntry : public GuiComponent,
private NumericTools private NumericTools
{ {
private: private:
@ -110,20 +108,16 @@ class RdsEntry : public LocalizedObject,
* The type parameter is a string of 2 or 3 upper-case characters, * The type parameter is a string of 2 or 3 upper-case characters,
* see http://en.wikipedia.org/wiki/Radio_Data_System. * see http://en.wikipedia.org/wiki/Radio_Data_System.
* *
* @param bundle the resource bundle holding the localized * @param parent the GuiObject which contains this one.
* resources for this window.
* @param glade the Glade file which specifies the visual
* components for this class.
* @param index the position of this item in the list of * @param index the position of this item in the list of
* RDS entries. * RDS entries.
* @param type the type of RDS data (PS, PI, RT, etc). * @param type the type of RDS data (PS, PI, RT, etc).
* @param width the width of the entry, in characters. * @param width the width of the entry, in characters.
*/ */
RdsEntry(Ptr<ResourceBundle>::Ref bundle, RdsEntry(GuiObject * parent,
Glib::RefPtr<Gnome::Glade::Xml> glade, int index,
int index, const Glib::ustring & type,
const Glib::ustring & type, int width) throw ();
int width) throw ();
/** /**
* A virtual destructor. * A virtual destructor.
@ -158,12 +152,10 @@ class RdsEntry : public LocalizedObject,
/** /**
* Save the changes made by the user. * 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. * @return true if any changes were saved; false otherwise.
*/ */
bool bool
saveChanges(Ptr<GLiveSupport>::Ref gLiveSupport) throw (); saveChanges(void) throw ();
/** /**
* Clear the entries of the widget. * Clear the entries of the widget.

View file

@ -44,6 +44,14 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "rdsView";
}
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */
@ -53,23 +61,20 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
RdsView :: RdsView (Ptr<GLiveSupport>::Ref gLiveSupport, RdsView :: RdsView (GuiObject * parent)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: gLiveSupport(gLiveSupport) : GuiComponent(parent,
bundleName)
{ {
Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle("rdsView");
setBundle(bundle);
Gtk::Label * deviceLabel; Gtk::Label * deviceLabel;
glade->get_widget("rdsDeviceLabel1", deviceLabel); glade->get_widget("rdsDeviceLabel1", deviceLabel);
deviceLabel->set_label(*getResourceUstring("deviceLabel")); deviceLabel->set_label(*getResourceUstring("deviceLabel"));
glade->get_widget("rdsDeviceEntry1", deviceEntry); glade->get_widget("rdsDeviceEntry1", deviceEntry);
Ptr<RdsEntry>::Ref psEntry(new RdsEntry(getBundle(), glade, 0, "PS", 8)); Ptr<RdsEntry>::Ref psEntry(new RdsEntry(this, 0, "PS", 8));
Ptr<RdsEntry>::Ref piEntry(new RdsEntry(getBundle(), glade, 1, "PI", 4)); Ptr<RdsEntry>::Ref piEntry(new RdsEntry(this, 1, "PI", 4));
Ptr<RdsEntry>::Ref rtEntry(new RdsEntry(getBundle(), glade, 2, "RT", 32)); Ptr<RdsEntry>::Ref rtEntry(new RdsEntry(this, 2, "RT", 32));
rdsEntryList.push_back(psEntry); rdsEntryList.push_back(psEntry);
rdsEntryList.push_back(piEntry); rdsEntryList.push_back(piEntry);
@ -100,7 +105,7 @@ RdsView :: saveChanges(void) throw ()
RdsEntryListType::const_iterator it; RdsEntryListType::const_iterator it;
for (it = rdsEntryList.begin(); it != rdsEntryList.end(); ++it) { for (it = rdsEntryList.begin(); it != rdsEntryList.end(); ++it) {
Ptr<RdsEntry>::Ref rdsEntry = *it; Ptr<RdsEntry>::Ref rdsEntry = *it;
touched |= rdsEntry->saveChanges(gLiveSupport); touched |= rdsEntry->saveChanges();
} }
return touched; return touched;

View file

@ -40,15 +40,15 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "RdsEntry.h" #include "RdsEntry.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -88,7 +88,7 @@ using namespace LiveSupport::Core;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class RdsView : public LocalizedObject class RdsView : public GuiComponent
{ {
private: private:
@ -113,11 +113,6 @@ class RdsView : public LocalizedObject
protected: protected:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* The entry field for the serial device. * The entry field for the serial device.
*/ */
@ -125,16 +120,13 @@ class RdsView : public LocalizedObject
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing * @param parent the GuiObject which contains this one.
* all the vital info.
* @param glade the Glade file which specifies the visual
* components for this class.
*/ */
RdsView(Ptr<GLiveSupport>::Ref gLiveSupport, RdsView(GuiObject * parent)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -108,10 +108,9 @@ ScratchpadWindow :: ScratchpadWindow (
&ScratchpadWindow::onKeyPressed)); &ScratchpadWindow::onKeyPressed));
// create the cue player widget // create the cue player widget
cuePlayer.reset(new CuePlayer(gLiveSupport, cuePlayer.reset(new CuePlayer(this,
treeView, treeView,
modelColumns, modelColumns));
glade));
// create the right-click entry context menu for audio clips // create the right-click entry context menu for audio clips
audioClipMenu.reset(new Gtk::Menu()); audioClipMenu.reset(new Gtk::Menu());

View file

@ -166,7 +166,7 @@ SearchWindow :: constructSimpleSearchView(void) throw ()
void void
SearchWindow :: constructAdvancedSearchView(void) throw () SearchWindow :: constructAdvancedSearchView(void) throw ()
{ {
advancedSearchEntry.reset(new AdvancedSearchEntry(gLiveSupport, glade)); advancedSearchEntry.reset(new AdvancedSearchEntry(this));
advancedSearchEntry->connectCallback(sigc::mem_fun(*this, advancedSearchEntry->connectCallback(sigc::mem_fun(*this,
&SearchWindow::onAdvancedSearch )); &SearchWindow::onAdvancedSearch ));
@ -184,7 +184,7 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
void void
SearchWindow :: constructBrowseView(void) throw () SearchWindow :: constructBrowseView(void) throw ()
{ {
browseEntry.reset(new BrowseEntry(gLiveSupport, getBundle(), glade)); browseEntry.reset(new BrowseEntry(this));
browseEntry->signalChanged().connect(sigc::mem_fun(*this, browseEntry->signalChanged().connect(sigc::mem_fun(*this,
&SearchWindow::onBrowse)); &SearchWindow::onBrowse));
} }
@ -196,10 +196,7 @@ SearchWindow :: constructBrowseView(void) throw ()
void void
SearchWindow :: constructTransportsView(void) throw () SearchWindow :: constructTransportsView(void) throw ()
{ {
transportList.reset(new TransportList( transportList.reset(new TransportList(this));
gLiveSupport,
gLiveSupport->getBundle("transportList"),
glade));
} }

View file

@ -48,6 +48,11 @@ using namespace LiveSupport::GLiveSupport;
namespace { namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "transportList";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The localization key for the 'working' status. * The localization key for the 'working' status.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -88,12 +93,10 @@ const Glib::ustring downloadSymbol = "⇩";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
TransportList :: TransportList(Ptr<GLiveSupport>::Ref gLiveSupport, TransportList :: TransportList(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: LocalizedObject(bundle), : GuiComponent(parent,
gLiveSupport(gLiveSupport) bundleName)
{ {
// create the tree view // create the tree view
treeModel = Gtk::ListStore::create(modelColumns); treeModel = Gtk::ListStore::create(modelColumns);

View file

@ -40,17 +40,16 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/UniqueId.h" #include "LiveSupport/Core/UniqueId.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/XmlRpcException.h" #include "LiveSupport/Core/XmlRpcException.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h" #include "LiveSupport/Widgets/ZebraTreeView.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -90,7 +89,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class TransportList : public LocalizedObject, class TransportList : public GuiComponent,
public ContentsStorable public ContentsStorable
{ {
private: private:
@ -160,11 +159,6 @@ class TransportList : public LocalizedObject,
protected: protected:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/** /**
* The columns model needed by ZebraTreeView. * The columns model needed by ZebraTreeView.
* *
@ -266,16 +260,9 @@ class TransportList : public LocalizedObject,
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing * @param parent the GuiObject which contains this one.
* 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.
*/ */
TransportList(Ptr<GLiveSupport>::Ref gLiveSupport, TransportList(GuiObject * parent) throw ();
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade) throw ();
/** /**
* Virtual destructor. * Virtual destructor.