aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2014-10-10 15:22:19 -0400
committerKen Moore <moorekou@gmail.com>2014-10-10 15:22:19 -0400
commit57697ef836ae31214f70a83e9445d0a83b4dddf2 (patch)
tree383c2d9aad9b7e55b53c4d160dfe7db9ded65e03
parentMake sure the directory catch for running lumina-fm happens at the end (in ca... (diff)
parentsave settings for lumina-screenshot (screenshot-delay and screenshot-target) (diff)
downloadlumina-57697ef836ae31214f70a83e9445d0a83b4dddf2.tar.gz
lumina-57697ef836ae31214f70a83e9445d0a83b4dddf2.tar.bz2
lumina-57697ef836ae31214f70a83e9445d0a83b4dddf2.zip
Merge pull request #19 from Nanolx/master
save settings for lumina-screenshot
-rw-r--r--lumina-screenshot/MainUI.cpp20
-rw-r--r--lumina-screenshot/MainUI.h4
2 files changed, 20 insertions, 4 deletions
diff --git a/lumina-screenshot/MainUI.cpp b/lumina-screenshot/MainUI.cpp
index cedaa7a5..34fec43a 100644
--- a/lumina-screenshot/MainUI.cpp
+++ b/lumina-screenshot/MainUI.cpp
@@ -25,14 +25,24 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveScreenshot()) );
connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(closeApplication()) );
connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(startScreenshot()) );
- ui->radio_window->setChecked(true);
+
+ 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());
this->show();
ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
}
MainUI::~MainUI(){}
-
+
//==============
// PRIVATE SLOTS
//==============
@@ -54,6 +64,7 @@ bool MainUI::getWindow(){
//Use this function to set cwin
cwin = 0;
if(ui->radio_window->isChecked()){
+ settings->setValue("screenshot-target", "window");
//Use xprop to get the desired window from the user
QList<WId> wins = LX11::WindowList();
wins.removeAll(this->winId()); //don't show this window
@@ -65,7 +76,10 @@ bool MainUI::getWindow(){
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) ];
+ } else {
+ settings->setValue("screenshot-target", "desktop");
}
+ settings->setValue("screenshot-delay", ui->spin_delay->value());
return true;
}
@@ -80,4 +94,4 @@ void MainUI::getPixmap(){
this->show();
//Now display the pixmap on the label as well
ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
-} \ No newline at end of file
+}
diff --git a/lumina-screenshot/MainUI.h b/lumina-screenshot/MainUI.h
index 5ebe20f6..0e60bda6 100644
--- a/lumina-screenshot/MainUI.h
+++ b/lumina-screenshot/MainUI.h
@@ -15,6 +15,7 @@
#include <QDesktopWidget>
#include <QDir>
#include <QInputDialog>
+#include <QSettings>
#include <LuminaXDG.h>
#include <LuminaUtils.h>
@@ -34,6 +35,7 @@ private:
QPixmap cpic; //current picture
QString ppath; //previous file path
WId cwin; //current window to screenshot
+ QSettings *settings;
private slots:
//Button Slots
@@ -48,4 +50,4 @@ private slots:
void getPixmap(); //set the "cpic" variable to the new screenshot
};
-#endif \ No newline at end of file
+#endif
bgstack15