aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r--src-qt5/core-utils/lumina-config/globals.h7
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.cpp73
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.h5
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.ui23
-rw-r--r--src-qt5/core-utils/lumina-config/pages/getPage.h5
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp282
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_wallpaper.h52
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui8
-rw-r--r--src-qt5/core-utils/lumina-config/pages/pages.pri15
9 files changed, 440 insertions, 30 deletions
diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h
index cddc76a6..f3921976 100644
--- a/src-qt5/core-utils/lumina-config/globals.h
+++ b/src-qt5/core-utils/lumina-config/globals.h
@@ -12,8 +12,15 @@
#include <QList>
#include <QWidget>
#include <QDesktopWidget>
+#include <QScreen>
#include <QMainWindow>
#include <QTreeWidgetItem>
+#include <QToolButton>
+#include <QSettings>
+#include <QFileDialog>
+#include <QColorDialog>
+#include <QMessageBox>
+
//Now the Lumina Library classes
#include <LuminaXDG.h>
#include <LuminaUtils.h>
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp
index 31d746d5..95a420e8 100644
--- a/src-qt5/core-utils/lumina-config/mainWindow.cpp
+++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp
@@ -15,7 +15,13 @@
//=============
mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){
ui->setupUi(this);
+ cpage = "somerandomjunktostartwith";
+ //Need to insert a spacer action in the toolbar
+ QWidget *tmp = new QWidget(this);
+ tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ ui->toolBar->insertWidget(ui->actionSave, tmp); //after the save button
setupIcons();
+ loadMonitors();
changePage(""); //load the default main page
}
@@ -33,27 +39,53 @@ void mainWindow::slotSingleInstance(){
void mainWindow::setupIcons(){
ui->actionSave->setIcon( LXDG::findIcon("document-save","") );
ui->actionBack->setIcon( LXDG::findIcon("go-previous-view","") );
+ ui->actionMonitor->setIcon(LXDG::findIcon("preferences-desktop-display","") );
+}
+
+void mainWindow::loadMonitors(){
+ if(ui->actionMonitor->menu()==0){
+ ui->actionMonitor->setMenu( new QMenu(this) );
+ ui->actionMonitor->setWhatsThis("0");
+ connect( ui->actionMonitor->menu(), SIGNAL(triggered(QAction*)), this, SLOT(changeMonitor(QAction*)) );
+ QToolButton *b = static_cast<QToolButton*>(ui->toolBar->widgetForAction(ui->actionMonitor));
+ b->setPopupMode(QToolButton::InstantPopup);
+ }
+ int cnum = ui->actionMonitor->whatsThis().toInt();
+ ui->actionMonitor->menu()->clear();
+ QList<QScreen*> SL = QApplication::screens();
+ for(int i=0; i<SL.length(); i++){
+ QAction *tmp = ui->actionMonitor->menu()->addAction( QString("%1: %2").arg(QString::number(i), SL[i]->name()) );
+ tmp->setWhatsThis(QString::number(i));
+ if(i==cnum || (i==0 && cnum>= SL.length()) ){
+ ui->actionMonitor->setText( tmp->text() );
+ ui->actionMonitor->setWhatsThis(tmp->whatsThis() );
+ }
+ }
+
}
//=============
// PRIVATE
//=============
void mainWindow::changePage(QString id){
- PageWidget *page = GetNewPage(id, this);
- if(page==0){ return; }
- qDebug() << "Changing page:" << id;
- cpage = id;
- QWidget *old = this->centralWidget();
- this->setCentralWidget(page);
- if(old!=0 && old!=ui->centralwidget){ old->disconnect(); old->deleteLater(); }
- //Connect the new page
- connect(page, SIGNAL(HasPendingChanges(bool)), this, SLOT(pageCanSave(bool)) );
- connect(page, SIGNAL(ChangePageTitle(QString)), this, SLOT(pageSetTitle(QString)) );
- connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) );
+ PageWidget *page = 0;
+ if(id!=cpage){
+ page = GetNewPage(id, this);
+ if(page==0){ return; }
+ qDebug() << "Changing page:" << id;
+ cpage = id;
+ QWidget *old = this->centralWidget();
+ this->setCentralWidget(page);
+ if(old!=0 && old!=ui->centralwidget){ old->disconnect(); old->deleteLater(); }
+ //Connect the new page
+ connect(page, SIGNAL(HasPendingChanges(bool)), this, SLOT(pageCanSave(bool)) );
+ connect(page, SIGNAL(ChangePageTitle(QString)), this, SLOT(pageSetTitle(QString)) );
+ connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) );
+ }
//Now load the new page
- page->LoadSettings(0); //need to make this show the current screen as needed
+ page->LoadSettings(ui->actionMonitor->whatsThis().toInt()); //need to make this show the current screen as needed
//Now update this UI a bit based on page settings
- bool needscreen = page->needsScreenSelector();
+ ui->actionMonitor->setVisible( page->needsScreenSelector() );// && ui->actionMonitor->menu()->actions().length()>1 );
this->showNormal();
}
@@ -70,12 +102,15 @@ void mainWindow::pageSetTitle(QString title){
this->setWindowTitle(title);
}
-void mainWindow::page_change(QString id){
+bool mainWindow::page_change(QString id){
if(ui->actionSave->isEnabled()){
//unsaved changed available - prompt to save first
- // TO-DO
+ QMessageBox::StandardButton result = QMessageBox::question(this, tr("Unsaved Changes"), tr("This page currently has unsaved changes, do you wish to save them now?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No);
+ if(result == QMessageBox::Yes){ on_actionSave_triggered(); }
+ else if(result == QMessageBox::Cancel){ return false; } //stop now
}
changePage(id);
+ return true;
}
void mainWindow::on_actionSave_triggered(){
@@ -89,3 +124,11 @@ void mainWindow::on_actionBack_triggered(){
else{ page_change(""); } //Use the interactive wrapper (check for save state, etc).
}
+void mainWindow::changeMonitor(QAction *act){
+ QString oldWT = ui->actionMonitor->whatsThis();
+ //Update the current selection shown on the button
+ ui->actionMonitor->setWhatsThis( act->whatsThis() );
+ //Now prompt the current page to re-load settings
+ if( page_change(cpage) ){ ui->actionMonitor->setText(act->text()); }
+ else{ ui->actionMonitor->setWhatsThis(oldWT); } //cancelled - go back to old setting
+}
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.h b/src-qt5/core-utils/lumina-config/mainWindow.h
index 76478692..3e632f4d 100644
--- a/src-qt5/core-utils/lumina-config/mainWindow.h
+++ b/src-qt5/core-utils/lumina-config/mainWindow.h
@@ -21,21 +21,24 @@ public:
public slots:
void slotSingleInstance();
void setupIcons();
+ void loadMonitors();
private:
Ui::mainWindow *ui;
QString cpage; //current page
+
void changePage(QString id);
private slots:
//Page signals
void pageCanSave(bool);
void pageSetTitle(QString);
- void page_change(QString);
+ bool page_change(QString);
//Toolbar actions
void on_actionSave_triggered();
void on_actionBack_triggered();
+ void changeMonitor(QAction*);
};
#endif
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.ui b/src-qt5/core-utils/lumina-config/mainWindow.ui
index 55e39233..538d1864 100644
--- a/src-qt5/core-utils/lumina-config/mainWindow.ui
+++ b/src-qt5/core-utils/lumina-config/mainWindow.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>486</width>
+ <width>504</width>
<height>388</height>
</rect>
</property>
@@ -28,6 +28,12 @@
<property name="allowedAreas">
<set>Qt::TopToolBarArea</set>
</property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ <property name="floatable">
+ <bool>false</bool>
+ </property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@@ -37,6 +43,7 @@
<addaction name="actionBack"/>
<addaction name="separator"/>
<addaction name="actionSave"/>
+ <addaction name="actionMonitor"/>
</widget>
<action name="actionSave">
<property name="text">
@@ -63,6 +70,20 @@
<string>Esc</string>
</property>
</action>
+ <action name="actionMonitor">
+ <property name="text">
+ <string notr="true">Monitor</string>
+ </property>
+ <property name="toolTip">
+ <string>Select monitor/desktop to configure</string>
+ </property>
+ <property name="statusTip">
+ <string>Select monitor/desktop to configure</string>
+ </property>
+ <property name="menuRole">
+ <enum>QAction::ApplicationSpecificRole</enum>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h
index 9e6b3612..cecc3d87 100644
--- a/src-qt5/core-utils/lumina-config/pages/getPage.h
+++ b/src-qt5/core-utils/lumina-config/pages/getPage.h
@@ -26,16 +26,17 @@ static QList<PAGEINFO> KnownPages(){
// Valid Groups: ["appearance", "interface", "session", "apps"]
QList<PAGEINFO> list;
//Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags>
- list << PageInfo("wallpapers", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme");
+ list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme");
return list;
}
//Add any sub-pages here
#include "page_main.h"
+#include "page_wallpaper.h"
static PageWidget* GetNewPage(QString id, QWidget *parent){
//Find the page that matches this "id"
- //if(id=="page_beadm"){ return new beadm_page(parent, core); }
+ if(id=="wallpaper"){ return new page_wallpaper(parent); }
//Return the main control_panel page as the fallback/default
return new page_main(parent);
}
diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp
new file mode 100644
index 00000000..b54e07bd
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp
@@ -0,0 +1,282 @@
+//===========================================
+// Lumina Desktop Source Code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "page_wallpaper.h"
+#include "ui_page_wallpaper.h"
+#include "getPage.h"
+
+//==========
+// PUBLIC
+//==========
+page_wallpaper::page_wallpaper(QWidget *parent) : PageWidget(parent), ui(new Ui::page_wallpaper()){
+ ui->setupUi(this);
+ DEFAULTBG = LOS::LuminaShare()+"/desktop-background.jpg";
+ updateIcons();
+ connect(ui->combo_desk_bg, SIGNAL(currentIndexChanged(int)), this, SLOT(deskbgchanged()) );
+ connect(ui->radio_desk_multi, SIGNAL(toggled(bool)), this, SLOT(desktimechanged()) );
+ connect(ui->tool_desk_addbg, SIGNAL(clicked()), this, SLOT(deskbgadded()) );
+ connect(ui->tool_desk_rmbg, SIGNAL(clicked()), this, SLOT(deskbgremoved()) );
+ connect(ui->spin_desk_min, SIGNAL(valueChanged(int)), this, SLOT(desktimechanged()) );
+ connect(ui->combo_desk_layout, SIGNAL(currentIndexChanged(int)), this, SLOT(desktimechanged()) ); //just need to poke the save routines
+}
+
+page_wallpaper::~page_wallpaper(){
+
+}
+
+//================
+// PUBLIC SLOTS
+//================
+void page_wallpaper::SaveSettings(){
+ QSettings settings("lumina-desktop","desktopsettings");
+ QString DPrefix = "desktop-"+QString::number(cScreen)+"/";
+ QStringList bgs; //get the list of backgrounds to use
+ if(ui->radio_desk_multi->isChecked()){
+ for(int i=0; i<ui->combo_desk_bg->count(); i++){
+ bgs << ui->combo_desk_bg->itemData(i).toString();
+ }
+ }else if(ui->combo_desk_bg->count() > 0){
+ bgs << ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString();
+ bgs.removeAll("default");
+ }
+ if(bgs.isEmpty()){ bgs << "default"; } //Make sure to always fall back on the default
+ settings.setValue(DPrefix+"background/filelist", bgs);
+ settings.setValue(DPrefix+"background/minutesToChange", ui->spin_desk_min->value());
+ settings.setValue(DPrefix+"background/format", ui->combo_desk_layout->currentData().toString());
+
+ emit HasPendingChanges(false);
+}
+
+void page_wallpaper::LoadSettings(int screennum){
+ emit HasPendingChanges(false);
+ emit ChangePageTitle( tr("Wallpaper Settings") );
+ cScreen = screennum; //save for later
+ loading = true;
+ QSettings settings("lumina-desktop","desktopsettings");
+ QString DPrefix = "desktop-"+QString::number(cScreen)+"/";
+
+ QStringList bgs = settings.value(DPrefix+"background/filelist", QStringList()<<"default").toStringList();
+ ui->combo_desk_bg->clear();
+ for(int i=0; i<bgs.length(); i++){
+ if(bgs[i]=="default"){ ui->combo_desk_bg->addItem( QIcon(DEFAULTBG), tr("System Default"), bgs[i] ); }
+ else if(bgs[i].startsWith("rgb(")){ui->combo_desk_bg->addItem(QString(tr("Solid Color: %1")).arg(bgs[i]), bgs[i]); }
+ //else{ ui->combo_desk_bg->addItem( QIcon(QPixmap(bgs[i]).scaled(64,64)), bgs[i].section("/",-1), bgs[i] ); }
+ else{ ui->combo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] ); } //disable the thumbnail - takes a long time for large collections of files
+ }
+
+ ui->radio_desk_multi->setEnabled(bgs.length()>1);
+ if(bgs.length()>1){ ui->radio_desk_multi->setChecked(true);}
+ else{ ui->radio_desk_single->setChecked(true); }
+ ui->spin_desk_min->setValue( settings.value(DPrefix+"background/minutesToChange", 5).toInt() );
+ desktimechanged(); //ensure the display gets updated (in case the radio selection did not change);
+ QRect geom = QApplication::desktop()->screenGeometry(cScreen);
+ ui->label_desk_res->setText( tr("Screen Resolution:")+"\n"+QString::number(geom.width())+"x"+QString::number(geom.height()) );
+ int tmp = ui->combo_desk_layout->findData(settings.value(DPrefix+"background/format","stretch"));
+ if(tmp>=0){ ui->combo_desk_layout->setCurrentIndex(tmp); }
+ loading = false;
+}
+
+void page_wallpaper::updateIcons(){
+ ui->tool_desk_addbg->setIcon( LXDG::findIcon("list-add","") );
+ ui->tool_desk_rmbg->setIcon( LXDG::findIcon("list-remove","") );
+ updateMenus();
+}
+
+//=================
+// PRIVATE
+//=================
+QString page_wallpaper::getColorStyle(QString current, bool allowTransparency){
+ QString out;
+ //Convert the current color string into a QColor
+ QStringList col = current.section(")",0,0).section("(",1,1).split(",");
+ if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; }
+ QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA
+ QColor ncol;
+ if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); }
+ else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); }
+ //Now convert the new color into a usable string and return
+ if(ncol.isValid()){ //if the dialog was not cancelled
+ if(allowTransparency){
+ out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")";
+ }else{
+ out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")";
+ }
+ }
+ return out;
+}
+
+//=================
+// PRIVATE SLOTS
+//=================
+void page_wallpaper::updateMenus(){
+ //Background file menu (different ways of loading files)
+ if(ui->tool_desk_addbg->menu()==0){ ui->tool_desk_addbg->setMenu(new QMenu(this)); }
+ ui->tool_desk_addbg->menu()->clear();
+ ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-new",""), tr("File(s)"), this, SLOT(deskbgadded()) );
+ ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("folder-new",""), tr("Directory (Single)"), this, SLOT(deskbgdiradded()) );
+ ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-open-folder",""), tr("Directory (Recursive)"), this, SLOT(deskbgdirradded()) );
+ ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("format-fill-color",""), tr("Solid Color"), this, SLOT(deskbgcoloradded()) );
+
+ //Available Wallpaper layout options
+ ui->combo_desk_layout->clear();
+ ui->combo_desk_layout->addItem(tr("Automatic"), "stretch");
+ ui->combo_desk_layout->addItem(tr("Fullscreen"), "full");
+ ui->combo_desk_layout->addItem(tr("Fit screen"), "fit");
+ ui->combo_desk_layout->addItem(tr("Tile"), "tile");
+ ui->combo_desk_layout->addItem(tr("Center"), "center");
+ ui->combo_desk_layout->addItem(tr("Top Left"), "topleft");
+ ui->combo_desk_layout->addItem(tr("Top Right"), "topright");
+ ui->combo_desk_layout->addItem(tr("Bottom Left"), "bottomleft");
+ ui->combo_desk_layout->addItem(tr("Bottom Right"), "bottomright");
+
+}
+
+void page_wallpaper::deskbgchanged(){
+ //Load the new image preview
+ if(ui->combo_desk_bg->count()==0){
+ ui->label_desk_bgview->setPixmap(QPixmap());
+ ui->label_desk_bgview->setText(tr("No Background")+"\n"+tr("(use system default)"));
+ ui->label_desk_bgview->setStyleSheet("");
+ }else{
+ QString path = ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString();
+ if(path=="default"){ path = DEFAULTBG; }
+ if(QFile::exists(path)){
+ QSize sz = ui->label_desk_bgview->size();
+ sz.setWidth( sz.width() - (2*ui->label_desk_bgview->frameWidth()) );
+ sz.setHeight( sz.height() - (2*ui->label_desk_bgview->frameWidth()) );
+ //Update the preview/thumbnail for this item
+ QPixmap pix(path);
+ ui->label_desk_bgview->setPixmap( pix.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation) );
+ ui->combo_desk_bg->setItemIcon(ui->combo_desk_bg->currentIndex(), pix.scaled(64,64) );
+ ui->label_desk_bgview->setStyleSheet("");
+ }else if(path.startsWith("rgb(")){
+ ui->label_desk_bgview->setPixmap(QPixmap());
+ ui->label_desk_bgview->setText("");
+ ui->label_desk_bgview->setStyleSheet("background-color: "+path+";");
+ }else{
+ ui->label_desk_bgview->setPixmap(QPixmap());
+ ui->label_desk_bgview->setText(tr("File does not exist"));
+ ui->label_desk_bgview->setStyleSheet("");
+ }
+ }
+ //See if this constitues a change to the current settings and enable the save button
+ if(!loading && ui->radio_desk_single->isChecked() && cBG!=ui->combo_desk_bg->currentIndex()){ emit HasPendingChanges(true); }
+ cBG = ui->combo_desk_bg->currentIndex(); //keep track of this for later
+ //Disable the background rotation option if only one background selected
+ if(ui->combo_desk_bg->count()<2){
+ ui->radio_desk_single->setChecked(true);
+ ui->radio_desk_multi->setEnabled(false);
+ ui->spin_desk_min->setEnabled(false);
+ }else{
+ ui->radio_desk_multi->setEnabled(true);
+ ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked());
+ }
+
+ //Disable the bg remove button if no backgrounds loaded
+ ui->tool_desk_rmbg->setEnabled(ui->combo_desk_bg->count()>0);
+ ui->label_desk_bgview->setMinimumSize(10,10);
+}
+
+void page_wallpaper::desktimechanged(){
+ ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked());
+ if(!loading){ emit HasPendingChanges(true); }
+}
+
+void page_wallpaper::deskbgremoved(){
+ if(ui->combo_desk_bg->count()<1){ return; } //nothing to remove
+ ui->combo_desk_bg->removeItem( ui->combo_desk_bg->currentIndex() );
+ emit HasPendingChanges(true);
+}
+
+void page_wallpaper::deskbgadded(){
+ //Prompt the user to find an image file to use for a background
+ QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE";
+ qDebug() << "Looking for wallpaper dir:" << dir;
+ if( !QFile::exists(dir) ){ dir = QDir::homePath(); }
+ QStringList imgs = LUtils::imageExtensions();
+ for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); }
+ QStringList bgs = QFileDialog::getOpenFileNames(this, tr("Find Background Image(s)"), dir, "Images ("+imgs.join(" ")+");;All Files (*)");
+ if(bgs.isEmpty()){ return; }
+ for(int i=0; i<bgs.length(); i++){
+ ui->combo_desk_bg->addItem( QIcon(bgs[i]), bgs[i].section("/",-1), bgs[i]);
+ }
+ //Now move to the last item in the list (the new image(s));
+ ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 );
+ //If multiple items selected, automatically enable the background rotation option
+ if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){
+ ui->radio_desk_multi->setChecked(true);
+ }
+ emit HasPendingChanges(true);
+}
+
+void page_wallpaper::deskbgcoloradded(){
+ //Prompt the user to select a color (no transparency allowed)
+ QString color = getColorStyle("",false); //no initial color
+ if(color.isEmpty()){ return; }
+ //Add it to the list
+ ui->combo_desk_bg->addItem( QString(tr("Solid Color: %1")).arg(color), color);
+ //Now move to the last item in the list (the new image(s));
+ ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 );
+
+ emit HasPendingChanges(true);
+}
+
+void page_wallpaper::deskbgdiradded(){
+ //Add the files from a single directory
+ QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE";
+ qDebug() << "Looking for wallpaper dir:" << dir;
+ if( !QFile::exists(dir) ){ dir = QDir::homePath(); }
+ dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly);
+ if(dir.isEmpty()){ return; }
+ //Got a directory - go ahead and find all the valid image files within it
+ QStringList imgs = LUtils::imageExtensions();
+ for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); }
+ QDir qdir(dir);
+ QStringList bgs = qdir.entryList(imgs, QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ if(bgs.isEmpty()){ return; }
+ for(int i=0; i<bgs.length(); i++){
+ ui->combo_desk_bg->addItem( bgs[i], qdir.absoluteFilePath(bgs[i]));
+ }
+ //Now move to the last item in the list (the new image(s));
+ ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 );
+ //If multiple items selected, automatically enable the background rotation option
+ if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){
+ ui->radio_desk_multi->setChecked(true);
+ }
+ emit HasPendingChanges(true);
+}
+
+void page_wallpaper::deskbgdirradded(){
+ //Recursively add files from a directory
+ QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE";
+ qDebug() << "Looking for wallpaper dir:" << dir;
+ if( !QFile::exists(dir) ){ dir = QDir::homePath(); }
+ dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly);
+ if(dir.isEmpty()){ return; }
+ //Got a directory - go ahead and get all the valid image file formats
+ QStringList imgs = LUtils::imageExtensions();
+ for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); }
+ //Now load the directory and add all the valid files
+ QStringList dirs = LUtils::listSubDirectories(dir, true); //find/list all the dirs
+ dirs.prepend(dir); //make sure the main dir is also listed
+ QStringList bgs;
+ for(int d=0; d<dirs.length(); d++){
+ QDir qdir(dirs[d]);
+ QStringList tmp = qdir.entryList(imgs, QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ for(int j=0; j<tmp.length(); j++){ bgs << qdir.absoluteFilePath(tmp[j]); }
+ }
+ //Now add all the files into the widget
+ for(int i=0; i<bgs.length(); i++){
+ ui->combo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] );
+ }
+ //Now move to the last item in the list (the new image(s));
+ ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 );
+ //If multiple items selected, automatically enable the background rotation option
+ if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){
+ ui->radio_desk_multi->setChecked(true);
+ }
+ emit HasPendingChanges(true);
+}
diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.h b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.h
new file mode 100644
index 00000000..ece613f9
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.h
@@ -0,0 +1,52 @@
+//===========================================
+// Lumina Desktop Source Code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_CONFIG_PAGE_WALLPAPER_H
+#define _LUMINA_CONFIG_PAGE_WALLPAPER_H
+#include "../globals.h"
+#include "PageWidget.h"
+
+namespace Ui{
+ class page_wallpaper;
+};
+
+class page_wallpaper : public PageWidget{
+ Q_OBJECT
+public:
+ page_wallpaper(QWidget *parent);
+ ~page_wallpaper();
+
+ bool needsScreenSelector(){ return true; }
+
+public slots:
+ void SaveSettings();
+ void LoadSettings(int screennum);
+ void updateIcons();
+
+private:
+ Ui::page_wallpaper *ui;
+ int cScreen, cBG; //current screen number/background
+ QString DEFAULTBG;
+ bool loading;
+
+ QString getColorStyle(QString current, bool allowTransparency);
+
+private slots:
+ void updateMenus();
+ void deskbgchanged();
+ void desktimechanged();
+ void deskbgremoved();
+ void deskbgadded();
+ void deskbgcoloradded();
+ void deskbgdiradded();
+ void deskbgdirradded();
+
+protected:
+ void resizeEvent(QResizeEvent*){
+ deskbgchanged(); //update the wallpaper preview
+ }
+};
+#endif
diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui
index 9dfbef2c..ca927c69 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui
+++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui
@@ -15,16 +15,16 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="topMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="rightMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="bottomMargin">
- <number>0</number>
+ <number>9</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri
index 2ebf2c46..c282a02c 100644
--- a/src-qt5/core-utils/lumina-config/pages/pages.pri
+++ b/src-qt5/core-utils/lumina-config/pages/pages.pri
@@ -1,7 +1,8 @@
HEADERS += $${PWD}/getPage.h \
$${PWD}/PageWidget.h \
- $${PWD}/page_main.h
+ $${PWD}/page_main.h \
+ $${PWD}/page_wallpaper.h
# $${PWD}/page_autostart.h \
# $${PWD}/page_defaultapps.h \
# $${PWD}/page_fluxbox_keys.h \
@@ -12,10 +13,10 @@ HEADERS += $${PWD}/getPage.h \
# $${PWD}/page_session_locale.h \
# $${PWD}/page_session_options.h \
# $${PWD}/page_theme.h \
-# $${PWD}/page_wallpaper.h
-
-SOURCES += $${PWD}/page_main.cpp
+
+SOURCES += $${PWD}/page_main.cpp \
+ $${PWD}/page_wallpaper.cpp
# $${PWD}/page_autostart.cpp \
# $${PWD}/page_defaultapps.cpp \
# $${PWD}/page_fluxbox_keys.cpp \
@@ -26,9 +27,10 @@ SOURCES += $${PWD}/page_main.cpp
# $${PWD}/page_session_locale.cpp \
# $${PWD}/page_session_options.cpp \
# $${PWD}/page_theme.cpp \
-# $${PWD}/page_wallpaper.cpp
+
-FORMS += $${PWD}/page_main.ui
+FORMS += $${PWD}/page_main.ui \
+ $${PWD}/page_wallpaper.ui
# $${PWD}/page_autostart.ui \
# $${PWD}/page_defaultapps.ui \
# $${PWD}/page_fluxbox_keys.ui \
@@ -39,4 +41,3 @@ FORMS += $${PWD}/page_main.ui
# $${PWD}/page_session_locale.ui \
# $${PWD}/page_session_options.ui \
# $${PWD}/page_theme.ui \
-# $${PWD}/page_wallpaper.ui
bgstack15