refs #883, improved position and layout of overlay message frame

This commit is contained in:
Klaus Basan
2017-02-19 02:50:46 +01:00
committed by Mathew Sutcliffe
parent 4ef64e4e22
commit 873823eaa1
9 changed files with 35 additions and 22 deletions

View File

@@ -54,7 +54,7 @@ namespace BlackGui
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &COverlayMessages::ps_onStyleSheetsChanged);
connect(ui->pb_Ok, &QPushButton::clicked, this, &COverlayMessages::ps_okClicked);
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->fr_Confirmation->setVisible(false);
@@ -134,8 +134,8 @@ namespace BlackGui
void COverlayMessages::showKill(bool show)
{
ui->pb_Kill->setVisible(show);
ui->pb_Kill->setEnabled(show);
ui->tb_Kill->setVisible(show);
ui->tb_Kill->setEnabled(show);
}
bool COverlayMessages::displayTextMessage(const CTextMessage &textMessage) const
@@ -264,23 +264,23 @@ namespace BlackGui
{
if (variant.canConvert<CStatusMessageList>())
{
showOverlayMessages(variant.value<CStatusMessageList>(), timeOutMs);
this->showOverlayMessages(variant.value<CStatusMessageList>(), timeOutMs);
}
else if (variant.canConvert<CStatusMessage>())
{
showOverlayMessage(variant.value<CStatusMessage>(), timeOutMs);
this->showOverlayMessage(variant.value<CStatusMessage>(), timeOutMs);
}
else if (variant.canConvert<CTextMessage>())
{
showOverlayTextMessage(variant.value<CTextMessage>(), timeOutMs);
this->showOverlayTextMessage(variant.value<CTextMessage>(), timeOutMs);
}
else if (variant.canConvert<QPixmap>())
{
showOverlayImage(variant.value<QPixmap>(), timeOutMs);
this->showOverlayImage(variant.value<QPixmap>(), timeOutMs);
}
else if (variant.canConvert<CPixmap>())
{
showOverlayImage(variant.value<CPixmap>(), timeOutMs);
this->showOverlayImage(variant.value<CPixmap>(), timeOutMs);
}
else
{
@@ -361,16 +361,16 @@ namespace BlackGui
ui->pb_Cancel->setAutoDefault(false);
ui->pb_Ok->setDefault(true);
ui->pb_Ok->setAutoDefault(true);
this->m_lastConfirmation = QMessageBox::Ok;
ui->pb_Ok->setFocus();
this->m_lastConfirmation = QMessageBox::Ok;
break;
case QMessageBox::Cancel:
ui->pb_Ok->setDefault(false);
ui->pb_Ok->setAutoDefault(false);
ui->pb_Cancel->setDefault(true);
ui->pb_Cancel->setAutoDefault(true);
this->m_lastConfirmation = QMessageBox::Cancel;
ui->pb_Cancel->setFocus();
this->m_lastConfirmation = QMessageBox::Cancel;
break;
default:
break;

View File

@@ -98,7 +98,7 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_Kill">
<widget class="QToolButton" name="tb_Kill">
<property name="enabled">
<bool>false</bool>
</property>
@@ -106,14 +106,18 @@
<string>kill application</string>
</property>
<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>
</widget>
</item>
<item>
<widget class="QToolButton" name="tb_Close">
<property name="text">
<string>PushButton</string>
<string>close</string>
</property>
<property name="icon">
<iconset resource="../blackmisc/blackmisc.qrc">

View File

@@ -10,6 +10,7 @@
#include "blackgui/overlaymessagesframe.h"
#include "blackgui/overlaymessages.h"
#include "blackgui/stylesheetutility.h"
#include "blackgui/guiutility.h"
#include "blackmisc/network/textmessage.h"
#include <QKeyEvent>
@@ -98,8 +99,8 @@ namespace BlackGui
QSize COverlayMessagesFrame::innerFrameSize() const
{
int w = this->width();
int h = this->height();
const int w = this->width();
const int h = this->height();
int wInner = this->m_widthFactor * w;
int hInner = this->m_heightFactor * h;
if (wInner > this->maximumWidth()) wInner = this->maximumWidth();
@@ -109,17 +110,19 @@ namespace BlackGui
void COverlayMessagesFrame::initInnerFrame()
{
QSize inner(innerFrameSize());
const QSize inner(innerFrameSize());
if (!this->m_overlayMessages)
{
this->m_overlayMessages = new COverlayMessages(inner.width(), inner.height(), this);
}
QPoint middle = this->geometry().center();
int w = inner.width();
int h = inner.height();
int x = middle.x() - w / 2;
int y = middle.y() - h / 2;
const bool isFrameless = CGuiUtility::isMainWindowFrameless();
const QPoint middle = this->geometry().center();
const double yFactor = isFrameless ? 1.25 : 1.5; // 2 is middle in normal window
const int w = inner.width();
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);
}
} // ns

View File

@@ -98,7 +98,7 @@ namespace BlackGui
void initInnerFrame();
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

View File

@@ -522,4 +522,10 @@
<file>icons/preloaders/FloatingRays16.gif</file>
<file>icons/preloaders/FloatingRays32.gif</file>
</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB