VirtualBox

Changeset 37893 in vbox


Ignore:
Timestamp:
Jul 12, 2011 12:31:43 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72794
Message:

FE/Qt: Virtual Media Manager: 'Modify' action added, medium-type-change functionality moved into 'modify' action handler.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp

    r37888 r37893  
    5353    m_pLabel = new QILabel(this);
    5454    m_pLabel->setWordWrap(true);
    55     m_pLabel->useSizeHintForWidth(400);
     55    m_pLabel->useSizeHintForWidth(450);
    5656    m_pLabel->updateGeometry();
    5757    pMainLayout->addWidget(m_pLabel);
     
    109109{
    110110    /* Translate window title: */
    111     setWindowTitle(tr("Change medium type"));
     111    setWindowTitle(tr("Modify medium attributes"));
    112112
    113113    /* Translate description: */
    114     m_pLabel->setText(tr("<p>You are about to change the medium type of the virtual disk located in %1.</p>"
     114    m_pLabel->setText(tr("<p>You are about to change the attributes of the virtual disk located in <b>%1</b>.</p>"
     115                         "<p><i>Note: For now only the 'medium type' attribute is changeable.</i></p>"
    115116                         "<p>Please choose one of the following medium types and press <b>%2</b> "
    116117                         "to proceed or <b>%3</b> otherwise.</p>")
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp

    r37891 r37893  
    285285             this, SLOT (makeRequestForAdjustTable()));
    286286
    287     /* Setup information pane: */
    288     m_pChangeMediumTypeButton->setIcon(UIIconPool::iconSet(":/arrow_down_10px.png"));
    289     connect(m_pChangeMediumTypeButton, SIGNAL(clicked()), this, SLOT(sltOpenMediumTypeChangeDialog()));
    290     m_pChangeMediumTypeButton->setIconSize(QSize(10, 10));
    291 
    292287    /* Context menu composing */
    293288    mActionsContextMenu = new QMenu (this);
     
    296291    mAddAction     = new QAction (this);
    297292    mCopyAction    = new QAction (this);
     293    mModifyAction  = new QAction (this);
    298294    mRemoveAction  = new QAction (this);
    299295    mReleaseAction = new QAction (this);
     
    303299    connect (mAddAction, SIGNAL (triggered()), this, SLOT (doAddMedium()));
    304300    connect (mCopyAction, SIGNAL (triggered()), this, SLOT (doCopyMedium()));
     301    connect (mModifyAction, SIGNAL (triggered()), this, SLOT (doModifyMedium()));
    305302    connect (mRemoveAction, SIGNAL (triggered()), this, SLOT (doRemoveMedium()));
    306303    connect (mReleaseAction, SIGNAL (triggered()), this, SLOT (doReleaseMedium()));
     
    316313        ":/hd_add_disabled_22px.png", ":/hd_add_disabled_16px.png"));
    317314    mCopyAction->setIcon(UIIconPool::iconSetFull (
     315        QSize (22, 22), QSize (16, 16),
     316        ":/hd_add_22px.png", ":/hd_add_16px.png",
     317        ":/hd_add_disabled_22px.png", ":/hd_add_disabled_16px.png"));
     318    mModifyAction->setIcon(UIIconPool::iconSetFull (
    318319        QSize (22, 22), QSize (16, 16),
    319320        ":/hd_new_22px.png", ":/hd_new_16px.png",
     
    333334
    334335    mActionsContextMenu->addAction (mCopyAction);
     336    mActionsContextMenu->addAction (mModifyAction);
    335337    mActionsContextMenu->addAction (mRemoveAction);
    336338    mActionsContextMenu->addAction (mReleaseAction);
     
    362364//    mToolBar->addAction (mAddAction);
    363365    mToolBar->addAction (mCopyAction);
     366    mToolBar->addAction (mModifyAction);
    364367//    mToolBar->addSeparator();
    365368    mToolBar->addAction (mRemoveAction);
     
    373376//    mActionsMenu->addAction (mAddAction);
    374377    mActionsMenu->addAction (mCopyAction);
     378    mActionsMenu->addAction (mModifyAction);
    375379//    mActionsMenu->addSeparator();
    376380    mActionsMenu->addAction (mRemoveAction);
     
    607611    mAddAction->setText (tr ("&Add..."));
    608612    mCopyAction->setText (tr ("&Copy..."));
     613    mModifyAction->setText (tr ("&Modify..."));
    609614    mRemoveAction->setText (tr ("R&emove"));
    610615    mReleaseAction->setText (tr ("Re&lease"));
     
    614619    mAddAction->setShortcut (QKeySequence ("Ins"));
    615620    mCopyAction->setShortcut (QKeySequence ("Ctrl+C"));
     621    mModifyAction->setShortcut (QKeySequence ("Ctrl+Space"));
    616622    mRemoveAction->setShortcut (QKeySequence (QKeySequence::Delete));
    617623    mReleaseAction->setShortcut (QKeySequence ("Ctrl+L"));
     
    621627    mAddAction->setStatusTip (tr ("Add an existing medium"));
    622628    mCopyAction->setStatusTip (tr ("Copy an existing medium"));
     629    mModifyAction->setStatusTip (tr ("Modify an existing medium attributes"));
    623630    mRemoveAction->setStatusTip (tr ("Remove the selected medium"));
    624631    mReleaseAction->setStatusTip (tr ("Release the selected medium by detaching it from the machines"));
     
    631638    mCopyAction->setToolTip (mCopyAction->text().remove ('&') +
    632639        QString (" (%1)").arg (mCopyAction->shortcut().toString()));
     640    mModifyAction->setToolTip (mModifyAction->text().remove ('&') +
     641        QString (" (%1)").arg (mModifyAction->shortcut().toString()));
    633642    mRemoveAction->setToolTip (mRemoveAction->text().remove ('&') +
    634643        QString (" (%1)").arg (mRemoveAction->shortcut().toString()));
     
    10631072}
    10641073
     1074void VBoxMediaManagerDlg::doModifyMedium()
     1075{
     1076    MediaItem *pMediumItem = toMediaItem(currentTreeWidget()->currentItem());
     1077    UIMediumTypeChangeDialog dlg(this, pMediumItem->id());
     1078    if (dlg.exec() == QDialog::Accepted)
     1079    {
     1080        pMediumItem->refreshAll();
     1081        m_pTypePane->setText(pMediumItem->hardDiskType());
     1082    }
     1083}
     1084
    10651085void VBoxMediaManagerDlg::doRemoveMedium()
    10661086{
     
    14191439    bool copyEnabled    = currentTreeWidgetType() == VBoxDefs::MediumType_HardDisk &&
    14201440                          notInEnum && item && checkMediumFor (item, Action_Copy);
     1441    bool modifyEnabled  = currentTreeWidgetType() == VBoxDefs::MediumType_HardDisk &&
     1442                          notInEnum && item && checkMediumFor (item, Action_Modify);
    14211443    bool removeEnabled  = notInEnum && item && checkMediumFor (item, Action_Remove);
    14221444    bool releaseEnabled = item && checkMediumFor (item, Action_Release);
     
    14251447    mAddAction->setEnabled (addEnabled);
    14261448    mCopyAction->setEnabled (copyEnabled);
     1449    mModifyAction->setEnabled (modifyEnabled);
    14271450    mRemoveAction->setEnabled (removeEnabled);
    14281451    mReleaseAction->setEnabled (releaseEnabled);
     
    14431466        if (item->treeWidget() == mTwHD)
    14441467        {
    1445             /* Check if thats parent medium: */
    1446             bool fIsThatParentMedium = !item->medium().parent();
    1447             m_pChangeMediumTypeButton->setEnabled(fIsThatParentMedium);
    1448 
    1449             /* Other panes: */
    14501468            m_pTypePane->setText(item->hardDiskType());
    14511469            m_pLocationPane->setText(formatPaneText(item->location(), true, "end"));
     
    15441562        if (widgetList [i]->header()->sectionSize (0) != size0)
    15451563            widgetList [i]->header()->resizeSection (0, size0);
    1546     }
    1547 }
    1548 
    1549 void VBoxMediaManagerDlg::sltOpenMediumTypeChangeDialog()
    1550 {
    1551     MediaItem *pMediumItem = toMediaItem(currentTreeWidget()->currentItem());
    1552     UIMediumTypeChangeDialog dlg(this, pMediumItem->id());
    1553     if (dlg.exec() == QDialog::Accepted)
    1554     {
    1555         pMediumItem->refreshAll();
    1556         m_pTypePane->setText(pMediumItem->hardDiskType());
    15571564    }
    15581565}
     
    17611768        }
    17621769        case Action_Copy:
     1770        {
     1771            /* False for children: */
     1772            return !aItem->medium().parent();
     1773        }
     1774        case Action_Modify:
    17631775        {
    17641776            /* False for children: */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.h

    r37874 r37893  
    4040    enum TabIndex { HDTab = 0, CDTab, FDTab };
    4141    enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
    42     enum Action { Action_Select, Action_Edit, Action_Copy, Action_Remove, Action_Release };
     42    enum Action { Action_Select, Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
    4343
    4444public:
     
    8686    void doAddMedium();
    8787    void doCopyMedium();
     88    void doModifyMedium();
    8889    void doRemoveMedium();
    8990    void doReleaseMedium();
     
    100101    void makeRequestForAdjustTable();
    101102    void performTablesAdjustment();
    102 
    103     void sltOpenMediumTypeChangeDialog();
    104103
    105104private:
     
    159158    QAction     *mAddAction;
    160159    QAction     *mCopyAction;
     160    QAction     *mModifyAction;
    161161    QAction     *mRemoveAction;
    162162    QAction     *mReleaseAction;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.ui

    r37874 r37893  
    104104           </item>
    105105           <item row="0" column="1" >
    106             <layout class="QHBoxLayout">
    107              <item>
    108               <widget class="QILabel" name="m_pTypePane">
    109                <property name="sizePolicy">
    110                 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding">
    111                  <horstretch>0</horstretch>
    112                  <verstretch>0</verstretch>
    113                 </sizepolicy>
    114                </property>
    115               </widget>
    116              </item>
    117              <item>
    118               <widget class="QIToolButton" name="m_pChangeMediumTypeButton">
    119                <property name="autoRaise">
    120                 <bool>true</bool>
    121                </property>
    122                <property name="toolTip">
    123                 <string>Change medium type...</string>
    124                </property>
    125               </widget>
    126              </item>
    127             </layout>
     106            <widget class="QILabel" name="m_pTypePane">
     107             <property name="sizePolicy">
     108              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding">
     109               <horstretch>0</horstretch>
     110               <verstretch>0</verstretch>
     111              </sizepolicy>
     112             </property>
     113            </widget>
    128114           </item>
    129115           <item row="1" column="0" >
     
    413399   <header>QITabWidget.h</header>
    414400  </customwidget>
    415   <customwidget>
    416    <class>QIToolButton</class>
    417    <extends>QToolButton</extends>
    418    <header>QIToolButton.h</header>
    419   </customwidget>
    420401 </customwidgets>
    421402 <resources/>
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