Changeset 86634 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 20, 2020 7:25:40 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r86622 r86634 54 54 #include "CSystemProperties.h" 55 55 56 enum HelpBrowserTabs 57 { 58 HelpBrowserTabs_TOC = 0, 59 HelpBrowserTabs_Index, 60 HelpBrowserTabs_Bookmarks, 61 HelpBrowserTabs_Max 62 }; 63 56 64 class UIHelpBrowserViewer : public QTextBrowser 57 65 { … … 112 120 , m_pSplitter(0) 113 121 , m_pMenu(0) 122 , m_pContentWidget(0) 123 , m_pIndexWidget(0) 124 , m_pBookmarksWidget(0) 125 , m_pShowHideContentsWidgetAction(0) 114 126 { 115 127 prepare(); … … 139 151 prepareActions(); 140 152 prepareWidgets(); 141 prepareMenu AndMenuActions();153 prepareMenu(); 142 154 retranslateUi(); 143 155 } … … 145 157 void UIHelpBrowserWidget::prepareActions() 146 158 { 147 159 m_pShowHideContentsWidgetAction = new QAction(this); 160 m_pShowHideContentsWidgetAction->setData(HelpBrowserTabs_TOC); 148 161 } 149 162 … … 159 172 #ifdef RT_OS_LINUX 160 173 m_pHelpEngine = new QHelpEngine(m_strHelpFilePath, this); 161 174 m_pBookmarksWidget = new QWidget(this); 162 175 m_pTabWidget = new QITabWidget; 163 AssertReturnVoid(m_pTabWidget); 164 AssertReturnVoid(m_pHelpEngine->contentWidget() && m_pHelpEngine->indexWidget()); 176 AssertReturnVoid(m_pTabWidget && m_pHelpEngine && m_pBookmarksWidget); 177 178 m_pContentWidget = m_pHelpEngine->contentWidget(); 179 m_pIndexWidget = m_pHelpEngine->indexWidget(); 180 181 AssertReturnVoid(m_pContentWidget && m_pIndexWidget); 165 182 m_pSplitter->addWidget(m_pTabWidget); 166 m_pTabWidget->addTab(m_pHelpEngine->contentWidget(), tr("Contents")); 167 m_pTabWidget->addTab(m_pHelpEngine->indexWidget(), tr("Index")); 183 m_pTabWidget->insertTab(HelpBrowserTabs_TOC, m_pContentWidget, QString()); 184 m_pTabWidget->insertTab(HelpBrowserTabs_Index, m_pIndexWidget, QString()); 185 m_pTabWidget->insertTab(HelpBrowserTabs_Bookmarks, m_pBookmarksWidget, QString()); 168 186 169 187 m_pContentViewer = new UIHelpBrowserViewer(m_pHelpEngine); … … 178 196 this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished); 179 197 180 connect(m_p HelpEngine->contentWidget(), &QHelpContentWidget::linkActivated,198 connect(m_pContentWidget, &QHelpContentWidget::linkActivated, 181 199 m_pContentViewer, &UIHelpBrowserViewer::setSource); 182 connect(m_p HelpEngine->contentWidget(), &QHelpContentWidget::clicked,200 connect(m_pContentWidget, &QHelpContentWidget::clicked, 183 201 this, &UIHelpBrowserWidget::sltHandleContentWidgetItemClicked); 184 202 185 203 186 connect(m_p HelpEngine->indexWidget(), &QHelpIndexWidget::linkActivated,204 connect(m_pIndexWidget, &QHelpIndexWidget::linkActivated, 187 205 m_pContentViewer, &UIHelpBrowserViewer::setSource); 188 206 … … 218 236 } 219 237 220 void UIHelpBrowserWidget::prepareMenu AndMenuActions()238 void UIHelpBrowserWidget::prepareMenu() 221 239 { 222 240 m_pMenu = new QMenu(tr("View"), this); … … 251 269 m_pToolBar->updateLayout(); 252 270 #endif 271 if (m_pTabWidget) 272 { 273 m_pTabWidget->setTabText(HelpBrowserTabs_TOC, tr("Contents")); 274 m_pTabWidget->setTabText(HelpBrowserTabs_Index, tr("Index")); 275 m_pTabWidget->setTabText(HelpBrowserTabs_Bookmarks, tr("Bookmarks")); 276 } 277 if (m_pShowHideContentsWidgetAction) 278 m_pShowHideContentsWidgetAction->setText("Show/Hide Contents"); 253 279 } 254 280 … … 289 315 { 290 316 #ifdef RT_OS_LINUX 291 AssertReturnVoid(m_pContentViewer && m_pHelpEngine && m_p HelpEngine->contentWidget());317 AssertReturnVoid(m_pContentViewer && m_pHelpEngine && m_pContentWidget); 292 318 QHelpContentModel *pContentModel = 293 qobject_cast<QHelpContentModel*>(m_p HelpEngine->contentWidget()->model());319 qobject_cast<QHelpContentModel*>(m_pContentWidget->model()); 294 320 if (!pContentModel) 295 321 return; -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h
r86622 r86634 37 37 38 38 /* Forward declarations: */ 39 class QHBoxLayout; 39 40 class QHelpEngine; 41 class QHelpContentWidget; 42 class QHelpIndexWidget; 40 43 class QPlainTextEdit; 41 class UIHelpBrowserViewer; 42 class QHBoxLayout; 44 class QSplitter; 43 45 class QITabWidget; 44 46 class QIToolBar; 45 47 class UIActionPool; 46 48 class UIDialogPanel; 47 class QSplitter;49 class UIHelpBrowserViewer; 48 50 49 /** QWidget extension providing GUI for VirtualBox LogViewer. It50 * encapsulates log pages, toolbar, a tab widget and manages51 * interaction between these classes. */52 51 class SHARED_LIBRARY_STUFF UIHelpBrowserWidget : public QIWithRetranslateUI<QWidget> 53 52 { … … 60 59 public: 61 60 62 /** Constructs the VM Log-Viewer by passing @a pParent to QWidget base-class constructor.63 * @param enmEmbedding Brings the type of widget embedding.64 * @param fShowToolbar Brings whether we should create/show toolbar.*/65 61 UIHelpBrowserWidget(EmbedTo enmEmbedding, const QString &strHelpFilePath, 66 62 bool fShowToolbar = true, QWidget *pParent = 0); 67 /** Destructs the VM Log-Viewer. */68 63 ~UIHelpBrowserWidget(); 69 64 70 /** Returns the menu. */71 65 QMenu *menu() const; 72 66 73 67 #ifdef VBOX_WS_MAC 74 /** Returns the toolbar. */75 68 QIToolBar *toolbar() const { return m_pToolBar; } 76 69 #endif … … 93 86 void prepareWidgets(); 94 87 void prepareToolBar(); 95 void prepareMenu AndMenuActions();88 void prepareMenu(); 96 89 void loadOptions(); 97 90 … … 135 128 QSplitter *m_pSplitter; 136 129 QMenu *m_pMenu; 130 QHelpContentWidget *m_pContentWidget; 131 QHelpIndexWidget *m_pIndexWidget; 132 QWidget *m_pBookmarksWidget; 133 QAction *m_pShowHideContentsWidgetAction; 137 134 }; 138 135
Note:
See TracChangeset
for help on using the changeset viewer.