OSSP CVS Repository

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

Check-in Number: 3876
Date: 2002-Dec-14 00:42:37 (local)
2002-Dec-13 23:42:37 (UTC)
User:ms
Branch:
Comment: Smooth out transition from closed to open document state, and add placeholding pixmap. Fixed row add and paste logic to include initialization and validation. Implement cut and past of user data. Fix cut and paste line feed bug. Disable edit controls until first document is created.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/TODO      1.42 -> 1.43     2 inserted, 0 deleted
ossp-pkg/as/as-gui/as_assist.cpp      1.67 -> 1.68     5 inserted, 1 deleted
ossp-pkg/as/as-gui/as_dataop.cpp      1.21 -> 1.22     7 inserted, 6 deleted
ossp-pkg/as/as-gui/as_gui.h      1.53 -> 1.54     0 inserted, 1 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.60 -> 1.61     95 inserted, 24 deleted

ossp-pkg/as/as-gui/TODO 1.42 -> 1.43

--- TODO 2002/12/13 17:44:42     1.42
+++ TODO 2002/12/13 23:42:37     1.43
@@ -42,6 +42,8 @@
 Make edit control window dockable anywhere
 Give configure a location to place and look for conf file
 Add customizable column ordering by click and drag
+Add new data fields to getRowdata() and setRowdata()
+Vor darueberknallen ein Datei, gib mal ne Warning
 
 Beim Editmodus
 ---------------


ossp-pkg/as/as-gui/as_assist.cpp 1.67 -> 1.68

--- as_assist.cpp        2002/12/13 21:25:32     1.67
+++ as_assist.cpp        2002/12/13 23:42:37     1.68
@@ -71,6 +71,7 @@
 #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[]
+#include "as_gfx/statvoid.xpm"  // static const char *s_kpcStatvoid_xpm[]
 
 
 //
@@ -481,6 +482,7 @@
         throw Genexcept("Main window table creation failed.");
     m_pMaintable->setNumCols(TITRAQ_IDXTAIL);
     m_pMaintable->setReadOnly(true);                    // Table is read only
+    m_pMaintable->setEnabled(false);                    // Table starts disabled
     m_pMaintable->setColumnMovingEnabled(false);        // Ctrl-drag disabled
     m_pMaintable->setSelectionMode(QTable::MultiRow);   // Multi row selection
     m_pMaintable->setCurrentCell(-1, 0);                // Initial row value -1
@@ -491,7 +493,7 @@
     m_pMaintable->horizontalHeader()->setClickEnabled(true); // Allow click signals
     m_pMaintable->horizontalHeader()->setTracking(false); // No continuous tracking
     m_pMaintable->setColumnStretchable(TITRAQ_IDXTAIL - 1, true);
-    m_pMaintable->setSorting(false);
+    m_pMaintable->setSorting(true);
 
     // Table header row
     m_pTablehead = m_pMaintable->horizontalHeader();
@@ -548,6 +550,8 @@
     m_pStatusedit = new QLabel(m_pCenframe, "Status");
     if (m_pStatusedit == NULL) // Sanity check
         throw Genexcept("Main window status edit creation failed.");
+    m_pStatusedit->setPixmap(QPixmap(s_kpcStatvoid_xpm));   // Placeholder
+
     QToolTip::add(m_pStatusedit, trUtf8("Status Item"));
     m_pEditlayout->addWidget(m_pStatusedit);  // Finally add the item status edit
 


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

--- as_dataop.cpp        2002/12/13 20:50:18     1.21
+++ as_dataop.cpp        2002/12/13 23:42:37     1.22
@@ -295,10 +295,10 @@
     // Calculate rows to delete from selection highlight
     for (int nIter = 0; nIter < nTotal; ++nIter) {
         // Build the row data string one field at a time, adding seps inbetween
+        Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER);
+        Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
         Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE);
         Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
-    //    Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER);
-    //    Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
         Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART);
         Rowdata += trUtf8(TITRAQ_SEPARATORTOK);
         Rowdata += m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH);
@@ -322,18 +322,18 @@
     int nRows = Rowdata.contains(QChar('\n'));          // Set so many rows
     int nCurrentrow = m_pMaintable->currentRow();       // Current table row
     QTableItem *pItem = NULL;                           // Old item to change out
-    QString Date, Start, Finish, Amount, Task, Remark;  // Text fields in table
+    QString User;                                       // Admin fields in table
+    QString Date, Start, Finish, Amount, Task, Remark;  // Viewable fields in table
     QTextStream Datastream(&Rowdata, IO_ReadOnly);      // Convert data to stream
 
     for (int nIter = 0; nIter < nRows; ++nIter) {
-        Datastream >> Date >> Start;                    // Stream data fields
+        Datastream >> User >> Date >> Start;            // Stream data fields
         Datastream >> Finish >> Amount >> Task;         // to corresponding vars
-        Datastream.skipWhiteSpace();                    // Remove whitespaces
         Remark = Datastream.readLine();                 // Remark is a whole line
 
         // Set the table row data one field at a time, skipping seps inbetween
+        m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXUSER, User);
         m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXDATE, Date);
-//        m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXUSER, User);
         m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXSTART, Start);
         m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXFINISH, Finish);
         m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXAMOUNT, Amount);
@@ -350,6 +350,7 @@
         m_pMaintable->setItem(nCurrentrow + nIter, TITRAQ_IDXTASK, new RtTableItem(m_pMaintable, QTableItem::WhenCurrent, Task));
 
         // Continue with field processing business as usual
+        Remark.simplifyWhiteSpace(); // First get rid of and simplify whitespace
         m_pMaintable->setText(nCurrentrow + nIter, TITRAQ_IDXREMARK, Remark);
     }
 }


ossp-pkg/as/as-gui/as_gui.h 1.53 -> 1.54

--- as_gui.h     2002/12/13 21:25:32     1.53
+++ as_gui.h     2002/12/13 23:42:37     1.54
@@ -138,7 +138,6 @@
     void validateData(int, int);        // Validate one row of matrix data
     void updSizes(int, int, int);       // Update edit sizes
     void dataChanged(void);             // Timesheet data changed
-    void updateStatus(const QString &); // Update status column
     void updateLine(const QString &);   // Update line number column
     void updateUser(const QString &);   // Update user column
     void updateGuid(const QString &);   // Update GUID column


ossp-pkg/as/as-gui/as_slot.cpp 1.60 -> 1.61

--- as_slot.cpp  2002/12/13 21:25:32     1.60
+++ as_slot.cpp  2002/12/13 23:42:37     1.61
@@ -85,12 +85,18 @@
     QString Selection;          // Will receive the clipboard text
     QClipboard *pClip;          // Will reference the global clipboard
 
-    Selection = pClip->text(QClipboard::Clipboard); // Windows and Unix
-    nRows = Selection.contains(QChar('\n'));        // How many rows
-    this->addEntry(nRows);                          // Reuse slot
+    // Optimize viewing by repainting cells only once after processing
+    m_pMaintable->setUpdatesEnabled(false);
 
-    if (Selection)
+    if (Selection = pClip->text(QClipboard::Clipboard)) { // Windows and Unix
+        nRows = Selection.contains(QChar('\n'));    // How many rows
+        this->addEntry(nRows);                      // Reuse slot
         setRowdata(Selection);                      // Use accessor
+        for (int nIter = 0; nIter <= nRows; nIter++)
+            this->validateData(m_pMaintable->currentRow() + nIter, 0);
+    }
+
+    m_pMaintable->setUpdatesEnabled(true);          // Update and repaint
 }
 
 //
@@ -102,34 +108,62 @@
     int nTotal = 0;         // Total row select
     int nCurrent = 0;       // Current row
 
+    // Decide how many rows to add
     Select = m_pMaintable->selection(0);
-    nTotal = Select.bottomRow() - Select.topRow() + 1;
+    if (nRows > 0)
+        nTotal = nRows;
+    else
+        nTotal = Select.bottomRow() - Select.topRow() + 1;
+
+    // Optimize viewing by repainting cells only once after processing
+    m_pMaintable->setUpdatesEnabled(false);
+
     // Add a row after selection and focus to the new row
     if (Select.bottomRow() + 1 != m_pMaintable->numRows()) { // Add upwards
         m_pMaintable->insertRows(Select.topRow(), nTotal);
         this->setDirty();   // Set data to dirty state
         m_pMaintable->setCurrentCell(Select.topRow(), m_pMaintable->currentColumn());
+
+        // Update relevant data fields for all new rows
+        for (int nIter = 0; nIter < nTotal; nIter++) {
+            m_pMaintable->setPixmap(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm));
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, ".");
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, ".");
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, ".");
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, trUtf8(TITRAQ_DATEZERO));
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTART, "00:00");
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXFINISH, "00:00");
+            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXAMOUNT, "00:00");
+//            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXTASK, "/");
+//            m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREMARK, "Remark");
+        }
     }
     else { // Special case on last row add downwards
         m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal);
         this->setDirty();   // Set data to dirty state
         m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn());
         m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please
+
+        // Update relevant data fields for all new rows
+        for (int nIter = 1; nIter <= nTotal; nIter++) {
+            m_pMaintable->setPixmap(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm));
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER));
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, ".");
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, ".");
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, ".");
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, trUtf8(TITRAQ_DATEZERO));
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTART, "00:00");
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXFINISH, "00:00");
+            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXAMOUNT, "00:00");
+//            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXTASK, "/");
+//            m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREMARK, "Remark");
+        }
     }
 
     // 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(".");
-    updateRev(".");
-
-    updateDate(*m_pDatezero);
-    updateStart(QTime::QTime(0, 0));
-    updateFinish(QTime::QTime(0, 0));
-    updateAmount(trUtf8("00:00"));
+        m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0')));
 
 //    char szGuitext[37];
 //    uuid_t Guid;
@@ -137,6 +171,9 @@
 //    uuid_generate(Guid);
 //    uuid_unparse(Guid, szGuitext);
 //    m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXGUID, szGuitext);
+
+    m_pMaintable->setUpdatesEnabled(true);          // Turn updates back on
+    m_pMaintable->repaintContents(false);           // Repaint viewport
 }
 
 //
@@ -193,6 +230,7 @@
             m_pTasks->setCurrentText(NULL);
             m_pRemark->setText(NULL);
 
+            m_pMaintable->setEnabled(true); // Enable the table first
             m_pMaintable->setNumRows(0);    // Remove all data in table
             m_pLineedit->setEnabled(true);
             m_pUseredit->setEnabled(true);
@@ -205,9 +243,11 @@
             m_pAmount->setEnabled(true);
             m_pTasks->setEnabled(true);
             m_pRemark->setEnabled(true);
+            this->updEdit(0, 0);            // Reset edit controls
             this->setDirty(false);          // Reset data to clean state
             break;
         case 1: // Second button selected, so don't save first but do new
+            m_pMaintable->setEnabled(true); // Enable the table first
             m_pMaintable->setNumRows(0);    // Remove all data in table
             m_pLineedit->setEnabled(true);
             m_pUseredit->setEnabled(true);
@@ -220,6 +260,7 @@
             m_pAmount->setEnabled(true);
             m_pTasks->setEnabled(true);
             m_pRemark->setEnabled(true);
+            this->updEdit(0, 0);            // Reset edit controls
             this->setDirty(false);          // Reset data to clean state
             break;
         case 2: // Third button selected, so don't do a new timesheet
@@ -235,6 +276,7 @@
         m_pAmount->setText(NULL);
         m_pTasks->setCurrentText(NULL);
         m_pRemark->setText(NULL);
+        m_pMaintable->setEnabled(true);     // Enable the table first
         m_pMaintable->setNumRows(0);        // Remove all data in table
         m_pLineedit->setEnabled(true);
         m_pUseredit->setEnabled(true);
@@ -247,6 +289,7 @@
         m_pAmount->setEnabled(true);
         m_pTasks->setEnabled(true);
         m_pRemark->setEnabled(true);
+        this->updEdit(0, 0);                // Reset edit controls
         this->setDirty(false);              // Reset data to clean state
     }
 }
@@ -281,6 +324,18 @@
                 // Reset and give output to main window
                 this->setCaption(Filestring);
                 m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000);
+                m_pMaintable->setEnabled(true); // Enable the table first
+                m_pLineedit->setEnabled(true);
+                m_pUseredit->setEnabled(true);
+                m_pGuidedit->setEnabled(true);
+                m_pCrcedit->setEnabled(true);
+                m_pRevedit->setEnabled(true);
+                m_pDateedit->setEnabled(true);
+                m_pStarttime->setEnabled(true);
+                m_pEndtime->setEnabled(true);
+                m_pAmount->setEnabled(true);
+                m_pTasks->setEnabled(true);
+                m_pRemark->setEnabled(true);
                 this->setDirty(false);          // Set the clean state
                 break;
             case 1: // Don't save first but do load
@@ -295,6 +350,18 @@
                 // Reset and give output to main window
                 this->setCaption(Filestring);
                 m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000);
+                m_pMaintable->setEnabled(true); // Enable the table first
+                m_pLineedit->setEnabled(true);
+                m_pUseredit->setEnabled(true);
+                m_pGuidedit->setEnabled(true);
+                m_pCrcedit->setEnabled(true);
+                m_pRevedit->setEnabled(true);
+                m_pDateedit->setEnabled(true);
+                m_pStarttime->setEnabled(true);
+                m_pEndtime->setEnabled(true);
+                m_pAmount->setEnabled(true);
+                m_pTasks->setEnabled(true);
+                m_pRemark->setEnabled(true);
                 this->setDirty(false);          // Set the clean state
                 break;
             case 2: // Don't do a load timesheet
@@ -314,6 +381,18 @@
             // Reset and give output to main window
             this->setCaption(Filestring);
             m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000);
+            m_pMaintable->setEnabled(true); // Enable the table first
+            m_pLineedit->setEnabled(true);
+            m_pUseredit->setEnabled(true);
+            m_pGuidedit->setEnabled(true);
+            m_pCrcedit->setEnabled(true);
+            m_pRevedit->setEnabled(true);
+            m_pDateedit->setEnabled(true);
+            m_pStarttime->setEnabled(true);
+            m_pEndtime->setEnabled(true);
+            m_pAmount->setEnabled(true);
+            m_pTasks->setEnabled(true);
+            m_pRemark->setEnabled(true);
             this->setDirty(false);          // Set the clean state
         }
     }
@@ -626,14 +705,6 @@
 }
 
 //
-// Update the current status column item
-//
-void Titraqform::updateStatus(const QString &Instring)
-{
-    m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXSTATUS, Instring);
-}
-
-//
 // Update the current line number column item
 //
 void Titraqform::updateLine(const QString &Instring)

CVSTrac 2.0.1