refactoring, stage 2:

* standalone windows now know their own bundle name, instead of having to be
 told at construction;
 * collected bundle, gLiveSupport, glade, and mainWindow initialization into
 the parent class.
This commit is contained in:
fgerlits 2007-08-09 13:49:40 +00:00
parent 669e054fb4
commit cd8f824661
23 changed files with 341 additions and 358 deletions

View File

@ -180,6 +180,20 @@ class LocalizedObject
this->bundle = bundle;
}
/**
* Get a resource bundle nested inside our bundle.
*
* @param key the name of the resource bundle to get.
* @exception std::invalid_argument if there is no bundle by
* the specified key
*/
Ptr<ResourceBundle>::Ref
getBundle(const Glib::ustring & key)
throw (std::invalid_argument)
{
return getBundle(getBundle(), key.c_str());
}
/**
* Get a resource bundle nested inside our bundle.
*

View File

@ -258,7 +258,8 @@ LDFLAGS = @LDFLAGS@ -pthread \
G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
${TMP_DIR}/MasterPanelWindow.o \
${TMP_DIR}/NowPlaying.o \
${TMP_DIR}/BasicWindow.o \
${TMP_DIR}/GuiObject.o \
${TMP_DIR}/GuiWindow.o \
${TMP_DIR}/LoginWindow.o \
${TMP_DIR}/UploadFileWindow.o \
${TMP_DIR}/ScratchpadWindow.o \

View File

@ -1579,41 +1579,7 @@ GLiveSupport :: getLocalizedWindowName(
*----------------------------------------------------------------------------*/
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: putWindowPosition(Ptr<const Gtk::Window>::Ref window)
throw ()
{
WindowPositionType pos;
window->get_position(pos.x, pos.y);
window->get_size(pos.width, pos.height);
windowPositions[window->get_name()] = pos;
}
/*------------------------------------------------------------------------------
* Apply saved position and size data to the window.
*----------------------------------------------------------------------------*/
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: getWindowPosition(Ptr<Gtk::Window>::Ref window)
throw ()
{
WindowPositionsListType::const_iterator it = windowPositions.find(
window->get_name());
if (it != windowPositions.end()) {
WindowPositionType pos = it->second;
window->move(pos.x, pos.y);
window->resize(pos.width, pos.height);
}
}
/*------------------------------------------------------------------------------
* Save the position and size of the window.
*----------------------------------------------------------------------------*/
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: putWindowPosition(const BasicWindow * window)
GLiveSupport :: putWindowPosition(const GuiWindow * window)
throw ()
{
WindowPositionType pos;
@ -1629,7 +1595,7 @@ GLiveSupport :: putWindowPosition(const BasicWindow * window)
*----------------------------------------------------------------------------*/
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: getWindowPosition(BasicWindow * window)
GLiveSupport :: getWindowPosition(GuiWindow * window)
throw ()
{
WindowPositionsListType::const_iterator it = windowPositions.find(

View File

@ -59,7 +59,7 @@
#include "KeyboardShortcutList.h"
#include "TaskbarIcons.h"
#include "ContentsStorable.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
namespace LiveSupport {
@ -1206,8 +1206,6 @@ class GLiveSupport : public LocalizedConfigurable,
/**
* Save the position and size of the window.
*
* TODO: remove this function, and only use its overloaded pair.
*
* The coordinates of the window's North-West corner and the
* size of the window are read, and stored in a variable of the
* GLiveSupport object, indexed by the window's get_name().
@ -1216,35 +1214,7 @@ class GLiveSupport : public LocalizedConfigurable,
* @see getWindowPosition()
*/
void
putWindowPosition(Ptr<const Gtk::Window>::Ref window) throw ();
/**
* Apply saved position and size data to the window.
*
* TODO: remove this function, and only use its overloaded pair.
*
* If position and size data were previously saved for a window
* with the same get_name(), then these data are read and applied to
* the window, restoring its position and size.
*
* @param window the window to apply the position and size info to.
* @see putWindowPosition()
*/
void
getWindowPosition(Ptr<Gtk::Window>::Ref window) throw ();
/**
* Save the position and size of the window.
*
* The coordinates of the window's North-West corner and the
* size of the window are read, and stored in a variable of the
* GLiveSupport object, indexed by the window's get_name().
*
* @param window the window to save the position and size of.
* @see getWindowPosition()
*/
void
putWindowPosition(const BasicWindow * window) throw ();
putWindowPosition(const GuiWindow * window) throw ();
/**
* Apply saved position and size data to the window.
@ -1257,7 +1227,7 @@ class GLiveSupport : public LocalizedConfigurable,
* @see putWindowPosition()
*/
void
getWindowPosition(BasicWindow * window) throw ();
getWindowPosition(GuiWindow * window) throw ();
/**
* Store the saved window positions.

View File

@ -0,0 +1,69 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "GLiveSupport.h"
#include "GuiObject.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::GLiveSupport;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
GuiObject :: GuiObject (const Glib::ustring & bundleName)
throw ()
: LocalizedObject()
{
gLiveSupport = GLiveSupport::getInstance();
if (bundleName == "") {
setBundle(gLiveSupport->getBundle());
} else {
setBundle(gLiveSupport->getBundle(bundleName));
}
}

View File

@ -0,0 +1,109 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster 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.
Campcaster 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 Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
#ifndef GuiObject_h
#define GuiObject_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/LocalizedObject.h"
namespace LiveSupport {
namespace GLiveSupport {
using namespace LiveSupport::Core;
class GLiveSupport;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* The common ancestor of all windows and sub-windows in the GUI.
*
* @author $Author$
* @version $Revision$
*/
class GuiObject : public LocalizedObject
{
protected:
/**
* The GLiveSupport object, holding the state of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/**
* Constructor.
*
* @param bundleName the name of the sub-bundle for this object;
* can be "" to indicate the outermost bundle.
*/
GuiObject(const Glib::ustring & bundleName) throw ();
public:
/**
* Virtual destructor.
*/
virtual
~GuiObject(void) throw ()
{
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace GLiveSupport
} // namespace LiveSupport
#endif // GuiObject_h

View File

@ -34,7 +34,7 @@
#endif
#include "GLiveSupport.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
using namespace LiveSupport::Core;
@ -62,22 +62,21 @@ const Glib::ustring applicationTitle = "Campcaster";
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
BasicWindow :: BasicWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeFileName)
GuiWindow :: GuiWindow (const Glib::ustring & bundleName,
const Glib::ustring & gladeFileName,
Gtk::ToggleButton * windowOpenerButton)
throw ()
: LocalizedObject(bundle),
gLiveSupport(gLiveSupport),
: GuiObject(bundleName),
windowOpenerButton(windowOpenerButton)
{
glade = Gnome::Glade::Xml::create(gladeFileName);
glade = Gnome::Glade::Xml::create(gLiveSupport->getGladeDir() +
gladeFileName);
glade->get_widget("mainWindow1", mainWindow);
setTitle(getResourceUstring("windowTitle"));
mainWindow->signal_delete_event().connect(sigc::mem_fun(*this,
&BasicWindow::onDeleteEvent));
&GuiWindow::onDeleteEvent));
}
@ -85,7 +84,7 @@ BasicWindow :: BasicWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
* Restore the window position and show the window.
*----------------------------------------------------------------------------*/
void
BasicWindow :: show (void) throw ()
GuiWindow :: show (void) throw ()
{
preShow();
mainWindow->show();
@ -96,7 +95,7 @@ BasicWindow :: show (void) throw ()
* Stuff to do before showing the window.
*----------------------------------------------------------------------------*/
void
BasicWindow :: preShow (void) throw ()
GuiWindow :: preShow (void) throw ()
{
gLiveSupport->getWindowPosition(this);
if (windowOpenerButton) {
@ -109,7 +108,7 @@ BasicWindow :: preShow (void) throw ()
* Save the window position and hide the window.
*----------------------------------------------------------------------------*/
void
BasicWindow :: hide (void) throw ()
GuiWindow :: hide (void) throw ()
{
preHide();
mainWindow->hide();
@ -120,7 +119,7 @@ BasicWindow :: hide (void) throw ()
* Signal handler for the close button getting clicked.
*----------------------------------------------------------------------------*/
bool
BasicWindow :: onDeleteEvent (GdkEventAny * event) throw ()
GuiWindow :: onDeleteEvent (GdkEventAny * event) throw ()
{
preHide();
return false;
@ -131,7 +130,7 @@ BasicWindow :: onDeleteEvent (GdkEventAny * event) throw ()
* Stuff to do before hiding the window.
*----------------------------------------------------------------------------*/
void
BasicWindow :: preHide (void) throw ()
GuiWindow :: preHide (void) throw ()
{
gLiveSupport->putWindowPosition(this);
if (windowOpenerButton) {
@ -144,7 +143,7 @@ BasicWindow :: preHide (void) throw ()
* Set the title of the window.
*----------------------------------------------------------------------------*/
void
BasicWindow :: setTitle (Ptr<const Glib::ustring>::Ref title)
GuiWindow :: setTitle (Ptr<const Glib::ustring>::Ref title)
throw ()
{
windowTitle = title;

View File

@ -26,8 +26,8 @@
Location : $URL$
------------------------------------------------------------------------------*/
#ifndef BasicWindow_h
#define BasicWindow_h
#ifndef GuiWindow_h
#define GuiWindow_h
#ifndef __cplusplus
#error This is a C++ include file
@ -40,19 +40,14 @@
#include "configure.h"
#endif
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "GuiObject.h"
#include "LiveSupport/Core/LocalizedObject.h"
namespace LiveSupport {
namespace GLiveSupport {
using namespace LiveSupport::Core;
class GLiveSupport;
/* ================================================================ constants */
@ -62,12 +57,12 @@ class GLiveSupport;
/* =============================================================== data types */
/**
* The common ancestor of all openable and closable windows in the GUI.
* The common ancestor of all standalone windows in the GUI.
*
* @author $Author$
* @version $Revision$
*/
class BasicWindow : public LocalizedObject
class GuiWindow : public GuiObject
{
private:
@ -92,9 +87,9 @@ class BasicWindow : public LocalizedObject
protected:
/**
* The GLiveSupport object, holding the state of the application.
* The Glade object, containing the visual design.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
Glib::RefPtr<Gnome::Glade::Xml> glade;
/**
* The button which was used to open this window.
@ -106,41 +101,34 @@ class BasicWindow : public LocalizedObject
*/
Gtk::Window * mainWindow;
/**
* The Glade object, containing the visual design.
*/
Glib::RefPtr<Gnome::Glade::Xml> glade;
/**
* Signal handler for the close button getting clicked.
*/
virtual bool
onDeleteEvent(GdkEventAny * event) throw ();
public:
/**
* Constructor.
*
* @param gLiveSupport the GLiveSupport application object.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param bundleName the name of the sub-bundle for this object;
* can be "" to indicate the outermost bundle.
* @param gladeFileName the name of the Glade file for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeFileName the Glade file for this window.
* this window (optional).
*/
BasicWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeFileName)
GuiWindow(const Glib::ustring & bundleName,
const Glib::ustring & gladeFileName,
Gtk::ToggleButton * windowOpenerButton = 0)
throw ();
public:
/**
* Virtual destructor.
*/
virtual
~BasicWindow(void) throw ()
~GuiWindow(void) throw ()
{
}
@ -206,5 +194,5 @@ class BasicWindow : public LocalizedObject
} // namespace GLiveSupport
} // namespace LiveSupport
#endif // BasicWindow_h
#endif // GuiWindow_h

View File

@ -54,6 +54,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "liveModeWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -74,16 +79,11 @@ const Glib::ustring userPreferencesKeyName = "liveModeContents";
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
LiveModeWindow :: LiveModeWindow (Gtk::ToggleButton * windowOpenerButton)
throw ()
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName),
gladeDir(gladeDir),
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton),
isDeleting(false)
{
glade->get_widget_derived("treeView1", treeView);
@ -407,7 +407,7 @@ LiveModeWindow :: onSchedulePlaylist(void) throw ()
if (playlist) {
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(
gLiveSupport,
gladeDir,
gLiveSupport->getGladeDir(),
playlist));
schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow);
Gtk::Main::run(*schedulePlaylistWindow->getWindow());
@ -430,7 +430,7 @@ LiveModeWindow :: onExportPlaylist(void) throw ()
if (playlist) {
exportPlaylistWindow.reset(new ExportPlaylistWindow(
gLiveSupport,
gladeDir,
gLiveSupport->getGladeDir(),
playlist));
exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
Gtk::Main::run(*exportPlaylistWindow->getWindow());
@ -704,6 +704,6 @@ LiveModeWindow :: hide(void) throw ()
schedulePlaylistWindow->getWindow()->hide();
}
BasicWindow::hide();
GuiWindow::hide();
}

View File

@ -41,14 +41,11 @@
#endif
#include <string>
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "ContentsStorable.h"
#include "CuePlayer.h"
#include "GLiveSupport.h"
@ -76,16 +73,11 @@ using namespace LiveSupport::Widgets;
* @author $Author$
* @version $Revision$
*/
class LiveModeWindow : public BasicWindow,
class LiveModeWindow : public GuiWindow,
public ContentsStorable
{
private:
/**
* The directory where the Glade files are.
*/
Glib::ustring gladeDir;
/**
* The Playable item at the top of the window.
*/
@ -310,18 +302,10 @@ class LiveModeWindow : public BasicWindow,
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
LiveModeWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
LiveModeWindow(Gtk::ToggleButton * windowOpenerButton)
throw ();
/**
@ -444,7 +428,7 @@ class LiveModeWindow : public BasicWindow,
/**
* Hide the window.
*
* This overrides BasicWindow::hide(), and closes the Export Playlist
* This overrides GuiWindow::hide(), and closes the Export Playlist
* and Schedule Playlist pop-up windows, if they are still open.
*/
virtual void

View File

@ -97,8 +97,8 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
const Glib::ustring & gladeDir)
throw ()
: LocalizedObject(bundle),
gLiveSupport(gLiveSupport),
gladeDir(gladeDir),
gLiveSupport(gLiveSupport),
userIsLoggedIn(false)
{
glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName);
@ -350,12 +350,7 @@ MasterPanelWindow :: updateLiveModeWindow(Ptr<Playable>::Ref playable)
throw ()
{
if (!liveModeWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("liveModeWindow");
liveModeWindow.reset(new LiveModeWindow(gLiveSupport,
bundle,
liveModeButton,
gladeDir));
liveModeWindow.reset(new LiveModeWindow(liveModeButton));
gLiveSupport->loadWindowContents(liveModeWindow);
}
@ -375,12 +370,7 @@ void
MasterPanelWindow :: updateUploadFileWindow(void) throw ()
{
if (!uploadFileWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("uploadFileWindow");
uploadFileWindow.reset(new UploadFileWindow(gLiveSupport,
bundle,
uploadFileButton,
gladeDir));
uploadFileWindow.reset(new UploadFileWindow(uploadFileButton));
}
uploadFileWindow->show();
@ -396,12 +386,7 @@ MasterPanelWindow :: createScratchpadWindow(void)
throw ()
{
if (!scratchpadWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("scratchpadWindow");
scratchpadWindow.reset(new ScratchpadWindow(gLiveSupport,
bundle,
scratchpadButton,
gladeDir));
scratchpadWindow.reset(new ScratchpadWindow(scratchpadButton));
gLiveSupport->loadWindowContents(scratchpadWindow);
}
}
@ -432,12 +417,7 @@ void
MasterPanelWindow :: updatePlaylistWindow(void) throw ()
{
if (!playlistWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("playlistWindow");
playlistWindow.reset(new PlaylistWindow(gLiveSupport,
bundle,
playlistButton,
gladeDir));
playlistWindow.reset(new PlaylistWindow(playlistButton));
}
playlistWindow->showContents();
@ -456,13 +436,9 @@ MasterPanelWindow :: updateSchedulerWindow(
throw ()
{
if (!schedulerWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("schedulerWindow");
try {
schedulerWindow.reset(new SchedulerWindow(gLiveSupport,
bundle,
schedulerButton,
gladeDir));
schedulerWindow.reset(new SchedulerWindow(schedulerButton));
} catch (XmlRpcException &e) {
std::cerr << e.what() << std::endl;
return;
@ -492,12 +468,7 @@ void
MasterPanelWindow :: updateSearchWindow(void) throw ()
{
if (!searchWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("searchWindow");
searchWindow.reset(new SearchWindow(gLiveSupport,
bundle,
searchButton,
gladeDir));
searchWindow.reset(new SearchWindow(searchButton));
}
searchWindow->show();
@ -512,12 +483,7 @@ void
MasterPanelWindow :: updateOptionsWindow(void) throw ()
{
if (!optionsWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("optionsWindow");
optionsWindow.reset(new OptionsWindow(gLiveSupport,
bundle,
optionsButton,
gladeDir));
optionsWindow.reset(new OptionsWindow(optionsButton));
Ptr<BackupList>::Ref backupList = optionsWindow->getBackupList();
if (backupList) {
gLiveSupport->loadWindowContents(backupList.get());
@ -715,12 +681,7 @@ MasterPanelWindow :: uploadToHub(Ptr<Playable>::Ref playable)
throw ()
{
if (!searchWindow.get()) {
Ptr<ResourceBundle>::Ref bundle = getBundle("searchWindow");
searchWindow.reset(new SearchWindow(gLiveSupport,
bundle,
searchButton,
gladeDir));
searchWindow.reset(new SearchWindow(searchButton));
}
searchWindow->uploadToHub(playable);

View File

@ -46,6 +46,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "optionsWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -61,15 +66,11 @@ const Glib::ustring gladeFileName = "OptionsWindow.glade";
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
OptionsWindow :: OptionsWindow (Gtk::ToggleButton * windowOpenerButton)
throw ()
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName)
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton)
{
bool canBackup = (gLiveSupport->getSessionId()
&& gLiveSupport->isStorageAvailable());

View File

@ -40,16 +40,13 @@
#include "configure.h"
#endif
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/OptionsContainer.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "GLiveSupport.h"
#include "BackupView.h"
#include "RdsView.h"
@ -86,7 +83,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$
* @version $Revision$
*/
class OptionsWindow : public BasicWindow
class OptionsWindow : public GuiWindow
{
private:
@ -401,18 +398,10 @@ class OptionsWindow : public BasicWindow
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
OptionsWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
OptionsWindow(Gtk::ToggleButton * windowOpenerButton)
throw ();
/**

View File

@ -53,6 +53,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "playlistWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -68,15 +73,11 @@ const Glib::ustring gladeFileName = "PlaylistWindow.glade";
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
PlaylistWindow :: PlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
PlaylistWindow :: PlaylistWindow(Gtk::ToggleButton * windowOpenerButton)
throw ()
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName),
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton),
isPlaylistModified(false)
{
// set up the file name entry

View File

@ -40,16 +40,11 @@
#include "configure.h"
#endif
#include <string>
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "GLiveSupport.h"
namespace LiveSupport {
@ -88,7 +83,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$
* @version $Revision$
*/
class PlaylistWindow : public BasicWindow
class PlaylistWindow : public GuiWindow
{
private:
@ -394,18 +389,10 @@ class PlaylistWindow : public BasicWindow
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
PlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
PlaylistWindow(Gtk::ToggleButton * windowOpenerButton)
throw ();
/**

View File

@ -53,6 +53,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "schedulerWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -69,15 +74,11 @@ const Glib::ustring gladeFileName = "SchedulerWindow.glade";
* Constructor.
*----------------------------------------------------------------------------*/
SchedulerWindow :: SchedulerWindow (
Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
Gtk::ToggleButton * windowOpenerButton)
throw (XmlRpcException)
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName)
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton)
{
constructScheduleView();
constructStatusView();

View File

@ -40,17 +40,13 @@
#include "configure.h"
#endif
#include <string>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "GLiveSupport.h"
namespace LiveSupport {
@ -95,7 +91,7 @@ using namespace LiveSupport::Core;
* @author $Author$
* @version $Revision$
*/
class SchedulerWindow : public BasicWindow
class SchedulerWindow : public GuiWindow
{
private:
@ -237,18 +233,10 @@ class SchedulerWindow : public BasicWindow
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
SchedulerWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
SchedulerWindow(Gtk::ToggleButton * windowOpenerButton)
throw (XmlRpcException);
/**

View File

@ -52,6 +52,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "scratchpadWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -73,16 +78,11 @@ const Glib::ustring userPreferencesKeyName = "scratchpadContents";
* Constructor.
*----------------------------------------------------------------------------*/
ScratchpadWindow :: ScratchpadWindow (
Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
Gtk::ToggleButton * windowOpenerButton)
throw ()
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName),
gladeDir(gladeDir)
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton)
{
// create the tree view
glade->get_widget_derived("treeView1", treeView);
@ -315,8 +315,8 @@ ScratchpadWindow :: onSchedulePlaylist(void) throw ()
}
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport,
gladeDir,
playlist));
gLiveSupport->getGladeDir(),
playlist));
Gtk::Main::run(*schedulePlaylistWindow->getWindow());
}
@ -335,7 +335,7 @@ ScratchpadWindow :: onExportPlaylist(void) throw ()
if (playlist) {
exportPlaylistWindow.reset(new ExportPlaylistWindow(
gLiveSupport,
gladeDir,
gLiveSupport->getGladeDir(),
playlist));
exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
Gtk::Main::run(*exportPlaylistWindow->getWindow());
@ -630,6 +630,6 @@ ScratchpadWindow :: hide(void) throw ()
schedulePlaylistWindow->getWindow()->hide();
}
BasicWindow::hide();
GuiWindow::hide();
}

View File

@ -41,14 +41,11 @@
#endif
#include <string>
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "CuePlayer.h"
#include "ContentsStorable.h"
#include "ExportPlaylistWindow.h"
@ -75,16 +72,11 @@ using namespace LiveSupport::Widgets;
* @author $Author$
* @version $Revision$
*/
class ScratchpadWindow : public BasicWindow,
class ScratchpadWindow : public GuiWindow,
public ContentsStorable
{
private:
/**
* The directory where the Glade files are.
*/
Glib::ustring gladeDir;
/**
* The user preferences key.
*/
@ -299,18 +291,10 @@ class ScratchpadWindow : public BasicWindow,
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
ScratchpadWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
ScratchpadWindow(Gtk::ToggleButton * windowOpenerButton)
throw ();
/**
@ -382,7 +366,7 @@ class ScratchpadWindow : public BasicWindow,
/**
* Hide the window.
*
* This overrides BasicWindow::hide(), and closes the Export Playlist
* This overrides GuiWindow::hide(), and closes the Export Playlist
* and Schedule Playlist pop-up windows, if they are still open.
*/
virtual void

View File

@ -58,6 +58,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "searchWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -78,16 +83,11 @@ const int searchResultsSize = 25;
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
SearchWindow :: SearchWindow (Gtk::ToggleButton * windowOpenerButton)
throw ()
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName),
gladeDir(gladeDir)
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton)
{
glade->get_widget("searchInputNoteBook1", searchInput);
@ -763,7 +763,7 @@ SearchWindow :: onSchedulePlaylist(void) throw ()
if (playlist) {
schedulePlaylistWindow.reset(new SchedulePlaylistWindow(
gLiveSupport,
gladeDir,
gLiveSupport->getGladeDir(),
playlist));
schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow);
Gtk::Main::run(*schedulePlaylistWindow->getWindow());
@ -791,13 +791,14 @@ SearchWindow :: onExportPlaylist(void) throw ()
try {
exportPlaylistWindow.reset(new ExportPlaylistWindow(
gLiveSupport,
gladeDir,
gLiveSupport->getGladeDir(),
playlist));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
}
exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow);
exportPlaylistWindow->getWindow()->set_transient_for(
*mainWindow);
Gtk::Main::run(*exportPlaylistWindow->getWindow());
}
}
@ -907,7 +908,7 @@ SearchWindow :: hide(void) throw ()
schedulePlaylistWindow->getWindow()->hide();
}
BasicWindow::hide();
GuiWindow::hide();
}

View File

@ -40,12 +40,7 @@
#include "configure.h"
#endif
#include <string>
#include <unicode/resbund.h>
#include <gtkmm.h>
#include <libglademm.h>
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "LiveSupport/Core/NumericTools.h"
#include "LiveSupport/Core/Ptr.h"
@ -79,16 +74,11 @@ using namespace LiveSupport::Widgets;
* @author $Author$
* @version $Revision$
*/
class SearchWindow : public BasicWindow,
class SearchWindow : public GuiWindow,
private NumericTools
{
private:
/**
* The directory where the Glade files are.
*/
Glib::ustring gladeDir;
/**
* The criteria for the last local search.
*/
@ -600,18 +590,10 @@ class SearchWindow : public BasicWindow,
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
SearchWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
SearchWindow(Gtk::ToggleButton * windowOpenerButton)
throw ();
/**
@ -641,7 +623,7 @@ class SearchWindow : public BasicWindow,
/**
* Hide the window.
*
* This overrides BasicWindow::hide(), and closes the Export Playlist
* This overrides GuiWindow::hide(), and closes the Export Playlist
* and Schedule Playlist windows, if they are still open.
*/
virtual void

View File

@ -56,6 +56,11 @@ using namespace LiveSupport::GLiveSupport;
namespace {
/*------------------------------------------------------------------------------
* The name of the localization resource bundle.
*----------------------------------------------------------------------------*/
const Glib::ustring bundleName = "uploadFileWindow";
/*------------------------------------------------------------------------------
* The name of the glade file.
*----------------------------------------------------------------------------*/
@ -72,15 +77,11 @@ const Glib::ustring gladeFileName = "UploadFileWindow.glade";
* Constructor.
*----------------------------------------------------------------------------*/
UploadFileWindow :: UploadFileWindow (
Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
Gtk::ToggleButton * windowOpenerButton)
throw ()
: BasicWindow(gLiveSupport,
bundle,
windowOpenerButton,
gladeDir + gladeFileName),
: GuiWindow(bundleName,
gladeFileName,
windowOpenerButton),
fileType(invalidType)
{
Gtk::Label * fileNameLabel;
@ -210,7 +211,6 @@ UploadFileWindow :: onBrowseButtonClicked(void) throw ()
*getResourceUstring("fileChooserDialogTitle"),
Gtk::FILE_CHOOSER_ACTION_OPEN));
dialog->set_name("uploadFileChooserDialog");
gLiveSupport->getWindowPosition(dialog);
dialog->set_current_folder(fileChooserFolder);
dialog->set_transient_for(*mainWindow);
@ -226,7 +226,6 @@ UploadFileWindow :: onBrowseButtonClicked(void) throw ()
fileNameEntry->set_text(dialog->get_filename());
updateFileInfo();
fileChooserFolder = dialog->get_current_folder();
gLiveSupport->putWindowPosition(dialog);
}
}

View File

@ -40,10 +40,7 @@
#include "configure.h"
#endif
#include <gtkmm.h>
#include <libglademm.h>
#include "BasicWindow.h"
#include "GuiWindow.h"
#include "LiveSupport/Core/NumericTools.h"
#include "LiveSupport/Core/Ptr.h"
@ -75,7 +72,7 @@ using namespace LiveSupport::Widgets;
* @author $Author$
* @version $Revision$
*/
class UploadFileWindow : public BasicWindow,
class UploadFileWindow : public GuiWindow,
private NumericTools
{
private:
@ -310,18 +307,10 @@ class UploadFileWindow : public BasicWindow,
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, containing
* all the vital info.
* @param bundle the resource bundle holding the localized
* resources for this window.
* @param windowOpenerButton the button which was pressed to open
* this window.
* @param gladeDir the directory where the glade file is.
*/
UploadFileWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle,
Gtk::ToggleButton * windowOpenerButton,
const Glib::ustring & gladeDir)
UploadFileWindow(Gtk::ToggleButton * windowOpenerButton)
throw ();
/**