progress towards #1617 (displays keyboard shortcuts, can't be edited yet)
This commit is contained in:
parent
1e1842ab95
commit
8c2c13faf2
16 changed files with 858 additions and 307 deletions
|
@ -259,6 +259,7 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
|
||||||
${TMP_DIR}/CuePlayer.o \
|
${TMP_DIR}/CuePlayer.o \
|
||||||
${TMP_DIR}/KeyboardShortcut.o \
|
${TMP_DIR}/KeyboardShortcut.o \
|
||||||
${TMP_DIR}/KeyboardShortcutContainer.o \
|
${TMP_DIR}/KeyboardShortcutContainer.o \
|
||||||
|
${TMP_DIR}/KeyboardShortcutList.o \
|
||||||
${TMP_DIR}/OptionsWindow.o
|
${TMP_DIR}/OptionsWindow.o
|
||||||
|
|
||||||
G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \
|
G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
cuePlayer,
|
cuePlayer,
|
||||||
stationLogo,
|
stationLogo,
|
||||||
metadataTypeContainer,
|
metadataTypeContainer,
|
||||||
keyboardShortcutContainer*) >
|
keyboardShortcutList) >
|
||||||
|
|
||||||
<!ELEMENT resourceBundle EMPTY >
|
<!ELEMENT resourceBundle EMPTY >
|
||||||
<!ATTLIST resourceBundle path CDATA #REQUIRED >
|
<!ATTLIST resourceBundle path CDATA #REQUIRED >
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
|
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
||||||
<!ELEMENT windowName (#PCDATA) >
|
<!ELEMENT windowName (#PCDATA) >
|
||||||
<!ELEMENT keyboardShortcut (action, key+) >
|
<!ELEMENT keyboardShortcut (action, key+) >
|
||||||
|
@ -340,6 +341,7 @@
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
<keyboardShortcutList>
|
||||||
<keyboardShortcutContainer>
|
<keyboardShortcutContainer>
|
||||||
<windowName>masterPanelWindow</windowName>
|
<windowName>masterPanelWindow</windowName>
|
||||||
<keyboardShortcut>
|
<keyboardShortcut>
|
||||||
|
@ -413,6 +415,7 @@
|
||||||
<key>Delete</key>
|
<key>Delete</key>
|
||||||
</keyboardShortcut>
|
</keyboardShortcut>
|
||||||
</keyboardShortcutContainer>
|
</keyboardShortcutContainer>
|
||||||
|
</keyboardShortcutList>
|
||||||
|
|
||||||
</gLiveSupport>
|
</gLiveSupport>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
cuePlayer,
|
cuePlayer,
|
||||||
stationLogo,
|
stationLogo,
|
||||||
metadataTypeContainer,
|
metadataTypeContainer,
|
||||||
keyboardShortcutContainer*) >
|
keyboardShortcutList) >
|
||||||
|
|
||||||
<!ELEMENT resourceBundle EMPTY >
|
<!ELEMENT resourceBundle EMPTY >
|
||||||
<!ATTLIST resourceBundle path CDATA #REQUIRED >
|
<!ATTLIST resourceBundle path CDATA #REQUIRED >
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
|
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
||||||
<!ELEMENT windowName (#PCDATA) >
|
<!ELEMENT windowName (#PCDATA) >
|
||||||
<!ELEMENT keyboardShortcut (action, key+) >
|
<!ELEMENT keyboardShortcut (action, key+) >
|
||||||
|
@ -340,6 +341,7 @@
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
<keyboardShortcutList>
|
||||||
<keyboardShortcutContainer>
|
<keyboardShortcutContainer>
|
||||||
<windowName>masterPanelWindow</windowName>
|
<windowName>masterPanelWindow</windowName>
|
||||||
<keyboardShortcut>
|
<keyboardShortcut>
|
||||||
|
@ -413,6 +415,7 @@
|
||||||
<key>Delete</key>
|
<key>Delete</key>
|
||||||
</keyboardShortcut>
|
</keyboardShortcut>
|
||||||
</keyboardShortcutContainer>
|
</keyboardShortcutContainer>
|
||||||
|
</keyboardShortcutList>
|
||||||
|
|
||||||
</gLiveSupport>
|
</gLiveSupport>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
cuePlayer,
|
cuePlayer,
|
||||||
stationLogo,
|
stationLogo,
|
||||||
metadataTypeContainer,
|
metadataTypeContainer,
|
||||||
keyboardShortcutContainer*) >
|
keyboardShortcutList) >
|
||||||
|
|
||||||
<!ELEMENT resourceBundle EMPTY >
|
<!ELEMENT resourceBundle EMPTY >
|
||||||
<!ATTLIST resourceBundle path CDATA #REQUIRED >
|
<!ATTLIST resourceBundle path CDATA #REQUIRED >
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
|
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (windowName, keyboardShortcut+) >
|
||||||
<!ELEMENT windowName (#PCDATA) >
|
<!ELEMENT windowName (#PCDATA) >
|
||||||
<!ELEMENT keyboardShortcut (action, key+) >
|
<!ELEMENT keyboardShortcut (action, key+) >
|
||||||
|
@ -340,6 +341,7 @@
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
<keyboardShortcutList>
|
||||||
<keyboardShortcutContainer>
|
<keyboardShortcutContainer>
|
||||||
<windowName>masterPanelWindow</windowName>
|
<windowName>masterPanelWindow</windowName>
|
||||||
<keyboardShortcut>
|
<keyboardShortcut>
|
||||||
|
@ -413,6 +415,7 @@
|
||||||
<key>Delete</key>
|
<key>Delete</key>
|
||||||
</keyboardShortcut>
|
</keyboardShortcut>
|
||||||
</keyboardShortcutContainer>
|
</keyboardShortcutContainer>
|
||||||
|
</keyboardShortcutList>
|
||||||
|
|
||||||
</gLiveSupport>
|
</gLiveSupport>
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
if (nodes.size() < 1) {
|
if (nodes.size() < 1) {
|
||||||
throw std::invalid_argument("no supportedLanguages element");
|
throw std::invalid_argument("no supportedLanguages element");
|
||||||
}
|
}
|
||||||
configSupportedLanguages(*((const xmlpp::Element*) *(nodes.begin())) );
|
configSupportedLanguages(*((const xmlpp::Element*) nodes.front()));
|
||||||
|
|
||||||
// configure the resource bundle
|
// configure the resource bundle
|
||||||
nodes = element.get_children(LocalizedObject::getConfigElementName());
|
nodes = element.get_children(LocalizedObject::getConfigElementName());
|
||||||
|
@ -204,7 +204,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("no resourceBundle element");
|
throw std::invalid_argument("no resourceBundle element");
|
||||||
}
|
}
|
||||||
LocalizedConfigurable::configure(
|
LocalizedConfigurable::configure(
|
||||||
*((const xmlpp::Element*) *(nodes.begin())));
|
*((const xmlpp::Element*) nodes.front()));
|
||||||
|
|
||||||
// configure the AuthenticationClientFactory
|
// configure the AuthenticationClientFactory
|
||||||
nodes = element.get_children(
|
nodes = element.get_children(
|
||||||
|
@ -214,7 +214,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
}
|
}
|
||||||
Ptr<AuthenticationClientFactory>::Ref acf
|
Ptr<AuthenticationClientFactory>::Ref acf
|
||||||
= AuthenticationClientFactory::getInstance();
|
= AuthenticationClientFactory::getInstance();
|
||||||
acf->configure( *((const xmlpp::Element*) *(nodes.begin())) );
|
acf->configure( *((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
authentication = acf->getAuthenticationClient();
|
authentication = acf->getAuthenticationClient();
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("no storageClientFactory element");
|
throw std::invalid_argument("no storageClientFactory element");
|
||||||
}
|
}
|
||||||
Ptr<StorageClientFactory>::Ref stcf = StorageClientFactory::getInstance();
|
Ptr<StorageClientFactory>::Ref stcf = StorageClientFactory::getInstance();
|
||||||
stcf->configure( *((const xmlpp::Element*) *(nodes.begin())) );
|
stcf->configure( *((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
storage = stcf->getStorageClient();
|
storage = stcf->getStorageClient();
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("no widgetFactory element");
|
throw std::invalid_argument("no widgetFactory element");
|
||||||
}
|
}
|
||||||
widgetFactory = WidgetFactory::getInstance();
|
widgetFactory = WidgetFactory::getInstance();
|
||||||
widgetFactory->configure( *((const xmlpp::Element*) *(nodes.begin())) );
|
widgetFactory->configure( *((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
// configure the SchedulerClientFactory
|
// configure the SchedulerClientFactory
|
||||||
nodes = element.get_children(
|
nodes = element.get_children(
|
||||||
|
@ -244,7 +244,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
}
|
}
|
||||||
Ptr<SchedulerClientFactory>::Ref schcf
|
Ptr<SchedulerClientFactory>::Ref schcf
|
||||||
= SchedulerClientFactory::getInstance();
|
= SchedulerClientFactory::getInstance();
|
||||||
schcf->configure( *((const xmlpp::Element*) *(nodes.begin())) );
|
schcf->configure( *((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
scheduler = schcf->getSchedulerClient();
|
scheduler = schcf->getSchedulerClient();
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("no audioPlayer element");
|
throw std::invalid_argument("no audioPlayer element");
|
||||||
}
|
}
|
||||||
apf = AudioPlayerFactory::getInstance();
|
apf = AudioPlayerFactory::getInstance();
|
||||||
apf->configure( *((const xmlpp::Element*) *(nodes.begin())) );
|
apf->configure( *((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
outputPlayer = apf->getAudioPlayer();
|
outputPlayer = apf->getAudioPlayer();
|
||||||
outputPlayer->initialize();
|
outputPlayer->initialize();
|
||||||
|
@ -278,7 +278,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("no audioPlayer element");
|
throw std::invalid_argument("no audioPlayer element");
|
||||||
}
|
}
|
||||||
apf = AudioPlayerFactory::getInstance();
|
apf = AudioPlayerFactory::getInstance();
|
||||||
apf->configure( *((const xmlpp::Element*) *(nodes.begin())) );
|
apf->configure( *((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
cuePlayer = apf->getAudioPlayer();
|
cuePlayer = apf->getAudioPlayer();
|
||||||
cuePlayer->initialize();
|
cuePlayer->initialize();
|
||||||
|
@ -304,26 +304,20 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
if (nodes.size() < 1) {
|
if (nodes.size() < 1) {
|
||||||
throw std::invalid_argument("no metadataTypeContainer element");
|
throw std::invalid_argument("no metadataTypeContainer element");
|
||||||
}
|
}
|
||||||
Ptr<ResourceBundle>::Ref metadataBundle;
|
Ptr<ResourceBundle>::Ref metadataBundle = getBundle("metadataTypes");
|
||||||
try {
|
|
||||||
metadataBundle = getBundle("metadataTypes");
|
|
||||||
} catch (std::invalid_argument &e) {
|
|
||||||
throw std::invalid_argument(e.what());
|
|
||||||
}
|
|
||||||
metadataTypeContainer.reset(new MetadataTypeContainer(metadataBundle));
|
metadataTypeContainer.reset(new MetadataTypeContainer(metadataBundle));
|
||||||
metadataTypeContainer->configure(
|
metadataTypeContainer->configure(
|
||||||
*((const xmlpp::Element*) *(nodes.begin())) );
|
*((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
// configure the KeyboardShortcutContainer classes
|
// configure the KeyboardShortcutList
|
||||||
nodes = element.get_children(
|
nodes = element.get_children(
|
||||||
KeyboardShortcutContainer::getConfigElementName());
|
KeyboardShortcutList::getConfigElementName());
|
||||||
xmlpp::Node::NodeList::const_iterator it = nodes.begin();
|
if (nodes.size() < 1) {
|
||||||
while (it != nodes.end()) {
|
throw std::invalid_argument("no keyboardShortcutList element");
|
||||||
Ptr<KeyboardShortcutContainer>::Ref ksc(new KeyboardShortcutContainer);
|
|
||||||
ksc->configure(*((const xmlpp::Element*) *it));
|
|
||||||
keyboardShortcutList[*ksc->getWindowName()] = ksc;
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
|
keyboardShortcutList.reset(new KeyboardShortcutList);
|
||||||
|
keyboardShortcutList->configure(
|
||||||
|
*((const xmlpp::Element*) nodes.front()) );
|
||||||
|
|
||||||
// save the configuration so we can modify it later
|
// save the configuration so we can modify it later
|
||||||
// TODO: move configuration code to the OptionsContainer class?
|
// TODO: move configuration code to the OptionsContainer class?
|
||||||
|
@ -1333,22 +1327,28 @@ GLiveSupport :: getStationLogoImage(void) throw()
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Find the action triggered by the given key in the given window.
|
* Get the localized name of the keyboard shortcut action.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
KeyboardShortcut::Action
|
Ptr<const Glib::ustring>::Ref
|
||||||
LiveSupport :: GLiveSupport ::
|
LiveSupport :: GLiveSupport ::
|
||||||
GLiveSupport :: findAction(const Glib::ustring & windowName,
|
GLiveSupport :: getLocalizedKeyboardActionName(
|
||||||
unsigned int modifiers,
|
Ptr<const Glib::ustring>::Ref actionName)
|
||||||
unsigned int key) const throw ()
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
KeyboardShortcutListType::const_iterator it = keyboardShortcutList.find(
|
return getResourceUstring("keyboardShortcuts", actionName->c_str());
|
||||||
windowName);
|
|
||||||
if (it != keyboardShortcutList.end()) {
|
|
||||||
Ptr<KeyboardShortcutContainer>::Ref ksc = it->second;
|
|
||||||
return ksc->findAction(modifiers, key);
|
|
||||||
} else {
|
|
||||||
return KeyboardShortcut::noAction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Get the localized name of the window.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
LiveSupport :: GLiveSupport ::
|
||||||
|
GLiveSupport :: getLocalizedWindowName(
|
||||||
|
Ptr<const Glib::ustring>::Ref windowName)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
return getResourceUstring(windowName->c_str(), "windowTitle");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
#include "LiveSupport/SchedulerClient/SchedulerClientInterface.h"
|
#include "LiveSupport/SchedulerClient/SchedulerClientInterface.h"
|
||||||
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
|
#include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h"
|
||||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||||
#include "KeyboardShortcutContainer.h"
|
#include "KeyboardShortcutList.h"
|
||||||
|
|
||||||
|
|
||||||
namespace LiveSupport {
|
namespace LiveSupport {
|
||||||
|
@ -287,17 +287,10 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
void
|
void
|
||||||
uncachePlaylist(Ptr<const UniqueId>::Ref id) throw ();
|
uncachePlaylist(Ptr<const UniqueId>::Ref id) throw ();
|
||||||
|
|
||||||
/**
|
|
||||||
* The type for storing the keyboard shortcuts.
|
|
||||||
*/
|
|
||||||
typedef std::map<const Glib::ustring,
|
|
||||||
Ptr<KeyboardShortcutContainer>::Ref>
|
|
||||||
KeyboardShortcutListType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of keyboard shortcuts for the various windows.
|
* The list of keyboard shortcuts for the various windows.
|
||||||
*/
|
*/
|
||||||
KeyboardShortcutListType keyboardShortcutList;
|
Ptr<KeyboardShortcutList>::Ref keyboardShortcutList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type for a single window position.
|
* The type for a single window position.
|
||||||
|
@ -986,7 +979,50 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
KeyboardShortcut::Action
|
KeyboardShortcut::Action
|
||||||
findAction(const Glib::ustring & windowName,
|
findAction(const Glib::ustring & windowName,
|
||||||
unsigned int modifiers,
|
unsigned int modifiers,
|
||||||
unsigned int key) const throw ();
|
unsigned int key) const throw ()
|
||||||
|
{
|
||||||
|
return keyboardShortcutList->findAction(windowName, modifiers, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of all KeyboardShortcutContainer objects.
|
||||||
|
* Used in the Key bindings section of the OptionsWindow class.
|
||||||
|
*
|
||||||
|
* @return a const pointer to the list (implemented as a std::map).
|
||||||
|
*/
|
||||||
|
Ptr<const KeyboardShortcutList>::Ref
|
||||||
|
getKeyboardShortcutList(void) throw ()
|
||||||
|
{
|
||||||
|
return keyboardShortcutList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the localized name of the window.
|
||||||
|
* Used in the Key bindings section of the OptionsWindow class.
|
||||||
|
*
|
||||||
|
* @param windowName the name of the window.
|
||||||
|
* @return the localized name.
|
||||||
|
* @exception std::invalid_argument if the resource bundle is
|
||||||
|
* not found
|
||||||
|
*/
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
getLocalizedWindowName(Ptr<const Glib::ustring>::Ref windowName)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the localized name of the keyboard shortcut action.
|
||||||
|
* Used in the Key bindings section of the OptionsWindow class.
|
||||||
|
*
|
||||||
|
* @param actionName the name of the action.
|
||||||
|
* @return the localized name.
|
||||||
|
* @exception std::invalid_argument if the resource bundle is
|
||||||
|
* not found
|
||||||
|
* @see KeyboardShortcut::getActionString()
|
||||||
|
*/
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
getLocalizedKeyboardActionName(
|
||||||
|
Ptr<const Glib::ustring>::Ref actionName)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the position and size of the window.
|
* Save the position and size of the window.
|
||||||
|
|
|
@ -83,11 +83,11 @@ static const unsigned int modifiersChecked = GDK_SHIFT_MASK
|
||||||
* Add a shortcut key for this object.
|
* Add a shortcut key for this object.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
KeyboardShortcut :: addKey(const Glib::ustring & modifiedKeyName)
|
KeyboardShortcut :: addKey(Ptr<const Glib::ustring>::Ref modifiedKeyName)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
Ptr<Glib::ustring>::Ref inputString(new Glib::ustring(
|
Ptr<Glib::ustring>::Ref inputString(new Glib::ustring(
|
||||||
modifiedKeyName ));
|
*modifiedKeyName ));
|
||||||
|
|
||||||
Ptr<Glib::ustring>::Ref keyName = getToken(inputString);
|
Ptr<Glib::ustring>::Ref keyName = getToken(inputString);
|
||||||
if (!keyName) {
|
if (!keyName) {
|
||||||
|
@ -142,13 +142,13 @@ KeyboardShortcut :: configure(const xmlpp::Element & element)
|
||||||
}
|
}
|
||||||
const xmlpp::Element* actionElement = dynamic_cast<const xmlpp::Element*>(
|
const xmlpp::Element* actionElement = dynamic_cast<const xmlpp::Element*>(
|
||||||
children.front());
|
children.front());
|
||||||
const Glib::ustring actionString = actionElement->get_child_text()
|
actionString.reset(new Glib::ustring(actionElement->get_child_text()
|
||||||
->get_content();
|
->get_content() ));
|
||||||
try {
|
try {
|
||||||
action = stringToAction(actionString);
|
action = stringToAction(actionString);
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
std::string eMsg = "Invalid action specification ";
|
std::string eMsg = "Invalid action specification ";
|
||||||
eMsg += actionString;
|
eMsg += *actionString;
|
||||||
eMsg += ".";
|
eMsg += ".";
|
||||||
throw std::invalid_argument(eMsg);
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
|
@ -159,19 +159,25 @@ KeyboardShortcut :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument("missing "
|
throw std::invalid_argument("missing "
|
||||||
+ keyElementName + " element");
|
+ keyElementName + " element");
|
||||||
}
|
}
|
||||||
|
bool firstRun = true;
|
||||||
xmlpp::Node::NodeList::const_iterator it;
|
xmlpp::Node::NodeList::const_iterator it;
|
||||||
for (it = children.begin(); it != children.end(); ++it) {
|
for (it = children.begin(); it != children.end(); ++it) {
|
||||||
const xmlpp::Element* keyElement =
|
const xmlpp::Element* keyElement =
|
||||||
dynamic_cast<const xmlpp::Element*>(*it);
|
dynamic_cast<const xmlpp::Element*>(*it);
|
||||||
const Glib::ustring keyString = keyElement->get_child_text()
|
Ptr<Glib::ustring>::Ref keyString(new Glib::ustring(
|
||||||
->get_content();
|
keyElement->get_child_text()
|
||||||
|
->get_content() ));
|
||||||
|
if (firstRun) {
|
||||||
|
firstKeyString = keyString;
|
||||||
|
firstRun = false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
addKey(keyString);
|
addKey(keyString);
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
std::string eMsg = "Invalid key specification ";
|
std::string eMsg = "Invalid key specification ";
|
||||||
eMsg += keyString;
|
eMsg += *keyString;
|
||||||
eMsg += " for action ";
|
eMsg += " for action ";
|
||||||
eMsg += actionString;
|
eMsg += *actionString;
|
||||||
eMsg += ".";
|
eMsg += ".";
|
||||||
throw std::invalid_argument(eMsg);
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
|
@ -208,24 +214,24 @@ KeyboardShortcut :: isTriggeredBy(unsigned int modifiers,
|
||||||
* Convert an action name string to an enumeration value.
|
* Convert an action name string to an enumeration value.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
KeyboardShortcut::Action
|
KeyboardShortcut::Action
|
||||||
KeyboardShortcut :: stringToAction(const Glib::ustring & actionName)
|
KeyboardShortcut :: stringToAction(Ptr<const Glib::ustring>::Ref actionName)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
if (actionName == "playAudio") {
|
if (*actionName == "playAudio") {
|
||||||
return playAudio;
|
return playAudio;
|
||||||
} else if (actionName == "pauseAudio") {
|
} else if (*actionName == "pauseAudio") {
|
||||||
return pauseAudio;
|
return pauseAudio;
|
||||||
} else if (actionName == "stopAudio") {
|
} else if (*actionName == "stopAudio") {
|
||||||
return stopAudio;
|
return stopAudio;
|
||||||
} else if (actionName == "nextTrack") {
|
} else if (*actionName == "nextTrack") {
|
||||||
return nextTrack;
|
return nextTrack;
|
||||||
} else if (actionName == "fadeOut") {
|
} else if (*actionName == "fadeOut") {
|
||||||
return fadeOut;
|
return fadeOut;
|
||||||
} else if (actionName == "moveItemUp") {
|
} else if (*actionName == "moveItemUp") {
|
||||||
return moveItemUp;
|
return moveItemUp;
|
||||||
} else if (actionName == "moveItemDown") {
|
} else if (*actionName == "moveItemDown") {
|
||||||
return moveItemDown;
|
return moveItemDown;
|
||||||
} else if (actionName == "removeItem") {
|
} else if (*actionName == "removeItem") {
|
||||||
return removeItem;
|
return removeItem;
|
||||||
} else {
|
} else {
|
||||||
throw std::invalid_argument("");
|
throw std::invalid_argument("");
|
||||||
|
|
|
@ -63,9 +63,6 @@ using namespace LiveSupport::Core;
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== data types */
|
||||||
|
|
||||||
// class KeyboardShortcutContainer; // TODO: remove or activate
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class for representing a keyboard shortcut.
|
* A class for representing a keyboard shortcut.
|
||||||
*
|
*
|
||||||
|
@ -139,6 +136,11 @@ class KeyboardShortcut : public Configurable
|
||||||
*/
|
*/
|
||||||
Action action;
|
Action action;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A string representation of the action.
|
||||||
|
*/
|
||||||
|
Ptr<Glib::ustring>::Ref actionString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type for storing key and modifier values.
|
* The type for storing key and modifier values.
|
||||||
*/
|
*/
|
||||||
|
@ -163,6 +165,11 @@ class KeyboardShortcut : public Configurable
|
||||||
*/
|
*/
|
||||||
KeyListType keyList;
|
KeyListType keyList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A string representation of the first item in the key list.
|
||||||
|
*/
|
||||||
|
Ptr<Glib::ustring>::Ref firstKeyString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an action name string to an enumeration value.
|
* Convert an action name string to an enumeration value.
|
||||||
* If no matching enumeration value is found, noAction is returned.
|
* If no matching enumeration value is found, noAction is returned.
|
||||||
|
@ -170,7 +177,7 @@ class KeyboardShortcut : public Configurable
|
||||||
* @param actionName a string containing the name of the action.
|
* @param actionName a string containing the name of the action.
|
||||||
*/
|
*/
|
||||||
Action
|
Action
|
||||||
stringToAction(const Glib::ustring & actionName)
|
stringToAction(Ptr<const Glib::ustring>::Ref actionName)
|
||||||
throw(std::invalid_argument);
|
throw(std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -238,7 +245,7 @@ class KeyboardShortcut : public Configurable
|
||||||
* key description.
|
* key description.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
addKey(const Glib::ustring & modifiedKeyName)
|
addKey(Ptr<const Glib::ustring>::Ref modifiedKeyName)
|
||||||
throw (std::invalid_argument);
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +313,29 @@ class KeyboardShortcut : public Configurable
|
||||||
bool
|
bool
|
||||||
isTriggeredBy(unsigned int modifiers,
|
isTriggeredBy(unsigned int modifiers,
|
||||||
unsigned int key) const throw ();
|
unsigned int key) const throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a string corresponding to the action of this shortcut.
|
||||||
|
*
|
||||||
|
* @return a string representing the action of this shortcut.
|
||||||
|
*/
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
getActionString(void) const throw ()
|
||||||
|
{
|
||||||
|
return actionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the first key associated with this shortcut.
|
||||||
|
*
|
||||||
|
* @return a string representing the first modifier-key pair of
|
||||||
|
* this shortcut.
|
||||||
|
*/
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
getKeyString(void) const throw ()
|
||||||
|
{
|
||||||
|
return firstKeyString;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ KeyboardShortcutContainer :: configure(const xmlpp::Element & element)
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
KeyboardShortcut::Action
|
KeyboardShortcut::Action
|
||||||
KeyboardShortcutContainer :: findAction(unsigned int modifiers,
|
KeyboardShortcutContainer :: findAction(unsigned int modifiers,
|
||||||
unsigned int key) throw ()
|
unsigned int key) const throw ()
|
||||||
{
|
{
|
||||||
ShortcutListType::const_iterator it = shortcutList.begin();
|
ShortcutListType::const_iterator it = shortcutList.begin();
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class KeyboardShortcutContainer : public Configurable
|
||||||
/**
|
/**
|
||||||
* A vector type holding contant KeyboardShortcut references.
|
* A vector type holding contant KeyboardShortcut references.
|
||||||
*/
|
*/
|
||||||
typedef std::vector<Ptr<const KeyboardShortcut>::Ref>
|
typedef std::vector<Ptr<KeyboardShortcut>::Ref>
|
||||||
ShortcutListType;
|
ShortcutListType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,7 +168,7 @@ class KeyboardShortcutContainer : public Configurable
|
||||||
* @return the action; or noAction if none is found.
|
* @return the action; or noAction if none is found.
|
||||||
*/
|
*/
|
||||||
KeyboardShortcut::Action
|
KeyboardShortcut::Action
|
||||||
findAction(unsigned int modifiers, unsigned int key) throw ();
|
findAction(unsigned int modifiers, unsigned int key) const throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the window the shortcuts are for.
|
* Return the name of the window the shortcuts are for.
|
||||||
|
@ -177,10 +177,34 @@ class KeyboardShortcutContainer : public Configurable
|
||||||
* the object has not been configured yet.
|
* the object has not been configured yet.
|
||||||
*/
|
*/
|
||||||
Ptr<const Glib::ustring>::Ref
|
Ptr<const Glib::ustring>::Ref
|
||||||
getWindowName(void) throw ()
|
getWindowName(void) const throw ()
|
||||||
{
|
{
|
||||||
return windowName;
|
return windowName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The iterator for cycling through the keyboard shortcuts.
|
||||||
|
* Dereference an iterator to get a Ptr<KeyboardShortcut>::Ref.
|
||||||
|
*/
|
||||||
|
typedef ShortcutListType::const_iterator iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first item in the list.
|
||||||
|
*/
|
||||||
|
iterator
|
||||||
|
begin(void) const throw ()
|
||||||
|
{
|
||||||
|
return shortcutList.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One after the last item in the list.
|
||||||
|
*/
|
||||||
|
iterator
|
||||||
|
end(void) const throw ()
|
||||||
|
{
|
||||||
|
return shortcutList.end();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author$
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL$
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "KeyboardShortcutList.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the config element for this class
|
||||||
|
*/
|
||||||
|
const std::string KeyboardShortcutList::configElementName
|
||||||
|
= "keyboardShortcutList";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Create a metadata type container element object based on an XML element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
KeyboardShortcutList :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (element.get_name() != configElementName) {
|
||||||
|
throw std::invalid_argument("bad coniguration element "
|
||||||
|
+ element.get_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlpp::Node::NodeList nodes = element.get_children(
|
||||||
|
KeyboardShortcutContainer::getConfigElementName());
|
||||||
|
xmlpp::Node::NodeList::const_iterator it = nodes.begin();
|
||||||
|
while (it != nodes.end()) {
|
||||||
|
Ptr<KeyboardShortcutContainer>::Ref ksc(new KeyboardShortcutContainer);
|
||||||
|
ksc->configure(*((const xmlpp::Element*) *it));
|
||||||
|
containerList.push_back(ksc);
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Find the action triggered by the given key in the given window.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
KeyboardShortcut::Action
|
||||||
|
KeyboardShortcutList :: findAction(const Glib::ustring & windowName,
|
||||||
|
unsigned int modifiers,
|
||||||
|
unsigned int key) const
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
for (iterator it = begin(); it != end(); ++it) {
|
||||||
|
Ptr<const KeyboardShortcutContainer>::Ref ksc = *it;
|
||||||
|
if (*ksc->getWindowName() == windowName) {
|
||||||
|
return ksc->findAction(modifiers, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return KeyboardShortcut::noAction;
|
||||||
|
}
|
||||||
|
|
194
livesupport/src/products/gLiveSupport/src/KeyboardShortcutList.h
Normal file
194
livesupport/src/products/gLiveSupport/src/KeyboardShortcutList.h
Normal file
|
@ -0,0 +1,194 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author$
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL$
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_GLiveSupport_KeyboardShortcutList_h
|
||||||
|
#define LiveSupport_GLiveSupport_KeyboardShortcutList_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <iostream> // TODO: REMOVE ME
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
|
|
||||||
|
#include "KeyboardShortcutContainer.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace GLiveSupport {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of KeyboardShortcutContainer objects.
|
||||||
|
*
|
||||||
|
* This object has to be configured with an XML configuration element
|
||||||
|
* called keyboardShortcutList.
|
||||||
|
*
|
||||||
|
* The DTD for the expected XML element is the following:
|
||||||
|
* <pre><code>
|
||||||
|
* <!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* For a description of the keyboardShortcutContainer XML element,
|
||||||
|
* see the documentation of the KeyboardShortcutContainer class.
|
||||||
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
* @see KeyboardShortcut
|
||||||
|
*/
|
||||||
|
class KeyboardShortcutList : public Configurable
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of the configuration XML element used by
|
||||||
|
* KeyboardShortcutList.
|
||||||
|
*/
|
||||||
|
static const std::string configElementName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type for storing the keyboard shortcut containers.
|
||||||
|
*/
|
||||||
|
typedef std::vector<Ptr<KeyboardShortcutContainer>::Ref>
|
||||||
|
ContainerListType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of keyboard shortcut containers for the various windows.
|
||||||
|
*/
|
||||||
|
ContainerListType containerList;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
KeyboardShortcutList() throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~KeyboardShortcutList(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return configElementName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the metadata object based on an XML configuration element.
|
||||||
|
*
|
||||||
|
* @param elemen the XML configuration element.
|
||||||
|
* @exception std::invalid_argument of the supplied XML element
|
||||||
|
* contains bad configuration information
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element &element)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the action triggered by the given key in the given window.
|
||||||
|
*
|
||||||
|
* @param windowName a string identifying the window (not localized).
|
||||||
|
* @param modifiers the gdktypes code for the Shift, Ctrl etc.
|
||||||
|
* modifier keys which are pressed.
|
||||||
|
* @param key the gdkkeysyms code for the key pressed.
|
||||||
|
* @return the associated action; or noAction, if none is found.
|
||||||
|
*/
|
||||||
|
KeyboardShortcut::Action
|
||||||
|
findAction(const Glib::ustring & windowName,
|
||||||
|
unsigned int modifiers,
|
||||||
|
unsigned int key) const throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The iterator for cycling through the keyboard shortcut containers.
|
||||||
|
* Dereference an iterator to get a
|
||||||
|
* Ptr<KeyboardShortcutContainer>::Ref.
|
||||||
|
*/
|
||||||
|
typedef ContainerListType::const_iterator iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first item in the list.
|
||||||
|
*/
|
||||||
|
iterator
|
||||||
|
begin(void) const throw ()
|
||||||
|
{
|
||||||
|
return containerList.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One after the last item in the list.
|
||||||
|
*/
|
||||||
|
iterator
|
||||||
|
end(void) const throw ()
|
||||||
|
{
|
||||||
|
return containerList.end();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace GLiveSupport
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_GLiveSupport_KeyboardShortcutList_h
|
||||||
|
|
|
@ -247,7 +247,7 @@ MasterPanelWindow :: changeLanguage(Ptr<ResourceBundle>::Ref bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
set_title(*getResourceUstring("windowTitle"));
|
set_title(*getResourceUstring(windowName.c_str(), "windowTitle"));
|
||||||
|
|
||||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
|
|
||||||
|
|
|
@ -90,12 +90,15 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
// build up the notepad for the various sections
|
// build up the notepad for the various sections
|
||||||
mainNotebook = Gtk::manage(new ScrolledNotebook);
|
mainNotebook = Gtk::manage(new ScrolledNotebook);
|
||||||
Gtk::Box * soundSectionBox = constructSoundSection();
|
Gtk::Box * soundSectionBox = constructSoundSection();
|
||||||
|
Gtk::Box * keyBindingsSectionBox = constructKeyBindingsSection();
|
||||||
Gtk::Box * serversSectionBox = constructServersSection();
|
Gtk::Box * serversSectionBox = constructServersSection();
|
||||||
Gtk::Box * aboutSectionBox = constructAboutSection();
|
Gtk::Box * aboutSectionBox = constructAboutSection();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mainNotebook->appendPage(*soundSectionBox,
|
mainNotebook->appendPage(*soundSectionBox,
|
||||||
*getResourceUstring("soundSectionLabel"));
|
*getResourceUstring("soundSectionLabel"));
|
||||||
|
mainNotebook->appendPage(*keyBindingsSectionBox,
|
||||||
|
*getResourceUstring("keyBindingsSectionLabel"));
|
||||||
mainNotebook->appendPage(*serversSectionBox,
|
mainNotebook->appendPage(*serversSectionBox,
|
||||||
*getResourceUstring("serversSectionLabel"));
|
*getResourceUstring("serversSectionLabel"));
|
||||||
mainNotebook->appendPage(*aboutSectionBox,
|
mainNotebook->appendPage(*aboutSectionBox,
|
||||||
|
@ -384,6 +387,74 @@ OptionsWindow :: constructSoundSection(void) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Construct the "Key bindings" section.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Gtk::VBox*
|
||||||
|
OptionsWindow :: constructKeyBindingsSection(void) throw ()
|
||||||
|
{
|
||||||
|
// create the TreeView
|
||||||
|
keyBindingsModel = Gtk::TreeStore::create(keyBindingsColumns);
|
||||||
|
Gtk::TreeView * keyBindingsView = Gtk::manage(new Gtk::TreeView(
|
||||||
|
keyBindingsModel ));
|
||||||
|
|
||||||
|
keyBindingsView->append_column("", keyBindingsColumns.actionColumn);
|
||||||
|
keyBindingsView->append_column("", keyBindingsColumns.keyNameColumn);
|
||||||
|
|
||||||
|
// fill in the data
|
||||||
|
Ptr<const KeyboardShortcutList>::Ref
|
||||||
|
list = gLiveSupport->getKeyboardShortcutList();
|
||||||
|
|
||||||
|
try {
|
||||||
|
KeyboardShortcutList::iterator it;
|
||||||
|
for (it = list->begin(); it != list->end(); ++it) {
|
||||||
|
Ptr<const KeyboardShortcutContainer>::Ref
|
||||||
|
container = *it;
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
windowName = container->getWindowName();
|
||||||
|
Gtk::TreeRow parent = *keyBindingsModel->append();
|
||||||
|
parent[keyBindingsColumns.actionColumn]
|
||||||
|
= *gLiveSupport->getLocalizedWindowName(windowName);
|
||||||
|
|
||||||
|
KeyboardShortcutContainer::iterator iter;
|
||||||
|
for (iter = container->begin(); iter != container->end(); ++iter) {
|
||||||
|
Ptr<const KeyboardShortcut>::Ref
|
||||||
|
shortcut = *iter;
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
actionString = shortcut->getActionString();
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
keyString = shortcut->getKeyString();
|
||||||
|
Gtk::TreeRow child
|
||||||
|
= *keyBindingsModel->append(parent.children());
|
||||||
|
child[keyBindingsColumns.actionColumn]
|
||||||
|
= *gLiveSupport->getLocalizedKeyboardActionName(
|
||||||
|
actionString);
|
||||||
|
child[keyBindingsColumns.keyNameColumn]
|
||||||
|
= *keyString; // TODO: localize this?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
// TODO: signal error
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set TreeView properties
|
||||||
|
keyBindingsView->set_headers_visible(false);
|
||||||
|
keyBindingsView->set_rules_hint(true);
|
||||||
|
keyBindingsView->columns_autosize();
|
||||||
|
keyBindingsView->expand_all();
|
||||||
|
|
||||||
|
// connect the callbacks
|
||||||
|
|
||||||
|
// make a new box and pack the components into it
|
||||||
|
Gtk::VBox * section = Gtk::manage(new Gtk::VBox);
|
||||||
|
section->pack_start(*keyBindingsView, Gtk::PACK_SHRINK, 5);
|
||||||
|
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Construct the "Servers" section.
|
* Construct the "Servers" section.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -169,6 +169,14 @@ class OptionsWindow : public WhiteWindow, public LocalizedObject
|
||||||
Gtk::VBox*
|
Gtk::VBox*
|
||||||
constructSoundSection(void) throw ();
|
constructSoundSection(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the "Key bindings" section.
|
||||||
|
*
|
||||||
|
* @return a pointer to the new box (already Gtk::manage()'ed)
|
||||||
|
*/
|
||||||
|
Gtk::VBox*
|
||||||
|
constructKeyBindingsSection(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the "Servers" section.
|
* Construct the "Servers" section.
|
||||||
*
|
*
|
||||||
|
@ -226,6 +234,61 @@ class OptionsWindow : public WhiteWindow, public LocalizedObject
|
||||||
virtual void
|
virtual void
|
||||||
onTestButtonClicked(const EntryBin * entry) throw ();
|
onTestButtonClicked(const EntryBin * entry) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The columns model containing the data for the Key bindings section.
|
||||||
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
|
class ModelColumns : public Gtk::TreeModelColumnRecord
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The column for the name of the action.
|
||||||
|
* This contains the name of the window (for parent rows),
|
||||||
|
* or the name of the action (for child rows).
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> actionColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the user readable name of the key bound.
|
||||||
|
* (Or "Disabled" if no key is bound to this action.)
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> keyNameColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the gdkkeytypes.h code of the modifiers.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<unsigned int> modifiersColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the gdkkeysyms.h code of the key.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<unsigned int> keyValueColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
ModelColumns(void) throw ()
|
||||||
|
{
|
||||||
|
add(actionColumn);
|
||||||
|
add(keyNameColumn);
|
||||||
|
add(modifiersColumn);
|
||||||
|
add(keyValueColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column model.
|
||||||
|
*/
|
||||||
|
ModelColumns keyBindingsColumns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree model, as a GTK reference.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::TreeStore> keyBindingsModel;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
root:table
|
root:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Master Panel" }
|
|
||||||
notLoggedInMsg:string { "Not logged in" }
|
notLoggedInMsg:string { "Not logged in" }
|
||||||
loggedInMsg:string { "Logged in as {0}" }
|
loggedInMsg:string { "Logged in as {0}" }
|
||||||
loginButtonLabel:string { "log in" }
|
loginButtonLabel:string { "log in" }
|
||||||
|
@ -30,19 +29,24 @@ root:table
|
||||||
audioErrorMsg { "Audio player error: " }
|
audioErrorMsg { "Audio player error: " }
|
||||||
sureToExitMsg:string { "Are you sure you want to exit?" }
|
sureToExitMsg:string { "Are you sure you want to exit?" }
|
||||||
|
|
||||||
|
masterPanelWindow:table
|
||||||
|
{
|
||||||
|
windowTitle:string { "Master Panel" }
|
||||||
|
}
|
||||||
|
|
||||||
loginWindow:table
|
loginWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LOGIN" }
|
windowTitle:string { "Login" }
|
||||||
|
|
||||||
loginLabel:string { "Login" }
|
loginLabel:string { "User name:" }
|
||||||
passwordLabel:string { "Password" }
|
passwordLabel:string { "Password:" }
|
||||||
okButtonLabel:string { "OK" }
|
okButtonLabel:string { "OK" }
|
||||||
cancelButtonLabel:string { "Cancel" }
|
cancelButtonLabel:string { "Cancel" }
|
||||||
}
|
}
|
||||||
|
|
||||||
audioClipListWindow:table
|
audioClipListWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Audio Clip Window" }
|
windowTitle:string { "Audio Clip List" }
|
||||||
|
|
||||||
idColumnLabel:string { "id" }
|
idColumnLabel:string { "id" }
|
||||||
lengthColumnLabel:string { "length" }
|
lengthColumnLabel:string { "length" }
|
||||||
|
@ -54,7 +58,7 @@ root:table
|
||||||
|
|
||||||
scratchpadWindow:table
|
scratchpadWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Scratchpad" }
|
windowTitle:string { "Scratchpad" }
|
||||||
|
|
||||||
typeColumnLabel:string { "Type" }
|
typeColumnLabel:string { "Type" }
|
||||||
titleColumnLabel:string { "Title" }
|
titleColumnLabel:string { "Title" }
|
||||||
|
@ -81,7 +85,7 @@ root:table
|
||||||
|
|
||||||
playlistListWindow:table
|
playlistListWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Playlist Window" }
|
windowTitle:string { "Playlist" }
|
||||||
|
|
||||||
listBoxLabel { "Playlists" }
|
listBoxLabel { "Playlists" }
|
||||||
detailBoxLabel { "Playlist details" }
|
detailBoxLabel { "Playlist details" }
|
||||||
|
@ -124,8 +128,7 @@ root:table
|
||||||
|
|
||||||
simplePlaylistManagementWindow:table
|
simplePlaylistManagementWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Simple Playlist Management"
|
windowTitle:string { "Simple Playlist Management" }
|
||||||
" Window" }
|
|
||||||
|
|
||||||
startColumnLabel:string { "Start" }
|
startColumnLabel:string { "Start" }
|
||||||
titleColumnLabel:string { "Title" }
|
titleColumnLabel:string { "Title" }
|
||||||
|
@ -151,7 +154,7 @@ root:table
|
||||||
|
|
||||||
schedulerWindow:table
|
schedulerWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Scheduler Window" }
|
windowTitle:string { "Scheduler" }
|
||||||
|
|
||||||
startColumnLabel:string { "start" }
|
startColumnLabel:string { "start" }
|
||||||
titleColumnLabel:string { "title" }
|
titleColumnLabel:string { "title" }
|
||||||
|
@ -164,7 +167,7 @@ root:table
|
||||||
|
|
||||||
schedulePlaylistWindow:table
|
schedulePlaylistWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Schedule Playlist Window" }
|
windowTitle:string { "Schedule Playlist" }
|
||||||
|
|
||||||
hourLabel:string { "hour: " }
|
hourLabel:string { "hour: " }
|
||||||
minuteLabel:string { "minute: " }
|
minuteLabel:string { "minute: " }
|
||||||
|
@ -174,7 +177,7 @@ root:table
|
||||||
|
|
||||||
searchWindow:table
|
searchWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Search/Browse Window" }
|
windowTitle:string { "Search/Browse" }
|
||||||
|
|
||||||
simpleSearchTab:string { "Search" }
|
simpleSearchTab:string { "Search" }
|
||||||
advancedSearchTab:string { "Advanced Search" }
|
advancedSearchTab:string { "Advanced Search" }
|
||||||
|
@ -206,7 +209,7 @@ root:table
|
||||||
|
|
||||||
liveModeWindow:table
|
liveModeWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Live Mode Window" }
|
windowTitle:string { "Live Mode" }
|
||||||
|
|
||||||
cueMenuItem:string { "Pre_view" }
|
cueMenuItem:string { "Pre_view" }
|
||||||
upMenuItem:string { "Move _Up" }
|
upMenuItem:string { "Move _Up" }
|
||||||
|
@ -219,7 +222,7 @@ root:table
|
||||||
|
|
||||||
optionsWindow:table
|
optionsWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Options Window" }
|
windowTitle:string { "Options" }
|
||||||
|
|
||||||
needToRestartMsg:string { "You will need to restart the "
|
needToRestartMsg:string { "You will need to restart the "
|
||||||
"application\nfor the new settings "
|
"application\nfor the new settings "
|
||||||
|
@ -227,6 +230,8 @@ root:table
|
||||||
errorMsg:string { "Could not save the options: " }
|
errorMsg:string { "Could not save the options: " }
|
||||||
|
|
||||||
soundSectionLabel:string { "Sound" }
|
soundSectionLabel:string { "Sound" }
|
||||||
|
keyBindingsSectionLabel:string
|
||||||
|
{ "Keyboard Shortcuts" }
|
||||||
serversSectionLabel:string { "Servers" }
|
serversSectionLabel:string { "Servers" }
|
||||||
aboutSectionLabel:string { "About" }
|
aboutSectionLabel:string { "About" }
|
||||||
|
|
||||||
|
@ -290,5 +295,17 @@ root:table
|
||||||
report_organizations:string { "Report organizations" }
|
report_organizations:string { "Report organizations" }
|
||||||
subject { "Subject" }
|
subject { "Subject" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keyboardShortcuts:table
|
||||||
|
{
|
||||||
|
playAudio:string { Play }
|
||||||
|
pauseAudio:string { Pause }
|
||||||
|
stopAudio:string { Stop }
|
||||||
|
nextTrack:string { Next track }
|
||||||
|
fadeOut:string { Fade out }
|
||||||
|
moveItemUp:string { Move item up }
|
||||||
|
moveItemDown:string { Move item down }
|
||||||
|
removeItem:string { Remove item }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue