handling widget disposal properly

fix for issue #805, see http://bugs.campware.org/view.php?id=805
This commit is contained in:
maroy 2005-04-15 07:55:46 +00:00
parent 241abf6ee6
commit e9bdede943
17 changed files with 217 additions and 654 deletions

View file

@ -21,7 +21,7 @@
#
#
# Author : $Author: maroy $
# Version : $Revision: 1.27 $
# Version : $Revision: 1.28 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
#
# @configure_input@
@ -180,7 +180,6 @@ LDFLAGS = @LDFLAGS@ -pthread \
# Dependencies
#-------------------------------------------------------------------------------
G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
${TMP_DIR}/UiTestMainWindow.o \
${TMP_DIR}/MasterPanelWindow.o \
${TMP_DIR}/MasterPanelUserInfoWidget.o \
${TMP_DIR}/LoginWindow.o \

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/AudioClipListWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -68,12 +68,17 @@ AudioClipListWindow :: AudioClipListWindow (
try {
set_title(*getResourceUstring("windowTitle"));
closeButton.reset(new Gtk::Button(
closeButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
vBox = Gtk::manage(new Gtk::VBox());
scrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
treeView = Gtk::manage(new Gtk::TreeView());
buttonBox = Gtk::manage(new Gtk::HButtonBox());
// set up the close button
closeButton->set_name("closeButton");
closeButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT);
@ -86,35 +91,35 @@ AudioClipListWindow :: AudioClipListWindow (
set_border_width(5);
set_default_size(400, 200);
add(vBox);
add(*vBox);
// Add the TreeView, inside a ScrolledWindow, with the button underneath:
scrolledWindow.add(treeView);
scrolledWindow->add(*treeView);
// Only show the scrollbars when they are necessary:
scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
scrolledWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
vBox.pack_start(scrolledWindow);
vBox.pack_start(buttonBox, Gtk::PACK_SHRINK);
vBox->pack_start(*scrolledWindow);
vBox->pack_start(*buttonBox, Gtk::PACK_SHRINK);
buttonBox.pack_start(*closeButton, Gtk::PACK_SHRINK);
buttonBox.set_border_width(5);
buttonBox.set_layout(Gtk::BUTTONBOX_END);
buttonBox->pack_start(*closeButton, Gtk::PACK_SHRINK);
buttonBox->set_border_width(5);
buttonBox->set_layout(Gtk::BUTTONBOX_END);
// Create the Tree model:
treeModel = Gtk::ListStore::create(modelColumns);
treeView.set_model(treeModel);
treeView->set_model(treeModel);
// Add the TreeView's view columns:
try {
treeView.append_column(*getResourceUstring("idColumnLabel"),
modelColumns.idColumn);
treeView.append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
treeView.append_column(*getResourceUstring("uriColumnLabel"),
modelColumns.uriColumn);
treeView.append_column(*getResourceUstring("tokenColumnLabel"),
modelColumns.tokenColumn);
treeView->append_column(*getResourceUstring("idColumnLabel"),
modelColumns.idColumn);
treeView->append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
treeView->append_column(*getResourceUstring("uriColumnLabel"),
modelColumns.uriColumn);
treeView->append_column(*getResourceUstring("tokenColumnLabel"),
modelColumns.tokenColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/AudioClipListWindow.h,v $
------------------------------------------------------------------------------*/
@ -67,7 +67,7 @@ using namespace LiveSupport::Core;
* A window, showing and handling audio clips.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class AudioClipListWindow : public Gtk::Window, public LocalizedObject
{
@ -79,7 +79,7 @@ class AudioClipListWindow : public Gtk::Window, public LocalizedObject
* Lists one clip per row.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
@ -130,17 +130,17 @@ class AudioClipListWindow : public Gtk::Window, public LocalizedObject
/**
* The main container in the window.
*/
Gtk::VBox vBox;
Gtk::VBox * vBox;
/**
* A scrolled window, so that the list can be scrolled.
*/
Gtk::ScrolledWindow scrolledWindow;
Gtk::ScrolledWindow * scrolledWindow;
/**
* The tree view, now only showing rows.
*/
Gtk::TreeView treeView;
Gtk::TreeView * treeView;
/**
* The tree model, as a GTK reference.
@ -150,12 +150,12 @@ class AudioClipListWindow : public Gtk::Window, public LocalizedObject
/**
* The box containing the close button.
*/
Gtk::HButtonBox buttonBox;
Gtk::HButtonBox * buttonBox;
/**
* The close button.
*/
Ptr<Gtk::Button>::Ref closeButton;
Gtk::Button * closeButton;
/**
* Signal handler for the close button clicked.

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.26 $
Author : $Author: maroy $
Version : $Revision: 1.27 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/
@ -232,6 +232,8 @@ GLiveSupport :: show(void) throw ()
// Shows the window and returns when it is closed.
Gtk::Main::run(*masterPanel);
masterPanel.reset();
}

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.6 $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx,v $
------------------------------------------------------------------------------*/
@ -69,12 +69,17 @@ MasterPanelUserInfoWidget :: MasterPanelUserInfoWidget (
this->gLiveSupport = gLiveSupport;
loggedIn = false;
logInOutButton = Gtk::manage(
WidgetFactory::getInstance()->createButton(""));
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
logInOutButton = Gtk::manage(wf->createButton(""));
logInOutSignalConnection =
logInOutButton->signal_clicked().connect(sigc::mem_fun(*this,
&MasterPanelUserInfoWidget::onLoginButtonClicked));
closeButton = Gtk::manage(wf->createButton(WidgetFactory::deleteButton));
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&MasterPanelUserInfoWidget::onCloseButtonClicked));
userInfoLabel = Gtk::manage(new Gtk::Label());
changeLanguage(bundle);
@ -86,6 +91,9 @@ MasterPanelUserInfoWidget :: MasterPanelUserInfoWidget (
attach(*userInfoLabel, 1, 2, 0, 1,
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
5, 0);
attach(*closeButton, 2, 3, 0, 1,
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
5, 0);
// show everything
show_all();
@ -131,6 +139,11 @@ MasterPanelUserInfoWidget :: onLogoutButtonClicked (void) throw ()
logInOutButton->signal_clicked().connect(sigc::mem_fun(*this,
&MasterPanelUserInfoWidget::onLoginButtonClicked));
// add the close button
attach(*closeButton, 2, 3, 0, 1,
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
5, 0);
// show only the anonymous UI
gLiveSupport->showAnonymousUI();
}
@ -171,12 +184,18 @@ MasterPanelUserInfoWidget :: onLoginButtonClicked (void) throw ()
logInOutButton->signal_clicked().connect(sigc::mem_fun(*this,
&MasterPanelUserInfoWidget::onLogoutButtonClicked));
// update the UI to the possibly selected locale
Ptr<const std::string>::Ref locale = loginWindow->getSelectedLocale();
if (locale->size() > 0) {
gLiveSupport->changeLanguage(locale);
} else {
// TODO: get and set default locale for user
}
// remove the close button
remove(*closeButton);
// show the logged in UI
gLiveSupport->showLoggedInUI();
}
}
@ -220,3 +239,17 @@ MasterPanelUserInfoWidget :: updateStrings(void)
}
/*------------------------------------------------------------------------------
* Event handler for the close button getting clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelUserInfoWidget :: onCloseButtonClicked (void) throw ()
{
// get the topmost container, should be the application window itself
Gtk::Container * container = get_parent();
while (container->get_parent()) {
container = container->get_parent();
}
container->hide();
}

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.h,v $
------------------------------------------------------------------------------*/
@ -68,7 +68,7 @@ using namespace LiveSupport::Core;
* This widget handles login and login info display.
*
* @author $Author: maroy $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class MasterPanelUserInfoWidget : public Gtk::Table,
public LocalizedObject
@ -79,6 +79,11 @@ class MasterPanelUserInfoWidget : public Gtk::Table,
*/
Widgets::Button * logInOutButton;
/**
* The close application button.
*/
Widgets::ImageButton * closeButton;
/**
* A label to display the currently logged in user.
*/
@ -118,6 +123,12 @@ class MasterPanelUserInfoWidget : public Gtk::Table,
virtual void
onLogoutButtonClicked(void) throw ();
/**
* Signal handler for the close button clicked.
*/
virtual void
onCloseButtonClicked(void) throw ();
/**
* Update the strings in the widget, including the localized strings.
*

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -70,14 +70,26 @@ PlaylistListWindow :: PlaylistListWindow (
// get localized resources
try {
set_title(*getResourceUstring("windowTitle"));
listBoxLabel.set_text(*getResourceUstring("listBoxLabel"));
detailBoxLabel.set_text(*getResourceUstring("detailBoxLabel"));
closeButton.reset(new Gtk::Button(
listBoxLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("listBoxLabel")));
detailBoxLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("detailBoxLabel")));
closeButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
mainBox = Gtk::manage(new Gtk::VBox());
playlistBox = Gtk::manage(new Gtk::HBox());
listBox = Gtk::manage(new Gtk::VBox());
listScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
listTreeView = Gtk::manage(new Gtk::TreeView());
detailBox = Gtk::manage(new Gtk::VBox());
detailScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
detailTreeView = Gtk::manage(new Gtk::TreeView());
buttonBox = Gtk::manage(new Gtk::HButtonBox());
// set up the close button
closeButton->set_name("closeButton");
closeButton->set_flags(CAN_FOCUS|CAN_DEFAULT|HAS_DEFAULT);
@ -91,33 +103,33 @@ PlaylistListWindow :: PlaylistListWindow (
set_default_size(400, 200);
// set up the main box
add(mainBox);
mainBox.pack_start(playlistBox);
mainBox.pack_start(buttonBox, PACK_SHRINK);
add(*mainBox);
mainBox->pack_start(*playlistBox);
mainBox->pack_start(*buttonBox, PACK_SHRINK);
// set up the playlist box
playlistBox.pack_start(listBox, PACK_EXPAND_WIDGET, 5);
playlistBox.pack_start(detailBox, PACK_EXPAND_WIDGET, 5);
playlistBox->pack_start(*listBox, PACK_EXPAND_WIDGET, 5);
playlistBox->pack_start(*detailBox, PACK_EXPAND_WIDGET, 5);
// set up the listBox
listBox.pack_start(listBoxLabel, PACK_SHRINK);
listBox.pack_start(listScrolledWindow);
listBox->pack_start(*listBoxLabel, PACK_SHRINK);
listBox->pack_start(*listScrolledWindow);
// set up the listScrolledWindow
listScrolledWindow.add(listTreeView);
listScrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
listScrolledWindow->add(*listTreeView);
listScrolledWindow->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
// create the list tree view, and add its columns
listTreeModel = ListStore::create(modelColumns);
listTreeView.set_model(listTreeModel);
listTreeView->set_model(listTreeModel);
try {
listTreeView.append_column(*getResourceUstring("idColumnLabel"),
listTreeView->append_column(*getResourceUstring("idColumnLabel"),
modelColumns.idColumn);
listTreeView.append_column(*getResourceUstring("lengthColumnLabel"),
listTreeView->append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
listTreeView.append_column(*getResourceUstring("uriColumnLabel"),
listTreeView->append_column(*getResourceUstring("uriColumnLabel"),
modelColumns.uriColumn);
listTreeView.append_column(*getResourceUstring("tokenColumnLabel"),
listTreeView->append_column(*getResourceUstring("tokenColumnLabel"),
modelColumns.tokenColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
@ -125,29 +137,29 @@ PlaylistListWindow :: PlaylistListWindow (
// attach the event handler for the user selecting a playlist from
// the list of playlists
listTreeSelection = listTreeView.get_selection();
listTreeSelection = listTreeView->get_selection();
listTreeSelection->signal_changed().connect(
sigc::mem_fun(*this, &PlaylistListWindow::onPlaylistListSelection));
// set up the detailBox
detailBox.pack_start(detailBoxLabel, PACK_SHRINK);
detailBox.pack_start(detailScrolledWindow);
detailBox->pack_start(*detailBoxLabel, PACK_SHRINK);
detailBox->pack_start(*detailScrolledWindow);
// set up the detailed scroll window
detailScrolledWindow.add(detailTreeView);
detailScrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
detailScrolledWindow->add(*detailTreeView);
detailScrolledWindow->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
// create the detail tree view, and add its columns
detailTreeModel = ListStore::create(modelColumns);
detailTreeView.set_model(detailTreeModel);
detailTreeView->set_model(detailTreeModel);
try {
detailTreeView.append_column(*getResourceUstring("idColumnLabel"),
modelColumns.idColumn);
detailTreeView.append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
detailTreeView.append_column(*getResourceUstring("uriColumnLabel"),
modelColumns.uriColumn);
detailTreeView.append_column(*getResourceUstring("tokenColumnLabel"),
detailTreeView->append_column(*getResourceUstring("idColumnLabel"),
modelColumns.idColumn);
detailTreeView->append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
detailTreeView->append_column(*getResourceUstring("uriColumnLabel"),
modelColumns.uriColumn);
detailTreeView->append_column(*getResourceUstring("tokenColumnLabel"),
modelColumns.tokenColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
@ -155,14 +167,14 @@ PlaylistListWindow :: PlaylistListWindow (
// attach the event handler for the user selecting an entry from
// the list of playlist details
detailTreeSelection = detailTreeView.get_selection();
detailTreeSelection = detailTreeView->get_selection();
detailTreeSelection->signal_changed().connect(
sigc::mem_fun(*this, &PlaylistListWindow::onDetailSelection));
// set up the button box
buttonBox.pack_start(*closeButton, PACK_SHRINK);
buttonBox.set_border_width(5);
buttonBox.set_layout(BUTTONBOX_END);
buttonBox->pack_start(*closeButton, PACK_SHRINK);
buttonBox->set_border_width(5);
buttonBox->set_layout(BUTTONBOX_END);
showAllPlaylists();

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.h,v $
------------------------------------------------------------------------------*/
@ -84,7 +84,7 @@ using namespace LiveSupport::Core;
* </pre></code>
*
* @author $Author: maroy $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class PlaylistListWindow : public Gtk::Window, public LocalizedObject
{
@ -120,7 +120,7 @@ class PlaylistListWindow : public Gtk::Window, public LocalizedObject
* Lists one playlist per row.
*
* @author $Author: maroy $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
@ -171,36 +171,36 @@ class PlaylistListWindow : public Gtk::Window, public LocalizedObject
/**
* The main container in the window.
*/
Gtk::VBox mainBox;
Gtk::VBox * mainBox;
/**
* The container holding the two boxes for playlist viewing:
* one lists the playlist, the other the details of the selected
* playlist.
*/
Gtk::HBox playlistBox;
Gtk::HBox * playlistBox;
/**
* The container holding the playlist list tree view and accompanying
* label.
*/
Gtk::VBox listBox;
Gtk::VBox * listBox;
/**
* The label for listBox.
*/
Gtk::Label listBoxLabel;
Gtk::Label * listBoxLabel;
/**
* A scrolled window holding the list of playlists
* so that the list can be scrolled.
*/
Gtk::ScrolledWindow listScrolledWindow;
Gtk::ScrolledWindow * listScrolledWindow;
/**
* A tree view, showing rows only, the list of playlists.
*/
Gtk::TreeView listTreeView;
Gtk::TreeView * listTreeView;
/**
* The tree model, as a GTK reference, holding the list of
@ -224,24 +224,24 @@ class PlaylistListWindow : public Gtk::Window, public LocalizedObject
* The container holding the playlist detail tree view and accompanying
* label.
*/
Gtk::VBox detailBox;
Gtk::VBox * detailBox;
/**
* The label for detailBox.
*/
Gtk::Label detailBoxLabel;
Gtk::Label * detailBoxLabel;
/**
* A scrolled window holding the details of a playlist
* so that the details can be scrolled.
*/
Gtk::ScrolledWindow detailScrolledWindow;
Gtk::ScrolledWindow * detailScrolledWindow;
/**
* A tree view, showing rows only, the details of the selected
* playlist.
*/
Gtk::TreeView detailTreeView;
Gtk::TreeView * detailTreeView;
/**
* The tree model, as a GTK reference, holding the details of a
@ -252,12 +252,12 @@ class PlaylistListWindow : public Gtk::Window, public LocalizedObject
/**
* The box containing the close button.
*/
Gtk::HButtonBox buttonBox;
Gtk::HButtonBox * buttonBox;
/**
* The close button.
*/
Ptr<Gtk::Button>::Ref closeButton;
Gtk::Button * closeButton;
/**
* Signal to catch the event of the user selecting a row

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -72,23 +72,25 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow (
try {
set_title(*getResourceUstring("windowTitle"));
hourLabel.reset(new Gtk::Label(*getResourceUstring("hourLabel")));
minuteLabel.reset(new Gtk::Label(*getResourceUstring("minuteLabel")));
scheduleButton.reset(new Gtk::Button(
hourLabel = Gtk::manage(new Gtk::Label(*getResourceUstring(
"hourLabel")));
minuteLabel = Gtk::manage(new Gtk::Label(*getResourceUstring(
"minuteLabel")));
scheduleButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("scheduleButtonLabel")));
closeButton.reset(new Gtk::Button(
closeButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
playlistLabel.reset(new Gtk::Label(*playlist->getTitle()));
calendar.reset(new Gtk::Calendar());
hourEntry.reset(new Gtk::Entry());
minuteEntry.reset(new Gtk::Entry());
playlistLabel = Gtk::manage(new Gtk::Label(*playlist->getTitle()));
calendar = Gtk::manage(new Gtk::Calendar());
hourEntry = Gtk::manage(new Gtk::Entry());
minuteEntry = Gtk::manage(new Gtk::Entry());
layout.reset(new Gtk::Table());
layout = Gtk::manage(new Gtk::Table());
layout->attach(*playlistLabel, 0, 4, 0, 1);
layout->attach(*calendar, 0, 4, 1, 2);

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.h,v $
------------------------------------------------------------------------------*/
@ -84,7 +84,7 @@ using namespace LiveSupport::Core;
* </pre></code>
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class SchedulePlaylistWindow : public Gtk::Window, public LocalizedObject
{
@ -104,47 +104,47 @@ class SchedulePlaylistWindow : public Gtk::Window, public LocalizedObject
/**
* The main container in the window.
*/
Ptr<Gtk::Table>::Ref layout;
Gtk::Table * layout;
/**
* The label displaying the name of the playlist to schedule.
*/
Ptr<Gtk::Label>::Ref playlistLabel;
Gtk::Label * playlistLabel;
/**
* The calendar to select a specific date from.
*/
Ptr<Gtk::Calendar>::Ref calendar;
Gtk::Calendar * calendar;
/**
* The hour label.
*/
Ptr<Gtk::Label>::Ref hourLabel;
Gtk::Label * hourLabel;
/**
* The entry field for hour.
*/
Ptr<Gtk::Entry>::Ref hourEntry;
Gtk::Entry * hourEntry;
/**
* The minute label.
*/
Ptr<Gtk::Label>::Ref minuteLabel;
Gtk::Label * minuteLabel;
/**
* The minute entry field.
*/
Ptr<Gtk::Entry>::Ref minuteEntry;
Gtk::Entry * minuteEntry;
/**
* The schedule button.
*/
Ptr<Gtk::Button>::Ref scheduleButton;
Gtk::Button * scheduleButton;
/**
* The close button.
*/
Ptr<Gtk::Button>::Ref closeButton;
Gtk::Button * closeButton;
/**
* Signal handler for the schedule button clicked.

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -69,19 +69,19 @@ SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
try {
set_title(*getResourceUstring("windowTitle"));
closeButton.reset(new Gtk::Button(
closeButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
calendar.reset(new Gtk::Calendar());
dateLabel.reset(new Gtk::Label());
calendar = Gtk::manage(new Gtk::Calendar());
dateLabel = Gtk::manage(new Gtk::Label());
// create the tree view for the entries
entryColumns.reset(new ModelColumns());
entriesModel = Gtk::ListStore::create(*entryColumns);
entriesView.reset(new Gtk::TreeView());
entriesView = Gtk::manage(new Gtk::TreeView());
entriesView->set_model(entriesModel);
// Add the TreeView's view columns:
@ -101,7 +101,7 @@ SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
&SchedulerWindow::onEntryClicked));
// create the right-click entry context menu for audio clips
entryMenu.reset(new Gtk::Menu());
entryMenu = Gtk::manage(new Gtk::Menu());
Gtk::Menu::MenuList& menuList = entryMenu->items();
// register the signal handlers for the popup menu
menuList.push_back(Gtk::Menu_Helpers::MenuElem(
@ -110,7 +110,7 @@ SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
&SchedulerWindow::onDeleteItem)));
entryMenu->accelerate(*this);
layout.reset(new Gtk::Table());
layout = Gtk::manage(new Gtk::Table());
layout->attach(*calendar, 0, 1, 0, 1);
layout->attach(*dateLabel, 0, 1, 1, 2);

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulerWindow.h,v $
------------------------------------------------------------------------------*/
@ -88,7 +88,7 @@ using namespace LiveSupport::Core;
* </pre></code>
*
* @author $Author: maroy $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
*/
class SchedulerWindow : public Gtk::Window, public LocalizedObject
{
@ -100,7 +100,7 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject
* Lists one scheduled item per row.
*
* @author $Author: maroy $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
@ -151,17 +151,17 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject
/**
* The main container in the window.
*/
Ptr<Gtk::Table>::Ref layout;
Gtk::Table * layout;
/**
* The calendar to select a specific date from.
*/
Ptr<Gtk::Calendar>::Ref calendar;
Gtk::Calendar * calendar;
/**
* The label saying which day is being displayed.
*/
Ptr<Gtk::Label>::Ref dateLabel;
Gtk::Label * dateLabel;
/**
* The column model.
@ -172,7 +172,7 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject
* The tree view, now only showing rows, each scheduled entry for a
* specific day.
*/
Ptr<Gtk::TreeView>::Ref entriesView;
Gtk::TreeView * entriesView;
/**
* The tree model, as a GTK reference.
@ -182,12 +182,12 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject
/**
* The right-click context menu for schedule entries.
*/
Ptr<Gtk::Menu>::Ref entryMenu;
Gtk::Menu * entryMenu;
/**
* The close button.
*/
Ptr<Gtk::Button>::Ref closeButton;
Gtk::Button * closeButton;
/**
* Signal handler for when a date is selected in the calendar.

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.6 $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -68,18 +68,19 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
try {
set_title(*getResourceUstring("windowTitle"));
nameLabel.reset(new Gtk::Label(*getResourceUstring("nameLabel")));
saveButton.reset(new Gtk::Button(
nameLabel = Gtk::manage(new Gtk::Label(*getResourceUstring(
"nameLabel")));
saveButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("saveButtonLabel")));
closeButton.reset(new Gtk::Button(
closeButton = Gtk::manage(new Gtk::Button(
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
nameEntry.reset(new Gtk::Entry());
entriesScrolledWindow.reset(new Gtk::ScrolledWindow());
entriesView.reset(new Gtk::TreeView());
nameEntry = Gtk::manage(new Gtk::Entry());
entriesScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
entriesView = Gtk::manage(new Gtk::TreeView());
// set up the entry scrolled window, with the entry treeview inside.
entriesScrolledWindow->add(*entriesView);
@ -102,10 +103,10 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
std::cerr << e.what() << std::endl;
}
statusBar.reset(new Gtk::Label(*getResourceUstring("statusBar")));
statusBar = Gtk::manage(new Gtk::Label(*getResourceUstring("statusBar")));
// set up the layout
layout.reset(new Gtk::Table());
layout = Gtk::manage(new Gtk::Table());
set_border_width(10);
layout->attach(*nameLabel, 0, 1, 0, 1);

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h,v $
------------------------------------------------------------------------------*/
@ -83,7 +83,7 @@ using namespace LiveSupport::Core;
* </code></pre>
*
* @author $Author: maroy $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
*/
class SimplePlaylistManagementWindow : public Gtk::Window,
public LocalizedObject
@ -96,7 +96,7 @@ class SimplePlaylistManagementWindow : public Gtk::Window,
* Lists one playlist entry per row.
*
* @author $Author: maroy $
* @version $Revision: 1.2 $
* @version $Revision: 1.3 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
@ -147,27 +147,27 @@ class SimplePlaylistManagementWindow : public Gtk::Window,
/**
* The layout used in the window.
*/
Ptr<Gtk::Table>::Ref layout;
Gtk::Table * layout;
/**
* The label for the name entry.
*/
Ptr<Gtk::Label>::Ref nameLabel;
Gtk::Label * nameLabel;
/**
* The test input entry for the name of the playlist.
*/
Ptr<Gtk::Entry>::Ref nameEntry;
Gtk::Entry * nameEntry;
/**
* A scrolled window, so that the entry list can be scrolled.
*/
Ptr<Gtk::ScrolledWindow>::Ref entriesScrolledWindow;
Gtk::ScrolledWindow * entriesScrolledWindow;
/**
* The entry tree view, now only showing rows.
*/
Ptr<Gtk::TreeView>::Ref entriesView;
Gtk::TreeView * entriesView;
/**
* The entry tree model, as a GTK reference.
@ -177,17 +177,17 @@ class SimplePlaylistManagementWindow : public Gtk::Window,
/**
* The save button.
*/
Ptr<Gtk::Button>::Ref saveButton;
Gtk::Button * saveButton;
/**
* The close button.
*/
Ptr<Gtk::Button>::Ref closeButton;
Gtk::Button * closeButton;
/**
* The status bar.
*/
Ptr<Gtk::Label>::Ref statusBar;
Gtk::Label * statusBar;
/**
* Signal handler for the save button clicked.

View file

@ -1,289 +0,0 @@
/*------------------------------------------------------------------------------
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: maroy $
Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <iostream>
#include <unicode/msgfmt.h>
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>
#include "LiveSupport/Core/TimeConversion.h"
#include "LoginWindow.h"
#include "AudioClipListWindow.h"
#include "PlaylistListWindow.h"
#include "UiTestMainWindow.h"
using namespace LiveSupport::GLiveSupport;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
UiTestMainWindow :: UiTestMainWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle)
{
this->gLiveSupport = gLiveSupport;
try {
set_title(*getResourceUstring("windowTitle"));
statusLabel.reset(new Gtk::Label(*getResourceUstring("welcomeMsg")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
// set up the time label
timeLabel.reset(new Gtk::Label(""));
// set up the login button
loginButton.reset(new Gtk::Button("loginWindow"));
loginButton->signal_clicked().connect(sigc::mem_fun(*this,
&UiTestMainWindow::onLoginButtonClicked));
// set up the logout button
logoutButton.reset(new Gtk::Button("logout"));
logoutButton->signal_clicked().connect(sigc::mem_fun(*this,
&UiTestMainWindow::onLogoutButtonClicked));
// set up the audio clip list button
audioClipListButton.reset(new Gtk::Button("audioClipList"));
audioClipListButton->signal_clicked().connect(sigc::mem_fun(*this,
&UiTestMainWindow::onAudioClipListButtonClicked));
// set up the playlist list button
playlistListButton.reset(new Gtk::Button("playlistList"));
playlistListButton->signal_clicked().connect(sigc::mem_fun(*this,
&UiTestMainWindow::onPlaylistListButtonClicked));
// set up the quit button
quitButton.reset(new Gtk::Button("quit"));
quitButton->signal_clicked().connect(sigc::mem_fun(*this,
&UiTestMainWindow::onQuitButtonClicked));
// set up the layout, which is a button box
layout.reset(new Gtk::VButtonBox());
// set up the main window, and show everything
set_border_width(10);
layout->add(*statusLabel);
layout->add(*timeLabel);
layout->add(*loginButton);
layout->add(*audioClipListButton);
layout->add(*playlistListButton);
layout->add(*logoutButton);
layout->add(*quitButton);
add(*layout);
// show everything
show_all();
// set the timer, that will update timeLabel
setTimer();
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
UiTestMainWindow :: ~UiTestMainWindow (void) throw ()
{
resetTimer();
}
/*------------------------------------------------------------------------------
* Set the timer
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: setTimer(void) throw ()
{
sigc::slot<bool> slot = sigc::bind(sigc::mem_fun(*this,
&UiTestMainWindow::onUpdateTime),
0);
// set the timer to active once a second
timer.reset(new sigc::connection(
Glib::signal_timeout().connect(slot, 1000)));
}
/*------------------------------------------------------------------------------
* Clear the timer
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: resetTimer(void) throw ()
{
timer->disconnect();
timer.reset();
}
/*------------------------------------------------------------------------------
* Event handler for the logout button getting clicked.
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: onLogoutButtonClicked (void) throw ()
{
gLiveSupport->logout();
try {
statusLabel->set_label(*getResourceUstring("welcomeMsg"));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
}
}
/*------------------------------------------------------------------------------
* Event handler for the quit button getting clicked.
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: onQuitButtonClicked (void) throw ()
{
hide();
}
/*------------------------------------------------------------------------------
* Event handler for the login button getting clicked.
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: onLoginButtonClicked (void) throw ()
{
Ptr<ResourceBundle>::Ref loginBundle;
try {
loginBundle = getBundle("loginWindow");
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
}
Ptr<LoginWindow>::Ref loginWindow(new LoginWindow(gLiveSupport,
loginBundle));
Gtk::Main::run(*loginWindow);
Ptr<const Glib::ustring>::Ref login = loginWindow->getLogin();
Ptr<const Glib::ustring>::Ref password = loginWindow->getPassword();
bool loggedIn = gLiveSupport->login(login->raw(), password->raw());
if (loggedIn) {
Ptr<UnicodeString>::Ref uLogin = ustringToUnicodeString(login);
Formattable arguments[] = { *uLogin };
Ptr<Glib::ustring>::Ref msg = formatMessageUstring("loggedInMsg",
arguments, 1);
statusLabel->set_label(*msg);
}
}
/*------------------------------------------------------------------------------
* Update the timeLabel display, with the current time
*----------------------------------------------------------------------------*/
bool
UiTestMainWindow :: onUpdateTime(int dummy) throw ()
{
Ptr<const ptime>::Ref now = gLiveSupport->getScheduler()
->getSchedulerTime();
if (now.get()) {
time_duration dayTime = now->time_of_day();
// get the time of day, only up to a second precision
time_duration dayTimeSec(dayTime.hours(),
dayTime.minutes(),
dayTime.seconds(),
0);
timeLabel->set_text(to_simple_string(dayTimeSec));
}
return true;
}
/*------------------------------------------------------------------------------
* Event handler for the audio clip list button getting clicked.
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: onAudioClipListButtonClicked (void) throw ()
{
Ptr<ResourceBundle>::Ref bundle;
try {
bundle = getBundle("audioClipListWindow");
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
}
Ptr<AudioClipListWindow>::Ref audioClipListWindow(
new AudioClipListWindow(gLiveSupport, bundle));
Gtk::Main::run(*audioClipListWindow);
}
/*------------------------------------------------------------------------------
* Event handler for the audio clip list button getting clicked.
*----------------------------------------------------------------------------*/
void
UiTestMainWindow :: onPlaylistListButtonClicked (void) throw ()
{
Ptr<ResourceBundle>::Ref bundle;
try {
bundle = getBundle("playlistListWindow");
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
}
Ptr<PlaylistListWindow>::Ref playlistListWindow(
new PlaylistListWindow(gLiveSupport, bundle));
Gtk::Main::run(*playlistListWindow);
}

View file

@ -1,213 +0,0 @@
/*------------------------------------------------------------------------------
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: maroy $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $
------------------------------------------------------------------------------*/
#ifndef UiTestMainWindow_h
#define UiTestMainWindow_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <gtkmm/button.h>
#include <gtkmm/buttonbox.h>
#include <gtkmm/window.h>
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "GLiveSupport.h"
namespace LiveSupport {
namespace GLiveSupport {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A window, enabling interactive testing of UI components.
*
* @author $Author: maroy $
* @version $Revision: 1.8 $
*/
class UiTestMainWindow : public Gtk::Window, public LocalizedObject
{
protected:
/**
* The layout used in the window.
*/
Ptr<Gtk::VButtonBox>::Ref layout;
/**
* A label to display the status of the user.
*/
Ptr<Gtk::Label>::Ref statusLabel;
/**
* A label showing the current time, with second precision.
*/
Ptr<Gtk::Label>::Ref timeLabel;
/**
* The signal connection, that is notified by the GTK timer each
* second, and will update timeLabel on each wakeup.
*/
Ptr<sigc::connection>::Ref timer;
/**
* The to quit the applicaiton.
*/
Ptr<Gtk::Button>::Ref quitButton;
/**
* The button invoking the LoginWindow.
*/
Ptr<Gtk::Button>::Ref loginButton;
/**
* The button to log out.
*/
Ptr<Gtk::Button>::Ref logoutButton;
/**
* The button to that brings up the audio clip list window.
*/
Ptr<Gtk::Button>::Ref audioClipListButton;
/**
* The button to that brings up the playlist list window.
*/
Ptr<Gtk::Button>::Ref playlistListButton;
/**
* The gLiveSupport object, handling the logic of the application.
*/
Ptr<GLiveSupport>::Ref gLiveSupport;
/**
* Signal handler for the quit button clicked.
*/
virtual void
onQuitButtonClicked(void) throw ();
/**
* Signal handler for the login button clicked.
*/
virtual void
onLoginButtonClicked(void) throw ();
/**
* Signal handler for the logout button clicked.
*/
virtual void
onLogoutButtonClicked(void) throw ();
/**
* Signal handler for the audio clip list button clicked.
*/
virtual void
onAudioClipListButtonClicked(void) throw ();
/**
* Signal handler for the playlist list button clicked.
*/
virtual void
onPlaylistListButtonClicked(void) throw ();
/**
* Function that updates timeLabel with the current time.
* This is called by GTK at regular intervals.
*
* @param dummy a dummy, unused parameter
* @return true if the timer should call this function again,
* false if the timer should be canceled
*/
virtual bool
onUpdateTime(int dummy) throw ();
/**
* Register onUpdateTime with the GTK timer.
*
* @see #resetTimer
*/
virtual void
setTimer(void) throw ();
/**
* Stop the timer, which was set by setTimer().
*
* @see #setTimer
*/
virtual void
resetTimer(void) throw ();
public:
/**
* Constructor.
*
* @param gLiveSupport the gLiveSupport object, handling the
* logic of the application
* @param bundle the resource bundle holding localized resources
*/
UiTestMainWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle)
throw ();
/**
* Virtual destructor.
*/
virtual
~UiTestMainWindow(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace GLiveSupport
} // namespace LiveSupport
#endif // UiTestMainWindow_h

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/main.cxx,v $
------------------------------------------------------------------------------*/
@ -132,21 +132,21 @@ int main ( int argc,
case 'h':
printUsage(argv[0], std::cout);
exit(EXIT_SUCCESS);
return 0;
case 'v':
printVersion(std::cout);
exit(EXIT_SUCCESS);
return 0;
default:
printUsage(argv[0], std::cout);
exit(EXIT_FAILURE);
return 1;
}
}
if (optind != argc) {
printUsage(argv[0], std::cout);
exit(EXIT_FAILURE);
return 1;
}
std::cerr << "using config file '" << configFileName << '\'' << std::endl;
@ -162,16 +162,16 @@ int main ( int argc,
} catch (std::invalid_argument &e) {
std::cerr << "semantic error in configuration file" << std::endl
<< e.what() << std::endl;
exit(EXIT_FAILURE);
return 1;
} catch (xmlpp::exception &e) {
std::cerr << "error parsing configuration file" << std::endl
<< e.what() << std::endl;
exit(EXIT_FAILURE);
return 1;
}
gLiveSupport->show();
exit(EXIT_SUCCESS);
return 0;
}