From 114a878c64ce6f8223cfd22d76a20eb16d177e5e 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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../cpp/app_templates/opieapplet/.kdev_ignore | 0 languages/cpp/app_templates/opieapplet/Example.png | Bin 0 -> 1262 bytes languages/cpp/app_templates/opieapplet/Makefile.am | 18 +++ .../cpp/app_templates/opieapplet/app.kdevelop | 158 ++++++++++++++++++++ languages/cpp/app_templates/opieapplet/app.pro | 38 +++++ .../opieapplet/opieapplet.kdevtemplate | 135 +++++++++++++++++ .../cpp/app_templates/opieapplet/opieapplet.png | Bin 0 -> 483 bytes .../cpp/app_templates/opieapplet/simpleimpl.cpp | 162 +++++++++++++++++++++ .../cpp/app_templates/opieapplet/simpleimpl.h | 75 ++++++++++ 9 files changed, 586 insertions(+) create mode 100644 languages/cpp/app_templates/opieapplet/.kdev_ignore create mode 100644 languages/cpp/app_templates/opieapplet/Example.png create mode 100644 languages/cpp/app_templates/opieapplet/Makefile.am create mode 100644 languages/cpp/app_templates/opieapplet/app.kdevelop create mode 100644 languages/cpp/app_templates/opieapplet/app.pro create mode 100644 languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate create mode 100644 languages/cpp/app_templates/opieapplet/opieapplet.png create mode 100644 languages/cpp/app_templates/opieapplet/simpleimpl.cpp create mode 100644 languages/cpp/app_templates/opieapplet/simpleimpl.h (limited to 'languages/cpp/app_templates/opieapplet') diff --git a/languages/cpp/app_templates/opieapplet/.kdev_ignore b/languages/cpp/app_templates/opieapplet/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/cpp/app_templates/opieapplet/Example.png b/languages/cpp/app_templates/opieapplet/Example.png new file mode 100644 index 00000000..f63d0bc7 Binary files /dev/null and b/languages/cpp/app_templates/opieapplet/Example.png differ diff --git a/languages/cpp/app_templates/opieapplet/Makefile.am b/languages/cpp/app_templates/opieapplet/Makefile.am new file mode 100644 index 00000000..8faf4e32 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/Makefile.am @@ -0,0 +1,18 @@ +dataFiles = Makefile.am Example.png app.kdevelop app.pro \ + simpleimpl.cpp simpleimpl.h + +templateName = opieapplet + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/opieapplet/app.kdevelop b/languages/cpp/app_templates/opieapplet/app.kdevelop new file mode 100644 index 00000000..eee2c55a --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/app.kdevelop @@ -0,0 +1,158 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevTrollProject + C++ + + Qt + C++ + Code + + + + + + + + + + + + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + w3c-dom-level2-html + kdev3api + sdl + w3c-svg + w3c-uaag10 + + + Guide to the Qt Translation Tools + qmake User Guide + Qt Assistant Manual + Qt Designer Manual + Qt Referrence Documentation + + + bonobo-activation + gconf + gtksourceview + libbonobo + libbonoboui + + + + + + -qws + + true + false + false + + + false + true + + + + + true + + + + + %{APPNAMELC} + 0 +
opie/applets
+ %{AUTHOR} %{EMAIL} + arm + task-opie-minimal + %{VERSION} + Empty +
+ + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi + + #!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi + + +
+ + + + + ./%{APPNAMELC} + -qws + + +
+ + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + -f + + -dP + + -f + -u3 -p + + + + + + Doxygen Documentation Collection + %{APPNAMELC}.tag + + +
diff --git a/languages/cpp/app_templates/opieapplet/app.pro b/languages/cpp/app_templates/opieapplet/app.pro new file mode 100644 index 00000000..e1cc1e3b --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/app.pro @@ -0,0 +1,38 @@ +TEMPLATE = lib +CONFIG = qt dll qtopia warn_on release zecke-libqpe zecke-libopie opie-applet +HEADERS = %{APPNAMELC}.h +SOURCES = %{APPNAMELC}.cpp +TARGET = %{APPNAMELC} + + +QUICK_SPEC_FOO = $$(OPIE_BUILD_QUICK_APP) +contains( TEMPLATE, quick-template ){ + contains( QUICK_SPEC_FOO, quick-app-lib ){ + message( "foo" ) + system( rm $$TARGET ) + system( ln -s $$(OPIEDIR)/bin/quicklauncher $$TARGET) + DEFINES += OPIE_APP_INTERFACE + TEMPLATE = lib + CONFIG += dll + }else{ + LI = $$join( TARGET, "lib", "lib", ".so*" ) + system( rm $$LI ) + TEMPLATE = app + } +} + + +QMAKE_LIBDIR= $$(OPIEDIR)/lib +OPIE-SPEC=6 + +zecke-libqpe { + INCLUDEPATH += $$(OPIEDIR)/include + LIBS += -lqpe + DEPENDPATH += $$(OPIEDIR)/include +} + +zecke-libopie { + INCLUDEPATH += $$(OPIEDIR)/include + DEPENDPATH += $$(OPIEDIR)/include + LIBS += -lopie +} diff --git a/languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate b/languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate new file mode 100644 index 00000000..7be33a95 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate @@ -0,0 +1,135 @@ +# KDE Config File +[General] +Name=Opie Applet +Name[br]=Arloadig Opie +Name[ca]=Miniaplicació per a Opie +Name[da]=Opie-applet +Name[de]=Opie-Miniprogramm (Applet) +Name[el]=Μικροεφαρμογή Opie +Name[es]=Applet para Opie +Name[et]=Opie aplett +Name[eu]=Opie applet-a +Name[fa]=برنامک Opie +Name[fr]=Applet Opie +Name[ga]=Feidhmchláirín Opie +Name[gl]=Applet Opie +Name[hu]=Opie-s kisalkalmazás +Name[it]=Applet Opie +Name[ja]=Opie アプレット +Name[nds]=Opie-Lüttprogramm +Name[ne]=ओपिइ एप्लेट +Name[nl]=Opie-applet +Name[pl]=Aplet Opie +Name[pt]='Applet' do Opie +Name[pt_BR]='Applet' do Opie +Name[ru]=Аплет Opie +Name[sk]=Opie applet +Name[sl]=Vstavek za Opie +Name[sr]=Opie аплет +Name[sr@Latn]=Opie aplet +Name[sv]=Opie-miniprogram +Name[tr]=Opie Küçük Uygulaması +Name[zh_CN]=Opie 小程序 +Name[zh_TW]=Opie 小程式 +Icon=qmakeapp.png +Category=C++/Embedded +Comment=Generate an Opie applet. +Comment[ca]=Genera una miniaplicació per a Opie. +Comment[da]=Generér en Opie-applet. +Comment[de]=Erstellt ein Opie-Miniprogramm (Applet). +Comment[el]=Δημιουργία μίας μικροεφαρμογής Opie. +Comment[es]=Genera un applet para Opie. +Comment[et]=Opie apleti loomine. +Comment[eu]=Sortu Opie applet bat. +Comment[fa]=یک برنامک Opie تولید می‌کند. +Comment[fr]=Génère un applet Opie. +Comment[ga]=Cruthaigh feidhmchláirín Opie. +Comment[gl]=Xera un applet Opie. +Comment[hu]=Létrehoz egy Opie-s kisalkalmazást. +Comment[it]=Genera un'applet Opie. +Comment[ja]=Opie アプレットを作成 +Comment[nds]=Stellt en Opie-Lüttprogramm op. +Comment[ne]=ओपिइ एप्लेट उत्पन्न गर्दछ +Comment[nl]=Genereert een Opie-applet. +Comment[pl]=Generuje aplet Opie +Comment[pt]=Gera uma 'applet' do Opie. +Comment[pt_BR]=Gera uma 'applet' do Opie. +Comment[ru]=Создание аплета Opie. +Comment[sk]=Vygeneruje Opie applet. +Comment[sl]=Ustvari vstavek za Opie. +Comment[sr]=Прави Opie аплет. +Comment[sr@Latn]=Pravi Opie aplet. +Comment[sv]=Skapa ett Opie-miniprogram. +Comment[zh_CN]=生成一个 Opie 小程序。 +Comment[zh_TW]=產生一個 Opie 小程式 +FileTemplates=h,CStyle,cpp,CStyle +ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.cpp +Archive=opieapplet.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir0] +Type=mkdir +Dir=%{dest}/pics + +[MkDir1] +Type=mkdir +Dir=%{dest}/pics/%{APPNAMELC} + +[FILE2] +Type=install +Source=%{src}/Example.png +Dest=%{dest}/pics/%{APPNAMELC}/%{APPNAMELC}.png +Process=false + +[FILE3] +Type=install +Source=%{src}/app.pro +Dest=%{dest}/%{APPNAMELC}.pro + +[FILE4] +Type=install +Source=%{src}/simpleimpl.cpp +Dest=%{dest}/%{APPNAMELC}.cpp + +[FILE5] +Type=install +Source=%{src}/simpleimpl.h +Dest=%{dest}/%{APPNAMELC}.h + +[MSG] +Type=message +Comment=An opie applet was created in %{dest} +Comment[ca]=Una miniaplicació per a Opie ha estat creat en %{dest} +Comment[da]=En opie-applet blev oprettet i %{dest} +Comment[de]=Ein Opie-Miniprogramm (Applet) wurde in %{dest} erstellt. +Comment[el]=Μία μικροεφαρμογή opie δημιουργήθηκε στο %{dest} +Comment[es]=Un applet para Opie ha sido creado en %{dest} +Comment[et]=Opie aplett loodi asukohta %{dest} +Comment[eu]=Opie applet bat sortu da hemen: %{dest} +Comment[fa]=یک برنامک opie در %{dest} ایجاد شد +Comment[fr]=Un applet Opie a été créé dans %{dest} +Comment[ga]=Cruthaíodh feidhmchláirín opie i %{dest} +Comment[gl]=Creouse un applet opie en %{dset} +Comment[hu]=Létrejött egy Opie-s kisalkalmazás itt: %{dest} +Comment[it]=È stata creata un'applet Opie in %{dest} +Comment[ja]=Opie アプレットを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en Opie-Lüttprogramm opstellt +Comment[ne]=ओपिइ एप्लेट %{dest} मा सिर्जना गरियो +Comment[nl]=Een Opie-applet is aangemaakt in %{dest} +Comment[pl]=Aplet Opie został utworzony w %{dest} +Comment[pt]=Foi criada uma 'applet' do Opie em %{dest} +Comment[pt_BR]=Foi criada uma 'applet' do Opie em %{dest} +Comment[ru]=Аплет Opie создан в %{dest} +Comment[sk]=Opie applet bol vytvorený v %{dest} +Comment[sl]=Vstavek za opie je bil ustvarjen v %{dest} +Comment[sr]=Opie аплет је направљен у %{dest} +Comment[sr@Latn]=Opie aplet je napravljen u %{dest} +Comment[sv]=Ett Opie-miniprogram skapades i %{dest} +Comment[tr]=Bir Opie küçük uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 中创建了一个 opie 小程序 +Comment[zh_TW]=一個 Opie 小程式已建立於 %{dest} diff --git a/languages/cpp/app_templates/opieapplet/opieapplet.png b/languages/cpp/app_templates/opieapplet/opieapplet.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/cpp/app_templates/opieapplet/opieapplet.png differ diff --git a/languages/cpp/app_templates/opieapplet/simpleimpl.cpp b/languages/cpp/app_templates/opieapplet/simpleimpl.cpp new file mode 100644 index 00000000..1474a0e4 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/simpleimpl.cpp @@ -0,0 +1,162 @@ +#include +#include +#include + +#include // for AppLnk +#include // for Resource loading + +#include "%{APPNAMELC}.h" + + +%{APPNAME}::%{APPNAME}(QWidget *parent) + : QWidget( parent, "%{APPNAME} Applet" ) { +/* + * we will load an Image, scale it for the right usage + * remember your applet might be used by different + * resolutions. + * Then we will convert the image back to an Pixmap + * and draw this Pimxap. We need to use Image because its + * the only class that allows scaling. + */ + + QImage image = Resource::loadImage("%{APPNAMELC}/%{APPNAMELC}"); + /* + * smooth scale to AppLnk smallIconSize for applest + * smallIconSize gets adjusted to the resolution + * so on some displays like SIMpad and a C-750 the smallIconSize + * is greater than on a iPAQ h3870 + */ + image = image.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize() ); + + /* + * now we need to convert the Image to a Pixmap cause these + * can be drawn more easily + */ + m_pix = new QPixmap(); + m_pix->convertFromImage( image ); + + /* + * Now we will say that we don't want to be bigger than our + * Pixmap + */ + setFixedHeight(AppLnk::smallIconSize() ); + setFixedWidth( AppLnk::smallIconSize() ); + +} + +%{APPNAME}::~%{APPNAME}() { + delete m_pix; +} + + +/* + * here you would normal show or do something + * useful. If you want to show a widget at the top left + * of your icon you need to map your rect().topLeft() to + * global with mapToGlobal(). Then you might also need to + * move the widgets so it is visible + */ +void %{APPNAME}::mousePressEvent(QMouseEvent* ) { + QMessageBox::information(this, tr("No action taken"), + tr("This Plugin does not yet support anything usefule aye."), + QMessageBox::Ok ); + +} + +void %{APPNAME}::paintEvent( QPaintEvent* ) { + QPainter p(this); + + /* simpy draw the pixmap from the start of this widget */ + p.drawPixmap(0, 0, *m_pix ); +} + +/* + * Here comes the implementation of the interface + */ +%{APPNAME}Impl::%{APPNAME}Impl() { +} +/* needed cause until it is only pure virtual */ +%{APPNAME}Impl::~%{APPNAME}Impl() { + /* + * we will delete our applets as well + * setAUtoDelete makes the QList free + * the objects behind the pointers + */ + m_applets.setAutoDelete( true ); + m_applets.clear(); +} + +/* + * For the taskbar interface return a Widget + */ +QWidget* %{APPNAME}Impl::applet( QWidget* parent ) { + /* + * There are problems with ownership. So we add + * our ownlist and clear this; + */ + %{APPNAME}* ap = new %{APPNAME}( parent ); + m_applets.append( ap ); + + return ap; +} + +/* + * A small hint where the Applet Should be displayed + */ +int %{APPNAME}Impl::position()const { + return 1; +} + + +/* + * Now the important QUnkownInterface method without + * this one your applet won't load + * @param uuid The uuid of the interface + * @param iface The pointer to the interface ptr + */ +QRESULT %{APPNAME}Impl::queryInterface( const QUuid& uuid, QUnknownInterface** iface) { + /* set the pointer to the interface to 0 */ + *iface = 0; + + /* + * we check if we support the requested interface + * and then assign to the pointer. + * You may alos create another interface here so + * *iface = this is only in this simple case true you + * could also support more interfaces. + * But this example below is the most common use. + * Now the caller knows that the Interface Pointer + * is valid and the interface supported + */ + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_TaskbarApplet ) + *iface = this; + else + return QS_FALSE; + + if ( *iface ) + (*iface)->addRef(); + + return QS_OK; +} + + +/* + * Finally we need to export the Interface. + * CREATE_INSTANCE creates a interface and calls + * queryInterface for the QUnknownInterface once + * With out this function the applet can't be loaded. + * + * NOTE: If your applet does not load it's likely you've an + * unresolved symbol. Change the .pro TEMPLATE = lib to TEMPLATE= app + * and recompile. If the linker only complains about a missing + * main method the problem is more complex. In most cases it'll say + * you which symbols are missing and you can implement them. + * The main(int argc, char* argv[] ) does not need to be + * included in a library so it's ok that the linker complains + */ +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( %{APPNAME}Impl ) +} + diff --git a/languages/cpp/app_templates/opieapplet/simpleimpl.h b/languages/cpp/app_templates/opieapplet/simpleimpl.h new file mode 100644 index 00000000..19475367 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/simpleimpl.h @@ -0,0 +1,75 @@ +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + + +/** + * Opie and Qtopia uses a component system called QCOM + * which was first part of the Qt 3.0 API but was made + * prviate during the betas. Opie and Qtopia still use it + * and we're happy with it. + * Every starts with the QUnknownInterface. It supports functions + * for reference counting and the most important one + * is for a query. Every QCOM interface got a global unique id ( GUID,UUID ) + * query is used to see if a interface is supported by + * a dynamic shared object ( dso / plugin ) + * For tasks like loading Applications, InputMethods, Today, MenuButton, + * Taskbar, Style, Email Client there are specefic Interfaces you + * need to implement. The interfaces inherits from QUnknownInterface and + * you'll need inherit from the interface. + * As example we will use the Taskbar interface + */ + + +/* + * The taskbar applet interfaces wants us to implement position() and applet() + * additionally we need to implement add(), release() and queryInterface for QUnknownInterface + * luckiy there is a macro for the reference counting + * We provide an Implementation of the interface. + */ +#include +#include + +#include + + +/* + * Because we only draw an Icon in a fixed width and height + * we declare and define %{APPNAME} here and you could use QLabel + * setPixmap or use QWidget and draw yourself. + * You might also want to reimplement mouse*Event to use some simple actions + */ +class %{APPNAME} : public QWidget { + Q_OBJECT +public: + %{APPNAME}(QWidget *parent); + ~%{APPNAME}(); +private: + void mousePressEvent( QMouseEvent* ); + void paintEvent( QPaintEvent* ); + QPixmap *m_pix; +}; + +class %{APPNAME}Impl : public TaskbarAppletInterface { +public: + + %{APPNAME}Impl(); + virtual ~%{APPNAME}Impl(); + + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + + QWidget *applet( QWidget* parent ); + int position()const; + + /* + * macro for reference countint + * if reference drops to zero + * delete this is called + */ + Q_REFCOUNT + +private: + QList<%{APPNAME}> m_applets; +}; + + +#endif -- cgit v1.2.1