- Timestamp:
- Feb 26, 2007 8:50:40 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMListBox.h
r382 r1068 58 58 QFont nameFont() const { return mNameFont; } 59 59 60 QFont shotFont() const { return mShotFont; } 61 60 62 QFont stateFont (CEnums::SessionState aS) const 61 63 { … … 81 83 CVirtualBox mVBox; 82 84 QFont mNameFont; 85 QFont mShotFont; 83 86 QFont mStateBusyFont; 84 87 int mMargin; … … 121 124 int height (const QListBox *) const; 122 125 int width (const QListBox *) const; 123 126 124 127 bool accessible() const { return mAccessible; } 125 128 const CVirtualBoxErrorInfo &accessError() const { return mAccessError; } … … 137 140 QUuid mId; 138 141 QString mSettingsFile; 139 142 140 143 bool mAccessible; 141 144 CVirtualBoxErrorInfo mAccessError; 142 145 143 146 QString mName; 147 QString mSnapshotName; 144 148 CEnums::MachineState mState; 145 149 QDateTime mLastStateChange; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r1000 r1068 70 70 71 71 void languageChange(); 72 72 73 73 void setDetailsText (const QString &aText) 74 74 { … … 83 83 raiseWidget (1); 84 84 } 85 85 86 86 void setEmpty() 87 87 { … … 95 95 return connect (mDetailsText, aSignal, aReceiver, aMember); 96 96 } 97 97 98 98 private: 99 99 … … 117 117 { 118 118 Assert (mRefreshAction); 119 119 120 120 /* create normal details page */ 121 121 122 122 mDetailsText = new QTextBrowser (mErrBox); 123 123 mDetailsText->setFocusPolicy (QWidget::StrongFocus); … … 133 133 { 134 134 /* create inaccessible details page */ 135 135 136 136 if (mErrBox) 137 137 return; … … 141 141 QVBoxLayout *layout = new QVBoxLayout (mErrBox); 142 142 layout->setSpacing (10); 143 143 144 144 mErrLabel = new QLabel (mErrBox); 145 145 mErrLabel->setAlignment (WordBreak); … … 156 156 mRefreshButton = new QToolButton (mErrBox); 157 157 mRefreshButton->setFocusPolicy (QWidget::StrongFocus); 158 158 159 159 QHBoxLayout *hLayout = new QHBoxLayout (layout); 160 160 hLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, 161 161 QSizePolicy::Minimum)); 162 162 hLayout->add (mRefreshButton); 163 163 164 164 connect (mRefreshButton, SIGNAL (clicked()), 165 165 mRefreshAction, SIGNAL (activated())); … … 168 168 layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, 169 169 QSizePolicy::Expanding)); 170 170 171 171 addWidget (mErrBox, 1); 172 173 languageChange(); 172 173 languageChange(); 174 174 } 175 175 … … 259 259 vmRefreshAction->setIconSet (VBoxGlobal::iconSet ( 260 260 "refresh_16px.png", "refresh_disabled_16px.png")); 261 261 262 262 helpContentsAction = new QAction (this, "helpContentsAction"); 263 263 helpContentsAction->setIconSet (VBoxGlobal::iconSet ("help_16px.png")); … … 353 353 354 354 menuBar()->insertItem (QString::null, helpMenu, 3); 355 355 356 356 languageChange(); 357 357 … … 729 729 730 730 AssertMsgReturn (item, ("Item must be always selected here"), (void) 0); 731 731 732 732 refreshVMItem (item->id(), true /* aDetails */, true /* aSnapshots */); 733 733 } … … 888 888 if (menuBar()->findItem(3)) 889 889 menuBar()->findItem(3)->setText (tr ("&Help")); 890 890 891 891 vmDetailsView->languageChange(); 892 892 } … … 910 910 { 911 911 CMachine m = item->machine(); 912 912 913 if (aRefreshDetails) 913 914 { … … 918 919 if (aRefreshSnapshots) 919 920 { 921 /* update snapshots tab name */ 922 QString shotName = tr ("&Snapshots"); 923 ULONG shotCount = m.GetSnapshotCount(); 924 if (shotCount) 925 shotName += QString (" (%1)").arg (shotCount); 926 vmTabWidget->changeTab (vmSnapshotsWgt, shotName); 920 927 /* refresh snapshots widget */ 921 928 vmSnapshotsWgt->setMachine (m); … … 955 962 956 963 vmDetailsView->setEnabled (true); 957 964 958 965 /* empty and disable refresh snapshots widget */ 959 966 vmSnapshotsWgt->setMachine (CMachine()); … … 974 981 975 982 do 976 { 983 { 977 984 /* ignore the signal if a modal widget is currently active (we won't be 978 985 * able to properly show the modeless VDI manager window in this case) */ 979 986 if (QApplication::activeModalWidget()) 980 987 break; 981 988 982 989 /* ignore the signal if a VBoxDiskImageManagerDlg window is active */ 983 990 if (qApp->activeWindow() && 984 991 !strcmp (qApp->activeWindow()->className(), "VBoxDiskImageManagerDlg")) 985 992 break; 986 993 987 994 /* look for at least one inaccessible media */ 988 995 VBoxMediaList::const_iterator it; … … 990 997 if ((*it).status == VBoxMedia::Inaccessible) 991 998 break; 992 999 993 1000 if (it != list.end() && vboxProblem().remindAboutInaccessibleMedia()) 994 1001 { … … 1046 1053 } 1047 1054 1048 void VBoxSelectorWnd::snapshotChanged (const VBoxSnapshotEvent & /* e */)1049 { 1050 /// @todo (dmik) nothing to do, should remove I guess1051 } 1055 void VBoxSelectorWnd::snapshotChanged (const VBoxSnapshotEvent &aEvent) 1056 { 1057 refreshVMItem (aEvent.machineId, false, true); 1058 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMListBox.cpp
r382 r1068 98 98 99 99 mNameFont = QFont ("Arial", font().pointSize() + 1, QFont::Bold); 100 mShotFont = QFont ("Arial", font().pointSize() + 1); 100 101 mStateBusyFont = font(); 101 102 mStateBusyFont.setItalic (true); … … 251 252 { 252 253 QString name = mMachine.GetName(); 254 CSnapshot snp = mMachine.GetCurrentSnapshot(); 255 mSnapshotName = snp.isNull() ? QString::null : snp.GetName(); 253 256 needsResort = name != mName; 254 257 mName = name; 255 258 256 259 mState = mMachine.GetState(); 257 260 mLastStateChange.setTime_t (mMachine.GetLastStateChange() / 1000); … … 262 265 { 263 266 mAccessError = mMachine.GetAccessError(); 264 267 265 268 /* this should be in sync with 266 269 * VBoxProblemReporter::confirmMachineDeletion() */ … … 287 290 288 291 QString toolTip; 289 292 290 293 if (mAccessible) 291 294 { 295 toolTip = QString ("<b>%1</b>").arg (mName); 296 if (!mSnapshotName.isNull()) 297 toolTip += QString (" (%1)").arg (mSnapshotName); 292 298 toolTip = QString (VBoxVMListBox::tr ( 293 "<nobr> <b>%1</b><br></nobr>"299 "<nobr>%1<br></nobr>" 294 300 "<nobr>%2 since %3</nobr><br>" 295 301 "<nobr>Session %4</nobr>", 296 302 "VM tooltip (name, last state change, session state)")) 297 .arg ( mName)303 .arg (toolTip) 298 304 .arg (vboxGlobal().toString (mState)) 299 305 .arg (dateTime) … … 320 326 321 327 QFontMetrics fmName = QFontMetrics (lb->nameFont()); 328 QFontMetrics fmShot = QFontMetrics (lb->shotFont()); 322 329 QFontMetrics fmState = QFontMetrics (lb->stateFont (mSessionState)); 323 330 const int marg = lb->margin(); … … 326 333 QPixmap pmState; 327 334 QString strState; 328 335 329 336 if (mAccessible) 330 337 { … … 342 349 343 350 int nameWidth = fmName.width (mName); 351 if (!mSnapshotName.isNull()) 352 nameWidth += fmShot.width (QString (" (%1)").arg (mSnapshotName)); 344 353 int stateWidth = pmState.width() + fmState.width (' ') + 345 354 fmState.width (strState); … … 404 413 405 414 QFontMetrics fmName = QFontMetrics (lb->nameFont()); 415 QFontMetrics fmShot = QFontMetrics (lb->shotFont()); 406 416 QFontMetrics fmState = QFontMetrics (lb->stateFont (mSessionState)); 407 417 const int marg = lb->margin(); … … 446 456 aP->drawText (textX, marg + fmName.ascent(), mName); 447 457 458 if (!mSnapshotName.isNull()) 459 { 460 int nameWidth = fmName.width (mName); 461 aP->setFont (lb->shotFont()); 462 QString shotName = QString (" (%1)").arg (mSnapshotName); 463 aP->drawText (textX + nameWidth, marg + fmName.ascent(), shotName); 464 } 465 448 466 int stateY = marg + fmName.lineSpacing(); 449 467 int stateH = QMAX (pmState.height(), fmState.height());
Note:
See TracChangeset
for help on using the changeset viewer.