VirtualBox

Changeset 16264 in vbox for trunk/src


Ignore:
Timestamp:
Jan 27, 2009 3:09:27 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
42075
Message:

FE/Qt4: 3225: Disable ACPI actions if the guest did not enter (or exit already) ACPI.

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

Legend:

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

    r15804 r16264  
    7474    void refreshView();
    7575
    76     bool isWindowMaximized() const 
    77     { 
     76    bool isWindowMaximized() const
     77    {
    7878#ifdef Q_WS_MAC
    7979        /* On Mac OS X we didn't really jump to the fullscreen mode but
     
    8383#else /* Q_WS_MAC */
    8484        return QMainWindow::isMaximized();
    85 #endif /* Q_WS_MAC */ 
     85#endif /* Q_WS_MAC */
    8686    }
    87     bool isWindowFullScreen() const 
    88     { 
     87    bool isWindowFullScreen() const
     88    {
    8989#ifdef Q_WS_MAC
    9090        /* On Mac OS X we didn't really jump to the fullscreen mode but
     
    9494#else /* Q_WS_MAC */
    9595        return QMainWindow::isFullScreen();
    96 #endif /* Q_WS_MAC */ 
     96#endif /* Q_WS_MAC */
    9797    }
    9898
     
    217217    void updateMediaDriveState (VBoxDefs::MediaType aType);
    218218    void updateSharedFoldersState();
     219    void updateACPIStatus();
    219220
    220221    void tryClose();
     
    326327    QString caption_prefix;
    327328
     329    QTimer *mACPITimer;
     330    bool mACPIEnabled : 1;
     331
    328332    bool no_auto_close : 1;
    329333
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r14441 r16264  
    232232    void cannotDiscardSavedState (const CConsole &console);
    233233
     234    void cannotSendACPIToMachine();
     235
    234236    void cannotSetSnapshotFolder (const CMachine &aMachine, const QString &aPath);
    235237    void cannotDiscardSnapshot (const CConsole &aConsole,
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r16256 r16264  
    224224    , console (0)
    225225    , machine_state (KMachineState_Null)
     226    , mACPIEnabled (false)
    226227    , no_auto_close (false)
    227228    , mIsFullscreen (false)
     
    244245
    245246    idle_timer = new QTimer (this);
     247    mACPITimer = new QTimer (this);
    246248
    247249#if !(defined (Q_WS_WIN) || defined (Q_WS_MAC))
     
    914916    idle_timer->start (50);
    915917
     918    /* start an idle timer that will update acpi status */
     919    connect (mACPITimer, SIGNAL (timeout()), SLOT (updateACPIStatus()));
     920    mACPITimer->start (1000);
     921
    916922    connect (console, SIGNAL (mouseStateChanged (int)),
    917923             this, SLOT (updateMouseState (int)));
     
    13361342                    cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction).split (',');
    13371343                AssertWrapperOk (cmachine);
    1338                 if (lastAction [0] == kPowerOff)
    1339                 {
    1340                     dlg.mRbPowerOff->setChecked (true);
    1341                     dlg.mRbPowerOff->setFocus();
    1342                 }
    1343                 else if (lastAction [0] == kShutdown)
    1344                 {
    1345                     dlg.mRbShutdown->setChecked (true);
    1346                     dlg.mRbShutdown->setFocus();
    1347                 }
    1348                 else if (lastAction [0] == kSave)
     1344                if (lastAction [0] == kSave)
    13491345                {
    13501346                    dlg.mRbSave->setChecked (true);
    13511347                    dlg.mRbSave->setFocus();
     1348                }
     1349                else if ((lastAction [0] == kPowerOff) && !mACPIEnabled)
     1350                {
     1351                    dlg.mRbShutdown->setEnabled (false);
     1352                    dlg.mRbPowerOff->setChecked (true);
     1353                    dlg.mRbPowerOff->setFocus();
    13521354                }
    13531355                else /* the default is ACPI Shutdown */
     
    15171519        idle_timer->disconnect (SIGNAL (timeout()), this, SLOT (updateDeviceLights()));
    15181520
     1521        /* Stop ACPI update timer */
     1522        mACPITimer->stop();
     1523        mACPITimer->disconnect (SIGNAL (timeout()), this, SLOT (updateACPIStatus()));
     1524
    15191525        /* Hide console window */
    15201526        hide();
     
    26032609void VBoxConsoleWnd::vmACPIShutdown()
    26042610{
     2611    if (!mACPIEnabled)
     2612        return vboxProblem().cannotSendACPIToMachine();
     2613
    26052614    if (console)
    26062615    {
     
    35373546}
    35383547
     3548void VBoxConsoleWnd::updateACPIStatus()
     3549{
     3550    mACPIEnabled = csession.GetConsole().GetGuestEnteredACPIMode();
     3551}
     3552
    35393553/**
    35403554 *  Helper to safely close the main console window.
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r14869 r16264  
    922922}
    923923
     924void VBoxProblemReporter::cannotSendACPIToMachine()
     925{
     926    message (mainWindowShown(),  Warning,
     927        tr ("Cannot send the ACPI Power Button press event to the "
     928            "virtual machine because ACPI is not available now."));
     929}
     930
    924931void VBoxProblemReporter::cannotSetSnapshotFolder (const CMachine &aMachine,
    925932                                                   const QString &aPath)
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