fixed #2234;
also: made the contents of the window stored at logout and restored at startup
This commit is contained in:
parent
c2eab3dfd7
commit
1bfa7f3207
10 changed files with 171 additions and 3 deletions
|
@ -705,7 +705,7 @@ GLiveSupport :: loadWindowContents(ContentsStorable * window)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
// no scratchpad stored for this user yet; no problem
|
// no preferences stored for this user yet; no problem
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,11 @@ namespace {
|
||||||
*/
|
*/
|
||||||
const Glib::ustring windowName = "liveModeWindow";
|
const Glib::ustring windowName = "liveModeWindow";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the user preference for storing contents of the window.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const Glib::ustring userPreferencesKeyName = "liveModeContents";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
@ -151,6 +156,16 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
cueAudioButtons = Gtk::manage(new CuePlayer(
|
cueAudioButtons = Gtk::manage(new CuePlayer(
|
||||||
gLiveSupport, treeView, modelColumns ));
|
gLiveSupport, treeView, modelColumns ));
|
||||||
|
|
||||||
|
Gtk::HBox * autoPlayNextBox = Gtk::manage(new Gtk::HBox);
|
||||||
|
try {
|
||||||
|
autoPlayNext = Gtk::manage(new Gtk::CheckButton(
|
||||||
|
*getResourceUstring("autoPlayNextLabel") ));
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
autoPlayNextBox->pack_start(*autoPlayNext, Gtk::PACK_SHRINK, 10);
|
||||||
|
|
||||||
topButtonBox->pack_start(*outputPlayButton, Gtk::PACK_EXPAND_PADDING, 10);
|
topButtonBox->pack_start(*outputPlayButton, Gtk::PACK_EXPAND_PADDING, 10);
|
||||||
topButtonBox->pack_start(*cueAudioBox, Gtk::PACK_EXPAND_PADDING, 10);
|
topButtonBox->pack_start(*cueAudioBox, Gtk::PACK_EXPAND_PADDING, 10);
|
||||||
cueAudioBox->pack_start(*cueAudioLabelBox, Gtk::PACK_SHRINK, 6);
|
cueAudioBox->pack_start(*cueAudioLabelBox, Gtk::PACK_SHRINK, 6);
|
||||||
|
@ -165,6 +180,7 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
bottomButtonBox->pack_start(*removeButton);
|
bottomButtonBox->pack_start(*removeButton);
|
||||||
|
|
||||||
vBox.pack_start(*topButtonBox, Gtk::PACK_SHRINK, 5);
|
vBox.pack_start(*topButtonBox, Gtk::PACK_SHRINK, 5);
|
||||||
|
vBox.pack_start(*autoPlayNextBox, Gtk::PACK_SHRINK, 5);
|
||||||
vBox.pack_start(scrolledWindow, Gtk::PACK_EXPAND_WIDGET, 5);
|
vBox.pack_start(scrolledWindow, Gtk::PACK_EXPAND_WIDGET, 5);
|
||||||
vBox.pack_start(*bottomButtonBox, Gtk::PACK_SHRINK, 5);
|
vBox.pack_start(*bottomButtonBox, Gtk::PACK_SHRINK, 5);
|
||||||
add(vBox);
|
add(vBox);
|
||||||
|
@ -181,6 +197,8 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
audioClipContextMenu = constructAudioClipContextMenu();
|
audioClipContextMenu = constructAudioClipContextMenu();
|
||||||
playlistContextMenu = constructPlaylistContextMenu();
|
playlistContextMenu = constructPlaylistContextMenu();
|
||||||
|
|
||||||
|
userPreferencesKey.reset(new const Glib::ustring(userPreferencesKeyName));
|
||||||
|
|
||||||
// show
|
// show
|
||||||
set_name(windowName);
|
set_name(windowName);
|
||||||
set_default_size(400, 500);
|
set_default_size(400, 500);
|
||||||
|
@ -251,6 +269,26 @@ LiveModeWindow :: addItem(Gtk::TreeModel::iterator iter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Add an item to the Live Mode window, by ID.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveModeWindow :: addItem(Ptr<const UniqueId>::Ref id)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
Ptr<Playable>::Ref playable;
|
||||||
|
try {
|
||||||
|
playable = gLiveSupport->acquirePlayable(id);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
std::cerr << "could not acquire playable in LiveModeWindow: "
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addItem(playable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* "Pop" the first item from the top of the Live Mode Window.
|
* "Pop" the first item from the top of the Live Mode Window.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -258,8 +296,11 @@ Ptr<Playable>::Ref
|
||||||
LiveModeWindow :: popTop(void) throw ()
|
LiveModeWindow :: popTop(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<Playable>::Ref playable;
|
Ptr<Playable>::Ref playable;
|
||||||
Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
if (!autoPlayNext->get_active()) {
|
||||||
|
return playable; // return a 0 pointer if auto is set to off
|
||||||
|
}
|
||||||
|
|
||||||
|
Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
||||||
if (iter) {
|
if (iter) {
|
||||||
playable = (*iter)[modelColumns.playableColumn];
|
playable = (*iter)[modelColumns.playableColumn];
|
||||||
treeModel->erase(iter);
|
treeModel->erase(iter);
|
||||||
|
@ -706,6 +747,68 @@ LiveModeWindow :: updateStrings(void) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Return the contents of the Scratchpad.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<Glib::ustring>::Ref
|
||||||
|
LiveModeWindow :: getContents(void) throw ()
|
||||||
|
{
|
||||||
|
std::ostringstream contentsStream;
|
||||||
|
|
||||||
|
contentsStream << int(autoPlayNext->get_active()) << " ";
|
||||||
|
|
||||||
|
Gtk::TreeModel::const_iterator it;
|
||||||
|
for (it = treeModel->children().begin();
|
||||||
|
it != treeModel->children().end(); ++it) {
|
||||||
|
Gtk::TreeRow row = *it;
|
||||||
|
Ptr<Playable>::Ref playable = row[modelColumns.playableColumn];
|
||||||
|
contentsStream << playable->getId()->getId() << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<Glib::ustring>::Ref contents(new Glib::ustring(
|
||||||
|
contentsStream.str() ));
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Restore the contents of the Scratchpad.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveModeWindow :: setContents(Ptr<const Glib::ustring>::Ref contents)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
std::istringstream contentsStream(*contents);
|
||||||
|
if (contentsStream.eof()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int autoPlayNextValue;
|
||||||
|
contentsStream >> autoPlayNextValue;
|
||||||
|
autoPlayNext->set_active(autoPlayNextValue);
|
||||||
|
|
||||||
|
std::vector<UniqueId::IdType> contentsVector;
|
||||||
|
while (!contentsStream.eof()) {
|
||||||
|
UniqueId::IdType nextItem;
|
||||||
|
contentsStream >> nextItem;
|
||||||
|
if (contentsStream.fail()) {
|
||||||
|
contentsStream.clear();
|
||||||
|
contentsStream.ignore();
|
||||||
|
} else {
|
||||||
|
contentsVector.push_back(nextItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
treeModel->clear();
|
||||||
|
std::vector<UniqueId::IdType>::reverse_iterator it;
|
||||||
|
|
||||||
|
for (it = contentsVector.rbegin(); it != contentsVector.rend(); ++it) {
|
||||||
|
Ptr<const UniqueId>::Ref id(new const UniqueId(*it));
|
||||||
|
addItem(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Event handler called when the the window gets hidden.
|
* Event handler called when the the window gets hidden.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||||
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
|
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
|
||||||
#include "GuiWindow.h"
|
#include "GuiWindow.h"
|
||||||
|
#include "ContentsStorable.h"
|
||||||
#include "CuePlayer.h"
|
#include "CuePlayer.h"
|
||||||
#include "GLiveSupport.h"
|
#include "GLiveSupport.h"
|
||||||
#include "ExportPlaylistWindow.h"
|
#include "ExportPlaylistWindow.h"
|
||||||
|
@ -78,7 +79,8 @@ using namespace LiveSupport::Widgets;
|
||||||
* @author $Author$
|
* @author $Author$
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
class LiveModeWindow : public GuiWindow
|
class LiveModeWindow : public GuiWindow,
|
||||||
|
public ContentsStorable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -91,6 +93,11 @@ class LiveModeWindow : public GuiWindow
|
||||||
*/
|
*/
|
||||||
bool isDeleting;
|
bool isDeleting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user preferences key.
|
||||||
|
*/
|
||||||
|
Ptr<const Glib::ustring>::Ref userPreferencesKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Export Playlist pop-up window.
|
* The Export Playlist pop-up window.
|
||||||
*/
|
*/
|
||||||
|
@ -121,6 +128,12 @@ class LiveModeWindow : public GuiWindow
|
||||||
*/
|
*/
|
||||||
Button * removeButton;
|
Button * removeButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If checked, the top item in the window will start playing
|
||||||
|
* automatically after the current one finishes.
|
||||||
|
*/
|
||||||
|
Gtk::CheckButton * autoPlayNext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the right-click context menu for local audio clips.
|
* Construct the right-click context menu for local audio clips.
|
||||||
*
|
*
|
||||||
|
@ -363,6 +376,15 @@ class LiveModeWindow : public GuiWindow
|
||||||
addItem(Gtk::TreeModel::iterator iter,
|
addItem(Gtk::TreeModel::iterator iter,
|
||||||
Ptr<Playable>::Ref playable) throw ();
|
Ptr<Playable>::Ref playable) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an item to the top of the Live Mode Window, by ID.
|
||||||
|
*
|
||||||
|
* @param id the id of the item to add.
|
||||||
|
* @see setContents().
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
addItem(Ptr<const UniqueId>::Ref id) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Pop" the first item from the top of the Live Mode Window.
|
* "Pop" the first item from the top of the Live Mode Window.
|
||||||
*
|
*
|
||||||
|
@ -409,6 +431,41 @@ class LiveModeWindow : public GuiWindow
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
updateStrings(void) throw ();
|
updateStrings(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the contents of the Live Mode window.
|
||||||
|
* This means the list of audio files, plus the state of the
|
||||||
|
* autoPlayNext checkbox.
|
||||||
|
*
|
||||||
|
* @return 0 or 1, followed by a space-separated list of the
|
||||||
|
* unique IDs, in base 10.
|
||||||
|
*/
|
||||||
|
Ptr<Glib::ustring>::Ref
|
||||||
|
getContents(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the contents of the Scratchpad.
|
||||||
|
* The current contents are discarded, and replaced with the items
|
||||||
|
* listed in the 'contents' parameter.
|
||||||
|
*
|
||||||
|
* @param contents 0 or 1, followed by a space-separated list of the
|
||||||
|
* unique IDs, in base 10.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setContents(Ptr<const Glib::ustring>::Ref contents) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the user preferences key.
|
||||||
|
* The contents of the window will be stored in the user preferences
|
||||||
|
* under this key.
|
||||||
|
*
|
||||||
|
* @return the user preference key.
|
||||||
|
*/
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
getUserPreferencesKey(void) throw ()
|
||||||
|
{
|
||||||
|
return userPreferencesKey;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
/* ================================================= external data structures */
|
||||||
|
|
|
@ -467,6 +467,7 @@ MasterPanelWindow :: updateLiveModeWindow(Ptr<Playable>::Ref playable)
|
||||||
liveModeWindow.reset(new LiveModeWindow(gLiveSupport,
|
liveModeWindow.reset(new LiveModeWindow(gLiveSupport,
|
||||||
bundle,
|
bundle,
|
||||||
liveModeButton));
|
liveModeButton));
|
||||||
|
gLiveSupport->loadWindowContents(liveModeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
liveModeWindow->present();
|
liveModeWindow->present();
|
||||||
|
@ -678,6 +679,7 @@ MasterPanelWindow :: showAnonymousUI(void) throw ()
|
||||||
optionsButton->hide();
|
optionsButton->hide();
|
||||||
|
|
||||||
if (liveModeWindow.get()) {
|
if (liveModeWindow.get()) {
|
||||||
|
gLiveSupport->storeWindowContents(liveModeWindow);
|
||||||
if (liveModeWindow->is_visible()) {
|
if (liveModeWindow->is_visible()) {
|
||||||
liveModeWindow->hide();
|
liveModeWindow->hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,7 @@ es:table
|
||||||
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
||||||
|
|
||||||
cuePlayerLabel:string { "Previsualizar" }
|
cuePlayerLabel:string { "Previsualizar" }
|
||||||
|
autoPlayNextLabel:string { "#Play the next item automatically#" }
|
||||||
|
|
||||||
clearListButtonLabel:string { "Clear list" }
|
clearListButtonLabel:string { "Clear list" }
|
||||||
removeButtonLabel:string { "Remove item(s)" }
|
removeButtonLabel:string { "Remove item(s)" }
|
||||||
|
|
|
@ -254,6 +254,7 @@ hu:table
|
||||||
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
||||||
|
|
||||||
cuePlayerLabel:string { "Belehallgatni" }
|
cuePlayerLabel:string { "Belehallgatni" }
|
||||||
|
autoPlayNextLabel:string { "#Play the next item automatically#" }
|
||||||
|
|
||||||
clearListButtonLabel:string { "Clear list" }
|
clearListButtonLabel:string { "Clear list" }
|
||||||
removeButtonLabel:string { "Remove item(s)" }
|
removeButtonLabel:string { "Remove item(s)" }
|
||||||
|
|
|
@ -256,6 +256,7 @@ nl:table
|
||||||
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
||||||
|
|
||||||
cuePlayerLabel:string { "Cue" }
|
cuePlayerLabel:string { "Cue" }
|
||||||
|
autoPlayNextLabel:string { "#Play the next item automatically#" }
|
||||||
|
|
||||||
clearListButtonLabel:string { "Clear list" }
|
clearListButtonLabel:string { "Clear list" }
|
||||||
removeButtonLabel:string { "Remove item(s)" }
|
removeButtonLabel:string { "Remove item(s)" }
|
||||||
|
|
|
@ -256,6 +256,7 @@ root:table
|
||||||
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
uploadToHubMenuItem:string { "Upload to Network Hub" }
|
||||||
|
|
||||||
cuePlayerLabel:string { "Preview" }
|
cuePlayerLabel:string { "Preview" }
|
||||||
|
autoPlayNextLabel:string { "Play the next item automatically" }
|
||||||
|
|
||||||
clearListButtonLabel:string { "Clear list" }
|
clearListButtonLabel:string { "Clear list" }
|
||||||
removeButtonLabel:string { "Remove item(s)" }
|
removeButtonLabel:string { "Remove item(s)" }
|
||||||
|
|
|
@ -251,6 +251,7 @@ sr_CS:table
|
||||||
uploadToHubMenuItem:string { "Uputi na centralni server" }
|
uploadToHubMenuItem:string { "Uputi na centralni server" }
|
||||||
|
|
||||||
cuePlayerLabel:string { "Proba" }
|
cuePlayerLabel:string { "Proba" }
|
||||||
|
autoPlayNextLabel:string { "#Play the next item automatically#" }
|
||||||
|
|
||||||
clearListButtonLabel:string { "Očisti listu" }
|
clearListButtonLabel:string { "Očisti listu" }
|
||||||
removeButtonLabel:string { "Ukloni" }
|
removeButtonLabel:string { "Ukloni" }
|
||||||
|
|
|
@ -251,6 +251,7 @@ sr_CS_CYRILLIC:table
|
||||||
uploadToHubMenuItem:string { "Упути на централни сервер" }
|
uploadToHubMenuItem:string { "Упути на централни сервер" }
|
||||||
|
|
||||||
cuePlayerLabel:string { "Проба" }
|
cuePlayerLabel:string { "Проба" }
|
||||||
|
autoPlayNextLabel:string { "#Play the next item automatically#" }
|
||||||
|
|
||||||
clearListButtonLabel:string { "Очисти листу" }
|
clearListButtonLabel:string { "Очисти листу" }
|
||||||
removeButtonLabel:string { "Уклони" }
|
removeButtonLabel:string { "Уклони" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue