--- as_gui.cpp 2002/11/08 12:27:57 1.1
+++ as_gui.cpp 2002/11/11 21:39:08 1.2
@@ -1,16 +1,10 @@
-#include "titraq.h"
-
-#include <qvariant.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qtable.h>
-#include <qmime.h>
-#include <qdragobject.h>
-#include <qlayout.h>
+// System interface
#include <qtooltip.h>
#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
+
+// User interface
+#include "titraq.h" // Main classes
+#include "gfx/ossplogo.xpm" // OSSP logo: static const char *ossplogo_xpm[]
// Used in initialization of the application
void Titraqform::init()
@@ -20,67 +14,102 @@
}
//
-// Construct a Titraqform which is a child of 'pParent', with the
+// Construct a Titraqform which is a child of 'pParent', with the
// name 'kszName' and widget flags set to 'Flags'
//
-
Titraqform::Titraqform(QWidget *pParent, const char *kszName, bool bModal,
WFlags Flags) : QDialog(pParent, kszName, bModal, Flags)
{
if (!kszName)
setName("Titraqform");
- resize(600, 480);
- setCaption(trUtf8("OpenPKG Friend"));
- pTitraqformlayout = new QVBoxLayout(this, 11, 6, "pTitraqformlayout");
-
- // Contains the package layout and control layout
- pMainlayout = new QVBoxLayout(0, 0, 6, "pMainlayout");
+ resize(600, 480);
+ setCaption(trUtf8("OSSP Titraq"));
- // Contains the table control and status line control
- pPackagelayout = new QVBoxLayout(0, 0, 6, "pPackagelayout");
+ // Control layouts for form, table, and status line
+ pTitraqformlayout = new QVBoxLayout(this, 11, 6, "pTitraqformlayout");
+ pMainlayout = new QVBoxLayout(0, 0, 6, "pMainlayout"); // For layouts
+ pPackagelayout = new QVBoxLayout(0, 0, 6, "pPackagelayout"); // For table
+ // The table itself
pMaintable = new QTable(this, "pMaintable");
- pMaintable->setNumRows(10);
- pMaintable->setNumCols(6);
- pMaintable->setReadOnly(FALSE);
- pPackagelayout->addWidget(pMaintable);
-
- pStatusline = new QLineEdit(this, "pStatusline");
- pStatusline->setFrameShape(QLineEdit::LineEditPanel);
- pStatusline->setFrameShadow(QLineEdit::Sunken);
- pStatusline->setFrame(TRUE);
- pStatusline->setReadOnly(TRUE);
- pPackagelayout->addWidget(pStatusline);
+ pMaintable->setNumRows(knRows);
+ pMaintable->setNumCols(knCols);
+ pMaintable->setReadOnly(false); // Not read only
+ pMaintable->setColumnMovingEnabled(true);
+ pMaintable->setSelectionMode(QTable::MultiRow); // Multi row selection
+ pMaintable->setLeftMargin(0); // Get rid of the vertical header
+ pMaintable->verticalHeader()->hide(); // by hiding it with a margin of 0
+ pMaintable->horizontalHeader()->setResizeEnabled(false);
+ pMaintable->setColumnStretchable(5, true);
+
+ // Table header row
+ pTablehead = pMaintable->horizontalHeader();
+ pTablehead->setLabel(0, QObject::tr("Date"), 76);
+ pTablehead->setLabel(1, QObject::tr("Begin"));
+ pTablehead->setLabel(2, QObject::tr("End"));
+ pTablehead->setLabel(3, QObject::tr("Amount"), 52);
+ pTablehead->setLabel(4, QObject::tr("Task"), 60);
+ pTablehead->setLabel(5, QObject::tr("Remark"));
+ pTablehead->setMovingEnabled(true);
+
+ // Icon table items
+ pIconimage = new QImage(ossplogo_xpm);
+ pIconpixmap = new QPixmap(pIconimage->scaleHeight(pMaintable->rowHeight(6)));
+ pMaintable->setPixmap(3, 2, *pIconpixmap);
+ pMaintable->setText(3, 2, "OSSP Titraq");
+
+ // Set contents of a generic combobox
+ pComboentries = new QStringList;
+ *pComboentries << "uno" << "dos" << "tres" << "quatro";
+
+ // Make the combobox items for all rows
+ for (int i = 0; i < knRows; ++i) {
+ QComboTableItem *pComboitem = new QComboTableItem(pMaintable, *pComboentries, false);
+ pComboitem->setCurrentItem(i % 4);
+ pMaintable->setItem(i, 4, pComboitem);
+ }
+
+ // Make the checkbox items for all rows
+ for (int j = 0; j < knRows; ++j)
+ pMaintable->setItem(j, 1, new QCheckTableItem(pMaintable, "Checkung"));
+
+ pPackagelayout->addWidget(pMaintable); // Finally add the table widget
+
+ // Bottom output line
+ pStatus = new QLineEdit(this, "pStatus");
+ pStatus->setFrameShape(QLineEdit::LineEditPanel);
+ pStatus->setFrameShadow(QLineEdit::Sunken);
+ pStatus->setFrame(true);
+ pStatus->setReadOnly(true);
+ pPackagelayout->addWidget(pStatus);
pMainlayout->addLayout(pPackagelayout);
- // Contains all the push button controls
- pControllayout = new QHBoxLayout(0, 0, 6, "pControllayout");
+ // Control layout for push buttons
+ pControllayout = new QHBoxLayout(0, 0, 6, "pControllayout"); // For buttons
- pInstallbutton = new QPushButton(this, "pInstallbutton");
- pInstallbutton->setCursor(QCursor(13));
- pInstallbutton->setText(trUtf8("&Install"));
- pInstallbutton->setFlat(FALSE);
- pControllayout->addWidget(pInstallbutton);
+ // Tuple push button add
+ pAddbutton = new QPushButton(this, "AddButton");
+ pAddbutton->setCursor(QCursor(13));
+ pAddbutton->setText(trUtf8("&Add"));
+ pControllayout->addWidget(pAddbutton);
+ // Tuple push button delete
pDeletebutton = new QPushButton(this, "pDeletebutton");
pDeletebutton->setCursor(QCursor(13));
pDeletebutton->setText(trUtf8("&Delete"));
+ pDeletebutton->setFlat(false);
pControllayout->addWidget(pDeletebutton);
- pVerifybutton = new QPushButton(this, "VerifyButton");
- pVerifybutton->setCursor(QCursor(13));
- pVerifybutton->setText(trUtf8("&Verify"));
- pControllayout->addWidget(pVerifybutton);
-
- pCommitbutton = new QPushButton(this, "pCommitbutton");
- pCommitbutton->setPaletteBackgroundColor(QColor(186, 156, 144));
- pCommitbutton->setCursor(QCursor(13));
- pCommitbutton->setText(trUtf8("&Commit"));
- pControllayout->addWidget(pCommitbutton);
+ // Tuple push button write
+ pWritebutton = new QPushButton(this, "pWritebutton");
+ pWritebutton->setPaletteBackgroundColor(QColor(186, 156, 144));
+ pWritebutton->setCursor(QCursor(13));
+ pWritebutton->setText(trUtf8("&Write"));
+ pControllayout->addWidget(pWritebutton);
pMainlayout->addLayout(pControllayout);
pTitraqformlayout->addLayout(pMainlayout);
- init(); // signals and slots connections
+ init(); // Initialize signal and slot connections
}
//
|