1 //=========================================== 2 // Lumina-DE source code 3 // Copyright (c) 2014-2015, Ken Moore 4 // Available under the 3-clause BSD license 5 // See the LICENSE file for full details 6 //=========================================== 7 #ifndef _LUMINA_SCREENSHOT_DIALOG_H 8 #define _LUMINA_SCREENSHOT_DIALOG_H 9 10 #include <QMainWindow> 11 #include <QString> 12 #include <QFileDialog> 13 #include <QPixmap> 14 #include <QTimer> 15 #include <QDesktopWidget> 16 #include <QDir> 17 #include <QInputDialog> 18 #include <QSettings> 19 #include <QAction> 20 #include <QScreen> 21 #include <QTabBar> 22 #include <QShortcut> 23 24 #include <LuminaXDG.h> 25 #include <LUtils.h> 26 #include <LuminaX11.h> 27 28 #include "ImageEditor.h" 29 30 namespace Ui{ 31 class MainUI; 32 }; 33 34 class MainUI : public QMainWindow{ 35 Q_OBJECT 36 public: 37 MainUI(); 38 ~MainUI(); 39 40 public slots: 41 void setupIcons(); 42 43 private: 44 Ui::MainUI *ui; 45 bool mousegrabbed, picSaved, closeOnSave; 46 QRect lastgeom, snapArea; 47 QPoint pt_click; //used for area click/release mapping to a snapArea 48 QWidget *areaOverlay; 49 QString ppath; //previous file path 50 WId cwin; //current window to screenshot 51 QSettings *settings; 52 LXCB *XCB; //Library access to window subsystems 53 QTimer *scaleTimer; 54 QTabBar *tabbar; 55 56 //Image Editor widget 57 ImageEditor *IMG; 58 QDateTime lastScreenShot; 59 60 void showSaveError(QString path); 61 62 QRect pointsToRect(QPoint pt1, QPoint pt2); 63 64 QShortcut *quitShortcut, *openShortcut; 65 void showSBMessage(QString msg, int secs); 66 67 private slots: 68 //Button Slots closeApplication()69 void closeApplication(){ 70 this->close(); 71 } 72 void saveScreenshot(); 73 void quicksave(); 74 void copyToClipboard(); 75 76 void startScreenshot(); 77 78 void imgselchanged(bool hassel); 79 void imgScalingChanged(int percent = -1); 80 void sliderChanged(); 81 82 void tabChanged(int); 83 void showPopupsChanged(bool); 84 85 //Utility functions to perform a screenshot 86 bool getWindow(); //set the "cwin" variable as appropriate 87 void getPixmap(); //set the "cpic" variable to the new screenshot 88 89 void quitShortcut_activated(); 90 91 protected: 92 void mousePressEvent(QMouseEvent *ev); 93 void mouseMoveEvent(QMouseEvent *ev); 94 void mouseReleaseEvent(QMouseEvent *ev); 95 void resizeEvent(QResizeEvent *ev); 96 void closeEvent( QCloseEvent *ev); 97 }; 98 99 #endif 100