Changeset d9b0b9e8


Ignore:
Timestamp:
07/08/13 09:42:58 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
abea4e8, e2fa25c
Parents:
fbdee93
git-author:
Ken Moore <ken@…> (07/08/13 09:40:58)
git-committer:
Ken Moore <ken@…> (07/08/13 09:42:58)
Message:

Add in a "simple" option for the PCDM desktop switcher.
Change the DESKTOP_ORIENTATION value to "simple" to use a small QComboBox on the toolbar for selecting a desktop environment instead of using the full selector

Location:
src-qt4/PCDM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/src/pcdm-gui.cpp

    r2d615ae rd9b0b9e8  
    7272  this->setStyleSheet( style.simplified() ); 
    7373 
     74  //Check for whether the desktop switcher is on the toolbar or not 
     75  simpleDESwitcher = (currentTheme->itemValue("desktop") == "simple"); 
     76   
    7477  //get the default translation directory 
    7578  translationDir = QApplication::applicationDirPath() + "/i18n/"; 
     
    129132    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 
    130133    toolbar->addWidget(spacer); 
     134     
     135    if(simpleDESwitcher){ 
     136      //Create the simple DE Switcher 
     137      sdeSwitcher = new QComboBox(this);  
     138      toolbar->addWidget(sdeSwitcher); 
     139      //Add an additional spacer 
     140      QWidget* spacer2 = new QWidget(); 
     141      spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 
     142      toolbar->addWidget(spacer2); 
     143       
     144    } 
    131145     
    132146    //----System Shutdown/Restart 
     
    187201     
    188202    //----Desktop Environment Switcher 
    189     //Create the switcher 
    190     deSwitcher = new FancySwitcher(this, !currentTheme->itemIsVertical("desktop") ); 
    191     QSize deSize = currentTheme->itemIconSize("desktop"); 
    192     deSwitcher->setIconSize(deSize.height()); 
    193     tmpIcon = currentTheme->itemIcon("nextde"); 
    194     if( !tmpIcon.isEmpty() && QFile::exists(tmpIcon) ){ deSwitcher->changeButtonIcon("forward", tmpIcon); } 
    195     tmpIcon = currentTheme->itemIcon("previousde"); 
    196     if( !tmpIcon.isEmpty() && QFile::exists(tmpIcon) ){ deSwitcher->changeButtonIcon("back", tmpIcon); } 
    197     //Figure out if we need to smooth out the animation 
    198     deSwitcher->setNumberAnimationFrames("4");  
    199     //NOTE: A transparent widget background slows the full animation to a crawl with a stretched background image 
    200  
    201     grid->addWidget( deSwitcher, currentTheme->itemLocation("desktop","row"), \ 
     203    if(!simpleDESwitcher){ 
     204      //Create the switcher 
     205      deSwitcher = new FancySwitcher(this, !currentTheme->itemIsVertical("desktop") ); 
     206      QSize deSize = currentTheme->itemIconSize("desktop"); 
     207      deSwitcher->setIconSize(deSize.height()); 
     208      tmpIcon = currentTheme->itemIcon("nextde"); 
     209      if( !tmpIcon.isEmpty() && QFile::exists(tmpIcon) ){ deSwitcher->changeButtonIcon("forward", tmpIcon); } 
     210      tmpIcon = currentTheme->itemIcon("previousde"); 
     211      if( !tmpIcon.isEmpty() && QFile::exists(tmpIcon) ){ deSwitcher->changeButtonIcon("back", tmpIcon); } 
     212      //Figure out if we need to smooth out the animation 
     213      deSwitcher->setNumberAnimationFrames("4");  
     214      //NOTE: A transparent widget background slows the full animation to a crawl with a stretched background image 
     215 
     216      grid->addWidget( deSwitcher, currentTheme->itemLocation("desktop","row"), \ 
    202217                      currentTheme->itemLocation("desktop","col"), \ 
    203218                      currentTheme->itemLocation("desktop","rowspan"), \ 
    204219                      currentTheme->itemLocation("desktop","colspan"), Qt::AlignCenter); 
    205  
     220    } 
    206221    //----WINDOW SPACERS 
    207222    QStringList spacers = currentTheme->getSpacers(); 
     
    231246  //Get user inputs 
    232247  QString username = Backend::getUsernameFromDisplayname(displayname); 
    233   QString binary = Backend::getDesktopBinary(deSwitcher->currentItem()); 
     248  QString binary; 
     249  if(simpleDESwitcher){ 
     250    binary = Backend::getDesktopBinary(sdeSwitcher->currentText()); 
     251  }else{ 
     252    binary = Backend::getDesktopBinary(deSwitcher->currentItem()); 
     253  } 
    234254  QString homedir = Backend::getUserHomeDir(username); 
    235255  //Disable user input while confirming login 
    236256  loginW->setEnabled(FALSE); 
    237   deSwitcher->setEnabled(FALSE); 
     257  if(!simpleDESwitcher){ deSwitcher->setEnabled(FALSE); } 
    238258  toolbar->setEnabled(FALSE); 
    239259  //Try to login 
     
    244264 
    245265void PCDMgui::slotLoginSuccess(){ 
    246   saveLastLogin( loginW->currentUsername(), deSwitcher->currentItem() ); 
     266  QString de; 
     267  if(simpleDESwitcher){ de = sdeSwitcher->currentText(); } 
     268  else{ de = deSwitcher->currentItem(); } 
     269  saveLastLogin( loginW->currentUsername(), de ); 
    247270  slotClosePCDM(); //now start to close down the PCDM GUI 
    248271} 
     
    261284  //Re-Enable user input 
    262285  loginW->setEnabled(TRUE); 
    263   deSwitcher->setEnabled(TRUE); 
     286  if(!simpleDESwitcher){ deSwitcher->setEnabled(TRUE); } 
    264287  toolbar->setEnabled(TRUE); 
    265288} 
     
    277300void PCDMgui::slotUserSelected(QString newuser){ 
    278301  if(newuser.isEmpty()){ 
    279     deSwitcher->setVisible(FALSE); 
    280   }else{ 
    281     deSwitcher->setVisible(TRUE); 
     302    if(simpleDESwitcher){ sdeSwitcher->setVisible(FALSE); } 
     303    else{ deSwitcher->setVisible(FALSE); } 
     304  }else{ 
     305    if(simpleDESwitcher){ sdeSwitcher->setVisible(TRUE); } 
     306    else{ deSwitcher->setVisible(TRUE); } 
    282307    //Try to load the user's last DE 
    283308    loadLastDE(newuser); 
     
    425450  loginW->retranslateUi(); 
    426451  //The desktop switcher 
    427   deSwitcher->removeAllItems(); 
    428   QStringList deList = Backend::getAvailableDesktops(); 
    429   for(int i=0; i<deList.length(); i++){ 
    430     QString deIcon = Backend::getDesktopIcon(deList[i]); 
    431     if( deIcon.isEmpty() ){ deIcon = currentTheme->itemIcon("desktop"); } //set the default icon if none given 
    432     if( !QFile::exists(deIcon) ){ deIcon = ":/images/desktop.png"; } 
    433     deSwitcher->addItem( deList[i], deIcon, Backend::getDesktopComment(deList[i]) ); 
    434   } 
     452  if(simpleDESwitcher){ sdeSwitcher->clear(); } 
     453  else{ deSwitcher->removeAllItems(); } 
     454   
     455    //Get the new desktop list (translated) 
     456    QStringList deList = Backend::getAvailableDesktops(); 
     457    for(int i=0; i<deList.length(); i++){ 
     458      QString deIcon = Backend::getDesktopIcon(deList[i]); 
     459      if( deIcon.isEmpty() ){ deIcon = currentTheme->itemIcon("desktop"); } //set the default icon if none given 
     460      if( !QFile::exists(deIcon) ){ deIcon = ":/images/desktop.png"; } 
     461      //Now add the item back to the widget 
     462      if(simpleDESwitcher){ sdeSwitcher->addItem(QIcon(deIcon), deList[i]); } 
     463      else{ deSwitcher->addItem( deList[i], deIcon, Backend::getDesktopComment(deList[i]) ); } 
     464    } 
    435465    //Set the switcher to the last used desktop environment 
    436     if( !lastDE.isEmpty() ){ deSwitcher->setCurrentItem(lastDE); } 
     466    if( !lastDE.isEmpty() ){  
     467      if(simpleDESwitcher){  
     468        int index = deList.indexOf(lastDE); 
     469        if(index != -1){ sdeSwitcher->setCurrentIndex(index); } 
     470        else{ sdeSwitcher->setCurrentIndex(0); } 
     471      }else{  
     472        deSwitcher->setCurrentItem(lastDE);  
     473      } 
     474    } 
    437475 
    438476} 
  • src-qt4/PCDM/src/pcdm-gui.h

    r1620346 rd9b0b9e8  
    6666    QToolButton *systemButton; 
    6767    QMenu* systemMenu; 
    68     FancySwitcher* deSwitcher; 
    69  
     68    FancySwitcher* deSwitcher; // full switcher 
     69    QComboBox* sdeSwitcher; //simple switcher 
     70    bool simpleDESwitcher; 
     71     
    7072    QProcess* vkbd; 
    7173    ThemeStruct* currentTheme; 
  • src-qt4/PCDM/src/themeStruct.cpp

    r1620346 rd9b0b9e8  
    9999            else{ items[index].y1 = y.section("-",0,0).toInt(); items[index].y2 = y.section("-",1,1).toInt(); } 
    100100        }else if(itemCat == "ORIENTATION"){ 
    101             items[index].isVertical = (val.toLower() == "vertical");     
     101            items[index].isVertical = (val.toLower() == "vertical");  
     102            if(val.toLower()=="simple"){ items[index].value = "simple"; } 
    102103        }else if(itemCat == "DISABLE"){ 
    103104            items[index].enabled = (val.toLower() != "true"); 
  • src-qt4/PCDM/themes/default/default.theme

    rdc1f572 rd9b0b9e8  
    3131DESKTOP_IMAGE=default-desktop.png       # Default Image for the DE selection if none found 
    3232  DESKTOP_IMAGE_SIZE=48x48                      # Size for the image (in pixels) 
    33   DESKTOP_ORIENTATION=horizontal                # [horizontal | vertical] 
     33  DESKTOP_ORIENTATION=horizontal                # [horizontal | vertical | simple] 
    3434  NEXTDE_IMAGE=nextDE.png                       # Next DE selection (right/down) 
    3535  PREVIOUSDE_IMAGE=previousDE.png               # Previous DE selection (left/up) 
Note: See TracChangeset for help on using the changeset viewer.