Check-in Number:
|
4047 | |
Date: |
2003-Feb-17 14:38:22 (local)
2003-Feb-17 13:38:22 (UTC) |
User: | ms |
Branch: | |
Comment: |
Begin coding a new time widget that allows unnatural time values. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/as/as-gui/as_amount.cpp 1.5 -> 1.6
--- 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 <qregexp.h>
+//#include <qregexp.h>
-#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');
+//}
|
|
ossp-pkg/as/as-gui/as_amount.h 1.3 -> 1.4
--- 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 <qspinbox.h>
+#include <qdatetimeedit.h>
-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
|
|
ossp-pkg/as/as-gui/as_assist.cpp 1.107 -> 1.108
--- 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 <em>task amount</em> 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
|
|
ossp-pkg/as/as-gui/as_gui.h 1.75 -> 1.76
--- 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
|
|