Changeset 86963 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.cpp
- Timestamp:
- Nov 24, 2020 9:43:55 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.cpp
r86915 r86963 23 23 #include <QKeyEvent> 24 24 #include <QLabel> 25 #include <QMenuBar> 25 26 #include <QPlainTextEdit> 26 27 #include <QPushButton> … … 41 42 42 43 /********************************************************************************************************************************* 43 * Class UIHelpBrowserDialogFactory implementation. *44 *********************************************************************************************************************************/45 46 UIHelpBrowserDialogFactory::UIHelpBrowserDialogFactory(const QString &strHelpFilePath)47 : m_strHelpFilePath(strHelpFilePath)48 {49 }50 51 UIHelpBrowserDialogFactory::UIHelpBrowserDialogFactory()52 : m_strHelpFilePath(QString())53 {54 }55 56 void UIHelpBrowserDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)57 {58 pDialog = new UIHelpBrowserDialog(pCenterWidget, m_strHelpFilePath);59 }60 61 62 /*********************************************************************************************************************************63 44 * Class UIHelpBrowserDialog implementation. * 64 45 *********************************************************************************************************************************/ 65 46 66 UIHelpBrowserDialog::UIHelpBrowserDialog(QWidget *p CenterWidget, const QString &strHelpFilePath)67 : QIWithRetranslateUI<QI ManagerDialog>(pCenterWidget)47 UIHelpBrowserDialog::UIHelpBrowserDialog(QWidget *pParent, QWidget *pCenterWidget, const QString &strHelpFilePath) 48 : QIWithRetranslateUI<QIWithRestorableGeometry<QMainWindow> >(pParent) 68 49 , m_strHelpFilePath(strHelpFilePath) 69 50 , m_pWidget(0) 51 , m_pCenterWidget(pCenterWidget) 70 52 { 53 setAttribute(Qt::WA_DeleteOnClose); 54 setWindowIcon(UIIconPool::iconSetFull(":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png")); 55 prepareCentralWidget(); 56 loadSettings(); 57 retranslateUi(); 58 } 59 60 UIHelpBrowserDialog::~UIHelpBrowserDialog() 61 { 62 saveSettings(); 71 63 } 72 64 … … 84 76 { 85 77 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) 86 setWindowTitle(UIHelpBrowserWidget::tr("User Manual")); 87 button(ButtonType_Close)->setText(UIHelpBrowserWidget::tr("Close")); 78 setWindowTitle(UIHelpBrowserWidget::tr("Oracle VM VirtualBox User Manual")); 88 79 #endif 89 80 } 90 81 91 void UIHelpBrowserDialog::configure()92 {93 /* Apply window icons: */94 setWindowIcon(UIIconPool::iconSetFull(":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png"));95 }96 82 97 void UIHelpBrowserDialog:: configureCentralWidget()83 void UIHelpBrowserDialog::prepareCentralWidget() 98 84 { 99 85 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) 100 86 m_pWidget = new UIHelpBrowserWidget(EmbedTo_Dialog, m_strHelpFilePath); 101 if (m_pWidget) 102 { 103 /* Configure widget: */ 104 setWidget(m_pWidget); 105 setWidgetMenus(m_pWidget->menus()); 87 AssertPtrReturnVoid(m_pWidget); 106 88 #ifdef VBOX_WS_MAC 107 89 setWidgetToolbar(m_pWidget->toolbar()); 108 90 #endif 109 connect(m_pWidget, &UIHelpBrowserWidget::sigSetCloseButtonShortCut, 110 this, &UIHelpBrowserDialog::sltSetCloseButtonShortCut); 91 setCentralWidget((m_pWidget)); 111 92 112 /* Add into layout: */113 centralWidget()->layout()->addWidget(m_pWidget);114 }93 const QList<QMenu*> menuList = m_pWidget->menus(); 94 foreach (QMenu *pMenu, menuList) 95 menuBar()->addMenu(pMenu); 115 96 #endif 116 }117 118 void UIHelpBrowserDialog::finalize()119 {120 /* Apply language settings: */121 retranslateUi();122 97 } 123 98 … … 130 105 131 106 /* Load geometry from extradata: */ 132 const QRect geo = gEDataManager->helpBrowserDialogGeometry(this, centerWidget(), defaultGeo);107 const QRect geo = gEDataManager->helpBrowserDialogGeometry(this, m_pCenterWidget, defaultGeo); 133 108 LogRel2(("GUI: UIHelpBrowserDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n", 134 109 geo.x(), geo.y(), geo.width(), geo.height())); … … 148 123 return gEDataManager->helpBrowserDialogShouldBeMaximized(); 149 124 } 150 151 void UIHelpBrowserDialog::sltSetCloseButtonShortCut(QKeySequence shortcut)152 {153 if (button(ButtonType_Close))154 button(ButtonType_Close)->setShortcut(shortcut);155 }
Note:
See TracChangeset
for help on using the changeset viewer.