CHANGED: #1471 CDBGroupComboBox no longer depends on the isLoggedin global Ryzom game variable.

This commit is contained in:
dfighter1985 2012-06-29 00:30:27 +02:00
parent f5091dacd4
commit 88f45b1ae4
5 changed files with 53 additions and 33 deletions

View file

@ -1351,6 +1351,7 @@ void CFarTP::onDssDown(bool forceReturn)
}
extern bool loginFinished;
void setLoginFinished( bool f );
extern bool loginOK;
void CFarTP::joinSessionResult(uint32 /* userId */, TSessionId /* sessionId */, uint32 /* result */, const std::string &/* shardAddr */, const std::string &/* participantStatus */)
@ -1365,7 +1366,7 @@ void CFarTP::joinSessionResult(uint32 /* userId */, TSessionId /* sessionId */,
//
// FSAddr = shardAddr;
//
// loginFinished = true;
// setLoginFinished( true );
// loginOK = true;
//
// LoginSM.pushEvent(CLoginStateMachine::ev_connect);

View file

@ -15,24 +15,22 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "dbgroup_combo_box.h"
#include "nel/gui/group_menu.h"
#include "nel/misc/xml_auto_ptr.h"
#include "interface_manager.h"
#include "nel/gui/ctrl_button.h"
#include "nel/gui/action_handler.h"
#include "nel/gui/lua_ihm.h"
#include "nel/gui/lua_ihm.h"
#include "nel/gui/widget_manager.h"
using namespace std;
using namespace NLMISC;
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
extern bool loginFinished;
std::string CDBGroupComboBox::measureMenu;
std::string CDBGroupComboBox::selectMenu;
std::string CDBGroupComboBox::selectMenuOut;
// ***************************************************************************
CDBGroupComboBox::CDBGroupComboBox(const TCtorParam &param)
@ -56,9 +54,8 @@ CDBGroupComboBox::~CDBGroupComboBox()
// ***************************************************************************
sint32 CDBGroupComboBox::evalContentWidth() const
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// get the menu to open.
CGroupMenu *groupMenu= dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId( loginFinished ? WIN_COMBO_BOX_MEASURE_MENU : WIN_COMBO_BOX_MEASURE_MENU_LOGIN ));
CGroupMenu *groupMenu= dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId( CDBGroupComboBox::measureMenu ));
if( !groupMenu )
{
return 0;
@ -543,7 +540,6 @@ class CHandlerComboBoxSelectStart : public IActionHandler
public:
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CDBGroupComboBox *pCB = dynamic_cast<CDBGroupComboBox*>(pCaller->getParent());
if (pCB == NULL) return;
// if no choice, return.
@ -551,10 +547,10 @@ public:
return;
// get the menu to open.
CGroupMenu *groupMenu= dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId(loginFinished ? WIN_COMBO_BOX_SELECT_MENU: WIN_COMBO_BOX_SELECT_MENU_LOGIN ));
CGroupMenu *groupMenu= dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId( CDBGroupComboBox::selectMenu ));
if( !groupMenu )
{
groupMenu= dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId(WIN_COMBO_BOX_SELECT_MENU_OUTGAME));
groupMenu= dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId( CDBGroupComboBox::selectMenuOut ));
}
if( !groupMenu )
return;
@ -606,7 +602,6 @@ class CHandlerComboBoxSelectEnd : public IActionHandler
public:
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CDBGroupComboBox *pCB = dynamic_cast<CDBGroupComboBox*>(CWidgetManager::getInstance()->getCtrlLaunchingModal());
if (pCB == NULL) return;

View file

@ -30,17 +30,6 @@ namespace NLGUI
}
// ***************************************************************************
#define WIN_COMBO_BOX_SELECT_MENU "ui:interface:combo_box_select_menu"
#define WIN_COMBO_BOX_MEASURE_MENU "ui:interface:combo_box_measure_menu"
#define WIN_COMBO_BOX_SELECT_MENU_OUTGAME "ui:outgame:combo_box_select_menu"
#define WIN_COMBO_BOX_SELECT_MENU_LOGIN "ui:login:combo_box_select_menu"
#define WIN_COMBO_BOX_MEASURE_MENU_LOGIN "ui:login:combo_box_measure_menu"
// ***************************************************************************
/**
* Widget: ComboBox of text
@ -155,12 +144,16 @@ protected:
private:
void setup();
void dirt();
public:
// private : fill a menu with current content
void fillMenu(CGroupMenu *groupMenu) const;
static std::string measureMenu;
static std::string selectMenu;
static std::string selectMenuOut;
};

View file

@ -174,6 +174,7 @@ using namespace NLNET;
// ------------------------------------------------------------------------------------------------
extern bool loginFinished;
void setLoginFinished( bool f );
// Edit actions
CActionsManager EditActions;
@ -788,7 +789,7 @@ void badXMLParseMessageBox()
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::initInGame()
{
loginFinished = true;
setLoginFinished( true );
_LogState = false;
// Whole initInGame profile

View file

@ -40,6 +40,7 @@
#include "nel/gui/view_text.h"
#include "nel/gui/ctrl_button.h"
#include "nel/gui/ctrl_text_button.h"
#include "interface_v3/dbgroup_combo_box.h"
#include "sound_manager.h"
#include "far_tp.h"
@ -143,6 +144,33 @@ uint32 TotalPatchSize;
CLoginStateMachine LoginSM;
// ***************************************************************************
#define WIN_COMBO_BOX_SELECT_MENU "ui:interface:combo_box_select_menu"
#define WIN_COMBO_BOX_MEASURE_MENU "ui:interface:combo_box_measure_menu"
#define WIN_COMBO_BOX_SELECT_MENU_OUTGAME "ui:outgame:combo_box_select_menu"
#define WIN_COMBO_BOX_SELECT_MENU_LOGIN "ui:login:combo_box_select_menu"
#define WIN_COMBO_BOX_MEASURE_MENU_LOGIN "ui:login:combo_box_measure_menu"
bool isLoginFinished()
{
return loginFinished;
}
void setLoginFinished( bool f )
{
loginFinished = f;
if( loginFinished )
{
CDBGroupComboBox::measureMenu.assign( WIN_COMBO_BOX_MEASURE_MENU );
CDBGroupComboBox::selectMenu.assign( WIN_COMBO_BOX_SELECT_MENU );
}
else
{
CDBGroupComboBox::measureMenu.assign( WIN_COMBO_BOX_MEASURE_MENU_LOGIN );
CDBGroupComboBox::selectMenu.assign( WIN_COMBO_BOX_SELECT_MENU_LOGIN );
}
}
// ***************************************************************************
// Pop a fatal error message box, giving the option to 'quit' the client, plus a help button
@ -349,6 +377,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath)
// Main loop of the login step
void loginMainLoop()
{
CDBGroupComboBox::selectMenuOut.assign( WIN_COMBO_BOX_SELECT_MENU_OUTGAME );
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CPatchManager *pPM = CPatchManager::getInstance();
@ -757,7 +786,7 @@ void initLoginScreen()
CCtrlTextButton *pCB = dynamic_cast<CCtrlTextButton*>(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT));
if (pCB != NULL) pCB->setActive(false);
loginFinished = false;
setLoginFinished( false );
loginOK = false;
}
@ -882,6 +911,7 @@ bool login()
// CCtrlTextButton *pCB = dynamic_cast<CCtrlTextButton*>(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT));
// if (pCB != NULL) pCB->setActive(false);
//
// setLoginFinished( false );
// loginFinished = false;
// loginOK = false;
@ -1280,7 +1310,7 @@ class CAHOnGameConfiguration : public IActionHandler
{
// launch the ryzom configurator
launchProgram(Configurator, "");
loginFinished = true;
setLoginFinished( true );
loginOK = false;
LoginSM.pushEvent(CLoginStateMachine::ev_quit);
@ -1301,7 +1331,7 @@ class CAHLoginQuit : public IActionHandler
{
nlinfo("CAHLoginQuit called");
loginFinished = true;
setLoginFinished( true );
loginOK = false;
LoginSM.pushEvent(CLoginStateMachine::ev_quit);
@ -1400,7 +1430,7 @@ void ConnectToShard()
if (ClientCfg.R2Mode)
{
// r2 mode
loginFinished = true;
setLoginFinished( true );
loginOK = true;
LoginSM.pushEvent(CLoginStateMachine::ev_enter_game);
@ -1414,7 +1444,7 @@ void ConnectToShard()
if(res.empty())
{
loginFinished = true;
setLoginFinished( true );
loginOK = true;
LoginSM.pushEvent(CLoginStateMachine::ev_enter_game);
@ -2625,7 +2655,7 @@ class CAHOnConnectToShard: public IActionHandler
Cookie[i] = '|';
}
loginFinished = true;
setLoginFinished( true );
loginOK = true;
LoginSM.pushEvent(CLoginStateMachine::ev_connect);
@ -2639,7 +2669,7 @@ class CAHOnBackToLogin: public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
loginFinished = false;
setLoginFinished( false );
loginOK = false;
LoginSM.pushEvent(CLoginStateMachine::ev_relog);