VirtualBox

Changeset 1371 in vbox


Ignore:
Timestamp:
Mar 9, 2007 1:19:31 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19362
Message:

FE/Qt:

  • Added new Welcome picture (shown when no VMs are defined);
  • VBoxVMSettingsDlg::setup() now accepts a control name to bring the focus to;
  • Pressing the Edit button on the Description tab in the Selector window opens the settings dialog and sets the keyboard focus direcrlty to the description editor.
Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r1255 r1371  
    232232        images/vdm_remove_22px.png \
    233233        images/vdm_remove_disabled_22px.png \
     234        images/welcome.png \
    234235        images/about_600px.png
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h

    r1289 r1371  
    6666    void vmNew();
    6767    void vmSettings (const QString &aCategory = QString::null,
    68                      const QString &aSubPage = QString::null);
     68                     const QString &aControl = QString::null);
    6969    void vmDelete();
    7070    void vmStart();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r1289 r1371  
    6464class VBoxVMDetailsView : public QWidgetStack
    6565{
     66    Q_OBJECT
     67
    6668public:
    6769
     
    9092    }
    9193
    92     bool connectDetailsText (const char *aSignal, const QObject *aReceiver,
    93                              const char *aMember)
    94     {
    95         return connect (mDetailsText, aSignal, aReceiver, aMember);
     94signals:
     95
     96    void linkClicked (const QString &aURL);
     97
     98private 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);
    96108    }
    97109
     
    126138    mDetailsText->setFrameShape (QFrame::NoFrame);
    127139    mDetailsText->setPaper (backgroundBrush());
     140
     141    connect (mDetailsText, SIGNAL (linkClicked (const QString &)),
     142            this, SLOT (gotLinkClicked (const QString &)));
    128143
    129144    addWidget (mDetailsText, 0);
     
    332347void VBoxVMDescriptionPage::goToSettings()
    333348{
    334     mParent->vmSettings ("#general", "description");
     349    mParent->vmSettings ("#general", "teDescription");
    335350}
    336351
     
    562577             this, SLOT (vmStart()));
    563578
    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 &)));
    567581
    568582    /* listen to "media enumeration finished" signals */
     
    669683 *  Opens the VM settings dialog.
    670684 *
    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().
    674689 */
    675 void VBoxSelectorWnd::vmSettings (const QString &category, const QString &aSubPage)
    676 {
     690void 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
    677699    VBoxVMListBoxItem *item = (VBoxVMListBoxItem *) vmListBox->selectedItem();
    678700
    679     AssertMsgReturn (item, ("Item must be always selected here"), (void) 0);
     701    AssertMsgReturnVoid (item, ("Item must be always selected here"));
    680702
    681703    // open a direct session to modify VM settings
     
    690712    VBoxVMSettingsDlg dlg (this, "VBoxVMSettingsDlg");
    691713    dlg.getFromMachine (m);
    692     dlg.setup (category, aSubPage);
     714    dlg.setup (aCategory, aControl);
    693715
    694716    if (dlg.exec() == QDialog::Accepted)
     
    11521174             * something really simple */
    11531175            vmDetailsView->setDetailsText
    1154                 (tr ("<h3><img src=ico64x01.png align=right/>"
     1176                (tr ("<h3>"
    11551177                     "Welcome to VirtualBox!</h3>"
    11561178                     "<p>The left part of this window is intended to display "
     
    11581180                     "The list is empty now because you haven't created any virtual "
    11591181                     "machines yet."
     1182                     "<img src=welcome.png align=right/></p>"
    11601183                     "<p>In order to create a new virtual machine, press the "
    11611184                     "<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>"));
    11631190            vmRefreshAction->setEnabled (false);
    11641191        }
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h

    r1294 r1371  
    922922 *  Sets up this dialog.
    923923 *
     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 * 
    924933 *  @note Calling this method after the dialog is open has no sense.
    925934 *
    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.
    931937 */
    932 void VBoxVMSettingsDlg::setup (const QString &aCategory, const QString &aSubPage)
     938void VBoxVMSettingsDlg::setup (const QString &aCategory, const QString &aControl)
    933939{
    934940    if (!aCategory.isNull())
    935941    {
    936         /* search for first-level item */
     942        /* search for a list view item corresponding to the category */
    937943        QListViewItem *item = listView->findItem (aCategory, listView_Link);
    938944        if (item)
    939945        {
    940946            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())
    943950            {
    944                 QObjectList *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())
    946953                {
    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();
    951973                }
    952974            }
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