OSSP CVS Repository

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

Check-in Number: 2887
Date: 2002-Nov-25 16:45:04 (local)
2002-Nov-25 15:45:04 (UTC)
User:ms
Branch:
Comment: Add AmountBox class to introduce missing functionality from QSpinBox, and implement most edit control updates.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/Makefile.in      1.16 -> 1.17     2 inserted, 2 deleted
ossp-pkg/as/as-gui/TODO      1.15 -> 1.16     1 inserted, 0 deleted
ossp-pkg/as/as-gui/as_amount.h      added-> 1.1
ossp-pkg/as/as-gui/as_assist.cpp      1.15 -> 1.16     27 inserted, 6 deleted
ossp-pkg/as/as-gui/as_const.h      1.2 -> 1.3     13 inserted, 0 deleted
ossp-pkg/as/as-gui/as_gui.h      1.23 -> 1.24     4 inserted, 3 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.12 -> 1.13     17 inserted, 3 deleted
ossp-pkg/as/as-gui/as_tableitem.h      1.2 -> 1.3     5 inserted, 1 deleted
ossp-pkg/titraq/Makefile.in      1.16 -> 1.17     2 inserted, 2 deleted
ossp-pkg/titraq/TODO      1.15 -> 1.16     1 inserted, 0 deleted
ossp-pkg/titraq/titabitem.h      1.2 -> 1.3     5 inserted, 1 deleted
ossp-pkg/titraq/titamount.h      added-> 1.1
ossp-pkg/titraq/titassist.cpp      1.15 -> 1.16     27 inserted, 6 deleted
ossp-pkg/titraq/titconst.h      1.2 -> 1.3     13 inserted, 0 deleted
ossp-pkg/titraq/titraq.h      1.23 -> 1.24     4 inserted, 3 deleted
ossp-pkg/titraq/titslot.cpp      1.12 -> 1.13     17 inserted, 3 deleted

ossp-pkg/as/as-gui/Makefile.in 1.16 -> 1.17

--- Makefile.in  2002/11/24 18:02:43     1.16
+++ Makefile.in  2002/11/25 15:45:04     1.17
@@ -65,9 +65,9 @@
 TARGET_PROGS    = titraq
 TARGET_MANS     = titraq.1 titraq.conf.5
 
-SRCS            = main.cpp titraq.cpp titassist.cpp titslot.cpp tidatops.cpp titrex.cpp generic.cpp titprefs.cpp titraq_version.c
+SRCS            = main.cpp titraq.cpp titassist.cpp titslot.cpp tidatops.cpp titrex.cpp generic.cpp titamount.cpp titprefs.cpp titraq_version.c
 
-OBJS            = main.o titraq.o titassist.o titslot.o tidatops.o titrex.o generic.o titprefs.o titraq_version.o
+OBJS            = main.o titraq.o titassist.o titslot.o tidatops.o titrex.o generic.o titamount.o titprefs.o titraq_version.o
 
 GRAFX           = gfx/ossplogo.xpm
 


ossp-pkg/as/as-gui/TODO 1.15 -> 1.16

--- TODO 2002/11/25 11:23:35     1.15
+++ TODO 2002/11/25 15:45:05     1.16
@@ -27,6 +27,7 @@
 Review destruction of all members, compare with setupPrefs
 Memory optimization needed in tidataops
 QTable::valueChanged(int row, int col) should be responsible for dirty flag
+Remove magic numbers from cpp files to titconst like TITRAQ_INDEXREMARK
 
 Dreams
 ------


ossp-pkg/as/as-gui/as_amount.h -> 1.1

*** /dev/null    Sat Nov 23 01:16:19 2024
--- -    Sat Nov 23 01:16:29 2024
***************
*** 0 ****
--- 1,15 ----
+ #ifndef AMOUNTBOX_H
+ #define AMOUNTBOX_H
+ 
+ #include <qspinbox.h>
+ 
+ 
+ class AmountBox : public QSpinBox
+ {
+ public:
+     AmountBox(int nMinval, int nMaxval, int nStep = 1, QWidget *pParent = 0, const char *szName = 0) : QSpinBox(nMinval, nMaxval, nStep, pParent, szName) {};
+     void setText(const QString &);  // Sets a text formatted representation
+     QString text(void) const;       // Return a text formatted representation
+ };
+ 
+ #endif // AMOUNTBOX_H


ossp-pkg/as/as-gui/as_assist.cpp 1.15 -> 1.16

--- as_assist.cpp        2002/11/25 11:40:07     1.15
+++ as_assist.cpp        2002/11/25 15:45:06     1.16
@@ -15,8 +15,9 @@
 #include <qcursor.h>
 
 // User interface
-#include "titraq.h"
+#include "titraq.h"             // Main classes
 #include "titrex.h"             // Exception classes
+#include "titamount.h"          // AmountBox class
 
 // Icon pixel maps
 #include "gfx/filenew.xpm"      // static const char *s_kpcFilenew_xpm[]
@@ -345,8 +346,13 @@
     m_pDateedit = new QDateEdit(Sylvestre, m_pCenframe, "Date");
     if (m_pDateedit == NULL)                                        // Sanity check
         throw Genexcept("Main window date edit creation failed.");  // Spew errors
-    m_pDatelayout->addWidget(m_pDateedit);                       // Finally add the date editor
 
+    // Configure attributes
+    m_pDateedit->setOrder(QDateEdit::YMD);
+    m_pDateedit->setAutoAdvance(true);
+    m_pDateedit->setSeparator(trUtf8("."));
+
+    m_pDatelayout->addWidget(m_pDateedit);                       // Finally add the date editor
     QToolTip::add(m_pDateedit, trUtf8("Task Date"));
 
     // Whatsthis info for the date editor
@@ -359,8 +365,11 @@
     m_pStarttime = new QTimeEdit(QTime::currentTime(), m_pCenframe, "StartTime");
     if (m_pStarttime == NULL)                                       // Sanity check
         throw Genexcept("Main window start time creation failed."); // Spew errors
-    m_pDatelayout->addWidget(m_pStarttime);                      // Finally add the start editor
 
+    // Configure attributes
+    m_pStarttime->setAutoAdvance(true);
+
+    m_pDatelayout->addWidget(m_pStarttime);                      // Finally add the start editor
     QToolTip::add(m_pStarttime, trUtf8("Task Starting Time"));
 
     // Whatsthis info for the time editor
@@ -373,8 +382,8 @@
     m_pEndtime = new QTimeEdit(QTime::currentTime(), m_pCenframe, "EndTime");
     if (m_pEndtime == NULL)                                        // Sanity check
         throw Genexcept("Main window end time creation failed.");  // Spew errors
-    m_pDatelayout->addWidget(m_pEndtime);                       // Finally add the end editor
 
+    m_pDatelayout->addWidget(m_pEndtime);                       // Finally add the end editor
     QToolTip::add(m_pEndtime, trUtf8("Task Ending Time"));
 
     // Whatsthis info for the time editor
@@ -384,11 +393,16 @@
     QWhatsThis::add(m_pEndtime, kszEndtime);
 
     // Make the amount selector
-    m_pAmount = new QSpinBox(m_pCenframe, "Amount");
+    m_pAmount = new AmountBox(TITRAQ_MINAMOUNT, TITRAQ_MAXAMOUNT, TITRAQ_STEPAMOUNT, m_pCenframe, "Amount");
     if (m_pAmount == NULL)                                      // Sanity check
         throw Genexcept("Main window amount creation failed."); // Spew errors
-    m_pDatelayout->addWidget(m_pAmount);                     // Finally add the amount editor
 
+    // Configure attributes
+    m_pAmount->setButtonSymbols(QSpinBox::PlusMinus);
+    m_pAmount->setSuffix(trUtf8(" Minutes"));
+    m_pAmount->setSpecialValueText(trUtf8("In progress"));
+
+    m_pDatelayout->addWidget(m_pAmount);    // Finally add the amount editor
     QToolTip::add(m_pAmount, trUtf8("Task Amount"));
 
     // Whatsthis info for the amount editor
@@ -437,6 +451,13 @@
                                        " this line control and typing the remarks you"
                                        " have about the task.");
     QWhatsThis::add(m_pRemark, kszRemarktext);
+
+//    // Signals
+//    m_pDateedit->valueChanged(const QDate &date);
+//    m_pStarttime->valueChanged(const QTime &time);
+//    m_pEndtime->valueChanged(const QTime &time);
+//    m_pAmount->valueChanged(int value);
+//    m_pTasks->textChanged(const QString &string);
 }
 
 //


ossp-pkg/as/as-gui/as_const.h 1.2 -> 1.3

--- as_const.h   2002/11/24 20:39:32     1.2
+++ as_const.h   2002/11/25 15:45:06     1.3
@@ -11,3 +11,16 @@
 #define TITRAQ_DEFREMOTELOG     "no"
 #define TITRAQ_PREFLOCALLOG     "loglocal"
 #define TITRAQ_DEFLOCALLOG      "no"
+
+// Indexes of table columns
+#define TITRAQ_INDEXDATE        0
+#define TITRAQ_INDEXSTART       1
+#define TITRAQ_INDEXFINISH      2
+#define TITRAQ_INDEXAMOUNT      3
+#define TITRAQ_INDEXTASK        4
+#define TITRAQ_INDEXREMARK      5
+
+// Values
+#define TITRAQ_MAXAMOUNT        960         // Maximum valid amount
+#define TITRAQ_MINAMOUNT        -1          // Minimum valid amount
+#define TITRAQ_STEPAMOUNT       15          // Line step interval


ossp-pkg/as/as-gui/as_gui.h 1.23 -> 1.24

--- as_gui.h     2002/11/25 11:40:07     1.23
+++ as_gui.h     2002/11/25 15:45:06     1.24
@@ -16,8 +16,9 @@
 #include <qlayout.h>
 #include <qfile.h>
 
-#include "titprefs.h"
-#include "titconst.h"
+#include "titconst.h"       // For general constants
+#include "titprefs.h"       // For class Preferences
+#include "titamount.h"      // For class AmountBox
 
 // Intentional no operation
 #define TITRAQ_NOP ((void)0)
@@ -66,7 +67,7 @@
     QDateEdit   *m_pDateedit;
     QTimeEdit   *m_pStarttime;
     QTimeEdit   *m_pEndtime;
-    QSpinBox    *m_pAmount;
+    AmountBox   *m_pAmount;
     QComboBox   *m_pTasks;
     QLineEdit   *m_pRemark;
 


ossp-pkg/as/as-gui/as_slot.cpp 1.12 -> 1.13

--- as_slot.cpp  2002/11/25 11:40:07     1.12
+++ as_slot.cpp  2002/11/25 15:45:06     1.13
@@ -1,5 +1,7 @@
 // Qt headers
 #include <qfiledialog.h>
+#include <qcombobox.h>
+#include <qregexp.h>
 
 // User interface
 #include "titraq.h"             // Main classes
@@ -189,10 +191,22 @@
 //
 // Update the edit controls contents
 //
-void Titraqform::updEdit(int, int)
+void Titraqform::updEdit(int nRow, int nCol)
 {
-    Prototype Unimp;
-    Unimp.doMbox();
+    QString Tasktext;               // For searching through prefixed task text
+    QRegExp Shorten("/(\\w+)$");    // For stripping prefix off the current task
+
+    m_pDateedit->setDate(QDate::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXDATE), Qt::ISODate));
+    m_pStarttime->setTime(QTime::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT), Qt::ISODate));
+    m_pEndtime->setTime(QTime::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT), Qt::ISODate));
+    m_pAmount->setText(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT));
+
+    // Process the task combo box to compress text length
+    Tasktext = m_pMaintable->text(nRow, TITRAQ_INDEXTASK);
+    Tasktext.remove(0, Shorten.search(Tasktext) + 1);       // Add one to strip leading slash
+
+    m_pTasks->setCurrentText(Tasktext);
+    m_pRemark->setText(m_pMaintable->text(nRow, TITRAQ_INDEXREMARK));
 }
 
 //


ossp-pkg/as/as-gui/as_tableitem.h 1.2 -> 1.3

--- as_tableitem.h       2002/11/25 11:23:35     1.2
+++ as_tableitem.h       2002/11/25 15:45:05     1.3
@@ -1,5 +1,7 @@
+#ifndef RTTABLEITEM_H
+#define RTTABLEITEM_H
+
 #include <qtable.h>
-#include <qpainter.h>
 
 
 class RtTableItem : public QTableItem
@@ -12,3 +14,5 @@
 private:
     int m_nOwnalign;
 };
+
+#endif // RTTABLEITEM_H









CVSTrac 2.0.1