Some dialog queue improvement.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13552 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
5ada92b251
commit
ed7b4b875a
@ -6,9 +6,9 @@
|
||||
|
||||
<spacer height="20" width="50">
|
||||
|
||||
<buttonbar id="options" width="90%" height="20%" align="center">
|
||||
<buttonbar id="options" width="90%" height="30%" align="center">
|
||||
<icon-button id="view" width="64" height="64" icon="gui/difficulty_medium.png"
|
||||
I18N="User info dialog" text="View" label_location="bottom"/>
|
||||
I18N="User info dialog" text="View friends" label_location="bottom"/>
|
||||
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
|
||||
I18N="User info dialog" text="Close" label_location="bottom"/>
|
||||
</buttonbar>
|
||||
|
@ -42,6 +42,7 @@ namespace GUIEngine
|
||||
|
||||
DialogQueue::DialogQueue()
|
||||
{
|
||||
m_closer = NULL;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -49,26 +50,33 @@ namespace GUIEngine
|
||||
void DialogQueue::pushDialog(ModalDialog * dialog, bool closes_any_dialog)
|
||||
{
|
||||
assert(!dialog->isInited());
|
||||
m_queue.push( new Entry(dialog, closes_any_dialog)); }
|
||||
if(closes_any_dialog)
|
||||
{
|
||||
delete m_closer;
|
||||
m_closer = dialog;
|
||||
}
|
||||
else
|
||||
m_queue.push(dialog);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void DialogQueue::update()
|
||||
{
|
||||
|
||||
if(!m_queue.empty())
|
||||
if(m_closer != NULL)
|
||||
{
|
||||
Entry * entry = m_queue.front();
|
||||
if(entry->closes() || !ModalDialog::isADialogActive())
|
||||
ModalDialog::dismiss();
|
||||
m_closer->load();
|
||||
m_closer = NULL;
|
||||
}
|
||||
else if(!m_queue.empty())
|
||||
{
|
||||
ModalDialog * entry = m_queue.front();
|
||||
if(!ModalDialog::isADialogActive())
|
||||
{
|
||||
ModalDialog::dismiss();
|
||||
entry->get()->load();
|
||||
entry->load();
|
||||
m_queue.pop();
|
||||
delete entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,16 +31,8 @@ namespace GUIEngine
|
||||
{
|
||||
private :
|
||||
|
||||
class Entry
|
||||
{
|
||||
ModalDialog * m_dialog;
|
||||
bool m_closes_any_dialog;
|
||||
public :
|
||||
Entry(ModalDialog * dialog, bool closes_any_dialog) : m_dialog(dialog), m_closes_any_dialog(closes_any_dialog) {}
|
||||
bool closes() { return m_closes_any_dialog; }
|
||||
ModalDialog* get() { return m_dialog; }
|
||||
};
|
||||
std::queue<Entry *> m_queue;
|
||||
std::queue<ModalDialog *> m_queue;
|
||||
ModalDialog * m_closer;
|
||||
DialogQueue();
|
||||
public :
|
||||
/**Singleton */
|
||||
|
Loading…
Reference in New Issue
Block a user