Add WarningMessage Translate function
This commit is contained in:
@@ -26,6 +26,8 @@ WarningMessageWidget::WarningMessageWidget(QWidget *parent):QWidget(parent)
|
|||||||
, mWarningCount(0)
|
, mWarningCount(0)
|
||||||
, mErrorEmptyMessage(new QLabel(tr("System is working properly.")))
|
, mErrorEmptyMessage(new QLabel(tr("System is working properly.")))
|
||||||
, mWarningEmptyMessage(new QLabel(tr("No message.")))
|
, mWarningEmptyMessage(new QLabel(tr("No message.")))
|
||||||
|
, mWarningTitle(new QLabel(this))
|
||||||
|
, mErrorTitle(new QLabel(this))
|
||||||
{
|
{
|
||||||
setWindowFlags(windowFlags()|Qt::FramelessWindowHint|Qt::Popup);
|
setWindowFlags(windowFlags()|Qt::FramelessWindowHint|Qt::Popup);
|
||||||
// setWindowFlags(windowFlags()|Qt::FramelessWindowHint);
|
// setWindowFlags(windowFlags()|Qt::FramelessWindowHint);
|
||||||
@@ -39,10 +41,10 @@ WarningMessageWidget::WarningMessageWidget(QWidget *parent):QWidget(parent)
|
|||||||
errorPanel->setObjectName("ErrorPanelContent");
|
errorPanel->setObjectName("ErrorPanelContent");
|
||||||
layout->addWidget(errorPanel);
|
layout->addWidget(errorPanel);
|
||||||
auto errorLayout = new QVBoxLayout(errorPanel);
|
auto errorLayout = new QVBoxLayout(errorPanel);
|
||||||
auto errorTitle = new QLabel;
|
|
||||||
errorTitle->setObjectName("WarningPanelTitle");
|
mErrorTitle->setObjectName("WarningPanelTitle");
|
||||||
errorTitle->setText(tr("System Status"));
|
mErrorTitle->setText(tr("System Status"));
|
||||||
errorLayout->addWidget(errorTitle);
|
errorLayout->addWidget(mErrorTitle);
|
||||||
errorLayout->setMargin(0);
|
errorLayout->setMargin(0);
|
||||||
errorLayout->addWidget(mErrorEmptyMessage,0, Qt::AlignCenter | Qt::AlignHCenter);
|
errorLayout->addWidget(mErrorEmptyMessage,0, Qt::AlignCenter | Qt::AlignHCenter);
|
||||||
|
|
||||||
@@ -67,10 +69,9 @@ WarningMessageWidget::WarningMessageWidget(QWidget *parent):QWidget(parent)
|
|||||||
|
|
||||||
layout->addWidget(warningPanel);
|
layout->addWidget(warningPanel);
|
||||||
auto warningLayout = new QVBoxLayout(warningPanel);
|
auto warningLayout = new QVBoxLayout(warningPanel);
|
||||||
auto warningTitle = new QLabel;
|
mWarningTitle->setObjectName("WarningPanelTitle");
|
||||||
warningTitle->setObjectName("WarningPanelTitle");
|
mWarningTitle->setText(tr("System Notifications"));
|
||||||
warningTitle->setText(tr("System Notifications"));
|
warningLayout->addWidget(mWarningTitle);
|
||||||
warningLayout->addWidget(warningTitle);
|
|
||||||
warningLayout->setMargin(0);
|
warningLayout->setMargin(0);
|
||||||
warningLayout->addWidget(mWarningEmptyMessage, 0,Qt::AlignCenter | Qt::AlignHCenter);
|
warningLayout->addWidget(mWarningEmptyMessage, 0,Qt::AlignCenter | Qt::AlignHCenter);
|
||||||
|
|
||||||
@@ -100,6 +101,9 @@ WarningMessageWidget::WarningMessageWidget(QWidget *parent):QWidget(parent)
|
|||||||
connect(EventCenter::Default(),&EventCenter::WarningMessageRaise,this,&WarningMessageWidget::addWarningProxySlot,Qt::QueuedConnection);
|
connect(EventCenter::Default(),&EventCenter::WarningMessageRaise,this,&WarningMessageWidget::addWarningProxySlot,Qt::QueuedConnection);
|
||||||
connect(EventCenter::Default(),&EventCenter::ErrorStateUnactive,this,&WarningMessageWidget::unactiveErrorProxySlot,Qt::QueuedConnection);
|
connect(EventCenter::Default(),&EventCenter::ErrorStateUnactive,this,&WarningMessageWidget::unactiveErrorProxySlot,Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this, &WarningMessageWidget::reloadLanguage);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WarningMessageWidget::setPopupArgs(int aHeight, int aX, int aY)
|
void WarningMessageWidget::setPopupArgs(int aHeight, int aX, int aY)
|
||||||
@@ -159,6 +163,13 @@ void WarningMessageWidget::unactiveErrorProxySlot(QObject*, QObject* aData)
|
|||||||
unactiveError(601);
|
unactiveError(601);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WarningMessageWidget::reloadLanguage()
|
||||||
|
{
|
||||||
|
mErrorTitle->setText(tr("System Status"));
|
||||||
|
mWarningTitle->setText(tr("System Notifications"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void WarningMessageWidget::clearWarning()
|
void WarningMessageWidget::clearWarning()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mWarningMutex);
|
QMutexLocker locker(&mWarningMutex);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ protected slots:
|
|||||||
void addWarningProxySlot(QObject*, QObject* aData);
|
void addWarningProxySlot(QObject*, QObject* aData);
|
||||||
void activeErrorProxySlot(QObject*, QObject* aData);
|
void activeErrorProxySlot(QObject*, QObject* aData);
|
||||||
void unactiveErrorProxySlot(QObject*, QObject* aData);
|
void unactiveErrorProxySlot(QObject*, QObject* aData);
|
||||||
|
void reloadLanguage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPropertyAnimation* showAnimation = nullptr;
|
QPropertyAnimation* showAnimation = nullptr;
|
||||||
@@ -32,6 +33,9 @@ private:
|
|||||||
QScrollArea* mScrollAreaW;
|
QScrollArea* mScrollAreaW;
|
||||||
QLabel* mErrorEmptyMessage;
|
QLabel* mErrorEmptyMessage;
|
||||||
QLabel* mWarningEmptyMessage;
|
QLabel* mWarningEmptyMessage;
|
||||||
|
QLabel* mErrorTitle;
|
||||||
|
QLabel* mWarningTitle;
|
||||||
|
|
||||||
QMutex mWarningMutex;
|
QMutex mWarningMutex;
|
||||||
QMutex mErrorMutex;
|
QMutex mErrorMutex;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user