Index: ossp-pkg/as/as-gui/TODO RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/TODO,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/TODO,v' 2>/dev/null --- TODO 2002/11/14 18:19:29 1.6 +++ TODO 2002/11/19 19:42:14 1.7 @@ -22,6 +22,7 @@ Document -------- +Use doxygen for C++ interface documentation. Project plan ------------ 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.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v' 2>/dev/null --- as_assist.cpp 2002/11/19 08:17:44 1.3 +++ as_assist.cpp 2002/11/19 19:42:14 1.4 @@ -1,10 +1,9 @@ // Qt headers #include #include -#include -#include #include #include +#include #include // User interface @@ -12,9 +11,10 @@ #include "titrex.h" // Exception classes // Icon pixel maps -#include "gfx/cw.xpm" // static const char *s_kpcCw_xpm[] +#include "gfx/cwlogo.xpm" // static const char *s_kpcCwlogo_xpm[] +#include "gfx/osspicon.xpm" // static const char *s_kpcOsspicon_xpm[] #include "gfx/ossplogo.xpm" // static const char *s_kpcOssplogo_xpm[] -#include "gfx/qtlogo.xpm" // static const char *s_kpcQtlogo_xpm[] +#include "gfx/qticon.xpm" // static const char *s_kpcQticon_xpm[] #include "gfx/filenew.xpm" // static const char *s_kpcFilenew_xpm[] #include "gfx/fileopen.xpm" // static const char *s_kpcFileopen_xpm[] #include "gfx/filesave.xpm" // static const char *s_kpcFilesave_xpm[] @@ -27,9 +27,10 @@ void Titraqform::setupIcons(void) { // Initialize icon images - m_pCwicon = new QImage(s_kpcCwlogo_xpm); - m_pOsspicon = new QImage(s_kpcOssplogo_xpm); - m_pQticon = new QImage(s_kpcQtlogo_xpm); + m_pCwlogo = new QImage(s_kpcCwlogo_xpm); + m_pOsspicon = new QImage(s_kpcOsspicon_xpm); + m_pOssplogo = new QImage(s_kpcOssplogo_xpm); + m_pQticon = new QImage(s_kpcQticon_xpm); m_pNewicon = new QImage(s_kpcFilenew_xpm); m_pOpenicon = new QImage(s_kpcFileopen_xpm); m_pSaveicon = new QImage(s_kpcFilesave_xpm); @@ -211,16 +212,21 @@ m_pCenframe->setFrameShadow(QFrame::Sunken); setCentralWidget(m_pCenframe); - // Layout controls for table, buttons, and status line + // Layout controls for table, editing widgets, and buttons m_pMainlayout = new QVBoxLayout(m_pCenframe, 10, 6, "Mainlayout"); // For layouts m_pPackagelayout = new QVBoxLayout(0, 0, 6, "Packagelayout"); // For table + m_pDatelayout = new QHBoxLayout(0, 0, 6, "Datelayout"); // For dates + m_pTasklayout = new QHBoxLayout(0, 0, 6, "Tasklayout"); // For tasks m_pControllayout = new QHBoxLayout(0, 0, 6, "Controllayout"); // For buttons - if (!(m_pMainlayout && m_pMainlayout && m_pMainlayout)) // Sanity check + // Major sanity check wrapped in one call + if (!(m_pMainlayout && m_pPackagelayout && m_pDatelayout && m_pTasklayout && m_pControllayout)) throw Genexcept("Main window layout creation failed."); // Specify ordering of the layouts m_pMainlayout->addLayout(m_pPackagelayout); + m_pMainlayout->addLayout(m_pDatelayout); + m_pMainlayout->addLayout(m_pTasklayout); m_pMainlayout->addLayout(m_pControllayout); } @@ -245,125 +251,134 @@ throw Genexcept("Main window table creation failed."); m_pMaintable->setNumRows(g_knRows); m_pMaintable->setNumCols(g_knCols); - m_pMaintable->setReadOnly(false); // Not read only - m_pMaintable->setColumnMovingEnabled(true); // Ctrl-drag of headers + m_pMaintable->setReadOnly(true); // Table is read only + m_pMaintable->setColumnMovingEnabled(false); // Ctrl-drag disabled m_pMaintable->setSelectionMode(QTable::MultiRow); // Multi row selection m_pMaintable->setLeftMargin(0); // Get rid of the vertical header m_pMaintable->verticalHeader()->hide(); // by hiding it with a margin of 0 m_pMaintable->horizontalHeader()->setResizeEnabled(false); - m_pMaintable->setColumnStretchable(5, true); + m_pMaintable->setColumnStretchable(g_knCols - 1, true); + m_pMaintable->setSorting(true); // Table header row m_pTablehead = m_pMaintable->horizontalHeader(); + m_pMaintable->setHScrollBarMode(QScrollView::AlwaysOff); m_pTablehead->setLabel(0, QObject::trUtf8("Date"), 96); m_pTablehead->setLabel(1, QObject::trUtf8("Begin"), 80); m_pTablehead->setLabel(2, QObject::trUtf8("End"), 80); m_pTablehead->setLabel(3, QObject::trUtf8("Amount"), 52); m_pTablehead->setLabel(4, QObject::trUtf8("Task"), 70); m_pTablehead->setLabel(5, QObject::trUtf8("Remark")); - m_pTablehead->setMovingEnabled(true); - - // Icon image items - QPixmap Osspminipix(QPixmap(m_pOsspicon->scaleHeight(m_pMaintable->rowHeight(6)))); - m_pMaintable->setItem(0, 0, new QTableItem(m_pMaintable, QTableItem::Never, "OSSP trac")); - m_pMaintable->setPixmap(0, 0, Osspminipix); // // Make a generic table item for all rows -// for (int i = 1; i < knRows; ++i) -// m_pMaintable->setItem(i, 0, new QTableItem(m_pMaintable, QTableItem::Always, ("Enter"))); - - // Make the date selector for all rows - for (int i = 1; i < g_knRows; ++i) { - QDate *pSylvestre = new QDate(2002, 12, 31); - QDateEdit *pDateEdit = new QDateEdit(*pSylvestre, m_pMaintable, "Date"); - m_pMaintable->setCellWidget(i, 0, pDateEdit); - } - - // Make the time start selector for all rows - for (int i = 0; i < g_knRows; ++i) { - QTimeEdit *pStart = new QTimeEdit(QTime::currentTime(), m_pMaintable, "Start"); - m_pMaintable->setCellWidget(i, 1, pStart); - } +// for (int i = 0; i < g_knRows; ++i) +// m_pMaintable->setItem(i, 0, new QTableItem(m_pMaintable, QTableItem::WhenCurrent, NULL)); - // Make the time end selector for all rows - for (int i = 0; i < g_knRows; ++i) { - QTimeEdit *pEnd = new QTimeEdit(QTime::currentTime(), m_pMaintable, "End"); - m_pMaintable->setCellWidget(i, 2, pEnd); - } + m_pPackagelayout->addWidget(m_pMaintable); // Finally add the damn table +} - // Make the amount selector for all rows - for (int i = 0; i < g_knRows; ++i) { - QSpinBox *pAmount = new QSpinBox(m_pMaintable, "Amount"); - m_pMaintable->setCellWidget(i, 3, pAmount); - } +// +// Construct the bottom edit widgets +// +void Titraqform::setupEditlay(void) +{ + // Make the date selector + QDate Sylvestre(2002, 12, 31); + QDateEdit *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 + + QToolTip::add(m_pDateedit, trUtf8("Task Date")); + + // Whatsthis info for the date editor + const char *kszDateedit = trUtf8("Edit the task date by clicking on" + " the year, month, or day, and then changing their" + " values with the arrow buttons."); + QWhatsThis::add(m_pDateedit, kszDateedit); + + // Make the start time selector + QTimeEdit *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 + + QToolTip::add(m_pStarttime, trUtf8("Task Starting Time")); + + // Whatsthis info for the time editor + const char *kszStarttime = trUtf8("Edit the task starting time by clicking on" + " the hour and minute, and then changing their" + " values with the arrow buttons."); + QWhatsThis::add(m_pStarttime, kszStarttime); + + // Make the end time selector + QTimeEdit *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 + + QToolTip::add(m_pEndtime, trUtf8("Task Ending Time")); + + // Whatsthis info for the time editor + const char *kszEndtime = trUtf8("Edit the task ending time by clicking on" + " the hour and minute, and then changing their" + " values with the arrow buttons."); + QWhatsThis::add(m_pEndtime, kszEndtime); + + // Make the amount selector + QSpinBox *m_pAmount = new QSpinBox(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 + + QToolTip::add(m_pAmount, trUtf8("Task Amount")); + + // Whatsthis info for the amount editor + const char *kszAmount = trUtf8("Edit the task amount by clicking on" + " the amount, and then changing its" + " value with the arrow buttons."); + QWhatsThis::add(m_pAmount, kszAmount); - // Populate the task stringlist + // Populate the stringlist with fresh tasks m_pTaskentries = new QStringList; if (m_pTaskentries == NULL) // Sanity check throw Genexcept("Main window task entries creation failed."); *m_pTaskentries << trUtf8("titraq") << trUtf8("opgui") << trUtf8("email") << trUtf8("admin") << trUtf8("pmod") << trUtf8("psod") << trUtf8("meeting") << trUtf8("training"); - // Make the combobox items for all rows - for (int i = 0; i < g_knRows; ++i) { - QComboBox *pTasks = new QComboBox(true, m_pMaintable, "Tasks"); - pTasks->insertStringList(*m_pTaskentries); - pTasks->setCurrentText(NULL); - pTasks->setAutoCompletion(true); - m_pMaintable->setCellWidget(i, 4, pTasks); + // Make the combobox task edit + QComboBox *m_pTasks = new QComboBox(true, m_pCenframe, "Tasks"); + if (m_pTasks == NULL) // Sanity check + throw Genexcept("Main window task edit creation failed."); + m_pTasks->insertStringList(*m_pTaskentries); + m_pTasks->setCurrentText(NULL); + m_pTasks->setAutoCompletion(true); + + // Fix the minimum width, and add an auto scroll bar to it + if (m_pTasks->listBox()) { // Motif style has no list box + m_pTasks->listBox()->setHScrollBarMode(QScrollView::Auto); + m_pTasks->setMinimumWidth(m_pTasks->listBox()->maxItemWidth()); } -// // Make the listbox for all rows -// for (int i = 0; i < knRows; ++i) { -// QListBox *pTasks = new QListBox(m_pMaintable, "Tasks"); -// pTasks->insertStringList(*pTaskentries); -// pTasks->setCurrentItem(i % 8); -// m_pMaintable->setCellWidget(i, 4, pTasks); -// } - -// // Populate a listbox for the task combobox -// QListBox *pListasks = new QListBox(m_pMaintable); -// pListasks->insertItem("titraq"); -// pListasks->insertItem("opgui"); -// pListasks->insertItem("email"); -// pListasks->insertItem("admin"); -// pListasks->insertItem("pmod"); -// pListasks->insertItem("psod"); -// pListasks->insertItem("meeting"); -// pListasks->insertItem("training"); - -// // Make the combobox items for all rows -// for (int i = 0; i < knRows; ++i) { -// QComboTableItem *pTasks = new QComboTableItem(m_pMaintable, *m_pTaskentries, false); -// pTasks->setCurrentItem(i % 8); -// m_pMaintable->setItem(i, 4, pTasks); -// } + // Finally add the task edit + m_pTasklayout->addWidget(m_pTasks); - m_pPackagelayout->addWidget(m_pMaintable); // Finally add the damn table -} - -// -// Construct the bottom output line -// -void Titraqform::setupOutput(void) -{ - // Bottom output line - m_pStatus = new QLineEdit(m_pCenframe, "Status"); - if (m_pStatus == NULL) // Sanity check - throw Genexcept("Main window status output creation failed."); - m_pStatus->setText(trUtf8("Happy birthday to Ralf")); - m_pStatus->setFrameShape(QLineEdit::LineEditPanel); - m_pStatus->setFrameShadow(QLineEdit::Sunken); - m_pStatus->setFrame(true); - m_pStatus->setReadOnly(true); - QToolTip::add(m_pStatus, trUtf8("Status Line")); - m_pPackagelayout->addWidget(m_pStatus); // Finally add the status bar - - // Whatsthis info for the output line - const char *kszStatouttext = trUtf8("

" - "This line shows the current row of your accounting data." - " You can also change the data in place, or above " - "from the Accounting table."); - QWhatsThis::add(m_pStatus, kszStatouttext); + // Make the Remark line + m_pRemark = new QLineEdit(m_pCenframe, "Remark"); + if (m_pRemark == NULL) // Sanity check + throw Genexcept("Main window remark line creation failed."); + m_pRemark->setText(trUtf8("Happy birthday to Ralf")); + m_pRemark->setFrameShape(QLineEdit::LineEditPanel); + m_pRemark->setFrameShadow(QLineEdit::Sunken); + m_pRemark->setFrame(true); + m_pRemark->setReadOnly(false); + QToolTip::add(m_pRemark, trUtf8("Remark Line")); + m_pTasklayout->addWidget(m_pRemark); // Finally add the remark line + + // Whatsthis info for the remark line + const char *kszRemarktext = trUtf8("Edit the task remarks by clicking on" + " this line control and typing the remarks you" + " have about the task."); + QWhatsThis::add(m_pRemark, kszRemarktext); } // 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.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v' 2>/dev/null --- as_gui.cpp 2002/11/18 23:34:17 1.15 +++ as_gui.cpp 2002/11/19 19:42:14 1.16 @@ -45,7 +45,7 @@ setupCentralwidget(); setupStatusbar(); setupTable(); - setupOutput(); + setupEditlay(); setupButtons(); } catch (Genexcept& Genex) { 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.12' '-r1.13' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v' 2>/dev/null --- as_gui.h 2002/11/19 08:17:44 1.12 +++ as_gui.h 2002/11/19 19:42:14 1.13 @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include @@ -43,23 +45,29 @@ QStringList *m_pTaskentries; // Reusable graphics - QImage *m_pCwicon; + QImage *m_pCwlogo; QImage *m_pOsspicon; + QImage *m_pOssplogo; QImage *m_pQticon; QImage *m_pNewicon; QImage *m_pOpenicon; QImage *m_pSaveicon; QImage *m_pWhatsicon; + // Edition widgets + QDateEdit *m_pDateedit; + QTimeEdit *m_pStarttime; + QTimeEdit *m_pEndtime; + QSpinBox *m_pAmount; + QComboBox *m_pTasks; + QLineEdit *m_pRemark; + // Push buttons in control layout QPushButton *m_pAddbutton; QPushButton *m_pDeletebutton; QPushButton *m_pWritebutton; QPushButton *m_pQuitbutton; - // Line edit for status - QLineEdit *m_pStatus; - protected slots: virtual void init(void); // Override init to include custom controls void addEntry(void); // Add a task entry to the list @@ -82,6 +90,8 @@ QFrame *m_pCenframe; // Central frame QVBoxLayout *m_pMainlayout; // Package and control layouts QVBoxLayout *m_pPackagelayout; // Main table control + QHBoxLayout *m_pDatelayout; // Lower date and time widgets + QHBoxLayout *m_pTasklayout; // Lower task and remark widgets QHBoxLayout *m_pControllayout; // Lower control buttons private: @@ -107,7 +117,7 @@ void setupStatusbar(void); // Status bar void setupCentralwidget(void); // Assemble main Frame widget void setupTable(void); // Table widget - void setupOutput(void); // Output widget + void setupEditlay(void); // Editing lay void setupButtons(void); // Push button widgets void setupPieces(void); // Assemble widget pieces }; 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.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null --- as_slot.cpp 2002/11/19 08:17:44 1.2 +++ as_slot.cpp 2002/11/19 19:42:14 1.3 @@ -75,8 +75,8 @@ return; QTextStream Textstream(&Filetemp); // Convert the file contents to a stream - m_pStatus->setText(Textstream.read()); - m_pStatus->setEdited(false); + m_pRemark->setText(Textstream.read()); + m_pRemark->setEdited(false); setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); } @@ -93,7 +93,7 @@ } // Try to read the status text, and write it to a file - QString Statustext = m_pStatus->text(); + QString Statustext = m_pRemark->text(); QFile Filetemp(*m_szFilename); if (!Filetemp.open(IO_WriteOnly)) { m_pStatbar->message(QString(trUtf8("Could not write to %1")).arg(*m_szFilename), 4000); @@ -106,7 +106,7 @@ Filetemp.close(); // Reset the text line, and give output to main window - m_pStatus->setEdited(FALSE); + m_pRemark->setEdited(FALSE); setCaption(*m_szFilename); m_pStatbar->message(QString(trUtf8("File %1 saved")).arg(*m_szFilename), 4000); m_bDirt = false; // Set the clean state to allow a close operation @@ -121,7 +121,7 @@ QString Filestring = QFileDialog::getSaveFileName(QString::null, QString::null, this); if (!Filestring.isEmpty()) { *m_szFilename = Filestring; - m_pStatus->setText(*m_szFilename); + m_pRemark->setText(*m_szFilename); save(); // Finish off by calling the save action } else { @@ -182,7 +182,7 @@ QMessageBox::NoButton, QMessageBox::NoButton, NULL, "Titraqmessage", true, Qt::WStyle_NormalBorder); - pCwmsg->setIconPixmap(QPixmap(*m_pCwicon)); + pCwmsg->setIconPixmap(QPixmap(*m_pCwlogo)); pCwmsg->exec(); } @@ -202,7 +202,7 @@ QMessageBox::NoButton, QMessageBox::NoButton, NULL, "Osspmessage", true, Qt::WStyle_NormalBorder); - pOsspmsg->setIconPixmap(QPixmap(*m_pOsspicon)); + pOsspmsg->setIconPixmap(QPixmap(*m_pOssplogo)); pOsspmsg->exec(); }