[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Increase effect of file highlight in Kate's file list
From:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2007-12-28 19:34:35
Message-ID: fl3j4d$3cp$1 () ger ! gmane ! org
[Download RAW message or body]

I've been sitting on this a while, besides making the tint stronger, it 
makes this codepath IMO a bit cleaner. Thoughts? Can I commit this?

Index: app/kateviewdocumentproxymodel.cpp
===================================================================
--- app/kateviewdocumentproxymodel.cpp  (revision 753890)
+++ app/kateviewdocumentproxymodel.cpp  (working copy)
@@ -27,15 +27,15 @@
  #include "katedocmanager.h"

  #include <KColorScheme>
+#include <KColorUtils>
  #include <KConfigGroup>
  #include <KGlobal>
+#include <KDebug>

  #include <QColor>
  #include <QBrush>
  #include <QPalette>

-#include <kdebug.h>
-
  KateViewDocumentProxyModel::KateViewDocumentProxyModel(QObject *parent)
    : QAbstractProxyModel(parent)
    , m_selection(new QItemSelectionModel(this, this))
@@ -240,7 +240,6 @@
    {
      QColor shade( m_viewShade );
      QColor eshade( m_editShade );
-    QColor b = QPalette().color(QPalette::Base);
      if (it.value().edit > 0)
      {
        int v = hc - it.value().view;
@@ -255,13 +254,8 @@
      }
      // blend in the shade color.
      // max transperancy < .5, latest is most colored.
-    float t = (0.5 / hc) * (hc - it.value().view + 1);
-    b.setRgb(
-      (int)((b.red()*(1 - t)) + (shade.red()*t)),
-      (int)((b.green()*(1 - t)) + (shade.green()*t)),
-      (int)((b.blue()*(1 - t)) + (shade.blue()*t))
-    );
-    m_brushes[it.key()] = QBrush(b);
+    double t = double(hc - it.value().view + 1) / double(hc);
+    m_brushes[it.key()] = 
QBrush(KColorUtils::mix(QPalette().color(QPalette::Base), shade, t));
    }
    foreach(const QModelIndex & key, m_brushes.keys())
    {


-- 
Matthew
Don't read this. What did I just tell you? Why are you still reading?

_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic