Skip to content

Commit

Permalink
update custom widget creation scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 26, 2020
1 parent ff0b012 commit 8f58372
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion scripts/customwidget.cpp.template
Expand Up @@ -61,7 +61,7 @@ bool %CLASSMIXEDCASE%Plugin::isInitialized() const

void %CLASSMIXEDCASE%Plugin::initialize( QDesignerFormEditorInterface *core )
{
Q_UNUSED( core );
Q_UNUSED( core )
if ( mInitialized )
return;
mInitialized = true;
Expand Down
1 change: 1 addition & 0 deletions scripts/customwidget.h.template
Expand Up @@ -20,6 +20,7 @@
#include <QtGlobal>
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include <QtUiPlugin/QDesignerExportWidget>
#include "qgis_customwidgets.h"


class CUSTOMWIDGETS_EXPORT %CLASSMIXEDCASE%Plugin : public QObject, public QDesignerCustomWidgetInterface
Expand Down
22 changes: 13 additions & 9 deletions scripts/customwidget_create.sh
Expand Up @@ -9,6 +9,12 @@

set -e

# GNU prefix command for mac os support (gsed, gsplit)
GP=
if [[ "$OSTYPE" =~ darwin* ]]; then
GP=g
fi

CLASSNAME=$1

TODAY=$(date '+%d.%m.%Y')
Expand All @@ -27,13 +33,11 @@ for i in "${EXT[@]}"
do
DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i
cp "$DIR"/customwidget."$i".template "$DESTFILE"
sed -i s/%DATE%/"$TODAY"/g "$DESTFILE"
sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE"
sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE"
sed -i s/%EMAIL%/"$EMAIL"/g "$DESTFILE"
sed -i s/%CLASSUPPERCASE%/"$CLASSUPPER"/g "$DESTFILE"
sed -i s/%CLASSLOWERCASE%/"$CLASSLOWER"/g "$DESTFILE"
sed -i s/%CLASSMIXEDCASE%/"$CLASSNAME"/g "$DESTFILE"
${GP}sed -i s/%DATE%/"$TODAY"/g "$DESTFILE"
${GP}sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE"
${GP}sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE"
${GP}sed -i s/%EMAIL%/"$EMAIL"/g "$DESTFILE"
${GP}sed -i s/%CLASSUPPERCASE%/"$CLASSUPPER"/g "$DESTFILE"
${GP}sed -i s/%CLASSLOWERCASE%/"$CLASSLOWER"/g "$DESTFILE"
${GP}sed -i s/%CLASSMIXEDCASE%/"$CLASSNAME"/g "$DESTFILE"
done


0 comments on commit 8f58372

Please sign in to comment.