diff options
author | Ken Moore <moorekou@gmail.com> | 2016-04-28 15:17:50 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-04-28 15:17:50 -0400 |
commit | 5c4080100d32ac17136e5f5d97a693558ff5994a (patch) | |
tree | 4c3e41144a827d4b3bdfdbc73ff48ff3da5702f3 /src-qt5/desktop-utils/lumina-screenshot | |
parent | Add "bool" to the C++ syntax highlighting. (diff) | |
download | lumina-5c4080100d32ac17136e5f5d97a693558ff5994a.tar.gz lumina-5c4080100d32ac17136e5f5d97a693558ff5994a.tar.bz2 lumina-5c4080100d32ac17136e5f5d97a693558ff5994a.zip |
Completely change how lumina-screenshot shows the image a bit. Now it is all QImage based, allows the user to zoom in/out on the screenshot, and crop the image all before saving to disk.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-screenshot')
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/ImageEditor.cpp | 141 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/ImageEditor.h | 72 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 122 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/MainUI.h | 16 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/MainUI.ui | 457 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro | 6 |
6 files changed, 593 insertions, 221 deletions
diff --git a/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.cpp b/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.cpp new file mode 100644 index 00000000..82b549c4 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.cpp @@ -0,0 +1,141 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "ImageEditor.h" + +#include <QPainter> + +// === PUBLIC === +ImageEditor::ImageEditor(QWidget*parent) : QWidget(parent){ + contextMenu = new QMenu(this); + contextMenu->addAction(tr("Zoom In"), this, SLOT(scaleUp()) ); + contextMenu->addAction(tr("Zoom Out"), this, SLOT(scaleDown()) ); + this->setContextMenuPolicy(Qt::CustomContextMenu); + connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu()) ); +} + +ImageEditor::~ImageEditor(){ + +} + +void ImageEditor::LoadImage(QImage img){ + fullIMG = img; + scaledIMG = fullIMG.scaled( defaultSize, Qt::KeepAspectRatio,Qt::SmoothTransformation); + this->update(); //trigger paint event + selRect = QRect(); + emit selectionChanged(false); +} + +void ImageEditor::setDefaultSize(QSize sz){ + defaultSize = sz; + bool change = false; + if(scaledIMG.width() > scaledIMG.height()){ + change = (sz.width() > scaledIMG.width() && sz.width() < fullIMG.width()); //new viewport is larger than the scaled image + }else{ + change = (sz.height() > scaledIMG.height() && sz.height() < fullIMG.height()); //new viewport is larger than the scaled image + } + if(change){ + scaledIMG = fullIMG.scaled( defaultSize, Qt::KeepAspectRatio,Qt::SmoothTransformation); + selRect = QRect(); + emit selectionChanged(false); + this->update(); //trigger paint event + } +} + +bool ImageEditor::hasSelection(){ + return !selRect.isNull(); +} + +QImage ImageEditor::image(){ + return fullIMG; +} + +// === PRIVATE SLOTS === +void ImageEditor::showMenu(){ + contextMenu->popup(QCursor::pos()); +} + +// === PUBLIC SLOTS === +void ImageEditor::scaleUp(int val){ + qreal sf = getScaleFactor(); + sf+= ((qreal) val)/100.0; + if(sf>2){ sf = 2.0; } + rescaleImage(sf); +} + +void ImageEditor::scaleDown(int val){ + qreal sf = getScaleFactor(); + sf-= ((qreal) val)/100.0; + if(sf<0.1){ sf = 0.1; } + rescaleImage(sf); +} + +void ImageEditor::cropImage(){ + if(selRect.isNull()){ return; } + qreal sf = getScaleFactor(); + QRect srect = QRect( qRound(selRect.x()/sf), qRound(selRect.y()/sf), qRound(selRect.width()/sf), qRound(selRect.height()/sf)); + fullIMG = fullIMG.copy(srect); + scaledIMG = fullIMG.scaled( defaultSize, Qt::KeepAspectRatio,Qt::SmoothTransformation); + selRect = QRect(); + emit selectionChanged(false); + this->update(); //trigger paint event +} + +void ImageEditor::resizeImage(){ + //TO-DO + selRect = QRect(); + emit selectionChanged(false); +} + +// === PROTECTED === +void ImageEditor::mousePressEvent(QMouseEvent *ev){ + selRect = QRect(); //reset it + emit selectionChanged(false); + selPoint = ev->pos(); //widget-relative coords +} + +void ImageEditor::mouseMoveEvent(QMouseEvent *ev){ + if( !this->geometry().contains(ev->pos()) ){ selRect = QRect(); } + else if(selPoint.x() < ev->pos().x()){ + if(selPoint.y() < ev->pos().y()){ + //init point is upper-left corner + selRect = QRect(selPoint, ev->pos()); + }else{ + //init point is lower-left corner + selRect.setBottomLeft(selPoint); + selRect.setTopRight(ev->pos()); + } + }else{ + if(selPoint.y() < ev->pos().y()){ + //init point is upper-right corner + selRect.setBottomLeft(ev->pos()); + selRect.setTopRight(selPoint); + }else{ + //init point is lower-right corner + selRect = QRect(ev->pos(), selPoint); + } + } + this->update(); +} + +void ImageEditor::mouseReleaseEvent(QMouseEvent*){ + emit selectionChanged( !selRect.isNull() ); + this->update(); +} + +void ImageEditor::paintEvent(QPaintEvent*){ + //ensure the widget is large enough to show the whole scaled image + if(this->size()!=scaledIMG.size()){ + this->setFixedSize(scaledIMG.size()); + this->update(); + return; + } + QPainter P(this); + //Draw the image + P.drawImage(QPoint(0,0), scaledIMG); + //Now draw the selection rectangle over the top + if(!selRect.isNull()){ P.fillRect(selRect, QBrush(Qt::CrossPattern)); } +} diff --git a/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.h b/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.h new file mode 100644 index 00000000..58a16e56 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.h @@ -0,0 +1,72 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is a simple widget for viewing a QImage and allowing the user to +// highlight/select portions of the image with possible actions on the selection +//=========================================== +#ifndef _LUMINA_SCREENSHOT_IMAGE_EDITOR_H +#define _LUMINA_SCREENSHOT_IMAGE_EDITOR_H + +#include <QImage> +#include <QWidget> +#include <QRect> +#include <QMouseEvent> +#include <QPaintEvent> +#include <QMenu> + +class ImageEditor : public QWidget{ + Q_OBJECT +public: + ImageEditor(QWidget*parent = 0); + ~ImageEditor(); + + void LoadImage(QImage img); + void setDefaultSize(QSize sz); + bool hasSelection(); + QImage image(); + +private: + QImage fullIMG, scaledIMG; //Note: the aspect ratio between the two images must be preserved!! + QSize defaultSize; //for loading new images + QRect selRect; //selection rectangle (scaledIMG coordinates) + QPoint selPoint; //initial selection point (used during click/drags) + QMenu *contextMenu; + + //simplification functions + qreal getScaleFactor(){ + //return the scale factor between the full/scaled images + return ( ( (qreal) scaledIMG.height()) / ( (qreal) fullIMG.height()) ); + } + + void rescaleImage(qreal scfactor){ + if(fullIMG.isNull()){ return; } + scaledIMG = fullIMG.scaled( fullIMG.width()*scfactor, fullIMG.height()*scfactor, Qt::KeepAspectRatio,Qt::SmoothTransformation); + selRect = QRect(); + emit selectionChanged(false); + this->update(); //trigger a repaint event + } + +private slots: + void showMenu(); + +public slots: + void scaleUp(int val = 10); //10% change by default + void scaleDown(int val = 10); //10% change by default + + void cropImage(); + void resizeImage(); + +protected: + void mousePressEvent(QMouseEvent *ev); + void mouseMoveEvent(QMouseEvent *ev); + void mouseReleaseEvent(QMouseEvent *); + void paintEvent(QPaintEvent*); + +signals: + void selectionChanged(bool); //true if there is a selection + +}; +#endif diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index c59b324f..f6b89a03 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -11,13 +11,13 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); //load the designer file + mousegrabbed = false; XCB = new LXCB(); - cpic = QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId()); //initial screenshot + IMG = new ImageEditor(this); + ui->scrollArea->setWidget(IMG); + ui->tabWidget->setCurrentWidget(ui->tab_view); ppath = QDir::homePath(); - QWidget *spacer = new QWidget(); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - ui->toolBar->insertWidget(ui->actionQuit, spacer); - + setupIcons(); ui->spin_monitor->setMaximum(QApplication::desktop()->screenCount()); if(ui->spin_monitor->maximum()<2){ @@ -26,93 +26,105 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ } //Setup the connections - connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveScreenshot()) ); - connect(ui->actionquicksave, SIGNAL(triggered()), this, SLOT(quicksave()) ); - connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(closeApplication()) ); - connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(startScreenshot()) ); - connect(ui->actionEdit, SIGNAL(triggered()), this, SLOT(editScreenshot()) ); + connect(ui->tool_save, SIGNAL(clicked()), this, SLOT(saveScreenshot()) ); + connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveScreenshot()) ); + connect(ui->tool_quicksave, SIGNAL(clicked()), this, SLOT(quicksave()) ); + connect(ui->actionQuick_Save, SIGNAL(triggered()), this, SLOT(quicksave()) ); + connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeApplication()) ); + 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(IMG, SIGNAL(selectionChanged(bool)), this, SLOT(imgselchanged(bool)) ); - QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); + //QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); settings = new QSettings("LuminaDE", "lumina-screenshot",this); - if(settings->value("screenshot-target", "window").toString() == "window") { ui->radio_window->setChecked(true); }else{ ui->radio_all->setChecked(true); } - ui->spin_delay->setValue(settings->value("screenshot-delay", 0).toInt()); + ui->tool_resize->setVisible(false); //not implemented yet this->show(); - ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); + IMG->setDefaultSize(ui->scrollArea->maximumViewportSize()); + IMG->LoadImage( QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId()).toImage() ); //initial screenshot + //ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); } MainUI::~MainUI(){} void MainUI::setupIcons(){ //Setup the icons - ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); - ui->actionquicksave->setIcon( LXDG::findIcon("document-save","") ); - ui->actionQuit->setIcon( LXDG::findIcon("application-exit","") ); - ui->actionNew->setIcon( LXDG::findIcon("camera-web","") ); - ui->actionEdit->setIcon( LXDG::findIcon("applications-graphics","") ); + ui->tabWidget->setTabIcon(0, LXDG::findIcon("camera-web","") ); + ui->tabWidget->setTabIcon(1, LXDG::findIcon("view-preview","") ); + 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->actionTake_Screenshot->setIcon( LXDG::findIcon("camera-web","") ); + ui->tool_crop->setIcon( LXDG::findIcon("transform-crop","") ); + ui->tool_resize->setIcon( LXDG::findIcon("transform-scale.png") ); + //ui->actionEdit->setIcon( LXDG::findIcon("applications-graphics","") ); } //============== // PRIVATE SLOTS //============== void MainUI::saveScreenshot(){ + if(mousegrabbed){ return; } QString filepath = QFileDialog::getSaveFileName(this, tr("Save Screenshot"), ppath, tr("PNG Files (*.png);;AllFiles (*)") ); if(filepath.isEmpty()){ return; } if(!filepath.endsWith(".png")){ filepath.append(".png"); } - cpic.save(filepath, "png"); + IMG->image().save(filepath, "png"); ppath = filepath; } void MainUI::quicksave(){ + if(mousegrabbed){ return; } QString savedir = QDir::homePath() + "/Pictures/"; QString path = savedir + QString( "Screenshot-%1.png" ).arg( QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss") ); - cpic.save(path, "png"); -} - -void MainUI::editScreenshot(){ - QString tmppath = QString("/tmp/screenshot.png"); - cpic.save(tmppath, "png"); - QProcess::startDetached("lumina-open /tmp/screenshot.png"); + IMG->image().save(path, "png"); + QProcess::startDetached("lumina-open \""+path+"\""); } void MainUI::startScreenshot(){ + if(mousegrabbed){ return; } + lastgeom = this->geometry(); if( !getWindow() ){ return; } this->hide(); QTimer::singleShot(50+ui->spin_delay->value()*1000, this, SLOT(getPixmap())); } +void MainUI::imgselchanged(bool hassel){ + ui->tool_crop->setEnabled(hassel); + ui->tool_resize->setEnabled(hassel); +} + bool MainUI::getWindow(){ //Use this function to set cwin cwin = 0; + //Save all the current settings for later + settings->setValue("screenshot-delay", ui->spin_delay->value()); if(ui->radio_window->isChecked()){ settings->setValue("screenshot-target", "window"); - //Use xprop to get the desired window from the user - QList<WId> wins = XCB->WindowList(); - wins.removeAll(this->winId()); //don't show this window - QStringList names; - for(int i=0; i<wins.length(); i++){ - names << XCB->WindowClass(wins[i])+" ("+XCB->WindowName(wins[i])+")"; - } - bool ok = false; - QString info = QInputDialog::getItem(this, tr("Select Window"), tr("Window:"), names, 0, false, &ok); - if(!ok || names.indexOf(info)<0){ return false; } //cancelled - cwin = wins[ names.indexOf(info) ]; + this->grabMouse( QCursor(Qt::CrossCursor) ); + mousegrabbed = true; + this->centralWidget()->setEnabled(false); + //this->hide(); + return false; //wait for the next click to continue }else if(ui->radio_monitor->isChecked()){ - + //will auto-grab the proper monitor later }else{ settings->setValue("screenshot-target", "desktop"); } - settings->setValue("screenshot-delay", ui->spin_delay->value()); return true; } void MainUI::getPixmap(){ QScreen *scrn = QApplication::screens().at(0); + QPixmap cpic; if( (cwin==0 && ui->radio_window->isChecked() ) || ui->radio_all->isChecked() ){ //Grab the whole screen cpic = scrn->grabWindow(QApplication::desktop()->winId()); @@ -129,6 +141,34 @@ void MainUI::getPixmap(){ } } this->show(); + this->setGeometry(lastgeom); + ui->tabWidget->setCurrentWidget(ui->tab_view); //view it right now //Now display the pixmap on the label as well - ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); + IMG->LoadImage( cpic.toImage() ); +} + +void MainUI::mouseReleaseEvent(QMouseEvent *ev){ + if(mousegrabbed){ + mousegrabbed = false; + this->centralWidget()->setEnabled(true); + this->releaseMouse(); + //In the middle of selecting a window to take a screenshot + // Get the window underneath the mouse click and take the screenshot + QList<WId> wins = XCB->WindowList(); + cwin = 0; + //qDebug() << "Try to select window:" << ev->globalPos(); + for(int i=0; i<wins.length() && cwin==0; i++){ + if( XCB->WindowGeometry(wins[i], true).contains(ev->globalPos()) ){ cwin = wins[i]; } + } + qDebug() << " - Got window:" << cwin; + if(cwin==this->winId()){ return; } //cancelled + this->hide(); + QTimer::singleShot(50+ui->spin_delay->value()*1000, this, SLOT(getPixmap())); + }else{ + QMainWindow::mouseReleaseEvent(ev); //normal processing + } +} + +void MainUI::resizeEvent(QResizeEvent*){ + IMG->setDefaultSize( ui->scrollArea->maximumViewportSize() ); } diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h index db0672da..853fb194 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h @@ -23,6 +23,8 @@ #include <LuminaUtils.h> #include <LuminaX11.h> +#include "ImageEditor.h" + namespace Ui{ class MainUI; }; @@ -38,12 +40,16 @@ public slots: private: Ui::MainUI *ui; - QPixmap cpic; //current picture + bool mousegrabbed; + QRect lastgeom; QString ppath; //previous file path WId cwin; //current window to screenshot QSettings *settings; LXCB *XCB; //Library access to window subsystems + //Image Editor widget + ImageEditor *IMG; + private slots: //Button Slots void closeApplication(){ @@ -51,13 +57,17 @@ private slots: } void saveScreenshot(); void quicksave(); - void editScreenshot(); - void startScreenshot(); + void startScreenshot(); + void imgselchanged(bool hassel); //Utility functions to perform a screenshot bool getWindow(); //set the "cwin" variable as appropriate void getPixmap(); //set the "cpic" variable to the new screenshot + +protected: + void mouseReleaseEvent(QMouseEvent *ev); + void resizeEvent(QResizeEvent *ev); }; #endif diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui b/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui index e8a19727..db1c0cee 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui @@ -15,212 +15,319 @@ </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item> - <widget class="QLabel" name="label_screenshot"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>1</number> </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string>No Screenshot Yet</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="group_new"> - <property name="title"> - <string>New Screenshot Settings</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="topMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <property name="spacing"> - <number>2</number> - </property> - <item row="3" column="1"> - <widget class="QCheckBox" name="check_frame"> - <property name="text"> - <string>Include Borders</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QSpinBox" name="spin_delay"> - <property name="suffix"> - <string> Seconds</string> - </property> - <property name="prefix"> - <string>Delay </string> - </property> - <property name="maximum"> - <number>20</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QRadioButton" name="radio_all"> - <property name="text"> - <string>Entire Session</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QRadioButton" name="radio_window"> - <property name="text"> - <string>Single Window</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QRadioButton" name="radio_monitor"> - <property name="text"> - <string>Single Screen</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QSpinBox" name="spin_monitor"> - <property name="prefix"> - <string notr="true"># </string> + <widget class="QWidget" name="tab_settings"> + <attribute name="title"> + <string>New Screenshot</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="group_settings"> + <property name="title"> + <string>Settings</string> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <property name="horizontalSpacing"> + <number>3</number> </property> - <property name="minimum"> - <number>1</number> + <property name="verticalSpacing"> + <number>3</number> </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> + <property name="rightMargin"> + <number>0</number> </property> - </spacer> - </item> - </layout> - </item> - </layout> + <property name="bottomMargin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QRadioButton" name="radio_all"> + <property name="text"> + <string>Entire Session</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="radio_monitor"> + <property name="text"> + <string>Single Screen</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QRadioButton" name="radio_window"> + <property name="text"> + <string>Single Window</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="spin_monitor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="prefix"> + <string notr="true"># </string> + </property> + <property name="minimum"> + <number>1</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="check_frame"> + <property name="text"> + <string>Include Borders</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QSpinBox" name="spin_delay"> + <property name="suffix"> + <string> Seconds</string> + </property> + <property name="prefix"> + <string>Delay </string> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="push_snap"> + <property name="text"> + <string>Take Screenshot</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_view"> + <attribute name="title"> + <string>View/Edit</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>3</number> + </property> + <property name="leftMargin"> + <number>1</number> + </property> + <property name="topMargin"> + <number>1</number> + </property> + <property name="rightMargin"> + <number>1</number> + </property> + <property name="bottomMargin"> + <number>1</number> + </property> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>341</width> + <height>171</height> + </rect> + </property> + </widget> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QToolButton" name="tool_save"> + <property name="text"> + <string>Save As</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_quicksave"> + <property name="text"> + <string>Launch Editor</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="tool_crop"> + <property name="text"> + <string>Crop</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_resize"> + <property name="text"> + <string>Resize</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> </widget> </item> </layout> </widget> <widget class="QStatusBar" name="statusbar"/> - <widget class="QToolBar" name="toolBar"> - <property name="contextMenuPolicy"> - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="windowTitle"> - <string>toolBar</string> - </property> - <property name="movable"> - <bool>false</bool> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>349</width> + <height>23</height> + </rect> </property> - <property name="iconSize"> - <size> - <width>24</width> - <height>24</height> - </size> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionTake_Screenshot"/> + <addaction name="separator"/> + <addaction name="actionSave_As"/> + <addaction name="actionQuick_Save"/> + <addaction name="separator"/> + <addaction name="actionClose"/> + </widget> + <addaction name="menuFile"/> + </widget> + <action name="actionTake_Screenshot"> + <property name="text"> + <string>Take Screenshot</string> </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextUnderIcon</enum> + <property name="shortcut"> + <string>Ctrl+N</string> </property> - <property name="floatable"> - <bool>false</bool> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> </property> - <attribute name="toolBarArea"> - <enum>TopToolBarArea</enum> - </attribute> - <attribute name="toolBarBreak"> - <bool>false</bool> - </attribute> - <addaction name="actionNew"/> - <addaction name="actionSave"/> - <addaction name="actionquicksave"/> - <addaction name="actionEdit"/> - <addaction name="actionQuit"/> - </widget> - <action name="actionSave"> + </action> + <action name="actionSave_As"> <property name="text"> - <string>Save</string> - </property> - <property name="toolTip"> - <string>Save Screenshot</string> - </property> - <property name="statusTip"> - <string>Save Screenshot</string> + <string>Save As</string> </property> <property name="shortcut"> <string>Ctrl+S</string> </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> </action> - <action name="actionquicksave"> + <action name="actionQuick_Save"> <property name="text"> <string>Quick Save</string> </property> - <property name="toolTip"> - <string>Quick Save Screenshot</string> - </property> - <property name="statusTip"> - <string>Quick Save Screenshot</string> - </property> - <property name="shortcut"> - <string>Ctrl+Shift+S</string> - </property> </action> - <action name="actionEdit"> + <action name="actionClose"> <property name="text"> - <string>Edit</string> - </property> - <property name="toolTip"> - <string>Edit Screenshot</string> - </property> - <property name="statusTip"> - <string>Edit Screenshot</string> + <string>Close</string> </property> <property name="shortcut"> - <string>Ctrl+E</string> + <string>Esc</string> </property> - </action> - <action name="actionQuit"> - <property name="text"> - <string>Quit</string> - </property> - <property name="statusTip"> - <string>Quit</string> - </property> - <property name="shortcut"> - <string>Ctrl+Q</string> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> </property> </action> - <action name="actionNew"> - <property name="text"> - <string>Snap</string> - </property> - <property name="statusTip"> - <string>Take new Screenshot</string> - </property> -</action> </widget> <resources/> <connections/> diff --git a/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro b/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro index 716d2ece..eb33107c 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro +++ b/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro @@ -10,9 +10,11 @@ target.path = $${L_BINDIR} TEMPLATE = app SOURCES += main.cpp \ - MainUI.cpp + MainUI.cpp \ + ImageEditor.cpp -HEADERS += MainUI.h +HEADERS += MainUI.h \ + ImageEditor.h FORMS += MainUI.ui |