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.96' '-r1.97' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v' 2>/dev/null --- as_assist.cpp 2003/02/03 14:12:08 1.96 +++ as_assist.cpp 2003/02/04 19:30:31 1.97 @@ -877,6 +877,14 @@ // Start edit controls off at right size this->updSizes(TITRAQ_IDXALLCTRLS, -1, -1); + // Validate data just as it is being entered + connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), this, SLOT(validateData(void))); + connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void))); + connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void))); + connect(m_pAmount, SIGNAL(valueChanged(const QString &)), this, SLOT(validateData(void))); + connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(validateData(void))); + connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(validateData(void))); + // Signals sent between table cells and corresponding edit control widgets connect(m_pLineedit, SIGNAL(textChanged(const QString &)), this, SLOT(updateLine(const QString &))); connect(m_pUseredit, SIGNAL(textChanged(const QString &)), this, SLOT(updateUser(const QString &))); @@ -890,14 +898,6 @@ connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(updateTask(const QString &))); connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(updateRemark(const QString &))); - // Validate data just as it is being entered - connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), this, SLOT(validateData(void))); - connect(m_pStarttime, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void))); - connect(m_pEndtime, SIGNAL(valueChanged(const QTime &)), this, SLOT(validateData(void))); - connect(m_pAmount, SIGNAL(valueChanged(const QString &)), this, SLOT(validateData(void))); - connect(m_pTasks, SIGNAL(textChanged(const QString &)), this, SLOT(validateData(void))); - connect(m_pRemark, SIGNAL(textChanged(const QString &)), this, SLOT(validateData(void))); - // Correctly update checksum and revision fields also connect(m_pUseredit, SIGNAL(textChanged(const QString &)), this, SLOT(calcCrc(void))); connect(m_pDateedit, SIGNAL(valueChanged(const QDate &)), this, SLOT(calcCrc(void))); Index: ossp-pkg/as/as-gui/as_const.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v rcsdiff -q -kk '-r1.47' '-r1.48' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v' 2>/dev/null --- as_const.h 2003/02/04 13:06:12 1.47 +++ as_const.h 2003/02/04 19:30:31 1.48 @@ -96,9 +96,9 @@ #define TITRAQ_PREFUCOLWIDTH "usercolwidth" #define TITRAQ_DEFUCOLWIDTH 32 #define TITRAQ_PREFGCOLWIDTH "guidcolwidth" -#define TITRAQ_DEFGCOLWIDTH 36 +#define TITRAQ_DEFGCOLWIDTH 254 #define TITRAQ_PREFCCOLWIDTH "crccolwidth" -#define TITRAQ_DEFCCOLWIDTH 32 +#define TITRAQ_DEFCCOLWIDTH 84 #define TITRAQ_PREFREVCOLWIDTH "revcolwidth" #define TITRAQ_DEFREVCOLWIDTH 32 #define TITRAQ_PREFDCOLWIDTH "datecolwidth" Index: ossp-pkg/as/as-gui/as_dataop.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_dataop.cpp,v rcsdiff -q -kk '-r1.41' '-r1.42' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_dataop.cpp,v' 2>/dev/null --- as_dataop.cpp 2003/02/03 21:14:58 1.41 +++ as_dataop.cpp 2003/02/04 19:30:31 1.42 @@ -38,6 +38,7 @@ #include "as_gui.h" // Main classes #include "as_tableitem.h" // For class RtTableItem #include "as_crc.h" // For quality strings +#include "as_uuid.h" // UUID classes // Icon pixel maps #include "as_gfx/statok.xpm" // static const char *s_kpcStatokay_xpm[] @@ -157,7 +158,7 @@ // Ensure that the right data version pattern precedes the data QString Datapattern = QString(TITRAQ_DATAPATTERN); if (!Line.startsWith(Datapattern)) { // Incompatible data format - QMessageBox Problema(TITRAQ_APPTITLE, + QMessageBox Problema(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, TITRAQ_NOPATTERNFOUND + QString(TITRAQ_DATAPATTERN) + TITRAQ_WASNOTFOUNDIN, QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Escape, QMessageBox::NoButton, QMessageBox::NoButton); @@ -165,15 +166,15 @@ throw Genexcept(TITRAQ_INVALIDDATA); } else if (Line.section(Datapattern, 1).section('.', 0, 0).toInt() != TITRAQ_DATAVERSIONMAJ) { - QMessageBox Problema(TITRAQ_APPTITLE, TITRAQ_BADVERSIONMAJ, - QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Escape, + QMessageBox Problema(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, + TITRAQ_BADVERSIONMAJ, QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Escape, QMessageBox::NoButton, QMessageBox::NoButton); Problema.exec(); // Give the user the bad news throw Genexcept(TITRAQ_INCOMPATDATA); } else if (Line.section(Datapattern, 1).section('.', 1, 1).toInt() > TITRAQ_DATAVERSIONMIN) { - QMessageBox Problema(TITRAQ_APPTITLE, TITRAQ_BADVERSIONMIN, - QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Escape, + QMessageBox Problema(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, + TITRAQ_BADVERSIONMIN, QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Escape, QMessageBox::NoButton, QMessageBox::NoButton); Problema.exec(); // Give the user the bad news throw Genexcept(TITRAQ_INCOMPATDATA); @@ -215,10 +216,7 @@ Asline.skipWhiteSpace(); // Remove whitespaces Asline >> Guid; // Copy the GUID field - if (!Guid.isEmpty()) - m_pMaintable->setText(nIter, TITRAQ_IDXGUID, Guid); - else - bValid = false; + // Postpone actual text delivery, to autoinsert GUIDs! Asline.skipWhiteSpace(); // Remove whitespaces Asline >> Crc; // Copy the CRC field @@ -289,6 +287,19 @@ m_pMaintable->setPixmap(nIter, TITRAQ_IDXSTATUS, Staterror); } + // Set the GUID text here, in case we need to generate a fresh value + if (!Guid.isEmpty()) { + if (Guid != ".") // This means, generate a fresh GUID value + m_pMaintable->setText(nIter, TITRAQ_IDXGUID, Guid); + else { + AS::Uuid Guidi; // For GUID production + Guidi.genId(); + m_pMaintable->setText(nIter, TITRAQ_IDXGUID, Guidi.getString()); + } + } + else // if isEmpty() + bValid = false; + // Set the CRC text here, in case we need to generate a fresh value if (!Crc.isEmpty()) { if (Crc != ".") // This means, generate a fresh CRC value Index: ossp-pkg/as/as-gui/as_generic.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_generic.cpp,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_generic.cpp,v' 2>/dev/null --- as_generic.cpp 2002/12/02 13:25:36 1.3 +++ as_generic.cpp 2003/02/04 19:30:31 1.4 @@ -33,12 +33,18 @@ #include "as_generic.h" +// Version information +#define _AS_VERSION_CPP_AS_HEADER_ +#include "as_version.cpp" +#undef _AS_VERSION_CPP_AS_HEADER_ + // Construct a Prototype object Prototype::Prototype() { // For display of a prototype implementation - m_pProtomsg = new QMessageBox("OSSP titraq", + QString Namever = QString("AS Accounting System") + ' ' + asgui_version.v_short; + m_pProtomsg = new QMessageBox(Namever, QObject::trUtf8("This method is not implemented yet."), QMessageBox::NoIcon, QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, QMessageBox::NoButton, Index: ossp-pkg/as/as-gui/as_gui.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v rcsdiff -q -kk '-r1.38' '-r1.39' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v' 2>/dev/null --- as_gui.cpp 2003/01/31 18:48:57 1.38 +++ as_gui.cpp 2003/02/04 19:30:31 1.39 @@ -70,11 +70,11 @@ // Postsetup manipulations m_pMaintable->setDirty(false); if (!kszName) - setName(trUtf8("ASGuiapp")); - resize(m_pPrefs->getNumber(TITRAQ_PREFFRAMEWIDTH, TITRAQ_DEFFRAMEWIDTH), + this->setName(trUtf8("ASGuiapp")); + this->resize(m_pPrefs->getNumber(TITRAQ_PREFFRAMEWIDTH, TITRAQ_DEFFRAMEWIDTH), m_pPrefs->getNumber(TITRAQ_PREFFRAMEHEIGHT, TITRAQ_DEFFRAMEHEIGHT)); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(savePrefs())); - setCaption("AS Accounting System"); + this->setCaption(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short); // Rehydrate main window layout and doc positions QString Laystring = m_pPrefs->getString(TITRAQ_PREFFRAMELAY, NULL); // FIXME: Handle first case better 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.69' '-r1.70' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v' 2>/dev/null --- as_gui.h 2003/02/03 21:14:58 1.69 +++ as_gui.h 2003/02/04 19:30:31 1.70 @@ -59,6 +59,11 @@ #include "as_table.h" // For class TiTable #include "as_datedit.h" // For class Daydatedit +// Version information +#define _AS_VERSION_CPP_AS_HEADER_ +#include "as_version.cpp" +#undef _AS_VERSION_CPP_AS_HEADER_ + // Intentional no operation #define TITRAQ_NOP ((void)0) Index: ossp-pkg/as/as-gui/as_slot.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v rcsdiff -q -kk '-r1.108' '-r1.109' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null --- as_slot.cpp 2003/02/03 21:41:42 1.108 +++ as_slot.cpp 2003/02/04 19:30:31 1.109 @@ -322,9 +322,9 @@ // Check modification state of current data if (m_pMaintable->isDirty()) { - nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), - trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), - trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); + nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), + trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { case 0: // First button selected, so save first @@ -365,9 +365,9 @@ // not be raised if no open timesheet exists or if it was just serialized. // if (m_pMaintable->isDirty()) { // Check modification state - nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), - trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), - trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); + nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), + trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { case 0: // Save first @@ -489,8 +489,9 @@ QString Filestring = QFileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false); if (!Filestring.isEmpty()) { if (QFile::exists(Filestring)) { - nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE), - trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); + nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) + + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), + trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); switch (nResult) { case 0: // Overwrite contents this->setFilename(Filestring); @@ -532,8 +533,9 @@ QString Filestring = QFileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false); if (!Filestring.isEmpty()) { if (QFile::exists(Filestring)) { - nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE), - trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); + nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) + + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), + trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); switch (nResult) { case 0: // Overwrite contents this->setFilename(Filestring); @@ -573,9 +575,9 @@ // Check modification state of current data if (m_pMaintable->isDirty()) { - nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), - trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), - trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); + nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), + trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { // Maybe save before closing case 0: // Save first @@ -594,7 +596,7 @@ if (!m_pMaintable->isDirty()) { // Check again // Fall through to implicit close code - this->setCaption(TITRAQ_APPTITLE); + this->setCaption(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short); try { // There might be problems, so wrap these last ops with error handling QString Lightsout; // It's late, go to bed if (this->isOpen()) @@ -853,19 +855,39 @@ m_pRemark->setText(Textremark); m_pTasks->setCurrentText(Texttask); - // Members not suitable for empty string text - if (!Textdate.isEmpty()) + // Date field not suitable for empty string text + if (Textdate == ".") + m_pDateedit->setDate(QDate::currentDate()); + else if (Textdate.isEmpty()) + m_pDateedit->setDate(QDate::fromString("0000-00-00", Qt::ISODate)); + else m_pDateedit->setDate(QDate::fromString(Textdate, Qt::ISODate)); + + // Start time not suitable for empty string text + if (Textstart == ".") + m_pStarttime->setTime(QTime::currentTime()); + else if (Textstart.isEmpty()) + m_pStarttime->setTime(QTime::QTime(0, 0)); else - m_pDateedit->setDate(QDate::currentDate()); - if (!Textstart.isEmpty()) m_pStarttime->setTime(QTime::fromString(Textstart, Qt::ISODate)); + + // Finish time not suitable for empty string text + if (Textfinish == ".") + m_pEndtime->setTime(QTime::currentTime()); + else if (Textfinish.isEmpty()) + m_pEndtime->setTime(QTime::QTime(0, 0)); else - m_pStarttime->setTime(QTime::QTime(0, 0)); - if (!Textfinish.isEmpty()) m_pEndtime->setTime(QTime::fromString(Textfinish, Qt::ISODate)); + + // Amount time not suitable for empty string text + if (Textamount == ".") { + int nDifference = m_pStarttime->time().secsTo(m_pEndtime->time()); + m_pAmount->setText(QTime(0, 0).addSecs(nDifference).toString("hh:mm")); + } + else if (Textamount.isEmpty()) + m_pAmount->setText(QString("00:00")); else - m_pEndtime->setTime(QTime::QTime(0, 0)); + m_pAmount->setText(Textamount); } } @@ -892,7 +914,7 @@ nRealrow = (nRow >= 0) ? nRow : m_pMaintable->currentRow(); QString Statis = m_pMaintable->text(nRealrow, TITRAQ_IDXSTATUS); // Get text - // Quick review of data validity, and set pixmaps accordingly + // Review whole data validity, and set pixmap accordingly if (m_pMaintable->text(nRealrow, TITRAQ_IDXUSER).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXGUID).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXCRC).isEmpty() || @@ -920,6 +942,30 @@ m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRealrow, TITRAQ_IDXSTATUS)); } } + + // Test for blank user field, and set to default if so + if (m_pMaintable->text(nRealrow, TITRAQ_IDXUSER).isEmpty()) + m_pMaintable->setText(nRealrow, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); + + // Test for blank date field, and set to default if so + if (m_pMaintable->text(nRealrow, TITRAQ_IDXDATE) == ".") + m_pMaintable->setText(nRealrow, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); + + // Test for blank start field, and set to default if so + if (m_pMaintable->text(nRealrow, TITRAQ_IDXSTART) == ".") + m_pMaintable->setText(nRealrow, TITRAQ_IDXSTART, QTime::currentTime().toString("hh:mm")); + + // Test for blank finish field, and set to default if so + if (m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH) == ".") + m_pMaintable->setText(nRealrow, TITRAQ_IDXFINISH, QTime::currentTime().toString("hh:mm")); + + // Test for blank amount field, and set to default if so + if (m_pMaintable->text(nRealrow, TITRAQ_IDXAMOUNT) == ".") { + QTime Begin = QTime::fromString(m_pMaintable->text(nRealrow, TITRAQ_IDXSTART), Qt::ISODate); + QTime End = QTime::fromString(m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH), Qt::ISODate); + QString Diff = QTime(0, 0).addSecs(Begin.secsTo(End)).toString("hh:mm"); + m_pMaintable->setText(nRealrow, TITRAQ_IDXAMOUNT, Diff); + } } // @@ -1612,7 +1658,8 @@ // void Titraqform::aboutTitraq(void) { - QMessageBox *pCwmsg = new QMessageBox("AS Accounting System", + QString Namever = QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short; + QMessageBox *pCwmsg = new QMessageBox(Namever, QObject::trUtf8("AS-GUI is a time and task-based\n" "accounting system that acts as both a\n" "work-like punch card and time tracker.\n" @@ -1631,7 +1678,8 @@ // void Titraqform::aboutOSSP(void) { - QMessageBox *pOsspmsg = new QMessageBox("AS Accounting System", + QString Namever = QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short; + QMessageBox *pOsspmsg = new QMessageBox(Namever, QObject::trUtf8("The open source software project (OSSP) is\n" "a collective effort aimed at implementing\n" "high-quality Unix software components,\n" @@ -1651,5 +1699,5 @@ // void Titraqform::aboutQt(void) { - QMessageBox::aboutQt(this, "AS Accounting System"); + QMessageBox::aboutQt(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short); } Index: ossp-pkg/as/as-gui/devtool.conf RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/devtool.conf,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/devtool.conf,v' 2>/dev/null --- devtool.conf 2003/01/24 19:32:50 1.10 +++ devtool.conf 2003/02/04 19:30:31 1.11 @@ -47,8 +47,8 @@ echo "+++ rolling" V=`./shtool version -l c -d short as_version.cpp` ./shtool tarball -o as-gui-${V}.tar.gz -d as-gui-${V} \ - -e 'CVS,.cvsignore,.[ao]$,^.,devtool*,*.tar.gz,^#.*,*~$' \ - -e 'asdb.cpp,asdb.h,as_scrap,as_gfx/*.png' \ + -e 'CVS,\.cvsignore,\.[ao]$,^\.,devtool*,*.tar.gz,^#.*,.*~$,*.bak' \ + -e 'autom4te\.cache,asdb.cpp,asdb.h,as_scrap,as_gfx/*.png' \ -c 'gzip --best' . ls -l as-gui-${V}.tar.gz echo "+++ testing"