mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Overlay messages with ratio and line parameter
This commit is contained in:
committed by
Mat Sutcliffe
parent
efb1ac46f2
commit
6ce833186b
@@ -74,9 +74,6 @@ namespace BlackGui
|
||||
this->setDefaultConfirmationButton(QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
COverlayMessages::~COverlayMessages()
|
||||
{}
|
||||
|
||||
COverlayMessages::COverlayMessages(const QString &headerText, int w, int h, QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::COverlayMessages),
|
||||
@@ -85,12 +82,15 @@ namespace BlackGui
|
||||
this->init(w, h);
|
||||
}
|
||||
|
||||
COverlayMessages::~COverlayMessages()
|
||||
{}
|
||||
|
||||
void COverlayMessages::init(int w, int h)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->resize(w, h);
|
||||
this->setAutoFillBackground(true);
|
||||
m_autoCloseTimer.setObjectName(objectName() + ":autoCloseTimer");
|
||||
m_autoCloseTimer.setObjectName(objectName() % ":autoCloseTimer");
|
||||
ui->tvp_StatusMessages->setMode(CStatusMessageListModel::Simplified);
|
||||
connect(ui->tb_Close, &QToolButton::released, this, &COverlayMessages::close);
|
||||
connect(&m_autoCloseTimer, &QTimer::timeout, this, &COverlayMessages::close);
|
||||
@@ -123,7 +123,7 @@ namespace BlackGui
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Shutdown the application.");
|
||||
msgBox.setInformativeText("Do you want to terminate " + sGui->getApplicationNameAndVersion() + "?");
|
||||
msgBox.setInformativeText(u"Do you want to terminate " % sGui->getApplicationNameAndVersion() % u"?");
|
||||
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Save);
|
||||
if (QMessageBox::Ok == msgBox.exec() && sGui)
|
||||
@@ -362,12 +362,12 @@ namespace BlackGui
|
||||
{
|
||||
if (progress >= 0 && max >= 0)
|
||||
{
|
||||
static const QString m("%1 of %2 from %3");
|
||||
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");
|
||||
static const QString m("%1 from '%2'");
|
||||
this->showHTMLMessage(m.arg(current).arg(url.toString()), timeOutMs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,13 +232,13 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
//! Init a minimal frame (smaller as the normal one)
|
||||
void initMinimalFrame()
|
||||
void initMinimalFrame(int lines = 4)
|
||||
{
|
||||
this->initInnerFrame();
|
||||
|
||||
// get logical resolution
|
||||
constexpr int MinHeight = 100;
|
||||
QSizeF s = CGuiUtility::fontMetricsEstimateSize(100, 5); // 2 lines for header
|
||||
QSizeF s = CGuiUtility::fontMetricsEstimateSize(100, lines, true); // 2 lines for header
|
||||
if (s.height() < MinHeight) { s.setHeight(MinHeight); }
|
||||
|
||||
const QSize inner(innerFrameSize());
|
||||
|
||||
Reference in New Issue
Block a user