reformatted the Live Mode table
This commit is contained in:
parent
125d6ceb64
commit
d56c8131fd
6 changed files with 113 additions and 41 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.10 $
|
||||
Version : $Revision: 1.11 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
|
|||
* 3) connected with a TreeModelColumn using set_renderer().
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.10 $
|
||||
* @version $Revision: 1.11 $
|
||||
*/
|
||||
class ZebraTreeView : public Gtk::TreeView
|
||||
{
|
||||
|
@ -158,6 +158,23 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
WidgetFactory::ImageButtonType buttonType,
|
||||
int minimumWidth = 0)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Add a centered text column to the TreeView.
|
||||
*
|
||||
* @param title the title of the column
|
||||
* @param modelColumn the model column this view will display
|
||||
* @param minimumWidth the minimum width of the column, in pixels
|
||||
* (optional)
|
||||
* @return the number of columns after adding this one
|
||||
*/
|
||||
int
|
||||
appendCenteredColumn(
|
||||
const Glib::ustring& title,
|
||||
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
|
||||
int minimumWidth = 0)
|
||||
throw ();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.10 $
|
||||
Version : $Revision: 1.11 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ZebraTreeView.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -90,7 +90,7 @@ ZebraTreeView :: appendColumn(
|
|||
Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// and then we associate this renderer with the model column
|
||||
viewColumn->set_renderer(*renderer, modelColumn);
|
||||
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
|
||||
|
||||
// this cell data function will do the blue-gray zebra stripes
|
||||
viewColumn->set_cell_data_func(
|
||||
|
@ -161,3 +161,40 @@ ZebraTreeView :: cellDataFunction(Gtk::CellRenderer* cell,
|
|||
cell->property_cell_background_gdk() = Colors::getColor(colorName);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add a centered text column to the TreeView.
|
||||
*----------------------------------------------------------------------------*/
|
||||
int
|
||||
ZebraTreeView :: appendCenteredColumn(
|
||||
const Glib::ustring& title,
|
||||
const Gtk::TreeModelColumn<Glib::ustring>& modelColumn,
|
||||
int minimumWidth)
|
||||
throw ()
|
||||
{
|
||||
// a standard cell renderer; can be replaced with a ZebraCellRenderer
|
||||
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
|
||||
Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// and then we associate this renderer with the model column
|
||||
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
|
||||
|
||||
// center the text in the column
|
||||
viewColumn->set_alignment(Gtk::ALIGN_CENTER);
|
||||
|
||||
// this cell data function will do the blue-gray zebra stripes
|
||||
viewColumn->set_cell_data_func(
|
||||
*renderer,
|
||||
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
|
||||
|
||||
// set the minimum width of the column
|
||||
if (minimumWidth) {
|
||||
viewColumn->set_min_width(minimumWidth);
|
||||
}
|
||||
|
||||
return append_column(*viewColumn);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.8 $
|
||||
Version : $Revision: 1.9 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <glibmm.h>
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
#include "SchedulePlaylistWindow.h"
|
||||
|
@ -81,16 +82,13 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
|
||||
// ... and the tree view:
|
||||
treeView = Gtk::manage(widgetFactory->createTreeView(treeModel));
|
||||
treeView->set_headers_visible(false);
|
||||
|
||||
// Add the TreeView's view columns:
|
||||
try {
|
||||
treeView->appendCenteredColumn("", modelColumns.numberColumn, 50);
|
||||
treeView->appendColumn("", WidgetFactory::hugePlayButton, 82);
|
||||
treeView->appendColumn(*getResourceUstring("titleColumnLabel"),
|
||||
modelColumns.titleColumn, 200);
|
||||
treeView->appendColumn(*getResourceUstring("creatorColumnLabel"),
|
||||
modelColumns.creatorColumn, 200);
|
||||
treeView->appendColumn(*getResourceUstring("lengthColumnLabel"),
|
||||
modelColumns.lengthColumn, 120);
|
||||
treeView->appendColumn("", modelColumns.infoColumn, 200);
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
|
@ -157,12 +155,46 @@ LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
|||
Gtk::TreeModel::Row row = *(treeModel->append());
|
||||
|
||||
row[modelColumns.playableColumn] = playable;
|
||||
row[modelColumns.titleColumn] = *playable->getTitle();
|
||||
|
||||
Ptr<Glib::ustring>::Ref numberString(new Glib::ustring);
|
||||
|
||||
numberString->append("<span size=\"larger\" weight=\"ultrabold\">");
|
||||
std::stringstream numberStr;
|
||||
numberStr << (rowNumber + 2);
|
||||
numberString->append(numberStr.str());
|
||||
numberString->append("</span>");
|
||||
|
||||
row[modelColumns.numberColumn] = *numberString;
|
||||
|
||||
Ptr<Glib::ustring>::Ref infoString(new Glib::ustring);
|
||||
|
||||
infoString->append("<span size=\"larger\" weight=\"bold\">");
|
||||
infoString->append(Glib::Markup::escape_text(*playable->getTitle()));
|
||||
infoString->append("</span>");
|
||||
|
||||
// TODO: rewrite this using the Core::Metadata class
|
||||
|
||||
Ptr<Glib::ustring>::Ref
|
||||
creator = playable->getMetadata("dc:creator");
|
||||
row[modelColumns.creatorColumn] = creator ? *creator : "";
|
||||
row[modelColumns.lengthColumn] = to_simple_string(
|
||||
*playable->getPlaylength() );
|
||||
if (creator) {
|
||||
infoString->append("\n<span weight=\"bold\">");
|
||||
infoString->append(Glib::Markup::escape_text(*creator));
|
||||
infoString->append("</span>");
|
||||
}
|
||||
|
||||
Ptr<Glib::ustring>::Ref
|
||||
album = playable->getMetadata("dc:source");
|
||||
if (album) {
|
||||
infoString->append("\n<span weight=\"bold\">");
|
||||
infoString->append(Glib::Markup::escape_text(*album));
|
||||
infoString->append("</span>");
|
||||
}
|
||||
|
||||
infoString->append("\nduration: ");
|
||||
infoString->append(to_simple_string(*playable->getPlaylength()));
|
||||
|
||||
row[modelColumns.infoColumn] = *infoString;
|
||||
|
||||
row[modelColumns.rowNumberColumn] = rowNumber;
|
||||
}
|
||||
|
||||
|
|
|
@ -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/LiveModeWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -73,7 +73,7 @@ using namespace LiveSupport::Widgets;
|
|||
* playlists.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.7 $
|
||||
* @version $Revision: 1.8 $
|
||||
*/
|
||||
class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
* Lists one clip per row.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.7 $
|
||||
* @version $Revision: 1.8 $
|
||||
*/
|
||||
class ModelColumns : public ZebraTreeModelColumnRecord
|
||||
{
|
||||
|
@ -96,6 +96,11 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
*/
|
||||
Gtk::TreeModelColumn<Ptr<Playable>::Ref> playableColumn;
|
||||
|
||||
/**
|
||||
* The column for the big row number display.
|
||||
*/
|
||||
Gtk::TreeModelColumn<Glib::ustring> numberColumn;
|
||||
|
||||
/**
|
||||
* The column for the play button.
|
||||
*/
|
||||
|
@ -103,19 +108,9 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
playButtonColumn;
|
||||
|
||||
/**
|
||||
* The column for the title of the audio clip or playlist.
|
||||
* The column for the title, creator, etc.
|
||||
*/
|
||||
Gtk::TreeModelColumn<Glib::ustring> titleColumn;
|
||||
|
||||
/**
|
||||
* The column for the creator of the audio clip or playlist.
|
||||
*/
|
||||
Gtk::TreeModelColumn<Glib::ustring> creatorColumn;
|
||||
|
||||
/**
|
||||
* The column for the length of the audio clip or playlist.
|
||||
*/
|
||||
Gtk::TreeModelColumn<Glib::ustring> lengthColumn;
|
||||
Gtk::TreeModelColumn<Glib::ustring> infoColumn;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -123,10 +118,9 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
ModelColumns(void) throw ()
|
||||
{
|
||||
add(playableColumn);
|
||||
add(numberColumn);
|
||||
add(playButtonColumn);
|
||||
add(titleColumn);
|
||||
add(creatorColumn);
|
||||
add(lengthColumn);
|
||||
add(infoColumn);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -179,10 +179,6 @@ hu:table
|
|||
{
|
||||
windowTitle:string { "LiveSupport Élő adás ablak" }
|
||||
|
||||
titleColumnLabel:string { "Cím" }
|
||||
creatorColumnLabel:string { "Előadó" }
|
||||
lengthColumnLabel:string { "Hossz" }
|
||||
|
||||
cueMenuItem:string { "Bele_hallgatni" }
|
||||
upMenuItem:string { "_Fel" }
|
||||
downMenuItem:string { "_Le" }
|
||||
|
|
|
@ -181,10 +181,6 @@ root:table
|
|||
{
|
||||
windowTitle:string { "LiveSupport Live Mode Window" }
|
||||
|
||||
titleColumnLabel:string { "Title" }
|
||||
creatorColumnLabel:string { "Creator" }
|
||||
lengthColumnLabel:string { "Length" }
|
||||
|
||||
cueMenuItem:string { "_Cue" }
|
||||
upMenuItem:string { "Move _Up" }
|
||||
downMenuItem:string { "Move D_own" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue