From cb09ecce34b02b2b12da2c75fdb818303df7bbb8 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Fri, 30 May 2025 10:56:15 +0200 Subject: [PATCH 1/2] workaround for ancient, but still existing msvc bug (multiple exported static members in one declaration produce link errors; see also https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/127900) --- libs/libcanvas/src/baseobjectview.h | 20 +- libs/libcanvas/src/basetableview.h | 4 +- libs/libcanvas/src/objectsscene.h | 45 ++-- libs/libcanvas/src/relationshipview.h | 6 +- libs/libcanvas/src/tableobjectview.h | 20 +- libs/libcanvas/src/textboxview.h | 2 +- libs/libcanvas/src/textpolygonitem.h | 4 +- libs/libcli/src/compat/view.cpp | 4 +- libs/libcli/src/pgmodelercliapp.h | 174 +++++++-------- libs/libconnector/src/catalog.h | 32 +-- libs/libcore/src/basegraphicobject.h | 4 +- libs/libcore/src/baseobject.h | 28 +-- libs/libcore/src/foreignobject.h | 4 +- libs/libcore/src/pgsqltypes/actiontype.h | 10 +- libs/libcore/src/pgsqltypes/behaviortype.h | 6 +- libs/libcore/src/pgsqltypes/categorytype.h | 28 +-- libs/libcore/src/pgsqltypes/checkoptiontype.h | 5 +- libs/libcore/src/pgsqltypes/constrainttype.h | 10 +- libs/libcore/src/pgsqltypes/deferraltype.h | 4 +- .../libcore/src/pgsqltypes/eventtriggertype.h | 8 +- libs/libcore/src/pgsqltypes/eventtype.h | 10 +- libs/libcore/src/pgsqltypes/executiontype.h | 4 +- libs/libcore/src/pgsqltypes/firingtype.h | 6 +- libs/libcore/src/pgsqltypes/functiontype.h | 6 +- libs/libcore/src/pgsqltypes/identitytype.h | 4 +- libs/libcore/src/pgsqltypes/indexingtype.h | 12 +- libs/libcore/src/pgsqltypes/intervaltype.h | 26 +-- libs/libcore/src/pgsqltypes/matchtype.h | 6 +- libs/libcore/src/pgsqltypes/paralleltype.h | 6 +- .../libcore/src/pgsqltypes/partitioningtype.h | 6 +- libs/libcore/src/pgsqltypes/pgsqltype.h | 12 +- libs/libcore/src/pgsqltypes/policycmdtype.h | 10 +- libs/libcore/src/pgsqltypes/providertype.h | 4 +- libs/libcore/src/pgsqltypes/securitytype.h | 4 +- libs/libcore/src/pgsqltypes/spatialtype.h | 16 +- libs/libcore/src/pgsqltypes/storagetype.h | 8 +- libs/libcore/src/pgsqltypes/templatetype.h | 2 +- libs/libcore/src/relationship.h | 10 +- libs/libcore/src/sequence.h | 13 +- libs/libgui/src/dbobjects/baseobjectwidget.h | 6 +- .../src/settings/appearanceconfigwidget.h | 10 +- .../libgui/src/tools/databaseexplorerwidget.h | 6 +- libs/libgui/src/tools/modelsdiffhelper.h | 10 +- libs/libgui/src/utils/objectslistmodel.h | 5 +- libs/libgui/src/utils/syntaxhighlighter.h | 6 +- libs/libgui/src/widgets/linenumberswidget.h | 4 +- libs/libgui/src/widgets/modelwidget.h | 23 +- libs/libgui/src/widgets/numberedtexteditor.h | 4 +- libs/libparsers/src/csvdocument.h | 6 +- libs/libparsers/src/schemaparser.h | 92 ++++---- libs/libutils/src/exception.h | 3 +- libs/libutils/src/globalattributes.h | 198 +++++++++--------- 52 files changed, 475 insertions(+), 481 deletions(-) diff --git a/libs/libcanvas/src/baseobjectview.h b/libs/libcanvas/src/baseobjectview.h index ebce35b8d7..720264a733 100644 --- a/libs/libcanvas/src/baseobjectview.h +++ b/libs/libcanvas/src/baseobjectview.h @@ -136,16 +136,16 @@ class __libcanvas BaseObjectView: public QObject, public QGraphicsItemGroup { void fade(bool fd_in, int duration, int loop_cnt = 1, qreal final_opacity = 1); public: - static constexpr double VertSpacing=2.0, - HorizSpacing=2.0, - DefaultFontSize=10.0, - ObjectBorderWidth=1.00, - MaxDpiFactor=1.4, - ObjectShadowXPos=8, - ObjectShadowYPos=8; - - static constexpr int ObjectAlphaChannel=128, - ObjectShadowAlphaChannel=50; + static constexpr double VertSpacing=2.0; + static constexpr double HorizSpacing=2.0; + static constexpr double DefaultFontSize=10.0; + static constexpr double ObjectBorderWidth=1.00; + static constexpr double MaxDpiFactor=1.4; + static constexpr double ObjectShadowXPos=8; + static constexpr double ObjectShadowYPos=8; + + static constexpr int ObjectAlphaChannel=128; + static constexpr int ObjectShadowAlphaChannel=50; BaseObjectView(BaseObject *object=nullptr); virtual ~BaseObjectView(); diff --git a/libs/libcanvas/src/basetableview.h b/libs/libcanvas/src/basetableview.h index 3746882ed0..8c8293fcf0 100644 --- a/libs/libcanvas/src/basetableview.h +++ b/libs/libcanvas/src/basetableview.h @@ -64,10 +64,10 @@ class __libcanvas BaseTableView: public BaseObjectView { *ext_attribs; //! brief Indicates if the extended attributes body should be hidden - static bool hide_ext_attribs, + static bool hide_ext_attribs; //! brief Indicates if the tag object should be hidden - hide_tags; + static bool hide_tags; //! brief Controls the maximum amount of attributes visible per page (columns/references + extended attributes) static unsigned attribs_per_page[2]; diff --git a/libs/libcanvas/src/objectsscene.h b/libs/libcanvas/src/objectsscene.h index 8da17d3ab4..382c12fdfc 100644 --- a/libs/libcanvas/src/objectsscene.h +++ b/libs/libcanvas/src/objectsscene.h @@ -44,25 +44,25 @@ class __libcanvas ObjectsScene: public QGraphicsScene { }; //! \brief Stores the default grid line color - static const QColor DefaultGridColor, + static const QColor DefaultGridColor; //! \brief Stores the default grid line color - DefaultCanvasColor, + static const QColor DefaultCanvasColor; //! \brief Stores the default page delimiter lines color - DefaultDelimitersColor; + static const QColor DefaultDelimitersColor; private: static GridPattern grid_pattern; //! \brief Stores the grid line color - static QColor grid_color, + static QColor grid_color; //! \brief Stores the canvas background color - canvas_color, + static QColor canvas_color; //! \brief Stores the page delimiter lines color - delimiters_color; + static QColor delimiters_color; //! \brief Holds the names of the layers on the scene used to separate in the objects on the canvas QStringList layers, @@ -83,9 +83,9 @@ class __libcanvas ObjectsScene: public QGraphicsScene { show_scene_limits; - static constexpr int SceneMoveStep=20, - SceneMoveTimeout=20, - SceneMoveThreshold=100; + static constexpr int SceneMoveStep=20; + static constexpr int SceneMoveTimeout=20; + static constexpr int SceneMoveThreshold=100; //! \brief Timer responsible to move the scene QTimer scene_move_timer, @@ -107,37 +107,36 @@ class __libcanvas ObjectsScene: public QGraphicsScene { int scene_move_dx, scene_move_dy; //! \brief Object alignemnt, grid showing, page delimiter showing options - static bool align_objs_grid, + static bool align_objs_grid; + static bool show_grid; - show_grid, - - show_page_delim, + static bool show_page_delim; //! \brief Indicates if the corner move is enabled for the scene - corner_move, + static bool corner_move; /*! \brief Indicates that panning mode and range selection model are activate in inverse mode. By default panning model is activated with a single left-click and range selection with SHIFT + left-click */ - invert_rangesel_trigger, + static bool invert_rangesel_trigger; - lock_delim_scale; + static bool lock_delim_scale; //! \brief Scene grid size - static unsigned grid_size, + static unsigned grid_size; //! \brief The number of pages in which the scene rect is expanded - expansion_factor; + static unsigned expansion_factor; //! \brief Used to store the canvas/printer page layout (size, orientation, margins) static QPageLayout page_layout; - static double delimiter_scale, + static double delimiter_scale; //! \brief The minimum scene width is defined to be width of the current page layout * 2 - min_scene_width, + static double min_scene_width; //! \brief The minimum scene height is defined to be height of the current page layout * 2 - min_scene_height; + static double min_scene_height; //! \brief Indicates that there are objects being moved and the signal s_objectsMoved must be emitted bool moving_objs, @@ -227,8 +226,8 @@ class __libcanvas ObjectsScene: public QGraphicsScene { LayerRectColor }; - static constexpr double MinScaleFactor = 0.100000, - MaxScaleFactor = 5.000001; + static constexpr double MinScaleFactor = 0.100000; + static constexpr double MaxScaleFactor = 5.000001; static constexpr unsigned DefaultLayer = 0; diff --git a/libs/libcanvas/src/relationshipview.h b/libs/libcanvas/src/relationshipview.h index e29799a60e..f6a90a2aeb 100644 --- a/libs/libcanvas/src/relationshipview.h +++ b/libs/libcanvas/src/relationshipview.h @@ -52,13 +52,13 @@ class __libcanvas RelationshipView: public BaseObjectView { static constexpr double ConnLineLength=20.0; //! \brief Indicates that the relationship labels must be hidden - static bool hide_name_label, + static bool hide_name_label; //! \brief Indicates that the relationship lines should be curved - use_curved_lines, + static bool use_curved_lines; //! \brief Indicates that the relationship should be drawn in Crow's foot notation - use_crows_foot; + static bool use_crows_foot; /*! \brief Specify the type of connection used by the lines. The first (classical) is to connect the line to tables through their central points. The second (better semantics) diff --git a/libs/libcanvas/src/tableobjectview.h b/libs/libcanvas/src/tableobjectview.h index 07e1125d26..6526911d71 100644 --- a/libs/libcanvas/src/tableobjectview.h +++ b/libs/libcanvas/src/tableobjectview.h @@ -63,16 +63,16 @@ class __libcanvas TableObjectView: public BaseObjectView { QString formatUserTypeName(PgSqlType type); public: - static const QString TypeSeparator, - ConstrSeparator, - TextUnique, - TextExclude, - TextCheck, - TextPrimaryKey, - TextForeignKey, - TextNotNull, - ConstrDelimStart, - ConstrDelimEnd; + static const QString TypeSeparator; + static const QString ConstrSeparator; + static const QString TextUnique; + static const QString TextExclude; + static const QString TextCheck; + static const QString TextPrimaryKey; + static const QString TextForeignKey; + static const QString TextNotNull; + static const QString ConstrDelimStart; + static const QString ConstrDelimEnd; enum ChildObjectId: unsigned { ObjDescriptor, diff --git a/libs/libcanvas/src/textboxview.h b/libs/libcanvas/src/textboxview.h index 352b750f5b..5cbcf2bd5c 100644 --- a/libs/libcanvas/src/textboxview.h +++ b/libs/libcanvas/src/textboxview.h @@ -53,7 +53,7 @@ class __libcanvas TextboxView: public BaseObjectView { public: TextboxView(Textbox *txtbox, bool override_style = false); - virtual ~TextboxView(); + virtual ~TextboxView(); /*! \brief Sets the fill and border color for the text box. This method has effect only when the style can be overriden (via constructor) */ diff --git a/libs/libcanvas/src/textpolygonitem.h b/libs/libcanvas/src/textpolygonitem.h index bbacfb0970..2448d1e1e2 100644 --- a/libs/libcanvas/src/textpolygonitem.h +++ b/libs/libcanvas/src/textpolygonitem.h @@ -34,9 +34,9 @@ class __libcanvas TextPolygonItem : public QGraphicsPolygonItem { private: - QGraphicsTextItem *text_item; + QGraphicsTextItem *text_item; - bool word_wrap; + bool word_wrap; public: TextPolygonItem(QGraphicsItem *parent = nullptr); diff --git a/libs/libcli/src/compat/view.cpp b/libs/libcli/src/compat/view.cpp index b4554ee6c2..58d18a9548 100644 --- a/libs/libcli/src/compat/view.cpp +++ b/libs/libcli/src/compat/view.cpp @@ -18,7 +18,7 @@ #include "view.h" -using namespace CompatNs; +namespace CompatNs { View::View() : BaseTable() { @@ -608,3 +608,5 @@ QString View::getDropCode(bool cascade) setSQLObjectAttribute(); return BaseObject::getDropCode(cascade); } + +} diff --git a/libs/libcli/src/pgmodelercliapp.h b/libs/libcli/src/pgmodelercliapp.h index 021f797d8a..15f6baf978 100644 --- a/libs/libcli/src/pgmodelercliapp.h +++ b/libs/libcli/src/pgmodelercliapp.h @@ -195,92 +195,92 @@ class __libcli PgModelerCliApp: public Application { public: //! \brief Option names constants - static const QString AllChildren, - Input, - Output, - InputDb, - ExportToFile, - ExportToPng, - ExportToSvg, - ExportToDbms, - ExportToDict, - ImportDb, - NoIndex, - Split, - Markdown, - DependenciesSql, - ChildrenSql, - GroupByType, - GenDropScript, - Diff, - DropDatabase, - DropObjects, - NonTransactional, - PgSqlVer, - Help, - ShowGrid, - ShowDelimiters, - PageByPage, - OverrideBgColor, - IgnoreDuplicates, - IgnoreErrorCodes, - ConnAlias, - Host, - Port, - User, - Passwd, - InitialDb, - Silent, - ListConns, - Simulate, - FixModel, - FixTries, - ZoomFactor, - UseTmpNames, - DbmMimeType, - Install, - Uninstall, - SystemWide, - IgnoreImportErrors, - ImportSystemObjs, - ImportExtensionObjs, - DebugMode, - FilterObjects, - MatchByName, - ForceChildren, - OnlyMatching, - CommentsAsAliases, - PartialDiff, - Force, - StartDate, - EndDate, - CompareTo, - SaveDiff, - ApplyDiff, - NoDiffPreview, - DropClusterObjs, - RevokePermissions, - DropMissingObjs, - ForceDropColsConstrs, - RenameDb, - NoSequenceReuse, - NoCascadeDrop, - RecreateUnmod, - ReplaceModified, - ForceReCreateObjs, - CreateConfigs, - MissingOnly, - IgnoreFaultyPlugins, - ListPlugins, - - ConnOptions, - TagExpr, - EndTagExpr, - AttributeExpr, - ModelFixLog, - - MsgFileAssociated, - MsgNoFileAssociation; + static const QString AllChildren; + static const QString Input; + static const QString Output; + static const QString InputDb; + static const QString ExportToFile; + static const QString ExportToPng; + static const QString ExportToSvg; + static const QString ExportToDbms; + static const QString ExportToDict; + static const QString ImportDb; + static const QString NoIndex; + static const QString Split; + static const QString Markdown; + static const QString DependenciesSql; + static const QString ChildrenSql; + static const QString GroupByType; + static const QString GenDropScript; + static const QString Diff; + static const QString DropDatabase; + static const QString DropObjects; + static const QString NonTransactional; + static const QString PgSqlVer; + static const QString Help; + static const QString ShowGrid; + static const QString ShowDelimiters; + static const QString PageByPage; + static const QString OverrideBgColor; + static const QString IgnoreDuplicates; + static const QString IgnoreErrorCodes; + static const QString ConnAlias; + static const QString Host; + static const QString Port; + static const QString User; + static const QString Passwd; + static const QString InitialDb; + static const QString Silent; + static const QString ListConns; + static const QString Simulate; + static const QString FixModel; + static const QString FixTries; + static const QString ZoomFactor; + static const QString UseTmpNames; + static const QString DbmMimeType; + static const QString Install; + static const QString Uninstall; + static const QString SystemWide; + static const QString IgnoreImportErrors; + static const QString ImportSystemObjs; + static const QString ImportExtensionObjs; + static const QString DebugMode; + static const QString FilterObjects; + static const QString MatchByName; + static const QString ForceChildren; + static const QString OnlyMatching; + static const QString CommentsAsAliases; + static const QString PartialDiff; + static const QString Force; + static const QString StartDate; + static const QString EndDate; + static const QString CompareTo; + static const QString SaveDiff; + static const QString ApplyDiff; + static const QString NoDiffPreview; + static const QString DropClusterObjs; + static const QString RevokePermissions; + static const QString DropMissingObjs; + static const QString ForceDropColsConstrs; + static const QString RenameDb; + static const QString NoSequenceReuse; + static const QString NoCascadeDrop; + static const QString RecreateUnmod; + static const QString ReplaceModified; + static const QString ForceReCreateObjs; + static const QString CreateConfigs; + static const QString MissingOnly; + static const QString IgnoreFaultyPlugins; + static const QString ListPlugins; + + static const QString ConnOptions; + static const QString TagExpr; + static const QString EndTagExpr; + static const QString AttributeExpr; + static const QString ModelFixLog; + + static const QString MsgFileAssociated; + static const QString MsgNoFileAssociation; PgModelerCliApp(int argc, char **argv); @@ -289,7 +289,7 @@ class __libcli PgModelerCliApp: public Application { //! \brief Shows the options menu void showMenu(); - //! \brief Shows the version info + //! \brief Shows the version info void showVersionInfo(); /*! \brief Prints to the stdout the provided text appending a \n on the string diff --git a/libs/libconnector/src/catalog.h b/libs/libconnector/src/catalog.h index 845aa3a673..ef78c8e1ab 100644 --- a/libs/libconnector/src/catalog.h +++ b/libs/libconnector/src/catalog.h @@ -58,32 +58,32 @@ class __libconnector Catalog { SchemaParser schparser; //! \brief Executes a list command on catalog - static const QString QueryList, + static const QString QueryList; //! \brief Executes a attribute retrieving command on catalog - QueryAttribs, + static const QString QueryAttribs; //! \brief Replacement for true 't' boolean value - PgSqlTrue, + static const QString PgSqlTrue; //! \brief Replacement for false 'f' boolean value - PgSqlFalse, + static const QString PgSqlFalse; //! \brief Suffix for boolean fields. - BoolField, + static const QString BoolField; /*! \brief Query used to retrieve extension objects. * This query retrieve all extension child object except for data types because * they are handled in extension catalog query */ - GetExtensionObjsSql, + static const QString GetExtensionObjsSql; //! \brief This pattern matches the PostgreSQL array values in format [n:n]={a,b,c,d,...} or {a,b,c,d,...} - ArrayPattern, + static const QString ArrayPattern; //! \brief Holds a constant string used to mark invalid filter patterns - InvFilterPattern, + static const QString InvFilterPattern; - AliasPlaceholder; + static const QString AliasPlaceholder; /*! \brief Stores the oid of objects that are created by extension. * The keys of this map are the names of the extensions that hold objects in the database, @@ -105,23 +105,23 @@ class __libconnector Catalog { /*! \brief This map stores the oid field name for each object type. The oid field name can be composed by the pg_[OBJECT_TYPE] table alias. Refer to catalog query schema files for details */ - static const std::map oid_fields, + static const std::map oid_fields; //! \brief This map stores the relation names in catalogs for each object type - obj_relnames, + static const std::map obj_relnames; /*! \brief This map stores the name field for each object type. Refer to catalog query schema files for details */ - name_fields, + static const std::map name_fields; /*! \brief This map stores the oid field name that is used to check if the object (or its parent) is part of a extension (see getNotExtObjectQuery()). By default the attribute oid_fields is used instead for that purpose, but, for some objects, there are different fields that tells if the object (or its parent) is part of extension. */ - ext_oid_fields, + static const std::map ext_oid_fields; /*! \brief This map stores the aliases that are used to reference the table (parent) on each table object catalog query. * This is mainly used to force the filter of constraints/indexes/triggers/rules/policies in presence of one or more table * filter (see setObjectFilter) */ - parent_aliases; + static const std::map parent_aliases; //! \brief Store the cached catalog queries static attribs_map catalog_queries; @@ -184,10 +184,10 @@ class __libconnector Catalog { public: //! \brief Stores the prefix of any temp object (in pg_temp) created during catalog reading by pgModeler - static const QString PgModelerTempDbObj, + static const QString PgModelerTempDbObj; //! \brief Stores the null char escaped in format \000 - EscapedNullChar; + static const QString EscapedNullChar; Catalog(); diff --git a/libs/libcore/src/basegraphicobject.h b/libs/libcore/src/basegraphicobject.h index bc2d11e1a9..eaa8983569 100644 --- a/libs/libcore/src/basegraphicobject.h +++ b/libs/libcore/src/basegraphicobject.h @@ -83,8 +83,8 @@ class __libcore BaseGraphicObject: public QObject, public BaseObject { void setLayersAttribute(); public: - static constexpr int MaxZValue = 50, - MinZValue = -50; + static constexpr int MaxZValue = 50; + static constexpr int MinZValue = -50; BaseGraphicObject(); diff --git a/libs/libcore/src/baseobject.h b/libs/libcore/src/baseobject.h index faf796270e..5b5608b3dd 100644 --- a/libs/libcore/src/baseobject.h +++ b/libs/libcore/src/baseobject.h @@ -36,7 +36,7 @@ #include "exception.h" #include "pgsqlversions.h" -enum class ObjectType: unsigned { +enum class __libcore ObjectType: unsigned { Column, Constraint, Function, @@ -91,10 +91,10 @@ class __libcore BaseObject { //! \brief Current PostgreSQL version used in SQL code generation static QString pgsql_ver; - static bool escape_comments, + static bool escape_comments; //! \brief Indicates if the dependences/references of the object must be erased on the destructor - clear_deps_in_dtor; + static bool clear_deps_in_dtor; //! \brief Stores the set of special (valid) chars that forces the object's name quoting static const QByteArray special_chars; @@ -192,15 +192,15 @@ class __libcore BaseObject { * * CAUTION: If both amount and order of the object type enumerations are modified * then the order and amount of the elements of this vector must also be modified */ - static const QString objs_schemas[ObjectTypeCount], + static const QString objs_schemas[ObjectTypeCount]; /*! \brief This map associates the object type to a keyword on SQL language that represents the object */ - objs_sql[ObjectTypeCount], + static const QString objs_sql[ObjectTypeCount]; /*! \brief Stores the name of the type of objects to be used in error messages formatting and others operations that envolves object type name */ - obj_type_names[ObjectTypeCount]; + static const QString obj_type_names[ObjectTypeCount]; //! \brief This map stores the translate human readable names of each search attribute use by the object static const attribs_map search_attribs_i18n; @@ -281,7 +281,7 @@ class __libcore BaseObject { void setBasicAttributes(bool format_name); /*! \brief Compares two xml buffers and returns if they differs from each other. The user can specify which attributes - and tags must be ignored when makin the comparison. NOTE: only the name for attributes and tags must be informed */ + and tags must be ignored when making the comparison. NOTE: only the name for attributes and tags must be informed */ bool isCodeDiffersFrom(const QString &xml_def1, const QString &xml_def2, const QStringList &ignored_attribs, const QStringList &ignored_tags); /*! \brief Copies the non-empty attributes on the map at parameter to the own object attributes map. This method is used @@ -600,19 +600,19 @@ class __libcore BaseObject { bool isCodeInvalidated(); /*! \brief Compares the xml code between the "this" object and another one. The user can specify which attributes - and tags must be ignored when makin the comparison. NOTE: only the name for attributes and tags must be informed */ + * and tags must be ignored when makin the comparison. NOTE: only the name for attributes and tags must be informed */ virtual bool isCodeDiffersFrom(BaseObject *object, const QStringList &ignored_attribs={}, const QStringList &ignored_tags={}); /*! \brief Returns the valid object types in a vector. The types - ObjectType::ObjBaseObject, TYPE_ATTRIBUTE and ObjectType::ObjBaseTable aren't included in return vector. - By default table objects (columns, trigger, constraints, etc) are included. To - avoid the insertion of these types set the boolean param to false. */ + * ObjectType::ObjBaseObject, TYPE_ATTRIBUTE and ObjectType::ObjBaseTable aren't included in return vector. + * By default table objects (columns, trigger, constraints, etc) are included. To + * avoid the insertion of these types set the boolean param to false. */ static std::vector getObjectTypes(bool inc_table_objs=true, std::vector exclude_types={}); /*! \brief Returns the valid object types that are child or grouped under the specified type. - This method works a litte different from getObjectTypes() since this latter returns all valid types - and this one returns only the valid types for the current specified type. For now the only accepted - types are ObjectType::Database, ObjectType::Schema, ObjectType::Table, ObjectType::ForeignTable */ + * This method works a litte different from getObjectTypes() since this latter returns all valid types + * and this one returns only the valid types for the current specified type. For now the only accepted + * types are ObjectType::Database, ObjectType::Schema, ObjectType::Table, ObjectType::ForeignTable */ static std::vector getChildObjectTypes(ObjectType obj_type); //! \brief Returns true when the child_type is in the list of children types of the parent_type diff --git a/libs/libcore/src/foreignobject.h b/libs/libcore/src/foreignobject.h index e69f1540ce..c1ecfa0425 100644 --- a/libs/libcore/src/foreignobject.h +++ b/libs/libcore/src/foreignobject.h @@ -37,8 +37,8 @@ class __libcore ForeignObject { public: //! \brief Store the character used to separate options/values in the XML code - static const QString OptionsSeparator, - OptionValueSeparator; + static const QString OptionsSeparator; + static const QString OptionValueSeparator; ForeignObject(); diff --git a/libs/libcore/src/pgsqltypes/actiontype.h b/libs/libcore/src/pgsqltypes/actiontype.h index 8dd1530466..8654ced0e4 100644 --- a/libs/libcore/src/pgsqltypes/actiontype.h +++ b/libs/libcore/src/pgsqltypes/actiontype.h @@ -32,11 +32,11 @@ class __libcore ActionType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned NoAction = 1, - Restrict = 2, - Cascade = 3, - SetNull = 4, - SetDefault = 5; + static constexpr unsigned NoAction = 1; + static constexpr unsigned Restrict = 2; + static constexpr unsigned Cascade = 3; + static constexpr unsigned SetNull = 4; + static constexpr unsigned SetDefault = 5; ActionType(const QString &type_name); ActionType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/behaviortype.h b/libs/libcore/src/pgsqltypes/behaviortype.h index 67809b35f8..be288787d5 100644 --- a/libs/libcore/src/pgsqltypes/behaviortype.h +++ b/libs/libcore/src/pgsqltypes/behaviortype.h @@ -32,9 +32,9 @@ class __libcore BehaviorType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned CalledOnNullInput = 1, - ReturnsNullOnNullInput = 2;//, - //Strict = 3; + static constexpr unsigned CalledOnNullInput = 1; + static constexpr unsigned ReturnsNullOnNullInput = 2; + // static constexpr unsigned Strict = 3; BehaviorType(const QString &type_name); BehaviorType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/categorytype.h b/libs/libcore/src/pgsqltypes/categorytype.h index e247bf23df..d8cdcf0861 100644 --- a/libs/libcore/src/pgsqltypes/categorytype.h +++ b/libs/libcore/src/pgsqltypes/categorytype.h @@ -32,20 +32,20 @@ class __libcore CategoryType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned UserDefined = 1, - Array = 2, - Boolean = 3, - Composite = 4, - DateTime = 5, - Enumeration = 6, - Geometric = 7, - NetworkAddr = 8, - Numeric = 9, - PseudoTypes = 10, - Stringt = 11, - Timespan = 12, - BitString = 13, - Unknown = 14; + static constexpr unsigned UserDefined = 1; + static constexpr unsigned Array = 2; + static constexpr unsigned Boolean = 3; + static constexpr unsigned Composite = 4; + static constexpr unsigned DateTime = 5; + static constexpr unsigned Enumeration = 6; + static constexpr unsigned Geometric = 7; + static constexpr unsigned NetworkAddr = 8; + static constexpr unsigned Numeric = 9; + static constexpr unsigned PseudoTypes = 10; + static constexpr unsigned Stringt = 11; + static constexpr unsigned Timespan = 12; + static constexpr unsigned BitString = 13; + static constexpr unsigned Unknown = 14; CategoryType(unsigned type_id); CategoryType(const QString &type_name); diff --git a/libs/libcore/src/pgsqltypes/checkoptiontype.h b/libs/libcore/src/pgsqltypes/checkoptiontype.h index 3a7f618e2e..185e802ffb 100644 --- a/libs/libcore/src/pgsqltypes/checkoptiontype.h +++ b/libs/libcore/src/pgsqltypes/checkoptiontype.h @@ -32,9 +32,8 @@ class __libcore CheckOptionType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned - Local = 2, - Cascaded = 3; + static constexpr unsigned Local = 2; + static constexpr unsigned Cascaded = 3; CheckOptionType(const QString &type_name); CheckOptionType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/constrainttype.h b/libs/libcore/src/pgsqltypes/constrainttype.h index b0f8b1054b..9250b7ca4d 100644 --- a/libs/libcore/src/pgsqltypes/constrainttype.h +++ b/libs/libcore/src/pgsqltypes/constrainttype.h @@ -32,11 +32,11 @@ class __libcore ConstraintType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned PrimaryKey = 1, - ForeignKey = 2, - Check = 3, - Unique = 4, - Exclude= 5; + static constexpr unsigned PrimaryKey = 1; + static constexpr unsigned ForeignKey = 2; + static constexpr unsigned Check = 3; + static constexpr unsigned Unique = 4; + static constexpr unsigned Exclude= 5; ConstraintType(const QString &type_name); ConstraintType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/deferraltype.h b/libs/libcore/src/pgsqltypes/deferraltype.h index 6affedcab4..b94c135144 100644 --- a/libs/libcore/src/pgsqltypes/deferraltype.h +++ b/libs/libcore/src/pgsqltypes/deferraltype.h @@ -32,8 +32,8 @@ class __libcore DeferralType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Immediate = 1, - Deferred = 2; + static constexpr unsigned Immediate = 1; + static constexpr unsigned Deferred = 2; DeferralType(unsigned type_id); DeferralType(const QString &type_name); diff --git a/libs/libcore/src/pgsqltypes/eventtriggertype.h b/libs/libcore/src/pgsqltypes/eventtriggertype.h index 085e220f8a..e9b6f7aaca 100644 --- a/libs/libcore/src/pgsqltypes/eventtriggertype.h +++ b/libs/libcore/src/pgsqltypes/eventtriggertype.h @@ -32,10 +32,10 @@ class __libcore EventTriggerType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned DdlCommandStart = 1, - DdlCommandEnd = 2, - SqlDrop = 3, - TableRewrite = 4; + static constexpr unsigned DdlCommandStart = 1; + static constexpr unsigned DdlCommandEnd = 2; + static constexpr unsigned SqlDrop = 3; + static constexpr unsigned TableRewrite = 4; EventTriggerType(const QString &type_name); EventTriggerType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/eventtype.h b/libs/libcore/src/pgsqltypes/eventtype.h index e09a896c47..725c696d1a 100644 --- a/libs/libcore/src/pgsqltypes/eventtype.h +++ b/libs/libcore/src/pgsqltypes/eventtype.h @@ -32,11 +32,11 @@ class __libcore EventType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned OnSelect = 1, - OnInsert = 2, - OnDelete = 3, - OnUpdate = 4, - OnTruncate = 5; + static constexpr unsigned OnSelect = 1; + static constexpr unsigned OnInsert = 2; + static constexpr unsigned OnDelete = 3; + static constexpr unsigned OnUpdate = 4; + static constexpr unsigned OnTruncate = 5; EventType(const QString &type_name); EventType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/executiontype.h b/libs/libcore/src/pgsqltypes/executiontype.h index 6cc72b3725..21272d65b5 100644 --- a/libs/libcore/src/pgsqltypes/executiontype.h +++ b/libs/libcore/src/pgsqltypes/executiontype.h @@ -32,8 +32,8 @@ class __libcore ExecutionType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Also = 1, - Instead = 2; + static constexpr unsigned Also = 1; + static constexpr unsigned Instead = 2; ExecutionType(const QString &type_name); ExecutionType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/firingtype.h b/libs/libcore/src/pgsqltypes/firingtype.h index 982c5d63fd..f4377063e2 100644 --- a/libs/libcore/src/pgsqltypes/firingtype.h +++ b/libs/libcore/src/pgsqltypes/firingtype.h @@ -32,9 +32,9 @@ class __libcore FiringType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Before = 1, - After = 2, - InsteadOf = 3; + static constexpr unsigned Before = 1; + static constexpr unsigned After = 2; + static constexpr unsigned InsteadOf = 3; FiringType(const QString &type_name); FiringType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/functiontype.h b/libs/libcore/src/pgsqltypes/functiontype.h index 41faf66eb0..2535e4b5ac 100644 --- a/libs/libcore/src/pgsqltypes/functiontype.h +++ b/libs/libcore/src/pgsqltypes/functiontype.h @@ -32,9 +32,9 @@ class __libcore FunctionType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Volatile = 1, - Stable = 2, - Immutable= 3; + static constexpr unsigned Volatile = 1; + static constexpr unsigned Stable = 2; + static constexpr unsigned Immutable= 3; FunctionType(const QString &type_name); FunctionType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/identitytype.h b/libs/libcore/src/pgsqltypes/identitytype.h index cceece63dc..c255e39e9f 100644 --- a/libs/libcore/src/pgsqltypes/identitytype.h +++ b/libs/libcore/src/pgsqltypes/identitytype.h @@ -32,8 +32,8 @@ class __libcore IdentityType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Always = 1, - ByDefault = 2; + static constexpr unsigned Always = 1; + static constexpr unsigned ByDefault = 2; IdentityType(const QString &type_name); IdentityType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/indexingtype.h b/libs/libcore/src/pgsqltypes/indexingtype.h index 3a1aa3b839..a558ce2a79 100644 --- a/libs/libcore/src/pgsqltypes/indexingtype.h +++ b/libs/libcore/src/pgsqltypes/indexingtype.h @@ -32,12 +32,12 @@ class __libcore IndexingType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Btree = 1, - Brin = 2, - Gist = 3, - Gin = 4, - Hash = 5, - Spgist = 6; + static constexpr unsigned Btree = 1; + static constexpr unsigned Brin = 2; + static constexpr unsigned Gist = 3; + static constexpr unsigned Gin = 4; + static constexpr unsigned Hash = 5; + static constexpr unsigned Spgist = 6; IndexingType(const QString &type_name); IndexingType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/intervaltype.h b/libs/libcore/src/pgsqltypes/intervaltype.h index 95803a404d..5175d92985 100644 --- a/libs/libcore/src/pgsqltypes/intervaltype.h +++ b/libs/libcore/src/pgsqltypes/intervaltype.h @@ -32,19 +32,19 @@ class __libcore IntervalType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Year = 1, - Month = 2, - Day = 3, - Hour= 4, - Minute = 5, - Second = 6, - YearToMonth = 7, - DayToHour = 8, - DayToMinute = 9, - DayToSecond = 10, - HourToMinute = 11, - HourToSecond = 12, - MinuteToSecond = 13; + static constexpr unsigned Year = 1; + static constexpr unsigned Month = 2; + static constexpr unsigned Day = 3; + static constexpr unsigned Hour= 4; + static constexpr unsigned Minute = 5; + static constexpr unsigned Second = 6; + static constexpr unsigned YearToMonth = 7; + static constexpr unsigned DayToHour = 8; + static constexpr unsigned DayToMinute = 9; + static constexpr unsigned DayToSecond = 10; + static constexpr unsigned HourToMinute = 11; + static constexpr unsigned HourToSecond = 12; + static constexpr unsigned MinuteToSecond = 13; IntervalType(const QString &type_name); IntervalType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/matchtype.h b/libs/libcore/src/pgsqltypes/matchtype.h index d08edad7a8..848672d669 100644 --- a/libs/libcore/src/pgsqltypes/matchtype.h +++ b/libs/libcore/src/pgsqltypes/matchtype.h @@ -32,9 +32,9 @@ class __libcore MatchType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Simple = 1, - Full = 2, - Partial = 3; + static constexpr unsigned Simple = 1; + static constexpr unsigned Full = 2; + static constexpr unsigned Partial = 3; MatchType(unsigned type_id); MatchType(const QString &type_name); diff --git a/libs/libcore/src/pgsqltypes/paralleltype.h b/libs/libcore/src/pgsqltypes/paralleltype.h index 1a1f135079..ba8362c544 100644 --- a/libs/libcore/src/pgsqltypes/paralleltype.h +++ b/libs/libcore/src/pgsqltypes/paralleltype.h @@ -32,9 +32,9 @@ class __libcore ParallelType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Unsafe = 1, - Restricted = 2, - Safe = 3; + static constexpr unsigned Unsafe = 1; + static constexpr unsigned Restricted = 2; + static constexpr unsigned Safe = 3; ParallelType(const QString &type_name); ParallelType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/partitioningtype.h b/libs/libcore/src/pgsqltypes/partitioningtype.h index 3b96839e3a..60a4957eaa 100644 --- a/libs/libcore/src/pgsqltypes/partitioningtype.h +++ b/libs/libcore/src/pgsqltypes/partitioningtype.h @@ -32,9 +32,9 @@ class __libcore PartitioningType: public TemplateType { static const QStringList type_names; public: - static constexpr unsigned Range = 1, - List = 2, - Hash = 3; + static constexpr unsigned Range = 1; + static constexpr unsigned List = 2; + static constexpr unsigned Hash = 3; PartitioningType(const QString &type_name); PartitioningType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/pgsqltype.h b/libs/libcore/src/pgsqltypes/pgsqltype.h index 3bfee4fc3e..e57e93055d 100644 --- a/libs/libcore/src/pgsqltypes/pgsqltype.h +++ b/libs/libcore/src/pgsqltypes/pgsqltype.h @@ -36,16 +36,16 @@ class __libcore PgSqlType: public TemplateType{ static const QStringList type_names; //! \brief Offset for all PostGiS types - static constexpr unsigned PostGiSStart = 64, - PostGiSEnd = 82; + static constexpr unsigned PostGiSStart = 64; + static constexpr unsigned PostGiSEnd = 82; //! \brief Offset for oid types - static constexpr unsigned OidStart = 94, - OidEnd = 108; + static constexpr unsigned OidStart = 94; + static constexpr unsigned OidEnd = 108; //! \brief Offset for pseudo types - static constexpr unsigned PseudoStart = 109, - PseudoEnd = 133; + static constexpr unsigned PseudoStart = 109; + static constexpr unsigned PseudoEnd = 133; //! \brief Configuration for user defined types static std::vector user_types; diff --git a/libs/libcore/src/pgsqltypes/policycmdtype.h b/libs/libcore/src/pgsqltypes/policycmdtype.h index bd5a4e738b..d418e5414e 100644 --- a/libs/libcore/src/pgsqltypes/policycmdtype.h +++ b/libs/libcore/src/pgsqltypes/policycmdtype.h @@ -32,11 +32,11 @@ class __libcore PolicyCmdType: public TemplateType { static const QStringList type_names; public: - static constexpr unsigned All = 1, - Select = 2, - Insert = 3, - Update = 4, - Delete = 5; + static constexpr unsigned All = 1; + static constexpr unsigned Select = 2; + static constexpr unsigned Insert = 3; + static constexpr unsigned Update = 4; + static constexpr unsigned Delete = 5; PolicyCmdType(const QString &type_name); PolicyCmdType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/providertype.h b/libs/libcore/src/pgsqltypes/providertype.h index 7f121eaf45..eca1129d39 100644 --- a/libs/libcore/src/pgsqltypes/providertype.h +++ b/libs/libcore/src/pgsqltypes/providertype.h @@ -32,8 +32,8 @@ class __libcore ProviderType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned LibC = 1, - Icu = 2; + static constexpr unsigned LibC = 1; + static constexpr unsigned Icu = 2; ProviderType(const QString &type_name); ProviderType(unsigned type_id); diff --git a/libs/libcore/src/pgsqltypes/securitytype.h b/libs/libcore/src/pgsqltypes/securitytype.h index e9eaad06cc..7e315974b6 100644 --- a/libs/libcore/src/pgsqltypes/securitytype.h +++ b/libs/libcore/src/pgsqltypes/securitytype.h @@ -32,8 +32,8 @@ class __libcore SecurityType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Invoker = 1, - Definer = 2; + static constexpr unsigned Invoker = 1; + static constexpr unsigned Definer = 2; SecurityType(unsigned type_id); SecurityType(const QString &type_name); diff --git a/libs/libcore/src/pgsqltypes/spatialtype.h b/libs/libcore/src/pgsqltypes/spatialtype.h index ebe36d90c9..25fe99d3b7 100644 --- a/libs/libcore/src/pgsqltypes/spatialtype.h +++ b/libs/libcore/src/pgsqltypes/spatialtype.h @@ -47,14 +47,14 @@ class __libcore SpatialType: public TemplateType{ int srid; public: - static constexpr unsigned Point = 1, - LineString = 2, - Polygon = 3, - MultiPoint = 4, - MultiLineString = 5, - MultiPolygon = 6, - Geometry = 7, - GeometryCollection = 8; + static constexpr unsigned Point = 1; + static constexpr unsigned LineString = 2; + static constexpr unsigned Polygon = 3; + static constexpr unsigned MultiPoint = 4; + static constexpr unsigned MultiLineString = 5; + static constexpr unsigned MultiPolygon = 6; + static constexpr unsigned Geometry = 7; + static constexpr unsigned GeometryCollection = 8; SpatialType(const QString &type_name, int srid, VariationId variation_id=SpatialType::NoVar); SpatialType(unsigned type_id, int srid, VariationId var_id=SpatialType::NoVar); diff --git a/libs/libcore/src/pgsqltypes/storagetype.h b/libs/libcore/src/pgsqltypes/storagetype.h index 3ee39e6e05..573bc539b1 100644 --- a/libs/libcore/src/pgsqltypes/storagetype.h +++ b/libs/libcore/src/pgsqltypes/storagetype.h @@ -32,10 +32,10 @@ class __libcore StorageType: public TemplateType{ static const QStringList type_names; public: - static constexpr unsigned Plain = 1, - External = 2, - Extended = 3, - Main = 4; + static constexpr unsigned Plain = 1; + static constexpr unsigned External = 2; + static constexpr unsigned Extended = 3; + static constexpr unsigned Main = 4; StorageType(); StorageType(const QString &type_name); diff --git a/libs/libcore/src/pgsqltypes/templatetype.h b/libs/libcore/src/pgsqltypes/templatetype.h index d978769ff8..efb72b030d 100644 --- a/libs/libcore/src/pgsqltypes/templatetype.h +++ b/libs/libcore/src/pgsqltypes/templatetype.h @@ -43,7 +43,7 @@ Interesting readings: #include "exception.h" template -class __libcore TemplateType { +class TemplateType { protected: //! \brief Index of the type on the type_list vector unsigned type_idx; diff --git a/libs/libcore/src/relationship.h b/libs/libcore/src/relationship.h index 0f2113c4c1..fc12ee29e6 100644 --- a/libs/libcore/src/relationship.h +++ b/libs/libcore/src/relationship.h @@ -346,11 +346,11 @@ class __libcore Relationship: public BaseRelationship { public: //! \brief String used as the name suffix separator. Default '_' - static const QString SuffixSeparator, - SrcTabToken, - DstTabToken, - GenTabToken, - SrcColToken; + static const QString SuffixSeparator; + static const QString SrcTabToken; + static const QString DstTabToken; + static const QString GenTabToken; + static const QString SrcColToken; Relationship(Relationship *rel); diff --git a/libs/libcore/src/sequence.h b/libs/libcore/src/sequence.h index 09191c78cb..3d1732ab8a 100644 --- a/libs/libcore/src/sequence.h +++ b/libs/libcore/src/sequence.h @@ -66,17 +66,16 @@ class __libcore Sequence: public BaseObject { public: //! \brief Constants that indicates the maximum and minimum values accepted by sequence //For serial sequences - static const QString - MaxPositiveValue, - MaxNegativeValue, + static const QString MaxPositiveValue; + static const QString MaxNegativeValue; //For smallserial sequences - MaxSmallPositiveValue, - MaxSmallNegativeValue, + static const QString MaxSmallPositiveValue; + static const QString MaxSmallNegativeValue; //For bigserial sequences - MaxBigPositiveValue, - MaxBigNegativeValue; + static const QString MaxBigPositiveValue; + static const QString MaxBigNegativeValue; Sequence(); diff --git a/libs/libgui/src/dbobjects/baseobjectwidget.h b/libs/libgui/src/dbobjects/baseobjectwidget.h index 75da3ba4b0..dc5d9aec35 100644 --- a/libs/libgui/src/dbobjects/baseobjectwidget.h +++ b/libs/libgui/src/dbobjects/baseobjectwidget.h @@ -128,9 +128,9 @@ class __libgui BaseObjectWidget: public QWidget, public Ui::BaseObjectWidget { public: //! \brief Constants used to generate version intervals for version alert frame - static constexpr unsigned UntilVersion=0, - VersionsInterval=1, - AfterVersion=2; + static constexpr unsigned UntilVersion=0; + static constexpr unsigned VersionsInterval=1; + static constexpr unsigned AfterVersion=2; BaseObjectWidget(QWidget * parent = nullptr, ObjectType obj_type=ObjectType::BaseObject); diff --git a/libs/libgui/src/settings/appearanceconfigwidget.h b/libs/libgui/src/settings/appearanceconfigwidget.h index f39bfcca3b..8182b7cac2 100644 --- a/libs/libgui/src/settings/appearanceconfigwidget.h +++ b/libs/libgui/src/settings/appearanceconfigwidget.h @@ -49,21 +49,21 @@ class __libgui AppearanceConfigWidget: public BaseConfigWidget, public Ui::Appea /*! \brief Holds the QPalette settings that defines dark theme. * This map key is a color role which value is a string list that * contains 3 elements: active color, inactive color and disabled color. */ - static std::map dark_ui_colors, + static std::map dark_ui_colors; /*! \brief Holds the QPalette settings that defines light theme. * This map key is a color role which value is a string list that * contains 3 elements: active color, inactive color and disabled color. */ - light_ui_colors, + static std::map light_ui_colors; //! \brief Holds the default/system QPalette settings. - system_ui_colors; + static std::map system_ui_colors; //! \brief Colors used for ObjectTableWidget items when in dark theme - static QStringList dark_tab_item_colors, + static QStringList dark_tab_item_colors; //! \brief Colors used for ObjectTableWidget items when in light theme - light_tab_item_colors; + static QStringList light_tab_item_colors; //! \brief Holds the current user interface theme id (light/dark) static QString UiThemeId; diff --git a/libs/libgui/src/tools/databaseexplorerwidget.h b/libs/libgui/src/tools/databaseexplorerwidget.h index f2b02d71e0..db14327159 100644 --- a/libs/libgui/src/tools/databaseexplorerwidget.h +++ b/libs/libgui/src/tools/databaseexplorerwidget.h @@ -45,9 +45,9 @@ class __libgui DatabaseExplorerWidget: public QWidget, public Ui::DatabaseExplor * This attribute is used by saveTreeState() and restoreTreeState() */ QStringList items_state; - static const QString DepNotDefined, - DepNotFound, - DefaultSourceCode; + static const QString DepNotDefined; + static const QString DepNotFound; + static const QString DefaultSourceCode; //! \brief Stores the translations of all used attributes at properties panel static const attribs_map attribs_i18n; diff --git a/libs/libgui/src/tools/modelsdiffhelper.h b/libs/libgui/src/tools/modelsdiffhelper.h index e81f90603e..39918c93e1 100644 --- a/libs/libgui/src/tools/modelsdiffhelper.h +++ b/libs/libgui/src/tools/modelsdiffhelper.h @@ -34,18 +34,16 @@ class __libgui ModelsDiffHelper: public QObject { private: //! \brief List of attributes ignored when comparing XML code of table children objects - static const QStringList - - TableObjsIgnoredAttribs, + static const QStringList TableObjsIgnoredAttribs; //! \brief List of tags ignored when comparing XML code of roles specifically - RolesIgnoredTags, + static const QStringList RolesIgnoredTags; //! \brief List of attributes ignored when comparing XML code of other database objects - ObjectsIgnoredAttribs, + static const QStringList ObjectsIgnoredAttribs; //! \brief List of tags ignored when comparing XML code of other database objects - ObjectsIgnoredTags; + static const QStringList ObjectsIgnoredTags; //! \brief Stores the SQL code that represents the diff between model and database QString diff_def, diff --git a/libs/libgui/src/utils/objectslistmodel.h b/libs/libgui/src/utils/objectslistmodel.h index 4f14dcdfc2..933904c27c 100644 --- a/libs/libgui/src/utils/objectslistmodel.h +++ b/libs/libgui/src/utils/objectslistmodel.h @@ -67,9 +67,8 @@ class __libgui ObjectsListModel: public QAbstractTableModel { QList header_data; - static const QStringList HeaderTexts, - - HeaderIcons; + static const QStringList HeaderTexts; + static const QStringList HeaderIcons; inline QVariant getItemData(const ItemData &item_dt, int role) const; static std::tuple getIndexMargins(); diff --git a/libs/libgui/src/utils/syntaxhighlighter.h b/libs/libgui/src/utils/syntaxhighlighter.h index ad2777ff8f..efdcb027df 100644 --- a/libs/libgui/src/utils/syntaxhighlighter.h +++ b/libs/libgui/src/utils/syntaxhighlighter.h @@ -76,12 +76,12 @@ class __libgui SyntaxHighlighter: public QSyntaxHighlighter { static QFont default_font; //! \brief Indicates that the current block has no special meaning - static constexpr int SimpleBlock = -1, + static constexpr int SimpleBlock = -1; /*! \brief Indicates that the current block was last formatted by a persistent group, * Indicating that the highlight was applied to the start position of the group * until the end of the block. */ - PersistentBlock = 0, + static constexpr int PersistentBlock = 0; /*! \brief Indicates that the current block has an open (but still to close) expression (e.g. multline comments) * When the highlighter finds this const it'll do special operation like highlight next blocks with the same @@ -89,7 +89,7 @@ class __libgui SyntaxHighlighter: public QSyntaxHighlighter { * calls using this as parameter will always use the group index as extra value. For example, say we have a * "multi-line-comment" group which index is 1 and was applied to the current block, then the block state will * be set as OpenExprBlock + 1 */ - OpenExprBlock = 1; + static constexpr int OpenExprBlock = 1; //! \brief Stores the order in which the groups must be applied QStringList groups_order, multilines_order; diff --git a/libs/libgui/src/widgets/linenumberswidget.h b/libs/libgui/src/widgets/linenumberswidget.h index 7e8504c581..6917ebecfb 100644 --- a/libs/libgui/src/widgets/linenumberswidget.h +++ b/libs/libgui/src/widgets/linenumberswidget.h @@ -53,10 +53,10 @@ class __libgui LineNumbersWidget : public QWidget { start_sel_line, start_sel_pos; //! \brief Font color for drawn line numbers - static QColor font_color, + static QColor font_color; //! \brief Widget's background color - bg_color; + static QColor bg_color; protected: void paintEvent(QPaintEvent *event); diff --git a/libs/libgui/src/widgets/modelwidget.h b/libs/libgui/src/widgets/modelwidget.h index 530cb93d92..6baf3995a3 100644 --- a/libs/libgui/src/widgets/modelwidget.h +++ b/libs/libgui/src/widgets/modelwidget.h @@ -75,9 +75,8 @@ class __libgui ModelWidget: public QWidget { }; //! \brief Constants used to control the object stacking method - static constexpr int BringToFront = 1, - - SendToBack = -1; + static constexpr int BringToFront = 1; + static constexpr int SendToBack = -1; XmlParser *xmlparser; @@ -111,15 +110,15 @@ class __libgui ModelWidget: public QWidget { /*! \brief Indicates if the cut operation is currently activated. This flag modifies the way the methods copyObjects() and removeObject() works. */ - static bool cut_operation, + static bool cut_operation; //! \brief Indicates if the last position and zoom must be saved/restored - save_restore_pos, + static bool save_restore_pos; //! \brief Indicates that graphical objects like table, view and textboxes can be created without click canvas (direclty from their editing form) - simple_obj_creation, + static bool simple_obj_creation; - disable_render_smooth; + static bool disable_render_smooth; //! \brief Indicates if the minimum object opacity used when appliyng fade out to objects static double min_object_opacity; @@ -129,10 +128,10 @@ class __libgui ModelWidget: public QWidget { static ModelWidget *src_model; //! \brief Copied object on the source model - static std::vector copied_objects, + static std::vector copied_objects; //! \brief Stores the cutted object on source model (only when executing cut command) - cut_objects; + static std::vector cut_objects; //! \brief Frame that indicates if the model is protected QFrame *protected_model_frm; @@ -384,9 +383,9 @@ class __libgui ModelWidget: public QWidget { void setAllCollapseMode(BaseTable::CollapseMode mode); public: - static constexpr double MinimumZoom = ObjectsScene::MinScaleFactor, - MaximumZoom = ObjectsScene::MaxScaleFactor, - ZoomIncrement = 0.050000; + static constexpr double MinimumZoom = ObjectsScene::MinScaleFactor; + static constexpr double MaximumZoom = ObjectsScene::MaxScaleFactor; + static constexpr double ZoomIncrement = 0.050000; ModelWidget(QWidget *parent = nullptr); virtual ~ModelWidget(); diff --git a/libs/libgui/src/widgets/numberedtexteditor.h b/libs/libgui/src/widgets/numberedtexteditor.h index f8a44ec4f4..33862f021a 100644 --- a/libs/libgui/src/widgets/numberedtexteditor.h +++ b/libs/libgui/src/widgets/numberedtexteditor.h @@ -40,10 +40,10 @@ class __libgui NumberedTextEditor : public QPlainTextEdit { /*! \brief Controls globally line numbers visibility. * If this flag is set to false then toggleLineNumbers will * have no effect */ - static bool line_nums_visible, + static bool line_nums_visible; //! \brief Controls if current line must be highlighted - highlight_lines; + static bool highlight_lines; //! \brief Line highlight color static QColor line_hl_color; diff --git a/libs/libparsers/src/csvdocument.h b/libs/libparsers/src/csvdocument.h index cec9525b9c..213b5be296 100644 --- a/libs/libparsers/src/csvdocument.h +++ b/libs/libparsers/src/csvdocument.h @@ -59,13 +59,13 @@ class __libparsers CsvDocument { public: //! \brief Default character used as text delimiter - static const QChar TextDelimiter, + static const QChar TextDelimiter; //! \brief Default character used as value separator - Separator, + static const QChar Separator; //! \brief Default character used as line break - LineBreak; + static const QChar LineBreak; CsvDocument(); diff --git a/libs/libparsers/src/schemaparser.h b/libs/libparsers/src/schemaparser.h index ff4a67ddbc..b85c8dbd2e 100644 --- a/libs/libparsers/src/schemaparser.h +++ b/libs/libparsers/src/schemaparser.h @@ -241,58 +241,58 @@ class __libparsers SchemaParser { } public: - static const QChar CharComment, //! \brief Character that starts a comment - CharLineEnd, //! \brief Character that indicates end of line - CharSpace, //! \brief Character that indicates spacing - CharTabulation, //! \brief Character that indicates tabulation - CharStartAttribute, //! \brief Character that indicates a reference to an attribute - CharEndAttribute, //! \brief Character that delimits on the right the attribute name - CharStartConditional, //! \brief Character that starts a conditional instruction - CharStartMetachar, //! \brief Character that starts a metacharacter - CharStartPlainText, //! \brief Character that starts a plain text - CharEndPlainText, //! \brief Character that ends a plain text - CharStartCompExpr, //! \brief Character that starts a comparison expression - CharEndCompExpr, //! \brief Character that ends a comparison expression - CharValueDelim, //! \brief Character that delimiters a value (string) - CharValueOf, //! \brief Character that is used on %set instructions to create an attribute name based upon another attribute value - CharToXmlEntity, //! \brief Character that is used on attributes, e.g. &{attribute}, to indicate that their content must be converted to xml entities - CharStartEscaped; //! \brief Character that is used on escapade special characters, e.g. \# \$ \% #\$ \& \] \[ \{ \} + static const QChar CharComment; //! \brief Character that starts a comment + static const QChar CharLineEnd; //! \brief Character that indicates end of line + static const QChar CharSpace; //! \brief Character that indicates spacing + static const QChar CharTabulation; //! \brief Character that indicates tabulation + static const QChar CharStartAttribute; //! \brief Character that indicates a reference to an attribute + static const QChar CharEndAttribute; //! \brief Character that delimits on the right the attribute name + static const QChar CharStartConditional; //! \brief Character that starts a conditional instruction + static const QChar CharStartMetachar; //! \brief Character that starts a metacharacter + static const QChar CharStartPlainText; //! \brief Character that starts a plain text + static const QChar CharEndPlainText; //! \brief Character that ends a plain text + static const QChar CharStartCompExpr; //! \brief Character that starts a comparison expression + static const QChar CharEndCompExpr; //! \brief Character that ends a comparison expression + static const QChar CharValueDelim; //! \brief Character that delimiters a value (string) + static const QChar CharValueOf; //! \brief Character that is used on %set instructions to create an attribute name based upon another attribute value + static const QChar CharToXmlEntity; //! \brief Character that is used on attributes, e.g. &{attribute}, to indicate that their content must be converted to xml entities + static const QChar CharStartEscaped; //! \brief Character that is used on escapade special characters, e.g. \# \$ \% #\$ \& \] \[ \{ \} //! \brief Tokens related to conditional instructions and operators - static const QString TokenIf, - TokenThen, - TokenElse, - TokenEnd, - TokenOr, - TokenAnd, - TokenNot, - TokenSet, - TokenUnset, - TokenInclude, + static const QString TokenIf; + static const QString TokenThen; + static const QString TokenElse; + static const QString TokenEnd; + static const QString TokenOr; + static const QString TokenAnd; + static const QString TokenNot; + static const QString TokenSet; + static const QString TokenUnset; + static const QString TokenInclude; //! \brief Tokens related to metacharacters - TokenMetaSp,// $sp (space) - TokenMetaBr, // $br (line break) - TokenMetaTb, // $tb (tabulation) - TokenMetaOb, // $ob (open square bracket '[') - TokenMetaCb, // $cb (close square bracket ']') - TokenMetaOc, // $oc (open curly bracket '{') - TokenMetaCc, // $cc (close curly bracket '}') - TokenMetaMs, // $ms (money sign '$') - TokenMetaHs, // $hs (hash/number sign '#') - TokenMetaPs, // $ps (percentage sign '%') - TokenMetaAt, // $at (at character '@') - TokenMetaDs, // $ds (special data separator character '•') - TokenMetaAm, // $am (ampersand character '&') - TokenMetaBs, // $bs (backslash character '\') + static const QString TokenMetaSp; // $sp (space) + static const QString TokenMetaBr; // $br (line break) + static const QString TokenMetaTb; // $tb (tabulation) + static const QString TokenMetaOb; // $ob (open square bracket '[') + static const QString TokenMetaCb; // $cb (close square bracket ']') + static const QString TokenMetaOc; // $oc (open curly bracket '{') + static const QString TokenMetaCc; // $cc (close curly bracket '}') + static const QString TokenMetaMs; // $ms (money sign '$') + static const QString TokenMetaHs; // $hs (hash/number sign '#') + static const QString TokenMetaPs; // $ps (percentage sign '%') + static const QString TokenMetaAt; // $at (at character '@') + static const QString TokenMetaDs; // $ds (special data separator character '•') + static const QString TokenMetaAm; // $am (ampersand character '&') + static const QString TokenMetaBs; // $bs (backslash character '\') //! \brief Tokens related to comparison expressions - TokenEqOper, // == (equal) - TokenNeOper, // != (not equal) - TokenGtOper, // > (greater than) - TokenLtOper, // < (less than) - TokenGtEqOper, // >= (greater or equal to) - TokenLtEqOper; // <= (less or equal to) + static const QString TokenEqOper; // == (equal) + static const QString TokenNeOper; // != (not equal) + static const QString TokenGtOper; // > (greater than) + static const QString TokenLtOper; // < (less than) + static const QString TokenGtEqOper; // >= (greater or equal to) + static const QString TokenLtEqOper; // <= (less or equal to) //! \brief Token related to schema files inclusion (@include) static const QRegularExpression TokenIncludeRegexp; diff --git a/libs/libutils/src/exception.h b/libs/libutils/src/exception.h index c102b649a8..ebe31b54a2 100644 --- a/libs/libutils/src/exception.h +++ b/libs/libutils/src/exception.h @@ -311,7 +311,8 @@ class __libutils Exception { static constexpr unsigned ErrorCount=271; //! \brief Constants used to access the error details - static constexpr unsigned ErrorCodeId=0, ErrorMessage=1; + static constexpr unsigned ErrorCodeId=0; + static constexpr unsigned ErrorMessage=1; /*! \brief Stores other exceptions before raise the 'this' exception. This structure can be used to simulate a stack trace to improve the debug */ diff --git a/libs/libutils/src/globalattributes.h b/libs/libutils/src/globalattributes.h index 47e89fa970..204c38adc9 100644 --- a/libs/libutils/src/globalattributes.h +++ b/libs/libutils/src/globalattributes.h @@ -53,23 +53,22 @@ class __libutils GlobalAttributes { PGMODELER_SE_PATH --> Full path to pgmodeler-se executable PGMODELER_PATH --> Full path to pgmodeler executable */ - static QString - SchemasRootPath, - LanguagesPath, - PluginsPath, - TemporaryPath, - SamplesPath, - TmplConfigurationPath, - ConfigurationsPath, - SQLHighlightConfPath, - XMLHighlightConfPath, - SchHighlightConfPath, - PatternHighlightConfPath, - PgModelerCHandlerPath, - PgModelerCLIPath, - PgModelerAppPath, - PgModelerSchemaEditorPath, - PgModelerBaseVersion; + static QString SchemasRootPath; + static QString LanguagesPath; + static QString PluginsPath; + static QString TemporaryPath; + static QString SamplesPath; + static QString TmplConfigurationPath; + static QString ConfigurationsPath; + static QString SQLHighlightConfPath; + static QString XMLHighlightConfPath; + static QString SchHighlightConfPath; + static QString PatternHighlightConfPath; + static QString PgModelerCHandlerPath; + static QString PgModelerCLIPath; + static QString PgModelerAppPath; + static QString PgModelerSchemaEditorPath; + static QString PgModelerBaseVersion; //! \brief Stores the custom paths retrieved either from pgmpaths.conf or from environment variables static attribs_map CustomPaths; @@ -137,92 +136,91 @@ class __libutils GlobalAttributes { } public: - static const QString - PgModelerVersion, - PgModelerAppName, - PgModelerOldAppName, - - PgModelerURI, - PgModelerBuildNumber, - PgModelerSite, - PgModelerSupport, - PgModelerSourceURL, - PgModelerDownloadURL, - PgModelerDonateURL, - PgModelerUpdateCheckURL, - - EnvSchemasPath, - EnvConfPath, - EnvTmplConfPath, - EnvLangPath, - EnvPluginsPath, - EnvTmpPath, - EnvSamplesPath, - EnvPgModelerChPath, - EnvPgModelerCliPath, - EnvPgModelerSePath, - EnvPgModelerPath, - - PgmPathsConfFile, //! \brief An ini-like (key=value) file that holds custom values for the pgModeler's enviroment variables - BugReportEmail, - BugReportFile, - StacktraceFile, - LastModelFile, - - DbModelExt, - DbModelBkpExt, - ObjMetadataExt, - DirSeparator, - ResourcesDir, //! \brief Directory name which holds the pgModeler's plug-ins resources directory (res) - ConfigurationsDir, //! \brief Default name for the configurations directory - DefaultConfsDir, //! \brief Default name for the default configurations directory - ConfsBackupsDir, //! \brief Directory name which holds the pgModeler configuration backups - SchemasDir, //! \brief Default name for the schemas directory - SQLSchemaDir, //! \brief Default name for the sql schemas directory - XMLSchemaDir, //! \brief Default name for the xml schemas directory - CatalogSchemasDir, //! \brief Default name for the catalog schemas directory - DataDictSchemaDir, //! \brief Default name for the data dictionary schemas root directory - DataDictHtmlDir, //! \brief Default name for the data dictionary schemas directory (HTML format) - DataDictMdDir, //! \brief Default name for the dictionary schemas directory (Markdown format) - AlterSchemaDir, //! \brief Default name for the alter schemas directory - LanguagesDir, //! \brief Default name for the translation files directory - SamplesDir, //! \brief Default name for the samples database models directory - PluginsDir, //! \brief Default name for the plug-ins directory - SchemaExt, //! \brief Default extension for schema files - ObjectDTDDir, //! \brief Default directory for dtd files - ObjectDTDExt, //! \brief Default extension for dtd files - RootDTD, //! \brief Root DTD of model xml files - MetadataDTD, //! \brief Root DTD of objects metadata xml files - ConfigurationExt, //! \brief Default extension for configuration files - HighlightFileSuffix, //! \brief Suffix of language highlight configuration files - ThemesDir, //! \brief Default name for the ui style directory - - CodeHighlightConf, //! \brief Default name for the language highlight dtd - AppearanceConf, //! \brief Default name for the appearance configuration file - GeneralConf, //! \brief Default name for the general pgModeler configuration - ConnectionsConf, //! \brief Default name for the DBMS connection configuration file - RelationshipsConf, //! \brief Default name for the relationships configuration file - SnippetsConf, //! \brief Default name for the code snippets configuration file - DiffPresetsConf, //! \brief Default name for the diff presets configuration file - - SQLHighlightConf, //! \brief Configuration file for SQL language highlight - XMLHighlightConf, //! \brief Configuration file for XML language highlight - SchHighlightConf, //! \brief Configuration file for Schema micro-language highlight - PatternHighlightConf, //! \brief Configuration file for name patterns highlight (relationship editing form) - SQLHistoryConf, //! \brief Default name for the SQL commands history configuration file - - ExampleModel, //! \brief Default name for the sample model loaded on appearence configuration form - UiStyleConf, //! \brief Configuration file ui style - IconsMediumConf, //! \brief Extra configuration file that defines medium icons size - IconsSmallConf, //! \brief Extra configuration file that defines small icons size - IconsBigConf, //! \brief Extra configuration file that defines big icons size - - FileDialogConf, //! \brief Default name for the file used to save/restore QFileDialog last geometry + static const QString PgModelerVersion; + static const QString PgModelerAppName; + static const QString PgModelerOldAppName; + + static const QString PgModelerURI; + static const QString PgModelerBuildNumber; + static const QString PgModelerSite; + static const QString PgModelerSupport; + static const QString PgModelerSourceURL; + static const QString PgModelerDownloadURL; + static const QString PgModelerDonateURL; + static const QString PgModelerUpdateCheckURL; + + static const QString EnvSchemasPath; + static const QString EnvConfPath; + static const QString EnvTmplConfPath; + static const QString EnvLangPath; + static const QString EnvPluginsPath; + static const QString EnvTmpPath; + static const QString EnvSamplesPath; + static const QString EnvPgModelerChPath; + static const QString EnvPgModelerCliPath; + static const QString EnvPgModelerSePath; + static const QString EnvPgModelerPath; + + static const QString PgmPathsConfFile; //! \brief An ini-like (key=value) file that holds custom values for the pgModeler's enviroment variables + static const QString BugReportEmail; + static const QString BugReportFile; + static const QString StacktraceFile; + static const QString LastModelFile; + + static const QString DbModelExt; + static const QString DbModelBkpExt; + static const QString ObjMetadataExt; + static const QString DirSeparator; + static const QString ResourcesDir; //! \brief Directory name which holds the pgModeler's plug-ins resources directory (res) + static const QString ConfigurationsDir; //! \brief Default name for the configurations directory + static const QString DefaultConfsDir; //! \brief Default name for the default configurations directory + static const QString ConfsBackupsDir; //! \brief Directory name which holds the pgModeler configuration backups + static const QString SchemasDir; //! \brief Default name for the schemas directory + static const QString SQLSchemaDir; //! \brief Default name for the sql schemas directory + static const QString XMLSchemaDir; //! \brief Default name for the xml schemas directory + static const QString CatalogSchemasDir; //! \brief Default name for the catalog schemas directory + static const QString DataDictSchemaDir; //! \brief Default name for the data dictionary schemas root directory + static const QString DataDictHtmlDir; //! \brief Default name for the data dictionary schemas directory (HTML format) + static const QString DataDictMdDir; //! \brief Default name for the dictionary schemas directory (Markdown format) + static const QString AlterSchemaDir; //! \brief Default name for the alter schemas directory + static const QString LanguagesDir; //! \brief Default name for the translation files directory + static const QString SamplesDir; //! \brief Default name for the samples database models directory + static const QString PluginsDir; //! \brief Default name for the plug-ins directory + static const QString SchemaExt; //! \brief Default extension for schema files + static const QString ObjectDTDDir; //! \brief Default directory for dtd files + static const QString ObjectDTDExt; //! \brief Default extension for dtd files + static const QString RootDTD; //! \brief Root DTD of model xml files + static const QString MetadataDTD; //! \brief Root DTD of objects metadata xml files + static const QString ConfigurationExt; //! \brief Default extension for configuration files + static const QString HighlightFileSuffix; //! \brief Suffix of language highlight configuration files + static const QString ThemesDir; //! \brief Default name for the ui style directory + + static const QString CodeHighlightConf; //! \brief Default name for the language highlight dtd + static const QString AppearanceConf; //! \brief Default name for the appearance configuration file + static const QString GeneralConf; //! \brief Default name for the general pgModeler configuration + static const QString ConnectionsConf; //! \brief Default name for the DBMS connection configuration file + static const QString RelationshipsConf; //! \brief Default name for the relationships configuration file + static const QString SnippetsConf; //! \brief Default name for the code snippets configuration file + static const QString DiffPresetsConf; //! \brief Default name for the diff presets configuration file + + static const QString SQLHighlightConf; //! \brief Configuration file for SQL language highlight + static const QString XMLHighlightConf; //! \brief Configuration file for XML language highlight + static const QString SchHighlightConf; //! \brief Configuration file for Schema micro-language highlight + static const QString PatternHighlightConf; //! \brief Configuration file for name patterns highlight (relationship editing form) + static const QString SQLHistoryConf; //! \brief Default name for the SQL commands history configuration file + + static const QString ExampleModel; //! \brief Default name for the sample model loaded on appearence configuration form + static const QString UiStyleConf; //! \brief Configuration file ui style + static const QString IconsMediumConf; //! \brief Extra configuration file that defines medium icons size + static const QString IconsSmallConf; //! \brief Extra configuration file that defines small icons size + static const QString IconsBigConf; //! \brief Extra configuration file that defines big icons size + + static const QString FileDialogConf; //! \brief Default name for the file used to save/restore QFileDialog last geometry /*! \brief Fusion is the default widget style for pgModeler. User can change this by calling the executable using -style option. This same style is applied to crash handler. */ - DefaultQtStyle, - UiStyleOption; + static const QString DefaultQtStyle; + static const QString UiStyleOption; /*! \brief Performs the initialization of the global attributes by setting the * application's search path (and all assets/executable paths based upon search_path). From 8e375a792bba39fefd60ed791a5ca9ccb5f880fd Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Fri, 30 May 2025 11:29:47 +0200 Subject: [PATCH 2/2] remove unused libs/libgui/src/widgets/elementstablewidget.{h,cpp} (lives in dbobjects/elementstablewidget.{h,cpp} now) --- .../src/widgets/elementstablewidget.cpp | 186 ------------------ libs/libgui/src/widgets/elementstablewidget.h | 140 ------------- 2 files changed, 326 deletions(-) delete mode 100644 libs/libgui/src/widgets/elementstablewidget.cpp delete mode 100644 libs/libgui/src/widgets/elementstablewidget.h diff --git a/libs/libgui/src/widgets/elementstablewidget.cpp b/libs/libgui/src/widgets/elementstablewidget.cpp deleted file mode 100644 index 1601c1a38e..0000000000 --- a/libs/libgui/src/widgets/elementstablewidget.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* -# PostgreSQL Database Modeler (pgModeler) -# -# Copyright 2006-2021 - Raphael Araújo e Silva -# -# 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 version 3. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# The complete text of GPLv3 is at LICENSE file on source code root directory. -# Also, you can get the complete GNU General Public License at -*/ - -#include "elementstablewidget.h" -#include "generalconfigwidget.h" - -ElementsTableWidget::ElementsTableWidget(QWidget *parent) : QWidget(parent) -{ - try - { - handled_elem = nullptr; - model = nullptr; - parent_obj = nullptr; - - element_wgt = new ElementWidget; - element_form.setMainWidget(element_wgt); - element_form.setButtonConfiguration(); - connect(&element_form, SIGNAL(accepted()), element_wgt, SLOT(applyConfiguration())); - - QVBoxLayout *vbox = new QVBoxLayout(this); - elements_tab=new ObjectsTableWidget(ObjectsTableWidget::AllButtons ^ - (ObjectsTableWidget::UpdateButton | ObjectsTableWidget::DuplicateButton), true, this); - - elements_tab->setColumnCount(7); - elements_tab->setHeaderLabel(tr("Element"), 0); - elements_tab->setHeaderIcon(QPixmap(GuiUtilsNs::getIconPath("column")),0); - elements_tab->setHeaderLabel(tr("Type"), 1); - elements_tab->setHeaderIcon(QPixmap(GuiUtilsNs::getIconPath("usertype")),1); - elements_tab->setHeaderLabel(tr("Operator"), 2); - elements_tab->setHeaderIcon(QPixmap(GuiUtilsNs::getIconPath("operator")),2); - elements_tab->setHeaderLabel(tr("Operator Class"), 3); - elements_tab->setHeaderIcon(QPixmap(GuiUtilsNs::getIconPath("opclass")),3); - elements_tab->setHeaderLabel(tr("Collation"), 4); - elements_tab->setHeaderIcon(QPixmap(GuiUtilsNs::getIconPath("collation")),4); - elements_tab->setHeaderLabel(tr("Sorting"), 5); - elements_tab->setHeaderLabel(tr("Nulls First"), 6); - - vbox->setContentsMargins(4,4,4,4); - vbox->addWidget(elements_tab); - - connect(elements_tab, SIGNAL(s_rowAdded(int)), this, SLOT(addElement(int))); - connect(elements_tab, SIGNAL(s_rowEdited(int)), this, SLOT(editElement(int))); - } - catch(Exception &e) - { - throw Exception(e.getErrorMessage(),e.getErrorCode(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); - } -} - -ElementsTableWidget::~ElementsTableWidget() -{ - if(handled_elem) - delete handled_elem; -} - -void ElementsTableWidget::showElementData(Element *elem, int elem_idx) -{ - if(!elem) - return; - - if(elem->getColumn()) - { - elements_tab->setCellText(elem->getColumn()->getName(), elem_idx, 0); - elements_tab->setCellText(elem->getColumn()->getTypeName(), elem_idx, 1); - } - else - { - elements_tab->setCellText(elem->getExpression(), elem_idx, 0); - elements_tab->setCellText(tr("Expression"), elem_idx, 1); - } - - elements_tab->clearCellText(elem_idx, 2); - if(elem->getOperator()) - elements_tab->setCellText(elem->getOperator()->getSignature(true), elem_idx, 2); - - elements_tab->clearCellText(elem_idx, 3); - if(elem->getOperatorClass()) - elements_tab->setCellText(elem->getOperatorClass()->getName(true), elem_idx, 3); - - elements_tab->clearCellText(elem_idx, 4); - if(elem->getCollation()) - elements_tab->setCellText(elem->getCollation()->getName(true), elem_idx, 4); - - if(elem->isSortingEnabled()) - { - if(elem->getSortingAttribute(IndexElement::AscOrder)) - elements_tab->setCellText(tr("Ascending"), elem_idx, 5); - else - elements_tab->setCellText(tr("Descending"), elem_idx, 5); - - if(elem->getSortingAttribute(IndexElement::NullsFirst)) - elements_tab->setCellText(tr("Yes"), elem_idx, 6); - else - elements_tab->setCellText(tr("No"), elem_idx, 6); - } - else - { - elements_tab->clearCellText(elem_idx, 4); - elements_tab->clearCellText(elem_idx, 5); - } - - elements_tab->setRowData(copyElementData(elem), elem_idx); -} - -QVariant ElementsTableWidget::copyElementData(Element *elem) -{ - if(dynamic_cast(elem)) - return QVariant::fromValue(*dynamic_cast(elem)); - - if(dynamic_cast(elem)) - return QVariant::fromValue(*dynamic_cast(elem)); - - if(dynamic_cast(elem)) - return QVariant::fromValue(*dynamic_cast(elem)); - - return QVariant(); -} - -int ElementsTableWidget::openElementForm(Element *elem) -{ - int res = 0; - - GeneralConfigWidget::restoreWidgetGeometry(&element_form, element_wgt->metaObject()->className()); - element_wgt->setAttributes(model, parent_obj, elem); - element_form.setWindowTitle(element_wgt->windowTitle()); - res = element_form.exec(); - GeneralConfigWidget::saveWidgetGeometry(&element_form, element_wgt->metaObject()->className()); - - return res; -} - -void ElementsTableWidget::editElement(int elem_idx) -{ - QVariant data = elements_tab->getRowData(elem_idx); - Element *elem = nullptr; - IndexElement idx_elem; - ExcludeElement exc_elem; - PartitionKey part_key; - int res = 0; - - if(data.canConvert()) - { - idx_elem = data.value(); - elem = &idx_elem; - } - - if(data.canConvert()) - { - exc_elem = data.value(); - elem = &exc_elem; - } - - if(data.canConvert()) - { - part_key = data.value(); - elem = &part_key; - } - - res = openElementForm(elem); - - if(elem && res == QDialog::Accepted) - showElementData(element_wgt->getElement(), elem_idx); -} - -void ElementsTableWidget::addElement(int elem_idx) -{ - if(openElementForm(handled_elem) == QDialog::Accepted) - showElementData(element_wgt->getElement(), elem_idx); - else - elements_tab->removeRow(elem_idx); -} diff --git a/libs/libgui/src/widgets/elementstablewidget.h b/libs/libgui/src/widgets/elementstablewidget.h deleted file mode 100644 index 319b875723..0000000000 --- a/libs/libgui/src/widgets/elementstablewidget.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -# PostgreSQL Database Modeler (pgModeler) -# -# Copyright 2006-2021 - Raphael Araújo e Silva -# -# 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 version 3. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# The complete text of GPLv3 is at LICENSE file on source code root directory. -# Also, you can get the complete GNU General Public License at -*/ - -/** -\ingroup libgui -\class ElementsTableWidget -\brief Implements the operations to create/edit constraints (exclude), indexes and partition keys elements via form storing them on a objects table (grid). -*/ - -#ifndef ELEMENTS_TABLES_WIDGET_H -#define ELEMENTS_TABLES_WIDGET_H - -#include -#include "objectstablewidget.h" -#include "indexelement.h" -#include "excludeelement.h" -#include "partitionkey.h" -#include "baseform.h" -#include "elementwidget.h" - -/* Declaring the IndexElement and ExcludeElement class as a Qt metatype in order to permit - * that instances of the class be used as data of QVariant and QMetaType */ -#include -Q_DECLARE_METATYPE(IndexElement) -Q_DECLARE_METATYPE(ExcludeElement) -Q_DECLARE_METATYPE(PartitionKey) - -class ElementsTableWidget: public QWidget { - private: - Q_OBJECT - - /*! \brief Store an instance of the element being handled (see setAttributes()) - * This one is used to determine the settings of the element widget open when the user - * wants to create new elements on the grid */ - Element *handled_elem; - - ElementWidget *element_wgt; - - BaseForm element_form; - - DatabaseModel *model; - - BaseObject *parent_obj; - - //! \brief Table widget used to control the index elements - ObjectsTableWidget *elements_tab; - - //! \brief Shows the element data on the elements table at the specified line - void showElementData(Element *elem, int elem_idx); - - //! \brief Copies the provided element storing it on a QVariant according to its real type (class) - QVariant copyElementData(Element *elem); - - //! \brief Opens the element editing form using the attributes of the provided element - int openElementForm(Element *elem); - - public: - ElementsTableWidget(QWidget *parent = nullptr); - virtual ~ElementsTableWidget(); - - //! \brief Configures the grid based upon the template Class in use - template - void setAttributes(DatabaseModel *model, BaseObject *parent_obj) - { - if(handled_elem && !dynamic_cast(handled_elem)) - { - delete handled_elem; - handled_elem = nullptr; - } - - if(!handled_elem) - handled_elem = new Class; - - this->model = model; - this->parent_obj = parent_obj; - - if(dynamic_cast(handled_elem)) - elements_tab->setHeaderVisible(2, false); - - if(dynamic_cast(handled_elem)) - elements_tab->setHeaderVisible(4, false); - - if(dynamic_cast(handled_elem)) - { - elements_tab->setHeaderVisible(2, false); - elements_tab->setHeaderVisible(5, false); - elements_tab->setHeaderVisible(6, false); - } - } - - //! \brief Fills the grid with the elements on the vector vector - template - void setElements(vector elems) - { - elements_tab->blockSignals(true); - for(auto &elem : elems) - { - elements_tab->addRow(); - showElementData(&elem, elements_tab->getRowCount() - 1); - } - elements_tab->clearSelection(); - elements_tab->blockSignals(false); - } - - //! \brief Fills the provided vector with the elements on the grid - template - void getElements(vector &elems) - { - if(elements_tab->getRowCount() > 0) - { - if(elements_tab->getRowData(0).canConvert()) - { - elems.clear(); - for(unsigned i=0; i < elements_tab->getRowCount(); i++) - elems.push_back(elements_tab->getRowData(i).value()); - } - } - } - - private slots: - void addElement(int elem_idx); - void editElement(int elem_idx); -}; - -#endif