mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-01-05 16:45:52 +00:00
Add help message in capture
This commit is contained in:
@@ -52,7 +52,7 @@ namespace {
|
||||
CaptureWidget::CaptureWidget(QWidget *parent) :
|
||||
QWidget(parent), m_mouseOverHandle(0), m_mouseIsClicked(false),
|
||||
m_rightClick(false), m_newSelection(false), m_grabbing(false),
|
||||
m_onButton(false), m_state(Button::Type::move)
|
||||
m_onButton(false), m_showInitialMsg(true), m_state(Button::Type::move)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
// create selection handlers
|
||||
@@ -143,10 +143,43 @@ void CaptureWidget::paintEvent(QPaintEvent *) {
|
||||
QRect r = m_selection.normalized().adjusted(0, 0, -1, -1);
|
||||
QRegion grey(rect());
|
||||
grey = grey.subtracted(r);
|
||||
|
||||
painter.setClipRegion(grey);
|
||||
painter.drawRect(-1, -1, rect().width() + 1, rect().height() + 1);
|
||||
painter.setClipRect(rect());
|
||||
|
||||
if(m_showInitialMsg) {
|
||||
|
||||
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
|
||||
|
||||
QString helpTxt = tr("Select an area with the mouse, or press Esc to exit."
|
||||
"\nPress Enter to capture the screen."
|
||||
"\nPress Right Click to choose the tool color.");
|
||||
|
||||
// We draw the white contrasting background for the text, using the
|
||||
//same text and options to get the boundingRect that the text will have.
|
||||
QColor rectColor = m_uiColor;
|
||||
rectColor.setAlpha(180);
|
||||
QColor textColor((Button::iconIsWhite(rectColor) ? Qt::white : Qt::black));
|
||||
painter.setPen(QPen(textColor));
|
||||
//painter.setBrush(QBrush(QColor(255, 255, 255, 180), Qt::SolidPattern));
|
||||
painter.setBrush(QBrush(rectColor, Qt::SolidPattern));
|
||||
QRectF bRect = painter.boundingRect(helpRect, Qt::AlignCenter, helpTxt);
|
||||
|
||||
// These four calls provide padding for the rect
|
||||
bRect.setWidth(bRect.width() + 12);
|
||||
bRect.setHeight(bRect.height() + 10);
|
||||
bRect.setX(bRect.x() - 12);
|
||||
bRect.setY(bRect.y() - 10);
|
||||
|
||||
painter.drawRect(bRect);
|
||||
|
||||
// Draw the text:
|
||||
//painter.setPen(QPen(Qt::black));
|
||||
painter.setPen(textColor);
|
||||
painter.drawText(helpRect, Qt::AlignCenter, helpTxt);
|
||||
}
|
||||
|
||||
if (!m_selection.isNull()) {
|
||||
// paint selection rect
|
||||
painter.setPen(m_uiColor);
|
||||
@@ -163,6 +196,7 @@ void CaptureWidget::paintEvent(QPaintEvent *) {
|
||||
}
|
||||
|
||||
void CaptureWidget::mousePressEvent(QMouseEvent *e) {
|
||||
m_showInitialMsg = false;
|
||||
if (e->button() == Qt::RightButton) {
|
||||
m_rightClick = true;
|
||||
setCursor(Qt::ArrowCursor);
|
||||
|
||||
@@ -92,6 +92,7 @@ protected:
|
||||
bool m_newSelection;
|
||||
bool m_grabbing;
|
||||
bool m_onButton;
|
||||
bool m_showInitialMsg;
|
||||
|
||||
// naming convention for handles
|
||||
// T top, B bottom, R Right, L left
|
||||
|
||||
Binary file not shown.
@@ -167,7 +167,16 @@
|
||||
<context>
|
||||
<name>CaptureWidget</name>
|
||||
<message>
|
||||
<location filename="../src/capture/capturewidget.cpp" line="386"/>
|
||||
<location filename="../src/capture/capturewidget.cpp" line="155"/>
|
||||
<source>Select an area with the mouse, or press Esc to exit.
|
||||
Press Enter to capture the screen.
|
||||
Press Right Click to choose the tool color.</source>
|
||||
<translation>Selecciona un área con el ratón, or presiona Esc para salir.
|
||||
Presiona Enter para capturar la pantalla.
|
||||
Presiona Click Derecho para elegir color de herramienta.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/capture/capturewidget.cpp" line="425"/>
|
||||
<source>Uploading image...</source>
|
||||
<translation>Subiendo imagen...</translation>
|
||||
</message>
|
||||
@@ -331,24 +340,24 @@
|
||||
<translation>Selecciona un Botón para modificarlo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="93"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="96"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="94"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="97"/>
|
||||
<source>Main Color</source>
|
||||
<translation>Color Principal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="97"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="98"/>
|
||||
<source>Click on this button to set the edition mode of the main color.</source>
|
||||
<translation>Clica en este botón para aplicar el modo edición para el color primario.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="112"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="115"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="118"/>
|
||||
<source>Contrast Color</source>
|
||||
<translation>Color de Contraste</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="116"/>
|
||||
<location filename="../src/config/uicoloreditor.cpp" line="119"/>
|
||||
<source>Click on this button to set the edition mode of the contrast color.</source>
|
||||
<translation>Clica en este botón para aplicar el modo edición para el color de contraste.</translation>
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user