Index: ossp-pkg/as/as-gui/as_amount.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_amount.cpp,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_amount.cpp,v' 2>/dev/null --- as_amount.cpp 2002/12/02 13:25:36 1.5 +++ as_amount.cpp 2003/02/17 13:38:22 1.6 @@ -29,42 +29,42 @@ // titamount.cpp: ISO C++ implementation // -#include +//#include -#include "as_amount.h" -#include "as_const.h" +//#include "as_amount.h" +//#include "as_const.h" -// Sets a text formatted representation -void AmountBox::setText(const QString &Strval) -{ - int nTotal = 0; // The total amount of minutes - QRegExp Strexpr("(\\d+):(\\d+)"); // Pattern in amount text - QString Stramount = QRegExp::escape(Strval); // Incoming string escaped - - if (Strval.isEmpty()) { // Shortcircuit in the - this->setValue(0); // case of empty string - } - else { // Do the real work then - Strexpr.search(Stramount); - nTotal = Strexpr.cap(Strexpr.numCaptures() - 1).toInt() * TITRAQ_MINSINHOUR; - nTotal += Strexpr.cap(Strexpr.numCaptures()).toInt(); - this->setValue(nTotal); - } -} - -// Return a text formatted representation -QString AmountBox::text(void) const -{ - QString Strfirst, Strsecond; - int nHours = 0; - int nMins = this->value(); - - nHours = nMins / TITRAQ_MINSINHOUR; // Calculate total hours - nMins = nMins % TITRAQ_MINSINHOUR; // Calculate total minutes - Strfirst = trUtf8("%1:").arg(nHours); // Format the first part - Strsecond = trUtf8("%1").arg(nMins); // Format the second part - - // Pad the resulting concatination before sending it out the back - return Strfirst.rightJustify(3, '0') + Strsecond.rightJustify(2, '0'); -} +//// Sets a text formatted representation +//void AmountBox::setText(const QString &Strval) +//{ +// int nTotal = 0; // The total amount of minutes +// QRegExp Strexpr("(\\d+):(\\d+)"); // Pattern in amount text +// QString Stramount = QRegExp::escape(Strval); // Incoming string escaped +// +// if (Strval.isEmpty()) { // Shortcircuit in the +// this->setValue(0); // case of empty string +// } +// else { // Do the real work then +// Strexpr.search(Stramount); +// nTotal = Strexpr.cap(Strexpr.numCaptures() - 1).toInt() * TITRAQ_MINSINHOUR; +// nTotal += Strexpr.cap(Strexpr.numCaptures()).toInt(); +// this->setValue(nTotal); +// } +//} + +//// Return a text formatted representation +//QString AmountBox::text(void) const +//{ +// QString Strfirst, Strsecond; +// int nHours = 0; +// int nMins = this->value(); +// +// nHours = nMins / TITRAQ_MINSINHOUR; // Calculate total hours +// nMins = nMins % TITRAQ_MINSINHOUR; // Calculate total minutes +// Strfirst = trUtf8("%1:").arg(nHours); // Format the first part +// Strsecond = trUtf8("%1").arg(nMins); // Format the second part +// +// // Pad the resulting concatination before sending it out the back +// return Strfirst.rightJustify(3, '0') + Strsecond.rightJustify(2, '0'); +//} Index: ossp-pkg/as/as-gui/as_amount.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_amount.h,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_amount.h,v' 2>/dev/null --- as_amount.h 2002/12/04 14:50:08 1.3 +++ as_amount.h 2003/02/17 13:38:22 1.4 @@ -32,15 +32,24 @@ #ifndef AMOUNTBOX_H #define AMOUNTBOX_H -#include +#include -class AmountBox : public QSpinBox +class ASTimeEdit : public QTimeEdit { public: - AmountBox(int nMinval, int nMaxval, int nStep = 1, QWidget *pParent = 0, const char *szName = 0) : QSpinBox(nMinval, nMaxval, nStep, pParent, szName) {setValue(0);}; - void setText(const QString &); // Sets a text formatted representation - QString text(void) const; // Return a text formatted representation + ASTimeEdit(QWidget *pParent = 0, const char *szName = 0) : QTimeEdit(pParent, szName) + { + this->setTime(QTime::QTime(0, 0)); + this->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes); + this->setAutoAdvance(true); +// this->setMaxValue(); +// this->setSuffix(trUtf8(" Mins")); +// this->setButtonSymbols(QSpinBox::PlusMinus); +// this->setSpecialValueText(trUtf8("In progress")); + }; +// void setText(const QString &); // Sets a text formatted representation +// QString text(void) const; // Return a text formatted representation }; #endif // AMOUNTBOX_H Index: ossp-pkg/as/as-gui/as_assist.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v rcsdiff -q -kk '-r1.107' '-r1.108' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v' 2>/dev/null --- as_assist.cpp 2003/02/14 19:27:03 1.107 +++ as_assist.cpp 2003/02/17 13:38:22 1.108 @@ -817,33 +817,28 @@ QToolTip::add(m_pEndtime, trUtf8("Task Ending Time")); m_pEditlayout->addWidget(m_pEndtime); // Finally add the end editor - // Make the total time amount selector - m_pAmount = new QTimeEdit(m_pCenframe, "TotalAmount"); - if (m_pAmount == NULL) // Sanity check - throw Genexcept("Main window amount creation failed."); // Spew errors +// // Make the total time amount selector +// m_pAmount = new QTimeEdit(m_pCenframe, "TotalAmount"); +// if (m_pAmount == NULL) // Sanity check +// throw Genexcept("Main window amount creation failed."); // Spew errors +// +// // Configure attributes +// m_pAmount->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes); +// m_pAmount->setAutoAdvance(true); +// m_pAmount->setEnabled(false); - // Configure attributes - m_pAmount->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes); - m_pAmount->setAutoAdvance(true); - m_pAmount->setEnabled(false); - -/* // Make the amount selector - m_pAmount = new AmountBox(TITRAQ_MINAMOUNT, TITRAQ_MAXAMOUNT, TITRAQ_STEPAMOUNT, m_pCenframe, "Amount"); + // Make the amount selector + m_pAmount = new ASTimeEdit(m_pCenframe, "TotalAmount"); if (m_pAmount == NULL) // Sanity check throw Genexcept("Main window amount creation failed."); // Spew errors - // Configure attributes - m_pAmount->setButtonSymbols(QSpinBox::PlusMinus); - m_pAmount->setSuffix(trUtf8(" Mins")); - m_pAmount->setEnabled(false); -// m_pAmount->setSpecialValueText(trUtf8("In progress"));*/ - // Whatsthis info for the amount editor const char *kszAmount = "Edit the task amount by clicking on " "the amount, and then changing its " "value with the arrow buttons."; QWhatsThis::add(m_pAmount, kszAmount); QToolTip::add(m_pAmount, trUtf8("Task Amount")); + m_pAmount->setEnabled(false); // Don't enable until it's ready m_pEditlayout->addWidget(m_pAmount); // Finally add the amount editor // Construct a stringlist just to hold task values Index: ossp-pkg/as/as-gui/as_gui.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v rcsdiff -q -kk '-r1.75' '-r1.76' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v' 2>/dev/null --- as_gui.h 2003/02/14 19:27:03 1.75 +++ as_gui.h 2003/02/17 13:38:22 1.76 @@ -56,8 +56,8 @@ class QFile; // Local class prototypes -// class AmountBox; // Warning: Might be replaced with QTimeEdit -class Daydatedit; +class ASTimeEdit; +class Daydatedit; // Might be replaced with ASTimeEdit throughout class TiTable; class Preferences; class Prefpanel; @@ -220,8 +220,8 @@ Daydatedit *m_pDateedit; // Control to edit date QTimeEdit *m_pStarttime; // Control to edit start time QTimeEdit *m_pEndtime; // Control to edit finish time - QTimeEdit *m_pAmount; // Control to edit total time -// AmountBox *m_pAmount; // Control to edit total time +// QTimeEdit *m_pAmount; // Control to edit total time + ASTimeEdit *m_pAmount; // Control to edit total time QComboBox *m_pTasks; // Control to choose a task QLineEdit *m_pRemark; // Control to edit remark