diff options
Diffstat (limited to 'languages/cpp/app_templates/opieapplet')
-rw-r--r-- | languages/cpp/app_templates/opieapplet/.kdev_ignore | 0 | ||||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/Example.png | bin | 0 -> 1262 bytes | |||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/Makefile.am | 18 | ||||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/app.kdevelop | 158 | ||||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/app.pro | 38 | ||||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/opieapplet.kdevtemplate | 135 | ||||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/opieapplet.png | bin | 0 -> 483 bytes | |||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/simpleimpl.cpp | 162 | ||||
-rw-r--r-- | languages/cpp/app_templates/opieapplet/simpleimpl.h | 75 |
9 files changed, 586 insertions, 0 deletions
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 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/.kdev_ignore diff --git a/languages/cpp/app_templates/opieapplet/Example.png b/languages/cpp/app_templates/opieapplet/Example.png Binary files differnew file mode 100644 index 00000000..f63d0bc7 --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/Example.png 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 @@ +<?xml version="1.0"?> +<kdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevTrollProject</projectmanagement> + <primarylanguage>C++</primarylanguage> + <keywords> + <keyword>Qt</keyword> + <keyword>C++</keyword> + <keyword>Code</keyword> + </keywords> + <ignoreparts/> + </general> + <kdevfileview> + <groups> + <group pattern="*.cpp;*.cxx;*.h" name="Sources" /> + <group pattern="*.ui" name="User Interface" /> + <group pattern="*.png" name="Icons" /> + <group pattern="*" name="Others" /> + </groups> + <tree> + <hidenonprojectfiles>false</hidenonprojectfiles> + <hidepatterns>*.o,*.lo,CVS</hidepatterns> + </tree> + </kdevfileview> + <kdevdoctreeview> + <ignoretocs> + <toc>gtk</toc> + <toc>gnustep</toc> + <toc>python</toc> + <toc>php</toc> + <toc>perl</toc> + <toc>w3c-dom-level2-html</toc> + <toc>kdev3api</toc> + <toc>sdl</toc> + <toc>w3c-svg</toc> + <toc>w3c-uaag10</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>Guide to the Qt Translation Tools</toc> + <toc>qmake User Guide</toc> + <toc>Qt Assistant Manual</toc> + <toc>Qt Designer Manual</toc> + <toc>Qt Referrence Documentation</toc> + </ignoreqt_xml> + <ignoredevhelp> + <toc>bonobo-activation</toc> + <toc>gconf</toc> + <toc>gtksourceview</toc> + <toc>libbonobo</toc> + <toc>libbonoboui</toc> + </ignoredevhelp> + </kdevdoctreeview> + <kdevdebugger> + <general> + <dbgshell></dbgshell> + <programargs>-qws</programargs> + <gdbpath/> + <breakonloadinglibs>true</breakonloadinglibs> + <separatetty>false</separatetty> + <floatingtoolbar>false</floatingtoolbar> + </general> + <display> + <staticmembers>false</staticmembers> + <demanglenames>true</demanglenames> + </display> + </kdevdebugger> + <kdevtrollproject> + <opie> + <quick_app>true</quick_app> + </opie> + <packaging> + <template>2</template> + <owner> + <package>%{APPNAMELC}</package> + <prio>0</prio> + <section>opie/applets</section> + <maintainer>%{AUTHOR} %{EMAIL}</maintainer> + <arch>arm</arch> + <depends>task-opie-minimal</depends> + <version>%{VERSION}</version> + <desc>Empty</desc> + </owner> + <scripts> + <post>#!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi +</post> + <post_rem>#!/bin/sh +if pidof -s qpe >/dev/null; then + /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" +else + exit 0 +fi +</post_rem> + </scripts> + </packaging> + <general> + <activedir></activedir> + </general> + <run> + <mainprogram>./%{APPNAMELC}</mainprogram> + <programargs>-qws</programargs> + </run> + <envvars/> + </kdevtrollproject> + <kdevfilecreate> + <filetypes/> + <useglobaltypes> + <type ext="ui" /> + <type ext="cpp" /> + <type ext="h" /> + </useglobaltypes> + </kdevfilecreate> + <cppsupportpart> + <codecompletion> + <codehinting outputview="1" enablech="0" selectview="0" /> + </codecompletion> + <classstore> + <enablepcs>false</enablepcs> + <enablepp>false</enablepp> + <preparsing/> + </classstore> + <filetemplates> + <choosefiles>false</choosefiles> + <interfaceURL></interfaceURL> + <implementationURL></implementationURL> + <interfacesuffix>.h</interfacesuffix> + <implementationsuffix>.cpp</implementationsuffix> + <lowercasefilenames>true</lowercasefilenames> + </filetemplates> + </cppsupportpart> + <kdevclassview> + <folderhierarchy>true</folderhierarchy> + <depthoffolders>2</depthoffolders> + </kdevclassview> + <kdevcvs> + <cvsoptions>-f</cvsoptions> + <commitoptions></commitoptions> + <updateoptions>-dP</updateoptions> + <addoptions></addoptions> + <removeoptions>-f</removeoptions> + <diffoptions>-u3 -p</diffoptions> + <logoptions></logoptions> + <rshoptions></rshoptions> + </kdevcvs> + <kdevdocumentation> + <projectdoc> + <docsystem>Doxygen Documentation Collection</docsystem> + <docurl>%{APPNAMELC}.tag</docurl> + </projectdoc> + </kdevdocumentation> +</kdevelop> 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 Binary files differnew file mode 100644 index 00000000..840a953c --- /dev/null +++ b/languages/cpp/app_templates/opieapplet/opieapplet.png 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 <qlabel.h> +#include <qpainter.h> +#include <qmessagebox.h> + +#include <qpe/applnk.h> // for AppLnk +#include <qpe/resource.h> // 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("<qt>This Plugin does not yet support anything usefule aye.</qt>"), + 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 <qwidget.h> +#include <qptrlist.h> + +#include <qpe/taskbarappletinterface.h> + + +/* + * 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 |