summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardEMailField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h27
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardJIDField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardOrganisationField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h2
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardRoleField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardTitleField.h20
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardURLField.h20
13 files changed, 49 insertions, 200 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h
index 9f2c83b..2746e94 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Address");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardAddressField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardAddressField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Address", UNLIMITED_INSTANCES, QtVCardAddressField)
public:
enum DeliveryType {
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h
index 868fbce..bb574f1 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Address Label");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardAddressLabelField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardAddressLabelField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Address Label", UNLIMITED_INSTANCES, QtVCardAddressLabelField)
public:
enum DeliveryType {
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h
index 28197c0..98e93f0 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h
@@ -22,24 +22,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Birthday");
- }
- virtual int getAllowedInstances() const {
- return 1;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardBirthdayField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardBirthdayField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Birthday", 1, QtVCardBirthdayField)
public:
explicit QtVCardBirthdayField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h
index 22c3a72..e39a764 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Description");
- }
- virtual int getAllowedInstances() const {
- return 1;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardDescriptionField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardDescriptionField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Description", 1, QtVCardDescriptionField)
public:
explicit QtVCardDescriptionField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardEMailField.h b/Swift/QtUI/QtVCardWidget/QtVCardEMailField.h
index ff486a1..15efc08 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardEMailField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardEMailField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("EMail");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardEMailField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardEMailField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("EMail", UNLIMITED_INSTANCES, QtVCardEMailField)
enum EMailType {
Internet = 0,
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h b/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h
index 8a9d089..d37912c 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h
@@ -8,6 +8,32 @@
#include <typeinfo>
+#include <QObject>
+#include <QString>
+
+#define GenericQtVCardFieldInfo(MENU_NAME, ALLOWED_INSTANCES, FIELD_CLASS) \
+ class FieldInfo : public QtVCardFieldInfo { \
+ public: \
+ virtual ~FieldInfo() { \
+ } \
+ \
+ virtual QString getMenuName() const { \
+ return QObject::tr(MENU_NAME); \
+ } \
+ \
+ virtual int getAllowedInstances() const { \
+ return ALLOWED_INSTANCES; \
+ } \
+ \
+ virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const { \
+ return new FIELD_CLASS(parent, editable); \
+ } \
+ \
+ virtual bool testInstance(QWidget* widget) const { \
+ return dynamic_cast<FIELD_CLASS*>(widget) != 0; \
+ } \
+ };
+
class QWidget;
namespace Swift {
@@ -23,5 +49,4 @@ namespace Swift {
virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const = 0;
virtual bool testInstance(QWidget*) const = 0;
};
-
}
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h
index bd697de..c2245cd 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("JID");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardJIDField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardJIDField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("JID", UNLIMITED_INSTANCES, QtVCardJIDField)
public:
explicit QtVCardJIDField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganisationField.h b/Swift/QtUI/QtVCardWidget/QtVCardOrganisationField.h
index 0743823..c3e5173 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardOrganisationField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganisationField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Organisation");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardOrganisationField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardOrganisationField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Organisation", UNLIMITED_INSTANCES, QtVCardOrganisationField)
public:
explicit QtVCardOrganisationField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h
index 2fb7e0a..20c57ae 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h
@@ -23,7 +23,7 @@ namespace Swift {
Q_OBJECT
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
- public :
+ public:
explicit QtVCardPhotoAndNameFields(QWidget* parent = 0);
~QtVCardPhotoAndNameFields();
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h
index f728170..9e7606d 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Role");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardRoleField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardRoleField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Role", UNLIMITED_INSTANCES, QtVCardRoleField)
public:
explicit QtVCardRoleField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h
index d3c6bb2..79ef04b 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Telephone");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardTelephoneField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardTelephoneField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Telephone", UNLIMITED_INSTANCES, QtVCardTelephoneField)
public:
explicit QtVCardTelephoneField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h
index 1de56e7..a3965ce 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("Title");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardTitleField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardTitleField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("Title", UNLIMITED_INSTANCES, QtVCardTitleField)
public:
explicit QtVCardTitleField(QWidget* parent = 0, bool editable = false);
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardURLField.h b/Swift/QtUI/QtVCardWidget/QtVCardURLField.h
index cb73345..debc22d 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardURLField.h
+++ b/Swift/QtUI/QtVCardWidget/QtVCardURLField.h
@@ -21,24 +21,8 @@ namespace Swift {
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(bool empty READ isEmpty)
- public :
- class FieldInfo : public QtVCardFieldInfo {
- public:
- virtual ~FieldInfo() {
- }
- virtual QString getMenuName() const {
- return tr("URL");
- }
- virtual int getAllowedInstances() const {
- return UNLIMITED_INSTANCES;
- }
- virtual QWidget* createFieldInstance(QWidget* parent, bool editable) const {
- return new QtVCardURLField(parent, editable);
- }
- virtual bool testInstance(QWidget* widget) const {
- return dynamic_cast<QtVCardURLField*>(widget) != 0;
- }
- };
+ public:
+ GenericQtVCardFieldInfo("URL", UNLIMITED_INSTANCES, QtVCardURLField)
public:
explicit QtVCardURLField(QWidget* parent = 0, bool editable = false);