VirtualBox

Ignore:
Timestamp:
Apr 26, 2018 11:50:13 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122334
Message:

FE/Qt: ​bugref:9072 Add a button to reset the settings of log viewer

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

Legend:

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

    r72033 r72037  
    4444    , m_pFontSizeSpinBox(0)
    4545    , m_pFontSizeLabel(0)
    46     , m_pOpenFontDialog(0)
     46    , m_pOpenFontDialogButton(0)
     47    , m_pResetToDefaultsButton(0)
    4748    , m_iDefaultFontSize(9)
    4849{
     
    111112    }
    112113
    113     m_pOpenFontDialog = new QIToolButton;
    114     if (m_pOpenFontDialog)
     114    m_pOpenFontDialogButton = new QIToolButton;
     115    if (m_pOpenFontDialogButton)
    115116    {
    116         mainLayout()->addWidget(m_pOpenFontDialog, 0);
    117         m_pOpenFontDialog->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png"));
    118         m_pOpenFontDialog->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
     117        mainLayout()->addWidget(m_pOpenFontDialogButton, 0);
     118        m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png"));
    119119    }
    120120
    121 
     121    m_pResetToDefaultsButton = new QIToolButton;
     122    if (m_pResetToDefaultsButton)
     123    {
     124        mainLayout()->addWidget(m_pResetToDefaultsButton, 0);
     125        m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png"));
     126    }
    122127    mainLayout()->addStretch(2);
    123128}
     
    131136    if (m_pFontSizeSpinBox)
    132137        connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
    133                 this, &UIVMLogViewerSettingsPanel::sigFontSizeInPoints);
    134     if (m_pOpenFontDialog)
    135         connect(m_pOpenFontDialog, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog);
    136 
     138                this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints);
     139    if (m_pOpenFontDialogButton)
     140        connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog);
     141    if (m_pResetToDefaultsButton)
     142        connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults);
    137143}
    138144
     
    158164    }
    159165
    160     if (m_pOpenFontDialog)
    161     {
    162         m_pOpenFontDialog->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
    163         m_pOpenFontDialog->setText(UIVMLogViewerWidget::tr("Select Font"));
    164     }
     166    if (m_pOpenFontDialogButton)
     167        m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
    165168
     169    if (m_pResetToDefaultsButton)
     170        m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));
    166171}
    167172
     
    179184
    180185    if (ok)
    181         emit sigFontFace(font);
     186        emit sigChangeFont(font);
    182187}
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSettingsPanel.h

    r72030 r72037  
    3838    void sigShowLineNumbers(bool show);
    3939    void sigWrapLines(bool show);
    40     void sigFontSizeInPoints(int size);
    41     void sigFontFace(QFont font);
     40    void sigChangeFontSizeInPoints(int size);
     41    void sigChangeFont(QFont font);
     42    void sigResetToDefaults();
    4243
    4344public:
     
    7071    QSpinBox     *m_pFontSizeSpinBox;
    7172    QLabel       *m_pFontSizeLabel;
    72     QIToolButton *m_pOpenFontDialog;
     73    QIToolButton *m_pOpenFontDialogButton;
     74    QIToolButton *m_pResetToDefaultsButton;
    7375
    7476    /** Default font size in points. */
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r72030 r72037  
    387387}
    388388
    389 void UIVMLogViewerWidget::sltFontFace(QFont font)
     389void UIVMLogViewerWidget::sltChangeFont(QFont font)
    390390{
    391391    if (m_font == font)
     
    397397        if (pLogPage)
    398398            pLogPage->setCurrentFont(m_font);
     399    }
     400}
     401void UIVMLogViewerWidget::sltResetSettingsToDefault()
     402{
     403    sltShowLineNumbers(true);
     404    sltWrapLines(false);
     405    sltChangeFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
     406
     407    if (m_pSettingsPanel)
     408    {
     409        m_pSettingsPanel->setShowLineNumbers(true);
     410        m_pSettingsPanel->setWrapLines(false);
     411        m_pSettingsPanel->setFontSizeInPoints(m_font.pointSize());
    399412    }
    400413}
     
    502515        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigShowLineNumbers, this, &UIVMLogViewerWidget::sltShowLineNumbers);
    503516        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigWrapLines, this, &UIVMLogViewerWidget::sltWrapLines);
    504         connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigFontSizeInPoints, this, &UIVMLogViewerWidget::sltFontSizeChanged);
    505         connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigFontFace, this, &UIVMLogViewerWidget::sltFontFace);
     517        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints, this, &UIVMLogViewerWidget::sltFontSizeChanged);
     518        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigChangeFont, this, &UIVMLogViewerWidget::sltChangeFont);
     519        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigResetToDefaults, this, &UIVMLogViewerWidget::sltResetSettingsToDefault);
    506520    }
    507521}
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r72030 r72037  
    120120        void sltWrapLines(bool bWrapLine);
    121121        void sltFontSizeChanged(int fontSize);
    122         void sltFontFace(QFont font);
     122        void sltChangeFont(QFont font);
     123        void sltResetSettingsToDefault();
    123124    /** @} */
    124125
Note: See TracChangeset for help on using the changeset viewer.

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