forked from len0rd/rockbox
qeditor: message widget now supports IDs, useful to clear messages
Change-Id: Ibe0a8909128469a71a25415761860e06fc9f1e67 Reviewed-on: http://gerrit.rockbox.org/1006 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
This commit is contained in:
parent
cef5e1018e
commit
7749c4d0e9
4 changed files with 37 additions and 6 deletions
|
@ -998,6 +998,8 @@ MessageWidget::MessageWidget(QWidget *parent)
|
|||
layout->addWidget(m_text, 1);
|
||||
layout->addWidget(m_close, 0);
|
||||
|
||||
m_id = 0;
|
||||
|
||||
connect(m_close, SIGNAL(clicked(bool)), this, SLOT(OnClose(bool)));
|
||||
|
||||
hide();
|
||||
|
@ -1042,12 +1044,19 @@ void MessageWidget::UpdateType()
|
|||
.arg(border.name()));
|
||||
}
|
||||
|
||||
void MessageWidget::SetMessage(MessageType type, const QString& msg)
|
||||
int MessageWidget::SetMessage(MessageType type, const QString& msg)
|
||||
{
|
||||
m_type = type;
|
||||
m_text->setText(msg);
|
||||
UpdateType();
|
||||
show();
|
||||
return ++m_id;
|
||||
}
|
||||
|
||||
void MessageWidget::HideMessage(int id)
|
||||
{
|
||||
if(m_id == id)
|
||||
OnClose(true);
|
||||
}
|
||||
|
||||
void MessageWidget::OnClose(bool clicked)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue