diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 90f323fd0..b68e91f56 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.18 $ + Version : $Revision: 1.19 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $ ------------------------------------------------------------------------------*/ @@ -89,7 +89,7 @@ class ZebraTreeView; * * * @author $Author: fgerlits $ - * @version $Revision: 1.18 $ + * @version $Revision: 1.19 $ */ class WidgetFactory : virtual public Configurable @@ -106,7 +106,8 @@ class WidgetFactory : typedef enum { deleteButton, plusButton, smallPlayButton, smallPauseButton, smallStopButton, hugePlayButton, - cuePlayButton, cueStopButton } + cuePlayButton, cueStopButton, + masterPlayButton, masterPauseButton, masterStopButton } ImageButtonType; /** diff --git a/livesupport/modules/widgets/src/WidgetFactory.cxx b/livesupport/modules/widgets/src/WidgetFactory.cxx index a383e051e..12118f94a 100644 --- a/livesupport/modules/widgets/src/WidgetFactory.cxx +++ b/livesupport/modules/widgets/src/WidgetFactory.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.20 $ + Version : $Revision: 1.21 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $ ------------------------------------------------------------------------------*/ @@ -187,6 +187,42 @@ static const std::string cueStopButtonPassiveName static const std::string cueStopButtonRollName = "imageButton/cueStopRoll.png"; +/** + * The name of the passive image for the master panel play button. + */ +static const std::string masterPlayButtonPassiveName + = "imageButton/masterPlay.gif"; + +/** + * The name of the rollover image for the master panel play button. + */ +static const std::string masterPlayButtonRollName + = "imageButton/masterPlayRoll.gif"; + +/** + * The name of the passive image for the master panel pause button. + */ +static const std::string masterPauseButtonPassiveName + = "imageButton/masterPause.gif"; + +/** + * The name of the rollover image for the master panel pause button. + */ +static const std::string masterPauseButtonRollName + = "imageButton/masterPauseRoll.gif"; + +/** + * The name of the passive image for the master panel stop button. + */ +static const std::string masterStopButtonPassiveName + = "imageButton/masterStop.gif"; + +/** + * The name of the rollover image for the master panel stop button. + */ +static const std::string masterStopButtonRollName + = "imageButton/masterStopRoll.gif"; + /** * The name of the combo box left image. */ @@ -414,6 +450,21 @@ WidgetFactory :: createButton(ImageButtonType type) throw () rollImage = loadImage(cueStopButtonRollName); break; + case masterPlayButton: + passiveImage = loadImage(masterPlayButtonPassiveName); + rollImage = loadImage(masterPlayButtonRollName); + break; + + case masterPauseButton: + passiveImage = loadImage(masterPauseButtonPassiveName); + rollImage = loadImage(masterPauseButtonRollName); + break; + + case masterStopButton: + passiveImage = loadImage(masterStopButtonPassiveName); + rollImage = loadImage(masterStopButtonRollName); + break; + default: return 0; } diff --git a/livesupport/products/gLiveSupport/etc/Makefile.in b/livesupport/products/gLiveSupport/etc/Makefile.in index 3869dad19..18e025ebe 100644 --- a/livesupport/products/gLiveSupport/etc/Makefile.in +++ b/livesupport/products/gLiveSupport/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: fgerlits $ -# Version : $Revision: 1.33 $ +# Version : $Revision: 1.34 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $ # # @configure_input@ @@ -181,6 +181,7 @@ LDFLAGS = @LDFLAGS@ -pthread \ #------------------------------------------------------------------------------- G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \ ${TMP_DIR}/MasterPanelWindow.o \ + ${TMP_DIR}/NowPlaying.o \ ${TMP_DIR}/MasterPanelUserInfoWidget.o \ ${TMP_DIR}/LoginWindow.o \ ${TMP_DIR}/AudioClipListWindow.o \ diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx index 0a5429634..8fef1d6f9 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.30 $ + Version : $Revision: 1.31 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -81,7 +81,7 @@ MasterPanelWindow :: MasterPanelWindow (Ptr::Ref gLiveSupport, timeBin->set_size_request(153, 104); // set up the now playing widget - nowPlayingWidget = Gtk::manage(new Gtk::Label("")); + nowPlayingWidget = Gtk::manage(new NowPlaying(gLiveSupport, bundle)); nowPlayingBin = Gtk::manage(widgetFactory->createDarkBlueBin()); nowPlayingBin->add(*nowPlayingWidget); nowPlayingBin->set_size_request(-1, 104); @@ -121,22 +121,22 @@ MasterPanelWindow :: MasterPanelWindow (Ptr::Ref gLiveSupport, // set up the main window, and show everything // all the localized widgets were set up in changeLanguage() set_border_width(10); - layout->attach(*timeBin, 0, 1, 0, 2, + layout->attach(*timeBin, 0, 1, 0, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - layout->attach(*nowPlayingBin, 1, 2, 0, 2, + layout->attach(*nowPlayingBin, 1, 2, 0, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 5, 0); - layout->attach(*vuMeterBin, 2, 3, 0, 1, + layout->attach(*vuMeterBin, 2, 3, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - layout->attach(*nextPlayingBin, 2, 3, 1, 2, + layout->attach(*nextPlayingBin, 2, 3, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - layout->attach(*radioLogoWidget, 3, 4, 0, 2, + layout->attach(*radioLogoWidget, 3, 4, 0, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 5, 0); - layout->attach(*bottomBar, 0, 4, 2, 3, + layout->attach(*bottomBar, 0, 4, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); add(*layout); @@ -569,27 +569,6 @@ void MasterPanelWindow :: setNowPlaying(Ptr::Ref playable) throw () { - Gtk::Label * label = dynamic_cast( - nowPlayingWidget ); - if (playable) { - Ptr::Ref infoString(new Glib::ustring); - - infoString->append(""); - infoString->append(Glib::Markup::escape_text(*playable->getTitle())); - infoString->append(" "); - - // TODO: rewrite this using the Core::Metadata class - - Ptr::Ref - creator = playable->getMetadata("dc:creator"); - if (creator) { - infoString->append(""); - infoString->append(Glib::Markup::escape_text(*creator)); - infoString->append(""); - } - label->set_markup(*infoString); - } else { - label->set_text(""); - } + nowPlayingWidget->setPlayable(playable); } diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h index 57fd532eb..f1348d1e9 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.18 $ + Version : $Revision: 1.19 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -49,6 +49,7 @@ #include "LiveSupport/Core/LocalizedObject.h" #include "GLiveSupport.h" +#include "NowPlaying.h" #include "MasterPanelUserInfoWidget.h" #include "LiveModeWindow.h" #include "UploadFileWindow.h" @@ -91,7 +92,7 @@ using namespace LiveSupport::Widgets; * * * @author $Author: fgerlits $ - * @version $Revision: 1.18 $ + * @version $Revision: 1.19 $ */ class MasterPanelWindow : public Gtk::Window, public LocalizedObject { @@ -130,7 +131,7 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject /** * The 'now playing' display. */ - Gtk::Widget * nowPlayingWidget; + NowPlaying * nowPlayingWidget; /** * The container for the VU meter widget diff --git a/livesupport/products/gLiveSupport/src/NowPlaying.cxx b/livesupport/products/gLiveSupport/src/NowPlaying.cxx new file mode 100644 index 000000000..36b2497d1 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/NowPlaying.cxx @@ -0,0 +1,171 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport 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. + + LiveSupport 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 LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include "LiveSupport/Widgets/WidgetFactory.h" + +#include "NowPlaying.h" + + +using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; +using namespace LiveSupport::GLiveSupport; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Constructor. + *----------------------------------------------------------------------------*/ +NowPlaying :: NowPlaying(Ptr::Ref gLiveSupport, + Ptr::Ref bundle) + throw () + : LocalizedObject(bundle), + gLiveSupport(gLiveSupport) +{ + Ptr::Ref wf = WidgetFactory::getInstance(); + + playButton = Gtk::manage(wf->createButton( + WidgetFactory::masterPlayButton )); + pauseButton = Gtk::manage(wf->createButton( + WidgetFactory::masterPauseButton )); + stopButton = Gtk::manage(wf->createButton( + WidgetFactory::masterStopButton )); + + playButton->signal_clicked().connect(sigc::mem_fun(*this, + &NowPlaying::onPlayButtonClicked )); + pauseButton->signal_clicked().connect(sigc::mem_fun(*this, + &NowPlaying::onPauseButtonClicked )); + stopButton->signal_clicked().connect(sigc::mem_fun(*this, + &NowPlaying::onStopButtonClicked )); + + isActive = false; + + label = Gtk::manage(new Gtk::Label); + label->set_ellipsize(Pango::ELLIPSIZE_END); + pack_end(*label, Gtk::PACK_EXPAND_WIDGET, 5); +} + + +/*------------------------------------------------------------------------------ + * Set the title etc. of the playable shown in the widget. + *----------------------------------------------------------------------------*/ +void +NowPlaying :: setPlayable(Ptr::Ref playable) throw () +{ + if (playable) { + if (!isActive) { + pack_end(*stopButton, Gtk::PACK_SHRINK, 0); + pack_end(*pauseButton, Gtk::PACK_SHRINK, 2); + stopButton->show(); + pauseButton->show(); + isActive = true; + } + + Ptr::Ref infoString(new Glib::ustring); + + infoString->append(""); + infoString->append(Glib::Markup::escape_text(*playable->getTitle())); + infoString->append(" "); + + // TODO: rewrite this using the Core::Metadata class + + Ptr::Ref + creator = playable->getMetadata("dc:creator"); + if (creator) { + infoString->append(""); + infoString->append(Glib::Markup::escape_text(*creator)); + infoString->append(""); + } + label->set_markup(*infoString); + this->playable = playable; + } else { + label->set_text(""); + if (isActive) { + remove(*stopButton); + remove(*pauseButton); + isActive = false; + } + this->playable.reset(); + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Play button being clicked. + *----------------------------------------------------------------------------*/ +void +NowPlaying :: onPlayButtonClicked(void) throw () +{ + gLiveSupport->pauseOutputAudio(); // i.e., restart + + remove(*playButton); + pack_end(*pauseButton, Gtk::PACK_SHRINK, 2); + pauseButton->show(); +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Pause button being clicked. + *----------------------------------------------------------------------------*/ +void +NowPlaying :: onPauseButtonClicked(void) throw () +{ + gLiveSupport->pauseOutputAudio(); + + remove(*pauseButton); + pack_end(*playButton, Gtk::PACK_SHRINK, 2); + playButton->show(); +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Stop button being clicked. + *----------------------------------------------------------------------------*/ +void +NowPlaying :: onStopButtonClicked(void) throw () +{ + gLiveSupport->stopOutputAudio(); +} + diff --git a/livesupport/products/gLiveSupport/src/NowPlaying.h b/livesupport/products/gLiveSupport/src/NowPlaying.h new file mode 100644 index 000000000..eec30fd50 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/NowPlaying.h @@ -0,0 +1,176 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport 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. + + LiveSupport 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 LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef LiveSupport_GLiveSupport_NowPlaying_h +#define LiveSupport_GLiveSupport_NowPlaying_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Core/LocalizedObject.h" + +#include "GLiveSupport.h" + + +namespace LiveSupport { +namespace GLiveSupport { + +using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * The box displaying "now playing" in the master panel. + * + * @author $Author: fgerlits $ + * @version $Revision: 1.1 $ + */ +class NowPlaying : public Gtk::HBox, + public LocalizedObject +{ + private: + + /** + * Whether anything is shown in the widget. + */ + bool isActive; + + /** + * The playable which is shown in the widget. + */ + Ptr::Ref playable; + + /** + * The label holding the title etc. of the now playing item. + */ + Gtk::Label * label; + + /** + * The play button. + */ + ImageButton * playButton; + + /** + * The pause button. + */ + ImageButton * pauseButton; + + /** + * The stop button. + */ + ImageButton * stopButton; + + /** + * The GLiveSupport object, holding the state of the application. + */ + Ptr::Ref gLiveSupport; + + /** + * Default constructor. + */ + NowPlaying(void) throw (); + + /** + * Event handler for the Play button being clicked. + */ + void + onPlayButtonClicked(void) throw (); + + /** + * Event handler for the Pause button being clicked. + */ + void + onPauseButtonClicked(void) throw (); + + /** + * Event handler for the Stop button being clicked. + */ + void + onStopButtonClicked(void) throw (); + + + public: + + /** + * Constructor with parent and localization parameter. + * + * @param gLiveSupport the GLiveSupport, application object. + * @param bundle the resource bundle holding the localized + * resources for this widget + */ + NowPlaying(Ptr::Ref gLiveSupport, + Ptr::Ref bundle) + throw (); + + /** + * A virtual destructor. + */ + virtual + ~NowPlaying(void) throw () + { + } + + /** + * Set the title etc. of the now playing item. + * + * @param playable the playable to be displayed + */ + void + setPlayable(Ptr::Ref playable) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace GLiveSupport +} // namespace LiveSupport + +#endif // LiveSupport_GLiveSupport_NowPlaying_h + diff --git a/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPause.gif b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPause.gif new file mode 100644 index 000000000..b8b358f10 Binary files /dev/null and b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPause.gif differ diff --git a/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPauseRoll.gif b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPauseRoll.gif new file mode 100644 index 000000000..b8b358f10 Binary files /dev/null and b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPauseRoll.gif differ diff --git a/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPlay.gif b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPlay.gif new file mode 100644 index 000000000..21c495156 Binary files /dev/null and b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPlay.gif differ diff --git a/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPlayRoll.gif b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPlayRoll.gif new file mode 100644 index 000000000..86d70abb9 Binary files /dev/null and b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterPlayRoll.gif differ diff --git a/livesupport/products/gLiveSupport/var/widgets/imageButton/masterStop.gif b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterStop.gif new file mode 100644 index 000000000..1c06242be Binary files /dev/null and b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterStop.gif differ diff --git a/livesupport/products/gLiveSupport/var/widgets/imageButton/masterStopRoll.gif b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterStopRoll.gif new file mode 100644 index 000000000..a86a086e3 Binary files /dev/null and b/livesupport/products/gLiveSupport/var/widgets/imageButton/masterStopRoll.gif differ