From 469c6cd20edc1e820b44065b4df67dfd3ac6cbc2 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Wed, 31 May 2017 17:34:46 +0200 Subject: [PATCH] Add help message in capture --- src/capture/capturewidget.cpp | 36 ++++++++++++++++++++++++- src/capture/capturewidget.h | 1 + translation/Internationalization_es.qm | Bin 7466 -> 0 bytes translation/Internationalization_es.ts | 21 ++++++++++----- 4 files changed, 51 insertions(+), 7 deletions(-) delete mode 100644 translation/Internationalization_es.qm diff --git a/src/capture/capturewidget.cpp b/src/capture/capturewidget.cpp index 266dca59..7a60a330 100644 --- a/src/capture/capturewidget.cpp +++ b/src/capture/capturewidget.cpp @@ -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); diff --git a/src/capture/capturewidget.h b/src/capture/capturewidget.h index 69ab4296..42e2fab1 100644 --- a/src/capture/capturewidget.h +++ b/src/capture/capturewidget.h @@ -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 diff --git a/translation/Internationalization_es.qm b/translation/Internationalization_es.qm deleted file mode 100644 index fb386e8f5486d169e7464f850dfb8f228fd0fad3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7466 zcmc&(Yit}>6+X6i?Ra#-^J(fy}k9`TfT+w&$d2z(;GyqFSVXoGfdR;v(~2uus%K2Rv14Ey}#V{ z)q!_#&ONCwJkpQ#gXtZo&qLpt^lszlc>i45ocJg7-rv6B?XRoYpZj+E>)HnB|8xia^fLB8)Y0>=UZRfgbxgE;k!aN~J3f7=kEr`MOHQvF zBD!wvl8f2H_&(4%S;YS3AMCvUZ7mabSEijx7bi2gH&ub#oulqTEqLlkcD4V{H9Pv9OdC#MSP?RZgAA5 zF}q^uuHuz+#nnw+Gi*ySEYB8iG}EZ$ZPh6xmB>Yu2=z`u*zx4j3=C&ojEI4$@dd+6 zF6_a=D&=`06rZ3nwiRKR6)4*^QC5q(GE*^awNUSwo1v6}4G#WsC_T4DCbwEu0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_YJ+>t+uaiWIUu_+(AjsZ$QuL7$(gp)^Iwl%g@ zL2u$wT3$KIl8*@sL}Y}BaS(CAiDFW2uQ?}jBLXEXfoDvxC9-jl*pbXaI2Yu-6?c7! zguT>{qU?=y>;7q6JjyE+&90gS#j-smk8DB8phMeAZ~t(w0JE4n=V3ozSMUXy6wi!4 z+HjeA@?^jVOXc_iDNed&CNb+(=r}$$a}HJM}YqoN1rqFd7tb^ z0y;AxgpCVAA(H4!fDK_p*m!0nKD(2oRPs7r#XZVrVI0|HFJq3!9o?U9!kuzuG$cOD zWAKx6k~}+f#hAb(CS6|1aBKE(7PvZYbdV`bkN7%~Tbw@uX-sZ-d=U0FGyc*4v+k9Rm7a19IqV&C+rC8YJ-rf)W%5Ek(jWLW29+d&% CaptureWidget - + + 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. + 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. + + + Uploading image... Subiendo imagen... @@ -331,24 +340,24 @@ Selecciona un Botón para modificarlo - - + + Main Color Color Principal - + Click on this button to set the edition mode of the main color. Clica en este botón para aplicar el modo edición para el color primario. - + Contrast Color Color de Contraste - + Click on this button to set the edition mode of the contrast color. Clica en este botón para aplicar el modo edición para el color de contraste.