Changeset 71683 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 5, 2018 1:07:14 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.cpp
r71638 r71683 244 244 } 245 245 246 void UIVMLogPage::setBookmarkVector(const QVector<LogBookmark>& bookmarks) 247 { 248 m_bookmarkVector = bookmarks; 249 updateTextEditBookmarkLineSet(); 250 } 251 246 252 void UIVMLogPage::showEvent(QShowEvent *pEvent) 247 253 { -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.h
r71638 r71683 39 39 40 40 /** UIVMLogPage defines data and functionalities of the each tab page of a UIVMLogViewerWidget. 41 41 * It stores the original log file content , a list of bookmarks, etc */ 42 42 class UIVMLogPage : public QIWithRetranslateUI<QWidget> 43 43 { … … 71 71 72 72 /** Set plaintextEdit's text. Note that the text we 73 74 73 * show currently might be different than 74 * m_strLog. For example during filtering. */ 75 75 void setTextEditText(const QString &strText); 76 76 void setTextEditTextAsHtml(const QString &strText); … … 88 88 89 89 const QVector<LogBookmark>& bookmarkVector() const; 90 void setBookmarkVector(const QVector<LogBookmark>& booksmarks); 91 90 92 void deleteAllBookmarks(); 91 93 /** Scrolls the plain text edit to the bookmark with index @a bookmarkIndex. */ … … 99 101 100 102 /** setFilterParameters is called at the end of filtering operation to store the parameter etc. 101 102 103 * these parameters are used to decide whether we have to reapply the filter, and if not to 104 * update filter panel with correct line counts etc.*/ 103 105 void setFilterParameters(const QSet<QString> &filterTermSet, int filterOperationType, 104 106 int iFilteredLineCount, int iUnfilteredLineCount); … … 106 108 int unfilteredLineCount() const; 107 109 /** Compares filter parameters with previous filter operation's parameters to decide if the 108 110 * filter should be applied again. */ 109 111 bool shouldFilterBeApplied(const QSet<QString> &filterTermSet, int filterOperationType) const; 110 112 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h
r71638 r71683 28 28 29 29 /** UIVMLogViewerPanel extension providing GUI for bookmark management. Show a list of bookmarks currently set 30 for displayed log page. It has controls to navigate and clear bookmarks. */30 * for displayed log page. It has controls to navigate and clear bookmarks. */ 31 31 class UIVMLogViewerBookmarksPanel : public UIVMLogViewerPanel 32 32 { … … 44 44 45 45 /** Adds a single bookmark to an existing list of bookmarks. Possibly called 46 by UIVMLogViewerWidget when user adds a bookmark thru context menu etc. */46 * by UIVMLogViewerWidget when user adds a bookmark thru context menu etc. */ 47 47 void addBookmark(const QPair<int, QString> &newBookmark); 48 48 /** Clear the bookmark list and show this list instead. Probably done after 49 user switches to another log page tab etc. */49 * user switches to another log page tab etc. */ 50 50 void setBookmarksList(const QVector<QPair<int, QString> > &bookmarkList); 51 51 void updateBookmarkList(const QVector<QPair<int, QString> > &bookmarkVector); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r71669 r71683 180 180 m_logPageList.clear(); 181 181 m_pTabWidget->setEnabled(true); 182 int currentTabIndex = m_pTabWidget->currentIndex(); 182 183 /* Hide the container widget during updates to avoid flickering: */ 183 184 m_pTabWidget->hide(); 185 QVector<QVector<LogBookmark> > logPageBookmarks; 184 186 /* Clear the tab widget. This might be an overkill but most secure way to deal with the case where 185 number of the log files changes. */187 number of the log files changes. Store the bookmark vectors before deleting the pages*/ 186 188 while (m_pTabWidget->count()) 187 189 { 188 190 QWidget *pFirstPage = m_pTabWidget->widget(0); 191 UIVMLogPage *pLogPage = qobject_cast<UIVMLogPage*>(pFirstPage); 192 if (pLogPage) 193 logPageBookmarks.push_back(pLogPage->bookmarkVector()); 189 194 m_pTabWidget->removeTab(0); 190 195 delete pFirstPage; … … 192 197 193 198 bool noLogsToShow = createLogViewerPages(); 194 195 /* Show the first tab widget's page after the refresh: */196 m_pTabWidget->setCurrentIndex(0);197 199 198 200 /* Apply the filter settings: */ 199 201 if (m_pFilterPanel) 200 202 m_pFilterPanel->applyFilter(); 203 /* Restore the bookmarks: */ 204 for (int i = 0; i < !noLogsToShow && m_pTabWidget->count(); ++i) 205 { 206 UIVMLogPage *pLogPage = qobject_cast<UIVMLogPage*>(m_pTabWidget->widget(i)); 207 if (pLogPage && i < logPageBookmarks.size()) 208 pLogPage->setBookmarkVector(logPageBookmarks[i]); 209 } 201 210 202 211 /* Setup this connection after refresh to avoid initial signals during page creation: */ … … 205 214 connect(m_pTabWidget, &QITabWidget::currentChanged, this, &UIVMLogViewerWidget::sltTabIndexChange); 206 215 216 /* Show the first tab widget's page after the refresh: */ 217 int tabIndex = (currentTabIndex < m_pTabWidget->count()) ? currentTabIndex : 0; 218 m_pTabWidget->setCurrentIndex(tabIndex); 219 sltTabIndexChange(tabIndex); 207 220 /* Enable/Disable toolbar actions (except Refresh) & tab widget according log presence: */ 208 221 if (m_pActionFind) … … 220 233 if (m_pSearchPanel && m_pSearchPanel->isVisible()) 221 234 m_pSearchPanel->refresh(); 235 236 /* If there are no log files to show the hide all the open panels: */ 237 if (noLogsToShow) 238 { 239 for(QMap<UIVMLogViewerPanel*, QAction*>::iterator iterator = m_panelActionMap.begin(); 240 iterator != m_panelActionMap.end(); ++iterator) 241 { 242 if (iterator.key()) 243 hidePanel(iterator.key()); 244 } 245 } 222 246 } 223 247
Note:
See TracChangeset
for help on using the changeset viewer.