OSSP CVS Repository

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

Check-in Number: 3874
Date: 2002-Dec-13 21:50:18 (local)
2002-Dec-13 20:50:18 (UTC)
User:ms
Branch:
Comment: Implemented basic validation logic, reflected by pixmaps in both table and edit control.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_assist.cpp      1.65 -> 1.66     6 inserted, 7 deleted
ossp-pkg/as/as-gui/as_dataop.cpp      1.20 -> 1.21     5 inserted, 0 deleted
ossp-pkg/as/as-gui/as_gui.h      1.51 -> 1.52     4 inserted, 1 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.58 -> 1.59     52 inserted, 1 deleted

ossp-pkg/as/as-gui/as_assist.cpp 1.65 -> 1.66

--- as_assist.cpp        2002/12/13 17:44:42     1.65
+++ as_assist.cpp        2002/12/13 20:50:18     1.66
@@ -68,6 +68,9 @@
 #include "as_gfx/rowdel.xpm"    // static const char *s_kpcRowdel_xpm[]
 #include "as_gfx/osspicon.xpm"  // static const char *s_kpcOsspicon_xpm[]
 #include "as_gfx/whatsthis.xpm" // static const char *s_kpcWhatsthis_xpm[]
+#include "as_gfx/statok.xpm"    // static const char *s_kpcStatokay_xpm[]
+#include "as_gfx/staterr.xpm"   // static const char *s_kpcStaterror_xpm[]
+#include "as_gfx/statwrn.xpm"   // static const char *s_kpcStatwarn_xpm[]
 
 
 //
@@ -526,6 +529,7 @@
 
     // Table update signals
     connect(m_pMaintable, SIGNAL(currentChanged(int, int)), this, SLOT(updEdit(int, int)));
+    connect(m_pMaintable, SIGNAL(currentChanged(int, int)), this, SLOT(validateData(int, int)));
     connect(m_pMaintable, SIGNAL(doubleClicked(int, int, int, const QPoint&)), this, SLOT(inplaceEdit(int, int, int, const QPoint&)));
     connect(m_pTablehead, SIGNAL(sizeChange(int, int, int)), this, SLOT(updSizes(int, int, int)));
     connect(m_pMaintable, SIGNAL(valueChanged(int, int)), this, SLOT(dataChanged(void)));
@@ -541,14 +545,10 @@
 //    m_pEditlayout->addWidget(&Pad); // Padd left side of control layout
 
     // Make the status edit
-    m_pStatusedit = new QLineEdit(m_pCenframe, "Status");
+    m_pStatusedit = new QLabel(m_pCenframe, "Status");
     if (m_pStatusedit == NULL) // Sanity check
         throw Genexcept("Main window status edit creation failed.");
-    m_pStatusedit->setText(trUtf8("0"));
-    m_pStatusedit->setFrameShape(QLineEdit::LineEditPanel);
-    m_pStatusedit->setFrameShadow(QLineEdit::Sunken);
-    m_pStatusedit->setFrame(true);
-    m_pStatusedit->setReadOnly(true);
+    m_pStatusedit->setPixmap(QPixmap(s_kpcStatwarn_xpm));
     QToolTip::add(m_pStatusedit, trUtf8("Status Item"));
     m_pEditlayout->addWidget(m_pStatusedit);  // Finally add the item status edit
 
@@ -783,7 +783,6 @@
     this->updSizes(TITRAQ_IDXALLCTRLS, -1, -1);
 
     // Signals sent between table cells and corresponding edit control widgets
-    connect(m_pStatusedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateStatus(const QString &)));
     connect(m_pLineedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateLine(const QString &)));
     connect(m_pUseredit, SIGNAL(textChanged(const QString &)), this, SLOT(updateUser(const QString &)));
     connect(m_pGuidedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateGuid(const QString &)));


ossp-pkg/as/as-gui/as_dataop.cpp 1.20 -> 1.21

--- as_dataop.cpp        2002/12/13 11:46:38     1.20
+++ as_dataop.cpp        2002/12/13 20:50:18     1.21
@@ -228,6 +228,9 @@
     QString Strsearch;                              // String to strip search
     QRegExp Stripper("\\s*$");                      // Pattern to strip off
 
+    // Optimize viewing by repainting cells only once after processing
+    m_pMaintable->setUpdatesEnabled(false);
+
     // Linewise save from the main table date, time, account, and others
     for (int nIter = 0; nIter < nRows; nIter++) {
         Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXUSER);      // Load user field text
@@ -276,6 +279,8 @@
 
         Tstream << endl;                                            // Append a newline
     }
+
+    m_pMaintable->setUpdatesEnabled(true); // Update and repaint
 }
 
 //


ossp-pkg/as/as-gui/as_gui.h 1.51 -> 1.52

--- as_gui.h     2002/12/12 16:20:15     1.51
+++ as_gui.h     2002/12/13 20:50:18     1.52
@@ -41,6 +41,7 @@
 #include <qstatusbar.h>
 #include <qimage.h>
 #include <qdatetimeedit.h>
+#include <qlabel.h>
 #include <qspinbox.h>
 #include <qlineedit.h>
 #include <qpushbutton.h>
@@ -104,7 +105,7 @@
 
     // Edition widgets
     QDate       *m_pDatezero;           // Hack to store empty date
-    QLineEdit   *m_pStatusedit;         // Control to show entry status
+    QLabel      *m_pStatusedit;         // Control to show entry status
     QLineEdit   *m_pLineedit;           // Control to line number
     QLineEdit   *m_pUseredit;           // Control to edit user name
     QLineEdit   *m_pGuidedit;           // Control to edit GUID
@@ -134,6 +135,8 @@
     void selAll(void);                  // Edit menu select all
     void inplaceEdit(int, int, int, const QPoint &); // Enter in place edit mode
     void updEdit(int, int);             // Update edit controls
+    void validateData(int, int);        // Validate one row of matrix data
+    void validateData(void);            // Validation overloaded convenience method
     void updSizes(int, int, int);       // Update edit sizes
     void dataChanged(void);             // Timesheet data changed
     void updateStatus(const QString &); // Update status column


ossp-pkg/as/as-gui/as_slot.cpp 1.58 -> 1.59

--- as_slot.cpp  2002/12/13 18:55:09     1.58
+++ as_slot.cpp  2002/12/13 20:50:18     1.59
@@ -45,6 +45,9 @@
 // Icon pixel maps
 #include "as_gfx/cwlogo.xpm"    // static const char *s_kpcCwlogo_xpm[]
 #include "as_gfx/ossplogo.xpm"  // static const char *s_kpcOssplogo_xpm[]
+#include "as_gfx/statok.xpm"    // static const char *s_kpcStatokay_xpm[]
+#include "as_gfx/staterr.xpm"   // static const char *s_kpcStaterror_xpm[]
+#include "as_gfx/statwrn.xpm"   // static const char *s_kpcStatwarn_xpm[]
 
 
 //
@@ -114,6 +117,10 @@
         m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please
     }
 
+    // Update line numbers for this new row and all subsequent rows
+    for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++)
+        m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter));
+
     updateUser(m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
     updateGuid(".");
     updateCrc(".");
@@ -155,6 +162,10 @@
         m_pMaintable->removeRows(Rowselect);
         this->setDirty();   // Set data to dirty state
     }
+
+    // Update line numbers for this new row and all subsequent rows
+    for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++)
+        m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter));
 }
 
 //
@@ -520,7 +531,7 @@
     m_pMaintable->setEdition();
 
     // Set text of member edit controls
-    m_pStatusedit->setText(Textstat);
+    m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, nCol));
     m_pLineedit->setText(Textline);
     m_pUseredit->setText(Textuser);
     m_pGuidedit->setText(Textguid);
@@ -548,6 +559,46 @@
 }
 
 //
+// Validate one row of matrix data
+//
+void Titraqform::validateData(int nRow, int nCol)
+{
+    // Field strings to check for validity and process
+    QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS));
+    QString Textline(m_pMaintable->text(nRow, TITRAQ_IDXLINE));
+    QString Textuser(m_pMaintable->text(nRow, TITRAQ_IDXUSER));
+    QString Textguid(m_pMaintable->text(nRow, TITRAQ_IDXGUID));
+    QString Textcrc(m_pMaintable->text(nRow, TITRAQ_IDXCRC));
+    QString Textrev(m_pMaintable->text(nRow, TITRAQ_IDXREV));
+    QString Textdate(m_pMaintable->text(nRow, TITRAQ_IDXDATE));
+    QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXSTART));
+    QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXFINISH));
+    QString Textamount(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT));
+    QString Texttask(m_pMaintable->text(nRow, TITRAQ_IDXTASK));
+    QString Textremark(m_pMaintable->text(nRow, TITRAQ_IDXREMARK));
+
+    // Quick review of data validity, and set pixmaps accordingly
+    if (Textuser.isEmpty() || Textguid.isEmpty() || Textcrc.isEmpty() ||
+        Textrev.isEmpty() || Textdate.isEmpty() || Textstart.isEmpty() ||
+        Textfinish.isEmpty() || Textamount.isEmpty() || Texttask.isEmpty()) {
+        m_pStatusedit->setPixmap(QPixmap(s_kpcStaterror_xpm));
+        m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm));
+    }
+    else {
+        m_pStatusedit->setPixmap(QPixmap(s_kpcStatokay_xpm));
+        m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm));
+    }
+}
+
+//
+// Validation overloaded convenience method
+//
+void Titraqform::validateData(void)
+{
+    validateData(m_pMaintable->currentRow(), 0);
+}
+
+//
 // Update the current status column item
 //
 void Titraqform::updateStatus(const QString &Instring)

CVSTrac 2.0.1