implemented the calls to the preload() function; this closes #2012
This commit is contained in:
parent
4b1ea1e069
commit
b4c9ed0e76
|
@ -150,6 +150,16 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
signalCellEdited().emit(path, columnId, newText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit the "tree model has changed" signal.
|
||||
*/
|
||||
void
|
||||
emitSignalTreeModelChanged(void)
|
||||
throw ()
|
||||
{
|
||||
signalTreeModelChanged().emit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renumber the rows after they have changed.
|
||||
*
|
||||
|
@ -181,6 +191,11 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
int,
|
||||
const Glib::ustring &> signalCellEditedObject;
|
||||
|
||||
/**
|
||||
* A signal object to notify people that the tree model has changed.
|
||||
*/
|
||||
sigc::signal<void> signalTreeModelChangedObject;
|
||||
|
||||
/**
|
||||
* Event handler for the row_inserted signal.
|
||||
*
|
||||
|
@ -397,6 +412,19 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
return signalCellEditedObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* The signal raised when the rows in the tree model have changed.
|
||||
* This signal is emitted whenever the tree model emits a
|
||||
* row_inserted, row_deleted or rows_reordered signal.
|
||||
*
|
||||
* @return the signal object (a protected member of this class)
|
||||
*/
|
||||
sigc::signal<void>
|
||||
signalTreeModelChanged(void) throw ()
|
||||
{
|
||||
return signalTreeModelChangedObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually connect the 'model has changed' signals to the tree view.
|
||||
* This is useful if you want to use the same ZebraTreeView object
|
||||
|
|
|
@ -501,6 +501,7 @@ ZebraTreeView :: onRowInserted(const Gtk::TreeModel::Path & path,
|
|||
{
|
||||
renumberRows();
|
||||
columns_autosize();
|
||||
emitSignalTreeModelChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -513,6 +514,7 @@ ZebraTreeView :: onRowDeleted(const Gtk::TreeModel::Path & path)
|
|||
{
|
||||
renumberRows();
|
||||
columns_autosize();
|
||||
emitSignalTreeModelChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -526,6 +528,7 @@ ZebraTreeView :: onRowsReordered(const Gtk::TreeModel::Path & path,
|
|||
throw ()
|
||||
{
|
||||
renumberRows();
|
||||
emitSignalTreeModelChanged();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -109,9 +109,11 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
|
||||
// register the signal handler for treeview entries being clicked
|
||||
treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this,
|
||||
&LiveModeWindow::onEntryClicked));
|
||||
&LiveModeWindow::onEntryClicked));
|
||||
treeView->signal_row_activated().connect(sigc::mem_fun(*this,
|
||||
&LiveModeWindow::onDoubleClick));
|
||||
&LiveModeWindow::onDoubleClick));
|
||||
treeView->signalTreeModelChanged().connect(sigc::mem_fun(*this,
|
||||
&LiveModeWindow::onTreeModelChanged));
|
||||
|
||||
// register the signal handler for keyboard key presses
|
||||
treeView->signal_key_press_event().connect(sigc::mem_fun(*this,
|
||||
|
@ -197,10 +199,7 @@ void
|
|||
LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
||||
{
|
||||
addItem(treeModel->append(), playable);
|
||||
|
||||
if (treeModel->children().size() == 1) {
|
||||
preloadNextItem();
|
||||
}
|
||||
onTreeModelChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,22 +271,6 @@ LiveModeWindow :: popTop(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Preload the item at the top of the window.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveModeWindow :: preloadNextItem(void) throw ()
|
||||
{
|
||||
Ptr<Playable>::Ref playable;
|
||||
Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
||||
|
||||
if (iter) {
|
||||
playable = (*iter)[modelColumns.playableColumn];
|
||||
gLiveSupport->preload(playable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Find the selected row.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -669,6 +652,28 @@ LiveModeWindow :: onRemoveItemButtonClicked(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Signal handler for a change in the tree model.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveModeWindow :: onTreeModelChanged(void) throw ()
|
||||
{
|
||||
Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
||||
|
||||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
if (playable) {
|
||||
if (!savedTopPlayable || savedTopPlayable &&
|
||||
*savedTopPlayable->getId() != *playable->getId()) {
|
||||
gLiveSupport->preload(playable);
|
||||
}
|
||||
savedTopPlayable = playable;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler called when the the window gets hidden.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -81,6 +81,11 @@ using namespace LiveSupport::Widgets;
|
|||
class LiveModeWindow : public GuiWindow
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The Playable item at the top of the window.
|
||||
*/
|
||||
Ptr<Playable>::Ref savedTopPlayable;
|
||||
|
||||
/**
|
||||
* The Export Playlist pop-up window.
|
||||
*/
|
||||
|
@ -280,6 +285,12 @@ class LiveModeWindow : public GuiWindow
|
|||
virtual void
|
||||
onRemoveItemButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* Signal handler for a change in the tree model.
|
||||
*/
|
||||
virtual void
|
||||
onTreeModelChanged(void) throw ();
|
||||
|
||||
/**
|
||||
* Event handler called when the the window gets hidden.
|
||||
*
|
||||
|
@ -341,13 +352,6 @@ class LiveModeWindow : public GuiWindow
|
|||
Ptr<Playable>::Ref
|
||||
popTop(void) throw ();
|
||||
|
||||
/**
|
||||
* Preload the item at the top of the window.
|
||||
* This is to shorten the time a playlist takes to start.
|
||||
*/
|
||||
void
|
||||
preloadNextItem() throw ();
|
||||
|
||||
/**
|
||||
* Update the cue player display to show a stopped state.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue