Changeset 100933 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 22, 2023 6:12:17 AM (16 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp
r100915 r100933 40 40 #include "UIVMLogViewerWidget.h" 41 41 42 /* Other VBox includes: */ 43 #include <iprt/assert.h> 42 44 43 45 UIVMLogViewerBookmarksPanel::UIVMLogViewerBookmarksPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer) … … 108 110 void UIVMLogViewerBookmarksPanel::prepareWidgets() 109 111 { 110 Q HBoxLayout *pMainLayout = new QHBoxLayout(this);111 112 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 113 AssertReturnVoid(pMainLayout); 112 114 /* Create bookmark combo/button layout: */ 113 115 QHBoxLayout *pComboButtonLayout = new QHBoxLayout; 114 if (pComboButtonLayout)115 { 116 116 AssertReturnVoid(pComboButtonLayout); 117 118 pComboButtonLayout->setContentsMargins(0, 0, 0, 0); 117 119 #ifdef VBOX_WS_MAC 118 120 pComboButtonLayout->setSpacing(5); 119 121 #else 120 122 pComboButtonLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2); 121 123 #endif 122 124 123 /* Create bookmark combo-box: */ 124 m_pBookmarksComboBox = new QComboBox; 125 if (m_pBookmarksComboBox) 126 { 127 m_pBookmarksComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); 128 /* Make sure we have 0th item in our combo-box. */ 129 m_pBookmarksComboBox->insertItem(0, ""); 130 pComboButtonLayout->addWidget(m_pBookmarksComboBox); 131 } 132 133 /* Create bookmark button layout 1: */ 134 QHBoxLayout *pButtonLayout1 = new QHBoxLayout; 135 if (pButtonLayout1) 136 { 137 pButtonLayout1->setContentsMargins(0, 0, 0, 0); 138 pButtonLayout1->setSpacing(0); 139 140 /* Create goto selected bookmark button: */ 141 m_pGotoSelectedBookmark = new QIToolButton; 142 if (m_pGotoSelectedBookmark) 143 { 144 m_pGotoSelectedBookmark->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png")); 145 pButtonLayout1->addWidget(m_pGotoSelectedBookmark); 146 } 147 148 /* Create goto previous bookmark button: */ 149 m_pPreviousButton = new QIToolButton; 150 if (m_pPreviousButton) 151 { 152 m_pPreviousButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_previous_bookmark_16px.png")); 153 pButtonLayout1->addWidget(m_pPreviousButton); 154 } 155 156 /* Create goto next bookmark button: */ 157 m_pNextButton = new QIToolButton; 158 if (m_pNextButton) 159 { 160 m_pNextButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_next_bookmark_16px.png")); 161 pButtonLayout1->addWidget(m_pNextButton); 162 } 163 164 pComboButtonLayout->addLayout(pButtonLayout1); 165 } 166 167 /* Create bookmark button layout 2: */ 168 QHBoxLayout *pButtonLayout2 = new QHBoxLayout; 169 if (pButtonLayout2) 170 { 171 pButtonLayout2->setContentsMargins(0, 0, 0, 0); 172 pButtonLayout2->setSpacing(0); 173 174 /* Create delete current bookmark button: */ 175 m_pDeleteCurrentButton = new QIToolButton; 176 if (m_pDeleteCurrentButton) 177 { 178 m_pDeleteCurrentButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_current_bookmark_16px.png")); 179 pButtonLayout2->addWidget(m_pDeleteCurrentButton); 180 } 181 182 /* Create delete all bookmarks button: */ 183 m_pDeleteAllButton = new QIToolButton; 184 if (m_pDeleteAllButton) 185 { 186 m_pDeleteAllButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_all_bookmarks_16px.png")); 187 pButtonLayout2->addWidget(m_pDeleteAllButton); 188 } 189 190 pComboButtonLayout->addLayout(pButtonLayout2); 191 } 192 193 pMainLayout->addLayout(pComboButtonLayout); 194 } 125 /* Create bookmark combo-box: */ 126 m_pBookmarksComboBox = new QComboBox; 127 AssertReturnVoid(m_pBookmarksComboBox); 128 m_pBookmarksComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); 129 /* Make sure we have 0th item in our combo-box. */ 130 m_pBookmarksComboBox->insertItem(0, ""); 131 pComboButtonLayout->addWidget(m_pBookmarksComboBox); 132 133 /* Create bookmark button layout 1: */ 134 QHBoxLayout *pButtonLayout1 = new QHBoxLayout; 135 AssertReturnVoid(pButtonLayout1); 136 pButtonLayout1->setContentsMargins(0, 0, 0, 0); 137 pButtonLayout1->setSpacing(0); 138 139 /* Create goto selected bookmark button: */ 140 m_pGotoSelectedBookmark = new QIToolButton; 141 AssertReturnVoid(m_pGotoSelectedBookmark); 142 m_pGotoSelectedBookmark->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png")); 143 pButtonLayout1->addWidget(m_pGotoSelectedBookmark); 144 145 /* Create goto previous bookmark button: */ 146 m_pPreviousButton = new QIToolButton; 147 AssertReturnVoid(m_pPreviousButton); 148 m_pPreviousButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_previous_bookmark_16px.png")); 149 pButtonLayout1->addWidget(m_pPreviousButton); 150 151 /* Create goto next bookmark button: */ 152 m_pNextButton = new QIToolButton; 153 AssertReturnVoid(m_pNextButton); 154 m_pNextButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_next_bookmark_16px.png")); 155 pButtonLayout1->addWidget(m_pNextButton); 156 157 pComboButtonLayout->addLayout(pButtonLayout1); 158 159 /* Create bookmark button layout 2: */ 160 QHBoxLayout *pButtonLayout2 = new QHBoxLayout; 161 AssertReturnVoid(pButtonLayout2); 162 pButtonLayout2->setContentsMargins(0, 0, 0, 0); 163 pButtonLayout2->setSpacing(0); 164 165 /* Create delete current bookmark button: */ 166 m_pDeleteCurrentButton = new QIToolButton; 167 AssertReturnVoid(m_pDeleteCurrentButton); 168 m_pDeleteCurrentButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_current_bookmark_16px.png")); 169 pButtonLayout2->addWidget(m_pDeleteCurrentButton); 170 171 /* Create delete all bookmarks button: */ 172 m_pDeleteAllButton = new QIToolButton; 173 AssertReturnVoid(m_pDeleteAllButton); 174 m_pDeleteAllButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_all_bookmarks_16px.png")); 175 pButtonLayout2->addWidget(m_pDeleteAllButton); 176 pComboButtonLayout->addLayout(pButtonLayout2); 177 178 pMainLayout->addLayout(pComboButtonLayout); 179 180 pMainLayout->addStretch(1); 195 181 } 196 182 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp
r100926 r100933 38 38 #include "UIVMLogViewerSearchPanel.h" 39 39 #include "UIVMLogViewerFilterPanel.h" 40 #include "UIVMLogViewerBookmarksPanel.h" 41 40 42 #ifdef VBOX_WS_MAC 41 43 # include "VBoxUtils-darwin.h" … … 47 49 , m_pSearchWidget(0) 48 50 , m_pFilterWidget(0) 51 , m_pBookmarksWidget(0) 49 52 { 50 53 prepare(); … … 68 71 connect(m_pFilterWidget, &UIVMLogViewerFilterPanel::sigFilterApplied, 69 72 this, &UIVMLogViewerPanelNew::sigFilterApplied); 73 74 /* Bookmark tab: */ 75 m_pBookmarksWidget = new UIVMLogViewerBookmarksPanel(0, m_pViewer); 76 insertTab(Page_Bookmark, m_pBookmarksWidget); 77 78 connect(m_pBookmarksWidget, &UIVMLogViewerBookmarksPanel::sigDeleteBookmarkByIndex, 79 this, &UIVMLogViewerPanelNew::sigDeleteBookmarkByIndex); 80 connect(m_pBookmarksWidget, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks, 81 this, &UIVMLogViewerPanelNew::sigDeleteAllBookmarks); 82 connect(m_pBookmarksWidget, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected, 83 this, &UIVMLogViewerPanelNew::sigBookmarkSelected); 70 84 71 85 retranslateUi(); … … 98 112 } 99 113 114 void UIVMLogViewerPanelNew::updateBookmarkList(const QVector<UIVMLogBookmark>& bookmarkList) 115 { 116 if (m_pBookmarksWidget) 117 m_pBookmarksWidget->updateBookmarkList(bookmarkList); 118 } 119 120 void UIVMLogViewerPanelNew::disableEnableBookmarking(bool flag) 121 { 122 if (m_pBookmarksWidget) 123 m_pBookmarksWidget->disableEnableBookmarking(flag); 124 } 125 100 126 void UIVMLogViewerPanelNew::retranslateUi() 101 127 { 102 128 setTabText(Page_Search, "Find"); 103 129 setTabText(Page_Filter, "Filter"); 130 setTabText(Page_Bookmark, "Bookmarks"); 104 131 } 105 132 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h
r100921 r100933 34 34 /* GUI includes: */ 35 35 #include "UIDialogPanel.h" 36 #include "UIVMLogBookmark.h" 36 37 37 38 /* Forward declarations: */ … … 41 42 class UIVMLogViewerSearchPanel; 42 43 class UIVMLogViewerFilterPanel; 44 class UIVMLogViewerBookmarksPanel; 43 45 44 46 class UIVMLogViewerPanelNew : public QIWithRetranslateUI<UIDialogPanelBase> … … 51 53 void sigSearchUpdated(); 52 54 void sigFilterApplied(); 55 void sigDeleteBookmarkByIndex(int bookmarkIndex); 56 void sigDeleteAllBookmarks(); 57 void sigBookmarkSelected(int index); 53 58 54 59 public: … … 69 74 /** @} */ 70 75 76 /** @name Bookmark page pass through functions 77 * @{ */ 78 void updateBookmarkList(const QVector<UIVMLogBookmark>& bookmarkList); 79 void disableEnableBookmarking(bool flag); 80 /** @} */ 71 81 72 82 enum Page … … 92 102 UIVMLogViewerSearchPanel *m_pSearchWidget; 93 103 UIVMLogViewerFilterPanel *m_pFilterWidget; 104 UIVMLogViewerBookmarksPanel *m_pBookmarksWidget; 94 105 }; 95 106 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r100921 r100933 212 212 , m_fIsPolished(false) 213 213 , m_pTabWidget(0) 214 , m_pBookmarksPanel(0)215 214 , m_pOptionsPanel(0) 216 215 , m_pMainLayout(0) … … 495 494 return; 496 495 pLogPage->deleteBookmarkByIndex(index); 497 if (m_p BookmarksPanel)498 m_p BookmarksPanel->updateBookmarkList(pLogPage->bookmarkList());496 if (m_pPanel) 497 m_pPanel->updateBookmarkList(pLogPage->bookmarkList()); 499 498 } 500 499 … … 506 505 pLogPage->deleteAllBookmarks(); 507 506 508 if (m_p BookmarksPanel)509 m_p BookmarksPanel->updateBookmarkList(pLogPage->bookmarkList());507 if (m_pPanel) 508 m_pPanel->updateBookmarkList(pLogPage->bookmarkList()); 510 509 } 511 510 512 511 void UIVMLogViewerWidget::sltUpdateBookmarkPanel() 513 512 { 514 if (!currentLogPage() || !m_p BookmarksPanel)515 return; 516 m_p BookmarksPanel->updateBookmarkList(currentLogPage()->bookmarkList());513 if (!currentLogPage() || !m_pPanel) 514 return; 515 m_pPanel->updateBookmarkList(currentLogPage()->bookmarkList()); 517 516 } 518 517 … … 555 554 556 555 /* We keep a separate QVector<LogBookmark> for each log page: */ 557 if (m_p BookmarksPanel && currentLogPage())558 m_p BookmarksPanel->updateBookmarkList(currentLogPage()->bookmarkList());556 if (m_pPanel && currentLogPage()) 557 m_pPanel->updateBookmarkList(currentLogPage()->bookmarkList()); 559 558 560 559 m_pPreviousLogPage = currentLogPage(); … … 574 573 /* Disable bookmark panel since bookmarks are stored as line numbers within 575 574 the original log text and does not mean much in a reduced/filtered one. */ 576 if (m_p BookmarksPanel)577 m_p BookmarksPanel->disableEnableBookmarking(!isFiltered);575 if (m_pPanel) 576 m_pPanel->disableEnableBookmarking(!isFiltered); 578 577 } 579 578 … … 768 767 769 768 /* Create VM Log-Viewer bookmarks-panel: */ 770 m_pBookmarksPanel = new UIVMLogViewerBookmarksPanel(0, this);771 if (m_pBookmarksPanel)772 {773 /* Configure panel: */774 m_pBookmarksPanel->hide();775 connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigDeleteBookmarkByIndex,776 this, &UIVMLogViewerWidget::sltDeleteBookmarkByIndex);777 connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks,778 this, &UIVMLogViewerWidget::sltDeleteAllBookmarks);779 connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected,780 this, &UIVMLogViewerWidget::gotoBookmark);781 /* Add into layout: */782 m_pMainLayout->addWidget(m_pBookmarksPanel);783 }769 // m_pBookmarksPanel = new UIVMLogViewerBookmarksPanel(0, this); 770 // if (m_pBookmarksPanel) 771 // { 772 // /* Configure panel: */ 773 // m_pBookmarksPanel->hide(); 774 // connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigDeleteBookmarkByIndex, 775 // this, &UIVMLogViewerWidget::sltDeleteBookmarkByIndex); 776 // connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks, 777 // this, &UIVMLogViewerWidget::sltDeleteAllBookmarks); 778 // connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected, 779 // this, &UIVMLogViewerWidget::gotoBookmark); 780 // /* Add into layout: */ 781 // m_pMainLayout->addWidget(m_pBookmarksPanel); 782 // } 784 783 785 784 /* Create VM Log-Viewer options-panel: */ … … 811 810 connect(m_pPanel, &UIVMLogViewerPanelNew::sigFilterApplied, 812 811 this, &UIVMLogViewerWidget::sltFilterApplied); 812 connect(m_pPanel, &UIVMLogViewerPanelNew::sigDeleteBookmarkByIndex, 813 this, &UIVMLogViewerWidget::sltDeleteBookmarkByIndex); 814 connect(m_pPanel, &UIVMLogViewerPanelNew::sigDeleteAllBookmarks, 815 this, &UIVMLogViewerWidget::sltDeleteAllBookmarks); 816 connect(m_pPanel, &UIVMLogViewerPanelNew::sigBookmarkSelected, 817 this, &UIVMLogViewerWidget::gotoBookmark); 813 818 814 819 m_pMainLayout->addWidget(m_pPanel); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r100921 r100933 227 227 /** @name Panel instances and a QMap for mapping panel instances to related actions. 228 228 * @{ */ 229 UIVMLogViewerBookmarksPanel *m_pBookmarksPanel;230 229 UIVMLogViewerOptionsPanel *m_pOptionsPanel; 231 230 QList<UIDialogPanel*> m_visiblePanelsList;
Note:
See TracChangeset
for help on using the changeset viewer.