Ignore:
Timestamp:
Jul 11, 2013 11:07:43 AM (10 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
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/loginWidget.cpp

    r2d615ae r1d2d46a  
    4848        pushUserIcon->setDefaultAction( tmp3 ); 
    4949        pushUserIcon->setFocusPolicy(Qt::NoFocus); 
     50  listDE = new QComboBox; 
     51  deIcon = new QLabel; 
     52         
    5053  //Add the items to the grid 
    5154    //user not yet selected widgets 
     
    5659      flayout->addRow(pushUserIcon, listUsers); 
    5760      flayout->addRow(pushViewPassword, linePassword); 
     61      flayout->addRow(deIcon,listDE); 
     62    vlayout->addSpacing(15); 
    5863    vlayout->addLayout(flayout); 
     64    vlayout->addSpacing(20); 
    5965      hlayout2->addWidget(pushLogin); 
    6066    vlayout->addLayout(hlayout2); 
     
    6773  connect(listUserBig,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(slotUserSelected()) ); 
    6874  connect(listUserBig,SIGNAL(currentRowChanged(int)),this,SLOT(slotUserHighlighted(int)) ); 
     75  connect(listDE,SIGNAL(currentIndexChanged(int)),this,SLOT(slotDesktopChanged(int)) ); 
    6976  allowPasswordView(allowPWVisible); //setup signal/slots for pushViewPassword 
    7077  //Set this layout for the loginWidget 
     
    8996    pushLogin->setVisible(TRUE); 
    9097    pushViewPassword->setVisible(TRUE); 
     98    if( listDE->count() < 1 ){ listDE->setVisible(FALSE); deIcon->setVisible(FALSE); } 
     99    else{ listDE->setVisible(TRUE); deIcon->setVisible(TRUE); } 
    91100  }else{ 
    92101    userIcon->setVisible(TRUE); 
     
    96105    linePassword->setVisible(FALSE); 
    97106    pushLogin->setVisible(FALSE); 
    98     pushViewPassword->setVisible(FALSE);     
     107    pushViewPassword->setVisible(FALSE);  
     108    listDE->setVisible(FALSE); 
     109    deIcon->setVisible(FALSE); 
    99110  } 
    100111  if(pwVisible){ 
     
    185196} 
    186197 
     198void LoginWidget::slotDesktopChanged(int index){ 
     199  if(index == -1){ 
     200    deIcon->setPixmap(QPixmap("")); 
     201    deIcon->setToolTip(""); 
     202  }else{ 
     203    deIcon->setPixmap( QPixmap(desktopIcons[index]).scaled(desktopIconSize) ); 
     204    deIcon->setToolTip(desktopInfo[index]); 
     205  } 
     206} 
     207 
    187208//----------------------------- 
    188209//     PUBLIC FUNCTIONS 
     
    198219} 
    199220 
     221QString LoginWidget::currentDE(){ 
     222  QString de = listDE->currentText(); 
     223  return de; 
     224} 
     225 
    200226void LoginWidget::setCurrentUser(QString id){ 
    201227  int index = idL.indexOf(id); 
     
    207233    emit UserChanged(id); 
    208234  } 
     235} 
     236 
     237void LoginWidget::setCurrentDE(QString de){ 
     238  for(int i=0; i<listDE->count(); i++){ 
     239    if( listDE->itemText(i) == de ){ 
     240      listDE->setCurrentIndex(i); 
     241      break; 
     242    } 
     243  } 
     244  updateWidget(); 
    209245} 
    210246 
     
    227263} 
    228264 
     265void LoginWidget::setDesktops(QStringList text, QStringList icon, QStringList info){ 
     266  if((text.length() != icon.length()) && (text.length() != info.length()) ){ qDebug() << "LoginWidget: Unequal text/icon desktop lists"; return; } 
     267  listDE->clear(); 
     268  desktopIcons = icon; //save for later 
     269  desktopInfo = info; //save for later 
     270  for(int i=0; i<text.length(); i++){ 
     271    listDE->addItem(text[i]); 
     272  } 
     273} 
     274 
    229275void LoginWidget::displayHostName(QString name){ 
    230276  hostName = name; 
     
    249295} 
    250296 
     297void LoginWidget::setDesktopIconSize(QSize iconsize){ 
     298  desktopIconSize = iconsize; 
     299} 
     300 
    251301void LoginWidget::changeStyleSheet(QString item, QString style){ 
    252302  //Propagate the style sheet to both the buttons and the iconViewer 
     
    278328  listUserBig->setToolTip(tr("Available users")); 
    279329  linePassword->setToolTip(tr("Login password for the selected user")); 
     330  listDE->setToolTip(tr("Available desktop environments")); 
    280331  //Setup the computer/host name display 
    281332  if( hostName.isEmpty() ){ 
Note: See TracChangeset for help on using the changeset viewer.