VirtualBox

Changeset 3045 in vbox


Ignore:
Timestamp:
Jun 5, 2007 10:41:33 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21818
Message:

Main, FE/Qt: Added support for asyncronous USB attach/detach errors.

Location:
trunk/src/VBox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h

    r2981 r3045  
    133133        SessionStateChangeEventType,
    134134        SnapshotEventType,
     135        USBDeviceStateChangeEventType,
    135136        RuntimeErrorEventType,
    136137        ModifierKeyChangeEventType,
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r2981 r3045  
    189189
    190190    void cannotAttachUSBDevice (const CConsole &console, const QString &device);
     191    void cannotAttachUSBDevice (const CConsole &console, const QString &device,
     192                                const CVirtualBoxErrorInfo &error);
    191193    void cannotDetachUSBDevice (const CConsole &console, const QString &device);
     194    void cannotDetachUSBDevice (const CConsole &console, const QString &device,
     195                                const CVirtualBoxErrorInfo &error);
    192196
    193197    void cannotCreateSharedFolder (QWidget *, const CMachine &,
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts

    r3017 r3045  
    7777    <message>
    7878        <source>Left Shift</source>
    79         <translation type="unfinished"></translation>
     79        <translation>Левый Shift</translation>
    8080    </message>
    8181    <message>
    8282        <source>Right Shift</source>
    83         <translation type="unfinished"></translation>
     83        <translation>Правый Shift</translation>
    8484    </message>
    8585    <message>
    8686        <source>Left Ctrl</source>
    87         <translation type="unfinished"></translation>
     87        <translation>Левый Ctrl</translation>
    8888    </message>
    8989    <message>
    9090        <source>Right Ctrl</source>
    91         <translation type="unfinished"></translation>
     91        <translation>Правый Ctrl</translation>
    9292    </message>
    9393    <message>
    9494        <source>Left Alt</source>
    95         <translation type="unfinished"></translation>
     95        <translation>Левый Alt</translation>
    9696    </message>
    9797    <message>
    9898        <source>Right Alt</source>
    99         <translation type="unfinished"></translation>
     99        <translation>Правый Alt</translation>
    100100    </message>
    101101    <message>
    102102        <source>Left WinKey</source>
    103         <translation type="unfinished"></translation>
     103        <translation>Левая Win-клавиша</translation>
    104104    </message>
    105105    <message>
    106106        <source>Right WinKey</source>
    107         <translation type="unfinished"></translation>
     107        <translation>Правая Win-клавиша</translation>
    108108    </message>
    109109    <message>
    110110        <source>Menu key</source>
    111         <translation type="unfinished"></translation>
     111        <translation>Клавиша Menu</translation>
    112112    </message>
    113113    <message>
    114114        <source>Alt Gr</source>
    115         <translation type="unfinished"></translation>
     115        <translation>Alt Gr</translation>
    116116    </message>
    117117    <message>
    118118        <source>Caps Lock</source>
    119         <translation type="unfinished"></translation>
     119        <translation>Caps Lock</translation>
    120120    </message>
    121121    <message>
    122122        <source>Scroll Lock</source>
    123         <translation type="unfinished"></translation>
     123        <translation>Scroll Lock</translation>
    124124    </message>
    125125    <message>
    126126        <source>&lt;key_%1&gt;</source>
    127         <translation type="unfinished"></translation>
     127        <translation>&lt;клавиша_%1&gt;</translation>
    128128    </message>
    129129</context>
     
    961961    <message>
    962962        <source>CD/DVD-ROM images (*.iso);;All files (*)</source>
    963         <translation type="unfinished"></translation>
     963        <translation>Образы CD/DVD-ROM (*.iso);;Все файлы (*)</translation>
    964964    </message>
    965965    <message>
    966966        <source>Floppy images (*.img);;All files (*)</source>
    967         <translation type="unfinished"></translation>
     967        <translation>Образы дискет (*.img);;Все файлы (*)</translation>
    968968    </message>
    969969</context>
     
    24212421    <message>
    24222422        <source>&lt;p&gt;VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.&lt;/p&gt;&lt;p&gt;Please update Guest Additions to the current version by choosing &lt;b&gt;Install Guest Additions&lt;/b&gt; from the &lt;b&gt;Devices&lt;/b&gt; menu.&lt;/p&gt;</source>
    2423         <translation type="unfinished"></translation>
     2423        <translation type="unfinished">&lt;p&gt;В гостевой ОС обнаружен слишком старый пакет Дополнений гостевой ОС: установлена версия %1, ожидается версия %2. Некоторые возможности, требующие Дополнений гостевой ОС (интеграция мыши, авто-размер экрана гостевой ОС), скорее всего, перестанут функционировать.&lt;/p&gt;&lt;p&gt;Пожалуйста, обновите Дополнения гостевой ОС до текущей версии, выбрав пункт &lt;b&gt;Установить Дополнения гостевой ОС&lt;/b&gt; в меню &lt;b&gt;Устройства&lt;/b&gt;.&lt;/p&gt;</translation>
    24242424    </message>
    24252425    <message>
    24262426        <source>&lt;p&gt;VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.&lt;/p&gt;&lt;p&gt;It is recommended to update Guest Additions to the current version  by choosing &lt;b&gt;Install Guest Additions&lt;/b&gt; from the &lt;b&gt;Devices&lt;/b&gt; menu.&lt;/p&gt;</source>
    2427         <translation type="unfinished"></translation>
     2427        <translation type="unfinished">&lt;p&gt;В гостевой ОС обнаружен устаревший пакет Дополнений гостевой ОС: установлена версия %1, ожидается версия %2. Некоторые возможности, требующие Дополнений гостевой ОС (интеграция мыши, авто-размер экрана гостевой ОС) могут перестать функционировать.&lt;/p&gt;&lt;p&gt;Рекомендуется обновить Дополнения гостевой ОС до текущей версии, выбрав пункт &lt;b&gt;Установить Дополнения гостевой ОС&lt;/b&gt; в меню &lt;b&gt;Устройства&lt;/b&gt;.&lt;/p&gt;</translation>
    24282428    </message>
    24292429    <message>
    24302430        <source>&lt;p&gt;VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.&lt;/p&gt;&lt;p&gt;Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of Guest Additions by choosing &lt;b&gt;Install Guest Additions&lt;/b&gt; from the &lt;b&gt;Devices&lt;/b&gt; menu.&lt;/p&gt;</source>
    2431         <translation type="unfinished"></translation>
     2431        <translation type="unfinished">&lt;p&gt;В гостевой ОС обнаружен слишком новый пакет Дополнений гостевой ОС: установлена версия %1, ожидается версия %2.&lt;/p&gt;&lt;p&gt;Использованее более новой версии Дополнений с более старой версией VirtualBox не поддерживается. Пожалуйста, установите подходящую версию Дополнений гостевой ОС, выбрав пункт &lt;b&gt;Установить Дополнения гостевой ОС&lt;/b&gt; в меню &lt;b&gt;Устройства&lt;/b&gt;.&lt;/p&gt;</translation>
    24322432    </message>
    24332433</context>
     
    26602660    <message>
    26612661        <source>Show &amp;Log...</source>
    2662         <translation type="unfinished"></translation>
     2662        <translation type="unfinished">Показать &amp;лог...</translation>
    26632663    </message>
    26642664    <message>
    26652665        <source>Show Log...</source>
    2666         <translation type="unfinished"></translation>
     2666        <translation type="unfinished">Показать лог...</translation>
    26672667    </message>
    26682668    <message>
     
    26722672    <message>
    26732673        <source>Show the log files of the selected virtual machine</source>
    2674         <translation type="unfinished"></translation>
     2674        <translation type="unfinished">Показать лог-файлы выбранной виртуальной машины</translation>
    26752675    </message>
    26762676</context>
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r3001 r3045  
    278278{
    279279public:
    280     ModifierKeyChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock) :
     280    ModifierKeyChangeEvent (bool fNumLock, bool fCapsLock, bool fScrollLock) :
    281281        QEvent ((QEvent::Type) VBoxDefs::ModifierKeyChangeEventType),
    282282        mfNumLock (fNumLock), mfCapsLock (fCapsLock), mfScrollLock (fScrollLock) {}
     
    286286private:
    287287    bool mfNumLock, mfCapsLock, mfScrollLock;
     288};
     289
     290/** USB device state change event */
     291class USBDeviceStateChangeEvent : public QEvent
     292{
     293public:
     294    USBDeviceStateChangeEvent (const CUSBDevice &aDevice, bool aAttached,
     295                               const CVirtualBoxErrorInfo &aError) :
     296        QEvent ((QEvent::Type) VBoxDefs::USBDeviceStateChangeEventType),
     297        mDevice (aDevice), mAttached (aAttached), mError (aError) {}
     298    CUSBDevice device() const { return mDevice; }
     299    bool attached() const { return mAttached; }
     300    CVirtualBoxErrorInfo error() const { return mError; }
     301private:
     302    CUSBDevice mDevice;
     303    bool mAttached;
     304    CVirtualBoxErrorInfo mError;
    288305};
    289306
     
    389406                                      IVirtualBoxErrorInfo *error)
    390407    {
    391         Q_UNUSED (device);
    392         Q_UNUSED (attached);
    393         Q_UNUSED (error);
    394 
    395         /// @todo update menu entries
    396 
     408        QApplication::postEvent (mView,
     409                                 new USBDeviceStateChangeEvent (
     410                                     CUSBDevice (device),
     411                                     bool (attached),
     412                                     CVirtualBoxErrorInfo (error)));
    397413        return S_OK;
    398414    }
     
    9921008                if (!destroyed && mainwnd->statusBar())
    9931009                    mainwnd->statusBar()->clear();
     1010
     1011                return true;
     1012            }
     1013
     1014            case VBoxDefs::USBDeviceStateChangeEventType:
     1015            {
     1016                USBDeviceStateChangeEvent *ue = (USBDeviceStateChangeEvent *)e;
     1017
     1018                if (ue->attached())
     1019                    vboxProblem().cannotAttachUSBDevice (
     1020                        cconsole,
     1021                        vboxGlobal().details (ue->device()), ue->error());
     1022                else
     1023                    vboxProblem().cannotDetachUSBDevice (
     1024                        cconsole,
     1025                        vboxGlobal().details (ue->device()), ue->error());
     1026
     1027                /// @todo update menu entries
    9941028
    9951029                return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r2981 r3045  
    11521152}
    11531153
     1154void VBoxProblemReporter::cannotAttachUSBDevice (const CConsole &console,
     1155                                                 const QString &device,
     1156                                                 const CVirtualBoxErrorInfo &error)
     1157{
     1158    message (&vboxGlobal().consoleWnd(), Error,
     1159        tr ("Failed to attach the USB device <b>%1</b> "
     1160            "to the virtual machine <b>%2</b>.")
     1161            .arg (device)
     1162            .arg (console.GetMachine().GetName()),
     1163        formatErrorInfo (error));
     1164}
     1165
    11541166void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
    11551167                                                 const QString &device)
     
    11641176            .arg (console.GetMachine().GetName()),
    11651177        formatErrorInfo (res));
     1178}
     1179
     1180void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
     1181                                                 const QString &device,
     1182                                                 const CVirtualBoxErrorInfo &error)
     1183{
     1184    message (&vboxGlobal().consoleWnd(), Error,
     1185        tr ("Failed to detach the USB device <b>%1</b> "
     1186            "from the virtual machine <b>%2</b>.")
     1187            .arg (device)
     1188            .arg (console.GetMachine().GetName()),
     1189        formatErrorInfo (error));
    11661190}
    11671191
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r3037 r3045  
    32003200
    32013201    /* VM might have been stopped when this message arrives */
    3202     if (mMachineState < MachineState_Running)
     3202    if (mMachineState < MachineState_Running ||
     3203        mMachineState == MachineState_Stopping)
    32033204    {
    32043205        LogFlowThisFunc (("Attach request ignored (mMachineState=%d).\n",
     
    32093210    if (aError != NULL)
    32103211    {
    3211         /* notify callback about an error */
     3212        /* notify callbacks about the error */
    32123213        onUSBDeviceStateChange (aDevice, true /* aAttached */, aError);
    32133214        return S_OK;
     
    32333234    HRESULT rc = attachUSBDevice (aDevice, pRhConfig);
    32343235
    3235     /// @todo notify listeners of IConsoleCallback in case of error
     3236    if (FAILED (rc))
     3237    {
     3238        /* take the current error info */
     3239        com::ErrorInfoKeeper eik;
     3240        /* the error must be a VirtualBoxErrorInfo instance */
     3241        ComPtr <IVirtualBoxErrorInfo> error = eik.takeError();
     3242        Assert (!error.isNull());
     3243        if (!error.isNull())
     3244        {
     3245            /* notify callbacks about the error */
     3246            onUSBDeviceStateChange (aDevice, true /* aAttached */, error);
     3247        }
     3248    }
     3249
    32363250    return rc;
    32373251}
     
    32923306    HRESULT rc = detachUSBDevice (it);
    32933307
    3294     /// @todo notify listeners of IConsoleCallback in case of error
     3308    if (FAILED (rc))
     3309    {
     3310        /* take the current error info */
     3311        com::ErrorInfoKeeper eik;
     3312        /* the error must be a VirtualBoxErrorInfo instance */
     3313        ComPtr <IVirtualBoxErrorInfo> error = eik.takeError();
     3314        Assert (!error.isNull());
     3315        if (!error.isNull())
     3316        {
     3317            /* notify callbacks about the error */
     3318            onUSBDeviceStateChange (device, false /* aAttached */, error);
     3319        }
     3320    }
     3321
    32953322    return rc;
    32963323}
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