From e9ae80694875f869892f13f4fcaf1170a00dea41 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kommander/examples/old/widgetgenerator.kmdr | 438 ++++++++++++++++++++++++++++ 1 file changed, 438 insertions(+) create mode 100644 kommander/examples/old/widgetgenerator.kmdr (limited to 'kommander/examples/old/widgetgenerator.kmdr') diff --git a/kommander/examples/old/widgetgenerator.kmdr b/kommander/examples/old/widgetgenerator.kmdr new file mode 100644 index 00000000..00ef6262 --- /dev/null +++ b/kommander/examples/old/widgetgenerator.kmdr @@ -0,0 +1,438 @@ + +widgetGen + + + widgetGen + + + + 0 + 0 + 470 + 267 + + + + Kommander Widget Source Generator + + + + unnamed + + + 11 + + + 6 + + + + Layout12 + + + + unnamed + + + 0 + + + 24 + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + ExecButton1 + + + &Save + + + + +classNameLower=$(echo '@className' | tr "A-Z" "a-z") +classNameUpper=$(echo '@className' | tr "a-z" "A-Z") +inheritClassHeader=$(echo '@inheritClassName' | tr "A-Z" "a-z") + +headerContent="/*************************************************************************** + $classNameLower.h - @description + ------------------- + begin : @dateStarted + copyright : (C) @author + email : @email + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _HAVE_${classNameUpper}_H_ +#define _HAVE_${classNameUpper}_H_ + +/* KDE INCLUDES */ + +/* QT INCLUDES */ +#include <$inheritClassHeader.h> +#include <qstring.h> +#include <qstringlist.h> + +/* OTHER INCLUDES */ +#include <kommanderwidget.h> + +class QWidget; + +class QShowEvent; +class @className : public @inheritClassName, public KommanderWidget +{ + Q_OBJECT + + Q_PROPERTY(QString populationText READ populationText WRITE setPopulationText DESIGNABLE false) + Q_PROPERTY(QStringList associations READ associatedText WRITE setAssociatedText DESIGNABLE false) + Q_PROPERTY(bool KommanderWidget READ isKommanderWidget) + +public: + @className(QWidget *a_parent, const char *a_name); + ~@className(); + + virtual QString widgetText() const; + + virtual bool isKommanderWidget() const; + virtual void setAssociatedText(QStringList); + virtual QStringList associatedText() const; + virtual QString currentState() const; + + virtual QString populationText() const; + virtual void setPopulationText(QString); + +public slots: + virtual void setWidgetText(const QString &); + virtual void populate(); +signals: + void widgetOpened(); + void widgetTextChanged(const QString &); +protected: + void showEvent( QShowEvent *e ); +private: +}; + +#endif" + +cppContent="/*************************************************************************** + $classNameLower.cpp - @description + ------------------- + begin : @dateStarted + copyright : (C) @author + email : @email + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/* KDE INCLUDES */ +#include <klocale.h> + +/* QT INCLUDES */ +#include <qstring.h> +#include <qwidget.h> +#include <qstringlist.h> +#include <$inheritClassHeader.h> +#include <qevent.h> + +/* OTHER INCLUDES */ +#include <kommanderwidget.h> +#include \"$classNameLower.h\" + +@className::@className(QWidget *a_parent, const char *a_name) + : @inheritClassName(a_parent, a_name), KommanderWidget(this) +{ + QStringList states; + states << \"default\"; + setStates(states); + setDisplayStates(states); +} + +@className::~@className() +{ +} + +QString @className::currentState() const +{ + return QString(\"default\"); +} + +bool @className::isKommanderWidget() const +{ + return TRUE; +} + +QStringList @className::associatedText() const +{ + return KommanderWidget::associatedText(); +} + +void @className::setAssociatedText(QStringList a_at) +{ + KommanderWidget::setAssociatedText(a_at); +} + +void @className::populate() +{ + QString txt = KommanderWidget::evalAssociatedText( populationText() ); + setWidgetText( txt ); +} + +QString @className::populationText() const +{ + return KommanderWidget::populationText(); +} + +void @className::setPopulationText(QString a_text) +{ + KommanderWidget::setPopulationText(a_text); +} + +void @className::setWidgetText(const QString &a_text) +{ + //set the widget text of your widget here + emit widgetTextChanged(a_text); +} + +QString @className::widgetText() const +{ + // implement your widget text here + return QString::null; +} + +void @className::showEvent( QShowEvent *e ) +{ + @inheritClassName::showEvent( e ); + emit widgetOpened(); +} + +#include \"$classNameLower.moc\" +" + +echo "$headerContent" > @directory/$classNameLower.h +echo "$cppContent" > @directory/$classNameLower.cpp + + + + true + + + + + CloseButton1 + + + &Close + + + + + Spacer3 + + + Horizontal + + + Expanding + + + + 30 + 0 + + + + + + + + Layout37 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + Author: + + + + + TextLabel6 + + + Email: + + + + + TextLabel2 + + + Description: + + + + + TextLabel3 + + + Date started: + + + + + TextLabel4 + + + Class name: + + + + + TextLabel7 + + + Base class name: + + + + + TextLabel5 + + + Directory to save in: + + + + + + + Layout36 + + + + unnamed + + + 0 + + + 6 + + + + author + + + + @widgetText + + + + + + email + + + + @widgetText + + + + + + description + + + + @widgetText + + + + + + dateStarted + + + + @widgetText + + + + + + className + + + + @widgetText + + + + + + inheritClassName + + + + @widgetText + + + + + + directory + + + + @widgetText + + + + + + + + + -- cgit v1.2.3