VirtualBox

Changeset 20568 in vbox


Ignore:
Timestamp:
Jun 14, 2009 8:52:22 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48572
Message:

FE/Qt4: New Registration Dialog: Radio-buttons are now excluding depending line-edits.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxRegistrationDlg.h

    r19225 r20568  
    5252private slots:
    5353
    54     void tuneRadioButton (const QString &aNewText);
     54    void radioButtonToggled();
    5555
    5656    void accept();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.cpp

    r19413 r20568  
    237237    mLeNewFirstName->setMaxLength (50);
    238238
    239    mLeNewFirstName->setValidator (new QRegExpValidator (nameExp, this));
     239    mLeNewFirstName->setValidator (new QRegExpValidator (nameExp, this));
    240240
    241241    mLeNewLastName->setMaxLength (50);
     
    264264             this, SLOT (revalidate (QIWidgetValidator *)));
    265265
    266     connect (mRbOld, SIGNAL (toggled (bool)), mWvalReg, SLOT (revalidate()));
    267     connect (mRbNew, SIGNAL (toggled (bool)), mWvalReg, SLOT (revalidate()));
    268 
    269     connect (mLeOldEmail, SIGNAL (textEdited (const QString &)),
    270              this, SLOT (tuneRadioButton (const QString &)));
    271     connect (mLeOldPassword, SIGNAL (textEdited (const QString &)),
    272              this, SLOT (tuneRadioButton (const QString &)));
    273     connect (mLeNewFirstName, SIGNAL (textEdited (const QString &)),
    274              this, SLOT (tuneRadioButton (const QString &)));
    275     connect (mLeNewLastName, SIGNAL (textEdited (const QString &)),
    276              this, SLOT (tuneRadioButton (const QString &)));
    277     connect (mLeNewCompany, SIGNAL (textEdited (const QString &)),
    278              this, SLOT (tuneRadioButton (const QString &)));
    279     connect (mLeNewCountry, SIGNAL (textEdited (const QString &)),
    280              this, SLOT (tuneRadioButton (const QString &)));
    281     connect (mLeNewEmail, SIGNAL (textEdited (const QString &)),
    282              this, SLOT (tuneRadioButton (const QString &)));
    283     connect (mLeNewPassword, SIGNAL (textEdited (const QString &)),
    284              this, SLOT (tuneRadioButton (const QString &)));
    285     connect (mLeNewPassword2, SIGNAL (textEdited (const QString &)),
    286              this, SLOT (tuneRadioButton (const QString &)));
     266    connect (mRbOld, SIGNAL (toggled (bool)), this, SLOT (radioButtonToggled()));
     267    connect (mRbNew, SIGNAL (toggled (bool)), this, SLOT (radioButtonToggled()));
    287268
    288269    /* Setup other connections */
     
    294275    mLeOldEmail->setText (data.account());
    295276
    296     /* Update the next button state for pages with validation
    297      * (validityChanged() connected to enableNext() will do the job) */
    298     mWvalReg->revalidate();
     277    radioButtonToggled();
    299278
    300279    /* Initialize wizard hdr */
     
    325304}
    326305
    327 void VBoxRegistrationDlg::tuneRadioButton (const QString &aNewText)
    328 {
    329     QList <QLineEdit*> oldSet;
    330     oldSet << mLeOldEmail << mLeOldPassword;
    331 
    332     QList <QLineEdit*> newSet;
    333     newSet << mLeNewFirstName << mLeNewLastName
    334            << mLeNewCompany << mLeNewCountry
    335            << mLeNewEmail << mLeNewPassword << mLeNewPassword2;
    336 
    337     QLineEdit *le = qobject_cast <QLineEdit*> (sender());
    338 
    339     if (le && !aNewText.isEmpty() && oldSet.contains (le))
    340         mRbOld->setChecked (true);
    341     else if (le && !aNewText.isEmpty() && newSet.contains (le))
    342         mRbNew->setChecked (true);
     306void VBoxRegistrationDlg::radioButtonToggled()
     307{
     308    QRadioButton *current = mRbOld->isChecked() ? mRbOld : mRbNew;
     309
     310    mLeOldEmail->setEnabled (current == mRbOld);
     311    mLeOldPassword->setEnabled (current == mRbOld);
     312    mLeNewFirstName->setEnabled (current == mRbNew);
     313    mLeNewLastName->setEnabled (current == mRbNew);
     314    mLeNewCompany->setEnabled (current == mRbNew);
     315    mLeNewCountry->setEnabled (current == mRbNew);
     316    mLeNewEmail->setEnabled (current == mRbNew);
     317    mLeNewPassword->setEnabled (current == mRbNew);
     318    mLeNewPassword2->setEnabled (current == mRbNew);
    343319
    344320    mWvalReg->revalidate();
     
    395371
    396372    /* Enable control elements */
    397     mLeOldEmail->setEnabled (true);
    398     mLeOldPassword->setEnabled (true);
    399     mLeNewFirstName->setEnabled (true);
    400     mLeNewLastName->setEnabled (true);
    401     mLeNewCompany->setEnabled (true);
    402     mLeNewCountry->setEnabled (true);
    403     mLeNewEmail->setEnabled (true);
    404     mLeNewPassword->setEnabled (true);
    405     mLeNewPassword2->setEnabled (true);
     373    radioButtonToggled();
    406374    finishButton()->setEnabled (true);
    407375    cancelButton()->setEnabled (true);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette