VirtualBox

Changeset 86764 in vbox for trunk/src


Ignore:
Timestamp:
Oct 30, 2020 10:08:52 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Saving/loading help browser dialog geometry.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r86716 r86764  
    240240/* Help Browser */
    241241const char *UIExtraDataDefs::GUI_HelpBrowserLastURL = "GUI/HelpBrowserLastURL";
     242const char *UIExtraDataDefs::GUI_HelpBrowserDialogGeometry = "GUI/HelpBrowserDialogGeomety";
    242243
    243244/* VM Resource Monitor: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r86716 r86764  
    439439      * @{ */
    440440        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserLastURL;
     441        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserDialogGeometry;
    441442    /** @} */
    442443
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r86716 r86764  
    19811981#endif /* VBOX_WITH_DEBUGGER_GUI */
    19821982           << GUI_ExtraDataManager_Geometry << GUI_ExtraDataManager_SplitterHints
    1983            << GUI_LogWindowGeometry;
     1983           << GUI_LogWindowGeometry
     1984           << GUI_HelpBrowserLastURL
     1985           << GUI_HelpBrowserDialogGeometry;
    19841986}
    19851987
     
    46004602{
    46014603    return extraDataString(GUI_HelpBrowserLastURL);
     4604}
     4605
     4606QRect UIExtraDataManager::helpBrowserDialogGeometry(QWidget *pWidget, QWidget *pParentWidget, const QRect &defaultGeometry)
     4607{
     4608    return dialogGeometry(GUI_HelpBrowserDialogGeometry, pWidget, pParentWidget, defaultGeometry);
     4609}
     4610
     4611void UIExtraDataManager::setHelpBrowserDialogGeometry(const QRect &geometry, bool fMaximized)
     4612{
     4613    /* Serialize passed values: */
     4614    QStringList data;
     4615    data << QString::number(geometry.x());
     4616    data << QString::number(geometry.y());
     4617    data << QString::number(geometry.width());
     4618    data << QString::number(geometry.height());
     4619    if (fMaximized)
     4620        data << GUI_Geometry_State_Max;
     4621
     4622    /* Re-cache corresponding extra-data: */
     4623    setExtraDataStringList(GUI_HelpBrowserDialogGeometry, data);
     4624}
     4625
     4626bool UIExtraDataManager::helpBrowserDialogShouldBeMaximized()
     4627{
     4628    /* Get corresponding extra-data: */
     4629    const QStringList data = extraDataStringList(GUI_HelpBrowserDialogGeometry);
     4630
     4631    /* Make sure 5th item has required value: */
     4632    return data.size() == 5 && data[4] == GUI_Geometry_State_Max;
    46024633}
    46034634
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r86716 r86764  
    789789        void setHelpBrowserLastUrl(const QString &url);
    790790        QString helpBrowserLastUrl();
     791        QRect helpBrowserDialogGeometry(QWidget *pWidget, QWidget *pParentWidget, const QRect &defaultGeometry);
     792        void setHelpBrowserDialogGeometry(const QRect &geometry, bool fMaximized);
     793        bool helpBrowserDialogShouldBeMaximized();
    791794    /** @} */
    792795
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.cpp

    r86583 r86764  
    112112void UIHelpBrowserDialog::loadSettings()
    113113{
     114    const QRect availableGeo = gpDesktop->availableGeometry(this);
     115    int iDefaultWidth = availableGeo.width() / 2;
     116    int iDefaultHeight = availableGeo.height() * 3 / 4;
     117    QRect defaultGeo(0, 0, iDefaultWidth, iDefaultHeight);
     118
     119    /* Load geometry from extradata: */
     120    const QRect geo = gEDataManager->helpBrowserDialogGeometry(this, centerWidget(), defaultGeo);
     121    LogRel2(("GUI: UIHelpBrowserDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
     122             geo.x(), geo.y(), geo.width(), geo.height()));
     123    restoreGeometry(geo);
    114124}
    115125
    116126void UIHelpBrowserDialog::saveSettings()
    117127{
     128    const QRect geo = currentGeometry();
     129    LogRel2(("GUI: UIHelpBrowserDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
     130             geo.x(), geo.y(), geo.width(), geo.height()));
     131    gEDataManager->setHelpBrowserDialogGeometry(geo, isCurrentlyMaximized());
    118132}
    119133
    120134bool UIHelpBrowserDialog::shouldBeMaximized() const
    121135{
    122     return gEDataManager->logWindowShouldBeMaximized();
     136    return gEDataManager->helpBrowserDialogShouldBeMaximized();
    123137}
    124138
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86758 r86764  
    315315    pSearchLayout->addWidget(m_pHelpSearchQueryWidget);
    316316    pSearchLayout->addWidget(m_pHelpSearchResultWidget);
    317 
     317    m_pHelpSearchQueryWidget->expandExtendedSearch();
    318318
    319319    connect(m_pHelpSearchQueryWidget, &QHelpSearchQueryWidget::search,
    320320            this, &UIHelpBrowserWidget::sltHandleSearchStart);
    321     // connect(resultWidget, &QHelpSearchResultWidget::requestShowLink,
    322     //         this, &SearchWidget::requestShowLink);
     321    connect(m_pHelpSearchResultWidget, &QHelpSearchResultWidget::requestShowLink,
     322            m_pContentViewer, &UIHelpBrowserViewer::setSource);
    323323
    324324    // connect(searchEngine, &QHelpSearchEngine::searchingStarted,
     
    328328
    329329
    330 
    331 
    332     // connect(m_pHelpSearchEngine, &QHelpSearchEngine::indexingStarted,
    333     //         this, &UIHelpBrowserWidget::sltHandleIndexingStarted);
    334     // connect(m_pHelpSearchEngine, &QHelpSearchEngine::indexingFinished,
    335     //         this, &UIHelpBrowserWidget::sltHandleIndexingFinished);
    336 
    337     //void      searchingFinished(int searchResultCount)
    338 
     330    connect(m_pHelpSearchEngine, &QHelpSearchEngine::indexingStarted,
     331            this, &UIHelpBrowserWidget::sltHandleIndexingStarted);
     332    connect(m_pHelpSearchEngine, &QHelpSearchEngine::indexingFinished,
     333            this, &UIHelpBrowserWidget::sltHandleIndexingFinished);
    339334
    340335    connect(m_pHelpSearchEngine, &QHelpSearchEngine::searchingStarted,
    341336            this, &UIHelpBrowserWidget::sltHandleSearchingStarted);
    342337
    343     m_pHelpSearchEngine->reindexDocumentation();
     338
    344339# endif//if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
    345340#endif
     
    693688void UIHelpBrowserWidget::sltHandleIndexingStarted()
    694689{
     690    if (m_pSearchContainerWidget)
     691        m_pSearchContainerWidget->setEnabled(false);
    695692    printf("indexing started\n");
    696693}
     
    698695void UIHelpBrowserWidget::sltHandleIndexingFinished()
    699696{
     697    if (m_pSearchContainerWidget)
     698        m_pSearchContainerWidget->setEnabled(true);
     699
    700700    printf("indexing finished\n");
    701701}
     
    703703void UIHelpBrowserWidget::sltHandleSearchingStarted()
    704704{
    705     printf("search started\n");
     705
    706706}
    707707
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp

    r86231 r86764  
    115115void UIVMLogViewerDialog::loadSettings()
    116116{
    117     /* Invent default window geometry: */
     117
    118118    const QRect availableGeo = gpDesktop->availableGeometry(this);
    119119    int iDefaultWidth = availableGeo.width() / 2;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette