VirtualBox

Changeset 29015 in vbox


Ignore:
Timestamp:
May 4, 2010 1:30:16 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt: 4865: HD, CD, FD device LEDs are now synchronized with device presence.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

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

    r28800 r29015  
    5757
    5858        QString strToolTip = QApplication::translate("VBoxConsoleWnd", "<p style='white-space:pre'><nobr>Indicates the activity "
    59                                 "of the virtual hard disks:</nobr>%1</p>", "HDD tooltip");
     59                                                     "of the virtual hard disks:</nobr>%1</p>", "HDD tooltip");
    6060
    6161        QString strFullData;
    62         bool bAttachmentsPresent = false;
     62        bool fAttachmentsPresent = false;
    6363
    6464        const CStorageControllerVector &controllers = machine.GetStorageControllers();
     
    7474                    .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
    7575                    .arg(VBoxMedium(attachment.GetMedium(), VBoxDefs::MediumType_HardDisk).location());
    76                 bAttachmentsPresent = true;
     76                fAttachmentsPresent = true;
    7777            }
    7878            if (!strAttData.isNull())
     
    8080        }
    8181
    82         if (!bAttachmentsPresent)
    83             strFullData += QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>No hard disks attached</b></nobr>", "HDD tooltip");
     82        /* For now we will hide that LED at all if there are no attachments! */
     83        setHidden(!fAttachmentsPresent);
     84        //if (!fAttachmentsPresent)
     85        //    strFullData += QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>No hard disks attached</b></nobr>", "HDD tooltip");
    8486
    8587        setToolTip(strToolTip.arg(strFullData));
    86         setState(bAttachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
     88        setState(fAttachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
    8789    }
    8890
     
    121123
    122124        QString strToolTip = QApplication::translate("VBoxConsoleWnd", "<p style='white-space:pre'><nobr>Indicates the activity "
    123                                 "of the CD/DVD devices:</nobr>%1</p>", "CD/DVD tooltip");
     125                                                     "of the CD/DVD devices:</nobr>%1</p>", "CD/DVD tooltip");
    124126
    125127        QString strFullData;
    126         bool bAttachmentsPresent = false;
     128        bool fAttachmentsPresent = false;
     129        bool fAttachmentsMounted = false;
    127130
    128131        const CStorageControllerVector &controllers = machine.GetStorageControllers();
     
    139142                    .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
    140143                    .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
     144                fAttachmentsPresent = true;
    141145                if (!vboxMedium.isNull())
    142                     bAttachmentsPresent = true;
     146                    fAttachmentsMounted = true;
    143147            }
    144148            if (!strAttData.isNull())
     
    146150        }
    147151
    148         if (strFullData.isNull())
    149             strFullData = QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>No CD/DVD devices attached</b></nobr>", "CD/DVD tooltip");
     152        /* For now we will hide that LED at all if there are no attachments! */
     153        setHidden(!fAttachmentsPresent);
     154        //if (!fAttachmentsPresent)
     155        //    strFullData = QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>No CD/DVD devices attached</b></nobr>", "CD/DVD tooltip");
    150156
    151157        setToolTip(strToolTip.arg(strFullData));
    152         setState(bAttachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
     158        setState(fAttachmentsMounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
    153159    }
    154160
     
    186192        const CMachine &machine = m_session.GetMachine();
    187193
    188         QString tip = QApplication::translate("VBoxConsoleWnd", "<p style='white-space:pre'><nobr>Indicates the activity "
    189                           "of the floppy devices:</nobr>%1</p>", "FD tooltip");
    190         QString data;
    191         bool attachmentsPresent = false;
     194        QString strToolTip = QApplication::translate("VBoxConsoleWnd", "<p style='white-space:pre'><nobr>Indicates the activity "
     195                                                     "of the floppy devices:</nobr>%1</p>", "FD tooltip");
     196
     197        QString strFullData;
     198        bool fAttachmentsPresent = false;
     199        bool fAttachmentsMounted = false;
    192200
    193201        const CStorageControllerVector &controllers = machine.GetStorageControllers();
    194202        foreach (const CStorageController &controller, controllers)
    195203        {
    196             QString attData;
    197             const CMediumAttachmentVector &attachments = machine.GetMediumAttachmentsOfController (controller.GetName());
     204            QString strAttData;
     205            const CMediumAttachmentVector &attachments = machine.GetMediumAttachmentsOfController(controller.GetName());
    198206            foreach (const CMediumAttachment &attachment, attachments)
    199207            {
    200208                if (attachment.GetType() != KDeviceType_Floppy)
    201209                    continue;
    202                 VBoxMedium vboxMedium (attachment.GetMedium(), VBoxDefs::MediumType_Floppy);
    203                 attData += QString ("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
    204                     .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
    205                     .arg (vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
     210                VBoxMedium vboxMedium(attachment.GetMedium(), VBoxDefs::MediumType_Floppy);
     211                strAttData += QString("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
     212                    .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
     213                    .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
     214                fAttachmentsPresent = true;
    206215                if (!vboxMedium.isNull())
    207                     attachmentsPresent = true;
     216                    fAttachmentsMounted = true;
    208217            }
    209             if (!attData.isNull())
    210                 data += QString ("<br><nobr><b>%1</b></nobr>").arg (controller.GetName()) + attData;
    211         }
    212 
    213         if (data.isNull())
    214             data = QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>No floppy devices attached</b></nobr>", "FD tooltip");
    215 
    216         setToolTip (tip.arg (data));
    217         setState (attachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
     218            if (!strAttData.isNull())
     219                strFullData += QString("<br><nobr><b>%1</b></nobr>").arg(controller.GetName()) + strAttData;
     220        }
     221
     222        /* For now we will hide that LED at all if there are no attachments! */
     223        setHidden(!fAttachmentsPresent);
     224        //if (!fAttachmentsPresent)
     225        //    strFullData = QApplication::translate("VBoxConsoleWnd", "<br><nobr><b>No floppy devices attached</b></nobr>", "FD tooltip");
     226
     227        setToolTip(strToolTip.arg(strFullData));
     228        setState(fAttachmentsMounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
    218229    }
    219230
     
    666677                m_IndicatorsPool[index] = new UIIndicatorOpticalDisks(m_session);
    667678                break;
     679            case UIIndicatorIndex_FloppyDisks:
     680                m_IndicatorsPool[index] = new UIIndicatorFloppyDisks(m_session);
     681                break;
    668682            case UIIndicatorIndex_NetworkAdapters:
    669683                m_IndicatorsPool[index] = new UIIndicatorNetworkAdapters(m_session);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r28994 r29015  
    176176            pStateIndicator->setState(state);
    177177    }
     178    pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_FloppyDisks);
     179    if (pStateIndicator->state() != KDeviceActivity_Null)
     180    {
     181        int state = console.GetDeviceActivity(KDeviceType_Floppy);
     182        if (pStateIndicator->state() != state)
     183            pStateIndicator->setState(state);
     184    }
    178185    pStateIndicator = indicatorsPool()->indicator(UIIndicatorIndex_USBDevices);
    179186    if (pStateIndicator->state() != KDeviceActivity_Null)
     
    205212        if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->isEnabled())
    206213            machineLogic()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->menu()->exec(pEvent->globalPos());
     214    }
     215    else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_FloppyDisks))
     216    {
     217        if (machineLogic()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices)->isEnabled())
     218            machineLogic()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices)->menu()->exec(pEvent->globalPos());
    207219    }
    208220    else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_USBDevices))
     
    256268    if (iElement & UIVisualElement_CDStuff)
    257269        indicatorsPool()->indicator(UIIndicatorIndex_OpticalDisks)->updateAppearance();
     270    if (iElement & UIVisualElement_FDStuff)
     271        indicatorsPool()->indicator(UIIndicatorIndex_FloppyDisks)->updateAppearance();
    258272    if (iElement & UIVisualElement_USBStuff &&
    259273        !indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->isHidden())
     
    379393            this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    380394
     395    /* Floppy Disks: */
     396    QIStateIndicator *pLedFloppyDisks = indicatorsPool()->indicator(UIIndicatorIndex_FloppyDisks);
     397    pIndicatorBoxHLayout->addWidget(pLedFloppyDisks);
     398    connect(pLedFloppyDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
     399            this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
     400
    381401    /* USB Devices: */
    382402    QIStateIndicator *pLedUSBDevices = indicatorsPool()->indicator(UIIndicatorIndex_USBDevices);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette