474
476
centralLayout->addLayout (rightVLayout, 2);
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");
505
507
leftVLayout->addWidget (mVMListView);
533
535
/* add actions to the toolbar */
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);
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);
544
vmTools->addAction (mVmStartAction);
545
vmTools->addAction (mVmDiscardAction);
546
mVMToolBar->addAction (mVmStartAction);
547
mVMToolBar->addAction (mVmDiscardAction);
547
549
/* add actions to menubar */
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 */
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)
910
CHardDiskAttachment hda = vec [i];
912
CMediumAttachment hda = vec [i];
911
913
const QString ctlName = hda.GetController();
913
machine.DetachHardDisk(ctlName, hda.GetPort(), hda.GetDevice());
915
machine.DetachDevice(ctlName, hda.GetPort(), hda.GetDevice());
914
916
if (!machine.isOk())
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());
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()));
985
990
QString id = item->id();
986
991
CVirtualBox vbox = vboxGlobal().virtualBox();
1286
1291
void VBoxSelectorWnd::retranslateUi()
1288
1293
#ifdef VBOX_OSE
1289
setWindowTitle (tr ("VirtualBox OSE"));
1294
QString title (tr ("VirtualBox OSE"));
1291
setWindowTitle (tr ("Sun VirtualBox"));
1296
QString title (tr ("Sun VirtualBox"));
1299
#ifdef VBOX_BLEEDING_EDGE
1300
title += QString(" EXPERIMENTAL build ")
1301
+ QString(RTBldCfgVersion())
1303
+ QString(RTBldCfgRevisionStr())
1304
+ QString(" - "VBOX_BLEEDING_EDGE);
1307
setWindowTitle (title);
1294
1309
mVmTabWidget->setTabText (mVmTabWidget->indexOf (mVmDetailsView), tr ("&Details"));
1295
1310
/* note: Snapshots and Details tabs are changed dynamically by
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? */
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
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"));
1493
mVmStartAction->setEnabled (!running);
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"));
1457
1507
mVmStartAction->setEnabled (item->canSwitchTo());
1461
mVmStartAction->setText (tr ("S&tart"));
1462
mVmStartAction->setStatusTip (
1463
tr ("Start the selected virtual machine"));
1465
mVmStartAction->setEnabled (!running);
1468
1510
/* change the Pause/Resume button text accordingly */
1469
if (state == KMachineState_Paused)
1511
if ( state == KMachineState_Paused
1512
|| state == KMachineState_TeleportingPausedVM /*?*/
1471
1515
mVmPauseAction->setText (tr ("R&esume"));
1472
1516
mVmPauseAction->setShortcut (QKeySequence ("Ctrl+P"));
1513
1557
mVmDetailsView->setDetailsText
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)
1598
1642
if (it != list.end() && vboxProblem().remindAboutInaccessibleMedia())
1854
1898
mVmDiscardAction->setEnabled (s == KMachineState_Saved && !running);
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
1907
mVmStartAction->setText (VBoxVMListView::tr ("S&tart"));
1908
mVmStartAction->setStatusTip (
1909
VBoxVMListView::tr ("Start the selected virtual machine"));
1910
mVmStartAction->setEnabled (!running);
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());
1866
mVmStartAction->setText (VBoxVMListView::tr ("S&tart"));
1867
mVmStartAction->setStatusTip (
1868
VBoxVMListView::tr ("Start the selected virtual machine"));
1869
mVmStartAction->setEnabled (!running);
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
1876
if (s == KMachineState_Paused)
1928
if ( s == KMachineState_Paused
1929
|| s == KMachineState_TeleportingPausedVM /*?*/
1878
1932
mVmPauseAction->setText (VBoxVMListView::tr ("R&esume"));
1879
1933
mVmPauseAction->setStatusTip (