diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h index feb9a74f5..6d84499c1 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h,v $ ------------------------------------------------------------------------------*/ @@ -65,7 +65,7 @@ using namespace LiveSupport::Core; * A container, holding a Gtk::Entry as its only child. * * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class EntryBin : public BlueBin { @@ -115,6 +115,17 @@ class EntryBin : public BlueBin return getEntry()->get_text(); } + /** + * Set the text of the entry. + * + * @return the get_text() string of the Gtk::Entry. + */ + void + set_text(const Glib::ustring & text) throw () + { + getEntry()->set_text(text); + } + /** * The signal proxy for pressing enter in the entry field. * @@ -125,6 +136,17 @@ class EntryBin : public BlueBin { return getEntry()->signal_activate(); } + + /** + * The signal proxy for the text having changed in the entry field. + * + * @return the signal_changed() proxy of the Gtk::Entry. + */ + Glib::SignalProxy0 + signal_changed(void) throw () + { + return getEntry()->signal_changed(); + } }; diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index 65e5df55e..c492976ac 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.60 $ + Version : $Revision: 1.61 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ ------------------------------------------------------------------------------*/ @@ -695,6 +695,7 @@ GLiveSupport :: addToPlaylist(Ptr::Ref id) } masterPanel->updateSimplePlaylistMgmtWindow(); + emitSignalEditedPlaylistModified(); } diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index f18023252..22edcbe81 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.44 $ + Version : $Revision: 1.45 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -102,7 +102,7 @@ class MasterPanelWindow; * respective documentation. * * @author $Author: fgerlits $ - * @version $Revision: 1.44 $ + * @version $Revision: 1.45 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -272,6 +272,22 @@ class GLiveSupport : public LocalizedConfigurable, virtual void releaseCueAudio(void) throw (std::logic_error); + /** + * Emit the "edited playlist has been modified" signal. + */ + void + emitSignalEditedPlaylistModified(void) throw () + { + signalEditedPlaylistModified().emit(); + } + + + protected: + /** + * A signal object to notify people that the edited playlist changed. + */ + sigc::signal signalEditedPlaylistModifiedObject; + public: /** @@ -782,6 +798,17 @@ class GLiveSupport : public LocalizedConfigurable, */ Gtk::Image* getStationLogoImage() throw (); + + /** + * The signal raised when the edited playlist is modified. + * + * @return the signal object (a protected member of this class) + */ + sigc::signal + signalEditedPlaylistModified(void) throw () + { + return signalEditedPlaylistModifiedObject; + } }; /* ================================================= external data structures */ diff --git a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx index 03937e95c..7f92bade3 100644 --- a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.23 $ + Version : $Revision: 1.24 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -87,8 +87,10 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow ( std::exit(1); } - EntryBin * nameEntryBin = Gtk::manage(wf->createEntryBin()); - nameEntry = nameEntryBin->getEntry(); + nameEntry = Gtk::manage(wf->createEntryBin()); + nameEntry->signal_changed().connect(sigc::mem_fun( + *this, &SimplePlaylistManagementWindow::onTitleEdited )); + entriesScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow()); entriesModel = Gtk::ListStore::create(modelColumns); entriesView = Gtk::manage(wf->createTreeView(entriesModel)); @@ -154,7 +156,7 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow ( Gtk::Alignment * nameEntryAlignment = Gtk::manage(new Gtk::Alignment( Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.7)); // take up 70% of available room - nameEntryAlignment->add(*nameEntryBin); + nameEntryAlignment->add(*nameEntry); nameBox->pack_start(*nameEntryAlignment, Gtk::PACK_EXPAND_WIDGET, 5); mainBox->pack_start(*nameBox, Gtk::PACK_SHRINK, 5); @@ -204,6 +206,9 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow ( DialogWindow::noButton | DialogWindow::yesButton, gLiveSupport->getBundle() )); + + gLiveSupport->signalEditedPlaylistModified().connect(sigc::mem_fun( + *this, &SimplePlaylistManagementWindow::onPlaylistModified )); } @@ -387,6 +392,27 @@ SimplePlaylistManagementWindow :: showContents(void) throw () } +/*------------------------------------------------------------------------------ + * Signal handler for the fade info being edited. + *----------------------------------------------------------------------------*/ +void +SimplePlaylistManagementWindow :: onTitleEdited(void) throw() +{ + Ptr::Ref playlist = gLiveSupport->getEditedPlaylist(); + if (!playlist) { + playlist = gLiveSupport->openPlaylistForEditing(); + } + Ptr::Ref title(new Glib::ustring( + nameEntry->get_text())); + if (*title != *playlist->getTitle()) { + playlist->setTitle(title); + isPlaylistModified = true; + } + + showContents(); +} + + /*------------------------------------------------------------------------------ * Signal handler for the fade info being edited. *----------------------------------------------------------------------------*/ @@ -436,9 +462,6 @@ SimplePlaylistManagementWindow :: onFadeInfoEdited( return; // should never happen } - Ptr::Ref title(new Glib::ustring(nameEntry->get_text())); - playlist->setTitle(title); // this is stupid; TODO: fix it - showContents(); } @@ -513,3 +536,13 @@ SimplePlaylistManagementWindow :: isLengthOkay( return (totalFades <= *playlistElement->getPlayable()->getPlaylength()); } + +/*------------------------------------------------------------------------------ + * Signal handler for the playlist being modified outside the window. + *----------------------------------------------------------------------------*/ +void +SimplePlaylistManagementWindow :: onPlaylistModified(void) throw() +{ + isPlaylistModified = true; +} + diff --git a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h index 4a21cac88..5d7da2706 100644 --- a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h +++ b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -88,7 +88,7 @@ using namespace LiveSupport::Widgets; * * * @author $Author: fgerlits $ - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ class SimplePlaylistManagementWindow : public WhiteWindow, public LocalizedObject @@ -101,14 +101,30 @@ class SimplePlaylistManagementWindow : public WhiteWindow, enum { fadeInColumnId, fadeOutColumnId }; + /** + * Signal handler for the title being edited. + */ + void + onTitleEdited(void) throw(); + /** * Signal handler for the fade info being edited. + * + * @path the path representing the row in the tree model + * @columnId the ID of the row which was passed to appendColumn() + * @newText the new fade value */ void onFadeInfoEdited(const Glib::ustring & path, int columnId, const Glib::ustring & newText) throw(); + /** + * Signal handler for the playlist being modified outside the window. + */ + void + onPlaylistModified(void) throw(); + /** * Set the fade in of a playlist element. */ @@ -157,7 +173,7 @@ class SimplePlaylistManagementWindow : public WhiteWindow, * Lists one playlist entry per row. * * @author $Author: fgerlits $ - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ class ModelColumns : public ZebraTreeModelColumnRecord { @@ -225,7 +241,7 @@ class SimplePlaylistManagementWindow : public WhiteWindow, /** * The test input entry for the name of the playlist. */ - Gtk::Entry * nameEntry; + EntryBin * nameEntry; /** * A scrolled window, so that the entry list can be scrolled.