diff options
author | Ken Moore <ken@ixsystems.com> | 2016-11-28 15:00:30 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-11-28 15:00:30 -0500 |
commit | 1567c8875ea5473a9c7e2c3fbd0537fe944b9778 (patch) | |
tree | 52ca0e313d91b96667b9b9c6d5a3b4a2aff1a288 /src-qt5/desktop-utils/lumina-screenshot | |
parent | Fix up the regular expression strip of the ZFS snapshot from the full path. (diff) | |
download | lumina-1567c8875ea5473a9c7e2c3fbd0537fe944b9778.tar.gz lumina-1567c8875ea5473a9c7e2c3fbd0537fe944b9778.tar.bz2 lumina-1567c8875ea5473a9c7e2c3fbd0537fe944b9778.zip |
Add a small 1/5 second delay between the zoom slider changing and the actual update of the zoom level (prevent flickering and seizures from rapidly changing the slider).
Diffstat (limited to 'src-qt5/desktop-utils/lumina-screenshot')
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 11 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-screenshot/MainUI.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index 9dd6c9d3..ac17ee3e 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -26,6 +26,9 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->spin_monitor->setEnabled(false); ui->radio_monitor->setEnabled(false); } + scaleTimer = new QTimer(this); + scaleTimer->setSingleShot(true); + scaleTimer->setInterval(200); //~1/5 second //Setup the connections connect(ui->tool_save, SIGNAL(clicked()), this, SLOT(saveScreenshot()) ); @@ -38,7 +41,8 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ connect(ui->tool_crop, SIGNAL(clicked()), IMG, SLOT(cropImage()) ); 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(imgScalingChanged()) ); + connect(ui->slider_zoom, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged()) ); + connect(scaleTimer, SIGNAL(timeout()), this, SLOT(imgScalingChanged()) ); settings = new QSettings("lumina-desktop", "lumina-screenshot",this); if(settings->value("screenshot-target", "window").toString() == "window") { @@ -130,6 +134,11 @@ void MainUI::imgScalingChanged(int percent){ ui->label_zoom_percent->setText( QString::number(ui->slider_zoom->value())+"%"); } +void MainUI::sliderChanged(){ + ui->label_zoom_percent->setText( QString::number(ui->slider_zoom->value())+"%"); + scaleTimer->start(); +} + bool MainUI::getWindow(){ //Use this function to set cwin cwin = 0; diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h index f7319541..bb1b61df 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.h +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.h @@ -46,6 +46,7 @@ private: WId cwin; //current window to screenshot QSettings *settings; LXCB *XCB; //Library access to window subsystems + QTimer *scaleTimer; //Image Editor widget ImageEditor *IMG; @@ -65,6 +66,7 @@ private slots: void imgselchanged(bool hassel); void imgScalingChanged(int percent = -1); + void sliderChanged(); //Utility functions to perform a screenshot bool getWindow(); //set the "cwin" variable as appropriate |