diff --git a/livesupport/products/gLiveSupport/etc/Makefile.in b/livesupport/products/gLiveSupport/etc/Makefile.in index e7b8a1893..9e64c1648 100644 --- a/livesupport/products/gLiveSupport/etc/Makefile.in +++ b/livesupport/products/gLiveSupport/etc/Makefile.in @@ -20,8 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # -# Author : $Author: fgerlits $ -# Version : $Revision: 1.22 $ +# Author : $Author: maroy $ +# Version : $Revision: 1.23 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $ # # @configure_input@ @@ -108,6 +108,12 @@ PLAYLIST_EXECUTOR_LIB_DIR = ${PLAYLIST_EXECUTOR_DIR}/lib PLAYLIST_EXECUTOR_LIB = livesupport_playlist_executor PLAYLIST_EXECUTOR_LIB_FILE = ${PLAYLIST_EXECUTOR_LIB_DIR}/lib${PLAYLIST_EXECUTOR_LIB}.a +WIDGETS_DIR = ${MODULES_DIR}/widgets +WIDGETS_INCLUDE_DIR = ${WIDGETS_DIR}/include +WIDGETS_LIB_DIR = ${WIDGETS_DIR}/lib +WIDGETS_LIB = livesupport_widgets +WIDGETS_LIB_FILE = ${WIDGETS_LIB_DIR}/lib${WIDGETS_LIB}.a + LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@ LIBXMLPP_LIBS=@LIBXMLPP_LIBS@ @@ -149,6 +155,7 @@ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \ -I${CORE_INCLUDE_DIR} \ -I${AUTHENTICATION_INCLUDE_DIR} \ -I${STORAGE_INCLUDE_DIR} \ + -I${WIDGETS_INCLUDE_DIR} \ -I${SCHEDULER_CLIENT_INCLUDE_DIR} \ -I${PLAYLIST_EXECUTOR_INCLUDE_DIR} \ -I${TMP_DIR} @@ -163,6 +170,7 @@ LDFLAGS = @LDFLAGS@ -pthread \ -L${CORE_LIB_DIR} \ -L${AUTHENTICATION_LIB_DIR} \ -L${STORAGE_LIB_DIR} \ + -L${WIDGETS_LIB_DIR} \ -L${SCHEDULER_CLIENT_LIB_DIR} \ -L${PLAYLIST_EXECUTOR_LIB_DIR} @@ -194,6 +202,7 @@ FSDF = ${G_LIVESUPPORT_OBJS} \ G_LIVESUPPORT_EXE_LIBS = -l${PLAYLIST_EXECUTOR_LIB} \ -l${AUTHENTICATION_LIB} \ -l${STORAGE_LIB} \ + -l${WIDGETS_LIB} \ -l${SCHEDULER_CLIENT_LIB} \ -l${CORE_LIB} \ ${HELIX_LIBS} \ @@ -231,6 +240,7 @@ docclean: depclean: clean ${MAKE} -C ${PLAYLIST_EXECUTOR_DIR} clean ${MAKE} -C ${SCHEDULER_CLIENT_DIR} clean + ${MAKE} -C ${WIDGETS_DIR} clean ${MAKE} -C ${STORAGE_DIR} clean ${MAKE} -C ${AUTHENTICATION_DIR} clean ${MAKE} -C ${CORE_DIR} clean @@ -267,6 +277,7 @@ uninstall: ${SCHEDULER_EXE} ${G_LIVESUPPORT_EXE}: ${CORE_LIB_FILE} \ ${AUTHENTICATION_LIB_FILE} \ ${STORAGE_LIB_FILE} \ + ${WIDGETS_LIB_FILE} \ ${SCHEDULER_CLIENT_LIB_FILE} \ ${PLAYLIST_EXECUTOR_LIB_FILE} \ ${G_LIVESUPPORT_OBJS} ${G_LIVESUPPORT_EXE_OBJS} @@ -281,6 +292,7 @@ ${DOXYGEN_DIR}: ${TEST_RUNNER}: ${CORE_LIB_FILE} \ ${AUTHENTICATION_LIB_FILE} \ ${STORAGE_LIB_FILE} \ + ${WIDGETS_LIB_FILE} \ ${SCHEDULER_CLIENT_LIB_FILE} \ ${TEST_RUNNER_OBJS} ${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS} @@ -294,6 +306,9 @@ ${AUTHENTICATION_LIB_FILE}: ${STORAGE_LIB_FILE}: ${MAKE} -C ${STORAGE_DIR} +${WIDGETS_LIB_FILE}: + ${MAKE} -C ${WIDGETS_DIR} + ${SCHEDULER_CLIENT_LIB_FILE}: ${MAKE} -C ${SCHEDULER_CLIENT_DIR} diff --git a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml index fe8a319e6..d908ced04 100644 --- a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml +++ b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml @@ -3,6 +3,7 @@ + + + @@ -84,6 +88,8 @@ + + ::Ref stcf = StorageClientFactory::getInstance(); stcf->configure( *((const xmlpp::Element*) *(nodes.begin())) ); storage = stcf->getStorageClient(); + // configure the WidgetFactory + nodes = element.get_children(WidgetFactory::getConfigElementName()); + if (nodes.size() < 1) { + throw std::invalid_argument("no widgetFactory element"); + } + widgetFactory = WidgetFactory::getInstance(); + widgetFactory->configure( *((const xmlpp::Element*) *(nodes.begin())) ); + // configure the SchedulerClientFactory nodes = element.get_children( SchedulerClientFactory::getConfigElementName()); diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index cf5fe7dd3..ce09f2c0e 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.17 $ + Version : $Revision: 1.18 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -52,6 +52,7 @@ #include "LiveSupport/Storage/StorageClientInterface.h" #include "LiveSupport/SchedulerClient/SchedulerClientInterface.h" #include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h" +#include "LiveSupport/Widgets/WidgetFactory.h" namespace LiveSupport { namespace GLiveSupport { @@ -61,6 +62,7 @@ using namespace LiveSupport::SchedulerClient; using namespace LiveSupport::Authentication; using namespace LiveSupport::Storage; using namespace LiveSupport::PlaylistExecutor; +using namespace LiveSupport::Widgets; /* ================================================================ constants */ @@ -83,9 +85,12 @@ class MasterPanelWindow; * *

  *  
+ *                                         schedulerClientFactory,
+ *                                         audioPlayer) >
  *  
* * For a description of the resourceBundle, @@ -95,7 +100,7 @@ class MasterPanelWindow; * respective documentation. * * @author $Author: maroy $ - * @version $Revision: 1.17 $ + * @version $Revision: 1.18 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -137,6 +142,11 @@ class GLiveSupport : public LocalizedConfigurable, */ Ptr::Ref storage; + /** + * The widget factory, containing our own widgets. + */ + Ptr::Ref widgetFactory; + /** * The scheduler client, used to access the scheduler daemon. */ diff --git a/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx b/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx index 55edad3a3..2952db6f2 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx +++ b/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx,v $ ------------------------------------------------------------------------------*/ @@ -43,6 +43,7 @@ #include "MasterPanelUserInfoWidget.h" +using namespace LiveSupport::Widgets; using namespace LiveSupport::GLiveSupport; /* =================================================== local data structures */ @@ -68,7 +69,7 @@ MasterPanelUserInfoWidget :: MasterPanelUserInfoWidget ( this->gLiveSupport = gLiveSupport; loggedIn = false; - logInOutButton.reset(new Gtk::Button()); + logInOutButton = WidgetFactory::getInstance()->createButton(""); logInOutSignalConnection = logInOutButton->signal_clicked().connect(sigc::mem_fun(*this, &MasterPanelUserInfoWidget::onLoginButtonClicked)); diff --git a/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.h b/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.h index a6f49c2a6..703d7378e 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.h +++ b/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.h,v $ ------------------------------------------------------------------------------*/ @@ -51,6 +51,7 @@ namespace LiveSupport { namespace GLiveSupport { +using namespace LiveSupport; using namespace LiveSupport::Core; /* ================================================================ constants */ @@ -67,7 +68,7 @@ using namespace LiveSupport::Core; * This widget handles login and login info display. * * @author $Author: maroy $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class MasterPanelUserInfoWidget : public Gtk::Table, public LocalizedObject @@ -76,7 +77,7 @@ class MasterPanelUserInfoWidget : public Gtk::Table, /** * The login / logout button. */ - Ptr::Ref logInOutButton; + Ptr::Ref logInOutButton; /** * A label to display the currently logged in user. diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx index 8eb821e02..84873bb10 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.9 $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -44,6 +44,7 @@ #include "MasterPanelWindow.h" +using namespace LiveSupport; using namespace LiveSupport::GLiveSupport; /* =================================================== local data structures */ @@ -67,37 +68,71 @@ MasterPanelWindow :: MasterPanelWindow (Ptr::Ref gLiveSupport, { this->gLiveSupport = gLiveSupport; - lsLogoWidget.reset(new Gtk::Label("lsLogo")); - nowPlayingWidget.reset(new Gtk::Label("now playing")); - vuMeterWidget.reset(new Gtk::Label("VU meter")); - nextPlayingWidget.reset(new Gtk::Label("next playing")); - onAirWidget.reset(new Gtk::Label("on air")); - radioLogoWidget.reset(new Gtk::Label("radio logo")); - userInfoWidget.reset(new MasterPanelUserInfoWidget(gLiveSupport, bundle)); + Ptr::Ref widgetFactory = WidgetFactory::getInstance(); + + // TODO: remove hard-coded station logo path reference + radioLogoWidget.reset(new Gtk::Image("var/stationLogo.png")); // set up the layout, which is a button box layout.reset(new Gtk::Table()); - // set the localized resources - changeLanguage(bundle); - // set up the time label timeWidget.reset(new Gtk::Label("time")); + timeBin = widgetFactory->createBlueBin(); + timeBin->add(*timeWidget); + + // set up the now playing widget + nowPlayingWidget.reset(new Gtk::Label("now playing")); + nowPlayingBin = widgetFactory->createDarkBlueBin(); + nowPlayingBin->add(*nowPlayingWidget); + + // set up the VU meter widget + vuMeterWidget.reset(new Gtk::Label("VU meter")); + vuMeterBin = widgetFactory->createBlueBin(); + vuMeterBin->add(*vuMeterWidget); + + // set up the next playing widget + nextPlayingWidget.reset(new Gtk::Label("next playing")); + nextPlayingBin = widgetFactory->createBlueBin(); + nextPlayingBin->add(*nextPlayingWidget); + + // create the bottom bar + bottomBar.reset(new Gtk::Table()); + buttonBar.reset(new Gtk::Table()); + buttonBarAlignment.reset(new Gtk::Alignment(Gtk::ALIGN_LEFT, + Gtk::ALIGN_CENTER, + 0, 0)); + buttonBarAlignment->add(*buttonBar); + userInfoWidget.reset(new MasterPanelUserInfoWidget(gLiveSupport, bundle)); + userInfoAlignment.reset(new Gtk::Alignment(Gtk::ALIGN_RIGHT, + Gtk::ALIGN_CENTER, + 0, 0)); + userInfoAlignment->add(*userInfoWidget); + bottomBar->attach(*buttonBarAlignment, 0, 1, 0, 1); + bottomBar->attach(*userInfoAlignment, 1, 2, 0, 1); // set up the main window, and show everything // all the localized widgets were set up in changeLanguage() set_border_width(10); - layout->attach(*lsLogoWidget, 0, 1, 0, 2); - layout->attach(*timeWidget, 1, 2, 0, 2); - layout->attach(*nowPlayingWidget, 2, 3, 0, 2); - layout->attach(*vuMeterWidget, 3, 4, 0, 1); - layout->attach(*nextPlayingWidget, 3, 4, 1, 2); - layout->attach(*onAirWidget, 4, 5, 0, 1); - layout->attach(*radioLogoWidget, 5, 6, 0, 1); - layout->attach(*userInfoWidget, 4, 6, 1, 2); + layout->attach(*timeBin, 0, 1, 0, 2); + layout->attach(*nowPlayingBin, 1, 2, 0, 2); + layout->attach(*vuMeterBin, 2, 3, 0, 1); + layout->attach(*nextPlayingBin, 2, 3, 1, 2); + layout->attach(*radioLogoWidget, 3, 4, 0, 2); + layout->attach(*bottomBar, 0, 4, 2, 3); add(*layout); + // set the background to white + bgColor = Gdk::Color(); + bgColor.set_rgb(0xffff, 0xffff, 0xffff); + Glib::RefPtr colormap = get_default_colormap(); + colormap->alloc_color(bgColor); + modify_bg(Gtk::STATE_NORMAL, bgColor); + + // set the localized resources + changeLanguage(bundle); + // show what's there to see showAnonymousUI(); @@ -127,14 +162,16 @@ MasterPanelWindow :: changeLanguage(Ptr::Ref bundle) try { set_title(*getResourceUstring("windowTitle")); - uploadFileButton.reset(new Gtk::Button( - *getResourceUstring("uploadFileButtonLabel"))); - djBagButton.reset(new Gtk::Button( - *getResourceUstring("djBagButtonLabel"))); - simplePlaylistMgmtButton.reset(new Gtk::Button( - *getResourceUstring("simplePlaylistMgmtButtonLabel"))); - schedulerButton.reset(new Gtk::Button( - *getResourceUstring("schedulerButtonLabel"))); + Ptr::Ref wf = WidgetFactory::getInstance(); + + uploadFileButton = wf->createButton( + *getResourceUstring("uploadFileButtonLabel")); + djBagButton = wf->createButton( + *getResourceUstring("djBagButtonLabel")); + simplePlaylistMgmtButton = wf->createButton( + *getResourceUstring("simplePlaylistMgmtButtonLabel")); + schedulerButton = wf->createButton( + *getResourceUstring("schedulerButtonLabel")); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; } @@ -142,10 +179,10 @@ MasterPanelWindow :: changeLanguage(Ptr::Ref bundle) userInfoWidget->changeLanguage(bundle); // re-attach the localized widgets to the layout - layout->attach(*uploadFileButton, 0, 1, 2, 3); - layout->attach(*djBagButton, 1, 2, 2, 3); - layout->attach(*simplePlaylistMgmtButton, 2, 3, 2, 3); - layout->attach(*schedulerButton, 3, 4, 2, 3); + buttonBar->attach(*uploadFileButton, 0, 1, 0, 1); + buttonBar->attach(*djBagButton, 1, 2, 0, 1); + buttonBar->attach(*simplePlaylistMgmtButton, 2, 3, 0, 1); + buttonBar->attach(*schedulerButton, 3, 4, 0, 1); // re-bind events to the buttons uploadFileButton->signal_clicked().connect(sigc::mem_fun(*this, @@ -315,6 +352,7 @@ void MasterPanelWindow :: showAnonymousUI(void) throw () { show_all(); + buttonBar->hide(); uploadFileButton->hide(); djBagButton->hide(); simplePlaylistMgmtButton->hide(); diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h index 4d8d13554..cc530f4be 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.7 $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ #include #include +#include #include #include "LiveSupport/Core/Ptr.h" @@ -58,6 +59,7 @@ namespace LiveSupport { namespace GLiveSupport { using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; /* ================================================================ constants */ @@ -72,19 +74,21 @@ using namespace LiveSupport::Core; * * The layout of the window is roughly the following: *

- *  +--- master panel --------------------------------------------------------+
- *  | + LS logo + + time + + now ----+ + VU meter + + on-air + + radio logo + |
- *  | |         | |      | | playing | |          | |        | |            | |
- *  | |         | |      | |         | +----------+ +--------+ +------------+ |
- *  | |         | |      | |         | + next ----+ + user info ------------+ |
- *  | |         | |      | |         | | playing  | |                       | |
- *  | +---------+ +------+ +---------+ +----------+ +-----------------------+ |
- *  | +-- button bar -------------------------------------------------------+ |
- *  +-------------------------------------------------------------------------+
+ *  +--- master panel ---------------------------------+
+ *  | + time + + now ----+ + VU meter + + radio logo + |
+ *  | |      | | playing | |          | |            | |
+ *  | |      | |         | +----------+ |            | |
+ *  | |      | |         | + next ----+ |            | |
+ *  | |      | |         | | playing  | |            | |
+ *  | +------+ +---------+ +----------+ +------------+ |
+ *  | +-- bottom bar --------------------------------+ |
+ *  | | +-- button bar -----------+ +-- user info -+ | |
+ *  | +----------------------------------------------+ |
+ *  +--------------------------------------------------+
  *  
* * @author $Author: maroy $ - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ class MasterPanelWindow : public Gtk::Window, public LocalizedObject { @@ -95,9 +99,14 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject Ptr::Ref layout; /** - * The LiveSupport logo + * The background color. */ - Ptr::Ref lsLogoWidget; + Gdk::Color bgColor; + + /** + * The container for the time widget + */ + Ptr::Ref timeBin; /** * The time display @@ -110,25 +119,40 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject */ Ptr::Ref timer; + /** + * The container for the now playing widget + */ + Ptr::Ref nowPlayingBin; + /** * The 'now playing' display. */ Ptr::Ref nowPlayingWidget; + /** + * The container for the VU meter widget + */ + Ptr::Ref vuMeterBin; + /** * The VU meter display. */ Ptr::Ref vuMeterWidget; + /** + * The container for the next playing widget. + */ + Ptr::Ref nextPlayingBin; + /** * The 'next playing' display. */ Ptr::Ref nextPlayingWidget; /** - * The on-air indicator. + * The user info alignment helper. */ - Ptr::Ref onAirWidget; + Ptr::Ref userInfoAlignment; /** * The user info widget. @@ -138,27 +162,42 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject /** * The radio logo. */ - Ptr::Ref radioLogoWidget; + Ptr::Ref radioLogoWidget; + + /** + * The bottom bar. + */ + Ptr::Ref bottomBar; + + /** + * The button bar alignment helper + */ + Ptr::Ref buttonBarAlignment; + + /** + * The button bar. + */ + Ptr::Ref buttonBar; /** * The button to invoke the upload file window. */ - Ptr::Ref uploadFileButton; + Ptr