Changeset 186faf2


Ignore:
Timestamp:
04/17/14 12:13:56 (11 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1
Children:
468e034, 2f11cb1
Parents:
3245f24
Message:

Get the backgrounds tab in lumina-config working

Location:
lumina/lumina-config
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-config/mainUI.cpp

    rb88775b r186faf2  
    2323  connect(ui->tool_rmbackground, SIGNAL(clicked()), this, SLOT(removeBackground()) ); 
    2424  connect(ui->tool_addbackground, SIGNAL(clicked()), this, SLOT(addBackground()) ); 
     25  connect(ui->push_save, SIGNAL(clicked()), this, SLOT(saveCurrentSettings()) ); 
    2526   
    2627  //Now finish setting up the UI 
     
    109110} 
    110111 
     112void MainUI::saveCurrentSettings(){ 
     113  QString DPrefix = "desktop-"+QString::number(currentDesktop())+"/"; 
     114  QString PPrefix = "panel"+QString::number(currentDesktop())+"."+QString::number(currentPanel())+"/"; 
     115  //Now save the current settings from the UI 
     116    // Background Tab 
     117    QStringList bgs; //get the list of backgrounds to use 
     118    if(ui->radio_rotateBG->isChecked()){ 
     119      for(int i=0; i<ui->list_backgrounds->count(); i++){ 
     120        bgs << ui->list_backgrounds->item(i)->whatsThis(); 
     121      } 
     122    }else{ 
     123        QListWidgetItem *it = ui->list_backgrounds->currentItem(); 
     124        if(it != 0){ bgs << it->whatsThis(); } 
     125        else if(ui->list_backgrounds->count() > 0){ bgs << ui->list_backgrounds->item(0)->whatsThis(); } 
     126    } 
     127    if(bgs.isEmpty()){ bgs << "default"; } 
     128    settings->setValue(DPrefix+"background/filelist", bgs); 
     129    settings->setValue(DPrefix+"background/minutesToChange", ui->spin_bgRotateMin->value()); 
     130 
     131    //Panels tab 
     132     
     133    //All done - make sure the changes get saved to file right now 
     134    settings->sync(); 
     135} 
     136 
    111137//Background Tab Functions 
    112138void MainUI::addBackground(){ 
    113          
     139  //Prompt the user to find an image file to use for a background 
     140  QStringList bgs = QFileDialog::getOpenFileNames(this, tr("Find Background Image(s)"), QDir::homePath(), "Images (*.png *.xpm *.jpg)"); 
     141  for(int i=0; i<bgs.length(); i++){ 
     142    addNewBackgroundFile(bgs[i]); 
     143  } 
     144   
    114145} 
    115146 
    116147void MainUI::removeBackground(){ 
    117          
     148  //Remove the currently selected background from the list 
     149  int item = ui->list_backgrounds->currentRow(); 
     150  if(item >= 0){ 
     151    delete ui->list_backgrounds->takeItem(item); 
     152  } 
    118153} 
    119154 
  • lumina/lumina-config/mainUI.h

    rdcb7f23 r186faf2  
    1111#include <QIcon> 
    1212#include <QTimer> 
     13#include <QFileDialog> 
    1314 
    1415// libLumina includes 
     
    4748        //General Utility Functions 
    4849        void loadCurrentSettings(); 
     50        void saveCurrentSettings(); 
    4951 
    5052        //Background Tab Functions 
Note: See TracChangeset for help on using the changeset viewer.