VirtualBox

Changeset 77087 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 31, 2019 7:05:53 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128540
Message:

FE/Qt: bugref:9072 RIP 'filtered' watermarking.

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

Legend:

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

    r77078 r77087  
    162162    }
    163163    m_iSearchPosition = -1;
     164    m_iMatchCount = 0;
     165    emit sigSearchUpdated();
    164166    clearHighlighting();
    165167}
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp

    r77078 r77087  
    224224    setWrapLines(false);
    225225    setReadOnly(true);
    226     setBackground();
    227226}
    228227
     
    314313}
    315314
    316 void UIVMLogViewerTextEdit::setBackground()
    317 {
    318     /* Prepare modified standard palette: */
    319     QPalette pal = style() ? style()->standardPalette() : palette(); // fallback if no style exist.
    320     pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Active, QPalette::Highlight));
    321     pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
    322 
    323     /* Paint a string to the background of the text edit to indicate that
    324        the text has been filtered */
    325     if (m_bShownTextIsFiltered)
    326     {
    327         /* For 100% scale PM_LargeIconSize is 32px, and since we want ~300x~100 pixmap we take it 9x3: */
    328         const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
    329         int imageW = 8 * iIconMetric;
    330         int imageH = 8 * iIconMetric;
    331         QImage image(imageW, imageH, QImage::Format_ARGB32_Premultiplied);
    332         QColor fillColor(QPalette::Light);
    333         fillColor.setAlpha(0);
    334         image.fill(fillColor);
    335         QPainter painter(&image);
    336         painter.translate(0.5 * imageW, 0.5 * imageH);
    337         painter.rotate(-45);
    338 
    339         /* Configure the font size and color: */
    340         QFont pfont = painter.font();
    341         QColor fontColor(QPalette::Dark);
    342         fontColor.setAlpha(22);
    343         painter.setPen(fontColor);
    344         pfont.setBold(true);
    345         pfont.setPixelSize(48);
    346         painter.setFont(pfont);
    347         QRect textRect(- 0.5 * imageW, - 0.5 * imageH, imageW, imageH);
    348         painter.drawText(textRect, Qt::AlignCenter | Qt::AlignVCenter, m_strBackgroungText);
    349 
    350         pal.setBrush(QPalette::Base, QBrush(image));
    351     }
    352 
    353     /* Apply palette changes finally: */
    354     setPalette(pal);
    355 }
    356 
    357315void UIVMLogViewerTextEdit::contextMenuEvent(QContextMenuEvent *pEvent)
    358316{
     
    423381
    424382    /** Draw an overlay with text in it to show the number of search matches: */
    425     if (viewport() && m_fShowSearchResultOverlay)
     383    if (viewport() && (m_fShowSearchResultOverlay || m_bShownTextIsFiltered))
    426384    {
    427385        QPainter painter(viewport());
     
    430388        rectColor.setAlpha(200);
    431389
    432         QString strText = QString("%1 %2").arg(QString::number(m_iMatchCount)).arg(UIVMLogViewerWidget::tr("Matches Found"));
     390        QString strText;
     391        if (m_fShowSearchResultOverlay)
     392            strText = QString("%1 %2").arg(QString::number(m_iMatchCount)).arg(UIVMLogViewerWidget::tr("Matches Found"));
     393        if (m_bShownTextIsFiltered)
     394        {
     395            if (!strText.isEmpty())
     396                strText.append(" / ");
     397            strText.append(UIVMLogViewerWidget::tr("Filtered"));
     398        }
    433399        /** Space between the text and rectangle border. */
    434400        QSize textMargin(5, 5);
     
    563529        return;
    564530    m_bShownTextIsFiltered = warning;
    565     setBackground();
     531    if (viewport())
     532        viewport()->repaint();
    566533}
    567534
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.h

    r77078 r77087  
    9797    /** If bookmark exists this function removes it, if not it adds the bookmark. */
    9898    void toggleBookmark(const QPair<int, QString>& bookmark);
    99     void setBackground();
    10099
    101100    /** Line number and text at the context menu position */
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