mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Overlay progress bar
This commit is contained in:
committed by
Mat Sutcliffe
parent
298f746862
commit
4e1835b80d
@@ -351,6 +351,28 @@ namespace BlackGui
|
||||
this->display(timeOutMs);
|
||||
}
|
||||
|
||||
void COverlayMessages::showProgressBar(int percentage, const QString &message, int timeOutMs)
|
||||
{
|
||||
if (message.isEmpty()) { return; }
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
if (this->hasPendingConfirmation()) { return; } // ignore if something else is pending
|
||||
|
||||
const int p = qMax(qMin(percentage, 100), 0);
|
||||
|
||||
ui->pb_ProgressBar->setValue(p);
|
||||
ui->lbl_ProgressBar->setText(message);
|
||||
this->setModeToProgressBar();
|
||||
|
||||
if (p >= 100)
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->display(timeOutMs);
|
||||
}
|
||||
}
|
||||
|
||||
void COverlayMessages::showKillButton(bool killButton)
|
||||
{
|
||||
m_hasKillButton = killButton;
|
||||
@@ -385,6 +407,13 @@ namespace BlackGui
|
||||
this->setHeader("Message");
|
||||
}
|
||||
|
||||
void COverlayMessages::setModeToProgressBar(bool withKillButton)
|
||||
{
|
||||
ui->sw_StatusMessagesComponent->setCurrentWidget(ui->pg_ProgressBar);
|
||||
this->showKill(withKillButton);
|
||||
this->setHeader("Progress bar");
|
||||
}
|
||||
|
||||
void COverlayMessages::setModeToTextMessage()
|
||||
{
|
||||
ui->sw_StatusMessagesComponent->setCurrentWidget(ui->pg_TextMessage);
|
||||
|
||||
@@ -65,6 +65,9 @@ namespace BlackGui
|
||||
//! HTML message mode
|
||||
void setModeToHTMLMessage(bool withKillButton = false);
|
||||
|
||||
//! Progress bar
|
||||
void setModeToProgressBar(bool withKillButton = false);
|
||||
|
||||
//! Single Text message mode
|
||||
void setModeToTextMessage();
|
||||
|
||||
@@ -116,6 +119,9 @@ namespace BlackGui
|
||||
//! HTML message
|
||||
void showHTMLMessage(const BlackMisc::CStatusMessage &message, int timeOutMs = -1);
|
||||
|
||||
//! Progress bar
|
||||
void showProgressBar(int percentage, const QString &message, int timeOutMs = -1);
|
||||
|
||||
//! Allows to globally enable/disable kill button
|
||||
void showKillButton(bool killButton);
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="sw_StatusMessagesComponent">
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pg_StatusMessages">
|
||||
<layout class="QVBoxLayout" name="vl_PgStatusMessages">
|
||||
@@ -340,6 +340,36 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_ProgressBar">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item alignment="Qt::AlignVCenter">
|
||||
<widget class="QFrame" name="fr_PRogressBar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_ProgressBar">
|
||||
<item>
|
||||
<widget class="QProgressBar" name="pb_ProgressBar">
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lbl_ProgressBar">
|
||||
<property name="text">
|
||||
<string>text will go here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user