implemented the calls to the preload() function; this closes #2012
This commit is contained in:
parent
4b1ea1e069
commit
b4c9ed0e76
4 changed files with 69 additions and 29 deletions
|
@ -150,6 +150,16 @@ class ZebraTreeView : public Gtk::TreeView
|
||||||
signalCellEdited().emit(path, columnId, newText);
|
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.
|
* Renumber the rows after they have changed.
|
||||||
*
|
*
|
||||||
|
@ -181,6 +191,11 @@ class ZebraTreeView : public Gtk::TreeView
|
||||||
int,
|
int,
|
||||||
const Glib::ustring &> signalCellEditedObject;
|
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.
|
* Event handler for the row_inserted signal.
|
||||||
*
|
*
|
||||||
|
@ -397,6 +412,19 @@ class ZebraTreeView : public Gtk::TreeView
|
||||||
return signalCellEditedObject;
|
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.
|
* Manually connect the 'model has changed' signals to the tree view.
|
||||||
* This is useful if you want to use the same ZebraTreeView object
|
* This is useful if you want to use the same ZebraTreeView object
|
||||||
|
|
|
@ -501,6 +501,7 @@ ZebraTreeView :: onRowInserted(const Gtk::TreeModel::Path & path,
|
||||||
{
|
{
|
||||||
renumberRows();
|
renumberRows();
|
||||||
columns_autosize();
|
columns_autosize();
|
||||||
|
emitSignalTreeModelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -513,6 +514,7 @@ ZebraTreeView :: onRowDeleted(const Gtk::TreeModel::Path & path)
|
||||||
{
|
{
|
||||||
renumberRows();
|
renumberRows();
|
||||||
columns_autosize();
|
columns_autosize();
|
||||||
|
emitSignalTreeModelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -526,6 +528,7 @@ ZebraTreeView :: onRowsReordered(const Gtk::TreeModel::Path & path,
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
renumberRows();
|
renumberRows();
|
||||||
|
emitSignalTreeModelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,8 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
&LiveModeWindow::onEntryClicked));
|
&LiveModeWindow::onEntryClicked));
|
||||||
treeView->signal_row_activated().connect(sigc::mem_fun(*this,
|
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
|
// register the signal handler for keyboard key presses
|
||||||
treeView->signal_key_press_event().connect(sigc::mem_fun(*this,
|
treeView->signal_key_press_event().connect(sigc::mem_fun(*this,
|
||||||
|
@ -197,10 +199,7 @@ void
|
||||||
LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
||||||
{
|
{
|
||||||
addItem(treeModel->append(), playable);
|
addItem(treeModel->append(), playable);
|
||||||
|
onTreeModelChanged();
|
||||||
if (treeModel->children().size() == 1) {
|
|
||||||
preloadNextItem();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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.
|
* 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.
|
* Event handler called when the the window gets hidden.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -81,6 +81,11 @@ using namespace LiveSupport::Widgets;
|
||||||
class LiveModeWindow : public GuiWindow
|
class LiveModeWindow : public GuiWindow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* The Playable item at the top of the window.
|
||||||
|
*/
|
||||||
|
Ptr<Playable>::Ref savedTopPlayable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Export Playlist pop-up window.
|
* The Export Playlist pop-up window.
|
||||||
*/
|
*/
|
||||||
|
@ -280,6 +285,12 @@ class LiveModeWindow : public GuiWindow
|
||||||
virtual void
|
virtual void
|
||||||
onRemoveItemButtonClicked(void) throw ();
|
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.
|
* Event handler called when the the window gets hidden.
|
||||||
*
|
*
|
||||||
|
@ -341,13 +352,6 @@ class LiveModeWindow : public GuiWindow
|
||||||
Ptr<Playable>::Ref
|
Ptr<Playable>::Ref
|
||||||
popTop(void) throw ();
|
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.
|
* Update the cue player display to show a stopped state.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue