summary refs log tree commit diff
path: root/src/dialogs
diff options
context:
space:
mode:
authorredsky17 <rubberduckie3554@gmail.com>2019-01-30 18:01:36 -0500
committerredsky17 <rubberduckie3554@gmail.com>2019-01-30 18:01:36 -0500
commit6d629f1c908d46cf2b22473ecd0039a8029d8cde (patch)
treea49c7e7936ecd1d093d2b3399a7a21021c5e1279 /src/dialogs
parentRestore Emoji Picker, but remove forcing EmojiOne (diff)
downloadnheko-6d629f1c908d46cf2b22473ecd0039a8029d8cde.tar.xz
Add download button to ImageOverlay
When opening images in the full-screen overlay, there is now
a download button next to the close button.  This button utilizes
the same functionality as the right-click->save image button.
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/ImageOverlay.cpp10
-rw-r--r--src/dialogs/ImageOverlay.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/dialogs/ImageOverlay.cpp b/src/dialogs/ImageOverlay.cpp

index b40aa164..dbf5bbe4 100644 --- a/src/dialogs/ImageOverlay.cpp +++ b/src/dialogs/ImageOverlay.cpp
@@ -76,6 +76,8 @@ ImageOverlay::paintEvent(QPaintEvent *event) content_ = QRect(outer_margin + diff_x / 2, diff_y / 2, image_.width(), image_.height()); close_button_ = QRect(screen_.width() - margin - buttonSize, margin, buttonSize, buttonSize); + save_button_ = + QRect(screen_.width() - (2 * margin) - (2 * buttonSize), margin, buttonSize, buttonSize); // Draw main content_. painter.drawPixmap(content_, image_); @@ -91,6 +93,12 @@ ImageOverlay::paintEvent(QPaintEvent *event) painter.setPen(pen); painter.drawLine(center - QPointF(15, 15), center + QPointF(15, 15)); painter.drawLine(center + QPointF(15, -15), center - QPointF(15, -15)); + + // Draw download button + center = save_button_.center(); + painter.drawLine(center - QPointF(0, 15), center + QPointF(0, 15)); + painter.drawLine(center - QPointF(15, 0), center + QPointF(0, 15)); + painter.drawLine(center + QPointF(0, 15), center + QPointF(15, 0)); } void @@ -101,6 +109,8 @@ ImageOverlay::mousePressEvent(QMouseEvent *event) if (close_button_.contains(event->pos())) emit closing(); + else if (save_button_.contains(event->pos())) + emit saving(); else if (!content_.contains(event->pos())) emit closing(); } diff --git a/src/dialogs/ImageOverlay.h b/src/dialogs/ImageOverlay.h
index b4d42acb..26257fc1 100644 --- a/src/dialogs/ImageOverlay.h +++ b/src/dialogs/ImageOverlay.h
@@ -35,6 +35,7 @@ protected: signals: void closing(); + void saving(); private: QPixmap originalImage_; @@ -42,6 +43,7 @@ private: QRect content_; QRect close_button_; + QRect save_button_; QRect screen_; }; } // dialogs