Changeset 70664 in vbox
- Timestamp:
- Jan 22, 2018 7:09:07 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp
r70617 r70664 100 100 m_pBookmarksComboBox = new QComboBox(this); 101 101 QFontMetrics fontMetrics = m_pBookmarksComboBox->fontMetrics(); 102 AssertPtrReturnVoid(m_pBookmarksComboBox); 103 m_pBookmarksComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 104 m_pBookmarksComboBox->setMaximumWidth(fontMetrics.width('a') * (m_iMaxBookmarkTextLength + 2)); 105 /* Make sure we have 0th item in our combo box. */ 106 m_pBookmarksComboBox->insertItem(0, ""); 107 mainLayout()->addWidget(m_pBookmarksComboBox, 2); 102 if (m_pBookmarksComboBox) 103 { 104 m_pBookmarksComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 105 m_pBookmarksComboBox->setMaximumWidth(fontMetrics.width('a') * (m_iMaxBookmarkTextLength + 2)); 106 /* Make sure we have 0th item in our combo box. */ 107 m_pBookmarksComboBox->insertItem(0, ""); 108 mainLayout()->addWidget(m_pBookmarksComboBox, 2); 109 } 108 110 109 111 m_pGotoSelectedBookmark = new QIToolButton(this); 110 AssertPtrReturnVoid(m_pGotoSelectedBookmark); 111 mainLayout()->addWidget(m_pGotoSelectedBookmark, 0); 112 m_pGotoSelectedBookmark->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this)); 113 112 if (m_pGotoSelectedBookmark) 113 { 114 mainLayout()->addWidget(m_pGotoSelectedBookmark, 0); 115 m_pGotoSelectedBookmark->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this)); 116 } 114 117 115 118 m_pNextPrevButtons = new UIRoundRectSegmentedButton(this, 2); 116 AssertPtrReturnVoid(m_pNextPrevButtons); 117 m_pNextPrevButtons->setEnabled(0, false); 118 m_pNextPrevButtons->setEnabled(1, false); 119 if (m_pNextPrevButtons) 120 { 121 m_pNextPrevButtons->setEnabled(0, false); 122 m_pNextPrevButtons->setEnabled(1, false); 119 123 #ifndef VBOX_WS_MAC 120 /* No icons on the Mac: */121 m_pNextPrevButtons->setIcon(0, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack, this));122 m_pNextPrevButtons->setIcon(1, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this));124 /* No icons on the Mac: */ 125 m_pNextPrevButtons->setIcon(0, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack, this)); 126 m_pNextPrevButtons->setIcon(1, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this)); 123 127 #endif /* !VBOX_WS_MAC */ 124 mainLayout()->addWidget(m_pNextPrevButtons); 125 m_pNextPrevButtons->setEnabled(0, true); 126 m_pNextPrevButtons->setEnabled(1, true); 128 mainLayout()->addWidget(m_pNextPrevButtons); 129 m_pNextPrevButtons->setEnabled(0, true); 130 m_pNextPrevButtons->setEnabled(1, true); 131 } 127 132 128 133 m_pDeleteCurrentButton = new QIToolButton(this); 129 AssertPtrReturnVoid(m_pDeleteCurrentButton); 130 mainLayout()->addWidget(m_pDeleteCurrentButton, 0); 131 m_pDeleteCurrentButton->setIcon(m_pDeleteCurrentButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); 134 if (m_pDeleteCurrentButton) 135 { 136 mainLayout()->addWidget(m_pDeleteCurrentButton, 0); 137 m_pDeleteCurrentButton->setIcon(m_pDeleteCurrentButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); 138 } 132 139 133 140 m_pDeleteAllButton = new QIToolButton(this); 134 AssertPtrReturnVoid(m_pDeleteAllButton); 135 mainLayout()->addWidget(m_pDeleteAllButton, 0); 141 if (m_pDeleteAllButton) 142 { 143 mainLayout()->addWidget(m_pDeleteAllButton, 0); 144 } 136 145 137 146 mainLayout()->addStretch(4); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp
r70610 r70664 76 76 /* Create widget: */ 77 77 UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, this, m_comMachine); 78 AssertPtrReturnVoid(pWidget);78 if (pWidget) 79 79 { 80 80 /* Configure widget: */ -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp
r70663 r70664 157 157 { 158 158 m_pRemoveTermButton = new QToolButton(this); 159 AssertReturnVoid(m_pRemoveTermButton); 160 m_pRemoveTermButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); 161 m_pRemoveTermButton->hide(); 159 if (m_pRemoveTermButton) 160 { 161 m_pRemoveTermButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); 162 m_pRemoveTermButton->hide(); 163 connect(m_pRemoveTermButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltRemoveFilterTerm); 164 } 162 165 163 166 m_pClearAllButton = new QToolButton(this); 164 AssertReturnVoid(m_pClearAllButton);165 m_pClearAllButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_LineEditClearButton));166 167 connect(m_pRemoveTermButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltRemoveFilterTerm);168 connect(m_pClearAllButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltClearAll);167 if (m_pClearAllButton) 168 { 169 m_pClearAllButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_LineEditClearButton)); 170 connect(m_pClearAllButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltClearAll); 171 } 169 172 } 170 173 … … 356 359 357 360 m_pFilterComboBox = new QComboBox(this); 358 AssertPtrReturnVoid(m_pFilterComboBox);361 if (m_pFilterComboBox) 359 362 { 360 363 m_pFilterComboBox->setEditable(true); … … 368 371 369 372 m_pAddFilterTermButton = new QIToolButton(this); 370 AssertPtrReturnVoid(m_pAddFilterTermButton);373 if (m_pAddFilterTermButton) 371 374 { 372 375 m_pAddFilterTermButton->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this)); … … 375 378 376 379 m_pFilterTermsLineEdit = new UIVMFilterLineEdit(this); 377 AssertPtrReturnVoid(m_pFilterTermsLineEdit);380 if (m_pFilterTermsLineEdit) 378 381 { 379 382 mainLayout()->addWidget(m_pFilterTermsLineEdit, 4); … … 382 385 383 386 m_pResultLabel = new QLabel(this); 384 AssertPtrReturnVoid(m_pResultLabel);387 if (m_pResultLabel) 385 388 { 386 389 mainLayout()->addWidget(m_pResultLabel,0); … … 388 391 /* Create filter-label: */ 389 392 // m_pFilterLabel = new QLabel(this); 390 // AssertPtrReturnVoid(m_pFilterLabel);393 // if (m_pFilterLabel) 391 394 // { 392 395 // /* Configure filter-label: */ … … 406 409 /* Create radio-button container: */ 407 410 m_pRadioButtonContainer = new QFrame; 408 AssertPtrReturnVoid(m_pRadioButtonContainer);411 if (m_pRadioButtonContainer) 409 412 { 410 413 /* Configure container: */ … … 413 416 /* Create container layout: */ 414 417 QHBoxLayout *pContainerLayout = new QHBoxLayout(m_pRadioButtonContainer); 415 AssertPtrReturnVoid(pContainerLayout);418 if (pContainerLayout) 416 419 { 417 420 /* Configure layout: */ … … 427 430 /* Create button-group: */ 428 431 m_pButtonGroup = new QButtonGroup(this); 429 AssertPtrReturnVoid(m_pButtonGroup);432 if (m_pButtonGroup) 430 433 { 431 434 /* Create 'Or' radio-button: */ 432 435 m_pOrRadioButton = new QRadioButton; 433 AssertPtrReturnVoid(m_pOrRadioButton);436 if (m_pOrRadioButton) 434 437 { 435 438 /* Configure radio-button: */ … … 444 447 /* Create 'And' radio-button: */ 445 448 m_pAndRadioButton = new QRadioButton; 446 AssertPtrReturnVoid(m_pAndRadioButton);449 if (m_pAndRadioButton) 447 450 { 448 451 /* Configure radio-button: */ -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.h
r70645 r70664 66 66 virtual void prepareConnections() /* override */; 67 67 68 /** Handles the translation event. */69 68 void retranslateUi() /* override */; 70 69 /** Handles Qt @a pEvent, used for keyboard processing. */ 71 70 bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */; 72 /** Handles the Qt show @a pEvent. */73 71 void showEvent(QShowEvent *pEvent) /* override */; 74 72 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp
r70539 r70664 74 74 { 75 75 m_pMainLayout = new QHBoxLayout(this); 76 AssertPtrReturnVoid(m_pMainLayout); 77 m_pMainLayout->setContentsMargins(0, 0, 0, 0); 78 m_pMainLayout->setSpacing(2); 79 76 if (m_pMainLayout) 77 { 78 m_pMainLayout->setContentsMargins(0, 0, 0, 0); 79 m_pMainLayout->setSpacing(2); 80 } 80 81 m_pCloseButton = new UIMiniCancelButton(this); 81 AssertPtrReturnVoid(m_pCloseButton); 82 m_pMainLayout->addWidget(m_pCloseButton, 0, Qt::AlignLeft); 82 if (m_pCloseButton) 83 { 84 m_pMainLayout->addWidget(m_pCloseButton, 0, Qt::AlignLeft); 85 } 83 86 } 84 87 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp
r70645 r70664 185 185 /* Create search-editor: */ 186 186 m_pSearchEditor = new UISearchField(this); 187 AssertPtrReturnVoid(m_pSearchEditor);187 if (m_pSearchEditor) 188 188 { 189 189 /* Configure search-editor: */ … … 195 195 /* Create search-label: */ 196 196 m_pSearchLabel = new QLabel(this); 197 AssertPtrReturnVoid(m_pSearchLabel);197 if (m_pSearchLabel) 198 198 { 199 199 /* Configure search-label: */ … … 211 211 /* Create Next/Prev button-box: */ 212 212 m_pNextPrevButtons = new UIRoundRectSegmentedButton(this, 2); 213 AssertPtrReturnVoid(m_pNextPrevButtons);213 if (m_pNextPrevButtons) 214 214 { 215 215 /* Configure Next/Prev button-box: */ … … 227 227 /* Create case-sensitive checkbox: */ 228 228 m_pCaseSensitiveCheckBox = new QCheckBox; 229 AssertPtrReturnVoid(m_pCaseSensitiveCheckBox);229 if (m_pCaseSensitiveCheckBox) 230 230 { 231 231 /* Configure font: */ … … 240 240 241 241 m_pMatchWholeWordCheckBox = new QCheckBox(this); 242 AssertPtrReturnVoid(m_pMatchWholeWordCheckBox);242 if (m_pMatchWholeWordCheckBox) 243 243 { 244 244 /* Configure focus for case-sensitive checkbox: */ … … 254 254 255 255 m_pHighlightAllCheckBox = new QCheckBox(this); 256 AssertPtrReturnVoid(m_pHighlightAllCheckBox);256 if (m_pHighlightAllCheckBox) 257 257 { 258 258 /* Configure font: */ … … 268 268 /* Create warning-icon: */ 269 269 m_pWarningIcon = new QLabel(this); 270 AssertPtrReturnVoid(m_pWarningIcon);270 if (m_pWarningIcon) 271 271 { 272 272 /* Confifure warning-icon: */ … … 281 281 /* Create warning-label: */ 282 282 m_pInfoLabel = new QLabel(this); 283 AssertPtrReturnVoid(m_pInfoLabel);283 if (m_pInfoLabel) 284 284 { 285 285 /* Configure warning-label: */ -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h
r70581 r70664 56 56 protected: 57 57 58 59 /** Prepares widgets. */60 58 virtual void prepareWidgets() /* override */; 61 59 virtual void prepareConnections() /* override */; 62 /** Handles translation event. */63 60 virtual void retranslateUi() /* override */; 64 61 /** Handles Qt key-press @a pEevent. */ … … 66 63 /** Handles Qt @a pEvent, used for keyboard processing. */ 67 64 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */; 68 /** Handles Qt show @a pEvent. */69 65 virtual void showEvent(QShowEvent *pEvent) /* override */; 70 66 virtual void hideEvent(QHideEvent* pEvent) /* override */; … … 86 82 enum SearchDirection { ForwardSearch, BackwardSearch }; 87 83 88 /** Clear the result of highlight*/84 /** Clear the highlighting */ 89 85 void clearHighlight(); 90 86 void clearHighlighting(int count); … … 105 101 /** Constructs the find flags for QTextDocument::find function. */ 106 102 QTextDocument::FindFlags constructFindFlags(SearchDirection eDirection); 107 108 103 109 104 /** Holds the instance of search-label we create. */ … … 130 125 n > 0: n matches found. */ 131 126 int m_iMatchCount; 132 /** Stores relative positions of the lines of the matches. The values are [0,1] 0 being the first line 1 being the last. */ 127 /** Stores relative positions of the lines of the matches. The values are [0,1] 128 0 being the first line 1 being the last. */ 133 129 QVector<float> m_matchLocationVector; 134 130 }; -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r70663 r70664 385 385 /* Create VM Log-Viewer container: */ 386 386 m_pTabWidget = new QITabWidget(this); 387 AssertPtrReturnVoid(m_pTabWidget);387 if (m_pTabWidget) 388 388 { 389 389 /* Add VM Log-Viewer container to main-layout: */ … … 393 393 /* Create VM Log-Viewer search-panel: */ 394 394 m_pSearchPanel = new UIVMLogViewerSearchPanel(this, this); 395 AssertPtrReturnVoid(m_pSearchPanel);395 if (m_pSearchPanel) 396 396 { 397 397 /* Configure VM Log-Viewer search-panel: */ … … 406 406 /* Create VM Log-Viewer filter-panel: */ 407 407 m_pFilterPanel = new UIVMLogViewerFilterPanel(this, this); 408 AssertPtrReturnVoid(m_pFilterPanel);408 if (m_pFilterPanel) 409 409 { 410 410 /* Configure VM Log-Viewer filter-panel: */ … … 418 418 419 419 m_pBookmarksPanel = new UIVMLogViewerBookmarksPanel(this, this); 420 AssertPtrReturnVoid(m_pBookmarksPanel);420 if (m_pBookmarksPanel) 421 421 { 422 422 installEventFilter(m_pBookmarksPanel); … … 432 432 433 433 m_pSettingsPanel = new UIVMLogViewerSettingsPanel(this, this); 434 AssertPtrReturnVoid(m_pSettingsPanel);434 if (m_pSettingsPanel) 435 435 { 436 436 installEventFilter(m_pSettingsPanel); 437 437 m_pSettingsPanel->hide(); 438 /* Initialize settings' panel checkboxes : */438 /* Initialize settings' panel checkboxes and input fields: */ 439 439 m_pSettingsPanel->setShowLineNumbers(m_bShowLineNumbers); 440 440 m_pSettingsPanel->setWrapLines(m_bWrapLines); … … 452 452 /* Create and configure 'Find' action: */ 453 453 m_pActionFind = new QAction(this); 454 AssertPtrReturnVoid(m_pActionFind);454 if (m_pActionFind) 455 455 { 456 456 m_pActionFind->setShortcut(QKeySequence("Ctrl+F")); … … 461 461 /* Create and configure 'Filter' action: */ 462 462 m_pActionFilter = new QAction(this); 463 AssertPtrReturnVoid(m_pActionFilter);463 if (m_pActionFilter) 464 464 { 465 465 m_pActionFilter->setShortcut(QKeySequence("Ctrl+T")); … … 469 469 /* Create and configure 'Bookmark' action: */ 470 470 m_pActionBookmark = new QAction(this); 471 AssertPtrReturnVoid(m_pActionBookmark);471 if (m_pActionBookmark) 472 472 { 473 473 /* tie Ctrl+D to save only if we show this in a dialog since Ctrl+D is … … 481 481 /* Create and configure 'Settings' action: */ 482 482 m_pActionSettings = new QAction(this); 483 AssertPtrReturnVoid(m_pActionSettings);483 if (m_pActionSettings) 484 484 { 485 485 m_pActionSettings->setCheckable(true); … … 490 490 /* Create and configure 'Refresh' action: */ 491 491 m_pActionRefresh = new QAction(this); 492 AssertPtrReturnVoid(m_pActionRefresh);492 if (m_pActionRefresh) 493 493 { 494 494 m_pActionRefresh->setShortcut(QKeySequence("F5")); … … 498 498 /* Create and configure 'Save' action: */ 499 499 m_pActionSave = new QAction(this); 500 AssertPtrReturnVoid(m_pActionSave);500 if (m_pActionSave) 501 501 { 502 502 /* tie Ctrl+S to save only if we show this in a dialog since Ctrl+S is … … 546 546 /* Create toolbar: */ 547 547 m_pToolBar = new UIToolBar(parentWidget()); 548 AssertPtrReturnVoid(m_pToolBar);548 if (m_pToolBar) 549 549 { 550 550 /* Configure toolbar: */ … … 589 589 /* Create 'LogViewer' menu: */ 590 590 m_pMenu = new QMenu(this); 591 AssertPtrReturnVoid(m_pMenu);591 if (m_pMenu) 592 592 { 593 593 if (m_pActionFind) … … 834 834 void UIVMLogViewerWidget::createLogPage(const QString &strFileName, const QString &strLogContent, bool noLogsToShow /* = false */) 835 835 { 836 AssertPtrReturnVoid(m_pTabWidget); 836 if (!m_pTabWidget) 837 return; 837 838 838 839 /* Create page-container: */ 839 840 UIVMLogPage* pLogPage = new UIVMLogPage(this); 840 AssertPtrReturnVoid(pLogPage); 841 842 connect(pLogPage, &UIVMLogPage::sigBookmarksUpdated, this, &UIVMLogViewerWidget::sltUpdateBookmarkPanel); 843 connect(pLogPage, &UIVMLogPage::sigLogPageFilteredChanged, this, &UIVMLogViewerWidget::sltLogPageFilteredChanged); 844 /* Initialize setting for this log page */ 845 pLogPage->setShowLineNumbers(m_bShowLineNumbers); 846 pLogPage->setWrapLines(m_bWrapLines); 847 pLogPage->setFontSizeInPoints(m_iFontSizeInPoints); 848 849 /* Set the file name only if we really have log file to read. */ 850 if (!noLogsToShow) 851 pLogPage->setFileName(strFileName); 852 853 /* Add page-container to viewer-container: */ 854 int tabIndex = m_pTabWidget->insertTab(m_pTabWidget->count(), pLogPage, QFileInfo(strFileName).fileName()); 855 856 pLogPage->setTabIndex(tabIndex); 857 m_logPageList.resize(m_pTabWidget->count()); 858 m_logPageList[tabIndex] = pLogPage; 859 860 /* Set the log string of the UIVMLogPage: */ 861 pLogPage->setLogString(strLogContent); 862 /* Set text edit since we want to display this text: */ 863 if (!noLogsToShow) 864 pLogPage->setTextEditText(strLogContent); 865 /* In case there are some errors append the error text as html: */ 866 else 867 { 868 pLogPage->setTextEditTextAsHtml(strLogContent); 869 pLogPage->markForError(); 841 if (pLogPage) 842 { 843 connect(pLogPage, &UIVMLogPage::sigBookmarksUpdated, this, &UIVMLogViewerWidget::sltUpdateBookmarkPanel); 844 connect(pLogPage, &UIVMLogPage::sigLogPageFilteredChanged, this, &UIVMLogViewerWidget::sltLogPageFilteredChanged); 845 /* Initialize setting for this log page */ 846 pLogPage->setShowLineNumbers(m_bShowLineNumbers); 847 pLogPage->setWrapLines(m_bWrapLines); 848 pLogPage->setFontSizeInPoints(m_iFontSizeInPoints); 849 850 /* Set the file name only if we really have log file to read. */ 851 if (!noLogsToShow) 852 pLogPage->setFileName(strFileName); 853 854 /* Add page-container to viewer-container: */ 855 int tabIndex = m_pTabWidget->insertTab(m_pTabWidget->count(), pLogPage, QFileInfo(strFileName).fileName()); 856 857 pLogPage->setTabIndex(tabIndex); 858 m_logPageList.resize(m_pTabWidget->count()); 859 m_logPageList[tabIndex] = pLogPage; 860 861 /* Set the log string of the UIVMLogPage: */ 862 pLogPage->setLogString(strLogContent); 863 /* Set text edit since we want to display this text: */ 864 if (!noLogsToShow) 865 pLogPage->setTextEditText(strLogContent); 866 /* In case there are some errors append the error text as html: */ 867 else 868 { 869 pLogPage->setTextEditTextAsHtml(strLogContent); 870 pLogPage->markForError(); 871 } 870 872 } 871 873 }
Note:
See TracChangeset
for help on using the changeset viewer.