Changeset 4364 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui
- Timestamp:
- Aug 24, 2007 6:34:50 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23911
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui
r4071 r4364 1358 1358 <functions> 1359 1359 <function access="private">init()</function> 1360 <function access="private" returnType="QString">pagePath( QWidget * )</function> 1360 1361 <function access="private" returnType="bool">event( QEvent * )</function> 1361 1362 <function access="protected">showEvent( QShowEvent * )</function> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h
r4071 r4364 340 340 /* General page */ 341 341 342 /// @todo (dmik) remove 343 // leVDIFolder->setValidator (new QRegExpValidator (QRegExp (".+"), this)); 344 // leMachineFolder->setValidator (new QRegExpValidator (QRegExp (".+"), this)); 345 346 wvalGeneral = new QIWidgetValidator (pageGeneral, this); 342 wvalGeneral = new QIWidgetValidator (pagePath (pageGeneral), pageGeneral, this); 347 343 connect (wvalGeneral, SIGNAL (validityChanged (const QIWidgetValidator *)), 348 344 this, SLOT (enableOk( const QIWidgetValidator *))); … … 350 346 /* Keyboard page */ 351 347 352 wvalKeyboard = new QIWidgetValidator ( pageKeyboard, this);348 wvalKeyboard = new QIWidgetValidator (pagePath (pageKeyboard), pageKeyboard, this); 353 349 connect (wvalKeyboard, SIGNAL (validityChanged (const QIWidgetValidator *)), 354 350 this, SLOT (enableOk( const QIWidgetValidator *))); … … 432 428 } 433 429 430 /** 431 * Returns a path to the given page of this settings dialog. See ::path() for 432 * details. 433 */ 434 QString VBoxGlobalSettingsDlg::pagePath (QWidget *aPage) 435 { 436 QListViewItem *li = listView-> 437 findItem (QString::number (widgetStack->id (aPage)), 1); 438 return ::path (li); 439 } 440 434 441 bool VBoxGlobalSettingsDlg::event (QEvent *aEvent) 435 442 { … … 526 533 Q_UNUSED (wval); 527 534 535 /* reset the warning text; interested parties will set it during 536 * validation */ 537 setWarning (QString::null); 538 539 QString wvalWarning; 540 528 541 /* detect the overall validity */ 529 542 bool newValid = true; … … 534 547 while ((obj = it.current()) != 0) 535 548 { 536 newValid &= ((QIWidgetValidator *) obj)->isValid(); 537 ++it; 549 QIWidgetValidator *wval = (QIWidgetValidator *) obj; 550 newValid = wval->isValid(); 551 if (!newValid) 552 { 553 wvalWarning = wval->warningText(); 554 break; 555 } 556 ++ it; 538 557 } 539 558 delete l; 540 559 } 541 560 561 if (warningString.isNull() && !wvalWarning.isNull()) 562 { 563 /* try to set the generic error message when invalid but no specific 564 * message is provided */ 565 setWarning (wvalWarning); 566 } 567 542 568 if (valid != newValid) 543 569 { 544 570 valid = newValid; 545 571 buttonOk->setEnabled (valid); 572 /// @todo in VBoxVMSettingsDlg.ui.h, this is absent at all. Is it 573 /// really what we want? 574 #if 0 546 575 if (valid) 547 576 warningSpacer->changeSize (0, 0, QSizePolicy::Expanding); 548 577 else 549 578 warningSpacer->changeSize (0, 0); 579 #endif 550 580 warningLabel->setHidden (valid); 551 581 warningPixmap->setHidden (valid); … … 846 876 /* setup validation */ 847 877 848 QIWidgetValidator *wval = new QIWidgetValidator (settings, settings); 878 QIWidgetValidator *wval = 879 new QIWidgetValidator (pagePath (pageUSB), settings, settings); 849 880 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)), 850 881 this, SLOT (enableOk (const QIWidgetValidator *))); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r4354 r4364 3166 3166 <functions> 3167 3167 <function access="private">init()</function> 3168 <function access="private" returnType="QString">pagePath( QWidget * )</function> 3168 3169 <function>setup( const QString &, const QString & )</function> 3169 3170 <function>getFromMachine( const CMachine & machine )</function> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r4324 r4364 562 562 const uint MaxVRAM = sysProps.GetMaxGuestVRAM(); 563 563 564 leName->setValidator ( new QRegExpValidator( QRegExp( ".+" ), this ));564 leName->setValidator (new QRegExpValidator (QRegExp (".+"), this)); 565 565 566 566 leRAM->setValidator (new QIntValidator (MinRAM, MaxRAM, this)); 567 567 leVRAM->setValidator (new QIntValidator (MinVRAM, MaxVRAM, this)); 568 568 569 wvalGeneral = new QIWidgetValidator ( pageGeneral, this);569 wvalGeneral = new QIWidgetValidator (pagePath (pageGeneral), pageGeneral, this); 570 570 connect (wvalGeneral, SIGNAL (validityChanged (const QIWidgetValidator *)), 571 571 this, SLOT(enableOk (const QIWidgetValidator *))); … … 614 614 "and allows to quickly select a different hard disk.")); 615 615 616 wvalHDD = new QIWidgetValidator ( pageHDD, this);616 wvalHDD = new QIWidgetValidator (pagePath (pageHDD), pageHDD, this); 617 617 connect (wvalHDD, SIGNAL (validityChanged (const QIWidgetValidator *)), 618 618 this, SLOT (enableOk (const QIWidgetValidator *))); … … 649 649 "drive and allows to quickly select a different image.")); 650 650 651 wvalDVD = new QIWidgetValidator (page DVD, this);651 wvalDVD = new QIWidgetValidator (pagePath (pageDVD), pageDVD, this); 652 652 connect (wvalDVD, SIGNAL (validityChanged (const QIWidgetValidator *)), 653 653 this, SLOT (enableOk (const QIWidgetValidator *))); … … 675 675 "drive and allows to quickly select a different image.")); 676 676 677 wvalFloppy = new QIWidgetValidator (page Floppy, this);677 wvalFloppy = new QIWidgetValidator (pagePath (pageFloppy), pageFloppy, this); 678 678 connect (wvalFloppy, SIGNAL (validityChanged (const QIWidgetValidator *)), 679 679 this, SLOT (enableOk (const QIWidgetValidator *))); … … 761 761 "using a standard RDP client.")); 762 762 763 ULONG maxPort = 65535; 764 leVRDPPort->setValidator (new QIntValidator (0, maxPort, this)); 765 leVRDPTimeout->setValidator (new QIntValidator (0, maxPort, this)); 766 wvalVRDP = new QIWidgetValidator (pageVRDP, this); 763 leVRDPPort->setValidator (new QIntValidator (0, 0xFFFF, this)); 764 leVRDPTimeout->setValidator (new QIntValidator (this)); 765 wvalVRDP = new QIWidgetValidator (pagePath (pageVRDP), pageVRDP, this); 767 766 connect (wvalVRDP, SIGNAL (validityChanged (const QIWidgetValidator *)), 768 767 this, SLOT (enableOk (const QIWidgetValidator *))); … … 878 877 cbVRDPAuthType->insertItem (vboxGlobal().toString (CEnums::VRDPAuthGuest)); 879 878 leVRDPTimeout->setAlignment (Qt::AlignRight); 879 } 880 881 /** 882 * Returns a path to the given page of this settings dialog. See ::path() for 883 * details. 884 */ 885 QString VBoxVMSettingsDlg::pagePath (QWidget *aPage) 886 { 887 QListViewItem *li = listView-> 888 findItem (QString::number (widgetStack->id (aPage)), 1); 889 return ::path (li); 880 890 } 881 891 … … 1298 1308 1299 1309 1300 void VBoxVMSettingsDlg::enableOk ( const QIWidgetValidator *wval)1310 void VBoxVMSettingsDlg::enableOk (const QIWidgetValidator *wval) 1301 1311 { 1302 1312 Q_UNUSED (wval); … … 1305 1315 * validation */ 1306 1316 setWarning (QString::null); 1317 1318 QString wvalWarning; 1307 1319 1308 1320 /* detect the overall validity */ … … 1314 1326 while ((obj = it.current()) != 0) 1315 1327 { 1316 newValid &= ((QIWidgetValidator *) obj)->isValid(); 1317 ++it; 1328 QIWidgetValidator *wval = (QIWidgetValidator *) obj; 1329 newValid = wval->isValid(); 1330 if (!newValid) 1331 { 1332 wvalWarning = wval->warningText(); 1333 break; 1334 } 1335 ++ it; 1318 1336 } 1319 1337 delete l; 1338 } 1339 1340 if (warningString.isNull() && !wvalWarning.isNull()) 1341 { 1342 /* try to set the generic error message when invalid but no specific 1343 * message is provided */ 1344 setWarning (wvalWarning); 1320 1345 } 1321 1346 … … 1337 1362 1338 1363 QString warningText; 1339 QString pageTitle = ::path (listView->currentItem());1364 QString pageTitle = pagePath (pg); 1340 1365 1341 1366 if (pg == pageHDD) … … 1506 1531 } 1507 1532 } 1508 }1509 else if (pg == pageVRDP)1510 {1511 if (pageVRDP->isEnabled())1512 {1513 valid = !(grbVRDP->isChecked() &&1514 (leVRDPPort->text().isEmpty() || leVRDPTimeout->text().isEmpty()));1515 if (!valid && leVRDPPort->text().isEmpty())1516 warningText = tr ("VRDP Port is not set ");1517 if (!valid && leVRDPTimeout->text().isEmpty())1518 warningText = tr ("VRDP Timeout is not set ");1519 }1520 else1521 valid = true;1522 1533 } 1523 1534 … … 2191 2202 page->loadList (mInterfaceList, mNoInterfaces); 2192 2203 page->getFromAdapter (aAdapter); 2193 tbwNetwork->addTab (page, QString (tr ("Adapter %1", "network")) 2194 .arg (aAdapter.GetSlot())); 2204 QString pageTitle = QString (tr ("Adapter %1", "network")) 2205 .arg (aAdapter.GetSlot()); 2206 tbwNetwork->addTab (page, pageTitle); 2195 2207 2196 2208 /* fix the tab order so that main dialog's buttons are always the last */ … … 2200 2212 2201 2213 /* setup validation */ 2202 QIWidgetValidator *wval = new QIWidgetValidator (pageNetwork, this); 2214 QIWidgetValidator *wval = 2215 new QIWidgetValidator (QString ("%1: %2") 2216 .arg (pagePath (pageNetwork), pageTitle), 2217 pageNetwork, this); 2203 2218 connect (page->grbEnabled, SIGNAL (toggled (bool)), wval, SLOT (revalidate())); 2204 2219 connect (page->cbNetworkAttachment, SIGNAL (activated (const QString &)), … … 2228 2243 VBoxVMSerialPortSettings *page = new VBoxVMSerialPortSettings(); 2229 2244 page->getFromPort (aPort); 2230 tbwSerialPorts->addTab (page, QString (tr ("Port %1", "serial ports")) 2231 .arg (aPort.GetSlot())); 2245 QString pageTitle = QString (tr ("Port %1", "serial ports")) 2246 .arg (aPort.GetSlot()); 2247 tbwSerialPorts->addTab (page, pageTitle); 2232 2248 2233 2249 /* fix the tab order so that main dialog's buttons are always the last */ … … 2237 2253 2238 2254 /* setup validation */ 2239 QIWidgetValidator *wval = new QIWidgetValidator (pageSerial, this); 2255 QIWidgetValidator *wval = 2256 new QIWidgetValidator (QString ("%1: %2") 2257 .arg (pagePath (pageSerial), pageTitle), 2258 pageSerial, this); 2240 2259 connect (page->mSerialPortBox, SIGNAL (toggled (bool)), 2241 2260 wval, SLOT (revalidate())); … … 2355 2374 /* setup validation */ 2356 2375 2357 QIWidgetValidator *wval = new QIWidgetValidator (settings, settings); 2376 QIWidgetValidator *wval = 2377 new QIWidgetValidator (pagePath (pageUSB), settings, settings); 2358 2378 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)), 2359 2379 this, SLOT (enableOk (const QIWidgetValidator *)));
Note:
See TracChangeset
for help on using the changeset viewer.