From c4849142e8e1d463098a67f4359be593c85a5adb Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Fri, 2 Jun 2017 01:59:43 +0200 Subject: [PATCH] Add rectangle button --- graphics.qrc | 2 + img/buttonIconsBlack/square.png | Bin 0 -> 157 bytes img/buttonIconsBlack/square.svg | 1 + img/buttonIconsWhite/square.png | Bin 0 -> 165 bytes img/buttonIconsWhite/square.svg | 56 ++++++++++++ src/capture/button.cpp | 23 +++-- src/capture/button.h | 1 + src/capture/capturemodification.cpp | 18 ++-- src/capture/screenshot.cpp | 4 + translation/Internationalization_es.ts | 122 +++++++++++++++++-------- 10 files changed, 172 insertions(+), 55 deletions(-) create mode 100644 img/buttonIconsBlack/square.png create mode 100644 img/buttonIconsBlack/square.svg create mode 100644 img/buttonIconsWhite/square.png create mode 100644 img/buttonIconsWhite/square.svg diff --git a/graphics.qrc b/graphics.qrc index 81b9fa0a..d01542fc 100644 --- a/graphics.qrc +++ b/graphics.qrc @@ -33,5 +33,7 @@ img/buttonIconsWhite/pencil.png img/buttonIconsBlack/cursor-move.png img/buttonIconsWhite/cursor-move.png + img/buttonIconsBlack/square.png + img/buttonIconsWhite/square.png diff --git a/img/buttonIconsBlack/square.png b/img/buttonIconsBlack/square.png new file mode 100644 index 0000000000000000000000000000000000000000..e04961b0e9f5a0e8a4529243097151852232cc64 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9F5he4R}c>anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt)=fE{-7{oyiFjtSk)5QvdC@ uo=sgesnO!#3f9G9Jy8Z(5C+pC28Ib&8C7IWZvpLKVDNPHb6Mw<&;$T#d@b?- literal 0 HcmV?d00001 diff --git a/img/buttonIconsBlack/square.svg b/img/buttonIconsBlack/square.svg new file mode 100644 index 00000000..ee8836e6 --- /dev/null +++ b/img/buttonIconsBlack/square.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/buttonIconsWhite/square.png b/img/buttonIconsWhite/square.png new file mode 100644 index 0000000000000000000000000000000000000000..82c2c18cbd705aa24fbe26ec75a98bcc9706f07d GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9F5he4R}c>anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt)ELE{-7{oyiFjtSk)5M$i8P z!OA2JW#v0DYFQE;{5??ySqE3JE*1kbG!%f&a7$%TDc9n-3DnKt>FVdQ&MBb@00Bua A>i_@% literal 0 HcmV?d00001 diff --git a/img/buttonIconsWhite/square.svg b/img/buttonIconsWhite/square.svg new file mode 100644 index 00000000..b5986e3e --- /dev/null +++ b/img/buttonIconsWhite/square.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/capture/button.cpp b/src/capture/button.cpp index 76d4dfdf..70975a26 100644 --- a/src/capture/button.cpp +++ b/src/capture/button.cpp @@ -119,7 +119,7 @@ QIcon Button::getIcon(const Type t, bool isWhite) { case Type::pencil: path += "pencil.png"; break; - case Type::rectangle: + case Type::selection: path += "square-outline.png"; break; case Type::save: @@ -134,6 +134,9 @@ QIcon Button::getIcon(const Type t, bool isWhite) { case Type::move: path += "cursor-move.png"; break; + case Type::rectangle: + path += "square.png"; + break; default: break; } @@ -261,16 +264,17 @@ Button::typeData Button::typeTooltip = { {Button::Type::exit, QT_TR_NOOP("Leaves the capture screen")}, {Button::Type::copy, QT_TR_NOOP("Copies the selecion into the clipboard")}, {Button::Type::save, QT_TR_NOOP("Opens the save image window")}, - {Button::Type::pencil, QT_TR_NOOP("Sets the paint tool to a pencil")}, - {Button::Type::line, QT_TR_NOOP("Sets the paint tool to a line drawer")}, - {Button::Type::arrow, QT_TR_NOOP("Sets the paint tool to an arrow drawer")}, - {Button::Type::rectangle, QT_TR_NOOP("Sets the paint tool to a rectagle drawer")}, - {Button::Type::circle, QT_TR_NOOP("Sets the paint tool to a circle drawer")}, - {Button::Type::marker, QT_TR_NOOP("Sets the paint tool to a marker")}, - {Button::Type::text, QT_TR_NOOP("Sets the paint tool to a text creator")}, + {Button::Type::pencil, QT_TR_NOOP("Sets the Pencil as the paint tool")}, + {Button::Type::line, QT_TR_NOOP("Sets the Line as the paint tool")}, + {Button::Type::arrow, QT_TR_NOOP("Sets the Arrow as the paint tool")}, + {Button::Type::rectangle, QT_TR_NOOP("Sets the Rectangle as the paint tool")}, + {Button::Type::circle, QT_TR_NOOP("Sets the Circle as the paint tool")}, + {Button::Type::marker, QT_TR_NOOP("Sets the Marker as the paint tool")}, + {Button::Type::text, QT_TR_NOOP("Sets the Text as the paint tool")}, {Button::Type::colorPicker, QT_TR_NOOP("Opens the color picker widget")}, {Button::Type::undo, QT_TR_NOOP("Undo the last modification")}, - {Button::Type::imageUploader, QT_TR_NOOP("Upload the selection to Imgur")}, + {Button::Type::imageUploader, QT_TR_NOOP("Uploads the selection to Imgur")}, + {Button::Type::selection, QT_TR_NOOP("Sets the Selection as the paint tool")}, {Button::Type::move, QT_TR_NOOP("Move the selection area")} }; @@ -290,6 +294,7 @@ Button::typeData Button::typeName = { {Button::Type::colorPicker, QT_TR_NOOP("Color Picker")}, {Button::Type::undo, QT_TR_NOOP("Undo")}, {Button::Type::imageUploader, QT_TR_NOOP("Image Uploader")}, + {Button::Type::selection, QT_TR_NOOP("Rectangular Selection")}, {Button::Type::move, QT_TR_NOOP("Move")} }; diff --git a/src/capture/button.h b/src/capture/button.h index 3cf45078..db17a7c4 100644 --- a/src/capture/button.h +++ b/src/capture/button.h @@ -43,6 +43,7 @@ public: undo, imageUploader, move, + selection, last, // used for iteration over the enum text, mouseVisibility, diff --git a/src/capture/capturemodification.cpp b/src/capture/capturemodification.cpp index 5a05de31..77c2d845 100644 --- a/src/capture/capturemodification.cpp +++ b/src/capture/capturemodification.cpp @@ -25,9 +25,12 @@ CaptureModification::CaptureModification(const Button::Type t, const QPoint p, const QColor c) : m_color(c), m_type(t) { m_coords.append(p); - if (m_type == Button::Type::circle || m_type == Button::Type::rectangle - || m_type == Button::Type::arrow || m_type == Button::Type::line || - m_type == Button::Type::marker) { + if (m_type == Button::Type::circle + || m_type == Button::Type::rectangle + || m_type == Button::Type::arrow + || m_type == Button::Type::line + || m_type == Button::Type::marker + || m_type == Button::Type::selection) { m_coords.append(p); } } @@ -49,9 +52,12 @@ QVector CaptureModification::getPoints() const { } // addPoint adds a point to the vector of points void CaptureModification::addPoint(const QPoint p) { - if (m_type == Button::Type::circle || m_type == Button::Type::rectangle - || m_type == Button::Type::arrow || m_type == Button::Type::line || - m_type == Button::Type::marker) { + if (m_type == Button::Type::circle + || m_type == Button::Type::rectangle + || m_type == Button::Type::arrow + || m_type == Button::Type::line + || m_type == Button::Type::marker + || m_type == Button::Type::selection) { m_coords[1] = p; } else { m_coords.append(p); diff --git a/src/capture/screenshot.cpp b/src/capture/screenshot.cpp index 3f5e4c1f..5aab84ce 100644 --- a/src/capture/screenshot.cpp +++ b/src/capture/screenshot.cpp @@ -228,7 +228,11 @@ void Screenshot::paintInPainter(QPainter &painter, case Button::Type::pencil: painter.drawPolyline(points.data(), points.size()); break; + case Button::Type::selection: + painter.drawRect(QRect(points[0], points[1])); + break; case Button::Type::rectangle: + painter.setBrush(QBrush(modification.getColor())); painter.drawRect(QRect(points[0], points[1])); break; default: diff --git a/translation/Internationalization_es.ts b/translation/Internationalization_es.ts index 19fc415f..0937d6cb 100644 --- a/translation/Internationalization_es.ts +++ b/translation/Internationalization_es.ts @@ -4,162 +4,204 @@ Button - + Shows the dimensions of the selection (X Y) - Muestra la dimensión de ls selección (X Y) + Muestra la dimensión de la selección (X Y) - + Sets the visibility of the mouse pointer Selecciona la visibilidad del puntero del ratón - + Leaves the capture screen Cierra la pantalla de captura - + Copies the selecion into the clipboard Copia la selección al portapapeles - + Opens the save image window Abre la ventana de guardar imagen - Sets the paint tool to a pencil - Establece el lápiz como herramienta de dibujo + Establece el lápiz como herramienta de dibujo - Sets the paint tool to a line drawer - Establece la línea como herramienta de dibujo + Establece la línea como herramienta de dibujo - Sets the paint tool to an arrow drawer - Establece la flecha como herramienta de dibujo + Establece la flecha como herramienta de dibujo - Sets the paint tool to a rectagle drawer - Establece el rectángulo como herramienta de dibujo + Establece el rectángulo como herramienta de dibujo - Sets the paint tool to a circle drawer - Establece el círculo como herramienta de dibujo + Establece el círculo como herramienta de dibujo - Sets the paint tool to a marker - Establece el marcador como herramienta de dibujo + Establece el marcador como herramienta de dibujo - Sets the paint tool to a text creator - Establece el texto como herramienta de dibujo + Establece el texto como herramienta de dibujo - + Opens the color picker widget Abre el selector de color - + Undo the last modification Deshace la última modificación - Upload the selection to Imgur + Sube la selección a Imgur + + + + Sets the Pencil as the paint tool + Establece el Lápiz como herramienta de dibujo + + + + Sets the Line as the paint tool + Establece la Línea como herramienta de dibujo + + + + Sets the Arrow as the paint tool + Establece la Flecha como herramienta de dibujo + + + + Sets the Rectangle as the paint tool + Establece el Rectángulo como herramienta de dibujo + + + + Sets the Circle as the paint tool + Establece el Círculo como herramienta de dibujo + + + + Sets the Marker as the paint tool + Establece el Marcador como herramienta de dibujo + + + + Sets the Text as the paint tool + Establece el Texto como herramienta de dibujo + + + + Uploads the selection to Imgur Sube la selección a Imgur - + + Sets the Selection as the paint tool + Establece la Selección como herramienta de dibujo + + + Move the selection area Mueve la selección - + Selection Size Indicator Indicador de Tamaño de Selección - + Mouse Visibility Visibilidad del Ratón - + Exit Salir - + Copy Copiar - + Save Guardar - + Pencil Lápiz - + Line Línea - + Arrow Flecha - + Rectangle Rectángulo - + Circle Círculo - + Marker Marcador - + Text Texto - + Color Picker Selector de Color - + Undo Deshacer - + Image Uploader Subir Imagen - + + Rectangular Selection + Selección Rectangular + + + Move Mover Selección