Now you can change the thickness of the drawing tools!
This commit is contained in:
57
src/capture/widget/notifierbox.cpp
Normal file
57
src/capture/widget/notifierbox.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2017 Alejandro Sirgo Rica
|
||||
//
|
||||
// This file is part of Flameshot.
|
||||
//
|
||||
// Flameshot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Flameshot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "notifierbox.h"
|
||||
#include "src/utils/confighandler.h"
|
||||
#include "src/capture/widget/capturebutton.h"
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
|
||||
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 = (CaptureButton::iconIsWhiteByColor(m_bgColor) ?
|
||||
Qt::white : Qt::black);
|
||||
m_bgColor.setAlpha(180);
|
||||
setFixedSize(QSize(46, 46));
|
||||
}
|
||||
|
||||
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::showMessage(const QString &msg) {
|
||||
m_message = msg;
|
||||
update();
|
||||
show();
|
||||
m_timer->start();
|
||||
}
|
||||
Reference in New Issue
Block a user