diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /lib/interfaces/external | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
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
Diffstat (limited to 'lib/interfaces/external')
-rw-r--r-- | lib/interfaces/external/Mainpage.dox | 57 | ||||
-rw-r--r-- | lib/interfaces/external/Makefile.am | 15 | ||||
-rw-r--r-- | lib/interfaces/external/designer.cpp | 30 | ||||
-rw-r--r-- | lib/interfaces/external/designer.h | 98 |
4 files changed, 200 insertions, 0 deletions
diff --git a/lib/interfaces/external/Mainpage.dox b/lib/interfaces/external/Mainpage.dox new file mode 100644 index 00000000..4618c3d5 --- /dev/null +++ b/lib/interfaces/external/Mainpage.dox @@ -0,0 +1,57 @@ +/** +@mainpage The %KInterfaceDesigner Library + +This library contains all %KInterfaceDesigner classes and interfaces which form the core of +GUI Designer integration framework. + +<b>Link with</b>: -lkinterfacedesigner + +<b>Include path</b>: -I\$(kde_includes)/kinterfacedesigner + +\section designerintegration Overview of GUI designer integration process +Each KPart that wants to act as a GUI Designer must implement @ref KInterfaceDesigner::Designer +interface. It defines necessary signals to communicate with an IDE and abstract virtual +functions to determine designer type. + +If a part which can "design" user interface files of a certain mimetype +implements this interface and sets itself as a default handler for that +mimetype then it becomes automatically integrated into KDevelop IDE. + +When a part is embedded into KDevelop shell, its signals (defined in @ref +KInterfaceDesigner::Designer interface): +@code + void addedFunction(DesignerType type, const QString &formName, Function function) + void removedFunction(DesignerType type, const QString &formName, Function function) + void editedFunction(DesignerType type, const QString &formName, Function oldFunction, Function function) + void editFunction(DesignerType type, const QString &formName, const QString &functionName) + void editSource(DesignerType type, const QString &formName); +@endcode +are connected to corresponding slots of KDevelop designer integration engine which can be implemented in KDevelop language support plugin. + +Each language support which wants to use integrated designer, must reimplement +@code +virtual KDevDesignerIntegration *KDevLanguageSupport::designer(KInterfaceDesigner::DesignerType type) +@endcode +method and return designer integration object. + +Convenience designer integration support library is available for programming language support +developers. With the convenience library writing %Qt designer integration for the language is a +trivial task. + + +\section kdevdesigner KDevelop Designer technical overview +KDevelop version >= 3.1 comes with a customized version (fork ;)) of %Qt Designer. It is called KDevelop Designer (KDevDesigner, kdevdesigner from the command line). KDevDesigner has some important differences: +- KDevDesigner provides a read/write KPart which can be embedded into any application which wants to edit .ui files. KDevelop IDE embeds KDevDesigner this way. +- KDevDesigner uses %KDE icons and dialogs and thus provides better integration with a system. +. + +It is safe to preview forms with some %KDE widgets from kdeui and kio libraries - KDevDesigner part is linked to those libraries so it will not crash under some circumstances. + +KDevDesigner will not create .ui.h files - this feature is completely disabled. Integrated KDevDesigner will use subclassing approach, standalone does not allow to enter code. + +\section other Other information + +@note It is technically possible to integrate not only %Qt Designer, but also, for example, Glade. Glade-3 can be compiled as a library and probably be embedded via XParts technology. + +*/ + diff --git a/lib/interfaces/external/Makefile.am b/lib/interfaces/external/Makefile.am new file mode 100644 index 00000000..bcad37b3 --- /dev/null +++ b/lib/interfaces/external/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +METASOURCES = AUTO + +kinterfacedesignerdir = $(includedir)/kinterfacedesigner +kinterfacedesigner_HEADERS = designer.h + +lib_LTLIBRARIES = libkinterfacedesigner.la +libkinterfacedesigner_la_LIBADD = $(LIB_QT) $(LIB_KPARTS) $(LIB_KDEUI) +libkinterfacedesigner_la_LDFLAGS = $(all_libraries) +libkinterfacedesigner_la_SOURCES = designer.cpp + +DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils +DOXYGEN_PROJECTNAME = KInterfaceDesigner Library +include ../../../Doxyfile.am diff --git a/lib/interfaces/external/designer.cpp b/lib/interfaces/external/designer.cpp new file mode 100644 index 00000000..b7c5de7a --- /dev/null +++ b/lib/interfaces/external/designer.cpp @@ -0,0 +1,30 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo <cloudtemple@mksat.net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include "designer.h" + +namespace KInterfaceDesigner{ + +Designer::Designer(QObject *parent, const char *name) + :KParts::ReadWritePart(parent, name) +{ +} + +} + +#include "designer.moc" diff --git a/lib/interfaces/external/designer.h b/lib/interfaces/external/designer.h new file mode 100644 index 00000000..5c7821fa --- /dev/null +++ b/lib/interfaces/external/designer.h @@ -0,0 +1,98 @@ +/* This file is part of the KDE project + Copyright (C) 2004 Alexander Dymo <cloudtemple@mksat.net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#ifndef KINTERFACEDESIGNER_FORMEDITOR_H +#define KINTERFACEDESIGNER_FORMEDITOR_H + +#include <kparts/part.h> + +/**Contains KInterfaceDesigner classes.*/ +namespace KInterfaceDesigner{ + +/**The type of a GUI Designer.*/ +enum DesignerType { + QtDesigner /**<Qt Designer.*/, + Glade /**<Glade (version >= 3).*/ +}; + +/**Function type.*/ +enum FunctionType { + ftFunction /**<Simple function or a callback.*/, + ftQtSlot /**<Qt slot.*/ +}; + +/**Function.*/ +struct Function{ + /**Return type.*/ + QString returnType; + /**Function name.*/ + QString function; + /**Specifier, e.g. virtual, static, etc.*/ + QString specifier; + /**Access, e.g. private, protected, public, etc.*/ + QString access; + /**Function type.*/ + FunctionType type; +}; + +/** +GUI Designer Part Interface. +Each KPart that wants to act as a GUI Designer must implement this interface. +It defines necessary signals to communicate with an IDE and abstract virtual +functions to determine designer type. + +Parts that implement this interface must emit its signals when necessary. +See signals documentation for an explanation on when to emit those. + +If a part which can "design" user interface files of a certain mimetype +implements this interface and sets itself as a default handler for that +mimetype then it becomes automatically integrated into KDevelop IDE. +*/ +class Designer: public KParts::ReadWritePart{ + Q_OBJECT +public: + Designer(QObject *parent, const char *name); + + /**Reimplement this to be able to open projects.*/ + virtual void openProject(const QString &projectFile) = 0; + /**Reimplement this return the type of this designer.*/ + virtual DesignerType designerType() = 0; + +signals: + /**Emit this signal when a function was added by a designer. For example, when a slot + or a callback function was defined.*/ + void addedFunction(DesignerType type, const QString &formName, Function function); + /**Emit this signal when a function was removed by a designer.*/ + void removedFunction(DesignerType type, const QString &formName, Function function); + /**Emit this signal when a function signature was edited by a designer.*/ + void editedFunction(DesignerType type, const QString &formName, Function oldFunction, Function function); + + /**Emit this signal when a designer wants to open the editor with function definition.*/ + void editFunction(DesignerType type, const QString &formName, const QString &functionName); + /**Emit this signal when a designer wants to open the editor for a form sources.*/ + void editSource(DesignerType type, const QString &formName); + + /**Emitted when a form state is changed in the designer. + @param formName An absolute name of the form file. + @param status 0: form is clean, 1: form is modified.*/ + void newStatus(const QString &formName, int status); +}; + +} + +#endif |