Changeset 86958 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 23, 2020 11:23:43 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r86791 r86958 241 241 const char *UIExtraDataDefs::GUI_HelpBrowserLastURLList = "GUI/HelpBrowserLastURLList"; 242 242 const char *UIExtraDataDefs::GUI_HelpBrowserDialogGeometry = "GUI/HelpBrowserDialogGeomety"; 243 const char *UIExtraDataDefs::GUI_HelpBrowserBookmarks = "GUI/HelpBrowserBookmarks"; 243 244 244 245 /* VM Resource Monitor: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r86791 r86958 440 440 SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserLastURLList; 441 441 SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserDialogGeometry; 442 SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserBookmarks; 442 443 /** @} */ 443 444 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r86791 r86958 1983 1983 << GUI_LogWindowGeometry 1984 1984 << GUI_HelpBrowserLastURLList 1985 << GUI_HelpBrowserDialogGeometry; 1985 << GUI_HelpBrowserDialogGeometry 1986 << GUI_HelpBrowserBookmarks; 1986 1987 } 1987 1988 … … 4631 4632 /* Make sure 5th item has required value: */ 4632 4633 return data.size() == 5 && data[4] == GUI_Geometry_State_Max; 4634 } 4635 4636 void UIExtraDataManager::setHelpBrowserBookmarks(const QStringList &bookmarks) 4637 { 4638 setExtraDataStringList(GUI_HelpBrowserBookmarks, bookmarks); 4639 } 4640 4641 QStringList UIExtraDataManager::helpBrowserBookmarks() 4642 { 4643 return extraDataStringList(GUI_HelpBrowserBookmarks); 4633 4644 } 4634 4645 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r86791 r86958 792 792 void setHelpBrowserDialogGeometry(const QRect &geometry, bool fMaximized); 793 793 bool helpBrowserDialogShouldBeMaximized(); 794 void setHelpBrowserBookmarks(const QStringList &bookmarks); 795 QStringList helpBrowserBookmarks(); 794 796 /** @} */ 795 797 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r86947 r86958 201 201 UIBookmarksListContainer(QWidget *pParent = 0); 202 202 void addBookmark(const QUrl &url, const QString &strTitle); 203 /** Return all bookmarks a url, title pair list. */ 204 QStringList bookmarks() const; 203 205 QUrl currentBookmarkUrl(); 204 206 … … 613 615 614 616 /********************************************************************************************************************************* 615 * UIBookmarksList Container implementation.*617 * UIBookmarksListWidget implementation. * 616 618 *********************************************************************************************************************************/ 617 619 UIBookmarksListWidget::UIBookmarksListWidget(QWidget *pParent /* = 0 */) … … 653 655 } 654 656 657 QStringList UIBookmarksListContainer::bookmarks() const 658 { 659 if (!m_pListWidget) 660 return QStringList(); 661 QStringList bookmarks; 662 for (int i = 0; i < m_pListWidget->count(); ++i) 663 { 664 QListWidgetItem *pItem = m_pListWidget->item(i); 665 if (!pItem) 666 continue; 667 bookmarks << pItem->data(iBookmarkUrlDataType).toUrl().toString() << pItem->text(); 668 } 669 return bookmarks; 670 } 671 655 672 QUrl UIBookmarksListContainer::currentBookmarkUrl() 656 673 { … … 668 685 m_pMainLayout = new QVBoxLayout(this); 669 686 AssertReturnVoid(m_pMainLayout); 687 m_pMainLayout->setContentsMargins(0, 0, 0, 0); 688 670 689 m_pListWidget = new UIBookmarksListWidget; 671 690 AssertReturnVoid(m_pListWidget); … … 992 1011 void UIHelpBrowserTab::retranslateUi() 993 1012 { 994 setActionTextAndToolTip(m_pHomeAction, tr("Home"), tr("Return to start page"));995 setActionTextAndToolTip(m_pBackwardAction, tr("Backward"), tr("Navigate to previous page"));996 setActionTextAndToolTip(m_pForwardAction, tr("Forward"), tr("Navigate to next page"));997 setActionTextAndToolTip(m_pAddBookmarkAction, tr("Bookmark"), tr("Add a new bookmark"));998 setActionTextAndToolTip(m_pFindInPageAction, tr("Find in Page"), tr("Find a string in the current page"));1013 setActionTextAndToolTip(m_pHomeAction, tr("Home"), tr("Return to Start Page")); 1014 setActionTextAndToolTip(m_pBackwardAction, tr("Backward"), tr("Navigate to Previous Page")); 1015 setActionTextAndToolTip(m_pForwardAction, tr("Forward"), tr("Navigate to Next Page")); 1016 setActionTextAndToolTip(m_pAddBookmarkAction, tr("Bookmark"), tr("Add a New Bookmark")); 1017 setActionTextAndToolTip(m_pFindInPageAction, tr("Find in Page"), tr("Find a String in the Current Page")); 999 1018 } 1000 1019 … … 1663 1682 return; 1664 1683 QMenu menu; 1665 QAction *pCloseAll = menu.addAction(UIHelpBrowserWidget::tr("Close other tabs"));1684 QAction *pCloseAll = menu.addAction(UIHelpBrowserWidget::tr("Close Other Tabs")); 1666 1685 connect(pCloseAll, &QAction::triggered, this, &UIHelpBrowserTabManager::sltHandleCloseOtherTabs); 1667 1686 pCloseAll->setData(tabBar()->tabAt(pos)); 1668 1687 1669 QAction *pClose = menu.addAction(UIHelpBrowserWidget::tr("Close tab"));1688 QAction *pClose = menu.addAction(UIHelpBrowserWidget::tr("Close Tab")); 1670 1689 connect(pClose, &QAction::triggered, this, &UIHelpBrowserTabManager::sltHandleContextMenuTabClose); 1671 1690 pClose->setData(tabBar()->tabAt(pos)); … … 1781 1800 prepareSearchWidgets(); 1782 1801 prepareMenu(); 1802 loadBookmarks(); 1783 1803 retranslateUi(); 1784 1804 } … … 1978 1998 } 1979 1999 2000 void UIHelpBrowserWidget::loadBookmarks() 2001 { 2002 if (!m_pBookmarksWidget) 2003 return; 2004 2005 QStringList bookmarks = gEDataManager->helpBrowserBookmarks(); 2006 /* bookmarks list is supposed to have url title pair: */ 2007 for (int i = 0; i < bookmarks.size(); ++i) 2008 { 2009 const QString &url = bookmarks[i]; 2010 if (i+1 >= bookmarks.size()) 2011 break; 2012 ++i; 2013 const QString &strTitle = bookmarks[i]; 2014 printf("%s %s\n", qPrintable(url), qPrintable(strTitle)); 2015 m_pBookmarksWidget->addBookmark(url, strTitle); 2016 } 2017 } 2018 2019 void UIHelpBrowserWidget::saveBookmarks() 2020 { 2021 if (!m_pBookmarksWidget) 2022 return; 2023 gEDataManager->setHelpBrowserBookmarks(m_pBookmarksWidget->bookmarks()); 2024 } 2025 1980 2026 void UIHelpBrowserWidget::saveOptions() 1981 2027 { … … 2029 2075 void UIHelpBrowserWidget::cleanup() 2030 2076 { 2031 /* Save options: */2032 2077 saveOptions(); 2078 saveBookmarks(); 2033 2079 } 2034 2080 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h
r86913 r86958 47 47 class QHelpSearchQueryWidget; 48 48 class QHelpSearchResultWidget; 49 class QListWidget; 49 50 class QPlainTextEdit; 50 51 class QSplitter; … … 111 112 void loadOptions(); 112 113 QStringList loadSavedUrlList(); 114 /** Bookmark list is save as url-title pairs. */ 115 void loadBookmarks(); 116 void saveBookmarks(); 113 117 void saveOptions(); 114 118 void cleanup(); … … 168 172 QAction *m_pFontSizeSmallerAction; 169 173 QAction *m_pFontSizeResetAction; 174 170 175 /* This is set t true when handling QHelpContentModel::contentsCreated signal. */ 171 176 bool m_fModelContentCreated;
Note:
See TracChangeset
for help on using the changeset viewer.