From 9b2a9129d27e5666c188a4c3488da87cf7bc3a7d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 31 Jul 2017 13:05:40 -0400 Subject: A few updates for lumina-screenshot: When selecting a window/area, make the window transparent. Ensure the single-instance system works for this apps (was not closing new process). --- src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index 2bdd69ae..1cadd4f6 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -209,14 +209,14 @@ bool MainUI::getWindow(){ this->grabMouse( QCursor(Qt::CrossCursor) ); mousegrabbed = true; this->centralWidget()->setEnabled(false); - //this->hide(); + this->setWindowOpacity(0); return false; //wait for the next click to continue }else if(ui->radio_area->isChecked()){ settings->setValue("screenshot-target", "area"); this->grabMouse( QCursor(Qt::CrossCursor) ); mousegrabbed = true; this->centralWidget()->setEnabled(false); - //this->hide(); + this->setWindowOpacity(0); return false; //wait for the next click to continue }else if(ui->radio_monitor->isChecked()){ //will auto-grab the proper monitor later @@ -247,7 +247,7 @@ void MainUI::getPixmap(){ cpic = scrn->grabWindow(cwin); } } - this->show(); + this->showNormal(); this->setGeometry(lastgeom); lastScreenShot = QDateTime::currentDateTime(); //Now display the pixmap on the label as well @@ -283,6 +283,7 @@ void MainUI::mouseReleaseEvent(QMouseEvent *ev){ mousegrabbed = false; this->centralWidget()->setEnabled(true); this->releaseMouse(); + this->setWindowOpacity(1); if(ui->radio_area->isChecked()){ //Need to determind the rectange which covers the area selected areaOverlay->hide(); -- cgit From 96252f4e5af25f24c4e7232cc42c077894e03370 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 31 Jul 2017 13:54:16 -0400 Subject: Fix the clearing of the QT_AUTO_SCREEN_SCALE_FACTOR variable on start of the screensaver --- src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index 1cadd4f6..f9a54965 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -229,6 +229,7 @@ bool MainUI::getWindow(){ void MainUI::getPixmap(){ QScreen *scrn = QApplication::screens().at(0); QPixmap cpic; + qDebug() << "Grab Pixmap:" << cwin; if( (cwin==0 && ui->radio_window->isChecked() ) || ui->radio_all->isChecked() ){ //Grab the whole screen cpic = scrn->grabWindow(QApplication::desktop()->winId()); @@ -237,6 +238,7 @@ void MainUI::getPixmap(){ cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() ); }else if(cwin==0 && ui->radio_area->isChecked()){ //Grab the section of the screen which was selected + qDebug() << "Screen Area:" << snapArea; cpic = scrn->grabWindow(QApplication::desktop()->winId(), snapArea.x(), snapArea.y(), snapArea.width(), snapArea.height() ); }else{ //Grab just the designated window @@ -294,15 +296,15 @@ void MainUI::mouseReleaseEvent(QMouseEvent *ev){ QList wins = XCB->WindowList(); QList stack = XCB->WM_Get_Client_List(true); cwin = 0; - //qDebug() << "Try to select window:" << ev->globalPos(); + qDebug() << "Try to select window:" << ev->globalPos() << ev->pos() << QCursor::pos(); for(int i=stack.length()-1; i>=0 && cwin==0; i--){ //work top->bottom in the stacking order if(!wins.contains(stack[i])){ continue; } if( XCB->WindowGeometry(stack[i], true).contains(ev->globalPos()) && XCB->WindowState(stack[i])!=LXCB::INVISIBLE ){ - //qDebug() << "Found Window:" << i << XCB->WindowClass(stack[i]); + qDebug() << "Found Window:" << i << XCB->WindowClass(stack[i]) << XCB->WindowGeometry(stack[i], true); cwin = stack[i]; } } - //qDebug() << " - Got window:" << cwin; + qDebug() << " - Got window:" << cwin; if(cwin==this->winId()){ return; } //cancelled } this->hide(); -- cgit From 3c084487233a81223c85afd109e47f64093bd5dc Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 31 Jul 2017 13:57:28 -0400 Subject: Remove a bunch of debug lines from lumina-screenshot --- src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index f9a54965..c894bdf8 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -229,7 +229,7 @@ bool MainUI::getWindow(){ void MainUI::getPixmap(){ QScreen *scrn = QApplication::screens().at(0); QPixmap cpic; - qDebug() << "Grab Pixmap:" << cwin; + //qDebug() << "Grab Pixmap:" << cwin; if( (cwin==0 && ui->radio_window->isChecked() ) || ui->radio_all->isChecked() ){ //Grab the whole screen cpic = scrn->grabWindow(QApplication::desktop()->winId()); @@ -238,7 +238,7 @@ void MainUI::getPixmap(){ cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() ); }else if(cwin==0 && ui->radio_area->isChecked()){ //Grab the section of the screen which was selected - qDebug() << "Screen Area:" << snapArea; + //qDebug() << "Screen Area:" << snapArea; cpic = scrn->grabWindow(QApplication::desktop()->winId(), snapArea.x(), snapArea.y(), snapArea.width(), snapArea.height() ); }else{ //Grab just the designated window @@ -296,15 +296,15 @@ void MainUI::mouseReleaseEvent(QMouseEvent *ev){ QList wins = XCB->WindowList(); QList stack = XCB->WM_Get_Client_List(true); cwin = 0; - qDebug() << "Try to select window:" << ev->globalPos() << ev->pos() << QCursor::pos(); + //qDebug() << "Try to select window:" << ev->globalPos() << ev->pos() << QCursor::pos(); for(int i=stack.length()-1; i>=0 && cwin==0; i--){ //work top->bottom in the stacking order if(!wins.contains(stack[i])){ continue; } if( XCB->WindowGeometry(stack[i], true).contains(ev->globalPos()) && XCB->WindowState(stack[i])!=LXCB::INVISIBLE ){ - qDebug() << "Found Window:" << i << XCB->WindowClass(stack[i]) << XCB->WindowGeometry(stack[i], true); + //qDebug() << "Found Window:" << i << XCB->WindowClass(stack[i]) << XCB->WindowGeometry(stack[i], true); cwin = stack[i]; } } - qDebug() << " - Got window:" << cwin; + //qDebug() << " - Got window:" << cwin; if(cwin==this->winId()){ return; } //cancelled } this->hide(); -- cgit From 9fe4993bdc8a166c60c1191292aa353d1937f109 Mon Sep 17 00:00:00 2001 From: ZackaryWelch Date: Tue, 15 Aug 2017 16:28:16 -0400 Subject: Added translations to menu buttons and the panel settings dialogue --- src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp index c894bdf8..48a4ceb4 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp @@ -322,10 +322,14 @@ 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 - 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) { + QMessageBox dialog( QMessageBox::Warning, 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, this); + dialog.setDefaultButton(QMessageBox::Cancel); + dialog.setButtonText(QMessageBox::Save, tr("Save")); + dialog.setButtonText(QMessageBox::Discard, tr("Discard")); + dialog.setButtonText(QMessageBox::Cancel, tr("Cancel")); + switch (dialog.exec()) { case QMessageBox::Discard: // Just close, we don't care about the file. break; -- cgit