Changeset 1236 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 5, 2007 6:02:01 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r1073 r1236 721 721 static const char *sSectionHrefTpl = 722 722 "<tr><td rowspan=%1 align=left><img src='%2'></td>" 723 "<td width=100% colspan=2>< a href='%3'><nobr>%4</nobr></a></td></tr>"723 "<td width=100% colspan=2><b><a href='%3'><nobr>%4</nobr></a></b></td></tr>" 724 724 "%5" 725 725 "<tr><td width=100% colspan=2><font size=1> </font></td></tr>"; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r1215 r1236 218 218 219 219 void goToSettings(); 220 void sessionStateChanged (const VBoxSessionStateChangeEvent &aE); 220 221 221 222 private: 223 224 QUuid mMachineId; 222 225 223 226 VBoxSelectorWnd *mParent; … … 264 267 QSizePolicy::Minimum)); 265 268 269 /* connect VirtualBox callback events */ 270 connect (&vboxGlobal(), SIGNAL (sessionStateChanged (const VBoxSessionStateChangeEvent &)), 271 this, SLOT (sessionStateChanged (const VBoxSessionStateChangeEvent &))); 272 266 273 /* apply language settings */ 267 274 languageChange(); … … 270 277 void VBoxVMDescriptionPage::setMachine (const CMachine &aMachine) 271 278 { 279 Assert (!aMachine.isNull()); 280 281 QUuid id = aMachine.GetId(); 282 if (id == mMachineId) 283 return; 284 285 mMachineId = id; 286 272 287 QString text = aMachine.GetDescription(); 288 273 289 if (text.isEmpty()) 274 290 text = QString::null; … … 298 314 { 299 315 mParent->vmSettings ("#general", 2); 316 } 317 318 void VBoxVMDescriptionPage::sessionStateChanged (const VBoxSessionStateChangeEvent &aE) 319 { 320 if (aE.id != mMachineId) 321 return; /* not interested in other machines */ 322 323 /* whether another direct session is open or not */ 324 bool busy = aE.state != CEnums::SessionClosed; 325 326 mBtnEdit->setEnabled (!busy); 300 327 } 301 328 … … 1028 1055 CMachine m = item->machine(); 1029 1056 1057 CEnums::MachineState state = item->state(); 1058 bool running = item->sessionState() != CEnums::SessionClosed; 1059 bool modifyEnabled = !running && state != CEnums::Saved; 1060 1030 1061 if (aRefreshDetails) 1031 1062 { 1032 1063 vmDetailsView->setDetailsText ( 1033 1064 vboxGlobal().detailsReport (m, false /* isNewVM */, 1034 true/* withLinks */));1065 !running /* withLinks */)); 1035 1066 } 1036 1067 if (aRefreshSnapshots) … … 1050 1081 } 1051 1082 1052 CEnums::MachineState state = item->state();1053 bool running = item->sessionState() != CEnums::SessionClosed;1054 bool modifyEnabled = !running && state != CEnums::Saved;1055 1056 /* enable/disable info panes */1057 vmDetailsView->setEnabled (modifyEnabled);1058 vmSnapshotsWgt->setEnabled (!running);1059 vmDescriptionPage->setEnabled (!running);1060 1061 1083 /* enable/disable modify actions */ 1062 1084 vmConfigAction->setEnabled (modifyEnabled); … … 1194 1216 void VBoxSelectorWnd::sessionStateChanged (const VBoxSessionStateChangeEvent &e) 1195 1217 { 1196 refreshVMItem (e.id, false, false, false);1218 refreshVMItem (e.id, true, false, false); 1197 1219 } 1198 1220 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSnapshotsWgt.ui
r382 r1236 239 239 <connection> 240 240 <sender>&vboxGlobal()</sender> 241 <signal>sessionStateChanged (const VBoxSessionStateChangeEvent &)</signal> 242 <receiver>VBoxSnapshotsWgt</receiver> 243 <slot>sessionStateChanged (const VBoxSessionStateChangeEvent &)</slot> 244 </connection> 245 <connection> 246 <sender>&vboxGlobal()</sender> 241 247 <signal>snapshotChanged (const VBoxSnapshotEvent &)</signal> 242 248 <receiver>VBoxSnapshotsWgt</receiver> … … 264 270 <variable access="private">CMachine mMachine;</variable> 265 271 <variable access="private">QUuid mMachineId;</variable> 272 <variable access="private">CEnums::SessionState mSessionState;</variable> 266 273 <variable access="private">class ListViewItem; ListViewItem *mCurSnapshotItem;</variable> 267 274 <variable access="private">class ToolTip; ToolTip *mToolTip;</variable> … … 279 286 <slot>machineDataChanged (const VBoxMachineDataChangeEvent & aE)</slot> 280 287 <slot>machineStateChanged (const VBoxMachineStateChangeEvent & aE)</slot> 288 <slot>sessionStateChanged (const VBoxSessionStateChangeEvent & aE)</slot> 281 289 <slot>snapshotChanged (const VBoxSnapshotEvent & aE)</slot> 282 290 </slots> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSnapshotsWgt.ui.h
r382 r1236 116 116 CSnapshot snapshot() const { return mSnapshot; } 117 117 QUuid snapshotId() const { return mId; } 118 119 CEnums::MachineState machineState() const { return mMachineState; } 118 120 119 121 void recache() … … 336 338 { 337 339 mMachine = aMachine; 338 mMachineId = aMachine.isNull() ? QUuid() : aMachine.GetId(); 340 341 if (aMachine.isNull()) 342 { 343 mMachineId = QUuid(); 344 mSessionState = CEnums::InvalidSessionState; 345 } 346 else 347 { 348 mMachineId = aMachine.GetId(); 349 mSessionState = aMachine.GetSessionState(); 350 } 351 339 352 refreshAll(); 340 353 } … … 458 471 listView->ensureItemVisible (item); 459 472 473 /* whether another direct session is open or not */ 474 bool busy = mSessionState != CEnums::SessionClosed; 475 460 476 /* enable/disable snapshot actions */ 461 snapshotActionGroup->setEnabled ( 477 snapshotActionGroup->setEnabled (!busy && 462 478 item && mCurSnapshotItem && item != mCurSnapshotItem->firstChild()); 463 479 464 showSnapshotDetailsAction->setEnabled (snapshotActionGroup->isEnabled()); 480 /* enable/disable the details action regardles of the session state */ 481 showSnapshotDetailsAction->setEnabled ( 482 item && mCurSnapshotItem && item != mCurSnapshotItem->firstChild()); 465 483 466 484 /* enable/disable current state actions */ 467 curStateActionGroup->setEnabled ( 485 curStateActionGroup->setEnabled (!busy && 468 486 item && mCurSnapshotItem && item == mCurSnapshotItem->firstChild()); 469 487 470 488 /* the Take Snapshot action is always enabled for the current state */ 471 takeSnapshotAction->setEnabled ( curStateActionGroup->isEnabled() ||489 takeSnapshotAction->setEnabled (!busy && curStateActionGroup->isEnabled() || 472 490 (item && !mCurSnapshotItem)); 473 491 … … 489 507 { 490 508 /* we have only one item -- current state */ 491 takeSnapshotAction->addTo (mContextMenu);509 curStateActionGroup->addTo (mContextMenu); 492 510 } 493 511 else … … 672 690 } 673 691 692 void VBoxSnapshotsWgt::sessionStateChanged (const VBoxSessionStateChangeEvent &aE) 693 { 694 if (aE.id != mMachineId) 695 return; /* not interested in other machines */ 696 697 mSessionState = aE.state; 698 listView_currentChanged (listView->currentItem()); 699 } 700 674 701 void VBoxSnapshotsWgt::snapshotChanged (const VBoxSnapshotEvent &aE) 675 702 {
Note:
See TracChangeset
for help on using the changeset viewer.