- Timestamp:
- Jan 10, 2018 2:27:17 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp
r70500 r70519 120 120 if (pFocus && pFocus->parent() == this) 121 121 focusNextPrevChild(true); 122 if(m_pViewer) 123 m_pViewer->hidePanel(this); 122 124 123 125 QWidget::hideEvent(pEvent); 124 emit sigHide();125 126 } -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h
r70500 r70519 40 40 { 41 41 Q_OBJECT; 42 43 signals:44 45 void sigHide();46 42 47 43 public: -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp
r70500 r70519 336 336 m_pNextPrevButtons->setToolTip(1, UIVMLogViewerWidget::tr("Search for the next occurrence of the string")); 337 337 338 m_pCaseSensitiveCheckBox->setText(UIVMLogViewerWidget::tr("C&ase \nSensitive"));338 m_pCaseSensitiveCheckBox->setText(UIVMLogViewerWidget::tr("C&ase Sensitive")); 339 339 m_pCaseSensitiveCheckBox->setToolTip(UIVMLogViewerWidget::tr("Perform case sensitive search (when checked)")); 340 340 341 m_pMatchWholeWordCheckBox->setText(UIVMLogViewerWidget::tr("Ma&tch \nWhole Word"));341 m_pMatchWholeWordCheckBox->setText(UIVMLogViewerWidget::tr("Ma&tch Whole Word")); 342 342 m_pMatchWholeWordCheckBox->setToolTip(UIVMLogViewerWidget::tr("Search matches only complete words when checked")); 343 343 344 m_pHighlightAllCheckBox->setText(UIVMLogViewerWidget::tr("&Highlight \nAll"));344 m_pHighlightAllCheckBox->setText(UIVMLogViewerWidget::tr("&Highlight All")); 345 345 m_pHighlightAllCheckBox->setToolTip(UIVMLogViewerWidget::tr("All occurence of the search text are highlighted")); 346 346 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r70505 r70519 181 181 QString m_logFileName; 182 182 }; 183 183 184 184 185 UIVMLogViewerWidget::UIVMLogViewerWidget(EmbedTo enmEmbedding, QWidget *pParent /* = 0 */, const CMachine &machine /* = CMachine() */) … … 238 239 void UIVMLogViewerWidget::sltPanelActionTriggered(bool checked) 239 240 { 240 RT_NOREF(checked);241 242 241 QAction *pSenderAction = qobject_cast<QAction*>(sender()); 243 242 if(!pSenderAction) 244 243 return; 244 UIVMLogViewerPanel* pPanel = 0; 245 245 /* Look for the sender() within the m_panelActionMap's values: */ 246 for(QMap<UIVMLogViewerPanel* *, QAction**>::const_iterator iterator = m_panelActionMap.begin();246 for(QMap<UIVMLogViewerPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin(); 247 247 iterator != m_panelActionMap.end(); ++iterator) 248 248 { 249 if(iterator.value() == &pSenderAction) 250 continue; 251 } 249 if(iterator.value() == pSenderAction) 250 pPanel = iterator.key(); 251 } 252 if(!pPanel) 253 return; 254 if(checked) 255 showPanel(pPanel); 256 else 257 hidePanel(pPanel); 252 258 } 253 259 … … 452 458 m_pMainLayout = new QVBoxLayout(this); 453 459 460 /* Prepare widgets: */ 461 prepareWidgets(); 462 463 454 464 prepareActions(); 455 465 … … 457 467 prepareMenu(); 458 468 459 /* Prepare widgets: */460 prepareWidgets();461 462 469 /* Reading log files: */ 463 470 sltRefresh(); … … 465 472 /* Loading language constants: */ 466 473 retranslateUi(); 474 475 m_panelActionMap.insert(m_pBookmarksPanel, m_pActionBookmark); 476 m_panelActionMap.insert(m_pSearchPanel, m_pActionFind); 477 m_panelActionMap.insert(m_pFilterPanel, m_pActionFilter); 467 478 } 468 479 … … 515 526 AssertPtrReturnVoid(m_pBookmarksPanel); 516 527 { 517 //QMap<UIVMLogViewerPanel*&, QAction*&> m_panelActionMap;518 m_panelActionMap.insert(reinterpret_cast<UIVMLogViewerPanel**>(&m_pBookmarksPanel), &m_pActionBookmark);519 //connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigHide, this, &UIVMLogViewerWidget::sltHidePanel);520 528 installEventFilter(m_pBookmarksPanel); 521 529 m_pBookmarksPanel->hide(); 522 530 m_pMainLayout->insertWidget(4, m_pBookmarksPanel); 523 531 } 532 524 533 } 525 534 … … 532 541 m_pActionFind->setShortcut(QKeySequence("Ctrl+F")); 533 542 m_pActionFind->setCheckable(true); 534 connect(m_pActionFind, &QAction::triggered, this, &UIVMLogViewerWidget::slt ShowHideSearchPanel);543 connect(m_pActionFind, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionTriggered); 535 544 } 536 545 … … 541 550 m_pActionFilter->setShortcut(QKeySequence("Ctrl+T")); 542 551 m_pActionFilter->setCheckable(true); 543 connect(m_pActionFilter, &QAction::triggered, this, &UIVMLogViewerWidget::sltShowHideFilterPanel); 552 connect(m_pActionFilter, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionTriggered); 553 } 554 /* Create and configure 'Bookmark' action: */ 555 m_pActionBookmark = new QAction(this); 556 AssertPtrReturnVoid(m_pActionBookmark); 557 { 558 /* tie Ctrl+D to save only if we show this in a dialog since Ctrl+D is 559 already assigned to another action in the selector UI: */ 560 if (m_enmEmbedding == EmbedTo_Dialog) 561 m_pActionBookmark->setShortcut(QKeySequence("Ctrl+D")); 562 m_pActionBookmark->setCheckable(true); 563 connect(m_pActionBookmark, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionTriggered); 544 564 } 545 565 … … 562 582 connect(m_pActionSave, &QAction::triggered, this, &UIVMLogViewerWidget::sltSave); 563 583 } 564 565 /* Create and configure 'Bookmark' action: */566 m_pActionBookmark = new QAction(this);567 AssertPtrReturnVoid(m_pActionBookmark);568 {569 /* tie Ctrl+D to save only if we show this in a dialog since Ctrl+D is570 already assigned to another action in the selector UI: */571 if (m_enmEmbedding == EmbedTo_Dialog)572 m_pActionBookmark->setShortcut(QKeySequence("Ctrl+D"));573 m_pActionBookmark->setCheckable(true);574 connect(m_pActionBookmark, &QAction::triggered, this, &UIVMLogViewerWidget::sltShowHideBookmarkPanel);575 }576 584 577 585 /* Update action icons: */ … … 829 837 void UIVMLogViewerWidget::hidePanel(UIVMLogViewerPanel* panel) 830 838 { 831 if (!panel || panel->isHidden()) 832 return; 833 panel->setVisible(false); 839 if (panel && panel->isVisible()) 840 panel->setVisible(false); 841 QMap<UIVMLogViewerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel); 842 if(iterator != m_panelActionMap.end()) 843 { 844 if(iterator.value()->isChecked()) 845 iterator.value()->setChecked(false); 846 } 834 847 } 835 848 836 849 void UIVMLogViewerWidget::showPanel(UIVMLogViewerPanel* panel) 837 850 { 838 if (!panel || panel->isVisible()) 839 return; 840 panel->setVisible(true); 851 if (panel && panel->isHidden()) 852 panel->setVisible(true); 853 QMap<UIVMLogViewerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel); 854 if(iterator != m_panelActionMap.end()) 855 { 856 if(!iterator.value()->isChecked()) 857 iterator.value()->setChecked(true); 858 } 841 859 } 842 860 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r70500 r70519 174 174 UIVMLogViewerFilterPanel *m_pFilterPanel; 175 175 UIVMLogViewerBookmarksPanel *m_pBookmarksPanel; 176 QMap<UIVMLogViewerPanel* *, QAction**> m_panelActionMap;176 QMap<UIVMLogViewerPanel*, QAction*> m_panelActionMap; 177 177 178 178 /** Holds the list of log file content. */ … … 207 207 friend class UIVMLogViewerFilterPanel; 208 208 friend class UIVMLogViewerSearchPanel; 209 friend class UIVMLogViewerPanel; 209 210 }; 210 211
Note:
See TracChangeset
for help on using the changeset viewer.