~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include <QDesktopWidget>
50
50
#include <QToolButton>
51
51
 
 
52
#include <iprt/buildconfig.h>
 
53
 
52
54
// VBoxVMDetailsView class
53
55
////////////////////////////////////////////////////////////////////////////////
54
56
 
474
476
    centralLayout->addLayout (rightVLayout, 2);
475
477
 
476
478
    /* VM list toolbar */
477
 
    VBoxToolBar *vmTools = new VBoxToolBar (this);
 
479
    mVMToolBar = new VBoxToolBar (this);
478
480
#if MAC_LEOPARD_STYLE
479
481
    /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3 */
480
 
    addToolBar (vmTools);
481
 
    vmTools->setMacToolbar();
 
482
    addToolBar (mVMToolBar);
 
483
    mVMToolBar->setMacToolbar();
482
484
    /* No spacing/margin on the mac */
483
485
    VBoxGlobal::setLayoutMargin (centralLayout, 0);
484
486
    leftVLayout->setSpacing (0);
485
487
    rightVLayout->setSpacing (0);
486
488
    rightVLayout->insertSpacing (0, 10);
487
489
#else /* MAC_LEOPARD_STYLE */
488
 
    leftVLayout->addWidget (vmTools);
 
490
    leftVLayout->addWidget (mVMToolBar);
489
491
    centralLayout->setSpacing (9);
490
492
    VBoxGlobal::setLayoutMargin (centralLayout, 5);
491
493
    leftVLayout->setSpacing (5);
500
502
    /* Make non-possible to activate list elements by single click,
501
503
     * this hack should disable the current possibility to do it if present */
502
504
    if (mVMListView->style()->styleHint (QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, mVMListView))
503
 
        mVMListView->setStyleSheet ("activate-on-singleclick");
 
505
        mVMListView->setStyleSheet ("activate-on-singleclick : 0");
504
506
 
505
507
    leftVLayout->addWidget (mVMListView);
506
508
 
532
534
 
533
535
    /* add actions to the toolbar */
534
536
 
535
 
    vmTools->setIconSize (QSize (32, 32));
536
 
    vmTools->setToolButtonStyle (Qt::ToolButtonTextUnderIcon);
537
 
    vmTools->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred);
 
537
    mVMToolBar->setIconSize (QSize (32, 32));
 
538
    mVMToolBar->setToolButtonStyle (Qt::ToolButtonTextUnderIcon);
 
539
    mVMToolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred);
538
540
 
539
 
    vmTools->addAction (mVmNewAction);
540
 
    vmTools->addAction (mVmConfigAction);
 
541
    mVMToolBar->addAction (mVmNewAction);
 
542
    mVMToolBar->addAction (mVmConfigAction);
541
543
#if 0 /* delete action is really rare */
542
 
    vmTools->addAction (mVmDeleteAction);
 
544
    mVMToolBar->addAction (mVmDeleteAction);
543
545
#endif
544
 
    vmTools->addAction (mVmStartAction);
545
 
    vmTools->addAction (mVmDiscardAction);
 
546
    mVMToolBar->addAction (mVmStartAction);
 
547
    mVMToolBar->addAction (mVmDiscardAction);
546
548
 
547
549
    /* add actions to menubar */
548
550
 
718
720
    {
719
721
        int y = mNormalGeo.y();
720
722
#if defined (Q_WS_MAC) && !defined (QT_MAC_USE_COCOA)
721
 
        /* The toolbar counts to the content not to the frame. Unfortunaly the
722
 
         * toolbar isn't fully initialized when this window will be moved to
723
 
         * the last position after VBox starting. As a workaround just do
 
723
        /* The toolbar counts to the content not to the frame. Unfortunately
 
724
         * the toolbar isn't fully initialized when this window will be moved
 
725
         * to the last position after VBox starting. As a workaround just do
724
726
         * remove the toolbar height part when save the last position. */
725
727
        y -= ::darwinWindowToolBarHeight (this);
726
728
#endif /* Q_WS_MAC && !QT_MAC_USE_COCOA */
904
906
                return;
905
907
            CMachine machine = session.GetMachine();
906
908
            /* Detach all attached Hard Disks */
907
 
            CHardDiskAttachmentVector vec = machine.GetHardDiskAttachments();
 
909
            CMediumAttachmentVector vec = machine.GetMediumAttachments();
908
910
            for (int i = 0; i < vec.size(); ++ i)
909
911
            {
910
 
                CHardDiskAttachment hda = vec [i];
 
912
                CMediumAttachment hda = vec [i];
911
913
                const QString ctlName = hda.GetController();
912
914
 
913
 
                machine.DetachHardDisk(ctlName, hda.GetPort(), hda.GetDevice());
 
915
                machine.DetachDevice(ctlName, hda.GetPort(), hda.GetDevice());
914
916
                if (!machine.isOk())
915
917
                {
916
918
                    CStorageController ctl = machine.GetStorageControllerByName(ctlName);
917
 
                    vboxProblem().cannotDetachHardDisk (this, machine,
918
 
                        vboxGlobal().getMedium (CMedium (hda.GetHardDisk())).location(),
 
919
                    vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk,
 
920
                        vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(),
919
921
                        ctl.GetBus(), hda.GetPort(), hda.GetDevice());
920
922
                }
921
923
            }
979
981
        return;
980
982
    }
981
983
 
982
 
    AssertMsg (item->state() < KMachineState_Running,
983
 
               ("Machine must be PoweredOff/Saved/Aborted"));
 
984
    AssertMsg (   item->state() == KMachineState_PoweredOff
 
985
               || item->state() == KMachineState_Saved
 
986
               || item->state() == KMachineState_Teleported
 
987
               || item->state() == KMachineState_Aborted
 
988
               , ("Machine must be PoweredOff/Saved/Aborted (%d)", item->state()));
984
989
 
985
990
    QString id = item->id();
986
991
    CVirtualBox vbox = vboxGlobal().virtualBox();
1116
1121
                   true /* aDescription */);
1117
1122
 
1118
1123
    if (!oldAccessible && item->accessible())
1119
 
        vboxGlobal().checkForAutoConvertedSettingsAfterRefresh();
 
1124
        fileExit();
1120
1125
}
1121
1126
 
1122
1127
void VBoxSelectorWnd::vmShowLogs (const QString &aUuid /*= QUuid_null*/)
1286
1291
void VBoxSelectorWnd::retranslateUi()
1287
1292
{
1288
1293
#ifdef VBOX_OSE
1289
 
    setWindowTitle (tr ("VirtualBox OSE"));
 
1294
    QString title (tr ("VirtualBox OSE"));
1290
1295
#else
1291
 
    setWindowTitle (tr ("Sun VirtualBox"));
1292
 
#endif
 
1296
    QString title (tr ("Sun VirtualBox"));
 
1297
#endif
 
1298
 
 
1299
#ifdef VBOX_BLEEDING_EDGE
 
1300
    title += QString(" EXPERIMENTAL build ")
 
1301
          +  QString(RTBldCfgVersion())
 
1302
          +  QString(" r")
 
1303
          +  QString(RTBldCfgRevisionStr())
 
1304
          +  QString(" - "VBOX_BLEEDING_EDGE);
 
1305
#endif
 
1306
 
 
1307
    setWindowTitle (title);
1293
1308
 
1294
1309
    mVmTabWidget->setTabText (mVmTabWidget->indexOf (mVmDetailsView), tr ("&Details"));
1295
1310
    /* note: Snapshots and Details tabs are changed dynamically by
1308
1323
 
1309
1324
    mFileApplianceExportAction->setText (tr ("&Export Appliance..."));
1310
1325
    mFileApplianceExportAction->setShortcut (QKeySequence ("Ctrl+E"));
1311
 
    mFileApplianceExportAction->setStatusTip (tr ("Export an appliance out of VM's from VirtualBox"));
 
1326
    mFileApplianceExportAction->setStatusTip (tr ("Export one or more VirtualBox virtual machines as an appliance"));
1312
1327
 
1313
1328
#ifdef Q_WS_MAC
1314
1329
    /*
1386
1401
        mTrayIcon->refresh();
1387
1402
    }
1388
1403
#endif
 
1404
 
 
1405
#ifdef QT_MAC_USE_COCOA
 
1406
    /* There is a bug in Qt Cocoa which result in showing a "more
 
1407
     * arrow" when the necessary size of the toolbar is increased. So
 
1408
     * manually adjust the size after changing the text. */
 
1409
    mVMToolBar->adjustSize();
 
1410
#endif /* QT_MAC_USE_COCOA */
1389
1411
}
1390
1412
 
1391
1413
 
1444
1466
        mVmConfigAction->setEnabled (modifyEnabled);
1445
1467
        mVmDeleteAction->setEnabled (modifyEnabled);
1446
1468
        mVmDiscardAction->setEnabled (state == KMachineState_Saved && !running);
1447
 
        mVmPauseAction->setEnabled (state == KMachineState_Running ||
1448
 
                                   state == KMachineState_Paused);
 
1469
        mVmPauseAction->setEnabled (   state == KMachineState_Running
 
1470
                                    || state == KMachineState_Teleporting
 
1471
                                    || state == KMachineState_LiveSnapshotting
 
1472
                                    || state == KMachineState_Paused
 
1473
                                    || state == KMachineState_TeleportingPausedVM /** @todo Live Migration: does this make sense? */
 
1474
                                   );
1449
1475
 
1450
1476
        /* change the Start button text accordingly */
1451
 
        if (state >= KMachineState_Running)
 
1477
        if (   state == KMachineState_PoweredOff
 
1478
            || state == KMachineState_Saved
 
1479
            || state == KMachineState_Teleported
 
1480
            || state == KMachineState_Aborted
 
1481
           )
 
1482
        {
 
1483
            mVmStartAction->setText (tr ("S&tart"));
 
1484
#ifdef QT_MAC_USE_COCOA
 
1485
            /* There is a bug in Qt Cocoa which result in showing a "more
 
1486
             * arrow" when the necessary size of the toolbar is increased. So
 
1487
             * manually adjust the size after changing the text. */
 
1488
            mVMToolBar->adjustSize();
 
1489
#endif /* QT_MAC_USE_COCOA */
 
1490
            mVmStartAction->setStatusTip (
 
1491
                tr ("Start the selected virtual machine"));
 
1492
 
 
1493
            mVmStartAction->setEnabled (!running);
 
1494
        }
 
1495
        else
1452
1496
        {
1453
1497
            mVmStartAction->setText (tr ("S&how"));
 
1498
#ifdef QT_MAC_USE_COCOA
 
1499
            /* There is a bug in Qt Cocoa which result in showing a "more
 
1500
             * arrow" when the necessary size of the toolbar is increased. So
 
1501
             * manually adjust the size after changing the text. */
 
1502
            mVMToolBar->adjustSize();
 
1503
#endif /* QT_MAC_USE_COCOA */
1454
1504
            mVmStartAction->setStatusTip (
1455
1505
                tr ("Switch to the window of the selected virtual machine"));
1456
1506
 
1457
1507
            mVmStartAction->setEnabled (item->canSwitchTo());
1458
1508
        }
1459
 
        else
1460
 
        {
1461
 
            mVmStartAction->setText (tr ("S&tart"));
1462
 
            mVmStartAction->setStatusTip (
1463
 
                tr ("Start the selected virtual machine"));
1464
 
 
1465
 
            mVmStartAction->setEnabled (!running);
1466
 
        }
1467
1509
 
1468
1510
        /* change the Pause/Resume button text accordingly */
1469
 
        if (state == KMachineState_Paused)
 
1511
        if (   state == KMachineState_Paused
 
1512
            || state == KMachineState_TeleportingPausedVM /*?*/
 
1513
           )
1470
1514
        {
1471
1515
            mVmPauseAction->setText (tr ("R&esume"));
1472
1516
            mVmPauseAction->setShortcut (QKeySequence ("Ctrl+P"));
1513
1557
            mVmDetailsView->setDetailsText
1514
1558
                (tr ("<h3>"
1515
1559
                     "Welcome to VirtualBox!</h3>"
1516
 
                     "<p>The left part of this window is intended to display "
 
1560
                     "<p>The left part of this window is  "
1517
1561
                     "a list of all virtual machines on your computer. "
1518
1562
                     "The list is empty now because you haven't created any virtual "
1519
1563
                     "machines yet."
1592
1636
        /* look for at least one inaccessible media */
1593
1637
        VBoxMediaList::const_iterator it;
1594
1638
        for (it = list.begin(); it != list.end(); ++ it)
1595
 
            if ((*it).state() == KMediaState_Inaccessible)
 
1639
            if ((*it).state() == KMediumState_Inaccessible)
1596
1640
                break;
1597
1641
 
1598
1642
        if (it != list.end() && vboxProblem().remindAboutInaccessibleMedia())
1854
1898
        mVmDiscardAction->setEnabled (s == KMachineState_Saved && !running);
1855
1899
 
1856
1900
        /* Change the Start button text accordingly */
1857
 
        if (s >= KMachineState_Running)
 
1901
        if (   s == KMachineState_PoweredOff
 
1902
            || s == KMachineState_Saved
 
1903
            || s == KMachineState_Teleported
 
1904
            || s == KMachineState_Aborted
 
1905
           )
 
1906
        {
 
1907
            mVmStartAction->setText (VBoxVMListView::tr ("S&tart"));
 
1908
            mVmStartAction->setStatusTip (
 
1909
                  VBoxVMListView::tr ("Start the selected virtual machine"));
 
1910
            mVmStartAction->setEnabled (!running);
 
1911
        }
 
1912
        else
1858
1913
        {
1859
1914
            mVmStartAction->setText (VBoxVMListView::tr ("S&how"));
1860
1915
            mVmStartAction->setStatusTip (
1861
1916
                  VBoxVMListView::tr ("Switch to the window of the selected virtual machine"));
1862
1917
            mVmStartAction->setEnabled (pItem->canSwitchTo());
1863
1918
        }
1864
 
        else
1865
 
        {
1866
 
            mVmStartAction->setText (VBoxVMListView::tr ("S&tart"));
1867
 
            mVmStartAction->setStatusTip (
1868
 
                  VBoxVMListView::tr ("Start the selected virtual machine"));
1869
 
            mVmStartAction->setEnabled (!running);
1870
 
        }
1871
1919
 
1872
1920
        /* Change the Pause/Resume button text accordingly */
1873
 
        mVmPauseAction->setEnabled (s == KMachineState_Running ||
1874
 
                                    s == KMachineState_Paused);
 
1921
        mVmPauseAction->setEnabled (   s == KMachineState_Running
 
1922
                                    || s == KMachineState_Teleporting
 
1923
                                    || s == KMachineState_LiveSnapshotting
 
1924
                                    || s == KMachineState_Paused
 
1925
                                    || s == KMachineState_TeleportingPausedVM
 
1926
                                   );
1875
1927
 
1876
 
        if (s == KMachineState_Paused)
 
1928
        if (   s == KMachineState_Paused
 
1929
            || s == KMachineState_TeleportingPausedVM /*?*/
 
1930
           )
1877
1931
        {
1878
1932
            mVmPauseAction->setText (VBoxVMListView::tr ("R&esume"));
1879
1933
            mVmPauseAction->setStatusTip (