OSSP CVS Repository

ossp - Check-in [4069]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4069
Date: 2003-Feb-21 11:12:02 (local)
2003-Feb-21 10:12:02 (UTC)
User:ms
Branch:
Comment: Reluctantly added Preferences class coupling, because we need to read the row shading colour dynamically.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_table.cpp      1.22 -> 1.23     14 inserted, 4 deleted
ossp-pkg/as/as-gui/as_table.h      1.14 -> 1.15     5 inserted, 1 deleted

ossp-pkg/as/as-gui/as_table.cpp 1.22 -> 1.23

--- as_table.cpp 2003/02/14 19:27:03     1.22
+++ as_table.cpp 2003/02/21 10:12:02     1.23
@@ -145,6 +145,16 @@
 void TiTable::paintCell(QPainter *pPainter, int nRow, int nCol, const QRect &Recto, bool bSelect, const QColorGroup &Colgroup)
 {
     QColorGroup Cgroup(Colgroup);
+    int nRed, nGreen, nBlue;
+
+    nRed = m_pTiprefs->getNumber(TITRAQ_PREFLIGHTRED, TITRAQ_DEFLIGHTRED);
+    nGreen = m_pTiprefs->getNumber(TITRAQ_PREFLIGHTGREEN, TITRAQ_DEFLIGHTGREEN);
+    nBlue = m_pTiprefs->getNumber(TITRAQ_PREFLIGHTBLUE, TITRAQ_DEFLIGHTBLUE);
+    QColor Bright = QColor(nRed, nGreen, nBlue);
+    nRed = m_pTiprefs->getNumber(TITRAQ_PREFDARKRED, TITRAQ_DEFDARKRED);
+    nGreen = m_pTiprefs->getNumber(TITRAQ_PREFDARKGREEN, TITRAQ_DEFDARKGREEN);
+    nBlue = m_pTiprefs->getNumber(TITRAQ_PREFDARKBLUE, TITRAQ_DEFDARKBLUE);
+    QColor Dark = QColor(nRed, nGreen, nBlue);
 
     // Alternate color for nonmatching sort keys
     QString Cur = this->text(nRow, this->getSortcol());
@@ -158,24 +168,24 @@
     //   3  Store information about which color we chose for the current row
     if (!Cur.isNull() && !Las.isNull() && Cur == Las) { // Set the base color conditionally
         if (this->text(nRow - 1, TITRAQ_IDXSTATUS).at(TITRAQ_IDXSTATCOLOR) == QChar(TITRAQ_BRIGHT)) {
-            Cgroup.setColor(QColorGroup::Base, QColor(248, 248, 240));  // Bright
+            Cgroup.setColor(QColorGroup::Base, Bright); // Bright
             if (this->text(nRow, TITRAQ_IDXSTATUS).at(TITRAQ_IDXSTATCOLOR) != QChar(TITRAQ_BRIGHT))
                 this->setText(nRow, TITRAQ_IDXSTATUS, this->text(nRow, TITRAQ_IDXSTATUS).replace(TITRAQ_IDXSTATCOLOR, sizeof(char), QChar(TITRAQ_BRIGHT)));
         }
         else {
-            Cgroup.setColor(QColorGroup::Base, QColor(224, 224, 216));  // Dark
+            Cgroup.setColor(QColorGroup::Base, Dark);   // Dark
             if (this->text(nRow, TITRAQ_IDXSTATUS).at(TITRAQ_IDXSTATCOLOR) != QChar(TITRAQ_DARK))
                 this->setText(nRow, TITRAQ_IDXSTATUS, this->text(nRow, TITRAQ_IDXSTATUS).replace(TITRAQ_IDXSTATCOLOR, sizeof(char), QChar(TITRAQ_DARK)));
         }
     }
     else {
         if (this->text(nRow - 1, TITRAQ_IDXSTATUS).at(TITRAQ_IDXSTATCOLOR) == QChar(TITRAQ_BRIGHT)) {
-            Cgroup.setColor(QColorGroup::Base, QColor(224, 224, 216));  // Dark
+            Cgroup.setColor(QColorGroup::Base, Dark);   // Dark
             if (this->text(nRow, TITRAQ_IDXSTATUS).at(TITRAQ_IDXSTATCOLOR) != QChar(TITRAQ_DARK))
                 this->setText(nRow, TITRAQ_IDXSTATUS, this->text(nRow, TITRAQ_IDXSTATUS).replace(TITRAQ_IDXSTATCOLOR, sizeof(char), QChar(TITRAQ_DARK)));
         }
         else {
-            Cgroup.setColor(QColorGroup::Base, QColor(248, 248, 240));  // Bright
+            Cgroup.setColor(QColorGroup::Base, Bright); // Bright
             if (this->text(nRow, TITRAQ_IDXSTATUS).at(TITRAQ_IDXSTATCOLOR) != QChar(TITRAQ_BRIGHT))
                 this->setText(nRow, TITRAQ_IDXSTATUS, this->text(nRow, TITRAQ_IDXSTATUS).replace(TITRAQ_IDXSTATCOLOR, sizeof(char), QChar(TITRAQ_BRIGHT)));
         }


ossp-pkg/as/as-gui/as_table.h 1.14 -> 1.15

--- as_table.h   2002/12/20 17:42:10     1.14
+++ as_table.h   2003/02/21 10:12:02     1.15
@@ -34,6 +34,8 @@
 
 #include <qtable.h>
 
+#include "as_pref.h"
+
 
 class TiTable : public QTable
 {
@@ -43,15 +45,17 @@
     int  m_nSortcol;    // To track current sort column
     int  m_bSortdir;    // To track current sort direction
     bool m_bDirt;       // To track dirty and clean states
+    Preferences *m_pTiprefs; // To read current color values
 
 public:
     // Try to match QTable's default constructor with an initializer list
-    TiTable(QWidget *pParent = 0, const char *szName = 0) : QTable(pParent, szName)
+    TiTable(Preferences *pPrefs, QWidget *pParent = 0, const char *szName = 0) : QTable(pParent, szName)
     {
         this->setSortcol(0);
         this->setSortdir(true);
         this->setDirty(false);
         this->setEdition(); // Reset edition state
+        m_pTiprefs = pPrefs;
         horizontalHeader()->installEventFilter(this);
     };
 

CVSTrac 2.0.1