gave a facelift to SimplePlaylistManagementWindow

This commit is contained in:
fgerlits 2005-05-21 19:05:25 +00:00
parent d751df9404
commit 6601609ed4
6 changed files with 117 additions and 80 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.19 $
Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
------------------------------------------------------------------------------*/
@ -89,7 +89,7 @@ class ZebraTreeView;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.19 $
* @version $Revision: 1.20 $
*/
class WidgetFactory :
virtual public Configurable
@ -116,7 +116,8 @@ class WidgetFactory :
typedef enum { resizeImage,
scratchpadWindowTitleImage,
searchWindowTitleImage,
liveModeWindowTitleImage }
liveModeWindowTitleImage,
playlistsWindowTitleImage }
ImageType;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.21 $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
------------------------------------------------------------------------------*/
@ -261,6 +261,12 @@ static const std::string searchWindowTitleImageName
static const std::string liveModeWindowTitleImageName
= "titleImages/liveModeWindowTitle.png";
/**
* The name of the image for the title of the playlist editor window.
*/
static const std::string playlistsWindowTitleImageName
= "titleImages/playlistsWindowTitle.png";
/* =============================================== local function prototypes */
@ -500,6 +506,10 @@ WidgetFactory :: createImage(ImageType imageName) throw ()
rawImage = loadImage(liveModeWindowTitleImageName);
break;
case playlistsWindowTitleImage:
rawImage = loadImage(playlistsWindowTitleImageName);
break;
default:
return 0;
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.7 $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -63,10 +63,12 @@ PlaylistListWindow :: PlaylistListWindow (
Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle)
: WhiteWindow(WidgetFactory::liveModeWindowTitleImage,
Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle),
gLiveSupport(gLiveSupport)
{
this->gLiveSupport = gLiveSupport;
// get localized resources
try {
set_title(*getResourceUstring("windowTitle"));

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.5 $
Author : $Author: fgerlits $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.h,v $
------------------------------------------------------------------------------*/
@ -48,6 +48,7 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/WhiteWindow.h"
#include "GLiveSupport.h"
namespace LiveSupport {
@ -83,10 +84,10 @@ using namespace LiveSupport::Core;
* +---------------------------------------------------------------+
* </pre></code>
*
* @author $Author: maroy $
* @version $Revision: 1.5 $
* @author $Author: fgerlits $
* @version $Revision: 1.6 $
*/
class PlaylistListWindow : public Gtk::Window, public LocalizedObject
class PlaylistListWindow : public WhiteWindow, public LocalizedObject
{
private:
@ -119,8 +120,8 @@ class PlaylistListWindow : public Gtk::Window, public LocalizedObject
* The model columns, for the playlist window.
* Lists one playlist per row.
*
* @author $Author: maroy $
* @version $Revision: 1.5 $
* @author $Author: fgerlits $
* @version $Revision: 1.6 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.10 $
Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -42,6 +42,7 @@
using namespace Glib;
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
using namespace LiveSupport::GLiveSupport;
/* =================================================== local data structures */
@ -62,17 +63,20 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle)
: WhiteWindow(WidgetFactory::playlistsWindowTitleImage,
Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle),
gLiveSupport(gLiveSupport)
{
this->gLiveSupport = gLiveSupport;
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
try {
set_title(*getResourceUstring("windowTitle"));
nameLabel = Gtk::manage(new Gtk::Label(*getResourceUstring(
"nameLabel")));
saveButton = Gtk::manage(new Gtk::Button(
nameLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("nameLabel")));
saveButton = Gtk::manage(wf->createButton(
*getResourceUstring("saveButtonLabel")));
closeButton = Gtk::manage(new Gtk::Button(
closeButton = Gtk::manage(wf->createButton(
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
@ -81,25 +85,22 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
nameEntry = Gtk::manage(new Gtk::Entry());
entriesScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
entriesView = Gtk::manage(new Gtk::TreeView());
entriesModel = Gtk::ListStore::create(modelColumns);
entriesView = Gtk::manage(wf->createTreeView(entriesModel));
// set up the entry scrolled window, with the entry treeview inside.
entriesScrolledWindow->add(*entriesView);
entriesScrolledWindow->set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC);
// Create the Tree model:
entriesModel = Gtk::ListStore::create(modelColumns);
entriesView->set_model(entriesModel);
// Add the TreeView's view columns:
try {
entriesView->append_column(*getResourceUstring("startColumnLabel"),
modelColumns.startColumn);
entriesView->append_column(*getResourceUstring("titleColumnLabel"),
modelColumns.titleColumn);
entriesView->append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
entriesView->appendColumn(*getResourceUstring("startColumnLabel"),
modelColumns.startColumn, 120);
entriesView->appendColumn(*getResourceUstring("titleColumnLabel"),
modelColumns.titleColumn, 200);
entriesView->appendColumn(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn, 120);
statusBar = Gtk::manage(new Gtk::Label(
*getResourceUstring("statusBar")));
@ -109,17 +110,32 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
}
// set up the layout
layout = Gtk::manage(new Gtk::Table());
Gtk::VBox * mainBox = Gtk::manage(new Gtk::VBox);
Gtk::HBox * nameBox = Gtk::manage(new Gtk::HBox);
nameBox->pack_start(*nameLabel, Gtk::PACK_SHRINK, 10);
Gtk::Alignment * nameEntryAlignment = Gtk::manage(new Gtk::Alignment(
Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER,
0.7)); // take up 70% of available room
nameEntryAlignment->add(*nameEntry);
nameBox->pack_start(*nameEntryAlignment, Gtk::PACK_EXPAND_WIDGET, 5);
mainBox->pack_start(*nameBox, Gtk::PACK_SHRINK, 5);
set_border_width(10);
layout->attach(*nameLabel, 0, 1, 0, 1);
layout->attach(*nameEntry, 1, 2, 0, 1);
layout->attach(*entriesScrolledWindow, 0, 2, 1, 2);
layout->attach(*saveButton, 1, 2, 2, 3);
layout->attach(*closeButton, 1, 2, 3, 4);
layout->attach(*statusBar, 0, 2, 4, 5);
mainBox->pack_start(*entriesScrolledWindow, Gtk::PACK_EXPAND_WIDGET, 5);
Gtk::ButtonBox * buttonBox = Gtk::manage(new Gtk::HButtonBox(
Gtk::BUTTONBOX_END, 5));
buttonBox->pack_start(*saveButton);
buttonBox->pack_start(*closeButton);
mainBox->pack_start(*buttonBox, Gtk::PACK_SHRINK, 0);
Gtk::Alignment * statusBarAlignment = Gtk::manage(new Gtk::Alignment(
Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER,
0.0)); // do not expand the label
statusBarAlignment->add(*statusBar);
mainBox->pack_start(*statusBarAlignment, Gtk::PACK_SHRINK, 5);
add(*layout);
add(*mainBox);
// Register the signal handlers
saveButton->signal_clicked().connect(sigc::mem_fun(*this,
@ -127,7 +143,12 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&SimplePlaylistManagementWindow::onCloseButtonClicked));
// show all
// show
set_name("simplePlaylistManagementWindow");
set_default_size(450, 300);
set_modal(false);
property_window_position().set_value(Gtk::WIN_POS_NONE);
show_all();
}
@ -196,29 +217,32 @@ SimplePlaylistManagementWindow :: onCloseButtonClicked (void) throw ()
void
SimplePlaylistManagementWindow :: showContents(void) throw ()
{
Ptr<Playlist>::Ref playlist;
Playlist::const_iterator it;
Playlist::const_iterator end;
Ptr<Playlist>::Ref playlist;
Playlist::const_iterator it;
Playlist::const_iterator end;
int rowNumber;
playlist = gLiveSupport->getEditedPlaylist();
if (playlist) {
it = playlist->begin();
end = playlist->end();
entriesModel->clear();
while (it != end) {
Ptr<PlaylistElement>::Ref playlistElem = it->second;
Ptr<Playable>::Ref playable = playlistElem->getPlayable();
Gtk::TreeModel::Row row = *(entriesModel->append());
rowNumber = 0;
for (it = playlist->begin(); it != playlist->end(); ++it) {
Ptr<PlaylistElement>::Ref
playlistElem = it->second;
Ptr<Playable>::Ref playable = playlistElem->getPlayable();
Gtk::TreeModel::Row row = *(entriesModel->append());
row[modelColumns.idColumn] = playable->getId();
row[modelColumns.startColumn] =
to_simple_string(*playlistElem->getRelativeOffset());
row[modelColumns.titleColumn] = *playable->getTitle();
row[modelColumns.lengthColumn] =
to_simple_string(*playable->getPlaylength());
it++;
row[modelColumns.rowNumberColumn]
= rowNumber++;
row[modelColumns.idColumn]
= playable->getId();
row[modelColumns.startColumn]
= to_simple_string(*playlistElem->getRelativeOffset());
row[modelColumns.titleColumn]
= *playable->getTitle();
row[modelColumns.lengthColumn]
= to_simple_string(*playable->getPlaylength());
}
}
}

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.3 $
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h,v $
------------------------------------------------------------------------------*/
@ -48,12 +48,16 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/WhiteWindow.h"
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "GLiveSupport.h"
namespace LiveSupport {
namespace GLiveSupport {
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* ================================================================ constants */
@ -82,10 +86,10 @@ using namespace LiveSupport::Core;
* +----------------------------------------------+
* </code></pre>
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
*/
class SimplePlaylistManagementWindow : public Gtk::Window,
class SimplePlaylistManagementWindow : public WhiteWindow,
public LocalizedObject
{
@ -95,10 +99,10 @@ class SimplePlaylistManagementWindow : public Gtk::Window,
* The columns model needed by Gtk::TreeView.
* Lists one playlist entry per row.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @author $Author: fgerlits $
* @version $Revision: 1.4 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
class ModelColumns : public ZebraTreeModelColumnRecord
{
public:
/**
@ -144,11 +148,6 @@ class SimplePlaylistManagementWindow : public Gtk::Window,
*/
ModelColumns modelColumns;
/**
* The layout used in the window.
*/
Gtk::Table * layout;
/**
* The label for the name entry.
*/
@ -162,27 +161,27 @@ class SimplePlaylistManagementWindow : public Gtk::Window,
/**
* A scrolled window, so that the entry list can be scrolled.
*/
Gtk::ScrolledWindow * entriesScrolledWindow;
Gtk::ScrolledWindow * entriesScrolledWindow;
/**
* The entry tree view, now only showing rows.
*/
Gtk::TreeView * entriesView;
ZebraTreeView * entriesView;
/**
* The entry tree model, as a GTK reference.
*/
Glib::RefPtr<Gtk::ListStore> entriesModel;
Glib::RefPtr<Gtk::ListStore> entriesModel;
/**
* The save button.
*/
Gtk::Button * saveButton;
Button * saveButton;
/**
* The close button.
*/
Gtk::Button * closeButton;
Button * closeButton;
/**
* The status bar.