mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
reformatted to Mozilla code style
This commit is contained in:
committed by
borgmanJeremy
parent
c0e2e48db4
commit
c8d15205be
@@ -16,52 +16,62 @@
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "notifierbox.h"
|
||||
#include "src/utils/confighandler.h"
|
||||
#include "src/utils/colorutils.h"
|
||||
#include "src/utils/confighandler.h"
|
||||
#include "src/utils/globalvalues.h"
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
|
||||
NotifierBox::NotifierBox(QWidget *parent) : QWidget(parent) {
|
||||
m_timer = new QTimer(this);
|
||||
m_timer->setSingleShot(true);
|
||||
m_timer->setInterval(1200);
|
||||
connect(m_timer, &QTimer::timeout, this, &NotifierBox::hide);
|
||||
m_bgColor = ConfigHandler().uiMainColorValue();
|
||||
m_foregroundColor = (ColorUtils::colorIsDark(m_bgColor) ?
|
||||
Qt::white : Qt::black);
|
||||
m_bgColor.setAlpha(180);
|
||||
const int size = (GlobalValues::buttonBaseSize() +
|
||||
GlobalValues::buttonBaseSize()/2) *
|
||||
qApp->devicePixelRatio();
|
||||
setFixedSize(QSize(size, size));
|
||||
NotifierBox::NotifierBox(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_timer = new QTimer(this);
|
||||
m_timer->setSingleShot(true);
|
||||
m_timer->setInterval(1200);
|
||||
connect(m_timer, &QTimer::timeout, this, &NotifierBox::hide);
|
||||
m_bgColor = ConfigHandler().uiMainColorValue();
|
||||
m_foregroundColor =
|
||||
(ColorUtils::colorIsDark(m_bgColor) ? Qt::white : Qt::black);
|
||||
m_bgColor.setAlpha(180);
|
||||
const int size =
|
||||
(GlobalValues::buttonBaseSize() + GlobalValues::buttonBaseSize() / 2) *
|
||||
qApp->devicePixelRatio();
|
||||
setFixedSize(QSize(size, size));
|
||||
}
|
||||
|
||||
void NotifierBox::enterEvent(QEvent *) {
|
||||
hide();
|
||||
void
|
||||
NotifierBox::enterEvent(QEvent*)
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void NotifierBox::paintEvent(QPaintEvent *) {
|
||||
QPainter painter(this);
|
||||
// draw Elipse
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setBrush(QBrush(m_bgColor, Qt::SolidPattern));
|
||||
painter.setPen(QPen(Qt::transparent));
|
||||
painter.drawEllipse(rect());
|
||||
// Draw the text:
|
||||
painter.setPen(QPen(m_foregroundColor));
|
||||
painter.drawText(rect(), Qt::AlignCenter, m_message);
|
||||
void
|
||||
NotifierBox::paintEvent(QPaintEvent*)
|
||||
{
|
||||
QPainter painter(this);
|
||||
// draw Elipse
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setBrush(QBrush(m_bgColor, Qt::SolidPattern));
|
||||
painter.setPen(QPen(Qt::transparent));
|
||||
painter.drawEllipse(rect());
|
||||
// Draw the text:
|
||||
painter.setPen(QPen(m_foregroundColor));
|
||||
painter.drawText(rect(), Qt::AlignCenter, m_message);
|
||||
}
|
||||
|
||||
void NotifierBox::showMessage(const QString &msg) {
|
||||
m_message = msg;
|
||||
update();
|
||||
show();
|
||||
m_timer->start();
|
||||
void
|
||||
NotifierBox::showMessage(const QString& msg)
|
||||
{
|
||||
m_message = msg;
|
||||
update();
|
||||
show();
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
void NotifierBox::showColor(const QColor &color) {
|
||||
Q_UNUSED(color);
|
||||
m_message = QLatin1String("");
|
||||
void
|
||||
NotifierBox::showColor(const QColor& color)
|
||||
{
|
||||
Q_UNUSED(color);
|
||||
m_message = QLatin1String("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user