1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/*
* roweditor.h
*
* (c) 2002-2004,2008-2010 by Jeremy Bowman <jmbowman@alum.mit.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
/** @file roweditor.h
* Header file for RowEditor
*/
#ifndef ROWEDITOR_H
#define ROWEDITOR_H
#include <QStringList>
#include <QList>
#include "datatypes.h"
#include "pbdialog.h"
class CalcWidget;
class Database;
class DateWidget;
class DynamicEdit;
class QCheckBox;
class QComboBox;
class QLabel;
class ImageSelector;
class NoteButton;
class NumberWidget;
class TimeWidget;
typedef QList<QCheckBox*> CheckBoxList;
typedef QList<NoteButton*> NoteButtonList;
typedef QList<DateWidget*> DateWidgetList;
typedef QList<TimeWidget*> TimeWidgetList;
typedef QList<NumberWidget*> NumberWidgetList;
typedef QList<QComboBox*> ComboBoxList;
typedef QList<DynamicEdit*> DynamicEditList;
typedef QList<CalcWidget*> CalcWidgetList;
typedef QList<QLabel*> LabelList;
typedef QList<ImageSelector*> ImageSelectorList;
/**
* Dialog for editing the values in one row of the database.
*/
class RowEditor: public PBDialog
{
Q_OBJECT
public:
RowEditor(QWidget *parent = 0);
int edit(Database *subject, int rowId=-1, bool copy=false);
bool isValid();
QStringList getRow(bool doCalcs=true);
protected:
void showEvent(QShowEvent *event);
private:
void addContent(int rowId);
private:
Database *db; /**< The database being edited */
QStringList colNames; /**< Ordered list of all the database's column names */
IntList colTypes; /**< Ordered list of all the database's column types */
CheckBoxList checkBoxes; /**< List of this dialog's boolean edit widgets */
NoteButtonList noteButtons; /**< List of this dialog's note edit widgets */
DateWidgetList dateWidgets; /**< List of this dialog's date edit widgets */
TimeWidgetList timeWidgets; /**< List of this dialog's time edit widgets */
NumberWidgetList numberWidgets; /**< List of this dialog's number edit widgets */
ComboBoxList comboBoxes; /**< List of this dialog's enum edit widgets */
DynamicEditList dynamicEdits; /**< List of this dialog's string edit widgets */
CalcWidgetList calcWidgets; /**< List of this dialog's calculation display widgets */
LabelList sequenceLabels; /**< List of this dialog's sequence number display widgets */
ImageSelectorList imageSelectors; /**< List of this dialog's image selection widgets */
QWidget *initialFocus; /**< The widget which is to receive focus when the dialog is shown */
};
#endif
|