Changeset 1371 in vbox
- Timestamp:
- Mar 9, 2007 1:19:31 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 19362
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
r1255 r1371 232 232 images/vdm_remove_22px.png \ 233 233 images/vdm_remove_disabled_22px.png \ 234 images/welcome.png \ 234 235 images/about_600px.png -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h
r1289 r1371 66 66 void vmNew(); 67 67 void vmSettings (const QString &aCategory = QString::null, 68 const QString &a SubPage= QString::null);68 const QString &aControl = QString::null); 69 69 void vmDelete(); 70 70 void vmStart(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r1289 r1371 64 64 class VBoxVMDetailsView : public QWidgetStack 65 65 { 66 Q_OBJECT 67 66 68 public: 67 69 … … 90 92 } 91 93 92 bool connectDetailsText (const char *aSignal, const QObject *aReceiver, 93 const char *aMember) 94 { 95 return connect (mDetailsText, aSignal, aReceiver, aMember); 94 signals: 95 96 void linkClicked (const QString &aURL); 97 98 private slots: 99 100 void gotLinkClicked (const QString &aURL) 101 { 102 QString text = mDetailsText->text(); 103 emit linkClicked (aURL); 104 /* QTextBrowser will try to get the URL from the mime source factory 105 * and show an empty "page" after a failure. Reset the text to avoid 106 * this. */ 107 mDetailsText->setText (text); 96 108 } 97 109 … … 126 138 mDetailsText->setFrameShape (QFrame::NoFrame); 127 139 mDetailsText->setPaper (backgroundBrush()); 140 141 connect (mDetailsText, SIGNAL (linkClicked (const QString &)), 142 this, SLOT (gotLinkClicked (const QString &))); 128 143 129 144 addWidget (mDetailsText, 0); … … 332 347 void VBoxVMDescriptionPage::goToSettings() 333 348 { 334 mParent->vmSettings ("#general", " description");349 mParent->vmSettings ("#general", "teDescription"); 335 350 } 336 351 … … 562 577 this, SLOT (vmStart())); 563 578 564 vmDetailsView->connectDetailsText ( 565 SIGNAL (linkClicked (const QString &)), 566 this, SLOT (vmSettings (const QString &))); 579 connect (vmDetailsView, SIGNAL (linkClicked (const QString &)), 580 this, SLOT (vmSettings (const QString &))); 567 581 568 582 /* listen to "media enumeration finished" signals */ … … 669 683 * Opens the VM settings dialog. 670 684 * 671 * @param category 672 * Category to select in the settings dialog. See 673 * VBoxVMSettingsDlg::setup(). 685 * @param aCategory Category to select in the settings dialog. See 686 * VBoxVMSettingsDlg::setup(). 687 * @param aControl Widget name to select in the settings dialog. See 688 * VBoxVMSettingsDlg::setup(). 674 689 */ 675 void VBoxSelectorWnd::vmSettings (const QString &category, const QString &aSubPage) 676 { 690 void VBoxSelectorWnd::vmSettings (const QString &aCategory, const QString &aControl) 691 { 692 if (!aCategory.isEmpty() && aCategory [0] != '#') 693 { 694 /* Assume it's a href from the Details HTML */ 695 vboxGlobal().openURL (aCategory); 696 return; 697 } 698 677 699 VBoxVMListBoxItem *item = (VBoxVMListBoxItem *) vmListBox->selectedItem(); 678 700 679 AssertMsgReturn (item, ("Item must be always selected here"), (void) 0);701 AssertMsgReturnVoid (item, ("Item must be always selected here")); 680 702 681 703 // open a direct session to modify VM settings … … 690 712 VBoxVMSettingsDlg dlg (this, "VBoxVMSettingsDlg"); 691 713 dlg.getFromMachine (m); 692 dlg.setup ( category, aSubPage);714 dlg.setup (aCategory, aControl); 693 715 694 716 if (dlg.exec() == QDialog::Accepted) … … 1152 1174 * something really simple */ 1153 1175 vmDetailsView->setDetailsText 1154 (tr ("<h3> <img src=ico64x01.png align=right/>"1176 (tr ("<h3>" 1155 1177 "Welcome to VirtualBox!</h3>" 1156 1178 "<p>The left part of this window is intended to display " … … 1158 1180 "The list is empty now because you haven't created any virtual " 1159 1181 "machines yet." 1182 "<img src=welcome.png align=right/></p>" 1160 1183 "<p>In order to create a new virtual machine, press the " 1161 1184 "<b>New</b> button in the main tool bar located " 1162 "at the top of the window.")); 1185 "at the top of the window.</p>" 1186 "<p>You can press the <b>F1</b> key to get instant help, " 1187 "or visit " 1188 "<a href=http://www.virtualbox.org>www.virtualbox.org</a> " 1189 "for the latest information and news.</p>")); 1163 1190 vmRefreshAction->setEnabled (false); 1164 1191 } -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r1294 r1371 922 922 * Sets up this dialog. 923 923 * 924 * If @a aCategory is non-null, it should be one of values from the hidden 925 * '[cat]' column of #listView (see VBoxVMSettingsDlg.ui in qdesigner) 926 * prepended with the '#' sign. In this case, the specified category page 927 * will be activated when the dialog is open. 928 * 929 * If @a aWidget is non-null, it should be a name of one of widgets 930 * from the given category page. In this case, the specified widget 931 * will get focus when the dialog is open. 932 * 924 933 * @note Calling this method after the dialog is open has no sense. 925 934 * 926 * @param category 927 * Category to select when the dialog is open. Must be one of 928 * values from the hidden '[cat]' column of #listView 929 * (see VBoxVMSettingsDlg.ui in qdesigner) prepended with the '#' 930 * sign. 935 * @param aCategory Category to select when the dialog is open or null. 936 * @param aWidget Category to select when the dialog is open or null. 931 937 */ 932 void VBoxVMSettingsDlg::setup (const QString &aCategory, const QString &a SubPage)938 void VBoxVMSettingsDlg::setup (const QString &aCategory, const QString &aControl) 933 939 { 934 940 if (!aCategory.isNull()) 935 941 { 936 /* search for first-level item*/942 /* search for a list view item corresponding to the category */ 937 943 QListViewItem *item = listView->findItem (aCategory, listView_Link); 938 944 if (item) 939 945 { 940 946 listView->setSelected (item, true); 941 /* search for second-level item */ 942 if (!aSubPage.isNull()) 947 948 /* search for a widget with the given name */ 949 if (!aControl.isNull()) 943 950 { 944 QObject List *list = widgetStack->visibleWidget()->queryList ("QTabWidget");945 for (QObject *obj = list->first(); obj != NULL; obj = list->next())951 QObject *obj = widgetStack->visibleWidget()->child (aControl); 952 if (obj && obj->isWidgetType()) 946 953 { 947 QTabWidget *tabWidget = static_cast<QTabWidget*> (obj); 948 for (int index = 0; index < tabWidget->count(); ++index) 949 if (tabWidget->page (index)->name() == aSubPage) 950 tabWidget->setCurrentPage (index); 954 QWidget *w = static_cast <QWidget *> (obj); 955 QWidgetList parents; 956 QWidget *p = w; 957 while ((p = p->parentWidget()) != NULL) 958 { 959 if (!strcmp (p->className(), "QTabWidget")) 960 { 961 /* the tab contents widget is two steps down 962 * (QTabWidget -> QWidgetStack -> QWidget) */ 963 QWidget *c = parents.last(); 964 if (c) 965 c = parents.prev(); 966 if (c) 967 static_cast <QTabWidget *> (p)->showPage (c); 968 } 969 parents.append (p); 970 } 971 972 w->setFocus(); 951 973 } 952 974 }
Note:
See TracChangeset
for help on using the changeset viewer.