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">
|
<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"
|
<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"
|
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
|
||||||
I18N="User info dialog" text="Close" label_location="bottom"/>
|
I18N="User info dialog" text="Close" label_location="bottom"/>
|
||||||
</buttonbar>
|
</buttonbar>
|
||||||
|
@ -42,6 +42,7 @@ namespace GUIEngine
|
|||||||
|
|
||||||
DialogQueue::DialogQueue()
|
DialogQueue::DialogQueue()
|
||||||
{
|
{
|
||||||
|
m_closer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -49,26 +50,33 @@ namespace GUIEngine
|
|||||||
void DialogQueue::pushDialog(ModalDialog * dialog, bool closes_any_dialog)
|
void DialogQueue::pushDialog(ModalDialog * dialog, bool closes_any_dialog)
|
||||||
{
|
{
|
||||||
assert(!dialog->isInited());
|
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()
|
void DialogQueue::update()
|
||||||
{
|
{
|
||||||
|
if(m_closer != NULL)
|
||||||
if(!m_queue.empty())
|
|
||||||
{
|
{
|
||||||
Entry * entry = m_queue.front();
|
ModalDialog::dismiss();
|
||||||
if(entry->closes() || !ModalDialog::isADialogActive())
|
m_closer->load();
|
||||||
|
m_closer = NULL;
|
||||||
|
}
|
||||||
|
else if(!m_queue.empty())
|
||||||
|
{
|
||||||
|
ModalDialog * entry = m_queue.front();
|
||||||
|
if(!ModalDialog::isADialogActive())
|
||||||
{
|
{
|
||||||
ModalDialog::dismiss();
|
entry->load();
|
||||||
entry->get()->load();
|
|
||||||
m_queue.pop();
|
m_queue.pop();
|
||||||
delete entry;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,16 +31,8 @@ namespace GUIEngine
|
|||||||
{
|
{
|
||||||
private :
|
private :
|
||||||
|
|
||||||
class Entry
|
std::queue<ModalDialog *> m_queue;
|
||||||
{
|
ModalDialog * m_closer;
|
||||||
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;
|
|
||||||
DialogQueue();
|
DialogQueue();
|
||||||
public :
|
public :
|
||||||
/**Singleton */
|
/**Singleton */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user