From 31cb69bd2ae39544c893d3ca5c3bdc23b464701c Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 3 Feb 2017 11:24:52 -0500 Subject: Clean up a bit more of the lumina-screenshot interface, and add a button to copy the current image to the clipboard (tied in to the ctrl-C shortcut as well) --- src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 16 ++++-- src-qt5/desktop-utils/lumina-screenshot/MainUI.h | 1 + src-qt5/desktop-utils/lumina-screenshot/MainUI.ui | 57 +++++++++++++++++++--- 3 files changed, 63 insertions(+), 11 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index 40c9857b..2c5dc700 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -9,7 +9,7 @@ #include #include - +#include MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); //load the designer file @@ -30,7 +30,8 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ scaleTimer->setSingleShot(true); scaleTimer->setInterval(200); //~1/5 second tabbar = new QTabBar(this); - ui->tabLayout->insertWidget(0,tabbar); + tabbar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + ui->tabLayout->insertWidget(0,tabbar, Qt::AlignLeft | Qt::AlignBottom); tabbar->addTab(LXDG::findIcon("view-preview",""), tr("View")); tabbar->addTab(LXDG::findIcon("preferences-other",""), tr("Settings")); ui->stackedWidget->setCurrentWidget(ui->page_current); @@ -47,6 +48,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //connect(ui->push_snap, SIGNAL(clicked()), this, SLOT(startScreenshot()) ); connect(ui->actionTake_Screenshot, SIGNAL(triggered()), this, SLOT(startScreenshot()) ); connect(ui->tool_crop, SIGNAL(clicked()), IMG, SLOT(cropImage()) ); + connect(ui->tool_copy_to_clipboard, SIGNAL(clicked()), this, SLOT(copyToClipboard()) ); connect(IMG, SIGNAL(selectionChanged(bool)), this, SLOT(imgselchanged(bool)) ); connect(IMG, SIGNAL(scaleFactorChanged(int)), this, SLOT(imgScalingChanged(int)) ); connect(ui->slider_zoom, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged()) ); @@ -74,16 +76,14 @@ MainUI::~MainUI(){} void MainUI::setupIcons(){ //Setup the icons - //ui->tool_save->setIcon( LXDG::findIcon("document-save","") ); ui->tool_quicksave->setIcon( LXDG::findIcon("document-edit","") ); ui->actionSave_As->setIcon( LXDG::findIcon("document-save-as","") ); ui->actionQuick_Save->setIcon( LXDG::findIcon("document-save","") ); ui->actionClose->setIcon( LXDG::findIcon("application-exit","") ); - //ui->push_snap->setIcon( LXDG::findIcon("camera-web","") ); + ui->tool_copy_to_clipboard->setIcon( LXDG::findIcon("insert-image","") ); ui->actionTake_Screenshot->setIcon( LXDG::findIcon("camera-web","") ); ui->tool_crop->setIcon( LXDG::findIcon("transform-crop","") ); ui->tool_resize->setIcon( LXDG::findIcon("transform-scale","") ); - //ui->actionEdit->setIcon( LXDG::findIcon("applications-graphics","") ); this->setWindowIcon( LXDG::findIcon("camera-web","") ); } @@ -121,6 +121,12 @@ void MainUI::quicksave(){ } } +void MainUI::copyToClipboard(){ + qDebug() << "Copy Image to clipboard"; + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setImage(IMG->image()); + qDebug() << " - Success:" << !clipboard->image().isNull(); +} void MainUI::startScreenshot(){ if(mousegrabbed){ return; } diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h index 396bfafe..5ff496a5 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h @@ -63,6 +63,7 @@ private slots: } void saveScreenshot(); void quicksave(); + void copyToClipboard(); void startScreenshot(); diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui b/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui index cddee009..0c70d3d8 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui @@ -6,8 +6,8 @@ 0 0 - 386 - 288 + 480 + 318 @@ -54,7 +54,7 @@ - QFrame::NoFrame + QFrame::StyledPanel QFrame::Raised @@ -83,12 +83,44 @@ 0 + + Open screenshot with an application + - Open With... + Open Qt::ToolButtonTextBesideIcon + + true + + + + + + + Copy screenshot to clipboard + + + Copy + + + Ctrl+C + + + Qt::ToolButtonTextBesideIcon + + + true + + + + + + + Qt::Vertical + @@ -99,12 +131,18 @@ 0 + + Resize screenshot to selection + Resize Qt::ToolButtonTextBesideIcon + + true + @@ -115,12 +153,18 @@ 0 + + Crop screenshot to selection + &Crop Qt::ToolButtonTextBesideIcon + + true + @@ -210,8 +254,8 @@ 0 0 - 344 - 216 + 439 + 230 @@ -466,6 +510,7 @@ + Capture -- cgit From 2f7d913989fbc4421b5ade96a6015e319eae86b3 Mon Sep 17 00:00:00 2001 From: Trenton Schulz Date: Sun, 5 Feb 2017 17:54:13 +0100 Subject: Better messageboxes for closing the screenshot app. Instead of a Yes/No question that requires you to read the text of the message box and decide what to do, let's give the buttons good names so we know what the command will do. Inspired by hitting "no" multiple times when I accidently hit the shortcut key to take a screenshot. (assuming it was asking "do you want to save"). --- src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 34 ++++++++++++++++++---- src-qt5/desktop-utils/lumina-screenshot/MainUI.h | 2 +- 2 files changed, 29 insertions(+), 7 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index 2c5dc700..25f4cc62 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -11,10 +11,13 @@ #include #include -MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ +MainUI::MainUI() + : QMainWindow(), ui(new Ui::MainUI), + mousegrabbed(false), + picSaved(false), + closeOnSave(false) +{ ui->setupUi(this); //load the designer file - mousegrabbed = false; - picSaved = false; XCB = new LXCB(); IMG = new ImageEditor(this); ui->scrollArea->setWidget(IMG); @@ -96,13 +99,22 @@ void MainUI::showSaveError(QString path){ void MainUI::saveScreenshot(){ if(mousegrabbed){ return; } QString filepath = QFileDialog::getSaveFileName(this, tr("Save Screenshot"), ppath+"/"+QString( "Screenshot-%1.png" ).arg( lastScreenShot.toString("yyyy-MM-dd-hh-mm-ss")), tr("PNG Files (*.png);;AllFiles (*)") ); - if(filepath.isEmpty()){ return; } + if(filepath.isEmpty()){ + closeOnSave = false; + return; + } if(!filepath.endsWith(".png")){ filepath.append(".png"); } if( !IMG->image().save(filepath, "png") ){ + closeOnSave = false; showSaveError(filepath); }else{ picSaved = true; ppath = filepath.section("/",0,-2); //just the directory + if (closeOnSave) { + // We came here from close, now we need to close *after* handling + // the current screen event. + QTimer::singleShot(0, this, SLOT(close())); + } } } @@ -249,8 +261,18 @@ void MainUI::closeEvent(QCloseEvent *ev){ //qDebug() << "Close Event:" << ui->check_show_popups->isChecked() << picSaved; if(ui->check_show_popups->isChecked() && !picSaved){ //Ask what to do about the unsaved changed - if(QMessageBox::Yes != QMessageBox::warning(this, tr("Unsaved Screenshot"), tr("The current screenshot has not been saved yet. Do you want to quit anyway?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ - //cancelled close of window + const int messageRet = QMessageBox::warning(this, tr("Unsaved Screenshot"), + tr("The current screenshot has not been saved yet. Do you want to save or discard your changes?"), + QMessageBox::Discard | QMessageBox::Save |QMessageBox::Cancel, QMessageBox::Cancel); + switch (messageRet) { + case QMessageBox::Discard: + // Just close, we don't care about the file. + break; + case QMessageBox::Save: + closeOnSave = true; + saveScreenshot(); + // fall through + case QMessageBox::Cancel: ev->ignore(); return; } diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h index 5ff496a5..4a18ef74 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h @@ -41,7 +41,7 @@ public slots: private: Ui::MainUI *ui; - bool mousegrabbed, picSaved; + bool mousegrabbed, picSaved, closeOnSave; QRect lastgeom; QString ppath; //previous file path WId cwin; //current window to screenshot -- cgit From 2d8f2ac508af99e6b8196c8dada3574ffdea3767 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 6 Feb 2017 15:49:28 -0500 Subject: Remove the "Quick Save" button in lumina-screenshot. This was just another button/front-end to the "Open With" functionality which did not get removed earlier. --- src-qt5/desktop-utils/lumina-screenshot/MainUI.ui | 1 - 1 file changed, 1 deletion(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui b/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui index 0c70d3d8..f4230ff6 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui @@ -507,7 +507,6 @@ - -- cgit From fcee4213af8c3978716d1d1bb872106af4358364 Mon Sep 17 00:00:00 2001 From: Ettore Atalan Date: Sat, 11 Feb 2017 19:00:19 +0000 Subject: Translated using Weblate (l_SCREENSHOT@de (generated)) Currently translated at 95.8% (23 of 24 strings) --- .../desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts index ab4efacf..5888f671 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts @@ -50,17 +50,17 @@ Sec Delay - + Sek. Verzögerung Capture - + Aufnehmen Edit - + Bearbeiten @@ -100,12 +100,12 @@ Could not save screenshot - + Bildschirmfoto konnte nicht gespeichert werden The screenshot could not be saved. Please check directory permissions or pick a different directory - + Das Bildschirmfoto konnte nicht gespeichert werden. Bitte überprüfen Sie die Verzeichnisberechtigungen oder wählen Sie ein anderes Verzeichnis aus -- cgit From c0a33604092988c8699470947ca8593641b88021 Mon Sep 17 00:00:00 2001 From: scootergrisen Date: Wed, 22 Feb 2017 02:51:01 +0000 Subject: Translated using Weblate (l_SCREENSHOT@da (generated)) Currently translated at 87.5% (21 of 24 strings) --- .../lumina-screenshot/i18n/l-screenshot_da.ts | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts index 7cc9d423..76a05b69 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts @@ -6,12 +6,12 @@ Zoom In - + Zoom ind Zoom Out - + Zoom ud @@ -30,37 +30,37 @@ Save As - + Gem som Crop - + Beskær Resize - + Tilpas størrelse Lumina Screenshot - + Lumina-skærmbillede Sec Delay - + Sek. forsinkelse Capture - + Fang Edit - + Redigér @@ -70,17 +70,17 @@ Ctrl+N - + Ctrl+N Close - + Luk Esc - + Esc @@ -100,7 +100,7 @@ Could not save screenshot - + Kunne ikke gemme skærmbillede -- cgit From 7520960aca8c6571a0406691eafa220f581b1ff9 Mon Sep 17 00:00:00 2001 From: scootergrisen Date: Thu, 23 Feb 2017 01:27:15 +0000 Subject: Translated using Weblate (l_SCREENSHOT@da (generated)) Currently translated at 100.0% (24 of 24 strings) --- src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts index 76a05b69..9267cde8 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts @@ -65,7 +65,7 @@ File - + Fil @@ -80,7 +80,7 @@ Esc - Esc + Esc @@ -105,7 +105,7 @@ The screenshot could not be saved. Please check directory permissions or pick a different directory - + Skærmbilledet kunne ikke gemmes. Tjek venligst mappetilladelserne eller vælg en anden mappe -- cgit From a19bbeed9090d1844f265e3d3969b89e839a0697 Mon Sep 17 00:00:00 2001 From: scootergrisen Date: Thu, 23 Feb 2017 23:18:20 +0000 Subject: Translated using Weblate (l_SCREENSHOT@da (generated)) Currently translated at 100.0% (24 of 24 strings) --- src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts index 9267cde8..5fd60ba2 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts @@ -60,7 +60,7 @@ Edit - Redigér + Rediger @@ -125,7 +125,7 @@ PNG Files (*.png);;AllFiles (*) - PNG Filer (*.png);;AllFiles (*) + PNG-filer (*.png);;Alle filer (*) -- cgit From e7e16599de6912251abd4cae07df553c6ac4dc64 Mon Sep 17 00:00:00 2001 From: Paweł Date: Fri, 24 Feb 2017 14:09:26 +0000 Subject: Translated using Weblate (l_SCREENSHOT@pl (generated)) Currently translated at 91.6% (22 of 24 strings) --- src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_pl.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_pl.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_pl.ts index 9ccca97d..c2dafeda 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_pl.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_pl.ts @@ -45,22 +45,22 @@ Lumina Screenshot - + Zrzut ekranu Lumina Sec Delay - + sekund(y) opoźnienia Capture - + Wykonaj zrzut ekranu Edit - + Edycja -- cgit From ba7a57079a47e9bca2fc35ea379fd0c7db125ed2 Mon Sep 17 00:00:00 2001 From: scootergrisen Date: Sat, 25 Feb 2017 18:07:08 +0000 Subject: Translated using Weblate (l_SCREENSHOT@da (generated)) Currently translated at 100.0% (24 of 24 strings) --- src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot') diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts index 5fd60ba2..ec870f78 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts @@ -19,7 +19,7 @@ Take Screenshot - Gem skærmbillede + Tag skærmbillede -- cgit