mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 09:54:16 +08:00
Ref T489, overlay message support for download progress
This commit is contained in:
committed by
Mat Sutcliffe
parent
d71e5f289a
commit
fefeeac33b
@@ -333,6 +333,13 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (message.isEmpty()) { return; }
|
if (message.isEmpty()) { return; }
|
||||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
|
this->showHTMLMessage(message.toHtml(true, true), timeOutMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void COverlayMessages::showHTMLMessage(const QString &htmlMessage, int timeOutMs)
|
||||||
|
{
|
||||||
|
if (htmlMessage.isEmpty()) { return; }
|
||||||
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
|
|
||||||
if (this->hasPendingConfirmation())
|
if (this->hasPendingConfirmation())
|
||||||
{
|
{
|
||||||
@@ -341,16 +348,30 @@ namespace BlackGui
|
|||||||
m_pendingMessageCalls.push_back([ = ]()
|
m_pendingMessageCalls.push_back([ = ]()
|
||||||
{
|
{
|
||||||
if (!myself) { return; }
|
if (!myself) { return; }
|
||||||
myself->showHTMLMessage(message, timeOutMs);
|
myself->showHTMLMessage(htmlMessage, timeOutMs);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setModeToHTMLMessage();
|
this->setModeToHTMLMessage();
|
||||||
ui->te_HTMLMessage->setText(message.toHtml(true, true));
|
ui->te_HTMLMessage->setText(htmlMessage);
|
||||||
this->display(timeOutMs);
|
this->display(timeOutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COverlayMessages::showDownloadProgress(int progress, qint64 current, qint64 max, const QUrl &url, int timeOutMs)
|
||||||
|
{
|
||||||
|
if (progress >= 0 && max >= 0)
|
||||||
|
{
|
||||||
|
static const QString m("%1 of %2 from %3");
|
||||||
|
this->showProgressBar(progress, m.arg(current).arg(max).arg(url.toString()), timeOutMs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static const QString m("%1 from %2");
|
||||||
|
this->showHTMLMessage(m.arg(current).arg(url.toString()), timeOutMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void COverlayMessages::showProgressBar(int percentage, const QString &message, int timeOutMs)
|
void COverlayMessages::showProgressBar(int percentage, const QString &message, int timeOutMs)
|
||||||
{
|
{
|
||||||
if (message.isEmpty()) { return; }
|
if (message.isEmpty()) { return; }
|
||||||
|
|||||||
@@ -119,6 +119,12 @@ namespace BlackGui
|
|||||||
//! HTML message
|
//! HTML message
|
||||||
void showHTMLMessage(const BlackMisc::CStatusMessage &message, int timeOutMs = -1);
|
void showHTMLMessage(const BlackMisc::CStatusMessage &message, int timeOutMs = -1);
|
||||||
|
|
||||||
|
//! HTML message
|
||||||
|
void showHTMLMessage(const QString &htmlMessage, int timeOutMs = -1);
|
||||||
|
|
||||||
|
//! Download progress
|
||||||
|
void showDownloadProgress(int progress, qint64 current, qint64 max, const QUrl &url, int timeOutMs = -1);
|
||||||
|
|
||||||
//! Progress bar
|
//! Progress bar
|
||||||
void showProgressBar(int percentage, const QString &message, int timeOutMs = -1);
|
void showProgressBar(int percentage, const QString &message, int timeOutMs = -1);
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
|
#include <QUrl>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -163,6 +164,14 @@ namespace BlackGui
|
|||||||
WIDGET::repaint();
|
WIDGET::repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc BlackGui::COverlayMessages::showHTMLMessage
|
||||||
|
void showOverlayHTMLMessage(const QString &htmlMessage, int timeOutMs = -1)
|
||||||
|
{
|
||||||
|
this->initMinimalFrame();
|
||||||
|
m_overlayMessages->showHTMLMessage(htmlMessage, timeOutMs);
|
||||||
|
WIDGET::repaint();
|
||||||
|
}
|
||||||
|
|
||||||
//! \copydoc BlackGui::COverlayMessages::showHTMLMessage
|
//! \copydoc BlackGui::COverlayMessages::showHTMLMessage
|
||||||
void showOverlayHTMLMessage(const BlackMisc::CStatusMessage &message, int timeOutMs = -1)
|
void showOverlayHTMLMessage(const BlackMisc::CStatusMessage &message, int timeOutMs = -1)
|
||||||
{
|
{
|
||||||
@@ -171,6 +180,14 @@ namespace BlackGui
|
|||||||
WIDGET::repaint();
|
WIDGET::repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \copydoc BlackGui::COverlayMessages::showDownloadProgress
|
||||||
|
void showDownloadProgress(int progress, qint64 current, qint64 max, const QUrl &url, int timeOutMs = -1)
|
||||||
|
{
|
||||||
|
this->initMinimalFrame();
|
||||||
|
m_overlayMessages->showDownloadProgress(progress, current, max, url, timeOutMs);
|
||||||
|
WIDGET::repaint();
|
||||||
|
}
|
||||||
|
|
||||||
//! \copydoc BlackGui::COverlayMessages::showOverlayImage
|
//! \copydoc BlackGui::COverlayMessages::showOverlayImage
|
||||||
void showOverlayInlineTextMessage(Components::TextMessageTab tab)
|
void showOverlayInlineTextMessage(Components::TextMessageTab tab)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user