OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_table.cpp versions 1.16 and 1.17
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_table.cpp 1.16 -> 1.17

--- as_table.cpp 2002/12/17 16:55:08     1.16
+++ as_table.cpp 2002/12/18 14:50:58     1.17
@@ -106,7 +106,7 @@
         // If a cell was edited, emit a signal indicating so
         // We can't rely on valueChanged for unknown reasons
         if (nText != this->text(nRow, nCol) && nCol != TITRAQ_IDXLINE)
-            emit textEdited();
+            emit textEdited(nRow, nCol);
 
         QTable::setText(nRow, nCol, nText);
     }
@@ -133,11 +133,36 @@
     QString Cur = this->text(nRow, this->getSortcol());
     QString Las = this->text(nRow - 1, this->getSortcol());
 
-    // Set the base color conditionally
-    if (!Cur.isNull() && !Las.isNull() && Cur == Las)
-        Cgroup.setColor(QColorGroup::Base, QColor(248, 248, 240));
-    else
-        Cgroup.setColor(QColorGroup::Base, QColor(232, 232, 224));
+    // A nice cascade of conditions providing a linewise base color test and set
+    // The algorythm:
+    //   1  Determine if the current row's index key differs from the former one
+    //   2a If they are the same, then current row should have the same color
+    //   2b If they are different, then current row should have an alt color
+    //   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
+            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
+            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
+            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
+            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)));
+        }
+    }
 
     QTable::paintCell(pPainter, nRow, nCol, Recto, bSelect, Cgroup);
 };

CVSTrac 2.0.1