VirtualBox

Changeset 88903 in vbox


Ignore:
Timestamp:
May 6, 2021 1:47:30 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. Saving log viewer widget options immediately as they change.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/logviewer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp

    r88901 r88903  
    6666    , m_comMachine(comMachine)
    6767{
     68}
     69
     70UIVMLogViewerDialog::~UIVMLogViewerDialog()
     71{
     72    UIVMLogViewerWidget *pWidget = qobject_cast<UIVMLogViewerWidget*>(widget());
     73    if (pWidget)
     74        pWidget->setDialogBeingClosed(true);
    6875}
    6976
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.h

    r88901 r88903  
    7878      * @param  comMachine     Brings the machine reference. */
    7979    UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine);
     80    ~UIVMLogViewerDialog();
    8081
    8182protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r88877 r88903  
    164164    , m_pCornerButton(0)
    165165    , m_pMachineSelectionMenu(0)
     166    , m_fDialogBeingClosed(false)
    166167{
    167168    /* Prepare VM Log-Viewer: */
     
    289290}
    290291
     292void UIVMLogViewerWidget::setDialogBeingClosed(bool fFlag)
     293{
     294    m_fDialogBeingClosed = fFlag;
     295}
     296
    291297bool UIVMLogViewerWidget::shouldBeMaximized() const
    292298{
     
    294300}
    295301
    296 void UIVMLogViewerWidget::sltSaveOptions()
    297 {
     302void UIVMLogViewerWidget::saveOptions()
     303{
     304    gEDataManager->setLogViweverOptions(m_font, m_bWrapLines, m_bShowLineNumbers);
     305}
     306
     307void UIVMLogViewerWidget::savePanelVisibility()
     308{
     309    if (m_fDialogBeingClosed)
     310        return;
    298311    /* Save a list of currently visible panels: */
    299312    QStringList strNameList;
     
    301314        strNameList.append(pPanel->panelName());
    302315    gEDataManager->setLogViewerVisiblePanels(strNameList);
    303     gEDataManager->setLogViweverOptions(m_font, m_bWrapLines, m_bShowLineNumbers);
    304316}
    305317
     
    508520            pLogPage->setShowLineNumbers(m_bShowLineNumbers);
    509521    }
     522    saveOptions();
    510523}
    511524
     
    523536            pLogPage->setWrapLines(m_bWrapLines);
    524537    }
     538    saveOptions();
    525539}
    526540
     
    536550            pLogPage->setCurrentFont(m_font);
    537551    }
     552    saveOptions();
    538553}
    539554
     
    549564            pLogPage->setCurrentFont(m_font);
    550565    }
     566    saveOptions();
    551567}
    552568
     
    563579        m_pOptionsPanel->setFontSizeInPoints(m_font.pointSize());
    564580    }
     581    saveOptions();
    565582}
    566583
     
    766783    if (loadedFont != QFont())
    767784        m_font = loadedFont;
    768     connect(&uiCommon(), &UICommon::sigAskToCommitData,
    769             this, &UIVMLogViewerWidget::sltSaveOptions);
    770785}
    771786
     
    10541069    m_visiblePanelsList.removeOne(panel);
    10551070    manageEscapeShortCut();
     1071    savePanelVisibility();
    10561072}
    10571073
     
    10691085        m_visiblePanelsList.push_back(panel);
    10701086    manageEscapeShortCut();
     1087    savePanelVisibility();
    10711088}
    10721089
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r88834 r88903  
    8989    QFont currentFont() const;
    9090
     91    /** Sets m_fDialogBeingClosed. */
     92    void setDialogBeingClosed(bool fFlag);
     93
    9194protected:
    9295
     
    9598
    9699private slots:
    97 
    98     /** Saves options.  */
    99     void sltSaveOptions();
    100100
    101101    /** Rereads the log file shown in the current tab. */
     
    152152        /** Prepares toolbar. */
    153153        void prepareToolBar();
     154        void saveOptions();
    154155        /** Loads options.  */
    155156        void loadOptions();
     157        void savePanelVisibility();
    156158        /** Shows the panels that have been visible the last time logviewer is closed. */
    157159        void restorePanelVisibility();
     
    246248    QIToolButton *m_pCornerButton;
    247249    UIMachineListMenu *m_pMachineSelectionMenu;
     250    /** This is set to true by the parent dialog. This is necessary not to save
     251      * visible panel list during destruction since they are hidden automatically during that. */
     252    bool m_fDialogBeingClosed;
    248253    friend class UIVMLogViewerFilterPanel;
    249254    friend class UIVMLogViewerPanel;
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