added first version of Master Panel buttons

This commit is contained in:
fgerlits 2005-05-10 18:47:01 +00:00
parent d24ccaea70
commit a40d2e523c
13 changed files with 418 additions and 38 deletions

View file

@ -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;
* </code></pre>
*
* @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;
/**

View file

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

View file

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

View file

@ -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<GLiveSupport>::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<GLiveSupport>::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<Playable>::Ref playable)
throw ()
{
Gtk::Label * label = dynamic_cast<Gtk::Label *>(
nowPlayingWidget );
if (playable) {
Ptr<Glib::ustring>::Ref infoString(new Glib::ustring);
infoString->append("<span size=\"larger\" weight=\"bold\">");
infoString->append(Glib::Markup::escape_text(*playable->getTitle()));
infoString->append("</span> ");
// TODO: rewrite this using the Core::Metadata class
Ptr<Glib::ustring>::Ref
creator = playable->getMetadata("dc:creator");
if (creator) {
infoString->append("<span size=\"larger\" weight=\"bold\">");
infoString->append(Glib::Markup::escape_text(*creator));
infoString->append("</span>");
}
label->set_markup(*infoString);
} else {
label->set_text("");
}
nowPlayingWidget->setPlayable(playable);
}

View file

@ -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;
* </code></pre>
*
* @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

View file

@ -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 <iostream>
#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<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle),
gLiveSupport(gLiveSupport)
{
Ptr<WidgetFactory>::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<Playable>::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<Glib::ustring>::Ref infoString(new Glib::ustring);
infoString->append("<span size=\"larger\" weight=\"bold\">");
infoString->append(Glib::Markup::escape_text(*playable->getTitle()));
infoString->append("</span> ");
// TODO: rewrite this using the Core::Metadata class
Ptr<Glib::ustring>::Ref
creator = playable->getMetadata("dc:creator");
if (creator) {
infoString->append("<span size=\"larger\" weight=\"bold\">");
infoString->append(Glib::Markup::escape_text(*creator));
infoString->append("</span>");
}
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();
}

View file

@ -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 <gtkmm.h>
#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<Playable>::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<GLiveSupport>::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<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::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<Playable>::Ref playable) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace GLiveSupport
} // namespace LiveSupport
#endif // LiveSupport_GLiveSupport_NowPlaying_h

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB