https://bugs.kde.org/show_bug.cgi?id=410934

James Nelson <cs_h...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cs_h...@hotmail.com

--- Comment #5 from James Nelson <cs_h...@hotmail.com> ---
I have this bug too and wanted to add some info, but I don't have much of a dev
environment nor any experience with patching. I'm just using Dolphin and KDE
pretty regularly. (Dolphin 19.08.1, frameworks 5.61.0, Qt 5.13.1 built against
5.13.0)

In Dolphin, the font color for text file thumbnails/previews is always this
one:

[System Settings] -> [Colors] -> [in selection: Edit Color Scheme...] -> [Color
Set: "View"] -> "Normal Text"
or
... [Edit Color Scheme...] -> Common Colors -> "View Text"


In code, I found a light background for the previews/thumbnails of all text
files:
https://cgit.kde.org/kio-extras.git/tree/thumbnail/textcreator.cpp
lines 143 & 144:

  QColor bgColor = QColor ( 245, 245, 245 ); // light-grey background
  m_pixmap.fill( bgColor );


Seems this will affect both the preview panel, and the main view's
preview-enabled thumbnails. 

If we change textcreator.cpp to have a explicitly black/dark-colors font, then
rebuild, does that fix the problem? Can somebody please try this?


More detail of how I was looking for this, tracing up from
Dolphin->[kio]->[kio-extras]:

• [dolphin]/src/panels/information/informationpanelapplet.cpp

  connect(m_previewJob.data(), &KIO::PreviewJob::gotPreview,
          this, &InformationPanelContent::showPreview);

• [kio]/src/widgets/previewjob.cpp

  void PreviewJobPrivate::emitPreview(const QImage &thumb)
  {
[...]
          pix = QPixmap::fromImage(thumb);
      }
      emit q->gotPreview(currentItem.item, pix);
  }

• looking for anything that would affect the pixmap, or QPixmap, that
PreviewJob needs by streaming text into it:

• [kio-extras]/thumbnail/textcreator.cpp
72  bool TextCreator::create(const QString &path, int width, int height, QImage
&img)
73  {
...
113    // create text-preview
114    QFile file( path );
...
143            QColor bgColor = QColor ( 245, 245, 245 ); // light-grey
background
144            m_pixmap.fill( bgColor );
145
146            QPainter painter( &m_pixmap );
147
148            QTextDocument textDocument(text);
...
172            textDocument.drawContents(&painter, QRectF(QPointF(0, 0),
canvasSize));
...
176            img = m_pixmap.toImage();
...
179        file.close();
...
182 }

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to