Index: ossp-pkg/as/as-gui/Makefile.in
RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/Makefile.in,v
rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/Makefile.in,v' 2>/dev/null
--- Makefile.in 2002/11/25 15:45:04 1.17
+++ Makefile.in 2002/11/27 22:44:48 1.18
@@ -65,9 +65,9 @@
TARGET_PROGS = titraq
TARGET_MANS = titraq.1 titraq.conf.5
-SRCS = main.cpp titraq.cpp titassist.cpp titslot.cpp tidatops.cpp titrex.cpp generic.cpp titamount.cpp titprefs.cpp titraq_version.c
+SRCS = main.cpp titraq.cpp titassist.cpp titslot.cpp tidatops.cpp titrex.cpp generic.cpp titamount.cpp titable.cpp titprefs.cpp titraq_version.c
-OBJS = main.o titraq.o titassist.o titslot.o tidatops.o titrex.o generic.o titamount.o titprefs.o titraq_version.o
+OBJS = main.o titraq.o titassist.o titslot.o tidatops.o titrex.o generic.o titamount.o titable.o titprefs.o titraq_version.o
GRAFX = gfx/ossplogo.xpm
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.32' '-r1.33' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v' 2>/dev/null
--- as_assist.cpp 2002/11/27 18:40:15 1.32
+++ as_assist.cpp 2002/11/27 22:44:48 1.33
@@ -272,7 +272,7 @@
m_pTbarspopup->setItemChecked(nMenuid, true);
nMenuid = m_pTbarspopup->insertItem(trUtf8("&Edit"), this, SLOT(showEditbar()));
m_pTbarspopup->setItemChecked(nMenuid, true);
- nMenuid = m_pTbarspopup->insertItem(trUtf8("&Whats this"), this, SLOT(showWhatsbar()));
+ nMenuid = m_pTbarspopup->insertItem(trUtf8("&Whats"), this, SLOT(showWhatsbar()));
m_pTbarspopup->setItemChecked(nMenuid, true);
m_pViewpopup->insertSeparator();
m_pViewpopup->insertItem(trUtf8("&Columns"), m_pColspopup);
@@ -366,10 +366,10 @@
setCentralWidget(m_pCenframe);
// Layout controls for table, editing widgets
- 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_pMainlayout = new QVBoxLayout(m_pCenframe, TITRAQ_MARGIN, TITRAQ_SPACING, "Mainlayout"); // For layouts
+ m_pPackagelayout = new QVBoxLayout(0, 0, TITRAQ_SPACING, "Packagelayout"); // For table
+ m_pDatelayout = new QHBoxLayout(0, 0, TITRAQ_SPACING, "Datelayout"); // For dates
+ m_pTasklayout = new QHBoxLayout(0, 0, TITRAQ_SPACING, "Tasklayout"); // For tasks
// Major sanity check wrapped in one call
if (!(m_pMainlayout && m_pPackagelayout && m_pDatelayout && m_pTasklayout))
@@ -403,12 +403,14 @@
m_pMaintable->setNumCols(g_knCols);
m_pMaintable->setReadOnly(true); // Table is read only
m_pMaintable->setColumnMovingEnabled(false); // Ctrl-drag disabled
- m_pMaintable->setSelectionMode(QTable::SingleRow); // Multi row selection
+ m_pMaintable->setSelectionMode(QTable::MultiRow); // Multi row selection
m_pMaintable->setCurrentCell(-1, 0); // Initial row value -1
m_pMaintable->setFocusStyle(QTable::FollowStyle); // How cells are drawn
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(true);
+ m_pMaintable->horizontalHeader()->setClickEnabled(true); // No click signals
+ m_pMaintable->horizontalHeader()->setTracking(false); // No continuous tracking
m_pMaintable->setColumnStretchable(g_knCols - 1, true);
m_pMaintable->setSorting(false);
@@ -427,6 +429,7 @@
// Table update signals
connect(m_pMaintable, SIGNAL(currentChanged(int, int)), this, SLOT(updEdit(int, int)));
connect(m_pMaintable, SIGNAL(doubleClicked(int, int, int, const QPoint&)), this, SLOT(inplaceEdit(int, int, int, const QPoint&)));
+ connect(m_pMaintable->horizontalHeader(), SIGNAL(sizeChange(int, int, int)), this, SLOT(updSizes(int, int, int)));
// connect(m_pMaintable, SIGNAL(valueChanged(int, int)), this, SLOT(tableChanged(int, int)));
}
@@ -435,6 +438,9 @@
//
void Titraqform::setupEditlay(void)
{
+// QSpacerItem Pad(TITRAQ_SPACING / 2, 0, QSizePolicy::Fixed);
+// m_pDatelayout->addWidget(&Pad); // Padd left side of control layout
+
// Make the date selector
m_pDateedit = new QDateEdit(m_pCenframe, "Date");
m_pDatezero = new QDate(m_pDateedit->date()); // Hack to store empty date
@@ -505,10 +511,12 @@
"value with the arrow buttons.";
QWhatsThis::add(m_pAmount, kszAmount);
- // Populate the stringlist with fresh tasks
+ // Construct a stringlist just to hold task values
m_pTaskentries = new QStringList;
if (m_pTaskentries == NULL) // Sanity check
throw Genexcept("Main window task entries creation failed.");
+
+ // Populate the stringlist with fresh tasks
*m_pTaskentries << trUtf8("titraq") << trUtf8("opgui")
<< trUtf8("email") << trUtf8("admin")
<< trUtf8("pmod") << trUtf8("psod")
@@ -527,17 +535,16 @@
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
+ // Add an auto scroll bar if possible under current GUI style
+ if (m_pTasks->listBox()) // Motif style has no list box
m_pTasks->listBox()->setHScrollBarMode(QScrollView::Auto);
- m_pTasks->setMinimumWidth(m_pTasks->listBox()->maxItemWidth());
- }
+// m_pTasks->setMinimumWidth(m_pTasks->listBox()->maxItemWidth());
// Whatsthis info for the remark line
const char *kszTasktext = "Choose a task account by clicking on "
"this box, and choosing whichever item most "
"closely resembles your task.";
- m_pTasklayout->addWidget(m_pTasks); // Finally add the task edit
+ m_pDatelayout->addWidget(m_pTasks); // Finally add the task edit
// Make the Remark line
m_pRemark = new QLineEdit(m_pCenframe, "Remark");
@@ -549,7 +556,7 @@
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
+ m_pDatelayout->addWidget(m_pRemark); // Finally add the remark line
// Whatsthis info for the remark line
const char *kszRemarktext = "Edit the task remarks by clicking on "
@@ -557,21 +564,8 @@
"have about the task.";
QWhatsThis::add(m_pRemark, kszRemarktext);
- // Tuple push button confirm
- m_pConfirmbutton = new QPushButton(m_pCenframe, "Confirmbutton");
- if (m_pConfirmbutton == NULL) // Sanity check
- throw Genexcept("Main window confirm button creation failed.");
- m_pConfirmbutton->setCursor(QCursor(13));
- m_pConfirmbutton->setPaletteBackgroundColor(QColor(206, 192, 176));
- m_pConfirmbutton->setText(trUtf8("&Confirm"));
- QToolTip::add(m_pConfirmbutton, trUtf8("Confirm Editing"));
- connect(m_pConfirmbutton, SIGNAL(clicked()), this, SLOT(confirmEdit()));
- m_pTasklayout->addWidget(m_pConfirmbutton); // Finally add the confirm button
-
- // Whatsthis info for the confirm button
- const char *kszConfirmtext = "Confirm any row edition by "
- "finally clicking on this button.";
- QWhatsThis::add(m_pConfirmbutton, kszConfirmtext);
+ // Start edit controls off at right size
+ this->updSizes(TITRAQ_IDXALLCTRLS, -1, -1);
// // Signals
// connect(m_pDateedit, SIGNAL(valueChanged(const QDate &date)), this, SLOT(updateDate()));
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.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v' 2>/dev/null
--- as_const.h 2002/11/26 20:25:16 1.6
+++ as_const.h 2002/11/27 22:44:48 1.7
@@ -13,6 +13,7 @@
#define TITRAQ_DEFLOCALLOG "no"
// Indexes of table columns
+#define TITRAQ_IDXALLCTRLS -1
#define TITRAQ_IDXDATE 0
#define TITRAQ_IDXSTART 1
#define TITRAQ_IDXFINISH 2
@@ -26,6 +27,8 @@
#define TITRAQ_IDXWHATBAR 3
// Values
+#define TITRAQ_MARGIN 10 // Default layout margin
+#define TITRAQ_SPACING 6 // Default layout spacing
#define TITRAQ_MAXAMOUNT 960 // Maximum valid amount
#define TITRAQ_MINAMOUNT 0 // Minimum valid amount
#define TITRAQ_STEPAMOUNT 15 // Line step interval
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.32' '-r1.33' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v' 2>/dev/null
--- as_gui.h 2002/11/27 18:40:15 1.32
+++ as_gui.h 2002/11/27 22:44:48 1.33
@@ -73,7 +73,6 @@
AmountBox *m_pAmount; // Control used to edit total time
QComboBox *m_pTasks; // Control used to choose a task
QLineEdit *m_pRemark; // Control used to edit remark
- QPushButton *m_pConfirmbutton; // Button used to confirm edition
protected slots:
void cutEntry(void); // Cut a task entry from the list
@@ -92,7 +91,8 @@
void selAll(void); // Edit menu select all
void inplaceEdit(int, int, int, const QPoint &); // Enter in place edit mode
void updEdit(int, int); // Update edit controls
- void confirmEdit(void); // Confirm recent edition
+ void updSizes(int, int, int); // Update edit sizes
+ void confirmEdit(void); // Confirm whole row edition
void configPrefs(void); // Edit menu configure preferences
void editingView(void); // View menu editing
void timingView(void); // View menu timing
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.24' '-r1.25' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null
--- as_slot.cpp 2002/11/27 18:40:15 1.24
+++ as_slot.cpp 2002/11/27 22:44:48 1.25
@@ -194,6 +194,44 @@
}
//
+// Update the edit controls widget sizes
+//
+void Titraqform::updSizes(int nSection, int nOldsize, int nNewsize)
+{
+ switch (nSection) {
+ case TITRAQ_IDXALLCTRLS:
+ m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2);
+ m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING);
+ m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING);
+ m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING);
+ m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING);
+// m_pRemark->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREMARK) - TITRAQ_SPACING);
+ break;
+ case TITRAQ_IDXDATE:
+ m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2);
+ break;
+ case TITRAQ_IDXSTART:
+ m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING);
+ break;
+ case TITRAQ_IDXFINISH:
+ m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING);
+ break;
+ case TITRAQ_IDXAMOUNT:
+ m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING);
+ break;
+ case TITRAQ_IDXTASK:
+ m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING);
+ break;
+ case TITRAQ_IDXREMARK:
+// m_pRemark->setFixedWidth(nNewsize);
+ break;
+ default:
+ throw Genexcept("Unrecognized main window column header.");
+ break;
+ }
+}
+
+//
// Update the edit controls contents
//
void Titraqform::updEdit(int nRow, int nCol)
@@ -233,7 +271,7 @@
}
//
-// Confirm any recent editions on a single row
+// Confirm any recent editions on a whole row
//
void Titraqform::confirmEdit(void)
{
Index: ossp-pkg/as/as-gui/as_table.cpp
RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_table.cpp,v
co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/as/as-gui/as_table.cpp,v' | diff -u /dev/null - -L'ossp-pkg/as/as-gui/as_table.cpp' 2>/dev/null
--- ossp-pkg/as/as-gui/as_table.cpp
+++ - 2025-04-11 21:41:26.173087350 +0200
@@ -0,0 +1,14 @@
+#include
+#include
+
+#include "titraq.h"
+
+
+// Implements an event filter for catching header double click events
+bool TiTable::eventFilter(QObject *pObject, QEvent *pEvent)
+{
+ if (pObject == horizontalHeader())
+ return false;
+ else
+ return QTable::eventFilter(pObject, pEvent); // Pass the event onwards
+}
Index: ossp-pkg/as/as-gui/as_table.h
RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_table.h,v
rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_table.h,v' 2>/dev/null
--- as_table.h 2002/11/27 17:13:13 1.1
+++ as_table.h 2002/11/27 22:44:48 1.2
@@ -7,11 +7,15 @@
class TiTable : public QTable
{
public:
- TiTable(QWidget *pParent = 0, const char *szName = 0) : QTable(pParent, szName) {};
+ // Try to match QTable's default constructor with an initializer list
+ TiTable(QWidget *pParent = 0, const char *szName = 0) : QTable(pParent, szName) {horizontalHeader()->installEventFilter(this);};
// Deny a cell special handling of the focus rectangle
// by overriding class QTable's paintFocus method
- void TiTable::paintFocus(QPainter *, const QRect &) {};
+ void paintFocus(QPainter *, const QRect &) {};
+
+private:
+ bool eventFilter(QObject *, QEvent *);
};
#endif // TITABLE_H