refactoring, stage 5 (last, for now): sorted the remaining classes into

either GuiWindow or GuiComponent
This commit is contained in:
fgerlits 2007-08-10 18:01:53 +00:00
parent 8b9ad7968d
commit bb5d7b8a33
21 changed files with 208 additions and 352 deletions

View file

@ -37,7 +37,8 @@ based on the design documentation <code>styleguide.pdf</code>.
<p>Each toplevel has its own file, named the same as the C++ class which <p>Each toplevel has its own file, named the same as the C++ class which
controls it, with the extension <code>.glade</code>. For example: controls it, with the extension <code>.glade</code>. For example:
<code>ScratchpadWindow.glade</code>, <code>LiveModeWindow.glade</code>. <code>ScratchpadWindow.glade</code>, <code>LiveModeWindow.glade</code>.
Pop-up dialogs go into the Glade file of the toplevel which pops them up. Pop-up dialogs which do not have their own class go into the Glade file
of the toplevel which pops them up.
<p>Each toplevel should be a GtkWindow, except for pop-ups like the Login <p>Each toplevel should be a GtkWindow, except for pop-ups like the Login
window, confirmation dialogs etc., which are GtkDialogs or subclasses of it.</p> window, confirmation dialogs etc., which are GtkDialogs or subclasses of it.</p>

View file

@ -101,7 +101,7 @@ BackupView :: BackupView (GuiObject * parent)
constructCriteriaView(); constructCriteriaView();
constructBackupListView(); constructBackupListView();
dateTimeChooserWindow.reset(new DateTimeChooserWindow(gLiveSupport)); dateTimeChooserWindow.reset(new DateTimeChooserWindow());
} }

View file

@ -45,6 +45,11 @@ using namespace LiveSupport::GLiveSupport;
namespace { namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "dateTimeChooserWindow";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the glade file. * The name of the glade file.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -60,21 +65,11 @@ const Glib::ustring gladeFileName = "DateTimeChooserWindow.glade";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
DateTimeChooserWindow :: DateTimeChooserWindow( DateTimeChooserWindow :: DateTimeChooserWindow (void)
Ptr<GLiveSupport>::Ref gLiveSupport)
throw () throw ()
: GuiWindow(bundleName,
gladeFileName)
{ {
Ptr<ResourceBundle>::Ref
bundle = gLiveSupport->getBundle("dateTimeChooserWindow");
setBundle(bundle);
Glib::ustring gladeDir = gLiveSupport->getGladeDir();
Glib::RefPtr<Gnome::Glade::Xml>
glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName);
glade->get_widget("mainWindow1", mainWindow);
mainWindow->set_title(*getResourceUstring("windowTitle"));
Gtk::Label * hourLabel; Gtk::Label * hourLabel;
Gtk::Label * minuteLabel; Gtk::Label * minuteLabel;
glade->get_widget("hourLabel1", hourLabel); glade->get_widget("hourLabel1", hourLabel);

View file

@ -40,15 +40,14 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/gregorian/gregorian.hpp>
#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 "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiWindow.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -74,15 +73,10 @@ using namespace LiveSupport::Core;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class DateTimeChooserWindow : public LocalizedObject class DateTimeChooserWindow : public GuiWindow
{ {
private: private:
/**
* The main window for this class.
*/
Gtk::Dialog * mainWindow;
/** /**
* The calendar where the date is chosen. * The calendar where the date is chosen.
*/ */
@ -122,11 +116,8 @@ class DateTimeChooserWindow : public LocalizedObject
/** /**
* Constructor. * Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
*/ */
DateTimeChooserWindow(Ptr<GLiveSupport>::Ref gLiveSupport) DateTimeChooserWindow(void)
throw (); throw ();
/** /**

View file

@ -54,11 +54,9 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
ExportFormatRadioButtons :: ExportFormatRadioButtons( ExportFormatRadioButtons :: ExportFormatRadioButtons(GuiObject * parent)
Ptr<ResourceBundle>::Ref bundle,
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw () throw ()
: LocalizedObject(bundle) : GuiComponent(parent)
{ {
glade->get_widget("internalFormatRadioButton1", internalFormatRadioButton); glade->get_widget("internalFormatRadioButton1", internalFormatRadioButton);
glade->get_widget("smilFormatRadioButton1", smilFormatRadioButton); glade->get_widget("smilFormatRadioButton1", smilFormatRadioButton);

View file

@ -36,12 +36,10 @@
/* ============================================================ include files */ /* ============================================================ include files */
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/StorageClient/StorageClientInterface.h" #include "LiveSupport/StorageClient/StorageClientInterface.h"
#include "GuiComponent.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -64,7 +62,7 @@ using namespace LiveSupport::StorageClient;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class ExportFormatRadioButtons : public LocalizedObject class ExportFormatRadioButtons : public GuiComponent
{ {
private: private:
@ -84,11 +82,9 @@ class ExportFormatRadioButtons : public LocalizedObject
/** /**
* Constructor. * Constructor.
* *
* @param bundle the resource bundle holding the localized * @param parent the GuiObject which contains this one.
* resources for this window.
*/ */
ExportFormatRadioButtons(Ptr<ResourceBundle>::Ref bundle, ExportFormatRadioButtons(GuiObject * parent)
Glib::RefPtr<Gnome::Glade::Xml> glade)
throw (); throw ();
/** /**

View file

@ -54,6 +54,11 @@ using namespace LiveSupport::GLiveSupport;
namespace { namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "exportPlaylistWindow";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the glade file. * The name of the glade file.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -69,25 +74,12 @@ const Glib::ustring gladeFileName = "ExportPlaylistWindow.glade";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
ExportPlaylistWindow :: ExportPlaylistWindow( ExportPlaylistWindow :: ExportPlaylistWindow(Ptr<Playlist>::Ref playlist)
Ptr<GLiveSupport>::Ref gLiveSupport,
const Glib::ustring & gladeDir,
Ptr<Playlist>::Ref playlist)
throw () throw ()
: gLiveSupport(gLiveSupport), : GuiWindow(bundleName,
gladeFileName),
playlist(playlist) playlist(playlist)
{ {
Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle(
"exportPlaylistWindow");
setBundle(bundle);
glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName);
glade->get_widget("mainWindow1", mainWindow);
mainWindow->set_title(*getResourceUstring("windowTitle"));
mainWindow->signal_delete_event().connect(sigc::mem_fun(*this,
&ExportPlaylistWindow::onDeleteEvent));
Gtk::Label * playlistTitleTextLabel; Gtk::Label * playlistTitleTextLabel;
Gtk::Label * formatLabel; Gtk::Label * formatLabel;
glade->get_widget("playlistTitleTextLabel1", playlistTitleTextLabel); glade->get_widget("playlistTitleTextLabel1", playlistTitleTextLabel);
@ -105,7 +97,7 @@ ExportPlaylistWindow :: ExportPlaylistWindow(
glade->connect_clicked("saveButton1", sigc::mem_fun(*this, glade->connect_clicked("saveButton1", sigc::mem_fun(*this,
&ExportPlaylistWindow::onSaveButtonClicked)); &ExportPlaylistWindow::onSaveButtonClicked));
formatButtons.reset(new ExportFormatRadioButtons(bundle, glade)); formatButtons.reset(new ExportFormatRadioButtons(this));
} }

View file

@ -40,14 +40,12 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Playlist.h" #include "LiveSupport/Core/Playlist.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "ExportFormatRadioButtons.h" #include "ExportFormatRadioButtons.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiWindow.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -71,25 +69,10 @@ using namespace LiveSupport::Core;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class ExportPlaylistWindow : public LocalizedObject class ExportPlaylistWindow : public GuiWindow
{ {
private: private:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/**
* The Glade object, containing the visual design.
*/
Glib::RefPtr<Gnome::Glade::Xml> glade;
/**
* The main window for this class.
*/
Gtk::Window * mainWindow;
/** /**
* The playlist to be exported. * The playlist to be exported.
*/ */
@ -129,8 +112,12 @@ class ExportPlaylistWindow : public LocalizedObject
/** /**
* Event handler called when the the window gets hidden. * Event handler called when the the window gets hidden.
*
* It closes the exporting operations, if there is one in progress. * It closes the exporting operations, if there is one in progress.
*
* Overrides GuiWindow::onDeleteEvent().
*
* @param event attributes of the event.
* @return true if handled the event, false to continue deleting.
*/ */
virtual bool virtual bool
onDeleteEvent(GdkEventAny * event) throw (); onDeleteEvent(GdkEventAny * event) throw ();
@ -141,14 +128,9 @@ class ExportPlaylistWindow : public LocalizedObject
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param gladeDir the directory where the Glade files are.
* @param playlist the playlist to be exported. * @param playlist the playlist to be exported.
*/ */
ExportPlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport, ExportPlaylistWindow(Ptr<Playlist>::Ref playlist)
const Glib::ustring & gladeDir,
Ptr<Playlist>::Ref playlist)
throw (); throw ();
/** /**
@ -158,15 +140,6 @@ class ExportPlaylistWindow : public LocalizedObject
~ExportPlaylistWindow(void) throw () ~ExportPlaylistWindow(void) throw ()
{ {
} }
/**
* Get the underlying Gtk::Window.
*/
virtual Gtk::Window *
getWindow(void) throw ()
{
return mainWindow;
}
}; };
/* ================================================= external data structures */ /* ================================================= external data structures */

View file

@ -400,17 +400,17 @@ LiveModeWindow :: onSchedulePlaylist(void) throw ()
{ {
Gtk::TreeModel::iterator iter = getSelected(); Gtk::TreeModel::iterator iter = getSelected();
if (iter) { if (!iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; return;
Ptr<Playlist>::Ref playlist = playable->getPlaylist(); }
if (playlist) {
schedulePlaylistWindow.reset(new SchedulePlaylistWindow( Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
gLiveSupport, Ptr<Playlist>::Ref playlist = playable->getPlaylist();
gLiveSupport->getGladeDir(),
playlist)); if (playlist) {
schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist));
Gtk::Main::run(*schedulePlaylistWindow->getWindow()); schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow);
} Gtk::Main::run(*schedulePlaylistWindow->getWindow());
} }
} }
@ -423,17 +423,17 @@ LiveModeWindow :: onExportPlaylist(void) throw ()
{ {
Gtk::TreeModel::iterator iter = getSelected(); Gtk::TreeModel::iterator iter = getSelected();
if (iter) { if (!iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; return;
Ptr<Playlist>::Ref playlist = playable->getPlaylist(); }
if (playlist) {
exportPlaylistWindow.reset(new ExportPlaylistWindow( Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
gLiveSupport, Ptr<Playlist>::Ref playlist = playable->getPlaylist();
gLiveSupport->getGladeDir(),
playlist)); if (playlist) {
exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist));
Gtk::Main::run(*exportPlaylistWindow->getWindow()); exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
} Gtk::Main::run(*exportPlaylistWindow->getWindow());
} }
} }

View file

@ -382,8 +382,10 @@ class MasterPanelWindow : public GuiWindow
* Event handler for when the user closes the master panel. * Event handler for when the user closes the master panel.
* It pops up a confirmation dialog. * It pops up a confirmation dialog.
* *
* @param event attributes for the event (?) * Overrides GuiWindow::onDeleteEvent().
* @return true if handled the event, false to continue deleting *
* @param event attributes of the event.
* @return true if handled the event, false to continue deleting.
*/ */
virtual bool virtual bool
onDeleteEvent(GdkEventAny * event) throw (); onDeleteEvent(GdkEventAny * event) throw ();

View file

@ -44,6 +44,15 @@ using namespace LiveSupport::GLiveSupport;
/* ================================================ local constants & macros */ /* ================================================ local constants & macros */
namespace { namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "restoreBackupWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
const Glib::ustring gladeFileName = "RestoreBackupWindow.glade";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The interval between two calls to restoreBackupCheck(), in milliseconds. * The interval between two calls to restoreBackupCheck(), in milliseconds.
@ -61,28 +70,18 @@ const unsigned int timerInterval = 10000;
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
RestoreBackupWindow :: RestoreBackupWindow ( RestoreBackupWindow :: RestoreBackupWindow (
Ptr<GLiveSupport>::Ref gLiveSupport,
Glib::RefPtr<Gnome::Glade::Xml> glade,
Ptr<const Glib::ustring>::Ref fileName) Ptr<const Glib::ustring>::Ref fileName)
throw () throw ()
: gLiveSupport(gLiveSupport), : GuiWindow(bundleName,
gladeFileName),
fileName(fileName), fileName(fileName),
currentState(AsyncState::pendingState) currentState(AsyncState::pendingState)
{ {
Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle(
"restoreBackupWindow");
setBundle(bundle);
glade->get_widget("restoreBackupWindow1", mainWindow);
mainWindow->set_title(*getResourceUstring("windowTitle"));
Gtk::Button * cancelButton; Gtk::Button * cancelButton;
glade->get_widget("restoreBackupMessageLabel1", messageLabel); glade->get_widget("restoreBackupMessageLabel1", messageLabel);
glade->get_widget("restoreBackupCancelButton1", cancelButton); glade->get_widget("restoreBackupCancelButton1", cancelButton);
glade->get_widget("restoreBackupOkButton1", okButton); glade->get_widget("restoreBackupOkButton1", okButton);
mainWindow->signal_delete_event().connect(sigc::mem_fun(*this,
&RestoreBackupWindow::onDeleteEvent));
cancelButton->signal_clicked().connect(sigc::mem_fun(*this, cancelButton->signal_clicked().connect(sigc::mem_fun(*this,
&RestoreBackupWindow::onCancelButtonClicked)); &RestoreBackupWindow::onCancelButtonClicked));
okButton->signal_clicked().connect(sigc::mem_fun(*this, okButton->signal_clicked().connect(sigc::mem_fun(*this,
@ -265,16 +264,6 @@ RestoreBackupWindow :: resetTimer(void) throw ()
} }
/*------------------------------------------------------------------------------
* Show the window.
*----------------------------------------------------------------------------*/
void
RestoreBackupWindow :: show(void) throw ()
{
mainWindow->show();
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Close the connection and hide the window. * Close the connection and hide the window.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -282,7 +271,7 @@ void
RestoreBackupWindow :: hide(void) throw () RestoreBackupWindow :: hide(void) throw ()
{ {
restoreBackupClose(); restoreBackupClose();
mainWindow->hide(); GuiWindow::hide();
} }

View file

@ -40,14 +40,12 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/StorageClient/StorageClientInterface.h" #include "LiveSupport/StorageClient/StorageClientInterface.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiWindow.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -69,20 +67,10 @@ using namespace LiveSupport::StorageClient;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class RestoreBackupWindow : public LocalizedObject class RestoreBackupWindow : public GuiWindow
{ {
private: private:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/**
* The main window for this class.
*/
Gtk::Window * mainWindow;
/** /**
* The label holding the current message displayed by the window. * The label holding the current message displayed by the window.
*/ */
@ -130,6 +118,12 @@ class RestoreBackupWindow : public LocalizedObject
/** /**
* Event handler for closing the window from the window manager. * Event handler for closing the window from the window manager.
* Calls StorageClientInterface::restoreBackupClose().
*
* Overrides GuiWindow::onDeleteEvent().
*
* @param event attributes of the event.
* @return true if handled the event, false to continue deleting.
*/ */
virtual bool virtual bool
onDeleteEvent(GdkEventAny * event) throw (); onDeleteEvent(GdkEventAny * event) throw ();
@ -220,15 +214,9 @@ class RestoreBackupWindow : public LocalizedObject
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param glade the Glade object, which contains the
* visual design.
* @param fileName the file name of the backup to be restored. * @param fileName the file name of the backup to be restored.
*/ */
RestoreBackupWindow(Ptr<GLiveSupport>::Ref gLiveSupport, RestoreBackupWindow(Ptr<const Glib::ustring>::Ref fileName)
Glib::RefPtr<Gnome::Glade::Xml> glade,
Ptr<const Glib::ustring>::Ref fileName)
throw (); throw ();
/** /**
@ -239,14 +227,11 @@ class RestoreBackupWindow : public LocalizedObject
{ {
} }
/**
* Show the window.
*/
virtual void
show(void) throw ();
/** /**
* Close the connection and hide the window. * Close the connection and hide the window.
* Calls StorageClientInterface::restoreBackupClose().
*
* Overrides GuiWindow::hide().
*/ */
virtual void virtual void
hide(void) throw (); hide(void) throw ();

View file

@ -51,6 +51,11 @@ using namespace LiveSupport::GLiveSupport;
namespace { namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "schedulePlaylistWindow";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the glade file. * The name of the glade file.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -66,23 +71,12 @@ const Glib::ustring gladeFileName = "SchedulePlaylistWindow.glade";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
SchedulePlaylistWindow :: SchedulePlaylistWindow ( SchedulePlaylistWindow :: SchedulePlaylistWindow (Ptr<Playlist>::Ref playlist)
Ptr<GLiveSupport>::Ref gLiveSupport,
const Glib::ustring & gladeDir,
Ptr<Playlist>::Ref playlist)
throw () throw ()
: gLiveSupport(gLiveSupport), : GuiWindow(bundleName,
gladeFileName),
playlist(playlist) playlist(playlist)
{ {
Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle(
"schedulePlaylistWindow");
setBundle(bundle);
glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName);
glade->get_widget("mainWindow1", mainWindow);
mainWindow->set_title(*getResourceUstring("windowTitle"));
Gtk::Label * playlistLabel; Gtk::Label * playlistLabel;
glade->get_widget("playlistLabel1", playlistLabel); glade->get_widget("playlistLabel1", playlistLabel);
playlistLabel->set_label(*playlist->getTitle()); playlistLabel->set_label(*playlist->getTitle());

View file

@ -41,14 +41,12 @@
#endif #endif
#include <string> #include <string>
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiWindow.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -84,25 +82,10 @@ using namespace LiveSupport::Core;
* @author $Author$ * @author $Author$
* @version $Revision$ * @version $Revision$
*/ */
class SchedulePlaylistWindow : public LocalizedObject class SchedulePlaylistWindow : public GuiWindow
{ {
private: private:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/**
* The Glade object, containing the visual design.
*/
Glib::RefPtr<Gnome::Glade::Xml> glade;
/**
* The main window for this class.
*/
Gtk::Window * mainWindow;
/** /**
* The playlist to schedule. * The playlist to schedule.
*/ */
@ -143,14 +126,9 @@ class SchedulePlaylistWindow : public LocalizedObject
/** /**
* Constructor. * Constructor.
* *
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param gladeDir the directory where the Glade files are.
* @param playlist the playlist to schedule. * @param playlist the playlist to schedule.
*/ */
SchedulePlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport, SchedulePlaylistWindow(Ptr<Playlist>::Ref playlist)
const Glib::ustring & gladeDir,
Ptr<Playlist>::Ref playlist)
throw (); throw ();
/** /**
@ -160,15 +138,6 @@ class SchedulePlaylistWindow : public LocalizedObject
~SchedulePlaylistWindow(void) throw () ~SchedulePlaylistWindow(void) throw ()
{ {
} }
/**
* Get the underlying Gtk::Window.
*/
virtual Gtk::Window *
getWindow(void) throw ()
{
return mainWindow;
}
}; };
/* ================================================= external data structures */ /* ================================================= external data structures */

View file

@ -293,31 +293,13 @@ void
ScratchpadWindow :: onSchedulePlaylist(void) throw () ScratchpadWindow :: onSchedulePlaylist(void) throw ()
{ {
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn]; Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
Ptr<UniqueId>::Ref uid = playable->getId(); Ptr<Playlist>::Ref playlist = playable->getPlaylist();
Ptr<Playlist>::Ref playlist; if (playlist) {
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist));
try { schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow);
if (!gLiveSupport->existsPlaylist(uid)) { Gtk::Main::run(*schedulePlaylistWindow->getWindow());
return;
}
playlist = gLiveSupport->getPlaylist(uid);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
} catch (XmlRpcException &e) {
std::cerr << "error in ScratchpadWindow::onSchedulePlaylist(): "
<< e.what() << std::endl;
return;
} }
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
gLiveSupport->getGladeDir(),
playlist));
Gtk::Main::run(*schedulePlaylistWindow->getWindow());
} }
@ -330,17 +312,10 @@ ScratchpadWindow :: onExportPlaylist(void) throw ()
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn]; Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
Ptr<Playlist>::Ref playlist = playable->getPlaylist(); Ptr<Playlist>::Ref playlist = playable->getPlaylist();
try { if (playlist) {
if (playlist) { exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist));
exportPlaylistWindow.reset(new ExportPlaylistWindow( exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
gLiveSupport, Gtk::Main::run(*exportPlaylistWindow->getWindow());
gLiveSupport->getGladeDir(),
playlist));
exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
Gtk::Main::run(*exportPlaylistWindow->getWindow());
}
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
} }
} }

View file

@ -45,12 +45,14 @@
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h" #include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h" #include "LiveSupport/Widgets/ZebraTreeView.h"
#include "GuiWindow.h"
#include "CuePlayer.h" #include "CuePlayer.h"
#include "ContentsStorable.h" #include "ContentsStorable.h"
#include "ExportPlaylistWindow.h" #include "ExportPlaylistWindow.h"
#include "SchedulePlaylistWindow.h" #include "SchedulePlaylistWindow.h"
#include "GuiWindow.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {

View file

@ -754,17 +754,17 @@ SearchWindow :: onSchedulePlaylist(void) throw ()
Gtk::TreeModel::iterator Gtk::TreeModel::iterator
iter = refSelection->get_selected(); iter = refSelection->get_selected();
if (iter) { if (!iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; return;
Ptr<Playlist>::Ref playlist = playable->getPlaylist(); }
if (playlist) {
schedulePlaylistWindow.reset(new SchedulePlaylistWindow( Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
gLiveSupport, Ptr<Playlist>::Ref playlist = playable->getPlaylist();
gLiveSupport->getGladeDir(),
playlist)); if (playlist) {
schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist));
Gtk::Main::run(*schedulePlaylistWindow->getWindow()); schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow);
} Gtk::Main::run(*schedulePlaylistWindow->getWindow());
} }
} }
@ -780,25 +780,17 @@ SearchWindow :: onExportPlaylist(void) throw ()
Gtk::TreeModel::iterator Gtk::TreeModel::iterator
iter = refSelection->get_selected(); iter = refSelection->get_selected();
if (iter) { if (!iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; return;
if (playable) { }
Ptr<Playlist>::Ref playlist = playable->getPlaylist();
if (playlist) { Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
try { Ptr<Playlist>::Ref playlist = playable->getPlaylist();
exportPlaylistWindow.reset(new ExportPlaylistWindow(
gLiveSupport, if (playlist) {
gLiveSupport->getGladeDir(), exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist));
playlist)); exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
} catch (std::invalid_argument &e) { Gtk::Main::run(*exportPlaylistWindow->getWindow());
std::cerr << e.what() << std::endl;
return;
}
exportPlaylistWindow->getWindow()->set_transient_for(
*mainWindow);
Gtk::Main::run(*exportPlaylistWindow->getWindow());
}
}
} }
} }

View file

@ -455,10 +455,7 @@ UploadFileWindow :: uploadStorageArchive(void) throw ()
fileNameEntry->get_text() )); fileNameEntry->get_text() ));
Ptr<RestoreBackupWindow>::Ref restoreBackupWindow( Ptr<RestoreBackupWindow>::Ref restoreBackupWindow(
new RestoreBackupWindow( new RestoreBackupWindow(path));
gLiveSupport,
glade,
path));
restoreBackupWindow->show(); restoreBackupWindow->show();
restoreBackupWindowList.push_back(restoreBackupWindow); restoreBackupWindowList.push_back(restoreBackupWindow);

View file

@ -40,15 +40,15 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include "GuiWindow.h"
#include "LiveSupport/Core/NumericTools.h"
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/ComboBoxText.h" #include "LiveSupport/Widgets/ComboBoxText.h"
#include "RestoreBackupWindow.h" #include "RestoreBackupWindow.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "GuiWindow.h"
#include "LiveSupport/Core/NumericTools.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Fri Aug 10 18:25:00 2007 by fgerlits@fgerlits-laptop-->
<glade-interface>
<widget class="GtkWindow" id="mainWindow1">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">8</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<child>
<widget class="GtkLabel" id="restoreBackupMessageLabel1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">uploading backup file
please wait...</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="restoreBackupCancelButton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="restoreBackupOkButton1">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">-5</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Thu Jul 26 14:44:06 2007 by fgerlits@desktop--> <!--Generated with glade3 3.2.0 on Fri Aug 10 19:26:43 2007 by fgerlits@fgerlits-laptop-->
<glade-interface> <glade-interface>
<widget class="GtkDialog" id="mainWindow1"> <widget class="GtkDialog" id="mainWindow1">
<property name="width_request">380</property> <property name="width_request">380</property>
@ -1694,64 +1694,4 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="restoreBackupWindow1">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">8</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<child>
<widget class="GtkLabel" id="restoreBackupMessageLabel1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">uploading backup file
please wait...</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">8</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="restoreBackupCancelButton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="restoreBackupOkButton1">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">-5</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>