VirtualBox

Changeset 4297 in vbox


Ignore:
Timestamp:
Aug 22, 2007 8:49:37 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
23820
Message:

Main/GUI: Implemented the Stuck state.

Location:
trunk/src/VBox
Files:
25 edited

Legend:

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

    r4202 r4297  
    185185    QPopupMenu *mMainMenu;
    186186
    187     QActionGroup *runningActions;
     187    QActionGroup *mRunningActions;
     188    QActionGroup *mRunningOrPausedActions;
    188189
    189190    // Machine actions
     
    231232    QPopupMenu *devicesMountFloppyMenu;
    232233    QPopupMenu *devicesMountDVDMenu;
    233     QPopupMenu *devicesSharedFolders;
     234    QPopupMenu *devicesSFMenu;
    234235    QPopupMenu *devicesNetworkMenu;
    235236    VBoxUSBMenu *devicesUSBMenu;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r4166 r4297  
    217217    void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);
    218218
     219    bool remindAboutGuruMeditation (const CConsole &aConsole,
     220                                    const QString &aLogFolder);
     221
    219222    int remindAboutUnsetHD (QWidget *aParent);
    220223
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ar.ts

    r3829 r4297  
    495495    </message>
    496496    <message>
    497         <source>&amp;Shared Folders</source>
     497        <source>&amp;Shared Folders...</source>
    498498        <translation type="unfinished"></translation>
    499499    </message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_de.ts

    r4205 r4297  
    453453    </message>
    454454    <message>
    455         <source>&amp;Shared Folders</source>
    456         <translation>&amp;Gemeinsame Ordner</translation>
     455        <source>&amp;Shared Folders...</source>
     456        <translation>&amp;Gemeinsame Ordner...</translation>
    457457    </message>
    458458    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts

    r3918 r4297  
    484484    </message>
    485485    <message>
    486         <source>&amp;Shared Folders</source>
    487         <translation>&amp;Directorios Compartidos</translation>
     486        <source>&amp;Shared Folders...</source>
     487        <translation>&amp;Directorios Compartidos...</translation>
    488488    </message>
    489489    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fi.ts

    r3829 r4297  
    456456    </message>
    457457    <message>
    458         <source>&amp;Shared Folders</source>
    459         <translation>&amp;Jaetut Kansiot</translation>
     458        <source>&amp;Shared Folders...</source>
     459        <translation>&amp;Jaetut Kansiot...</translation>
    460460    </message>
    461461    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts

    r3829 r4297  
    484484    </message>
    485485    <message>
    486         <source>&amp;Shared Folders</source>
    487         <translation>Répertoire&amp;s partagés</translation>
     486        <source>&amp;Shared Folders...</source>
     487        <translation>Répertoire&amp;s partagés...</translation>
    488488    </message>
    489489    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_hu.ts

    r3829 r4297  
    461461    </message>
    462462    <message>
    463         <source>&amp;Shared Folders</source>
    464         <translation>&amp;Osztott mappák</translation>
     463        <source>&amp;Shared Folders...</source>
     464        <translation>&amp;Osztott mappák...</translation>
    465465    </message>
    466466    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_it.ts

    r3829 r4297  
    484484    </message>
    485485    <message>
    486         <source>&amp;Shared Folders</source>
    487         <translation>Cartelle Condivi&amp;se</translation>
     486        <source>&amp;Shared Folders...</source>
     487        <translation>Cartelle Condivi&amp;se...</translation>
    488488    </message>
    489489    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts

    r3829 r4297  
    456456    </message>
    457457    <message>
    458         <source>&amp;Shared Folders</source>
    459         <translation>共有フォルダ(&amp;S)</translation>
     458        <source>&amp;Shared Folders...</source>
     459        <translation>共有フォルダ(&amp;S)...</translation>
    460460    </message>
    461461    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ko.ts

    r3829 r4297  
    457457    </message>
    458458    <message>
    459         <source>&amp;Shared Folders</source>
    460         <translation>공유 폴더(&amp;S)</translation>
     459        <source>&amp;Shared Folders...</source>
     460        <translation>공유 폴더(&amp;S)...</translation>
    461461    </message>
    462462    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pl.ts

    r4139 r4297  
    457457    </message>
    458458    <message>
    459         <source>&amp;Shared Folders</source>
    460         <translation>Udo&amp;stępnione foldery</translation>
     459        <source>&amp;Shared Folders...</source>
     460        <translation>Udo&amp;stępnione foldery...</translation>
    461461    </message>
    462462    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt_BR.ts

    r3829 r4297  
    457457    </message>
    458458    <message>
    459         <source>&amp;Shared Folders</source>
    460         <translation>Pastas Compartilhada&amp;s</translation>
     459        <source>&amp;Shared Folders...</source>
     460        <translation>Pastas Compartilhada&amp;s...</translation>
    461461    </message>
    462462    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ro.ts

    r3829 r4297  
    484484    </message>
    485485    <message>
    486         <source>&amp;Shared Folders</source>
    487         <translation>Directoare &amp;partajate</translation>
     486        <source>&amp;Shared Folders...</source>
     487        <translation>Directoare &amp;partajate...</translation>
    488488    </message>
    489489    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts

    r4118 r4297  
    457457    </message>
    458458    <message>
    459         <source>&amp;Shared Folders</source>
    460         <translation>О&amp;бщие папки</translation>
     459        <source>&amp;Shared Folders...</source>
     460        <translation>О&amp;бщие папки...</translation>
    461461    </message>
    462462    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sv.ts

    r3829 r4297  
    457457    </message>
    458458    <message>
    459         <source>&amp;Shared Folders</source>
    460         <translation>&amp;Delade mappar</translation>
     459        <source>&amp;Shared Folders...</source>
     460        <translation>&amp;Delade mappar...</translation>
    461461    </message>
    462462    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_xx_YY.ts

    r3829 r4297  
    456456    </message>
    457457    <message>
    458         <source>&amp;Shared Folders</source>
     458        <source>&amp;Shared Folders...</source>
    459459        <translation type="unfinished"></translation>
    460460    </message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_CN.ts

    r3829 r4297  
    484484    </message>
    485485    <message>
    486         <source>&amp;Shared Folders</source>
    487         <translation>共享文件夹(&amp;S)</translation>
     486        <source>&amp;Shared Folders...</source>
     487        <translation>共享文件夹(&amp;S)...</translation>
    488488    </message>
    489489    <message>
  • trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_TW.ts

    r3829 r4297  
    764764    </message>
    765765    <message>
    766         <source>&amp;Shared Folders</source>
    767         <translation>分享資料夾(&amp;S)</translation>
     766        <source>&amp;Shared Folders...</source>
     767        <translation>分享資料夾(&amp;S)</translation>
    768768    </message>
    769769    <message>
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r4255 r4297  
    24852485                }
    24862486            }
     2487            /* fall through */
     2488        }
     2489        case CEnums::Stuck:
     2490        {
    24872491            /* reuse the focus event handler to uncapture everything */
    24882492            if (hasFocus())
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r4203 r4297  
    3333#include <qbuttongroup.h>
    3434#include <qradiobutton.h>
     35#include <qfile.h>
    3536#include <qdir.h>
    3637#include <qpushbutton.h>
     
    141142    ///// Actions ///////////////////////////////////////////////////////////
    142143
    143     /*
    144      *  a group for all actions that are enabled only when the VM is running.
    145      *  note that only actions whose enabled state depends exclusively on the
    146      *  running state of the VM are added to this group.
    147      */
    148     runningActions = new QActionGroup (this);
    149     runningActions->setExclusive (false);
     144    /* a group for all actions that are enabled only when the VM is running.
     145     * Note that only actions whose enabled state depends exclusively on the
     146     * execution state of the VM are added to this group. */
     147    mRunningActions = new QActionGroup (this);
     148    mRunningActions->setExclusive (false);
     149
     150    /* a group for all actions that are enabled when the VM is running or
     151     * paused. Note that only actions whose enabled state depends exclusively
     152     * on the execution state of the VM are added to this group. */
     153    mRunningOrPausedActions = new QActionGroup (this);
     154    mRunningOrPausedActions->setExclusive (false);
    150155
    151156    /* VM menu actions */
     
    161166    vmSeamlessAction->setToggleAction (true);
    162167
    163     vmAutoresizeGuestAction = new QAction (runningActions, "vmAutoresizeGuestAction");
     168    vmAutoresizeGuestAction = new QAction (mRunningActions, "vmAutoresizeGuestAction");
    164169    vmAutoresizeGuestAction->setIconSet (
    165170        VBoxGlobal::iconSet ("auto_resize_on_16px.png", "auto_resize_on_disabled_16px.png"));
     
    172177                             "adjust_win_size_disabled_16px.png"));
    173178
    174     vmTypeCADAction = new QAction (runningActions, "vmTypeCADAction");
     179    vmTypeCADAction = new QAction (mRunningActions, "vmTypeCADAction");
    175180    vmTypeCADAction->setIconSet (VBoxGlobal::iconSet ("hostkey_16px.png",
    176181                                                      "hostkey_disabled_16px.png"));
    177182
    178183#if defined(Q_WS_X11)
    179     vmTypeCABSAction = new QAction (runningActions, "vmTypeCABSAction");
     184    vmTypeCABSAction = new QAction (mRunningActions, "vmTypeCABSAction");
    180185    vmTypeCABSAction->setIconSet (VBoxGlobal::iconSet ("hostkey_16px.png",
    181186                                                       "hostkey_disabled_16px.png"));
    182187#endif
    183188
    184     vmResetAction = new QAction (runningActions, "vmResetAction");
     189    vmResetAction = new QAction (mRunningActions, "vmResetAction");
    185190    vmResetAction->setIconSet (VBoxGlobal::iconSet ("reset_16px.png",
    186                                            "reset_disabled_16px.png"));
    187 
    188     vmPauseAction = new QAction( this, "vmPauseAction" );
     191                                                    "reset_disabled_16px.png"));
     192
     193    vmPauseAction = new QAction (this, "vmPauseAction");
    189194    vmPauseAction->setIconSet (VBoxGlobal::iconSet ("pause_16px.png"));
    190     vmPauseAction->setToggleAction( true );
    191 
    192     vmACPIShutdownAction = new QAction (this, "vmACPIShutdownAction");
     195    vmPauseAction->setToggleAction (true);
     196
     197    vmACPIShutdownAction = new QAction (mRunningActions, "vmACPIShutdownAction");
    193198    vmACPIShutdownAction->setIconSet (
    194199        VBoxGlobal::iconSet ("acpi_16px.png", "acpi_disabled_16px.png"));
     
    197202    vmCloseAction->setIconSet (VBoxGlobal::iconSet ("exit_16px.png"));
    198203
    199     vmTakeSnapshotAction = new QAction (this, "vmTakeSnapshotAction");
     204    vmTakeSnapshotAction = new QAction (mRunningOrPausedActions, "vmTakeSnapshotAction");
    200205    vmTakeSnapshotAction->setIconSet (VBoxGlobal::iconSet (
    201206        "take_snapshot_16px.png", "take_snapshot_dis_16px.png"));
     
    208213    /* Devices menu actions */
    209214
    210     devicesMountFloppyImageAction = new QAction (runningActions, "devicesMountFloppyImageAction");
     215    devicesMountFloppyImageAction = new QAction (mRunningOrPausedActions,
     216                                                 "devicesMountFloppyImageAction");
    211217
    212218    devicesUnmountFloppyAction = new QAction (this, "devicesUnmountFloppyAction");
    213219    devicesUnmountFloppyAction->setIconSet (VBoxGlobal::iconSet ("fd_unmount_16px.png",
    214                                                         "fd_unmount_dis_16px.png"));
    215 
    216     devicesMountDVDImageAction = new QAction (runningActions, "devicesMountISOImageAction");
     220                                                                 "fd_unmount_dis_16px.png"));
     221
     222    devicesMountDVDImageAction = new QAction (mRunningOrPausedActions,
     223                                              "devicesMountISOImageAction");
    217224
    218225    devicesUnmountDVDAction = new QAction (this, "devicesUnmountDVDAction");
     
    220227                                                     "cd_unmount_dis_16px.png"));
    221228
    222     devicesSFDialogAction = new QAction (runningActions, "devicesSFDialogAction");
     229    devicesSFDialogAction = new QAction (mRunningOrPausedActions,
     230                                         "devicesSFDialogAction");
    223231    devicesSFDialogAction->setIconSet (VBoxGlobal::iconSet ("shared_folder_16px.png",
    224232                                                            "shared_folder_disabled_16px.png"));
    225233
    226     devicesSwitchVrdpAction = new QAction (runningActions, "devicesSwitchVrdpAction");
     234    devicesSwitchVrdpAction = new QAction (mRunningOrPausedActions,
     235                                           "devicesSwitchVrdpAction");
    227236    devicesSwitchVrdpAction->setIconSet (VBoxGlobal::iconSet ("vrdp_16px.png",
    228237                                                              "vrdp_disabled_16px.png"));
    229238    devicesSwitchVrdpAction->setToggleAction (true);
    230239
    231     devicesInstallGuestToolsAction = new QAction (runningActions, "devicesInstallGuestToolsAction");
     240    devicesInstallGuestToolsAction = new QAction (mRunningActions,
     241                                                  "devicesInstallGuestToolsAction");
    232242    devicesInstallGuestToolsAction->setIconSet (VBoxGlobal::iconSet ("guesttools_16px.png",
    233243                                                                     "guesttools_disabled_16px.png"));
     
    248258    /* Help menu actions */
    249259
    250     helpWebAction = new QAction( this, "helpWebAction" );
     260    helpWebAction = new QAction (this, "helpWebAction");
    251261    helpWebAction->setIconSet (VBoxGlobal::iconSet ("site_16px.png"));
    252     helpAboutAction = new QAction( this, "helpAboutAction" );
     262    helpAboutAction = new QAction (this, "helpAboutAction");
    253263    helpAboutAction->setIconSet (VBoxGlobal::iconSet ("about_16px.png"));
    254     helpResetMessagesAction = new QAction( this, "helpResetMessagesAction" );
     264    helpResetMessagesAction = new QAction (this, "helpResetMessagesAction");
    255265    helpResetMessagesAction->setIconSet (VBoxGlobal::iconSet ("reset_16px.png"));
    256266
     
    298308    devicesMountFloppyMenu = new QPopupMenu (devicesMenu, "devicesMountFloppyMenu");
    299309    devicesMountDVDMenu = new QPopupMenu (devicesMenu, "devicesMountDVDMenu");
    300     devicesSharedFolders = new QPopupMenu (devicesMenu, "devicesSharedFolders");
     310    devicesSFMenu = new QPopupMenu (devicesMenu, "devicesSFMenu");
    301311    devicesNetworkMenu = new QPopupMenu (devicesMenu, "devicesNetworkMenu");
    302312    devicesUSBMenu = new VBoxUSBMenu (devicesMenu);
     
    307317    devicesUnmountDVDAction->addTo (devicesMenu);
    308318    devicesMenu->insertSeparator();
     319
    309320    devicesMenu->insertItem (VBoxGlobal::iconSet ("fd_16px.png", "fd_disabled_16px.png"),
    310321        QString::null, devicesMountFloppyMenu, devicesMountFloppyMenuId);
    311322    devicesUnmountFloppyAction->addTo (devicesMenu);
    312323    devicesMenu->insertSeparator();
     324
    313325    devicesMenu->insertItem (VBoxGlobal::iconSet ("usb_16px.png", "usb_disabled_16px.png"),
    314326        QString::null, devicesUSBMenu, devicesUSBMenuId);
    315327    devicesUSBMenuSeparatorId = devicesMenu->insertSeparator();
     328
    316329    devicesSFDialogAction->addTo (devicesMenu);
    317330    devicesSFMenuSeparatorId = devicesMenu->insertSeparator();
     331    devicesSFDialogAction->addTo (devicesSFMenu);
     332
    318333    devicesMenu->insertItem (VBoxGlobal::iconSet ("nw_16px.png", "nw_disabled_16px.png"),
    319334        QString::null, devicesNetworkMenu, devicesNetworkMenuId);
    320335    devicesMenu->insertSeparator();
     336
    321337    devicesSwitchVrdpAction->addTo (devicesMenu);
    322338    devicesVRDPMenuSeparatorId = devicesMenu->insertSeparator();
     339
    323340    devicesInstallGuestToolsAction->addTo (devicesMenu);
    324341
     
    477494    connect (devicesMountDVDMenu, SIGNAL(activated(int)), this, SLOT(captureDVD(int)));
    478495    connect (devicesUSBMenu, SIGNAL(activated(int)), this, SLOT(switchUSB(int)));
    479     connect (devicesSharedFolders, SIGNAL(activated(int)), this, SLOT(devicesOpenSFDialog()));
    480496    connect (devicesNetworkMenu, SIGNAL(activated(int)), this, SLOT(activateNetworkMenu(int)));
    481497
     
    10611077    }
    10621078
    1063     if (machine_state > CEnums::Paused)
     1079    if (machine_state > CEnums::Paused &&
     1080        machine_state != CEnums::Stuck)
    10641081    {
    10651082        /*
     
    10911108        bool success = true;
    10921109
    1093         bool wasPaused = machine_state == CEnums::Paused;
     1110        bool wasPaused = machine_state == CEnums::Paused ||
     1111                         machine_state == CEnums::Stuck;
    10941112        if (!wasPaused)
    10951113        {
     
    11081126            dlg.pmIcon->setPixmap (vboxGlobal().vmGuestOSTypeIcon (typeId));
    11091127
    1110             /* read the last user's choice for the given VM */
    1111             QStringList lastAction = QStringList::split (',',
    1112                 cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction));
    1113             AssertWrapperOk (cmachine);
    1114             if (lastAction [0] == PowerOff)
    1115                 dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbPowerOff));
    1116             else if (lastAction [0] == Save)
    1117                 dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbSave));
    1118             else
    1119                 dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbPowerOff));
    1120             dlg.cbDiscardCurState->setChecked (
    1121                 lastAction.count() > 1 && lastAction [1] == DiscardCurState);
    1122 
    11231128            /* make the Discard checkbox invisible if there are no snapshots */
    11241129            dlg.cbDiscardCurState->setShown ((cmachine.GetSnapshotCount() > 0));
     1130
     1131            if (machine_state != CEnums::Stuck)
     1132            {
     1133                /* read the last user's choice for the given VM */
     1134                QStringList lastAction = QStringList::split (',',
     1135                                                             cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction));
     1136                AssertWrapperOk (cmachine);
     1137                if (lastAction [0] == PowerOff)
     1138                    dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbPowerOff));
     1139                else if (lastAction [0] == Save)
     1140                    dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbSave));
     1141                else
     1142                    dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbPowerOff));
     1143                dlg.cbDiscardCurState->setChecked (
     1144                    lastAction.count() > 1 && lastAction [1] == DiscardCurState);
     1145            }
     1146            else
     1147            {
     1148                /* The stuck VM can only be powered off; disable anything
     1149                 * else and choose PowerOff */
     1150                dlg.rbSave->setEnabled (false);
     1151                dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbPowerOff));
     1152            }
    11251153
    11261154            if (dlg.exec() == QDialog::Accepted)
     
    13591387        tr ("Enable or disable remote desktop (RDP) connections to this machine"));
    13601388
    1361     devicesSharedFolders->insertItem (tr ("Open"));
    1362     devicesSFDialogAction->setMenuText (tr ("&Shared Folders"));
     1389    devicesSFDialogAction->setMenuText (tr ("&Shared Folders..."));
    13631390    devicesSFDialogAction->setStatusTip (
    13641391        tr ("Open the dialog to operate on shared folders"));
     
    14521479    CConsole cconsole = console->console();
    14531480
     1481    bool isRunningOrPaused = machine_state == CEnums::Running ||
     1482                             machine_state == CEnums::Paused;
     1483
    14541484    if (element & Caption)
    14551485    {
     
    14661496    if (element & FloppyStuff)
    14671497    {
    1468         devicesMountFloppyMenu->setEnabled (machine_state == CEnums::Running);
     1498        devicesMountFloppyMenu->setEnabled (isRunningOrPaused);
    14691499        CFloppyDrive floppy = cmachine.GetFloppyDrive();
    14701500        CEnums::DriveState state = floppy.GetState();
    14711501        bool mounted = state != CEnums::NotMounted;
    1472         devicesUnmountFloppyAction->setEnabled (machine_state == CEnums::Running && mounted);
     1502        devicesUnmountFloppyAction->setEnabled (isRunningOrPaused && mounted);
    14731503        fd_light->setState (mounted ? CEnums::DeviceIdle : CEnums::InvalidActivity);
    14741504        QString tip = tr ("<qt><nobr>Indicates the activity of the floppy media:</nobr>"
     
    15101540    if (element & DVDStuff)
    15111541    {
    1512         devicesMountDVDMenu->setEnabled (machine_state == CEnums::Running);
     1542        devicesMountDVDMenu->setEnabled (isRunningOrPaused);
    15131543        CDVDDrive dvd = cmachine.GetDVDDrive();
    15141544        CEnums::DriveState state = dvd.GetState();
    15151545        bool mounted = state != CEnums::NotMounted;
    1516         devicesUnmountDVDAction->setEnabled (machine_state == CEnums::Running && mounted);
     1546        devicesUnmountDVDAction->setEnabled (isRunningOrPaused && mounted);
    15171547        cd_light->setState (mounted ? CEnums::DeviceIdle : CEnums::InvalidActivity);
    15181548        QString tip = tr ("<qt><nobr>Indicates the activity of the CD/DVD-ROM media:</nobr>"
     
    15861616                count++;
    15871617        net_light->setState (count > 0 ? CEnums::DeviceIdle
    1588                                          : CEnums::InvalidActivity);
     1618                                       : CEnums::InvalidActivity);
     1619
     1620        devicesNetworkMenu->setEnabled (isRunningOrPaused && count > 0);
    15891621
    15901622        /* update tooltip */
     
    16161648    if (element & USBStuff)
    16171649    {
    1618         /// @todo (r=dmik) do we really need to disable the control while
    1619         //  in Pause? Check the same for CD/DVD above.
    16201650        if (!usb_light->isHidden())
    16211651        {
    1622             devicesUSBMenu->setEnabled (machine_state == CEnums::Running);
    1623 
    16241652            /* update tooltip */
    16251653            QString ttip = tr ("<qt><nobr>Indicates the activity of the "
     
    16291657            QString info;
    16301658
    1631             if (cmachine.GetUSBController().GetEnabled())
     1659            bool isUSBEnabled = cmachine.GetUSBController().GetEnabled();
     1660            if (isUSBEnabled)
    16321661            {
     1662                devicesUSBMenu->setEnabled (isRunningOrPaused);
     1663
    16331664                CUSBDeviceEnumerator en = cconsole.GetUSBDevices().Enumerate();
    16341665                while (en.HasMore())
     
    16431674            }
    16441675            else
     1676            {
     1677                devicesUSBMenu->setEnabled (false);
     1678
    16451679                info = tr ("<br><nobr><b>USB Controller is disabled</b></nobr>",
    16461680                           "USB device tooltip");
     1681            }
    16471682
    16481683            QToolTip::add (usb_light, ttip.arg (info));
     
    17341769                tr ("Resume the execution of the virtual machine" ) );
    17351770        }
    1736         vmPauseAction->setEnabled (machine_state == CEnums::Running ||
    1737                                    machine_state == CEnums::Paused);
     1771        vmPauseAction->setEnabled (isRunningOrPaused);
    17381772    }
    17391773    if (element & DisableMouseIntegrAction)
     
    24382472            tr ("Host Drive ") + fullName);
    24392473        hostFloppyMap [id] = hostFloppy;
    2440         if (machine_state != CEnums::Running)
     2474        if (machine_state != CEnums::Running && machine_state != CEnums::Paused)
    24412475            devicesMountFloppyMenu->setItemEnabled (id, false);
    24422476        else if (!selected.isNull())
     
    24842518            tr ("Host Drive ") + fullName);
    24852519        hostDVDMap [id] = hostDVD;
    2486         if (machine_state != CEnums::Running)
     2520        if (machine_state != CEnums::Running && machine_state != CEnums::Paused)
    24872521            devicesMountDVDMenu->setItemEnabled (id, false);
    24882522        else if (!selected.isNull())
     
    27202754    if (ind == sf_light)
    27212755    {
    2722         devicesSharedFolders->exec (e->globalPos());
     2756        /* Showing the context menu that always contains a single item is a
     2757         * bit stupid; let's better execute this item's action directly. The
     2758         * menu itself is kept just in case if we need more than one item in
     2759         * the future. */
     2760#if 0
     2761        devicesSFMenu->exec (e->globalPos());
     2762#else
     2763        if (devicesSFDialogAction->isEnabled())
     2764            devicesSFDialogAction->activate();
     2765#endif
    27232766    }
    27242767    else
    27252768    if (ind == net_light)
    27262769    {
    2727         /* set "this is a context menu" flag */
    2728         devicesMenu->setItemParameter (devicesNetworkMenuId, 1);
    2729         devicesNetworkMenu->exec (e->globalPos());
    2730         devicesMenu->setItemParameter (devicesNetworkMenuId, 0);
     2770        if (devicesNetworkMenu->isEnabled())
     2771        {
     2772            /* set "this is a context menu" flag */
     2773            devicesMenu->setItemParameter (devicesNetworkMenuId, 1);
     2774            devicesNetworkMenu->exec (e->globalPos());
     2775            devicesMenu->setItemParameter (devicesNetworkMenuId, 0);
     2776        }
    27312777    }
    27322778}
     
    27722818void VBoxConsoleWnd::updateMachineState (CEnums::MachineState state)
    27732819{
     2820    bool guruMeditation = false;
     2821
    27742822    if (console && machine_state != state)
    27752823    {
     
    27782826            switch (state)
    27792827            {
     2828                case CEnums::Stuck:
     2829                {
     2830                    guruMeditation = true;
     2831                    break;
     2832                }
    27802833                case CEnums::Paused:
    27812834                {
     
    27952848        }
    27962849
    2797         runningActions->setEnabled (state == CEnums::Running);
     2850        bool isRunningOrPaused = state == CEnums::Running ||
     2851                                 state == CEnums::Paused;
     2852
     2853        /* enable/disable actions that are not managed by
     2854         * updateAppearanceOf() */
     2855
     2856        mRunningActions->setEnabled (state == CEnums::Running);
     2857        mRunningOrPausedActions->setEnabled (isRunningOrPaused);
    27982858
    27992859        machine_state = state;
     
    28012861        updateAppearanceOf (Caption | FloppyStuff | DVDStuff |
    28022862                            USBStuff | VRDPStuff | PauseAction |
    2803                             DisableMouseIntegrAction );
     2863                            DisableMouseIntegrAction);
    28042864
    28052865        if (state < CEnums::Running)
     
    28122872            if (!no_auto_close)
    28132873                tryClose();
     2874        }
     2875    }
     2876
     2877    if (guruMeditation)
     2878    {
     2879        CConsole cconsole = console->console();
     2880        QString logFolder = cconsole.GetMachine().GetLogFolder();
     2881
     2882        /* Take the screenshot for debugging purposes and save it */
     2883        QString fname = logFolder + "/VBox.png";
     2884
     2885        /// @todo for some reason, IDisplay::takeScreenShot() may not work
     2886        /// properly on a VM which is Stuck -- investigate it.
     2887        CDisplay dsp = cconsole.GetDisplay();
     2888        QImage shot = QImage (dsp.GetWidth(), dsp.GetHeight(), 32, 0);
     2889        dsp.TakeScreenShot (shot.bits(), shot.width(), shot.height());
     2890        shot.save (QFile::encodeName (fname), "PNG");
     2891
     2892        if (vboxProblem().remindAboutGuruMeditation (
     2893                cconsole, QDir::convertSeparators (logFolder)))
     2894        {
     2895            cconsole.PowerDown();
     2896            if (!cconsole.isOk())
     2897                vboxProblem().cannotStopMachine (cconsole);
    28142898        }
    28152899    }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r4294 r4297  
    18201820    machineStates [CEnums::Running] =       tr ("Running", "MachineState");
    18211821    machineStates [CEnums::Paused] =        tr ("Paused", "MachineState");
     1822    machineStates [CEnums::Stuck] =         tr ("Stuck", "MachineState");
    18221823    machineStates [CEnums::Starting] =      tr ("Starting", "MachineState");
    18231824    machineStates [CEnums::Stopping] =      tr ("Stopping", "MachineState");
     
    33093310        {CEnums::Running, "state_running_16px.png"},
    33103311        {CEnums::Paused, "state_paused_16px.png"},
     3312        {CEnums::Stuck, "state_paused_16px.png"}, /// @todo (dmik) separate icon?
    33113313        {CEnums::Starting, "state_running_16px.png"}, /// @todo (dmik) separate icon?
    33123314        {CEnums::Stopping, "state_running_16px.png"}, /// @todo (dmik) separate icon?
     
    33343336    vm_state_color.insert (CEnums::Running,             &Qt::green);
    33353337    vm_state_color.insert (CEnums::Paused,              &Qt::darkGreen);
     3338    vm_state_color.insert (CEnums::Stuck,               &Qt::darkMagenta);
    33363339    vm_state_color.insert (CEnums::Starting,            &Qt::green);
    33373340    vm_state_color.insert (CEnums::Stopping,            &Qt::green);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r4204 r4297  
    15971597}
    15981598
     1599/**
     1600 *  Returns @c true if the user has selected to power off the machine.
     1601 */
     1602bool VBoxProblemReporter::remindAboutGuruMeditation (const CConsole &aConsole,
     1603                                                     const QString &aLogFolder)
     1604{
     1605    Q_UNUSED (aConsole);
     1606
     1607    int rc = message (&vboxGlobal().consoleWnd(), Critical,
     1608        tr ("<p>A critical error has been detected while running the virtual "
     1609            "machine and the machine execution has been stopped.</p>"
     1610            ""
     1611            "<p>Please go to "
     1612            "<a href=http://www.virtualbox.org>http://www.virtualbox.org</a> "
     1613            "and search through forums and mailing lists for "
     1614            "similar problems. If nothing similar is found, please open a "
     1615            "new ticket and attach the <tt>VBox.log</tt> and <tt>VBox.png</tt> "
     1616            "files which you can find in the <nobr><b>%1</b></nobr> directory "
     1617            "to this ticket together with the description of what you were "
     1618            "doing when this error happened. "
     1619            ""
     1620            "Note that you can also access the above files by selecting "
     1621            "<b>Show Log</b> from the <b>Machine</b> menu of the main "
     1622            "VirualBox window.</p>"
     1623            ""
     1624            "<p>Press <b>OK</b> if you want to power off the machine "
     1625            "or press <b>Ignore</b> if you want to leave it as is for debugging. "
     1626            "Please note that debugging requires special knowledge and tools, so "
     1627            "it is recommended to press <b>OK</b> now.</p>")
     1628            .arg (aLogFolder),
     1629        0, /* autoConfirmId */
     1630        QIMessageBox::Ok | QIMessageBox::Default,
     1631        QIMessageBox::Ignore | QIMessageBox::Escape);
     1632
     1633    return rc == QIMessageBox::Ok;
     1634}
     1635
    15991636int VBoxProblemReporter::remindAboutUnsetHD (QWidget *aParent)
    16001637{
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r4270 r4297  
    14681468
    14691469    if (mMachineState != MachineState_Running &&
    1470         mMachineState != MachineState_Paused)
     1470        mMachineState != MachineState_Paused &&
     1471        mMachineState != MachineState_Stuck)
    14711472    {
    14721473        /* extra nice error message for a common case */
     
    18911892    //  Paused, Starting, Saving, Stopping, etc? if not, we should make a
    18921893    //  stricter check (mMachineState != MachineState_Running).
    1893     /* bird: It is not permitted to attach or detach while the VM is saving, is restoring
    1894      * or has stopped - definintly not.
     1894    //
     1895    //  I'm changing it to the semi-strict check for the time being. We'll
     1896    //  consider the below later.
     1897    //
     1898    /* bird: It is not permitted to attach or detach while the VM is saving,
     1899     * is restoring or has stopped - definintly not.
    18951900     *
    1896      * Attaching while starting, well, if you don't create any deadlock it should work...
    1897      * Paused should work I guess, but we shouldn't push our luck if we're pausing because an
    1898      * runtime error condition was raised (which is one of the reasons there better be a separate
    1899      * state for that in the VMM).
     1901     * Attaching while starting, well, if you don't create any deadlock it
     1902     * should work...  Paused should work I guess, but we shouldn't push our
     1903     * luck if we're pausing because an runtime error condition was raised
     1904     * (which is one of the reasons there better be a separate state for that
     1905     * in the VMM).
    19001906     */
    1901     if (mMachineState < MachineState_Running)
     1907    if (mMachineState != MachineState_Running &&
     1908        mMachineState != MachineState_Paused)
    19021909        return setError (E_FAIL,
    1903             tr ("Cannot attach a USB device to a machine which is not running "
    1904                 "(machine state: %d)"), mMachineState);
     1910            tr ("Cannot attach a USB device to the machine which is not running"
     1911                "(machine state: %d)"),
     1912            mMachineState);
    19051913
    19061914    /* protect mpVM */
     
    19992007    AutoLock alock (this);
    20002008
     2009    /// @todo see @todo in AttachUSBDevice() about the Paused state
    20012010    if (mMachineState == MachineState_Saved)
    20022011        return setError (E_FAIL,
    2003             tr ("Cannot create a transient shared folder on a "
     2012            tr ("Cannot create a transient shared folder on the "
    20042013                "machine in the saved state"));
     2014    if (mMachineState > MachineState_Paused)
     2015        return setError (E_FAIL,
     2016            tr ("Cannot create a transient shared folder on the "
     2017                "machine while it is changing the state (machine state: %d)"),
     2018            mMachineState);
    20052019
    20062020    ComObjPtr <SharedFolder> sharedFolder;
     
    20652079    AutoLock alock (this);
    20662080
     2081    /// @todo see @todo in AttachUSBDevice() about the Paused state
    20672082    if (mMachineState == MachineState_Saved)
    20682083        return setError (E_FAIL,
    2069             tr ("Cannot remove a transient shared folder when the "
    2070                 "machine is in the saved state."));
     2084            tr ("Cannot remove a transient shared folder from the "
     2085                "machine in the saved state"));
     2086    if (mMachineState > MachineState_Paused)
     2087        return setError (E_FAIL,
     2088            tr ("Cannot remove a transient shared folder from the "
     2089                "machine while it is changing the state (machine state: %d)"),
     2090            mMachineState);
    20712091
    20722092    ComObjPtr <SharedFolder> sharedFolder;
     
    21242144    AutoLock alock (this);
    21252145
    2126     if (mMachineState > MachineState_Running &&
    2127         mMachineState != MachineState_Paused)
     2146    if (mMachineState > MachineState_Paused)
    21282147    {
    21292148        return setError (E_FAIL,
    2130             tr ("Cannot take a snapshot of a machine while it is changing state.  (Machine state: %d)"), mMachineState);
     2149            tr ("Cannot take a snapshot of the machine "
     2150                "while it is changing the state (machine state: %d)"),
     2151            mMachineState);
    21312152    }
    21322153
     
    22962317    if (mMachineState >= MachineState_Running)
    22972318        return setError (E_FAIL,
    2298             tr ("Cannot discard a snapshot on a running machine (Machine state: %d)"), mMachineState);
     2319            tr ("Cannot discard a snapshot of the running machine "
     2320                "(machine state: %d)"),
     2321            mMachineState);
    22992322
    23002323    MachineState_T machineState = MachineState_InvalidMachineState;
     
    23152338    if (mMachineState >= MachineState_Running)
    23162339        return setError (E_FAIL,
    2317             tr ("Cannot discard the current state of a running machine.  (Machine state: %d)"), mMachineState);
     2340            tr ("Cannot discard the current state of the running machine "
     2341                "(nachine state: %d)"),
     2342            mMachineState);
    23182343
    23192344    MachineState_T machineState = MachineState_InvalidMachineState;
     
    23342359    if (mMachineState >= MachineState_Running)
    23352360        return setError (E_FAIL,
    2336             tr ("Cannot discard the current snapshot and state on a running machine.  (Machine state: %d)"), mMachineState);
     2361            tr ("Cannot discard the current snapshot and state of the "
     2362                "running machine (machine state: %d)"),
     2363            mMachineState);
    23372364
    23382365    MachineState_T machineState = MachineState_InvalidMachineState;
     
    38693896    AssertMsg (mMachineState == MachineState_Running ||
    38703897               mMachineState == MachineState_Paused ||
     3898               mMachineState == MachineState_Stuck ||
    38713899               mMachineState == MachineState_Saving ||
    38723900               mMachineState == MachineState_Starting ||
     
    45484576                that->setMachineState (MachineState_Paused);
    45494577            }
     4578
     4579            break;
    45504580        }
    45514581
     
    45724602                that->setMachineState (MachineState_Running);
    45734603            }
     4604
     4605            break;
     4606        }
     4607
     4608        case VMSTATE_GURU_MEDITATION:
     4609        {
     4610            AutoLock alock (that);
     4611
     4612            if (that->mVMStateChangeCallbackDisabled)
     4613                break;
     4614
     4615            /* Guru respects only running VMs */
     4616            Assert ((that->mMachineState >= MachineState_Running));
     4617
     4618            that->setMachineState (MachineState_Stuck);
     4619
     4620            break;
    45744621        }
    45754622
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r4269 r4297  
    111111  <enum
    112112     name="MachineState"
    113      uuid="b8bb15f7-4fa2-4e84-87a8-b4677dd87deb"
     113     uuid="73bf04d0-7c4f-4684-9abf-d65a9ad74343"
    114114     >
    115115    <desc>
     
    118118    </desc>
    119119
    120     <const name="InvalidMachineState"   value="0"/>
     120    <const name="InvalidMachineState"   value="0">
     121      <desc>
     122        Invalid machine state. This state is never used by the virtual machine
     123        and may be used as a <tt>null</tt> value for state
     124        variables.
     125      </desc>
     126    </const>
    121127    <const name="PoweredOff"            value="1">
    122128      <desc>
     
    150156          action).
    151157        </note>
     158        <note>
     159          For whoever decides to touch this enum: In order to keep the
     160          aforementioned comparisons valid, this state must immediately
     161          preceed the Paused state.
     162        </note>
    152163      </desc>
    153164    </const>
     
    156167        The execution of the machine has been paused.
    157168        <note>
    158           This value can be used in comparison expressions:
    159           all state values above it represent unstable states of the
    160           virtual machine. No any settings can be altered when the
    161           VM is in one of the unstable sates.
     169          This value can be used in comparison expressions: all state values
     170          above it represent unstable states of the running virtual
     171          machine. Unless explicitly stated otherwise, no machine settings can
     172          be altered when it is in one of the unstable sates.
     173        </note>
     174        <note>
     175          For whoever decides to touch this enum: In order to keep the
     176          aforementioned comparisons valid, this state must immediately
     177          follow the Running state.
    162178        </note>
    163179      </desc>
    164180    </const>
    165     <const name="Starting"              value="6">
     181    <const name="Stuck"                 value="6">
     182      <desc>
     183        The execution of the machine has reached the Guru Meditaion
     184        condition. This condition indicates an internal VMM failure which may
     185        happen as a result of either an unhandled low-level virtual hardware
     186        exception or one of the recompiler exceptions (such as
     187        the <i>too-many-traps</i> condition).
     188      </desc>
     189    </const>
     190    <const name="Starting"              value="7">
    166191      <desc>
    167192        The machine is being started after
     
    170195      </desc>
    171196    </const>
    172     <const name="Stopping"              value="7">
     197    <const name="Stopping"              value="8">
    173198      <desc>
    174199        The machine is being normally stopped
     
    177202      </desc>
    178203    </const>
    179     <const name="Saving"                value="8">
     204    <const name="Saving"                value="9">
    180205      <desc>
    181206        The machine is saving its execution state to a file as a
     
    185210      </desc>
    186211    </const>
    187     <const name="Restoring"             value="9">
     212    <const name="Restoring"             value="10">
    188213      <desc>
    189214        The execution state of the machine is being restored from a file
     
    192217      </desc>
    193218    </const>
    194     <const name="Discarding"            value="10">
     219    <const name="Discarding"            value="11">
    195220      <desc>
    196221        A snapshot of the machine is being discarded after calling
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