Skip to content

Commit

Permalink
add ACTION_NAV_BACK (back) action to replace the previous use of ACTI…
Browse files Browse the repository at this point in the history
…ON_PARENT_DIR combined with <rootovershoot> advancedsetting
  • Loading branch information
Jonathan Marshall committed Jul 6, 2011
1 parent 49cf5c0 commit 04135b4
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 42 deletions.
8 changes: 3 additions & 5 deletions xbmc/dialogs/GUIDialogFileBrowser.cpp
Expand Up @@ -81,12 +81,10 @@ CGUIDialogFileBrowser::~CGUIDialogFileBrowser()

bool CGUIDialogFileBrowser::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_PARENT_DIR ||
(action.GetID() == ACTION_NAV_BACK && !m_vecItems->IsVirtualDirectoryRoot()))
{
if (m_vecItems->IsVirtualDirectoryRoot() && g_advancedSettings.m_bUseEvilB)
Close();
else
GoParentFolder();
GoParentFolder();
return true;
}
if ((action.GetID() == ACTION_CONTEXT_MENU || action.GetID() == ACTION_MOUSE_RIGHT_CLICK) && m_Directory->m_strPath.IsEmpty())
Expand Down
2 changes: 1 addition & 1 deletion xbmc/dialogs/GUIDialogGamepad.cpp
Expand Up @@ -72,7 +72,7 @@ bool CGUIDialogGamepad::OnAction(const CAction &action)
SetLine(2, strHiddenInput);
return true;
}
else if (action.GetButtonCode() == KEY_BUTTON_BACK || action.GetID() == ACTION_CLOSE_DIALOG || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_PARENT_DIR)
else if (action.GetButtonCode() == KEY_BUTTON_BACK || action.GetID() == ACTION_CLOSE_DIALOG || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
{
m_bConfirmed = false;
m_bCanceled = true;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/GUIDialog.cpp
Expand Up @@ -74,7 +74,7 @@ bool CGUIDialog::OnAction(const CAction &action)
if (!action.IsMouse() && m_autoClosing)
SetAutoClose(m_showDuration);

if (action.GetID() == ACTION_CLOSE_DIALOG || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_CLOSE_DIALOG || action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
{
Close();
return true;
Expand Down
8 changes: 1 addition & 7 deletions xbmc/guilib/GUIStandardWindow.cpp
Expand Up @@ -34,13 +34,7 @@ CGUIStandardWindow::~CGUIStandardWindow(void)

bool CGUIStandardWindow::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PREVIOUS_MENU)
{
g_windowManager.PreviousWindow();
return true;
}

if (action.GetID() == ACTION_PARENT_DIR && g_advancedSettings.m_bUseEvilB)
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
{
g_windowManager.PreviousWindow();
return true;
Expand Down
22 changes: 17 additions & 5 deletions xbmc/guilib/GUIWindow.cpp
Expand Up @@ -322,12 +322,24 @@ bool CGUIWindow::OnAction(const CAction &action)

CGUIControl *focusedControl = GetFocusedControl();
if (focusedControl)
return focusedControl->OnAction(action);
{
if (focusedControl->OnAction(action))
return true;
}
else
{
// no control has focus?
// set focus to the default control then
CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), m_defaultControl);
OnMessage(msg);
}

// no control has focus?
// set focus to the default control then
CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), m_defaultControl);
OnMessage(msg);
// default implementations
if (action.GetID() == ACTION_NAV_BACK)
{
g_windowManager.PreviousWindow();
return true;
}
return false;
}

Expand Down
1 change: 1 addition & 0 deletions xbmc/guilib/Key.h
Expand Up @@ -183,6 +183,7 @@
#define ACTION_VOLUME_UP 88
#define ACTION_VOLUME_DOWN 89
#define ACTION_MUTE 91
#define ACTION_NAV_BACK 92

#define ACTION_MOUSE_START 100
#define ACTION_MOUSE_LEFT_CLICK 100
Expand Down
1 change: 1 addition & 0 deletions xbmc/input/ButtonTranslator.cpp
Expand Up @@ -55,6 +55,7 @@ static const ActionMapping actions[] =
{"select" , ACTION_SELECT_ITEM},
{"highlight" , ACTION_HIGHLIGHT_ITEM},
{"parentdir" , ACTION_PARENT_DIR},
{"back" , ACTION_NAV_BACK},
{"previousmenu" , ACTION_PREVIOUS_MENU},
{"info" , ACTION_SHOW_INFO},
{"pause" , ACTION_PAUSE},
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/json-rpc/InputOperations.cpp
Expand Up @@ -84,7 +84,7 @@ JSON_STATUS CInputOperations::Select(const CStdString &method, ITransportLayer *

JSON_STATUS CInputOperations::Back(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
return sendAction(ACTION_PARENT_DIR);
return sendAction(ACTION_NAV_BACK);
}

JSON_STATUS CInputOperations::Home(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
Expand Down
1 change: 0 additions & 1 deletion xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp
Expand Up @@ -155,7 +155,6 @@ bool CGUIDialogKaraokeSongSelector::OnAction(const CAction & action)

case ACTION_DELETE_ITEM:
case ACTION_BACKSPACE:
case ACTION_PARENT_DIR:
OnBackspace();
break;
}
Expand Down
7 changes: 3 additions & 4 deletions xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp
Expand Up @@ -61,10 +61,9 @@ CGUIWindowMusicPlaylistEditor::~CGUIWindowMusicPlaylistEditor(void)

bool CGUIWindowMusicPlaylistEditor::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PARENT_DIR && !m_viewControl.HasControl(GetFocusedControlID()))
{ // don't go to parent folder unless we're on the list in question
g_windowManager.PreviousWindow();
return true;
if (action.GetID() == ACTION_NAV_BACK && !m_viewControl.HasControl(GetFocusedControlID()))
{ // base class would normally go up a folder here, but we don't do this
return CGUIWindow::OnAction(action);
}
return CGUIWindowMusicBase::OnAction(action);
}
Expand Down
3 changes: 0 additions & 3 deletions xbmc/settings/AdvancedSettings.cpp
Expand Up @@ -206,8 +206,6 @@ void CAdvancedSettings::Initialize()
m_bVideoLibraryImportWatchedState = false;
m_bVideoScannerIgnoreErrors = false;

m_bUseEvilB = true;

m_iTuxBoxStreamtsPort = 31339;
m_bTuxBoxAudioChannelSelection = false;
m_bTuxBoxSubMenuSelection = false;
Expand Down Expand Up @@ -657,7 +655,6 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
XMLUtils::GetInt(pRootElement, "playlistretries", m_playlistRetries, -1, 5000);
XMLUtils::GetInt(pRootElement, "playlisttimeout", m_playlistTimeout, 0, 5000);

XMLUtils::GetBoolean(pRootElement,"rootovershoot",m_bUseEvilB);
XMLUtils::GetBoolean(pRootElement,"glrectanglehack", m_GLRectangleHack);
XMLUtils::GetInt(pRootElement,"skiploopfilter", m_iSkipLoopFilter, -16, 48);
XMLUtils::GetFloat(pRootElement, "forcedswaptime", m_ForcedSwapTime, 0.0, 100.0);
Expand Down
1 change: 0 additions & 1 deletion xbmc/settings/AdvancedSettings.h
Expand Up @@ -214,7 +214,6 @@ class CAdvancedSettings

bool m_bVideoScannerIgnoreErrors;

bool m_bUseEvilB;
std::vector<CStdString> m_vecTokens; // cleaning strings tied to language
//TuxBox
int m_iTuxBoxStreamtsPort;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/settings/GUIWindowSettings.cpp
Expand Up @@ -35,7 +35,7 @@ CGUIWindowSettings::~CGUIWindowSettings(void)

bool CGUIWindowSettings::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
{
g_windowManager.PreviousWindow();
return true;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/settings/GUIWindowSettingsCategory.cpp
Expand Up @@ -159,7 +159,7 @@ CGUIWindowSettingsCategory::~CGUIWindowSettingsCategory(void)

bool CGUIWindowSettingsCategory::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
{
g_settings.Save();
if (m_iWindowBeforeJump!=WINDOW_INVALID)
Expand Down
8 changes: 3 additions & 5 deletions xbmc/windows/GUIMediaWindow.cpp
Expand Up @@ -152,12 +152,10 @@ CFileItemPtr CGUIMediaWindow::GetCurrentListItem(int offset)

bool CGUIMediaWindow::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_PARENT_DIR ||
(action.GetID() == ACTION_NAV_BACK && !(m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->m_strPath == m_startDirectory)))
{
if ((m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->m_strPath == m_startDirectory) && g_advancedSettings.m_bUseEvilB)
g_windowManager.PreviousWindow();
else
GoParentFolder();
GoParentFolder();
return true;
}

Expand Down
8 changes: 3 additions & 5 deletions xbmc/windows/GUIWindowFileManager.cpp
Expand Up @@ -164,12 +164,10 @@ bool CGUIWindowFileManager::OnAction(const CAction &action)
}
return true;
}
if (action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_PARENT_DIR ||
(action.GetID() == ACTION_NAV_BACK && !m_vecItems[list]->IsVirtualDirectoryRoot()))
{
if (m_vecItems[list]->IsVirtualDirectoryRoot())
g_windowManager.PreviousWindow();
else
GoParentFolder(list);
GoParentFolder(list);
return true;
}
if (action.GetID() == ACTION_PLAYER_PLAY)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/windows/GUIWindowWeather.cpp
Expand Up @@ -82,7 +82,7 @@ CGUIWindowWeather::~CGUIWindowWeather(void)

bool CGUIWindowWeather::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_PARENT_DIR)
if (action.GetID() == ACTION_PREVIOUS_MENU || action.GetID() == ACTION_NAV_BACK)
{
g_windowManager.PreviousWindow();
return true;
Expand Down

0 comments on commit 04135b4

Please sign in to comment.