Ignore:
Timestamp:
07/11/13 11:07:43 (2 years ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, enter/10, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
8679296
Parents:
b1457e5
Message:

Completely redo the simple desktop switcher option. It now puts it in the login widget underneath the password prompt. Also clean up the default theme a bit to accomodate these changes.

File:
1 edited

Legend:

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

    r4018e43 r1d2d46af  
    138138    toolbar->addAction(keyboardButton); 
    139139    connect( keyboardButton, SIGNAL(triggered()), this, SLOT(slotChangeKeyboardLayout()) ); 
    140      
     140 
    141141    //----Add a spacer 
    142142    QWidget* spacer = new QWidget(); 
    143     spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 
     143    spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); 
    144144    toolbar->addWidget(spacer); 
    145      
    146     if(simpleDESwitcher){ 
    147       if(DEBUG_MODE){ qDebug() << " - Create Simple DE Switcher"; } 
    148       //Create the simple DE Switcher 
    149       sdeSwitcher = new QComboBox(this);  
    150       sdeSwitcher->setFocusPolicy( Qt::NoFocus ); 
    151       sdeSwitcher->setIconSize(currentTheme->itemIconSize("toolbar")); 
    152       toolbar->addWidget(sdeSwitcher); 
    153       //Add an additional spacer 
    154       QWidget* spacer2 = new QWidget(); 
    155       spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 
    156       toolbar->addWidget(spacer2); 
    157        
    158     } 
    159      
     145         
    160146    //----System Shutdown/Restart 
    161147    if(DEBUG_MODE){ qDebug() << " - Create System Button"; } 
     
    219205     
    220206    //----Desktop Environment Switcher 
    221     if(!simpleDESwitcher){ 
     207    if(simpleDESwitcher){ 
     208      loginW->setDesktopIconSize(currentTheme->itemIconSize("desktop")); 
     209    }else{ 
    222210      if(DEBUG_MODE){ qDebug() << " - Create DE Switcher"; } 
    223211      //Create the switcher 
     
    260248  if(DEBUG_MODE){ qDebug() << " - Fill GUI with data"; } 
    261249  retranslateUi(); 
     250  if(simpleDESwitcher && !lastUser.isEmpty()){ 
     251     
     252  } 
    262253  if(DEBUG_MODE){ qDebug() << "Done with initialization"; } 
    263254 
     
    269260  QString binary; 
    270261  if(simpleDESwitcher){ 
    271     binary = Backend::getDesktopBinary(sdeSwitcher->currentText()); 
     262    binary = Backend::getDesktopBinary(loginW->currentDE()); 
    272263  }else{ 
    273264    binary = Backend::getDesktopBinary(deSwitcher->currentItem()); 
     
    286277void PCDMgui::slotLoginSuccess(){ 
    287278  QString de; 
    288   if(simpleDESwitcher){ de = sdeSwitcher->currentText(); } 
     279  if(simpleDESwitcher){ de = loginW->currentDE(); } 
    289280  else{ de = deSwitcher->currentItem(); } 
    290281  saveLastLogin( loginW->currentUsername(), de ); 
     
    320311 
    321312void PCDMgui::slotUserSelected(QString newuser){ 
     313  if(DEBUG_MODE){ qDebug() << "User selection changed:" << newuser; } 
    322314  if(newuser.isEmpty()){ 
    323     if(simpleDESwitcher){ sdeSwitcher->setVisible(FALSE); } 
    324     else{ deSwitcher->setVisible(FALSE); } 
    325   }else{ 
    326     if(simpleDESwitcher){ sdeSwitcher->setVisible(TRUE); } 
    327     else{ deSwitcher->setVisible(TRUE); } 
     315    if(!simpleDESwitcher){ deSwitcher->setVisible(FALSE); } 
     316  }else{ 
     317    if(!simpleDESwitcher){ deSwitcher->setVisible(TRUE); } 
    328318    //Try to load the user's last DE 
    329319    loadLastDE(newuser); 
     
    477467  } 
    478468  loginW->retranslateUi(); 
     469   
    479470  //The desktop switcher 
    480   if(simpleDESwitcher){ sdeSwitcher->clear(); } 
    481   else{ deSwitcher->removeAllItems(); } 
    482471   
    483472    //Get the new desktop list (translated) 
    484473    QStringList deList = Backend::getAvailableDesktops(); 
    485     for(int i=0; i<deList.length(); i++){ 
    486       QString deIcon = Backend::getDesktopIcon(deList[i]); 
    487       if( deIcon.isEmpty() ){ deIcon = currentTheme->itemIcon("desktop"); } //set the default icon if none given 
    488       if( !QFile::exists(deIcon) ){ deIcon = ":/images/desktop.png"; } 
    489       //Now add the item back to the widget 
    490       if(simpleDESwitcher){ sdeSwitcher->addItem(QIcon(deIcon), deList[i]); } 
    491       else{ deSwitcher->addItem( deList[i], deIcon, Backend::getDesktopComment(deList[i]) ); } 
    492     } 
    493     //Set the switcher to the last used desktop environment 
    494     if( !lastDE.isEmpty() ){  
    495       if(simpleDESwitcher){  
    496         int index = deList.indexOf(lastDE); 
    497         if(index != -1){ sdeSwitcher->setCurrentIndex(index); } 
    498         else{ sdeSwitcher->setCurrentIndex(0); } 
    499       }else{  
    500         deSwitcher->setCurrentItem(lastDE);  
     474    //Now fill the switcher 
     475    if(!simpleDESwitcher){ 
     476      deSwitcher->removeAllItems(); 
     477      for(int i=0; i<deList.length(); i++){ 
     478        QString deIcon = Backend::getDesktopIcon(deList[i]); 
     479        if( deIcon.isEmpty() ){ deIcon = currentTheme->itemIcon("desktop"); } //set the default icon if none given 
     480        if( !QFile::exists(deIcon) ){ deIcon = ":/images/desktop.png"; } 
     481        //Now add the item back to the widget 
     482        deSwitcher->addItem( deList[i], deIcon, Backend::getDesktopComment(deList[i]) ); 
    501483      } 
     484      //Set the switcher to the last used desktop environment 
     485      if( !lastDE.isEmpty() ){ deSwitcher->setCurrentItem(lastDE); } 
     486 
     487    }else{ 
     488      //Simple switcher on the login widget 
     489      QStringList deIcons, deInfo; 
     490      for(int i=0; i<deList.length(); i++){  
     491        QString ico = Backend::getDesktopIcon(deList[i]); 
     492        if(ico.isEmpty()){ ico = currentTheme->itemIcon("desktop"); } 
     493        if(!QFile::exists(ico)){ ico = ":/images/desktop.png"; } 
     494        deIcons << ico; 
     495        deInfo << Backend::getDesktopComment(deList[i]); 
     496      } 
     497      loginW->setDesktops(deList, deIcons, deInfo); 
     498      //Set the switcher to the last used desktop environment 
     499      if( !lastDE.isEmpty() ){ loginW->setCurrentDE(lastDE); } 
    502500    } 
    503501 
Note: See TracChangeset for help on using the changeset viewer.