VirtualBox

Changeset 88728 in vbox


Ignore:
Timestamp:
Apr 27, 2021 11:51:02 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144046
Message:

FE/Qt: bugref:9930. Some cleaning

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

Legend:

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

    r88703 r88728  
    3838    , m_iSelectedBookmarkIndex(-1)
    3939    , m_bFiltered(false)
    40     , m_iFilteredLineCount(-1)
    41     , m_iUnfilteredLineCount(-1)
    4240    , m_iLogFileId(-1)
    4341{
     
    298296}
    299297
    300 void UIVMLogPage::setFilterParameters(const QSet<QString> &filterTermSet, int filterOperationType,
    301                                       int iFilteredLineCount, int iUnfilteredLineCount)
    302 {
    303     m_filterTermSet = filterTermSet;
    304     m_filterOperationType = filterOperationType;
    305     m_iFilteredLineCount = iFilteredLineCount;
    306     m_iUnfilteredLineCount = iUnfilteredLineCount;
    307 }
    308 
    309 int  UIVMLogPage::filteredLineCount() const
    310 {
    311     return m_iFilteredLineCount;
    312 }
    313 
    314 int  UIVMLogPage::unfilteredLineCount() const
    315 {
    316     return m_iUnfilteredLineCount;
    317 }
    318 
    319 bool UIVMLogPage::shouldFilterBeApplied(const QSet<QString> &filterTermSet, int filterOperationType) const
    320 {
    321     /* If filter terms set is different reapply the filter. */
    322     if (filterTermSet != m_filterTermSet)
    323         return true;
    324 
    325     /* If filter operation type set is different reapply the filter. */
    326     if (filterOperationType != m_filterOperationType)
    327         return true;
    328     return false;
    329 }
    330 
    331298QFont UIVMLogPage::currentFont() const
    332299{
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.h

    r88707 r88728  
    9393    void setWrapLines(bool bWrapLines);
    9494
    95     /** setFilterParameters is called at the end of filtering operation to store the parameter etc.
    96      *  these parameters are used to decide whether we have to reapply the filter, and if not to
    97      *  update filter panel with correct line counts etc.*/
    98     void setFilterParameters(const QSet<QString> &filterTermSet, int filterOperationType,
    99                              int iFilteredLineCount, int iUnfilteredLineCount);
    100     int  filteredLineCount() const;
    101     int  unfilteredLineCount() const;
    102     /** Compares filter parameters with previous filter operation's parameters to decide if the
    103      *  filter should be applied again. */
    104     bool shouldFilterBeApplied(const QSet<QString> &filterTermSet, int filterOperationType) const;
    105 
    10695    QFont currentFont() const;
    10796    void setCurrentFont(QFont font);
     
    150139        if m_bFiltered is false than (m_strLog == m_pTextEdit->text()). */
    151140        bool           m_bFiltered;
    152         /** The set of filter terms used in the last filtering.
    153             Used when deciding whether we have to reapply the filter or not. see shouldFilterBeApplied function. */
    154         QSet<QString>  m_filterTermSet;
    155         /** The type of the boolean last filtering operation. Used in deciding whether we have to reapply the
    156             filter. see shouldFilterBeApplied function. This is int cast of enum FilterOperatorButton
    157             of UIVMLogViewerFilterPanel. */
    158         int            m_filterOperationType;
    159         /** These counts are saveds and restored during filtering operation. If filter is not reapplied these counts
    160             are shown in the filter panel. */
    161         int            m_iFilteredLineCount;
    162         int            m_iUnfilteredLineCount;
    163141    /** @} */
    164142    /** Id of the machine the log shown in this page belongs to. */
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp

    r88707 r88728  
    264264}
    265265
    266 void UIVMLogViewerFilterPanel::applyFilter(const int iCurrentIndex /* = 0 */)
    267 {
    268     Q_UNUSED(iCurrentIndex);
     266void UIVMLogViewerFilterPanel::applyFilter()
     267{
    269268    filter();
    270269    retranslateUi();
     
    282281    if (!logPage)
    283282        return;
    284     /* Check if we have to reapply the filter. If not
    285        restore line counts etc. and return */
    286     // if (!logPage->shouldFilterBeApplied(m_filterTermSet, (int)m_eFilterOperatorButton))
    287     // {
    288     //     m_iFilteredLineCount = logPage->filteredLineCount();
    289     //     m_iUnfilteredLineCount = logPage->unfilteredLineCount();
    290     //     emit sigFilterApplied(!logPage->isFiltered() /* isOriginalLog */);
    291     //     return;
    292     // }
    293 
    294283
    295284    const QString* originalLogString = logString();
     
    309298        emit sigFilterApplied(true /* isOriginalLog */);
    310299        m_iFilteredLineCount = document->lineCount();
    311         logPage->setFilterParameters(m_filterTermSet, (int)m_eFilterOperatorButton,
    312                                      m_iFilteredLineCount, m_iUnfilteredLineCount);
    313300        return;
    314301    }
     
    338325
    339326    emit sigFilterApplied(false /* isOriginalLog */);
    340     logPage->setFilterParameters(m_filterTermSet, (int)m_eFilterOperatorButton,
    341                                  m_iFilteredLineCount, m_iUnfilteredLineCount);
    342 }
    343 
     327}
     328
     329void resetFiltering()
     330{
     331}
    344332
    345333bool UIVMLogViewerFilterPanel::applyFilterTermsToString(const QString& string)
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.h

    r82968 r88728  
    6161public slots:
    6262
    63     /** Applies filter settings and filters the current log-page.
    64       * @param  iCurrentIndex  Specifies index of current log-page, but it is actually not used in the method. */
    65     void applyFilter(const int iCurrentIndex = 0);
     63    /** Applies filter settings and filters the current log-page. */
     64    void applyFilter();
    6665
    6766protected:
     
    9796    bool applyFilterTermsToString(const QString& string);
    9897    void filter();
     98    /** Revert the document to original. */
     99    void resetFiltering();
    99100
    100101    QLabel              *m_pFilterLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r88707 r88728  
    400400}
    401401
    402 void UIVMLogViewerWidget::sltTabIndexChange(int tabIndex)
     402void UIVMLogViewerWidget::sltCurrentTabChanged(int tabIndex)
    403403{
    404404    Q_UNUSED(tabIndex);
     
    406406    /* Dont refresh the search here as it is refreshed by the filtering mechanism
    407407       which is updated as tab current index changes: */
     408    if (m_pFilterPanel)
     409        m_pFilterPanel->applyFilter();
    408410
    409411    /* We keep a separate QVector<LogBookmark> for each log page: */
     
    586588            /* Add into layout: */
    587589            m_pMainLayout->addWidget(m_pTabWidget);
     590            connect(m_pTabWidget, &QITabWidget::currentChanged, this, &UIVMLogViewerWidget::sltCurrentTabChanged);
    588591#if 0
    589592            m_pCornerButton = new QIToolButton(m_pTabWidget);
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r88702 r88728  
    119119    void sltHandleSearchUpdated();
    120120    /** Handles the tab change of the logviewer. */
    121     void sltTabIndexChange(int tabIndex);
     121    void sltCurrentTabChanged(int tabIndex);
    122122    /* if @a isOriginal true than the result of the filtering is equal to
    123123       the original log file for some reason. */
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