mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refs #883, improved position and layout of overlay message frame
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4ef64e4e22
commit
873823eaa1
@@ -54,7 +54,7 @@ namespace BlackGui
|
|||||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &COverlayMessages::ps_onStyleSheetsChanged);
|
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &COverlayMessages::ps_onStyleSheetsChanged);
|
||||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &COverlayMessages::ps_okClicked);
|
connect(ui->pb_Ok, &QPushButton::clicked, this, &COverlayMessages::ps_okClicked);
|
||||||
connect(ui->pb_Cancel, &QPushButton::clicked, this, &COverlayMessages::ps_cancelClicked);
|
connect(ui->pb_Cancel, &QPushButton::clicked, this, &COverlayMessages::ps_cancelClicked);
|
||||||
connect(ui->pb_Kill, &QPushButton::clicked, this, &COverlayMessages::ps_killClicked);
|
connect(ui->tb_Kill, &QPushButton::clicked, this, &COverlayMessages::ps_killClicked);
|
||||||
|
|
||||||
ui->tvp_StatusMessages->setResizeMode(CStatusMessageView::ResizingAuto);
|
ui->tvp_StatusMessages->setResizeMode(CStatusMessageView::ResizingAuto);
|
||||||
ui->fr_Confirmation->setVisible(false);
|
ui->fr_Confirmation->setVisible(false);
|
||||||
@@ -134,8 +134,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
void COverlayMessages::showKill(bool show)
|
void COverlayMessages::showKill(bool show)
|
||||||
{
|
{
|
||||||
ui->pb_Kill->setVisible(show);
|
ui->tb_Kill->setVisible(show);
|
||||||
ui->pb_Kill->setEnabled(show);
|
ui->tb_Kill->setEnabled(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COverlayMessages::displayTextMessage(const CTextMessage &textMessage) const
|
bool COverlayMessages::displayTextMessage(const CTextMessage &textMessage) const
|
||||||
@@ -264,23 +264,23 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (variant.canConvert<CStatusMessageList>())
|
if (variant.canConvert<CStatusMessageList>())
|
||||||
{
|
{
|
||||||
showOverlayMessages(variant.value<CStatusMessageList>(), timeOutMs);
|
this->showOverlayMessages(variant.value<CStatusMessageList>(), timeOutMs);
|
||||||
}
|
}
|
||||||
else if (variant.canConvert<CStatusMessage>())
|
else if (variant.canConvert<CStatusMessage>())
|
||||||
{
|
{
|
||||||
showOverlayMessage(variant.value<CStatusMessage>(), timeOutMs);
|
this->showOverlayMessage(variant.value<CStatusMessage>(), timeOutMs);
|
||||||
}
|
}
|
||||||
else if (variant.canConvert<CTextMessage>())
|
else if (variant.canConvert<CTextMessage>())
|
||||||
{
|
{
|
||||||
showOverlayTextMessage(variant.value<CTextMessage>(), timeOutMs);
|
this->showOverlayTextMessage(variant.value<CTextMessage>(), timeOutMs);
|
||||||
}
|
}
|
||||||
else if (variant.canConvert<QPixmap>())
|
else if (variant.canConvert<QPixmap>())
|
||||||
{
|
{
|
||||||
showOverlayImage(variant.value<QPixmap>(), timeOutMs);
|
this->showOverlayImage(variant.value<QPixmap>(), timeOutMs);
|
||||||
}
|
}
|
||||||
else if (variant.canConvert<CPixmap>())
|
else if (variant.canConvert<CPixmap>())
|
||||||
{
|
{
|
||||||
showOverlayImage(variant.value<CPixmap>(), timeOutMs);
|
this->showOverlayImage(variant.value<CPixmap>(), timeOutMs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -361,16 +361,16 @@ namespace BlackGui
|
|||||||
ui->pb_Cancel->setAutoDefault(false);
|
ui->pb_Cancel->setAutoDefault(false);
|
||||||
ui->pb_Ok->setDefault(true);
|
ui->pb_Ok->setDefault(true);
|
||||||
ui->pb_Ok->setAutoDefault(true);
|
ui->pb_Ok->setAutoDefault(true);
|
||||||
this->m_lastConfirmation = QMessageBox::Ok;
|
|
||||||
ui->pb_Ok->setFocus();
|
ui->pb_Ok->setFocus();
|
||||||
|
this->m_lastConfirmation = QMessageBox::Ok;
|
||||||
break;
|
break;
|
||||||
case QMessageBox::Cancel:
|
case QMessageBox::Cancel:
|
||||||
ui->pb_Ok->setDefault(false);
|
ui->pb_Ok->setDefault(false);
|
||||||
ui->pb_Ok->setAutoDefault(false);
|
ui->pb_Ok->setAutoDefault(false);
|
||||||
ui->pb_Cancel->setDefault(true);
|
ui->pb_Cancel->setDefault(true);
|
||||||
ui->pb_Cancel->setAutoDefault(true);
|
ui->pb_Cancel->setAutoDefault(true);
|
||||||
this->m_lastConfirmation = QMessageBox::Cancel;
|
|
||||||
ui->pb_Cancel->setFocus();
|
ui->pb_Cancel->setFocus();
|
||||||
|
this->m_lastConfirmation = QMessageBox::Cancel;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pb_Kill">
|
<widget class="QToolButton" name="tb_Kill">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@@ -106,14 +106,18 @@
|
|||||||
<string>kill application</string>
|
<string>kill application</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Kill</string>
|
<string>kill application</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../blackmisc/blackmisc.qrc">
|
||||||
|
<normaloff>:/misc/icons/misc/skull64.png</normaloff>:/misc/icons/misc/skull64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="tb_Close">
|
<widget class="QToolButton" name="tb_Close">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PushButton</string>
|
<string>close</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../blackmisc/blackmisc.qrc">
|
<iconset resource="../blackmisc/blackmisc.qrc">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "blackgui/overlaymessagesframe.h"
|
#include "blackgui/overlaymessagesframe.h"
|
||||||
#include "blackgui/overlaymessages.h"
|
#include "blackgui/overlaymessages.h"
|
||||||
#include "blackgui/stylesheetutility.h"
|
#include "blackgui/stylesheetutility.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
@@ -98,8 +99,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
QSize COverlayMessagesFrame::innerFrameSize() const
|
QSize COverlayMessagesFrame::innerFrameSize() const
|
||||||
{
|
{
|
||||||
int w = this->width();
|
const int w = this->width();
|
||||||
int h = this->height();
|
const int h = this->height();
|
||||||
int wInner = this->m_widthFactor * w;
|
int wInner = this->m_widthFactor * w;
|
||||||
int hInner = this->m_heightFactor * h;
|
int hInner = this->m_heightFactor * h;
|
||||||
if (wInner > this->maximumWidth()) wInner = this->maximumWidth();
|
if (wInner > this->maximumWidth()) wInner = this->maximumWidth();
|
||||||
@@ -109,17 +110,19 @@ namespace BlackGui
|
|||||||
|
|
||||||
void COverlayMessagesFrame::initInnerFrame()
|
void COverlayMessagesFrame::initInnerFrame()
|
||||||
{
|
{
|
||||||
QSize inner(innerFrameSize());
|
const QSize inner(innerFrameSize());
|
||||||
if (!this->m_overlayMessages)
|
if (!this->m_overlayMessages)
|
||||||
{
|
{
|
||||||
this->m_overlayMessages = new COverlayMessages(inner.width(), inner.height(), this);
|
this->m_overlayMessages = new COverlayMessages(inner.width(), inner.height(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint middle = this->geometry().center();
|
const bool isFrameless = CGuiUtility::isMainWindowFrameless();
|
||||||
int w = inner.width();
|
const QPoint middle = this->geometry().center();
|
||||||
int h = inner.height();
|
const double yFactor = isFrameless ? 1.25 : 1.5; // 2 is middle in normal window
|
||||||
int x = middle.x() - w / 2;
|
const int w = inner.width();
|
||||||
int y = middle.y() - h / 2;
|
const int h = inner.height();
|
||||||
|
const int x = middle.x() - w / 2;
|
||||||
|
const int y = middle.y() - h / yFactor;
|
||||||
this->m_overlayMessages->setGeometry(x, y, w, h);
|
this->m_overlayMessages->setGeometry(x, y, w, h);
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace BlackGui
|
|||||||
void initInnerFrame();
|
void initInnerFrame();
|
||||||
|
|
||||||
double m_widthFactor = 0.7; //!< inner frame x factor
|
double m_widthFactor = 0.7; //!< inner frame x factor
|
||||||
double m_heightFactor = 0.7; //!< inner frame x factor
|
double m_heightFactor = 0.6; //!< inner frame x factor
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -522,4 +522,10 @@
|
|||||||
<file>icons/preloaders/FloatingRays16.gif</file>
|
<file>icons/preloaders/FloatingRays16.gif</file>
|
||||||
<file>icons/preloaders/FloatingRays32.gif</file>
|
<file>icons/preloaders/FloatingRays32.gif</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
<qresource prefix="/misc">
|
||||||
|
<file>icons/misc/skull64.png</file>
|
||||||
|
<file>icons/misc/skull128.png</file>
|
||||||
|
<file>icons/misc/skull256.png</file>
|
||||||
|
<file>icons/misc/skull512.png</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
BIN
src/blackmisc/icons/misc/skull128.png
Normal file
BIN
src/blackmisc/icons/misc/skull128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
BIN
src/blackmisc/icons/misc/skull256.png
Normal file
BIN
src/blackmisc/icons/misc/skull256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
src/blackmisc/icons/misc/skull512.png
Normal file
BIN
src/blackmisc/icons/misc/skull512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
BIN
src/blackmisc/icons/misc/skull64.png
Normal file
BIN
src/blackmisc/icons/misc/skull64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Reference in New Issue
Block a user