Changeset 3802 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui
- Timestamp:
- Jul 24, 2007 9:12:30 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23142
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h
r3528 r3802 33 33 *****************************************************************************/ 34 34 35 /* defined in VBoxConsoleWnd.cpp */36 extern const char *GUI_FirstRun;37 35 38 36 /** … … 317 315 } 318 316 if (uuidHD.isNull() || !chd.isNull()) 319 cmachine.SetExtraData ( GUI_FirstRun, "yes");317 cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, "yes"); 320 318 } 321 319 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui
r2988 r3802 40 40 </property> 41 41 <property name="caption"> 42 <string>VBox USBFilterSettings</string>42 <string>VBoxSharedFoldersSettings</string> 43 43 <comment>don't translate</comment> 44 44 </property> … … 190 190 </vbox> 191 191 </widget> 192 <connections> 193 <connection> 194 <sender>listView</sender> 195 <signal>doubleClicked(QListViewItem*)</signal> 196 <receiver>VBoxSharedFoldersSettings</receiver> 197 <slot>processDoubleClick(QListViewItem*)</slot> 198 </connection> 199 </connections> 192 200 <includes> 193 201 <include location="local" impldecl="in declaration">VBoxGlobal.h</include> … … 200 208 </includes> 201 209 <variables> 202 <variable access="public">enum SFDialogType { WrongType = 0, GlobalType = 1, MachineType = 2, ConsoleType = 3};</variable>210 <variable access="public">enum SFDialogType { WrongType, GlobalType = 0x01, MachineType = 0x02, ConsoleType = 0x04 };</variable> 203 211 <variable access="private">bool mIsListViewChanged;</variable> 204 <variable access="private"> SFDialogTypemDialogType;</variable>212 <variable access="private">int mDialogType;</variable> 205 213 <variable access="private">CMachine mMachine;</variable> 206 214 <variable access="private">CConsole mConsole;</variable> … … 212 220 <slot>processOnItem( QListViewItem* )</slot> 213 221 <slot>processCurrentChanged( QListViewItem* )</slot> 222 <slot>processDoubleClick( QListViewItem* )</slot> 214 223 </slots> 215 224 <functions> 216 225 <function access="private">init()</function> 217 <function>setDialogType( VBoxSharedFoldersSettings::SFDialogType)</function>226 <function>setDialogType( int )</function> 218 227 <function access="private">removeSharedFolder( const QString &, const QString &, VBoxSharedFoldersSettings::SFDialogType )</function> 219 228 <function access="private">createSharedFolder( const QString &, const QString &, VBoxSharedFoldersSettings::SFDialogType )</function> … … 226 235 <function>putBackToConsole()</function> 227 236 <function access="private">putBackTo( CSharedFolderEnumerator &, QListViewItem* )</function> 237 <function access="private" returnType="QListViewItem*">searchRoot( bool )</function> 228 238 <function access="private" returnType="bool">isEditable( const QString & )</function> 229 239 </functions> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h
r2981 r3802 154 154 public: 155 155 156 enum DialogType { AddDType, EditDType }; 157 158 VBoxAddSFDialog (QWidget *aParent, VBoxAddSFDialog::DialogType aType) : 156 enum DialogType { AddDialogType, EditDialogType }; 157 158 VBoxAddSFDialog (QWidget *aParent, VBoxAddSFDialog::DialogType aType, 159 bool aEnableSelector /* for "permanent" checkbox */) : 159 160 QDialog (aParent, "VBoxAddSFDialog", true /* modal */), 160 mLePath (0), mLeName (0) 161 mLePath (0), mLeName (0), mCbPermanent (0) 161 162 { 162 163 switch (aType) 163 164 { 164 case AddD Type:165 case AddDialogType: 165 166 setCaption (tr ("Add Share")); 166 167 break; 167 case EditD Type:168 case EditDialogType: 168 169 setCaption (tr ("Edit Share")); 169 170 break; … … 174 175 175 176 /* Setup Input layout */ 176 QGridLayout *inputLayout = new QGridLayout (mainLayout, 2, 3, 10, "inputLayout");177 QGridLayout *inputLayout = new QGridLayout (mainLayout, 3, 3, 10, "inputLayout"); 177 178 QLabel *lbPath = new QLabel (tr ("Folder Path"), this); 178 179 mLePath = new QLineEdit (this); … … 199 200 inputLayout->addMultiCellWidget (mLeName, 1, 1, 1, 2); 200 201 202 if (aEnableSelector) 203 { 204 mCbPermanent = new QCheckBox ("&Make Permanent", this); 205 mCbPermanent->setChecked (true); 206 inputLayout->addMultiCellWidget (mCbPermanent, 2, 2, 0, 2); 207 } 208 201 209 /* Setup Button layout */ 202 210 QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout"); … … 219 227 QString getPath() { return mLePath->text(); } 220 228 QString getName() { return mLeName->text(); } 229 bool getPermanent() 230 { 231 return mCbPermanent ? mCbPermanent->isChecked() : true; 232 } 221 233 222 234 void setPath (const QString &aPath) { mLePath->setText (aPath); } 223 235 void setName (const QString &aName) { mLeName->setText (aName); } 236 void setPermanent (bool aPermanent) 237 { 238 if (mCbPermanent) 239 { 240 mCbPermanent->setChecked (aPermanent); 241 mCbPermanent->setEnabled (!aPermanent); 242 } 243 } 224 244 225 245 private slots: … … 272 292 QLineEdit *mLePath; 273 293 QLineEdit *mLeName; 294 QCheckBox *mCbPermanent; 274 295 }; 275 296 … … 301 322 } 302 323 303 void VBoxSharedFoldersSettings::setDialogType ( 304 VBoxSharedFoldersSettings::SFDialogType aType) 324 void VBoxSharedFoldersSettings::setDialogType (int aType) 305 325 { 306 326 mDialogType = aType; … … 456 476 457 477 /* This function is only available for MachineType dialog */ 458 Assert (mDialogType ==MachineType);478 Assert (mDialogType & MachineType); 459 479 /* Searching for MachineType item's root */ 460 480 QListViewItem *root = listView->findItem (QString::number (MachineType), 2); … … 470 490 471 491 /* This function is only available for ConsoleType dialog */ 472 Assert (mDialogType ==ConsoleType);492 Assert (mDialogType & ConsoleType); 473 493 /* Searching for ConsoleType item's root */ 474 494 QListViewItem *root = listView->findItem (QString::number (ConsoleType), 2); … … 507 527 508 528 529 QListViewItem* VBoxSharedFoldersSettings::searchRoot (bool aIsPermanent) 530 { 531 if (!aIsPermanent) 532 return listView->findItem (QString::number (ConsoleType), 2); 533 else if (mDialogType & MachineType) 534 return listView->findItem (QString::number (MachineType), 2); 535 else 536 return listView->findItem (QString::number (GlobalType), 2); 537 } 538 509 539 void VBoxSharedFoldersSettings::tbAddPressed() 510 540 { 511 541 /* Invoke Add-Box Dialog */ 512 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::AddDType); 542 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::AddDialogType, 543 mDialogType & ConsoleType); 513 544 if (dlg.exec() != QDialog::Accepted) 514 545 return; 515 546 QString name = dlg.getName(); 516 547 QString path = dlg.getPath(); 548 bool isPermanent = dlg.getPermanent(); 517 549 /* Shared folder's name & path could not be empty */ 518 550 Assert (!name.isEmpty() && !path.isEmpty()); 519 551 /* Searching root for the new listview item */ 520 QListViewItem *root = listView->findItem (QString::number (mDialogType), 2);552 QListViewItem *root = searchRoot (isPermanent); 521 553 Assert (root); 522 554 /* Appending a new listview item to the root */ 523 VBoxRichListItem *item = new VBoxRichListItem (VBoxRichListItem::EllipsisFile, 524 root, name, path); 555 VBoxRichListItem *item = new VBoxRichListItem ( 556 VBoxRichListItem::EllipsisFile, root, name, path); 557 /* Make the created item selected */ 525 558 listView->ensureItemVisible (item); 526 559 listView->setCurrentItem (item); 527 560 processCurrentChanged (item); 528 561 listView->setFocus(); 562 529 563 mIsListViewChanged = true; 530 564 } … … 534 568 /* Check selected item */ 535 569 QListViewItem *selectedItem = listView->selectedItem(); 536 VBoxRichListItem *item = 0;537 if (selectedItem->rtti() == VBoxRichListItem::QIRichListItemId)538 item = static_cast<VBoxRichListItem*> (selectedItem);570 VBoxRichListItem *item = 571 selectedItem->rtti() == VBoxRichListItem::QIRichListItemId ? 572 static_cast<VBoxRichListItem*> (selectedItem) : 0; 539 573 Assert (item); 540 /* Invoke Add-Box Dialog */ 541 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::EditDType); 574 Assert (item->parent()); 575 /* Invoke Edit-Box Dialog */ 576 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::EditDialogType, 577 mDialogType & ConsoleType); 542 578 dlg.setPath (item->getText (1)); 543 579 dlg.setName (item->getText (0)); 580 dlg.setPermanent ((SFDialogType)item->parent()->text (2).toInt() 581 != ConsoleType); 544 582 if (dlg.exec() != QDialog::Accepted) 545 583 return; 546 584 QString name = dlg.getName(); 547 585 QString path = dlg.getPath(); 586 bool isPermanent = dlg.getPermanent(); 548 587 /* Shared folder's name & path could not be empty */ 549 588 Assert (!name.isEmpty() && !path.isEmpty()); 589 /* Searching new root for the selected listview item */ 590 QListViewItem *root = searchRoot (isPermanent); 591 Assert (root); 550 592 /* Updating an edited listview item */ 551 593 item->updateText (1, path); 552 594 item->updateText (0, name); 595 if (item->parent() != root) 596 { 597 /* Move the selected item into new location */ 598 item->parent()->takeItem (item); 599 root->insertItem (item); 600 601 /* Make the created item selected */ 602 listView->ensureItemVisible (item); 603 listView->setCurrentItem (item); 604 processCurrentChanged (item); 605 listView->setFocus(); 606 } 607 553 608 mIsListViewChanged = true; 554 609 } … … 591 646 } 592 647 648 void VBoxSharedFoldersSettings::processDoubleClick (QListViewItem *aItem) 649 { 650 bool editEnabled = aItem && aItem->parent() && 651 isEditable (aItem->parent()->text (2)); 652 if (editEnabled) 653 tbEditPressed(); 654 } 655 593 656 bool VBoxSharedFoldersSettings::isEditable (const QString &aKey) 594 657 { … … 601 664 if (!type) 602 665 AssertMsgFailed (("Incorrect listview item key value\n")); 603 return type == mDialogType;666 return mDialogType & type; 604 667 } 605 668 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r3490 r3802 29 29 ** place of a destructor. 30 30 *****************************************************************************/ 31 32 33 extern const char *GUI_SaveMountedAtRuntime;34 extern const char *GUI_FirstRun;35 31 36 32 … … 1524 1520 1525 1521 /* other features */ 1526 QString saveRtimeImages = cmachine.GetExtraData ( GUI_SaveMountedAtRuntime);1522 QString saveRtimeImages = cmachine.GetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime); 1527 1523 chbRememberMedia->setChecked (saveRtimeImages != "no"); 1528 1524 … … 1867 1863 1868 1864 /* other features */ 1869 cmachine.SetExtraData ( GUI_SaveMountedAtRuntime,1865 cmachine.SetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime, 1870 1866 chbRememberMedia->isChecked() ? "yes" : "no"); 1871 1867 … … 1980 1976 * and/or disk configuration were changed */ 1981 1977 if (mResetFirstRunFlag) 1982 cmachine.SetExtraData ( GUI_FirstRun, QString::null);1978 cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null); 1983 1979 1984 1980 /* audio */
Note:
See TracChangeset
for help on using the changeset viewer.