Changeset 39225 in vbox
- Timestamp:
- Nov 8, 2011 10:31:52 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp
r33540 r39225 237 237 style()->drawPrimitive (QStyle::PE_FrameFocusRect, &option, &painter, this); 238 238 } 239 }240 241 void QILabel::showEvent(QShowEvent *pEvent)242 {243 QLabel::showEvent(pEvent);244 emit shown();245 239 } 246 240 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h
r30868 r39225 48 48 QString text() const; 49 49 50 signals:51 void shown();52 53 50 public slots: 54 51 … … 67 64 void focusOutEvent (QFocusEvent *aEvent); 68 65 void paintEvent (QPaintEvent *aEvent); 69 void showEvent(QShowEvent *pEvent);70 66 71 67 private: -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r39096 r39225 845 845 /* Get current item: */ 846 846 UIVMItem *pItem = m_pVMListView->currentItem(); 847 QList<UIVMItem*> items = m_pVMListView->currentItems(); 847 848 848 849 /* Enable/disable actions: */ … … 866 867 { 867 868 CMachine m = pItem->machine(); 869 QList<CMachine> machines; 870 for (int i = 0; i < items.size(); ++i) 871 machines << items[i]->machine(); 868 872 KMachineState state = pItem->machineState(); 869 873 870 874 if (fRefreshDetails || fRefreshDescription) 871 m_pVMDesktop->updateDetails(pItem, m );875 m_pVMDesktop->updateDetails(pItem, machines); 872 876 if (fRefreshSnapshots) 873 877 m_pVMDesktop->updateSnapshots(pItem, m); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r37755 r39225 17 17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 18 18 */ 19 20 /* Global includes */ 21 #include <QDir> 22 #include <QLabel> 23 #include <QScrollArea> 24 #include <QStackedLayout> 25 #include <QStackedWidget> 26 #include <QToolButton> 27 #include <QUrl> 28 29 #include <iprt/assert.h> 19 30 20 31 /* Local includes */ … … 32 43 #include "VBoxSnapshotsWgt.h" 33 44 #include "UIToolBar.h" 34 35 45 #include "VBoxUtils.h" 36 37 /* Global includes */38 #include <QDir>39 #include <QLabel>40 #include <QScrollArea>41 #include <QStackedLayout>42 #include <QStackedWidget>43 #include <QToolButton>44 #include <QUrl>45 46 #include <iprt/assert.h>47 46 48 47 /* … … 55 54 //#endif /* Q_WS_MAC */ 56 55 57 static const QString sTableTpl = 58 "<table border=0 cellspacing=1 cellpadding=0>%1</table>"; 59 static const QString sSectionItemTpl1 = 60 "<tr><td width=40%><nobr><i>%1</i></nobr></td><td/><td/></tr>"; 61 static const QString sSectionItemTpl2 = 62 "<tr><td><nobr>%1:</nobr></td><td/><td>%2</td></tr>"; 63 // "<tr><td width=40%><nobr>%1:</nobr></td><td/><td>%2</td></tr>"; 64 static const QString sSectionItemTpl3 = 65 "<tr><td width=40%><nobr>%1</nobr></td><td/><td/></tr>"; 66 static const QString sSectionItemTpl4 = 67 "<tr><td>%1</td><td/><td/></tr>"; 56 static const QString sTableTpl = "<table border=0 cellspacing=1 cellpadding=0>%1</table>"; 57 static const QString sSectionItemTpl1 = "<tr><td width=40%><nobr><i>%1</i></nobr></td><td/><td/></tr>"; 58 static const QString sSectionItemTpl2 = "<tr><td><nobr>%1:</nobr></td><td/><td>%2</td></tr>"; 59 static const QString sSectionItemTpl3 = "<tr><td width=40%><nobr>%1</nobr></td><td/><td/></tr>"; 60 static const QString sSectionItemTpl4 = "<tr><td>%1</td><td/><td/></tr>"; 68 61 69 62 #ifdef Q_WS_MAC … … 88 81 enum Section 89 82 { 90 GeneralSec,91 S ystemSec,92 PreviewSec,93 DisplaySec,94 S torageSec,95 AudioSec,96 NetworkSec,97 Se rialPortsSec,83 Section_General, 84 Section_System, 85 Section_Preview, 86 Section_Display, 87 Section_Storage, 88 Section_Audio, 89 Section_Network, 90 Section_Serial, 98 91 #ifdef VBOX_WITH_PARALLEL_PORTS 99 ParallelPortsSec,92 Section_Parallel, 100 93 #endif /* VBOX_WITH_PARALLEL_PORTS */ 101 USBSec,102 S haredFoldersSec,103 DescriptionSec,104 EndSec94 Section_USB, 95 Section_SharedFolders, 96 Section_Description, 97 Section_End 105 98 }; 99 typedef QMap<Section, UIPopupBox*> UIDetailsBlock; 100 typedef QVector<UIDetailsBlock> UIDetailsSet; 106 101 107 102 public: 108 103 109 UIDetailsPagePrivate(QWidget * aParent, QAction *aRefreshAction = 0);104 UIDetailsPagePrivate(QWidget *pParent, QAction *pRefreshAction = 0); 110 105 ~UIDetailsPagePrivate(); 111 106 112 void setMachine(const CMachine& machine); 113 114 void setText(const QString &aText) 115 { 116 m_machine = CMachine(); 117 createTextPage(); 118 m_pText->setText(aText); 119 setCurrentIndex(indexOf(m_pText)); 120 } 121 122 void setErrorText(const QString &aText) 123 { 124 m_machine = CMachine(); 125 createErrPage(); 126 m_pErrText->setText(aText); 127 setCurrentIndex(indexOf(m_pErrBox)); 128 } 107 void setMachines(const QList<CMachine> &machines); 108 void setText(const QString &aText); 109 void setErrorText(const QString &aText); 129 110 130 111 signals: 131 112 132 void linkClicked(const QString & aURL);113 void linkClicked(const QString &url); 133 114 134 115 protected: … … 155 136 void sltContextMenuRequested(const QPoint &pos); 156 137 157 void gotLinkClicked(const QUrl &aURL) 158 { 159 emit linkClicked(aURL.toString()); 160 } 138 void sltLinkClicked(const QUrl &url) { emit linkClicked(url.toString()); } 139 140 void sltPopupToggled(bool fPopupOpened); 161 141 162 142 private: 163 143 164 void createTextPage(); 165 void createErrPage(); 144 void prepareDetails(); 145 void cleanupDetails(); 146 147 void prepareTextPage(); 148 149 void prepareErrorPage(); 150 151 void prepareSet(); 152 void prepareBlock(int iBlockNumber); 153 void prepareSection(UIDetailsBlock &block, int iBlockNumber, Section section); 154 void updateSet(); 155 156 void saveSectionSetting(); 166 157 167 158 static QString summarizeGenericProperties(const CNetworkAdapter &adapter); 168 159 169 /* Private member vars*/160 /* Common variables: */ 170 161 CVirtualBox m_vbox; 171 CMachine m_machine; 172 173 /* Details view */ 162 int m_cMachineCount; 163 QVector<CMachine> m_machines; 164 QVector<bool> m_changeable; 165 166 /* Details-view variables: */ 167 QScrollArea *m_pScrollArea; 174 168 QWidget *m_pDetails; 175 QHash<Section, QString> m_EDStrs; 176 QHash<Section, QAction*> m_actions; 177 QHash<Section, UIPopupBox*> m_secBoxes; 178 bool m_fChangeable; 169 QMap<Section, QString> m_sectionSettings; 170 QMap<Section, QString> m_sectionNames; 171 QMap<Section, bool> m_sectionOpened; 172 QMap<Section, QAction*> m_actions; 173 QList<Section> m_sections; 174 UIDetailsSet m_set; 179 175 bool m_fUSBAvailable; 180 176 181 /* Free text */177 /* Free text: */ 182 178 QRichTextBrowser *m_pText; 183 179 184 /* Error text */180 /* Error text: */ 185 181 QWidget *m_pErrBox; 186 182 QLabel *m_pErrLabel; 187 183 QTextBrowser *m_pErrText; 188 QToolButton *m RefreshButton;189 QAction *m RefreshAction;184 QToolButton *m_pRefreshButton; 185 QAction *m_pRefreshAction; 190 186 }; 191 187 192 UIDetailsPagePrivate::UIDetailsPagePrivate(QWidget *aParent, 193 QAction *aRefreshAction /* = 0 */) 194 : QIWithRetranslateUI<QStackedWidget>(aParent) 188 UIDetailsPagePrivate::UIDetailsPagePrivate(QWidget *pParent, QAction *pRefreshAction /* = 0 */) 189 : QIWithRetranslateUI<QStackedWidget>(pParent) 195 190 , m_vbox(vboxGlobal().virtualBox()) 196 , m_fChangeable(false) 191 , m_cMachineCount(0) 192 , m_pScrollArea(0) 193 , m_pDetails(0) 197 194 , m_fUSBAvailable(true) 198 195 , m_pText(0) 199 196 , m_pErrBox(0), m_pErrLabel(0), m_pErrText(0) 200 , mRefreshButton(0) 201 , mRefreshAction(aRefreshAction) 202 { 203 Assert(mRefreshAction); 204 205 /* The names for the extra data list */ 206 m_EDStrs[GeneralSec] = "general"; 207 m_EDStrs[SystemSec] = "system"; 208 m_EDStrs[PreviewSec] = "preview"; 209 m_EDStrs[DisplaySec] = "display"; 210 m_EDStrs[StorageSec] = "storage"; 211 m_EDStrs[AudioSec] = "audio"; 212 m_EDStrs[NetworkSec] = "network"; 213 m_EDStrs[SerialPortsSec] = "serialPorts"; 197 , m_pRefreshButton(0), m_pRefreshAction(pRefreshAction) 198 { 199 /* Check that refresh action was passed: */ 200 Assert(m_pRefreshAction); 201 } 202 203 UIDetailsPagePrivate::~UIDetailsPagePrivate() 204 { 205 /* Cleanup details: */ 206 cleanupDetails(); 207 } 208 209 void UIDetailsPagePrivate::setMachines(const QList<CMachine> &machines) 210 { 211 /* Prepare variables: */ 212 bool fCountChanged = machines.size() != m_cMachineCount; 213 m_cMachineCount = machines.size(); 214 /* Recreate corresponding vectors: */ 215 m_machines.clear(); 216 m_machines.resize(m_cMachineCount); 217 m_changeable.clear(); 218 m_changeable.resize(m_cMachineCount); 219 /* Fetch passed VMs: */ 220 for (int i = 0; i < machines.size(); ++i) 221 { 222 /* Get current VM: */ 223 const CMachine &machine = machines[i]; 224 /* Assign corresponding vector values: */ 225 m_machines[i] = machine; 226 m_changeable[i] = machine.isNull() ? false : 227 machine.GetState() != KMachineState_Stuck && 228 machine.GetState() != KMachineState_Saved /* for now! */; 229 } 230 231 /* Prepare machine details page if necessary: */ 232 prepareDetails(); 233 234 /* If count was changed: */ 235 if (fCountChanged) 236 { 237 /* Recreate set of blocks of sections: */ 238 prepareSet(); 239 } 240 /* If count was NOT changed: */ 241 else 242 { 243 /* Update set of blocks of sections: */ 244 updateSet(); 245 } 246 247 /* Select corresponding widget: */ 248 setCurrentIndex(indexOf(m_pScrollArea)); 249 } 250 251 void UIDetailsPagePrivate::setText(const QString &aText) 252 { 253 /* Clear machine maps: */ 254 m_machines.clear(); 255 m_machines.resize(0); 256 m_changeable.clear(); 257 m_changeable.resize(0); 258 259 /* Prepare text page if necessary: */ 260 prepareTextPage(); 261 262 /* Assign corresponding text: */ 263 m_pText->setText(aText); 264 265 /* Select corresponding widget: */ 266 setCurrentIndex(indexOf(m_pText)); 267 } 268 269 void UIDetailsPagePrivate::setErrorText(const QString &aText) 270 { 271 /* Clear machine maps: */ 272 m_machines.clear(); 273 m_machines.resize(0); 274 m_changeable.clear(); 275 m_changeable.resize(0); 276 277 /* Prepare error page if necessary: */ 278 prepareErrorPage(); 279 280 /* Assign corresponding error: */ 281 m_pErrText->setText(aText); 282 283 /* Select corresponding widget: */ 284 setCurrentIndex(indexOf(m_pErrBox)); 285 } 286 287 void UIDetailsPagePrivate::retranslateUi() 288 { 289 /* Translate context menu actions: */ 290 { 291 if (m_actions.contains(Section_General)) 292 m_actions[Section_General]->setText(tr("General", "details report")); 293 if (m_actions.contains(Section_System)) 294 m_actions[Section_System]->setText(tr("System", "details report")); 295 if (m_actions.contains(Section_Preview)) 296 m_actions[Section_Preview]->setText(tr("Preview", "details report")); 297 if (m_actions.contains(Section_Display)) 298 m_actions[Section_Display]->setText(tr("Display", "details report")); 299 if (m_actions.contains(Section_Storage)) 300 m_actions[Section_Storage]->setText(tr("Storage", "details report")); 301 if (m_actions.contains(Section_Audio)) 302 m_actions[Section_Audio]->setText(tr("Audio", "details report")); 303 if (m_actions.contains(Section_Network)) 304 m_actions[Section_Network]->setText(tr("Network", "details report")); 305 if (m_actions.contains(Section_Serial)) 306 m_actions[Section_Serial]->setText(tr("Serial Ports", "details report")); 214 307 #ifdef VBOX_WITH_PARALLEL_PORTS 215 m_EDStrs[ParallelPortsSec] = "parallelPorts"; 308 if (m_actions.contains(Section_Parallel)) 309 m_actions[Section_Parallel]->setText(tr("Parallel Ports", "details report")); 216 310 #endif /* VBOX_WITH_PARALLEL_PORTS */ 217 m_EDStrs[USBSec] = "usb"; 218 m_EDStrs[SharedFoldersSec] = "sharedFolders"; 219 m_EDStrs[DescriptionSec] = "description"; 220 221 QScrollArea *pSArea = new QScrollArea(this); 222 pSArea->setFrameStyle(QFrame::NoFrame); 223 m_pDetails = new QWidget(this); 224 QVBoxLayout *pMainLayout = new QVBoxLayout(m_pDetails); 225 pMainLayout->setContentsMargins(gsLeftMargin, gsTopMargin, gsRightMargin, gsBottomMargin); 226 227 /* Create the context menu, which allows showing/hiding of the boxes */ 228 m_pDetails->setContextMenuPolicy(Qt::CustomContextMenu); 229 connect(m_pDetails, SIGNAL(customContextMenuRequested(const QPoint&)), 230 this, SLOT(sltContextMenuRequested(const QPoint&))); 231 for(int i = 0; i < EndSec; ++i) 232 { 233 /* Create the context menu actions */ 234 QAction *pAction = new QAction(this); 235 pAction->setData(i); 236 pAction->setCheckable(true); 237 m_actions[static_cast<Section>(i)] = pAction; 238 239 /* Create the popup boxes */ 240 UIPopupBox *pPopup = new UIPopupBox(this); 241 connect(pPopup, SIGNAL(titleClicked(const QString)), 242 this, SIGNAL(linkClicked(const QString))); 243 pPopup->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); 244 m_secBoxes[static_cast<Section>(i)] = pPopup; 245 } 246 247 /* General */ 248 { 249 QILabel *pLabel= new QILabel(m_secBoxes.value(GeneralSec)); 250 pLabel->setWordWrap(true); 251 connect(pLabel, SIGNAL(shown()), 252 this, SLOT(sltUpdateGeneral())); 253 m_secBoxes.value(GeneralSec)->setTitleIcon(UIIconPool::iconSet(":/machine_16px.png")); 254 m_secBoxes.value(GeneralSec)->setTitleLink("#general"); 255 m_secBoxes.value(GeneralSec)->setContentWidget(pLabel); 256 m_secBoxes.value(GeneralSec)->hide(); 257 } 258 259 /* System */ 260 { 261 QILabel *pLabel= new QILabel(this); 262 pLabel->setWordWrap(true); 263 connect(pLabel, SIGNAL(shown()), 264 this, SLOT(sltUpdateSystem())); 265 m_secBoxes.value(SystemSec)->setTitleIcon(UIIconPool::iconSet(":/chipset_16px.png")); 266 m_secBoxes.value(SystemSec)->setTitleLink("#system"); 267 m_secBoxes.value(SystemSec)->setContentWidget(pLabel); 268 m_secBoxes.value(SystemSec)->hide(); 269 } 270 271 /* Preview */ 272 { 273 UIVMPreviewWindow *pWidget = new UIVMPreviewWindow(this); 274 m_secBoxes.value(PreviewSec)->setTitleIcon(UIIconPool::iconSet(":/machine_16px.png")); 275 m_secBoxes.value(PreviewSec)->setContentWidget(pWidget); 276 m_secBoxes.value(PreviewSec)->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 277 /* Make sure the width is always the same, regardless if the preview is 278 * shown or not. */ 279 m_secBoxes.value(PreviewSec)->setFixedWidth(m_secBoxes.value(PreviewSec)->sizeHint().width()); 280 m_secBoxes.value(PreviewSec)->hide(); 281 } 282 283 QHBoxLayout *tt1 = new QHBoxLayout(); 284 QVBoxLayout *tt2 = new QVBoxLayout(); 285 tt2->addWidget(m_secBoxes.value(GeneralSec)); 286 tt2->addWidget(m_secBoxes.value(SystemSec)); 287 tt2->addStretch(1); 288 tt1->addLayout(tt2); 289 QVBoxLayout *tt3 = new QVBoxLayout(); 290 tt3->addWidget(m_secBoxes.value(PreviewSec)); 291 tt3->addStretch(1); 292 tt1->addLayout(tt3); 293 pMainLayout->addLayout(tt1); 294 295 /* Display */ 296 { 297 QILabel *pLabel= new QILabel(this); 298 pLabel->setWordWrap(true); 299 connect(pLabel, SIGNAL(shown()), 300 this, SLOT(sltUpdateDisplay())); 301 m_secBoxes.value(DisplaySec)->setTitleIcon(UIIconPool::iconSet(":/vrdp_16px.png")); 302 m_secBoxes.value(DisplaySec)->setTitleLink("#display"); 303 m_secBoxes.value(DisplaySec)->setContentWidget(pLabel); 304 m_secBoxes.value(DisplaySec)->hide(); 305 pMainLayout->addWidget(m_secBoxes.value(DisplaySec)); 306 } 307 308 /* Storage */ 309 { 310 QILabel *pLabel= new QILabel(this); 311 pLabel->setWordWrap(true); 312 connect(pLabel, SIGNAL(shown()), 313 this, SLOT(sltUpdateStorage())); 314 m_secBoxes.value(StorageSec)->setTitleIcon(UIIconPool::iconSet(":/attachment_16px.png")); 315 m_secBoxes.value(StorageSec)->setTitleLink("#storage"); 316 m_secBoxes.value(StorageSec)->setContentWidget(pLabel); 317 m_secBoxes.value(StorageSec)->hide(); 318 pMainLayout->addWidget(m_secBoxes.value(StorageSec)); 319 } 320 321 /* Audio */ 322 { 323 QILabel *pLabel= new QILabel(this); 324 pLabel->setWordWrap(true); 325 connect(pLabel, SIGNAL(shown()), 326 this, SLOT(sltUpdateAudio())); 327 m_secBoxes.value(AudioSec)->setTitleIcon(UIIconPool::iconSet(":/sound_16px.png")); 328 m_secBoxes.value(AudioSec)->setTitleLink("#audio"); 329 m_secBoxes.value(AudioSec)->setContentWidget(pLabel); 330 m_secBoxes.value(AudioSec)->hide(); 331 pMainLayout->addWidget(m_secBoxes.value(AudioSec)); 332 } 333 334 /* Network */ 335 { 336 QILabel *pLabel= new QILabel(this); 337 pLabel->setWordWrap(true); 338 connect(pLabel, SIGNAL(shown()), 339 this, SLOT(sltUpdateNetwork())); 340 m_secBoxes.value(NetworkSec)->setTitleIcon(UIIconPool::iconSet(":/nw_16px.png")); 341 m_secBoxes.value(NetworkSec)->setTitleLink("#network"); 342 m_secBoxes.value(NetworkSec)->setContentWidget(pLabel); 343 m_secBoxes.value(NetworkSec)->hide(); 344 pMainLayout->addWidget(m_secBoxes.value(NetworkSec)); 345 } 346 347 /* Serial Ports */ 348 { 349 QILabel *pLabel= new QILabel(this); 350 pLabel->setWordWrap(true); 351 connect(pLabel, SIGNAL(shown()), 352 this, SLOT(sltUpdateSerialPorts())); 353 m_secBoxes.value(SerialPortsSec)->setTitleIcon(UIIconPool::iconSet(":/serial_port_16px.png")); 354 m_secBoxes.value(SerialPortsSec)->setTitleLink("#serialPorts"); 355 m_secBoxes.value(SerialPortsSec)->setContentWidget(pLabel); 356 m_secBoxes.value(SerialPortsSec)->hide(); 357 pMainLayout->addWidget(m_secBoxes.value(SerialPortsSec)); 358 } 359 360 #ifdef VBOX_WITH_PARALLEL_PORTS 361 /* Parallel Ports */ 362 { 363 QILabel *pLabel= new QILabel(this); 364 pLabel->setWordWrap(true); 365 connect(pLabel, SIGNAL(shown()), 366 this, SLOT(sltUpdateParallelPorts())); 367 m_secBoxes.value(ParallelPortsSec)->setTitleIcon(UIIconPool::iconSet(":/parallel_port_16px.png")); 368 m_secBoxes.value(ParallelPortsSec)->setTitleLink("#parallelPorts"); 369 m_secBoxes.value(ParallelPortsSec)->setContentWidget(pLabel); 370 m_secBoxes.value(ParallelPortsSec)->hide(); 371 pMainLayout->addWidget(m_secBoxes.value(ParallelPortsSec)); 372 } 373 #endif /* VBOX_WITH_PARALLEL_PORTS */ 374 375 /* USB */ 376 { 377 QILabel *pLabel= new QILabel(this); 378 pLabel->setWordWrap(true); 379 connect(pLabel, SIGNAL(shown()), 380 this, SLOT(sltUpdateUSB())); 381 m_secBoxes.value(USBSec)->setTitleIcon(UIIconPool::iconSet(":/usb_16px.png")); 382 m_secBoxes.value(USBSec)->setTitleLink("#usb"); 383 m_secBoxes.value(USBSec)->setContentWidget(pLabel); 384 m_secBoxes.value(USBSec)->hide(); 385 pMainLayout->addWidget(m_secBoxes.value(USBSec)); 386 } 387 388 /* Shared Folders */ 389 { 390 QILabel *pLabel= new QILabel(this); 391 pLabel->setWordWrap(true); 392 connect(pLabel, SIGNAL(shown()), 393 this, SLOT(sltUpdateSharedFolders())); 394 m_secBoxes.value(SharedFoldersSec)->setTitleIcon(UIIconPool::iconSet(":/shared_folder_16px.png")); 395 m_secBoxes.value(SharedFoldersSec)->setTitleLink("#sfolders"); 396 m_secBoxes.value(SharedFoldersSec)->setContentWidget(pLabel); 397 m_secBoxes.value(SharedFoldersSec)->hide(); 398 pMainLayout->addWidget(m_secBoxes.value(SharedFoldersSec)); 399 } 400 401 /* Description */ 402 { 403 QILabel *pLabel= new QILabel(this); 404 pLabel->setWordWrap(true); 405 connect(pLabel, SIGNAL(shown()), 406 this, SLOT(sltUpdateDescription())); 407 m_secBoxes.value(DescriptionSec)->setTitleIcon(UIIconPool::iconSet(":/description_16px.png")); 408 m_secBoxes.value(DescriptionSec)->setTitleLink("#general%%mTeDescription"); 409 m_secBoxes.value(DescriptionSec)->setContentWidget(pLabel); 410 m_secBoxes.value(DescriptionSec)->hide(); 411 pMainLayout->addWidget(m_secBoxes.value(DescriptionSec)); 412 } 413 414 pMainLayout->addStretch(1); 415 416 pSArea->setWidget(m_pDetails); 417 pSArea->setWidgetResizable(true); 418 addWidget(pSArea); 419 420 /* Read the configuration from extra data. Defaults are provided in place. */ 421 QStringList boxes = vboxGlobal().virtualBox().GetExtraDataStringList(VBoxDefs::GUI_DetailsPageBoxes, 422 /* Defaults */ 423 QStringList() 424 << m_EDStrs.value(GeneralSec) 425 << m_EDStrs.value(SystemSec) 426 << m_EDStrs.value(PreviewSec) 427 << m_EDStrs.value(DisplaySec) 428 << m_EDStrs.value(StorageSec) 429 << m_EDStrs.value(AudioSec) 430 << m_EDStrs.value(NetworkSec) 431 << m_EDStrs.value(USBSec) 432 << m_EDStrs.value(SharedFoldersSec) 433 << m_EDStrs.value(DescriptionSec)); 434 for (int i = 0; i < boxes.size(); ++i) 435 { 436 QString strED = boxes.value(i); 437 bool fOpen = !strED.endsWith("Closed"); 438 Section sec = m_EDStrs.key(fOpen ? strED : strED.remove("Closed"), EndSec); 439 if (sec != EndSec) 440 { 441 m_actions[sec]->setChecked(true); 442 m_secBoxes.value(sec)->setOpen(fOpen); 443 m_secBoxes.value(sec)->show(); 444 } 445 } 446 447 retranslateUi(); 448 } 449 450 UIDetailsPagePrivate::~UIDetailsPagePrivate() 451 { 452 /* Save the configuration to extra data at destruction */ 453 QStringList boxes; 454 for (int i = 0; i < EndSec; ++i) 455 { 456 if (m_actions[static_cast<Section>(i)]->isChecked()) 457 { 458 QString strED = m_EDStrs.value(static_cast<Section>(i)); 459 if (!m_secBoxes.value(static_cast<Section>(i))->isOpen()) 460 strED += "Closed"; 461 boxes << strED; 462 } 463 } 464 vboxGlobal().virtualBox().SetExtraDataStringList(VBoxDefs::GUI_DetailsPageBoxes, 465 boxes); 466 } 467 468 void UIDetailsPagePrivate::retranslateUi() 469 { 311 if (m_actions.contains(Section_USB)) 312 m_actions[Section_USB]->setText(tr("USB", "details report")); 313 if (m_actions.contains(Section_SharedFolders)) 314 m_actions[Section_SharedFolders]->setText(tr("Shared Folders", "details report")); 315 if (m_actions.contains(Section_Description)) 316 m_actions[Section_Description]->setText(tr("Description", "details report")); 317 } 318 319 /* Translate set of blocks of sections: */ 320 { 321 /* For every existing block: */ 322 for (int i = 0; i < m_cMachineCount; ++i) 323 { 324 /* For every existing section: */ 325 for (int j = 0; j < m_sections.size(); ++j) 326 { 327 /* Assign corresponding action text as section title: */ 328 m_set[i][m_sections[j]]->setTitle(m_actions[m_sections[j]]->text()); 329 } 330 } 331 } 332 333 /* Translate error-label text: */ 470 334 if (m_pErrLabel) 471 m_pErrLabel->setText(tr( 472 "The selected virtual machine is <i>inaccessible</i>. Please " 473 "inspect the error message shown below and press the " 474 "<b>Refresh</b> button if you want to repeat the accessibility " 475 "check:")); 476 477 if (mRefreshAction && mRefreshButton) 478 { 479 mRefreshButton->setText(mRefreshAction->text()); 480 mRefreshButton->setIcon(mRefreshAction->icon()); 481 mRefreshButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 482 } 483 484 /* General */ 485 { 486 m_secBoxes.value(GeneralSec)->setTitle(tr("General", "details report")); 487 m_actions.value(GeneralSec)->setText(m_secBoxes.value(GeneralSec)->title()); 488 } 489 490 /* System */ 491 { 492 m_secBoxes.value(SystemSec)->setTitle(tr("System", "details report")); 493 m_actions.value(SystemSec)->setText(m_secBoxes.value(SystemSec)->title()); 494 } 495 496 /* Preview */ 497 { 498 m_secBoxes.value(PreviewSec)->setTitle(tr("Preview", "details report")); 499 m_actions.value(PreviewSec)->setText(m_secBoxes.value(PreviewSec)->title()); 500 } 501 502 /* Display */ 503 { 504 m_secBoxes.value(DisplaySec)->setTitle(tr("Display", "details report")); 505 m_actions.value(DisplaySec)->setText(m_secBoxes.value(DisplaySec)->title()); 506 } 507 508 /* Storage */ 509 { 510 m_secBoxes.value(StorageSec)->setTitle(tr("Storage", "details report")); 511 m_actions.value(StorageSec)->setText(m_secBoxes.value(StorageSec)->title()); 512 } 513 514 /* Audio */ 515 { 516 m_secBoxes.value(AudioSec)->setTitle(tr("Audio", "details report")); 517 m_actions.value(AudioSec)->setText(m_secBoxes.value(AudioSec)->title()); 518 } 519 520 /* Network */ 521 { 522 m_secBoxes.value(NetworkSec)->setTitle(tr("Network", "details report")); 523 m_actions.value(NetworkSec)->setText(m_secBoxes.value(NetworkSec)->title()); 524 } 525 526 /* Serial Ports */ 527 { 528 m_secBoxes.value(SerialPortsSec)->setTitle(tr("Serial Ports", "details report")); 529 m_actions.value(SerialPortsSec)->setText(m_secBoxes.value(SerialPortsSec)->title()); 530 } 531 532 #ifdef VBOX_WITH_PARALLEL_PORTS 533 /* Parallel Ports */ 534 { 535 m_secBoxes.value(ParallelPortsSec)->setTitle(tr("Parallel Ports", "details report")); 536 m_actions.value(ParallelPortsSec)->setText(m_secBoxes.value(ParallelPortsSec)->title()); 537 } 538 #endif /* VBOX_WITH_PARALLEL_PORTS */ 539 540 /* USB */ 541 { 542 m_secBoxes.value(USBSec)->setTitle(tr("USB", "details report")); 543 m_actions.value(USBSec)->setText(m_secBoxes.value(USBSec)->title()); 544 } 545 546 /* Shared Folders */ 547 { 548 m_secBoxes.value(SharedFoldersSec)->setTitle(tr("Shared Folders", "details report")); 549 m_actions.value(SharedFoldersSec)->setText(m_secBoxes.value(SharedFoldersSec)->title()); 550 } 551 552 /* Description */ 553 { 554 m_secBoxes.value(DescriptionSec)->setTitle(tr("Description", "details report")); 555 m_actions.value(DescriptionSec)->setText(m_secBoxes.value(DescriptionSec)->title()); 335 m_pErrLabel->setText(tr("The selected virtual machine is <i>inaccessible</i>. " 336 "Please inspect the error message shown below and press the " 337 "<b>Refresh</b> button if you want to repeat the accessibility check:")); 338 339 /* Translate refresh button & action text: */ 340 if (m_pRefreshAction && m_pRefreshButton) 341 { 342 m_pRefreshButton->setText(m_pRefreshAction->text()); 343 m_pRefreshButton->setIcon(m_pRefreshAction->icon()); 344 m_pRefreshButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 556 345 } 557 346 } … … 559 348 void UIDetailsPagePrivate::sltUpdateGeneral() 560 349 { 561 m_secBoxes.value(GeneralSec)->setTitleLinkEnabled(m_fChangeable); 562 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(GeneralSec)->contentWidget()); 563 if (pLabel->isVisible()) 564 { 565 if (!m_machine.isNull()) 566 { 567 QString item = sSectionItemTpl2.arg(tr("Name", "details report"), 568 m_machine.GetName()) 569 + sSectionItemTpl2.arg(tr("OS Type", "details report"), 570 vboxGlobal().vmGuestOSTypeDescription(m_machine.GetOSTypeId())); 571 572 QString table = sTableTpl.arg(item); 573 pLabel->setText(table); 574 575 }else 576 pLabel->setText(""); 350 /* Get current sender: */ 351 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 352 AssertMsg(pSender, ("Sender should be valid!\n")); 353 /* Get current block number: */ 354 int iBlockNumber = pSender->property("block-number").toInt(); 355 /* Get current machine: */ 356 CMachine &machine = m_machines[iBlockNumber]; 357 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 358 /* Get details block: */ 359 UIDetailsBlock &block = m_set[iBlockNumber]; 360 /* Get corresponding content widget: */ 361 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_General]->contentWidget()); 362 AssertMsg(pLabel, ("Content widget should be valid!")); 363 364 /* Enable link: */ 365 block[Section_General]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 366 367 /* Update if content widget is visible: */ 368 if (pSender->isOpen()) 369 { 370 if (!machine.isNull()) 371 { 372 QString item = sSectionItemTpl2.arg(tr("Name", "details report"), machine.GetName()) 373 + sSectionItemTpl2.arg(tr("OS Type", "details report"), vboxGlobal().vmGuestOSTypeDescription(machine.GetOSTypeId())); 374 pLabel->setText(sTableTpl.arg(item)); 375 } 376 else 377 pLabel->clear(); 577 378 } 578 379 } … … 580 381 void UIDetailsPagePrivate::sltUpdateSystem() 581 382 { 582 m_secBoxes.value(SystemSec)->setTitleLinkEnabled(m_fChangeable); 583 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(SystemSec)->contentWidget()); 584 if (pLabel->isVisible()) 585 { 586 if (!m_machine.isNull()) 587 { 588 QString item = sSectionItemTpl2.arg(tr("Base Memory", "details report"), 589 tr("<nobr>%1 MB</nobr>", "details report")) 590 .arg(m_machine.GetMemorySize()); 591 592 int cCPU = m_machine.GetCPUCount(); 383 /* Get current sender: */ 384 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 385 AssertMsg(pSender, ("Sender should be valid!\n")); 386 /* Get current block number: */ 387 int iBlockNumber = pSender->property("block-number").toInt(); 388 /* Get current machine: */ 389 CMachine &machine = m_machines[iBlockNumber]; 390 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 391 /* Get details block: */ 392 UIDetailsBlock &block = m_set[iBlockNumber]; 393 /* Get corresponding content widget: */ 394 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_System]->contentWidget()); 395 AssertMsg(pLabel, ("Content widget should be valid!")); 396 397 /* Enable link: */ 398 block[Section_System]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 399 400 /* Update if content widget is visible: */ 401 if (pSender->isOpen()) 402 { 403 if (!machine.isNull()) 404 { 405 QString item = sSectionItemTpl2.arg(tr("Base Memory", "details report"), tr("<nobr>%1 MB</nobr>", "details report")) 406 .arg(machine.GetMemorySize()); 407 408 int cCPU = machine.GetCPUCount(); 593 409 if (cCPU > 1) 594 item += sSectionItemTpl2.arg(tr("Processors", "details report"), 595 tr("<nobr>%1</nobr>", "details report")) 596 .arg(cCPU); 597 598 int iCPUExecCap = m_machine.GetCPUExecutionCap(); 410 item += sSectionItemTpl2.arg(tr("Processors", "details report"), tr("<nobr>%1</nobr>", "details report")) 411 .arg(cCPU); 412 413 int iCPUExecCap = machine.GetCPUExecutionCap(); 599 414 if (iCPUExecCap < 100) 600 item += sSectionItemTpl2.arg(tr("Execution Cap", "details report"), 601 tr("<nobr>%1%</nobr>", "details report")) 602 .arg(iCPUExecCap); 603 604 /* Boot order */ 415 item += sSectionItemTpl2.arg(tr("Execution Cap", "details report"), tr("<nobr>%1%</nobr>", "details report")) 416 .arg(iCPUExecCap); 417 418 /* Boot order: */ 605 419 QStringList bootOrder; 606 420 for (ulong i = 1; i <= m_vbox.GetSystemProperties().GetMaxBootPosition(); ++i) 607 421 { 608 KDeviceType device = m _machine.GetBootOrder(i);422 KDeviceType device = machine.GetBootOrder(i); 609 423 if (device == KDeviceType_Null) 610 424 continue; … … 617 431 618 432 #ifdef VBOX_WITH_FULL_DETAILS_REPORT 619 /* BIOS Settings holder */620 const CBIOSSettings &biosSettings = m _machine.GetBIOSSettings();433 /* BIOS Settings holder: */ 434 const CBIOSSettings &biosSettings = machine.GetBIOSSettings(); 621 435 QStringList bios; 622 /* ACPI */ 436 437 /* ACPI: */ 623 438 if (biosSettings.GetACPIEnabled()) 624 439 bios << tr("ACPI", "details report"); 625 440 626 /* IO APIC */441 /* IO APIC: */ 627 442 if (biosSettings.GetIOAPICEnabled()) 628 443 bios << tr("IO APIC", "details report"); … … 635 450 if (m_vbox.GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx)) 636 451 { 637 /* VT-x/AMD-V */638 if (m _machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled))452 /* VT-x/AMD-V: */ 453 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)) 639 454 { 640 455 accel << tr("VT-x/AMD-V", "details report"); 641 456 642 /* Nested Paging (only when hw virt is enabled) */643 if (m _machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))457 /* Nested Paging (only when hw virt is enabled): */ 458 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)) 644 459 accel << tr("Nested Paging", "details report"); 645 460 } 646 461 } 647 /* PAE/NX */ 648 if (m_machine.GetCPUProperty(KCPUPropertyType_PAE)) 462 463 /* PAE/NX: */ 464 if (machine.GetCPUProperty(KCPUPropertyType_PAE)) 649 465 accel << tr("PAE/NX", "details report"); 650 466 … … 652 468 item += sSectionItemTpl2.arg(tr("Acceleration", "details report"), accel.join(", ")); 653 469 654 QString table = sTableTpl.arg(item);655 pLabel->setText(table);656 }else657 pLabel-> setText("");470 pLabel->setText(sTableTpl.arg(item)); 471 } 472 else 473 pLabel->clear(); 658 474 } 659 475 } … … 661 477 void UIDetailsPagePrivate::sltUpdatePreview() 662 478 { 663 qobject_cast<UIVMPreviewWindow*>(m_secBoxes.value(PreviewSec)->contentWidget())->setMachine(m_machine); 479 /* Get current sender: */ 480 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 481 AssertMsg(pSender, ("Sender should be valid!\n")); 482 /* Get current block number: */ 483 int iBlockNumber = pSender->property("block-number").toInt(); 484 /* Get current machine: */ 485 CMachine &machine = m_machines[iBlockNumber]; 486 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 487 /* Get details block: */ 488 UIDetailsBlock &block = m_set[iBlockNumber]; 489 /* Get corresponding content widget: */ 490 UIVMPreviewWindow *pPreview = qobject_cast<UIVMPreviewWindow*>(block[Section_Preview]->contentWidget()); 491 AssertMsg(pPreview, ("Content widget should be valid!")); 492 493 /* Update if content widget is visible: */ 494 if (pSender->isOpen()) 495 { 496 /* Update preview widget: */ 497 pPreview->setMachine(machine); 498 } 664 499 } 665 500 666 501 void UIDetailsPagePrivate::sltUpdateDisplay() 667 502 { 668 m_secBoxes.value(DisplaySec)->setTitleLinkEnabled(m_fChangeable); 669 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(DisplaySec)->contentWidget()); 670 if (pLabel->isVisible()) 671 { 672 if (!m_machine.isNull()) 673 { 674 /* Video tab */ 675 QString item = QString(sSectionItemTpl2) 676 .arg(tr("Video Memory", "details report"), 677 tr("<nobr>%1 MB</nobr>", "details report")) 678 .arg(m_machine.GetVRAMSize()); 679 680 int cGuestScreens = m_machine.GetMonitorCount(); 503 /* Get current sender: */ 504 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 505 AssertMsg(pSender, ("Sender should be valid!\n")); 506 /* Get current block number: */ 507 int iBlockNumber = pSender->property("block-number").toInt(); 508 /* Get current machine: */ 509 CMachine &machine = m_machines[iBlockNumber]; 510 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 511 /* Get details block: */ 512 UIDetailsBlock &block = m_set[iBlockNumber]; 513 /* Get corresponding content widget: */ 514 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Display]->contentWidget()); 515 AssertMsg(pLabel, ("Content widget should be valid!")); 516 517 /* Enable link: */ 518 block[Section_Display]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 519 520 /* Update if content widget is visible: */ 521 if (pSender->isOpen()) 522 { 523 if (!machine.isNull()) 524 { 525 /* Video tab: */ 526 QString item = QString(sSectionItemTpl2).arg(tr("Video Memory", "details report"), tr("<nobr>%1 MB</nobr>", "details report")) 527 .arg(machine.GetVRAMSize()); 528 529 int cGuestScreens = machine.GetMonitorCount(); 681 530 if (cGuestScreens > 1) 682 { 683 item += QString(sSectionItemTpl2) 684 .arg(tr("Screens", "details report")) 685 .arg(cGuestScreens); 686 } 531 item += QString(sSectionItemTpl2).arg(tr("Screens", "details report")).arg(cGuestScreens); 687 532 688 533 QStringList accel; 689 534 #ifdef VBOX_WITH_VIDEOHWACCEL 690 if (m _machine.GetAccelerate2DVideoEnabled())535 if (machine.GetAccelerate2DVideoEnabled()) 691 536 accel << tr("2D Video", "details report"); 692 537 #endif /* VBOX_WITH_VIDEOHWACCEL */ 693 if (m _machine.GetAccelerate3DEnabled())538 if (machine.GetAccelerate3DEnabled()) 694 539 accel << tr("3D", "details report"); 695 540 … … 697 542 item += sSectionItemTpl2.arg(tr("Acceleration", "details report"), accel.join(", ")); 698 543 699 /* VRDE tab */700 CVRDEServer srv = m _machine.GetVRDEServer();544 /* VRDE tab: */ 545 CVRDEServer srv = machine.GetVRDEServer(); 701 546 if (!srv.isNull()) 702 547 { 703 548 if (srv.GetEnabled()) 704 item += QString(sSectionItemTpl2) 705 .arg(tr("Remote Desktop Server Port", "details report (VRDE Server)")) 706 .arg(srv.GetVRDEProperty("TCP/Ports")); 549 item += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server Port", "details report (VRDE Server)")) 550 .arg(srv.GetVRDEProperty("TCP/Ports")); 707 551 else 708 item += QString(sSectionItemTpl2) 709 .arg(tr("Remote Desktop Server", "details report (VRDE Server)")) 710 .arg(tr("Disabled", "details report (VRDE Server)")); 552 item += QString(sSectionItemTpl2).arg(tr("Remote Desktop Server", "details report (VRDE Server)")) 553 .arg(tr("Disabled", "details report (VRDE Server)")); 711 554 } 712 555 713 QString table = sTableTpl.arg(item);714 pLabel->setText(table);715 }else716 pLabel-> setText("");556 pLabel->setText(sTableTpl.arg(item)); 557 } 558 else 559 pLabel->clear(); 717 560 } 718 561 } … … 720 563 void UIDetailsPagePrivate::sltUpdateStorage() 721 564 { 722 m_secBoxes.value(StorageSec)->setTitleLinkEnabled(m_fChangeable); 723 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(StorageSec)->contentWidget()); 724 if (pLabel->isVisible()) 725 { 726 if (!m_machine.isNull()) 565 /* Get current sender: */ 566 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 567 AssertMsg(pSender, ("Sender should be valid!\n")); 568 /* Get current block number: */ 569 int iBlockNumber = pSender->property("block-number").toInt(); 570 /* Get current machine: */ 571 CMachine &machine = m_machines[iBlockNumber]; 572 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 573 /* Get details block: */ 574 UIDetailsBlock &block = m_set[iBlockNumber]; 575 /* Get corresponding content widget: */ 576 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Storage]->contentWidget()); 577 AssertMsg(pLabel, ("Content widget should be valid!")); 578 579 /* Enable link: */ 580 block[Section_Storage]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 581 582 /* Update if content widget is visible: */ 583 if (pSender->isOpen()) 584 { 585 if (!machine.isNull()) 727 586 { 728 587 QString item; 729 588 /* Iterate over the all machine controllers: */ 730 const CStorageControllerVector &controllers = m _machine.GetStorageControllers();589 const CStorageControllerVector &controllers = machine.GetStorageControllers(); 731 590 for (int i = 0; i < controllers.size(); ++i) 732 591 { … … 738 597 /* Populate sorted map with attachments information: */ 739 598 QMap<StorageSlot,QString> attachmentsMap; 740 const CMediumAttachmentVector &attachments = m _machine.GetMediumAttachmentsOfController(controller.GetName());599 const CMediumAttachmentVector &attachments = machine.GetMediumAttachmentsOfController(controller.GetName()); 741 600 for (int j = 0; j < attachments.size(); ++j) 742 601 { … … 753 612 /* Prepare information about current medium & attachment: */ 754 613 QString strAttachmentInfo = !attachment.isOk() ? QString() : 755 QString(sSectionItemTpl2) 756 .arg(QString(" ") + 757 vboxGlobal().toString(StorageSlot(controller.GetBus(), 758 attachment.GetPort(), 759 attachment.GetDevice())) + strDeviceType) 760 .arg(vboxGlobal().details(medium, false)); 614 QString(sSectionItemTpl2) 615 .arg(QString(" ") + 616 vboxGlobal().toString(StorageSlot(controller.GetBus(), 617 attachment.GetPort(), 618 attachment.GetDevice())) + 619 strDeviceType) 620 .arg(vboxGlobal().details(medium, false)); 761 621 /* Insert that attachment into map: */ 762 622 if (!strAttachmentInfo.isNull()) … … 775 635 776 636 if (item.isNull()) 777 { 778 item = QString(sSectionItemTpl1) 779 .arg(tr("Not Attached", "details report (Storage)")); 780 } 781 782 QString table = sTableTpl.arg(item); 783 pLabel->setText(table); 784 } else 785 pLabel->setText(""); 637 item = QString(sSectionItemTpl1).arg(tr("Not Attached", "details report (Storage)")); 638 639 pLabel->setText(sTableTpl.arg(item)); 640 } 641 else 642 pLabel->clear(); 786 643 } 787 644 } … … 789 646 void UIDetailsPagePrivate::sltUpdateAudio() 790 647 { 791 m_secBoxes.value(AudioSec)->setTitleLinkEnabled(m_fChangeable); 792 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(AudioSec)->contentWidget()); 793 if (pLabel->isVisible()) 794 { 795 if (!m_machine.isNull()) 648 /* Get current sender: */ 649 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 650 AssertMsg(pSender, ("Sender should be valid!\n")); 651 /* Get current block number: */ 652 int iBlockNumber = pSender->property("block-number").toInt(); 653 /* Get current machine: */ 654 CMachine &machine = m_machines[iBlockNumber]; 655 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 656 /* Get details block: */ 657 UIDetailsBlock &block = m_set[iBlockNumber]; 658 /* Get corresponding content widget: */ 659 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Audio]->contentWidget()); 660 AssertMsg(pLabel, ("Content widget should be valid!")); 661 662 /* Enable link: */ 663 block[Section_Audio]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 664 665 /* Update if content widget is visible: */ 666 if (pSender->isOpen()) 667 { 668 if (!machine.isNull()) 796 669 { 797 670 QString item; 798 671 799 const CAudioAdapter &audio = m _machine.GetAudioAdapter();672 const CAudioAdapter &audio = machine.GetAudioAdapter(); 800 673 if (audio.GetEnabled()) 801 item = QString(sSectionItemTpl2) 802 .arg(tr("Host Driver", "details report (audio)"), 803 vboxGlobal().toString(audio.GetAudioDriver())) + 804 QString(sSectionItemTpl2) 805 .arg(tr("Controller", "details report (audio)"), 806 vboxGlobal().toString(audio.GetAudioController())); 674 item = QString(sSectionItemTpl2).arg(tr("Host Driver", "details report (audio)"), 675 vboxGlobal().toString(audio.GetAudioDriver())) + 676 QString(sSectionItemTpl2).arg(tr("Controller", "details report (audio)"), 677 vboxGlobal().toString(audio.GetAudioController())); 807 678 else 808 item = QString(sSectionItemTpl1) 809 .arg(tr("Disabled", "details report (audio)")); 810 811 QString table = sTableTpl.arg(item); 812 pLabel->setText(table); 813 } else 814 pLabel->setText(""); 679 item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (audio)")); 680 681 pLabel->setText(sTableTpl.arg(item)); 682 } 683 else 684 pLabel->clear(); 815 685 } 816 686 } … … 818 688 void UIDetailsPagePrivate::sltUpdateNetwork() 819 689 { 820 m_secBoxes.value(NetworkSec)->setTitleLinkEnabled(m_fChangeable); 821 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(NetworkSec)->contentWidget()); 822 if (pLabel->isVisible()) 823 { 824 if (!m_machine.isNull()) 690 /* Get current sender: */ 691 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 692 AssertMsg(pSender, ("Sender should be valid!\n")); 693 /* Get current block number: */ 694 int iBlockNumber = pSender->property("block-number").toInt(); 695 /* Get current machine: */ 696 CMachine &machine = m_machines[iBlockNumber]; 697 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 698 /* Get details block: */ 699 UIDetailsBlock &block = m_set[iBlockNumber]; 700 /* Get corresponding content widget: */ 701 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Network]->contentWidget()); 702 AssertMsg(pLabel, ("Content widget should be valid!")); 703 704 /* Enable link: */ 705 block[Section_Network]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 706 707 /* Update if content widget is visible: */ 708 if (pSender->isOpen()) 709 { 710 if (!machine.isNull()) 825 711 { 826 712 QString item; … … 829 715 for (ulong slot = 0; slot < count; slot ++) 830 716 { 831 const CNetworkAdapter &adapter = m _machine.GetNetworkAdapter(slot);717 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(slot); 832 718 if (adapter.GetEnabled()) 833 719 { 834 720 KNetworkAttachmentType type = adapter.GetAttachmentType(); 835 721 QString attType = vboxGlobal().toString(adapter.GetAdapterType()) 836 .replace(QRegExp("\\s\\(.+\\)"), " (%1)");837 /* don't use the adapter type string for types that have838 * an additional symbolic network/interface name field, use839 * this name instead*/722 .replace(QRegExp("\\s\\(.+\\)"), " (%1)"); 723 /* Don't use the adapter type string for types that have 724 * an additional symbolic network/interface name field, 725 * use this name instead: */ 840 726 if (type == KNetworkAttachmentType_Bridged) 841 attType = attType.arg(tr("Bridged adapter, %1", 842 "details report (network)").arg(adapter.GetBridgedInterface())); 727 attType = attType.arg(tr("Bridged adapter, %1", "details report (network)").arg(adapter.GetBridgedInterface())); 843 728 else if (type == KNetworkAttachmentType_Internal) 844 attType = attType.arg(tr("Internal network, '%1'", 845 "details report (network)").arg(adapter.GetInternalNetwork())); 729 attType = attType.arg(tr("Internal network, '%1'", "details report (network)").arg(adapter.GetInternalNetwork())); 846 730 else if (type == KNetworkAttachmentType_HostOnly) 847 attType = attType.arg(tr("Host-only adapter, '%1'", 848 "details report (network)").arg(adapter.GetHostOnlyInterface())); 731 attType = attType.arg(tr("Host-only adapter, '%1'", "details report (network)").arg(adapter.GetHostOnlyInterface())); 849 732 else if (type == KNetworkAttachmentType_Generic) 850 733 { … … 858 741 attType = attType.arg(vboxGlobal().toString(type)); 859 742 860 item += QString(sSectionItemTpl2) 861 .arg(tr("Adapter %1", "details report (network)") 862 .arg(adapter.GetSlot() + 1)) 863 .arg(attType); 743 item += QString(sSectionItemTpl2).arg(tr("Adapter %1", "details report (network)").arg(adapter.GetSlot() + 1)) 744 .arg(attType); 864 745 } 865 746 } 866 747 if (item.isNull()) 867 { 868 item = QString(sSectionItemTpl1) 869 .arg(tr("Disabled", "details report (network)")); 870 } 871 872 QString table = sTableTpl.arg(item); 873 pLabel->setText(table); 874 } else 875 pLabel->setText(""); 748 item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (network)")); 749 750 pLabel->setText(sTableTpl.arg(item)); 751 } 752 else 753 pLabel->clear(); 876 754 } 877 755 } … … 879 757 void UIDetailsPagePrivate::sltUpdateSerialPorts() 880 758 { 881 m_secBoxes.value(SerialPortsSec)->setTitleLinkEnabled(m_fChangeable); 882 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(SerialPortsSec)->contentWidget()); 883 if (pLabel->isVisible()) 884 { 885 if (!m_machine.isNull()) 759 /* Get current sender: */ 760 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 761 AssertMsg(pSender, ("Sender should be valid!\n")); 762 /* Get current block number: */ 763 int iBlockNumber = pSender->property("block-number").toInt(); 764 /* Get current machine: */ 765 CMachine &machine = m_machines[iBlockNumber]; 766 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 767 /* Get details block: */ 768 UIDetailsBlock &block = m_set[iBlockNumber]; 769 /* Get corresponding content widget: */ 770 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Serial]->contentWidget()); 771 AssertMsg(pLabel, ("Content widget should be valid!")); 772 773 /* Enable link: */ 774 block[Section_Serial]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 775 776 /* Update if content widget is visible: */ 777 if (pSender->isOpen()) 778 { 779 if (!machine.isNull()) 886 780 { 887 781 QString item; … … 890 784 for (ulong slot = 0; slot < count; slot ++) 891 785 { 892 const CSerialPort &port = m _machine.GetSerialPort(slot);786 const CSerialPort &port = machine.GetSerialPort(slot); 893 787 if (port.GetEnabled()) 894 788 { 895 789 KPortMode mode = port.GetHostMode(); 896 QString data = 897 vboxGlobal().toCOMPortName(port.GetIRQ(), port.GetIOBase()) + ", "; 898 if (mode == KPortMode_HostPipe || 899 mode == KPortMode_HostDevice || 900 mode == KPortMode_RawFile) 901 data += QString("%1 (<nobr>%2</nobr>)") 902 .arg(vboxGlobal().toString(mode)) 903 .arg(QDir::toNativeSeparators(port.GetPath())); 790 QString data = vboxGlobal().toCOMPortName(port.GetIRQ(), port.GetIOBase()) + ", "; 791 if (mode == KPortMode_HostPipe || mode == KPortMode_HostDevice || mode == KPortMode_RawFile) 792 data += QString("%1 (<nobr>%2</nobr>)").arg(vboxGlobal().toString(mode)).arg(QDir::toNativeSeparators(port.GetPath())); 904 793 else 905 794 data += vboxGlobal().toString(mode); 906 795 907 item += QString(sSectionItemTpl2) 908 .arg(tr("Port %1", "details report (serial ports)") 909 .arg(port.GetSlot() + 1)) 910 .arg(data); 796 item += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (serial ports)").arg(port.GetSlot() + 1)) 797 .arg(data); 911 798 } 912 799 } 913 800 if (item.isNull()) 914 { 915 item = QString(sSectionItemTpl1) 916 .arg(tr("Disabled", "details report (serial ports)")); 917 } 918 919 QString table = sTableTpl.arg(item); 920 pLabel->setText(table); 921 } else 922 pLabel->setText(""); 801 item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (serial ports)")); 802 803 pLabel->setText(sTableTpl.arg(item)); 804 } 805 else 806 pLabel->clear(); 923 807 } 924 808 } … … 927 811 void UIDetailsPagePrivate::sltUpdateParallelPorts() 928 812 { 929 m_secBoxes.value(ParallelPortsSec)->setTitleLinkEnabled(m_fChangeable); 930 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(ParallelPortsSec)->contentWidget()); 931 if (pLabel->isVisible()) 932 { 933 if (!m_machine.isNull()) 813 /* Get current sender: */ 814 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 815 AssertMsg(pSender, ("Sender should be valid!\n")); 816 /* Get current block number: */ 817 int iBlockNumber = pSender->property("block-number").toInt(); 818 /* Get current machine: */ 819 CMachine &machine = m_machines[iBlockNumber]; 820 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 821 /* Get details block: */ 822 UIDetailsBlock &block = m_set[iBlockNumber]; 823 /* Get corresponding content widget: */ 824 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Parallel]->contentWidget()); 825 AssertMsg(pLabel, ("Content widget should be valid!")); 826 827 /* Enable link: */ 828 block[Section_Parallel]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 829 830 /* Update if content widget is visible: */ 831 if (pSender->isOpen()) 832 { 833 if (!machine.isNull()) 934 834 { 935 835 QString item; … … 938 838 for (ulong slot = 0; slot < count; slot ++) 939 839 { 940 const CParallelPort &port = m _machine.GetParallelPort(slot);840 const CParallelPort &port = machine.GetParallelPort(slot); 941 841 if (port.GetEnabled()) 942 842 { 943 QString data = 944 vboxGlobal().toLPTPortName(port.GetIRQ(), port.GetIOBase()) + 945 QString(" (<nobr>%1</nobr>)") 946 .arg(QDir::toNativeSeparators(port.GetPath())); 947 948 item += QString(sSectionItemTpl2) 949 .arg(tr("Port %1", "details report (parallel ports)") 950 .arg(port.GetSlot() + 1)) 951 .arg(data); 843 QString data = vboxGlobal().toLPTPortName(port.GetIRQ(), port.GetIOBase()) + 844 QString(" (<nobr>%1</nobr>)").arg(QDir::toNativeSeparators(port.GetPath())); 845 846 item += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (parallel ports)").arg(port.GetSlot() + 1)) 847 .arg(data); 952 848 } 953 849 } 954 850 if (item.isNull()) 955 { 956 item = QString(sSectionItemTpl1) 957 .arg(tr("Disabled", "details report (parallel ports)")); 958 } 959 960 /* Currently disabled */ 961 QString table = sTableTpl.arg(item); 962 pLabel->setText(table); 963 } else 964 pLabel->setText(""); 851 item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (parallel ports)")); 852 853 pLabel->setText(sTableTpl.arg(item)); 854 } 855 else 856 pLabel->clear(); 965 857 } 966 858 } … … 969 861 void UIDetailsPagePrivate::sltUpdateUSB() 970 862 { 971 m_secBoxes.value(USBSec)->setTitleLinkEnabled(m_fChangeable); 972 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(USBSec)->contentWidget()); 973 if (pLabel->isVisible()) 974 { 975 if (!m_machine.isNull()) 863 /* Get current sender: */ 864 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 865 AssertMsg(pSender, ("Sender should be valid!\n")); 866 /* Get current block number: */ 867 int iBlockNumber = pSender->property("block-number").toInt(); 868 /* Get current machine: */ 869 CMachine &machine = m_machines[iBlockNumber]; 870 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 871 /* Get details block: */ 872 UIDetailsBlock &block = m_set[iBlockNumber]; 873 /* Get corresponding content widget: */ 874 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_USB]->contentWidget()); 875 AssertMsg(pLabel, ("Content widget should be valid!")); 876 877 /* Enable link: */ 878 block[Section_USB]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 879 880 /* Update if content widget is visible: */ 881 if (pSender->isOpen()) 882 { 883 if (!machine.isNull()) 976 884 { 977 885 QString item; 978 886 979 const CUSBController &ctl = m_machine.GetUSBController(); 980 if ( !ctl.isNull() 981 && ctl.GetProxyAvailable()) 887 const CUSBController &ctl = machine.GetUSBController(); 888 if (!ctl.isNull() && ctl.GetProxyAvailable()) 982 889 { 983 890 m_fUSBAvailable = true; 984 /* the USB controller may be unavailable (i.e. in VirtualBox OSE)*/891 /* The USB controller may be unavailable (i.e. in VirtualBox OSE): */ 985 892 if (ctl.GetEnabled()) 986 893 { … … 989 896 for (int i = 0; i < coll.size(); ++i) 990 897 if (coll[i].GetActive()) 991 active ++; 992 993 item = QString(sSectionItemTpl2) 994 .arg(tr("Device Filters", "details report (USB)"), 995 tr("%1 (%2 active)", "details report (USB)") 996 .arg(coll.size()).arg(active)); 898 ++active; 899 900 item = QString(sSectionItemTpl2).arg(tr("Device Filters", "details report (USB)"), 901 tr("%1 (%2 active)", "details report (USB)").arg(coll.size()).arg(active)); 997 902 } 998 903 else 999 item = QString(sSectionItemTpl1) 1000 .arg(tr("Disabled", "details report (USB)")); 1001 1002 QString table = sTableTpl.arg(item); 1003 pLabel->setText(table); 1004 } else 904 item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (USB)")); 905 906 pLabel->setText(sTableTpl.arg(item)); 907 } 908 else 1005 909 { 1006 910 m_fUSBAvailable = false; 1007 /* Fully hide when USB is not available */1008 m_secBoxes.value(USBSec)->hide();911 /* Fully hide when USB is not available: */ 912 block[Section_USB]->hide(); 1009 913 } 1010 } else 1011 pLabel->setText(""); 914 } 915 else 916 pLabel->clear(); 1012 917 } 1013 918 } … … 1015 920 void UIDetailsPagePrivate::sltUpdateSharedFolders() 1016 921 { 1017 m_secBoxes.value(SharedFoldersSec)->setTitleLinkEnabled(m_fChangeable); 1018 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(SharedFoldersSec)->contentWidget()); 1019 if (pLabel->isVisible()) 1020 { 1021 if (!m_machine.isNull()) 922 /* Get current sender: */ 923 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 924 AssertMsg(pSender, ("Sender should be valid!\n")); 925 /* Get current block number: */ 926 int iBlockNumber = pSender->property("block-number").toInt(); 927 /* Get current machine: */ 928 CMachine &machine = m_machines[iBlockNumber]; 929 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 930 /* Get details block: */ 931 UIDetailsBlock &block = m_set[iBlockNumber]; 932 /* Get corresponding content widget: */ 933 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_SharedFolders]->contentWidget()); 934 AssertMsg(pLabel, ("Content widget should be valid!")); 935 936 /* Enable link: */ 937 block[Section_SharedFolders]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 938 939 /* Update if content widget is visible: */ 940 if (pSender->isOpen()) 941 { 942 if (!machine.isNull()) 1022 943 { 1023 944 QString item; 1024 945 1025 ulong count = m _machine.GetSharedFolders().size();946 ulong count = machine.GetSharedFolders().size(); 1026 947 if (count > 0) 1027 948 { 1028 item = QString(sSectionItemTpl2) 1029 .arg(tr("Shared Folders", "details report (shared folders)")) 1030 .arg(count); 949 item = QString(sSectionItemTpl2).arg(tr("Shared Folders", "details report (shared folders)")).arg(count); 1031 950 } 1032 951 else 1033 item = QString(sSectionItemTpl1) 1034 .arg(tr("None", "details report (shared folders)")); 1035 1036 QString table = sTableTpl.arg(item); 1037 pLabel->setText(table); 1038 } else 1039 pLabel->setText(""); 952 item = QString(sSectionItemTpl1).arg(tr("None", "details report (shared folders)")); 953 954 pLabel->setText(sTableTpl.arg(item)); 955 } 956 else 957 pLabel->clear(); 1040 958 } 1041 959 } … … 1043 961 void UIDetailsPagePrivate::sltUpdateDescription() 1044 962 { 1045 m_secBoxes.value(DescriptionSec)->setTitleLinkEnabled(m_fChangeable); 1046 QILabel *pLabel = qobject_cast<QILabel*>(m_secBoxes.value(DescriptionSec)->contentWidget()); 1047 if (pLabel->isVisible()) 1048 { 1049 if (!m_machine.isNull()) 963 /* Get current sender: */ 964 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 965 AssertMsg(pSender, ("Sender should be valid!\n")); 966 /* Get current block number: */ 967 int iBlockNumber = pSender->property("block-number").toInt(); 968 /* Get current machine: */ 969 CMachine &machine = m_machines[iBlockNumber]; 970 AssertMsg(!machine.isNull(), ("Machine should be valid!\n")); 971 /* Get details block: */ 972 UIDetailsBlock &block = m_set[iBlockNumber]; 973 /* Get corresponding content widget: */ 974 QILabel *pLabel = qobject_cast<QILabel*>(block[Section_Description]->contentWidget()); 975 AssertMsg(pLabel, ("Content widget should be valid!")); 976 977 /* Enable link: */ 978 block[Section_Description]->setTitleLinkEnabled(m_changeable[iBlockNumber]); 979 980 /* Update if content widget is visible: */ 981 if (pSender->isOpen()) 982 { 983 if (!machine.isNull()) 1050 984 { 1051 985 QString item; 1052 const QString &strDesc = m _machine.GetDescription();986 const QString &strDesc = machine.GetDescription(); 1053 987 if (!strDesc.isEmpty()) 1054 item = QString(sSectionItemTpl4) 1055 .arg(strDesc); 988 item = QString(sSectionItemTpl4).arg(strDesc); 1056 989 else 1057 item = QString(sSectionItemTpl1) 1058 .arg(tr("None", "details report (description)")); 1059 1060 QString table = sTableTpl.arg(item); 1061 pLabel->setText(table); 1062 1063 }else 1064 pLabel->setText(""); 990 item = QString(sSectionItemTpl1).arg(tr("None", "details report (description)")); 991 992 pLabel->setText(sTableTpl.arg(item)); 993 } 994 else 995 pLabel->clear(); 1065 996 } 1066 997 } … … 1068 999 void UIDetailsPagePrivate::sltContextMenuRequested(const QPoint &pos) 1069 1000 { 1070 QList<QAction*> actions = m_actions.values(); 1001 /* Populate list of allowed actions: */ 1002 QList<QAction*> actions; 1003 for (int i = 0; i < m_sections.size(); ++i) 1004 actions << m_actions[m_sections[i]]; 1005 /* Restrict USB action if USB is NOT available: */ 1071 1006 if (!m_fUSBAvailable) 1072 actions.removeOne(m_actions.value(USBSec)); 1007 actions.removeOne(m_actions[Section_USB]); 1008 /* Popup menu to show/hide sections: */ 1073 1009 QAction *pReturn = QMenu::exec(actions, m_pDetails->mapToGlobal(pos), 0); 1010 /* If some action was toggled: */ 1074 1011 if (pReturn) 1075 1012 { 1076 UIPopupBox *pBox = m_secBoxes.value(static_cast<Section>(pReturn->data().toInt())); 1077 if (pReturn->isChecked()) 1078 pBox->show(); 1079 else 1080 pBox->hide(); 1081 } 1082 } 1083 1084 void UIDetailsPagePrivate::setMachine(const CMachine& machine) 1085 { 1086 m_machine = machine; 1087 m_fChangeable = m_machine.isNull() ? false : 1088 m_machine.GetState() != KMachineState_Stuck && 1089 m_machine.GetState() != KMachineState_Saved /* for now! */; 1090 1091 sltUpdateGeneral(); 1092 sltUpdateSystem(); 1093 sltUpdatePreview(); 1094 sltUpdateDisplay(); 1095 sltUpdateStorage(); 1096 sltUpdateAudio(); 1097 sltUpdateNetwork(); 1098 sltUpdateSerialPorts(); 1013 /* Get corresponding section type: */ 1014 Section section = static_cast<Section>(pReturn->data().toInt()); 1015 /* Enumerate all the available blocks: */ 1016 for (int i = 0; i < m_cMachineCount; ++i) 1017 { 1018 /* Get current popup: */ 1019 UIPopupBox *pPopup = m_set[i][section]; 1020 /* Show/hide popup if necessary: */ 1021 if (pReturn->isChecked()) 1022 pPopup->show(); 1023 else 1024 pPopup->hide(); 1025 } 1026 } 1027 } 1028 1029 void UIDetailsPagePrivate::sltPopupToggled(bool fPopupOpened) 1030 { 1031 /* Get current sender: */ 1032 UIPopupBox *pSender = sender() && sender()->inherits("UIPopupBox") ? qobject_cast<UIPopupBox*>(sender()) : 0; 1033 AssertMsg(pSender, ("Sender should be valid!\n")); 1034 /* Get section type: */ 1035 Section section = static_cast<Section>(pSender->property("section-type").toInt()); 1036 /* Update the state of corresponding map: */ 1037 m_sectionOpened[section] = fPopupOpened; 1038 /* Open/Close all the blocks: */ 1039 for (int i = 0; i < m_cMachineCount; ++i) 1040 m_set[i][section]->setOpen(fPopupOpened); 1041 } 1042 1043 void UIDetailsPagePrivate::prepareSet() 1044 { 1045 /* Which sections should be available: */ 1046 m_sections.clear(); 1047 if (m_cMachineCount == 1) 1048 { 1049 m_sections << Section_General 1050 << Section_System 1051 << Section_Preview 1052 << Section_Display 1053 << Section_Storage 1054 << Section_Audio 1055 << Section_Network 1056 << Section_Serial 1099 1057 #ifdef VBOX_WITH_PARALLEL_PORTS 1100 sltUpdateParallelPorts();1058 << Section_Parallel 1101 1059 #endif /* VBOX_WITH_PARALLEL_PORTS */ 1102 sltUpdateUSB(); 1103 sltUpdateSharedFolders(); 1104 sltUpdateDescription(); 1105 1106 setCurrentIndex(0); 1107 } 1108 1109 void UIDetailsPagePrivate::createTextPage() 1060 << Section_USB 1061 << Section_SharedFolders 1062 << Section_Description; 1063 } 1064 else 1065 { 1066 m_sections << Section_General 1067 << Section_System 1068 << Section_Preview; 1069 } 1070 1071 /* Recreate details set: */ 1072 m_set.clear(); 1073 m_set.resize(m_cMachineCount); 1074 /* Re-create details widget: */ 1075 if (m_pDetails) 1076 delete m_pDetails; 1077 m_pDetails = new QWidget(m_pScrollArea); 1078 m_pScrollArea->setWidget(m_pDetails); 1079 /* Configure the context-menu rules, which allows to show/hide the boxes: */ 1080 m_pDetails->setContextMenuPolicy(Qt::CustomContextMenu); 1081 connect(m_pDetails, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sltContextMenuRequested(const QPoint&))); 1082 /* Configure details widget layout: */ 1083 QVBoxLayout *pMainLayout = new QVBoxLayout(m_pDetails); 1084 pMainLayout->setContentsMargins(gsLeftMargin, gsTopMargin, gsRightMargin, gsBottomMargin); 1085 1086 /* Prepare set content (blocks): */ 1087 for (int i = 0; i < m_cMachineCount; ++i) 1088 prepareBlock(i); 1089 1090 /* Layout set content: */ 1091 pMainLayout->addStretch(1); 1092 1093 retranslateUi(); 1094 } 1095 1096 void UIDetailsPagePrivate::prepareBlock(int iBlockNumber) 1097 { 1098 /* Prepare new block: */ 1099 UIDetailsBlock& block = m_set[iBlockNumber]; 1100 1101 /* Prepare block content (sections): */ 1102 for(int i = 0; i < m_sections.size(); ++i) 1103 prepareSection(block, iBlockNumber, m_sections[i]); 1104 1105 /* Layout block content: */ 1106 QVBoxLayout *pMainLayout = qobject_cast<QVBoxLayout*>(m_pDetails->layout()); 1107 QHBoxLayout *tt1 = new QHBoxLayout; 1108 QVBoxLayout *tt2 = new QVBoxLayout; 1109 if (m_sections.contains(Section_General)) 1110 tt2->addWidget(block[Section_General]); 1111 if (m_sections.contains(Section_System)) 1112 tt2->addWidget(block[Section_System]); 1113 tt2->addStretch(1); 1114 tt1->addLayout(tt2); 1115 QVBoxLayout *tt3 = new QVBoxLayout; 1116 if (m_sections.contains(Section_Preview)) 1117 tt3->addWidget(block[Section_Preview]); 1118 tt3->addStretch(1); 1119 tt1->addLayout(tt3); 1120 pMainLayout->addLayout(tt1); 1121 if (m_sections.contains(Section_Display)) 1122 pMainLayout->addWidget(block[Section_Display]); 1123 if (m_sections.contains(Section_Storage)) 1124 pMainLayout->addWidget(block[Section_Storage]); 1125 if (m_sections.contains(Section_Audio)) 1126 pMainLayout->addWidget(block[Section_Audio]); 1127 if (m_sections.contains(Section_Network)) 1128 pMainLayout->addWidget(block[Section_Network]); 1129 if (m_sections.contains(Section_Serial)) 1130 pMainLayout->addWidget(block[Section_Serial]); 1131 #ifdef VBOX_WITH_PARALLEL_PORTS 1132 if (m_sections.contains(Section_Parallel)) 1133 pMainLayout->addWidget(block[Section_Parallel]); 1134 #endif /* VBOX_WITH_PARALLEL_PORTS */ 1135 if (m_sections.contains(Section_USB)) 1136 pMainLayout->addWidget(block[Section_USB]); 1137 if (m_sections.contains(Section_SharedFolders)) 1138 pMainLayout->addWidget(block[Section_SharedFolders]); 1139 if (m_sections.contains(Section_Description)) 1140 pMainLayout->addWidget(block[Section_Description]); 1141 } 1142 1143 void UIDetailsPagePrivate::prepareSection(UIDetailsBlock &block, int iBlockNumber, Section section) 1144 { 1145 /* Prepare new section (popup box): */ 1146 UIPopupBox *pPopup = block[section] = new UIPopupBox(m_pDetails); 1147 connect(pPopup, SIGNAL(titleClicked(const QString &)), this, SIGNAL(linkClicked(const QString &))); 1148 connect(pPopup, SIGNAL(toggled(bool)), this, SLOT(sltPopupToggled(bool))); 1149 pPopup->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); 1150 pPopup->setProperty("block-number", iBlockNumber); 1151 pPopup->setProperty("section-type", static_cast<int>(section)); 1152 1153 /* Configure the popup box: */ 1154 switch (section) 1155 { 1156 case Section_General: 1157 { 1158 QILabel *pLabel = new QILabel(pPopup); 1159 pLabel->setWordWrap(true); 1160 pPopup->setTitleIcon(UIIconPool::iconSet(":/machine_16px.png")); 1161 pPopup->setTitleLink("#general"); 1162 pPopup->setContentWidget(pLabel); 1163 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateGeneral())); 1164 break; 1165 } 1166 case Section_System: 1167 { 1168 QILabel *pLabel = new QILabel(pPopup); 1169 pLabel->setWordWrap(true); 1170 pPopup->setTitleIcon(UIIconPool::iconSet(":/chipset_16px.png")); 1171 pPopup->setTitleLink("#system"); 1172 pPopup->setContentWidget(pLabel); 1173 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateSystem())); 1174 break; 1175 } 1176 case Section_Preview: 1177 { 1178 UIVMPreviewWindow *pWidget = new UIVMPreviewWindow(pPopup); 1179 pPopup->setTitleIcon(UIIconPool::iconSet(":/machine_16px.png")); 1180 pPopup->setContentWidget(pWidget); 1181 pPopup->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 1182 /* Make sure the width is always the same, regardless if the preview is shown or not: */ 1183 pPopup->setFixedWidth(pPopup->sizeHint().width()); 1184 pWidget->updateGeometry(); 1185 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdatePreview())); 1186 break; 1187 } 1188 case Section_Display: 1189 { 1190 QILabel *pLabel = new QILabel(pPopup); 1191 pLabel->setWordWrap(true); 1192 pPopup->setTitleIcon(UIIconPool::iconSet(":/vrdp_16px.png")); 1193 pPopup->setTitleLink("#display"); 1194 pPopup->setContentWidget(pLabel); 1195 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateDisplay())); 1196 break; 1197 } 1198 case Section_Storage: 1199 { 1200 QILabel *pLabel = new QILabel(pPopup); 1201 pLabel->setWordWrap(true); 1202 pPopup->setTitleIcon(UIIconPool::iconSet(":/attachment_16px.png")); 1203 pPopup->setTitleLink("#storage"); 1204 pPopup->setContentWidget(pLabel); 1205 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateStorage())); 1206 break; 1207 } 1208 case Section_Audio: 1209 { 1210 QILabel *pLabel = new QILabel(pPopup); 1211 pLabel->setWordWrap(true); 1212 pPopup->setTitleIcon(UIIconPool::iconSet(":/sound_16px.png")); 1213 pPopup->setTitleLink("#audio"); 1214 pPopup->setContentWidget(pLabel); 1215 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateAudio())); 1216 break; 1217 } 1218 case Section_Network: 1219 { 1220 QILabel *pLabel = new QILabel(pPopup); 1221 pLabel->setWordWrap(true); 1222 pPopup->setTitleIcon(UIIconPool::iconSet(":/nw_16px.png")); 1223 pPopup->setTitleLink("#network"); 1224 pPopup->setContentWidget(pLabel); 1225 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateNetwork())); 1226 break; 1227 } 1228 case Section_Serial: 1229 { 1230 QILabel *pLabel = new QILabel(pPopup); 1231 pLabel->setWordWrap(true); 1232 pPopup->setTitleIcon(UIIconPool::iconSet(":/serial_port_16px.png")); 1233 pPopup->setTitleLink("#serialPorts"); 1234 pPopup->setContentWidget(pLabel); 1235 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateSerialPorts())); 1236 break; 1237 } 1238 #ifdef VBOX_WITH_PARALLEL_PORTS 1239 case Section_Parallel: 1240 { 1241 QILabel *pLabel = new QILabel(pPopup); 1242 pLabel->setWordWrap(true); 1243 pPopup->setTitleIcon(UIIconPool::iconSet(":/parallel_port_16px.png")); 1244 pPopup->setTitleLink("#parallelPorts"); 1245 pPopup->setContentWidget(pLabel); 1246 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateParallelPorts())); 1247 break; 1248 } 1249 #endif /* VBOX_WITH_PARALLEL_PORTS */ 1250 case Section_USB: 1251 { 1252 QILabel *pLabel = new QILabel(pPopup); 1253 pLabel->setWordWrap(true); 1254 pPopup->setTitleIcon(UIIconPool::iconSet(":/usb_16px.png")); 1255 pPopup->setTitleLink("#usb"); 1256 pPopup->setContentWidget(pLabel); 1257 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateUSB())); 1258 break; 1259 } 1260 case Section_SharedFolders: 1261 { 1262 QILabel *pLabel = new QILabel(pPopup); 1263 pLabel->setWordWrap(true); 1264 pPopup->setTitleIcon(UIIconPool::iconSet(":/shared_folder_16px.png")); 1265 pPopup->setTitleLink("#sfolders"); 1266 pPopup->setContentWidget(pLabel); 1267 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateSharedFolders())); 1268 break; 1269 } 1270 case Section_Description: 1271 { 1272 QILabel *pLabel = new QILabel(pPopup); 1273 pLabel->setWordWrap(true); 1274 pPopup->setTitleIcon(UIIconPool::iconSet(":/description_16px.png")); 1275 pPopup->setTitleLink("#general%%mTeDescription"); 1276 pPopup->setContentWidget(pLabel); 1277 connect(pPopup, SIGNAL(sigUpdateContentWidget()), this, SLOT(sltUpdateDescription())); 1278 break; 1279 } 1280 default: 1281 break; 1282 } 1283 1284 /* Show/hide and open section: */ 1285 if (m_actions[section]->isChecked()) 1286 pPopup->show(); 1287 else 1288 pPopup->hide(); 1289 pPopup->setOpen(m_sectionOpened[section]); 1290 1291 /* Call for update: */ 1292 pPopup->callForUpdateContentWidget(); 1293 } 1294 1295 void UIDetailsPagePrivate::updateSet() 1296 { 1297 /* For every block of set: */ 1298 for (int i = 0; i < m_cMachineCount; ++i) 1299 { 1300 /* For every section of block: */ 1301 for (int j = 0; j < m_sections.size(); ++j) 1302 { 1303 /* Call for update: */ 1304 m_set[i][m_sections[j]]->callForUpdateContentWidget(); 1305 } 1306 } 1307 } 1308 1309 void UIDetailsPagePrivate::prepareDetails() 1310 { 1311 if (m_pScrollArea) 1312 return; 1313 1314 /* Prepare scroll area: */ 1315 m_pScrollArea = new QScrollArea(this); 1316 m_pScrollArea->setFrameStyle(QFrame::NoFrame); 1317 m_pScrollArea->setWidgetResizable(true); 1318 addWidget(m_pScrollArea); 1319 1320 /* Prepare section names: */ 1321 m_sectionNames[Section_General] = "general"; 1322 m_sectionNames[Section_System] = "system"; 1323 m_sectionNames[Section_Preview] = "preview"; 1324 m_sectionNames[Section_Display] = "display"; 1325 m_sectionNames[Section_Storage] = "storage"; 1326 m_sectionNames[Section_Audio] = "audio"; 1327 m_sectionNames[Section_Network] = "network"; 1328 m_sectionNames[Section_Serial] = "serialPorts"; 1329 #ifdef VBOX_WITH_PARALLEL_PORTS 1330 m_sectionNames[Section_Parallel] = "parallelPorts"; 1331 #endif /* VBOX_WITH_PARALLEL_PORTS */ 1332 m_sectionNames[Section_USB] = "usb"; 1333 m_sectionNames[Section_SharedFolders] = "sharedFolders"; 1334 m_sectionNames[Section_Description] = "description"; 1335 1336 /* Prepare context menu actions: */ 1337 for (int i = 0; i < Section_End; ++i) 1338 { 1339 Section section = static_cast<Section>(i); 1340 m_actions[section] = new QAction(m_pScrollArea); 1341 QAction *pAction = m_actions[section]; 1342 pAction->setData(i); 1343 pAction->setCheckable(true); 1344 } 1345 1346 /* Load section configuration from extra data: */ 1347 QStringList values = vboxGlobal().virtualBox().GetExtraDataStringList(VBoxDefs::GUI_DetailsPageBoxes, 1348 /* Default keys: */ 1349 QStringList() 1350 << m_sectionNames.value(Section_General) 1351 << m_sectionNames.value(Section_System) 1352 << m_sectionNames.value(Section_Preview) 1353 << m_sectionNames.value(Section_Display) 1354 << m_sectionNames.value(Section_Storage) 1355 << m_sectionNames.value(Section_Audio) 1356 << m_sectionNames.value(Section_Network) 1357 << m_sectionNames.value(Section_USB) 1358 << m_sectionNames.value(Section_SharedFolders) 1359 << m_sectionNames.value(Section_Description)); 1360 /* Parse loaded section configuration: */ 1361 for (int i = 0; i < values.size(); ++i) 1362 { 1363 /* Get current section setting: */ 1364 QString strSectionSetting = values[i]; 1365 1366 /* Is this section opened? */ 1367 bool fSectionOpened = !strSectionSetting.endsWith("Closed"); 1368 1369 /* Get current section: */ 1370 Section section = m_sectionNames.key(fSectionOpened ? strSectionSetting : strSectionSetting.remove("Closed"), Section_End); 1371 1372 /* Assign values: */ 1373 if (section != Section_End) 1374 { 1375 m_sectionSettings[section] = strSectionSetting; 1376 m_actions[section]->setChecked(true); 1377 m_sectionOpened[section] = fSectionOpened; 1378 } 1379 } 1380 } 1381 1382 void UIDetailsPagePrivate::cleanupDetails() 1383 { 1384 if (!m_pScrollArea) 1385 return; 1386 1387 /* Update loaded section configuration with current values: */ 1388 for (int i = 0; i < Section_End; ++i) 1389 { 1390 /* Get current section: */ 1391 Section section = static_cast<Section>(i); 1392 1393 /* Process only existing sections: */ 1394 if (!m_sections.contains(section)) 1395 continue; 1396 1397 /* Compose section key to save: */ 1398 QString strSectionSetting = !m_actions[section]->isChecked() ? QString() : 1399 m_sectionOpened[section] ? m_sectionNames[section] : 1400 m_sectionNames[section] + "Closed"; 1401 1402 /* Update corresponding setting: */ 1403 m_sectionSettings[section] = strSectionSetting; 1404 } 1405 /* Save section configuration to extra data: */ 1406 vboxGlobal().virtualBox().SetExtraDataStringList(VBoxDefs::GUI_DetailsPageBoxes, m_sectionSettings.values()); 1407 } 1408 1409 void UIDetailsPagePrivate::prepareTextPage() 1110 1410 { 1111 1411 if (m_pText) 1112 1412 return; 1113 1413 1114 /* Create normal text page */1414 /* Create normal text page: */ 1115 1415 m_pText = new QRichTextBrowser(this); 1116 1416 m_pText->setFocusPolicy(Qt::StrongFocus); 1117 1417 m_pText->document()->setDefaultStyleSheet("a { text-decoration: none; }"); 1118 /* Make "transparent" */1418 /* Make "transparent": */ 1119 1419 m_pText->setFrameShape(QFrame::NoFrame); 1120 1420 m_pText->viewport()->setAutoFillBackground(false); 1121 1421 m_pText->setOpenLinks(false); 1122 1422 1123 connect(m_pText, SIGNAL(anchorClicked(const QUrl &)), 1124 this, SLOT(gotLinkClicked(const QUrl &))); 1423 connect(m_pText, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(sltLinkClicked(const QUrl &))); 1125 1424 1126 1425 addWidget(m_pText); 1127 } 1128 1129 void UIDetailsPagePrivate::createErrPage() 1426 1427 retranslateUi(); 1428 } 1429 1430 void UIDetailsPagePrivate::prepareErrorPage() 1130 1431 { 1131 1432 if (m_pErrBox) … … 1149 1450 vLayout->addWidget(m_pErrText); 1150 1451 1151 if (m RefreshAction)1152 { 1153 m RefreshButton = new QToolButton(m_pErrBox);1154 m RefreshButton->setFocusPolicy(Qt::StrongFocus);1452 if (m_pRefreshAction) 1453 { 1454 m_pRefreshButton = new QToolButton(m_pErrBox); 1455 m_pRefreshButton->setFocusPolicy(Qt::StrongFocus); 1155 1456 1156 1457 QHBoxLayout *hLayout = new QHBoxLayout(); 1157 1458 vLayout->addLayout(hLayout); 1158 hLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, 1159 QSizePolicy::Minimum)); 1160 hLayout->addWidget(mRefreshButton); 1161 1162 connect(mRefreshButton, SIGNAL(clicked()), 1163 mRefreshAction, SIGNAL(triggered())); 1164 } 1165 1166 vLayout->addItem(new QSpacerItem(0, 0, 1167 QSizePolicy::Minimum, 1168 QSizePolicy::Expanding)); 1459 hLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); 1460 hLayout->addWidget(m_pRefreshButton); 1461 1462 connect(m_pRefreshButton, SIGNAL(clicked()), 1463 m_pRefreshAction, SIGNAL(triggered())); 1464 } 1465 1466 vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); 1169 1467 1170 1468 addWidget(m_pErrBox); … … 1432 1730 } 1433 1731 1434 void UIVMDesktop::updateDetails(UIVMItem * /* pVMItem */, const CMachine& machine)1732 void UIVMDesktop::updateDetails(UIVMItem * /* pVMItem */, const QList<CMachine> &machines) 1435 1733 { 1436 1734 // KMachineState state = pVMItem->state(); 1437 1735 // bool fRunning = pVMItem->sessionState() != KSessionState_Closed; 1438 1736 // bool fModifyEnabled = !fRunning && state != KMachineState_Saved; 1439 m_pDetails->setMachine (machine);1737 m_pDetails->setMachines(machines); 1440 1738 } 1441 1739 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.h
r32760 r39225 43 43 UIVMDesktop(UIToolBar *pToolBar, QAction *pRefreshAction, QWidget *pParent = 0); 44 44 45 void updateDetails(UIVMItem *pVMItem, const CMachine& machine);45 void updateDetails(UIVMItem *pVMItem, const QList<CMachine> &machines); 46 46 void updateDetailsText(const QString &strText); 47 47 void updateDetailsErrorText(const QString &strText); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMPreviewWindow.cpp
r38798 r39225 149 149 void UIVMPreviewWindow::paintEvent(QPaintEvent *pEvent) 150 150 { 151 /* Prepare painter: */ 151 152 QPainter painter(this); 152 /* Enable clipping */153 /* Enable clipping: */ 153 154 painter.setClipRect(pEvent->rect()); 154 /* Where should the content go */155 /* Where should the content go: */ 155 156 QRect cr = contentsRect(); 156 /* Draw the background with the monitor and the shadow */ 157 if (!cr.isValid()) 158 return; 159 /* Draw the background with the monitor and the shadow: */ 157 160 if (m_pbgImage) 158 161 painter.drawImage(cr.x(), cr.y(), *m_pbgImage); 159 // painter.setPen(Qt::red); 160 // painter.drawRect(cr.adjusted(0, 0, -1, -1)); 161 // return; 162 /* If there is a preview image available, use it. */ 162 163 /* If there is a preview image available: */ 163 164 if (m_pPreviewImg) 165 { 166 /* Draw that image: */ 164 167 painter.drawImage(0, 0, *m_pPreviewImg); 168 } 165 169 else 166 170 { 167 QString strName = tr("No Preview"); 168 if (!m_machine.isNull()) 169 strName = m_machine.GetName(); 170 171 /* Paint the name in the center of the monitor */ 171 /* Fill rectangle with black color: */ 172 172 painter.fillRect(m_vRect, Qt::black); 173 QFont font = painter.font(); 174 font.setBold(true); 175 int fFlags = Qt::AlignCenter | Qt::TextWordWrap; 176 float h = m_vRect.size().height() * .2; 177 QRect r; 178 /* Make a little magic to find out if the given text fits into 179 * our rectangle. Decrease the font pixel size as long as it 180 * doesn't fit. */ 181 int cMax = 30; 182 do 183 { 184 h = h * .8; 185 font.setPixelSize((int)h); 186 painter.setFont(font); 187 r = painter.boundingRect(m_vRect, fFlags, strName); 188 }while (( r.height() > m_vRect.height() 189 || r.width() > m_vRect.width()) 190 && cMax-- != 0); 191 painter.setPen(Qt::white); 192 painter.drawText(m_vRect, fFlags, strName); 193 } 194 /* Draw the glossy overlay last */ 173 } 174 175 /* Compose name: */ 176 QString strName = tr("No Preview"); 177 if (!m_machine.isNull()) 178 strName = m_machine.GetName(); 179 /* Paint that name: */ 180 QFont font = painter.font(); 181 font.setBold(true); 182 int fFlags = Qt::AlignCenter | Qt::TextWordWrap; 183 float h = m_vRect.size().height() * .2; 184 QRect r; 185 /* Make a little magic to find out if the given text fits into our rectangle. 186 * Decrease the font pixel size as long as it doesn't fit. */ 187 int cMax = 30; 188 do 189 { 190 h = h * .8; 191 font.setPixelSize((int)h); 192 painter.setFont(font); 193 r = painter.boundingRect(m_vRect, fFlags, strName); 194 } 195 while ((r.height() > m_vRect.height() || r.width() > m_vRect.width()) && cMax-- != 0); 196 painter.setPen(Qt::white); 197 painter.drawText(m_vRect, fFlags, strName); 198 199 /* Draw the glossy overlay last: */ 195 200 if (m_pGlossyImg) 196 201 painter.drawImage(m_vRect.x(), m_vRect.y(), *m_pGlossyImg); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp
r30904 r39225 129 129 void UIPopupBox::setOpen(bool fOpen) 130 130 { 131 /* Do not do anything if already done: */ 132 if (m_fOpen == fOpen) 133 return; 134 135 /* Store new value: */ 131 136 m_fOpen = fOpen; 137 138 /* Update content widget if present or this itself: */ 132 139 if (m_pContentWidget) 133 140 m_pContentWidget->setVisible(m_fOpen); 134 141 else 135 142 update(); 143 144 /* Notify listeners about content widget visibility: */ 145 if (m_pContentWidget && m_pContentWidget->isVisible()) 146 emit sigUpdateContentWidget(); 136 147 } 137 148 138 149 void UIPopupBox::toggleOpen() 139 150 { 151 /* Switch 'opened' state: */ 140 152 setOpen(!m_fOpen); 153 154 /* Notify listeners about toggling: */ 155 emit toggled(m_fOpen); 141 156 } 142 157 … … 239 254 { 240 255 bool fOld = m_fHeaderHover; 241 QPoint bl = mapFromGlobal(QCursor::pos());256 // QPoint bl = mapFromGlobal(QCursor::pos()); 242 257 // printf("%d %d\n", bl.x(), bl.y()); 243 258 if ( m_pLabelPath -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h
r30868 r39225 55 55 bool isOpen() const; 56 56 57 void callForUpdateContentWidget() { emit sigUpdateContentWidget(); } 58 57 59 signals: 58 void titleClicked(const QString); 60 61 void titleClicked(const QString &); 62 void toggled(bool fOpened); 63 void sigUpdateContentWidget(); 59 64 60 65 protected:
Note:
See TracChangeset
for help on using the changeset viewer.