Changeset 19103 in vbox
- Timestamp:
- Apr 22, 2009 10:11:02 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsUtils.h
r11968 r19103 100 100 }; 101 101 102 #ifdef Q_WS_WIN103 /**104 * QDialog class reimplementation to use for adding network interface.105 * It has one line-edit field for entering network interface's name and106 * common dialog's ok/cancel buttons.107 */108 class VBoxAddNIDialog : public QDialog109 {110 Q_OBJECT111 112 public:113 114 VBoxAddNIDialog (QWidget *aParent, const QString &aIfaceName) :115 QDialog (aParent),116 mLeName (0)117 {118 setWindowTitle (tr ("Add Host Interface"));119 QVBoxLayout *mainLayout = new QVBoxLayout (this);120 121 /* Setup Input layout */122 QHBoxLayout *inputLayout = new QHBoxLayout();123 QLabel *lbName = new QLabel (tr ("Interface Name"), this);124 mLeName = new QLineEdit (aIfaceName, this);125 mLeName->setWhatsThis (tr ("Descriptive name of the new "126 "network interface"));127 inputLayout->addWidget (lbName);128 inputLayout->addWidget (mLeName);129 connect (mLeName, SIGNAL (textChanged (const QString &)),130 this, SLOT (validate()));131 mainLayout->addLayout (inputLayout);132 133 /* Setup Button layout */134 QHBoxLayout *buttonLayout = new QHBoxLayout();135 mBtOk = new QPushButton (tr ("&OK"), this);136 QPushButton *btCancel = new QPushButton (tr ("Cancel"), this);137 connect (mBtOk, SIGNAL (clicked()), this, SLOT (accept()));138 connect (btCancel, SIGNAL (clicked()), this, SLOT (reject()));139 buttonLayout->addWidget (mBtOk);140 buttonLayout->addStretch();141 buttonLayout->addWidget (btCancel);142 mainLayout->addLayout (buttonLayout);143 144 /* Resize to fit the aIfaceName in one string */145 int requiredWidth = mLeName->fontMetrics().width (aIfaceName) +146 inputLayout->spacing() +147 lbName->fontMetrics().width (lbName->text()) +148 lbName->frameWidth() * 2 +149 lbName->lineWidth() * 2 +150 mainLayout->margin() * 2;151 resize (requiredWidth, minimumHeight());152 153 /* Validate interface name field */154 validate();155 }156 157 ~VBoxAddNIDialog() {}158 159 QString getName() { return mLeName->text(); }160 161 private slots:162 163 void validate()164 {165 mBtOk->setEnabled (!mLeName->text().isEmpty());166 }167 168 private:169 170 void showEvent (QShowEvent *aEvent)171 {172 setFixedHeight (height());173 QDialog::showEvent (aEvent);174 }175 176 QPushButton *mBtOk;177 QLineEdit *mLeName;178 };179 #endif180 181 102 class USBListItem : public QTreeWidgetItem 182 103 {
Note:
See TracChangeset
for help on using the changeset viewer.