diff options
Diffstat (limited to 'kjsembed/docs')
173 files changed, 15301 insertions, 0 deletions
diff --git a/kjsembed/docs/ChangeLog b/kjsembed/docs/ChangeLog new file mode 100644 index 00000000..95cedca2 --- /dev/null +++ b/kjsembed/docs/ChangeLog @@ -0,0 +1,4243 @@ +2004-12-11 Saturday 09:01 geiseri + + Added two examples to the Doxygen documentation. + +2004-12-11 Saturday 07:27 geiseri + + Updated Doxyfile. + +2004-12-11 Saturday 07:22 geiseri + + Added method throwError(...). + This method will take an error message and a type and throw a + complete exception with an error object. This object has the + following properties that can be accessed: + line - the line number the exception happened at. + sourceid - the source fragment the exception happened in. + message - the actual error message. + name - the error type. + + This object can be accessed in both javascript and C++, and + will be returned as the completion object when there is an + exception in an executed script. + + Moved all errors in the code to throwError() + +2004-12-11 Saturday 07:15 geiseri + + Use extractQObject here because it is safer. + +2004-12-11 Saturday 07:15 geiseri + + Added home directory path, current path, and application directory path. + +2004-12-11 Saturday 07:12 geiseri + + Added more verbose documentation on how to use the part interface. + +2004-12-11 Saturday 07:11 geiseri + + documentation cleanup + +2004-12-11 Saturday 02:25 geiseri + + Actually return the line number that the error happened. + +2004-12-10 Friday 13:12 geiseri + + Things that are created via the widgetFactory should be owned in + javascript. So when the parent is destroyed so will the children. + +2004-12-10 Friday 13:10 geiseri + + Make sure the KActionCollection is native, it seems that + it has no parent so the GC will happily collect it. + +2004-12-10 Friday 13:09 geiseri + + Added registration of more proxies. + +2004-12-10 Friday 13:07 geiseri + + Small code cleanup. + +2004-12-10 Friday 13:03 geiseri + + remove some debug information + +2004-12-10 Friday 13:01 geiseri + + Added some debugging info for object ownership. + Moved the typeName to a pure virtual here. We already + broke BC here, and this method is in every child class. + +2004-12-10 Friday 12:59 geiseri + + Implemented better QVariant to JSObject mappings. The big change here + that Javascript arrays and Javascript objects can be mapped to QVariants + in C++. Conversions break down as follows: + QStringList -> Array of javascript strings. + QValueList<QVariant> -> Array of Javascript values. + QMap<QString,QVariant> -> Object/Array that has each QString key as + a property, and the QVariant is mapped to a Javascript value. + + From Javascript the conversions are a little different. + All arrays that have a numeric index will be converted to + QValueList<QVariant> QVariants. These can be mapped to both + QStringList and to normal QValueList. An example would be like this: + KJS::Value someArrayValue; + QStringList strLst = convertToVariant(exec, someArrayValue).toStringList(); + QValueList<QVariant> varLst + = convertToVariant( exec, someArrayValue).toList(); + + Now if the Javascript value is a Javascript object or a map then + the conversion will go to a QMap<QString,QVariant>. An example of + this would be like: + KJS::Value someJSObject; + QMap<QString,QVariant> map = convertToVariant(exec,someJSObject) + .toMap(); + QString someVal = map["someProp"].toString(); + + This is done via some testing of the array and you can trip + it up in some cases: + 1) If the object is empty, or null will return an empty QMap + 2) If the object is an array that has the last element null + then a QMap will be returned. + + The first case is not much of an issue because an empty variant + is the same for all types, but the second case can cause + unexpected results. + + In cases of sparse arrays the empty values will be filled in + with empty QVariants in the QValueList. + +2004-12-10 Friday 12:42 geiseri + + Changed the example to actually show off using KJSEmbed. + Example shows the following: + 1) Embedding KJSEmbed. + 2) Calling Javascript methods from C++. + 3) Transparent mapping of custom javascript objects into QVariant maps. + 4) Adding widgets to a C++ based form from Javascript. + 5) Execution of a script from outside of the main application. + +2004-12-09 Thursday 23:55 geiseri + + removed generated docs from cvs + +2004-12-09 Thursday 15:09 geiseri + + torture test for QFrame, still fails. + +2004-12-09 Thursday 15:07 geiseri + + more complete test for arrays + +2004-12-08 Wednesday 11:15 geiseri + + Added a QVariant slot so C++ bindings can easier get more + complex data types into the bindings. + +2004-12-08 Wednesday 11:12 geiseri + + Fixed some logic errors. + Throw exceptions with meaningful errors. + +2004-12-08 Wednesday 11:12 geiseri + + Removed debug information that was screwing with QVariants. + +2004-12-07 Tuesday 20:10 staikos + + compile + +2004-12-07 Tuesday 12:02 geiseri + + do not delete a QWidget if you are painting on it, its rude + +2004-12-07 Tuesday 12:01 geiseri + + fix name of include + +2004-12-06 Monday 14:08 geiseri + + Moved to new bindings extension class. + +2004-12-06 Monday 14:07 geiseri + + With new API QListViewItem objects now iterate properly. + + QListView::firstChild() and QListView::currentSelection now work. + QListViewItems can now iterate property. + + The test now shows how to use these methods. + + +2004-12-06 Monday 14:04 geiseri + + Moved registered bindings to their own baseclass. This API is not stable + so it is subject to change. More documentation on this will follow once + it is more solid. + +2004-12-06 Monday 13:34 geiseri + + Removed autogenerated docs, since the scripts now work to generate them + property on Qt only and KDE mode. + +2004-12-05 Sunday 19:54 geiseri + + Moved QListViewItem and QCheckListItem to the object registry. + +2004-12-05 Sunday 19:11 geiseri + + Moved bindings to the new object registry. + + The new object registry allows developers to add custom types + to KJSEmbed when they embed the interpreter into their applications. + + To add a binding you create the binding as binding plugin, but instead + of using the KTrader to register the plugin, you call + JSFactory::registerOpaqueType("Name", new TypeFactory(parent,"name"); + + Now KJS can create your type and manipulate it. This currently supports + only opaque types, QObject types are next once this migration is + complete. + +2004-12-05 Sunday 19:08 geiseri + + Throw errors on type mismatches. This causes scripts to + actually give errors where they happen vs at some random + later point. + +2004-12-05 Sunday 10:12 geiseri + + Test for QFrame + +2004-12-04 Saturday 17:57 geiseri + + Do not delete the internal dcop client pointer, it is considered rude. + +2004-12-04 Saturday 14:25 geiseri + + Added QProgressDialog to the list of creatable types. + +2004-12-04 Saturday 02:34 geiseri + + QT_NO_ASCII_CAST build fix. + +2004-12-04 Saturday 02:25 geiseri + + Gave the KJSEmbed documentation viewer a facelift. + Runs in Qt only and KDE mode just fine. + Search is not implemented, but most browser features are. + Maybe we need to fix up the dump() output and make it + follow the current KDE color styles? + +2004-12-04 Saturday 01:33 geiseri + + Add QToolBox items to the published children when comming from QWidgetFactory + +2004-12-03 Friday 21:28 geiseri + + Small cleanup. + +2004-12-03 Friday 21:27 geiseri + + Add config to Qt only. + +2004-12-03 Friday 21:27 geiseri + + dont delete the builting kapplication ptr. + +2004-12-03 Friday 21:25 geiseri + + code cleanup. + +2004-12-03 Friday 20:07 geiseri + + These are no longer needed. + +2004-12-03 Friday 20:06 geiseri + + Added createObject method. + +2004-12-03 Friday 20:06 geiseri + + logic fix + +2004-12-03 Friday 20:05 geiseri + + Do not delete QObjects that are managed by their parents. + +2004-12-03 Friday 20:04 geiseri + + Added Factory.createObject(classname,args,...) for those coming + from windows land. + +2004-12-03 Friday 20:01 geiseri + + Do not manage QListView, and ListBox items as the containers will. + Had to wash this file over with AStyle, it was getting to be a mess. + +2004-12-02 Thursday 22:15 geiseri + + note start position + +2004-12-02 Thursday 21:50 geiseri + + Added QRect::contains(...) to Rect class. + Updated game board to detect objects getting in the target. + +2004-12-01 Wednesday 14:45 geiseri + + make 10 items, use QFrame for formatting. + +2004-12-01 Wednesday 11:25 geiseri + + added a small gameboard example + +2004-12-01 Wednesday 09:58 geiseri + + Added tests for QSize, QPoint and QRect. + +2004-12-01 Wednesday 09:58 geiseri + + Added support for: + QPoint + QRect + QSize + + Cleanup headers in QPen + + These are all handled as value proxies so they are transparently supported + in slots, QObject bindings, and dcop. These can be used by their variant + names of Point, Rect and Size respectivly. Also constructors are provided + for Point, Rect and Size so you can construct items in one step + ex: + var point = new Point(x,y); + var size = new Size(w,h); + var rect = new Rect(x,y,w,h); + +2004-12-01 Wednesday 09:54 geiseri + + Throw an exception on a handler error so the user can figure out what went wrong. + +2004-12-01 Wednesday 09:54 geiseri + + Added drag and drop event handlers. + +2004-11-30 Tuesday 17:47 geiseri + + test kconfig more robustly. + +2004-11-30 Tuesday 12:02 geiseri + + Fixed issue where config files where not reading and writing properly + When the default args where removed they would pass invalid items to + the KConfig methods. This would basicly cause the methods to fail + in strange and entertaining ways. Since the methods with default + args had the default args ignored before this really changes nothing + on the public API. This will someday change to an opaque proxy + though and those args will work. + +2004-11-30 Tuesday 12:00 geiseri + + save the max input from the dialog + +2004-11-30 Tuesday 10:45 geiseri + + Added support for passing QStringList through slots. This fixed the problems with KConfig bindings not showing up. It should also fix the problem of not being able to pass StringLists to C++ slots that have been published to javascript. + +2004-11-29 Monday 17:41 annma + + add a maximum value that can be changed in config + config dialog is a bit bloated though now ;-) + +2004-11-29 Monday 13:26 geiseri + + Start of QSettings support for real. Binding is complete hozed though so it probably needs to be replaced before we release the next release. + +2004-11-29 Monday 13:25 geiseri + + Qt only fixes + +2004-11-29 Monday 13:22 geiseri + + Qt only fixes. + +2004-11-29 Monday 13:22 geiseri + + Remove unused headers. + +2004-11-29 Monday 11:14 geiseri + + Update to use KJSEmbed from KDE 3.3 features. + +2004-11-28 Sunday 21:38 geiseri + + removed default args, they really screw up QObject bindings. + +2004-11-28 Sunday 21:32 geiseri + + more qtonly config fixes + +2004-11-28 Sunday 21:11 geiseri + + Added some help + +2004-11-28 Sunday 20:39 geiseri + + added widget extraction methods to cleanup code elsewhere + +2004-11-28 Sunday 20:23 geiseri + + Small example application with KJSEmbed: + This is a small math drill application I wrote for my cousin this weekend. She is + having a horrible time of it in math, so I created a simple drill utility for addition and + subtraction. Basicly what it does is throws random math problems at you for a + minute. The goal is to see how many you can get correct in that time. This is loosely + based off of a very foggy memory of a math drill that I did in second grade. I + think the important message here is that KJSEmbed could be a powerful tool + that teachers who are not strong programmers could create learning tools in short + order. This particular app took me all of 45 minutes, and after three days of random + playing of the game (that and khangman) she got up to 38 questions correctly answered + in a minute up from about 25. Not sure if its earth shattering, but its an improvement. + + ccmail: annma@kde.org + +2004-11-28 Sunday 20:14 geiseri + + Test for Config. + +2004-11-28 Sunday 20:13 geiseri + + Splashscreen test. + +2004-11-28 Sunday 20:13 geiseri + + Add bindings to Qt only. + +2004-11-28 Sunday 20:12 geiseri + + Vain attempt to fix the QCanvas bindings. They are no longer crashing, but they are so not implemented they don't do much yet. + +2004-11-28 Sunday 20:12 geiseri + + Attempt at unscrewing up this binding. + It compiles and works slightly more, but it needs a friend seriously. + +2004-11-28 Sunday 20:11 geiseri + + QFrame now actually works as expected. + +2004-11-28 Sunday 20:10 geiseri + + Remove dead code. + Fix stupid corner case where the QPainter would become invalid and crash kjsembed. + +2004-11-28 Sunday 20:09 geiseri + + Compile in Qt Only mode + +2004-11-28 Sunday 20:08 geiseri + + Remove dead code. + Enable working with Qt Only mode. + +2004-11-28 Sunday 20:08 geiseri + + Change this so the Config bindings handle all the dirty work. This + removes a very strange misbehavior with the Config object when + used with scripts. + Started adding support for QSettings in Qt Only mode, but its disabled for now. + +2004-11-28 Sunday 20:07 geiseri + + Change this so the Config bindings handle all the dirty work. This + removes a very strange misbehavior with the Config object when + used with scripts. + +2004-11-28 Sunday 20:06 geiseri + + QSplashScreen works again, the object was there but the bindings where not. + General code cleanup. + Made the factory throw some exceptions instead of just warnings. This will + allow developers to actually be able to debug their scripts with a nondebug + version of KJSEmbed. + +2004-11-28 Sunday 20:03 geiseri + + Clean up old debug messages. + +2004-11-28 Sunday 20:00 geiseri + + Clean up code. + Remove old debug messages. + +2004-11-28 Sunday 19:59 geiseri + + Throw a real exception on a slot error so the script actually knows what the heck went wrong. + Remove some debug messages that no longer make sense. + +2004-11-28 Sunday 19:57 geiseri + + Add bindings to Qt only compile + +2004-11-24 Wednesday 19:49 geiseri + + there is suck and there is this, temporary fix until we can get a better solution. + +2004-11-24 Wednesday 17:00 geiseri + + sync with zack's tree, builds but sucks + +2004-11-24 Wednesday 16:59 geiseri + + sync with zack's tree, isnt building yet + +2004-11-24 Wednesday 16:58 geiseri + + cleanup dead code + +2004-11-24 Wednesday 11:37 geiseri + + Removed the copy operator and clone functions. They are never called, and if they + where they would not function as one would expect. + + Check for void types in the destructor. This should keep anyone from trying + to delete a void *. + +2004-11-24 Wednesday 01:59 staikos + + QT_NO_COMPAT fix (untested, but at least it compiles now): + int match ( const QString & str, int index = 0, int * len = 0, bool indexIsStart = TRUE ) const (obsolete) + int search ( const QString & str, int offset = 0, CaretMode caretMode = CaretAtZero ) const + +2004-11-24 Wednesday 01:36 geiseri + + remove debug information + +2004-11-24 Wednesday 01:28 geiseri + + fixed example + +2004-11-24 Wednesday 01:21 geiseri + + globals is now gone. + +2004-11-24 Wednesday 01:21 geiseri + + toNative fixes + +2004-11-24 Wednesday 01:20 geiseri + + added missing include + +2004-11-24 Wednesday 01:19 geiseri + + symbol visibility can work in KDE land now too. + +2004-11-24 Wednesday 01:02 geiseri + + toNative<> fixes. + +2004-11-24 Wednesday 00:54 geiseri + + More memory management fun: + 1) Removed the any object, it basicly was useless for + managing pointers. + 2) Changed the opaque proxy to handle the pointers + internally. Based heavily on boost::any but focuses on + pointers only. + 3) Things to note now that KJS is actually managing + memory. If you create a QObject binding but do not store + it anywhere and let it go out of scope the GC WILL delete + it. This may cause some unwanted side effects, so + please keep track of your objects. + 4) Fixed some casting problems that was causing the + QCanvas bindings not to work. They have not been completely + solved yet but they are at least not crashing anymore. + + There are still a few crashes, but these should be easier to + track down now that we have more clear ownership roles. + +2004-11-23 Tuesday 18:06 staikos + + warn the users + +2004-11-23 Tuesday 11:51 geiseri + + Clarified the object ownership symantics. This changes the interface a bit so instead of a boolean there is now an enum. Also the create methods in the factory will automaticly give ownership of pointers created by the factory to KJSEmbed. Any external proxies created will be owned by the object that creates it. To change ownership you now use the method JSProxy::setOwner() and JSProxy::owner() to read it. + +2004-11-23 Tuesday 11:44 geiseri + + do not screw up dlls + +2004-11-23 Tuesday 11:44 geiseri + + header cleanup + +2004-11-23 Tuesday 11:43 geiseri + + Share symbol visibility with GCC + +2004-11-22 Monday 01:27 zrusin + + We should have a law preventing Ian/Rich from creating Makefile's ;) + +2004-11-19 Friday 21:16 bmeyer + + Terminal=0 -> Terminal=false + Added missing ; to Categories + +2004-11-08 Monday 10:12 geiseri + + Qt Events now work on windows. + GC works on win32. + NOTE on win32: the standard in/out/err will crash if you do not have + matching Qt debug and KJSEmbed debug libs. So if you have a nondebug + build of Qt NEVER build a debug version of QJSEmbed. Gold star for + MS on this one. + +2004-10-03 Sunday 23:25 zrusin + + fixing build + +2004-09-23 Thursday 15:51 mlaurent + + CVS_SILENT QString(i18n(...)) -> i18n(...) + +2004-09-01 Wednesday 20:47 geiseri + + more include fixes + +2004-09-01 Wednesday 20:43 geiseri + + one more makefile.am fix + +2004-09-01 Wednesday 20:42 geiseri + + i just cant get enough of autohell... + +2004-09-01 Wednesday 20:36 geiseri + + added qtonly project files. + +2004-09-01 Wednesday 20:31 geiseri + + More updates from qtonly version to bring it in sync with KDE version + +2004-09-01 Wednesday 20:11 geiseri + + More updates from qtonly version to bring it in sync with KDE version + +2004-09-01 Wednesday 20:03 geiseri + + move to plain boost::any. need to move the deletion of the pointers to the opaque proxies themselves. + +2004-09-01 Wednesday 19:58 geiseri + + More updates from qtonly version to bring it in sync with KDE version + +2004-09-01 Wednesday 19:52 geiseri + + for some reason vc7 gets confused on casting... + +2004-09-01 Wednesday 19:50 geiseri + + qtonly fixes to the globals methods. + +2004-09-01 Wednesday 19:49 geiseri + + More updates from qtonly version to bring it in sync with KDE version + +2004-09-01 Wednesday 19:00 geiseri + + start merging win32 changes + +2004-09-01 Wednesday 10:32 geiseri + + gc test + +2004-08-25 Wednesday 11:07 geiseri + + Introduced any object to remove the void* in opaque proxy. + Introduced the concept of pointer ownership, this api is not yet stable though. + +2004-08-20 Friday 16:10 geiseri + + doesnt anyone compile this anymore? + +2004-08-16 Monday 19:44 geiseri + + mumble mumble, didnt this compile at one time... + +2004-08-16 Monday 09:28 geiseri + + Qt only changes merged into KJSEmbed. + +2004-08-16 Monday 09:27 geiseri + + Qt only fixes merged back into KJSEmbed. + +2004-08-16 Monday 09:22 geiseri + + more robust exception handling. soon backtraces. + +2004-08-16 Monday 09:22 geiseri + + attempt at custom signatures. + +2004-08-16 Monday 09:13 geiseri + + Added KFileItem bindings for doing directory listviews with KFile. + +2004-08-16 Monday 08:54 geiseri + + Update dcop test. + +2004-08-16 Monday 08:52 geiseri + + moved methods to slots, since when this becomes a nonQt binding the properties will break. + +2004-08-16 Monday 08:51 geiseri + + Added iconset bindings. + +2004-08-16 Monday 08:48 geiseri + + Reorganization of the bindings here to make Qt/KDE separation easier. + +2004-08-16 Monday 08:46 geiseri + + QWidget and QObject extraction helper functions. + +2004-08-16 Monday 08:45 geiseri + + QComboBox and QPopup menu fixes. + +2004-07-14 Wednesday 04:31 binner + + CVS_SILENT + +2004-06-21 Monday 14:58 binner + + CVS_SILENT No punctuation in command line descriptions + +2004-06-21 Monday 06:17 binner + + CVS_SILENT i18n style guide fixes + +2004-06-20 Sunday 18:51 rich + + - Added a missing doc file and the test program for qcanvas. + +2004-06-20 Sunday 18:49 rich + + - Improvements to the bindingwizard. + + - Start of bindings for QCanvasXX. These might need to be disabled for the + 3.3 release but they're a good stress test of the code. + + - Update docs. + + - Added support for QPoint to jsbinding methods. + +2004-06-18 Friday 19:44 rich + + - Added newlines to the documentation to make the html sources more readable. + +2004-06-18 Friday 19:33 rich + + - Update docs + +2004-06-18 Friday 19:27 rich + + - Added support for the QStringList parameter argument of the KParts + constructors. For now, this can only be used with the full 5 argument + forms of the factory's part construction methods. Added the test script + from Koos, though it can't be used without an accompanying applet! + + +2004-06-18 Friday 18:51 rich + + - Updated the qtbindings using the bindwizard. The problems identified in + #83427 and my own QListView testing turned out to be caused by a stupid + logic error in the code generated by the XSL. Basically, I forgot that + enum values start at 0 even if they're being automagically generated. + +2004-06-18 Friday 17:34 rich + + - Reverted the updated QComboBox bindings. Looks like I need to do some + more work on making the XSL binding generator work with the custom + bindings code. + + - Added a test case so I don't break this again. + + +2004-06-12 Saturday 23:03 rich + + - Update docs + +2004-06-12 Saturday 22:53 rich + + - Added support for a couple of new types to the extractXX() methods. + + - Major improvements to the binding wizard. + +2004-06-12 Saturday 20:51 rich + + - Added action for launching ksnapshot. + +2004-06-12 Saturday 20:49 rich + + - Reverted update of the QListViewItem bindings as it broke things. + +2004-06-11 Friday 20:52 rich + + - Handling for slots with signatures xx( const QTime &) and xx( QWidget *). + + +2004-06-11 Friday 19:03 rich + + - Added a way for non-konq users to view the changelog. + +2004-06-11 Friday 18:45 rich + + - Disable compilation of the embedding example. This example wasn't + written to support compilation with the library (something which + needs addressing). Bug #83020, Bug #82991. + + - Added the missing kjs.pro for the qt-only build. + + +2004-06-06 Sunday 20:58 rich + + - Fixes to make qt-only mode work with the latest changes. + +2004-06-06 Sunday 20:42 rich + + - Forgot to add the implementation. + +2004-06-06 Sunday 20:40 rich + + - Added support for QCheckListItem. + + - Regenerated qtbindings using the wizard. + +2004-06-06 Sunday 19:37 rich + + - Added support for signals and slots with signature func(const QTime &) + including support for handling them from scripts. + + - Added a check for exceptions occurring in event handlers. + + +2004-06-06 Sunday 19:03 rich + + - Added a few missing files. + +2004-06-06 Sunday 19:00 rich + + - Updated documentation. + +2004-06-06 Sunday 18:44 rich + + - Added a binding for the Qt namespace class. This gives scripts access to + important constants such as the alignment flags. + + - Added an accessor for the KPropertiesDialog of a URL to NetAccess. + + - Minor fix to the binding wizard to support classes that provide no methods. + + - Added partially complete cropping tool to imunge, along with support for + showing the file's properties dialog. + +2004-06-06 Sunday 18:10 rich + + CVS_SILENT fix ignores + +2004-06-05 Saturday 22:07 rich + + - JSObjectProxy now reuses the same JSObjectEventProxy no matter how many + event handlers there are. + +2004-06-04 Friday 22:06 rich + + - Added an example script that provides a documentation browser for the + qt-only build. + +2004-06-04 Friday 21:31 rich + + - Added a script that makes building the qt-only kjsembed easy. All you + need to do is ./setup_qtonly in a clean checkout of kjsembed. + + - Fixed some minor issues with types that only showed up because the + qt-only tree uses an unusual set of header files. (it's nice that this + development has the side effect of making some rare bugs visible). + + - Added a minimal command line for the qt-only build. You can see that + things are working by running tests/test_stdio.js. Note that this test + script is one of the kde build scripts which shows how easy it should + be to migrate between the two. + +2004-06-04 Friday 18:52 geiseri + + Resolve conflicts. + +2004-05-28 Friday 22:10 rich + + - Updated js reference documentation. + +2004-05-28 Friday 22:06 rich + + - Removing docs. + +2004-05-28 Friday 21:08 rich + + - Improved the documentation generation. + +2004-05-28 Friday 19:55 rich + + - Ensure we always use our debug area in our kdDebug() calls. + +2004-05-28 Friday 19:51 rich + + - JS exceptions that occur when a js function has been invoked by a signal + are now reported and cleaned up properly. + +2004-05-28 Friday 19:15 rich + + - Fixed the problem of the time property of a QTimeEdit returning -1. This + in fact turned out to be a general problem that affects all QTime + properties and was happening because you can't create a Date object in js + with just a time in it. + + +2004-05-27 Thursday 21:05 rich + + - Added the missing mirror() method to the image binding. + + - Added missing icons to imunge. + +2004-05-27 Thursday 17:41 rich + + - Added support for passing opaque types as arguments to slots. This is a big + win and turned out to be pretty simple once I tracked down a logic error + that caused any subsequent args to be ignored. This would all be perfect + except for the minor flaw that it doesn't work. + + - Improvements to imunge. + - Made it work again after I broke it. + - Added support for a bunch more effects. + - Shows the filename in the status bar. + + - Added an accessor to the KConfig wrapper that lets you obtain an opaque + pointer to the KConfig object. + + - Updated class docs + +2004-05-20 Thursday 20:24 rich + + - Improved the Imunge example code by splitting the image effect handling into + a standalone file. In addition, I added support to the GUI for several + additional effects and added a toolbar that makes it easy to invoke them. + +2004-05-19 Wednesday 21:24 geiseri + + Added the ability to query if a function is available. + +2004-05-19 Wednesday 21:17 rich + + - Added support for the selectedItem() method of QListView then converted the + docviewer example to use QListView. + +2004-05-19 Wednesday 20:10 rich + + - Modified the imunge demo to avoid hard-coding the path to the ui.rc file I + use here. + +2004-05-19 Wednesday 20:08 rich + + - Added support for creating system tray icons from scripts using + KSystemTray, and an example that shows how this can be used. + +2004-05-19 Wednesday 18:54 rich + + - Fixed a couple of naming errors in QProcess's signals that resulted from + the conversion from KProcess. + +2004-05-19 Wednesday 18:31 rich + + - Missed this in the last commit. + +2004-05-19 Wednesday 18:29 rich + + - Added a new directory for the Qt bindings. This means that these bindings + can now be made available for the qtonly version of kjsembed. This also + greatly simplifies the structure of the code (basically it's what I should + have done initially). + +2004-05-19 Wednesday 18:02 rich + + Added something for testing + +2004-05-19 Wednesday 16:55 rich + + - Added the first bit of an image manipulation app for kde (using + KImageEffect). The app is implemented in javascript. + +2004-05-17 Monday 14:52 geiseri + + added the java test applet + +2004-05-17 Monday 14:52 geiseri + + I added a test for the args stuff. Is this correct code? + + +2004-05-13 Thursday 12:36 geiseri + + Test for slots that use pixmaps + +2004-05-13 Thursday 12:35 geiseri + + Qt wants the real thing, not cheap immitations. + + Fixed QPixmaps in slots. + +2004-05-07 Friday 17:13 geiseri + + Added tests to the make file. + +2004-05-07 Friday 17:10 geiseri + + Added the C++ based tests used to develop the new part code for manipulating the script engine. + + These need to be refactored, but I hate CPPUnit too much to use that here. + +2004-05-05 Wednesday 23:51 geiseri + + Const cleanups + Fixed accidental memory leak + Added the following methods to make access of QVariant based objects + easier: + void putVariant( const QString &valueName, const QVariant &value); + QVariant getVariant( const QString &valueName ) const; + + Started an implementation of a scope walker so the added methods + will work beyond the global scope. Not reliable yet, so its not used. + +2004-05-05 Wednesday 22:26 geiseri + + Added the following functions to the part for embedders to enjoy: + KJS::Value getValue( const QString &valueName ); + KJS::Value callMethod(const QString &methodName, KJS::List &args); + void putValue( const QString &valueName, const KJS::Value &value); + + Rich I have tests, but they require being compiled. We need a C++ tests + directory at this point i think to show off what we are up to. + +2004-05-04 Tuesday 19:52 rich + + - Update class reference + +2004-05-04 Tuesday 19:50 rich + + - Improved the argument handling of kjscmd so that it will automatically + invoke the console if there is no script to run. It will also call exec + implicitly in this situation, though not if there is a script to invoke + so the exec() call in the graphical scripts is still required. + + - Added a directory for a standard library of javascript utilities and put + the command line prompt script in it - other reusable scripts and objects + will follow. Scripts installed in this location will be found automatically + by the include(...) method. + + - Added an option to kjscmd to tell it to invoke the cmdprompt script from + the standard library. + + - Updated the man page to reflect these changes. + +2004-05-03 Monday 21:21 rich + + - Added support for a few KHTMLPart method to the custom bindings. + + - Added a simple example of embedding the engine. This will be used + by the embedding tutorial i'm working on. The example is based on + the KDevelop template for a non-parts KDE app and embeds the + interpreter. It then offers an action to show the js console, and + a word count action that is implemented in js. + +2004-04-30 Friday 20:53 rich + + - Improved binding wizard. + +2004-04-30 Friday 20:27 rich + + - Extended the range of types supported by the XSL stylesheet to allow QFile + and QFrame to be wrapped. Added the generated wrappers to the build. + +2004-04-30 Friday 19:36 rich + + - Integrated the constructor bindings into the binding wizard and added a hack + that only enables the first method we see with a given name, meaning that + only the first version of overloaded methods can be used. This change means + that the QComboBox binding is now generated directly from the Qt header file + using the wizard. + +2004-04-30 Friday 17:38 rich + + - Started rolling the code for instantiating bound objects into the wizard. + I accidentally deleted the stylesheet it uses to index the classes, so i'm + adding that to the repository now too so I don't have to write it a third + time. + +2004-04-29 Thursday 21:11 rich + + - Improved the command line tool. + +2004-04-29 Thursday 20:37 rich + + - Further steps towards a GUI for binding generation. The wizard pages are now + split up into functions and it uses an LED to provide feedback when it's + running doxygen. There's still a way to go, but this is slowly approaching + release quality. + +2004-04-29 Thursday 20:34 rich + + - Update class reference + +2004-04-29 Thursday 20:33 rich + + - Update class reference. + +2004-04-29 Thursday 18:57 rich + + - More updates to the binding generation wizard. + + - Added support for the flush method to textstreams. + + - Added a script that provides an interactive command line prompt. + +2004-04-23 Friday 22:19 rich + + Added the start of a wizard that will make creating bindings for a set of + C++ classes a point-and-click process. + +2004-04-23 Friday 18:47 geiseri + + Added event support for: + QEvent::QTimer + QEvent::ContextMenu + QEvent::DragMove + QEvent::DragEnter + QEvent::Drop + QEvent::Enter + QEvent::Leave + QEvent::Clipboard + QEvent::DragLeave + Based all events off the default handler so interited + properties are preserved. + +2004-04-23 Friday 15:57 geiseri + + move to QProcess. + +2004-04-23 Friday 15:20 rich + + Update to qt-only support + +2004-04-23 Friday 10:57 geiseri + + added some of my things i want to see. + +2004-04-22 Thursday 20:33 rich + + Update changelog. + + Allow C++ doc pages to link to each other in the docviewer. + +2004-04-22 Thursday 20:27 rich + + Improvements to the docviewer. + +2004-04-22 Thursday 20:17 geiseri + + remove printfs + +2004-04-22 Thursday 20:01 geiseri + + since im trapped in the basement here, i figured id fix + the appname patch rich commited. Rich friends dont + let friends use C string crap ;) + +2004-04-22 Thursday 18:27 rich + + Changed the behaviour of kjscmd so that it uses the name of the script as + the name of the instance it uses. This means that scripts can now have their + own config files etc. + +2004-04-22 Thursday 17:33 geiseri + + Added extractQPalette + Added extractQStrList + +2004-04-22 Thursday 16:57 rich + + Added support for Ian's new string munging functions to the XSL binding + generator. + +2004-04-22 Thursday 15:07 geiseri + + Normalized the size and color extraction. + Added QRect helper function. + +2004-04-22 Thursday 15:03 geiseri + + Normalize extraction helper function so its easier to use with + the bindings generator. + +2004-04-22 Thursday 12:59 geiseri + + remove noise... + +2004-04-22 Thursday 12:58 geiseri + + Found out javascripts month index starts at 0. + Fixed validation test, and code + Added ability to handle date, datetime, and time in slots + Added ability to call slots that use datetime, date, and time. + +2004-04-22 Thursday 10:01 geiseri + + added test for dealing with time in slots + +2004-04-22 Thursday 09:17 geiseri + + Rich I really dont like this one bit. + Added a few more slot signatures. + Way more effort than its worth, we need to rethink how this all ties + together. + +2004-04-21 Wednesday 23:10 geiseri + + There is a moral here... untested code is buggy code. + +2004-04-21 Wednesday 22:17 geiseri + + Added transparent mapping between Javascript dates and Qt's dates + +2004-04-21 Wednesday 16:09 geiseri + + forgot to add the one i really wanted to. Now we can map a string array to a QVariant properly. + +2004-04-21 Wednesday 15:48 geiseri + + Added the ability to convert from JS Arrays to stringlists. Rich to use this + code follow what i did in qcombobox_imp.cpp. Its a oneliner and Hari says + its the most maintainable way to do it... Learned more about KJS than I ever + did today. Hari I owe you a beer, or 3, and john, you owe me your first born. + +2004-04-19 Monday 11:53 geiseri + + fixed QBoxLayouts. might want to backport + +2004-04-16 Friday 21:51 rich + + We can now build kjsembed without needing KDE! There is tidying up needed, + but it builds ok. + +2004-04-16 Friday 19:47 rich + + More work on making a qt only build possible. This build mode doesn't work + yet, but the standard mode is unaffected by the changes. + + Tidied up the header file inclusion in various places which makes life simpler + and should also speed up compilation. + +2004-04-15 Thursday 20:19 rich + + More work towards a qt-only build + +2004-04-15 Thursday 18:53 rich + + Began adding support for Qt-only builds. + Explained to Ian's copyrights that the year is now 2004. + +2004-04-13 Tuesday 12:08 geiseri + + Added DCOPClient::isApplicationRegistered(...) + Added validation test for it. + +2004-04-13 Tuesday 11:10 geiseri + + Test for clobbering return values of dcoprefs call. + The fixed dcopref code... yay validation tests... + +2004-04-12 Monday 17:48 geiseri + + DCOPRefs now work correctly as return values from javascript + dcop interfaces. + +2004-04-12 Monday 16:53 geiseri + + Added testcase for pixmaps. + Fixed no object type returned bug. + + Dcop interfaces now work for more cases. + +2004-04-12 Monday 16:28 geiseri + + test case to show off problems calling void functions in dcop interfaces. + +2004-04-12 Monday 13:08 geiseri + + Fixed an issue with dcop interfaces where only the first + argument was being read. + +2004-04-12 Monday 10:11 geiseri + + Added ktempfile support. + +2004-04-12 Monday 10:11 geiseri + + Added ability to invert pixels on the painter. + +2004-04-12 Monday 10:10 geiseri + + More spacing and formatting fixes... soon my cvs will be in sync. + +2004-04-12 Monday 10:09 geiseri + + Added support for the command shell(...). + Added ksimple process ( a blocking shell process that returns the output) + I dont like where this is going, but ideally in cvs we can work this out. + The goal is to get a function that allows us to do the following: + var response = shell( 'ps -aux' ); + prinln( response ); + So we can run simple shell commands and get a response back. + Suggestions welcome. + +2004-04-12 Monday 10:05 geiseri + + Formatting and spacing. + +2004-04-12 Monday 10:03 geiseri + + Formatting and spacing cleanups. + +2004-04-12 Monday 10:02 geiseri + + Added support for dcopstart (like the shell command line version). + Added tests for dcopreferences. + +2004-04-12 Monday 10:00 geiseri + + Added support for QProcess as a bindings plugin. + Exposed API identical to QProcess. + +2004-04-10 Saturday 20:40 rich + + Added support for the setSpacing method of QHBox. + + Converted the docviewer example to use the KHTML streaming API and made it + work properly. + +2004-04-10 Saturday 17:24 rich + + Fix link to livedata example. + +2004-04-09 Friday 21:26 rich + + Added support for streaming data to a KPart, and an example of doing so. This + means you no longer need to have a temporary file to display stuff in khtml. + +2004-04-09 Friday 20:22 rich + + Added an example of how to embed several parts in one scripts GUI. + +2004-04-09 Friday 19:34 rich + + Added some methods that should allow us to have a unified interface to the + proxy types in future. This change is the first step towards an understanding + of inheritence. The first win of the change is that the code now understands + that KXMLGUIClient's are not necessarily QWidgets. + +2004-04-09 Friday 17:52 rich + + Added proper support for QComboBox. This binding was generated automagically + using the xsl stuff in the tools dir, but I had to disable 4 methods to work + around missing support for method overloading. There's also an example. + +2004-04-09 Friday 16:39 rich + + Added support for loading read-write parts, and an example showing how it's + done. + +2004-04-09 Friday 15:32 rich + + - Made it so the man page gets installed. + + - Fixed some unused variable warnings. + +2004-04-08 Thursday 09:52 geiseri + + Oh this is an annoying one. For some reason I thought I could trust + QVariants to tell me what type they where. It seems that in the + instance of QString vs QCString this is not the case, so I am now + doing this correctly and using the dcop functions type signature to + get the correct types. This fixes a few courious bugs I was chasing + after in dcop. I am trying to backport this fix now. + +2004-04-07 Wednesday 19:38 rich + + Fix missing exec call found by David Joham. + +2004-04-04 Sunday 19:33 rich + + Added a man page for kjscmd + +2004-03-25 Thursday 19:48 geiseri + + Added the ability to expose child widgets as properties of a loaded UI file. + This will allow one to import a UI file and then transparently address + each of the UI elements via their name as given in the UI file. + +2004-03-25 Thursday 19:16 geiseri + + this moved a few days ago. + +2004-03-25 Thursday 19:12 rich + + Added an accessor to let the imp specify its factory. + +2004-03-23 Tuesday 10:06 geiseri + + Moved the mimetype for javascripts to the kdelibs mimetypes. + Removed useless feilds per davids advice. + Matches the freedesktop.org format. + + +2004-03-22 Monday 20:29 geiseri + + hack to make javascripts open here with kdevelop. + +2004-03-17 Wednesday 11:48 faure + + Lazy loading - don't slow down the loading of every KHTMLPart in Konqueror. + OKayed by Rich. + +2004-03-05 Friday 16:29 jowenn + + wrong warning + +2004-03-04 Thursday 17:52 jowenn + + don't crash on slots having uint parameters. I could put it into a function, but I don't like my hack at all. I would appreciate, if somebody comes up with a better solution. + + +2004-02-29 Sunday 12:54 jowenn + + support for plugin based decorating of qobject derived return values from slots. If somebody has a problem with that, please let me know, I'll fork the code than, since i need it for kate scripting. the jsproxy behaves really bad for slots with default values and overloaded methods. From what I see they should get numbered, but they aren't + + +2004-02-29 Sunday 05:35 jowenn + + It's not nice, for each proxy implementation one QGuardedPtr. :( I hope Qt's next generation smart pointer will be more lightweight. Why a qguardedptr? + + If you do the following in kjscmd it would crash without guardedptr + var k=new KMainWindow(); + k.show(); + var k1=new KMainWindow(); + k1.show8); + ---> close k1 with the mouse + k1.hide(); or k1.show(); + ====> Crash + +2004-02-16 Monday 02:42 geiseri + + Small code consolidation. No real functional changes, just cleaner code. + +2004-02-16 Monday 01:28 geiseri + + Added missing Brush type conversion. + +2004-02-16 Monday 01:09 geiseri + + Added signatures for: + void slot_color( const QColor &color ); + void slot_point( const QPoint &point ); + void slot_rect( const QRect &rec ); + void slot_size( const QSize &size ); + void slot_pixmap( const QPixmap &pix ); + void slot_url( const KURL &url ); + void slot_intint( int , int ); + void slot_intbool( int , bool ); + void slot_intintint( int , int , int ); + + This should cover almost every signal that we can handle with + native types in KJSEmbed. Thanks Adam Treat from the C# stuff + for the hints... now to streamline this junk. + +2004-02-12 Thursday 14:51 geiseri + + Added an example of how RSSService can be interacted with + using DCOPRefs and dcop signals. + +2004-02-12 Thursday 14:51 geiseri + + Fixed an issue where dcoprefs would not be marshalled + properly. + +2004-02-11 Wednesday 19:02 rich + + Fixed a problem with non-mainwindow xmlgui clients not getting the + actionCollection() method. + +2004-02-11 Wednesday 17:19 rich + + Backport: Better fix for the crash when there is no actioncollection. + +2004-02-11 Wednesday 17:15 rich + + Better fix for the crash when there is no actioncollection. + +2004-02-11 Wednesday 17:12 rich + + Fix a crash when there is no actioncollection. + +2004-02-11 Wednesday 14:33 staikos + + backport crash fix + +2004-02-11 Wednesday 10:18 staikos + + don't krash + +2004-02-09 Monday 13:41 rich + + Disable the KJS embed console plugin. + +2004-02-01 Sunday 19:45 geiseri + + helps if you can actually create the little buggers too. + +2004-02-01 Sunday 19:44 geiseri + + added support for dcoprefs. the test assumes that your + running the dcoprss service though. to run the dcop test + $rssservice + $kjscmd dcop.js + +2004-01-20 Tuesday 19:49 staikos + + No you really can't, Ian. :-) This fixes KJSEmbed from crashing all over the + place and I consider it a KJSEmbed showstopper pending review by Rich. Without + this patch I can't run space invaders. + + +2004-01-20 Tuesday 19:48 staikos + + For some reason [perhaps old admin/? don't think so...] at least one of my + machines insists on generating moc for these even though it's commented out. + +2004-01-15 Thursday 01:35 geiseri + + oh how i hate to merge xml files... + +2004-01-14 Wednesday 14:51 zander + + Fix some bad layed-out button -- GUI problems + +2004-01-11 Sunday 08:41 geiseri + + forgot to commit the image test. + +2004-01-11 Sunday 02:08 geiseri + + use imagefx plugin. + +2004-01-11 Sunday 02:08 geiseri + + reflect the changes to use include. + +2004-01-11 Sunday 02:06 geiseri + + import was taken so include seems to work better for loading script libraries into kjsembed. + +2004-01-11 Sunday 01:27 geiseri + + updat to ImageFX + +2004-01-10 Saturday 21:35 rich + + - A first cut at specifying the public classes and generating their + documentation. Internal documentation (for people working on the code can be + created with doxygen Doxyfile-Internal). + +2004-01-10 Saturday 20:38 rich + + - Added a hook for future bc virtuals. + +2004-01-10 Saturday 20:12 rich + + - Fixed buffer overrun in argument handling. + + - Updated docs. + +2004-01-10 Saturday 20:10 geiseri + + Use new image effects code. + Works like a charm ;) + +2004-01-10 Saturday 20:04 geiseri + + This is the ImageFX plugin. It provides a wrapper arround KImageEffect and can be dynamicly + loaded at runtime. + + To activate: + var imgfx = new ImageFX(); + + To use: + var img = imgfx.blend(color, img, 0.25); + + All methods mirror their KImageEffects counterparts in function signatures. + +2004-01-10 Saturday 20:00 geiseri + + Step 2. Remove Image effects from the Image Bindings + +2004-01-10 Saturday 19:48 rich + + - Added the unlisted demos to the index page. + +2004-01-10 Saturday 19:45 geiseri + + Step 1 in conversion of ImageEffects to a plugin. + +2004-01-10 Saturday 19:25 rich + + - Fixed support for QChildEvent. It now has a type specific conversion + function rather than falling back to the generic one. Without this change, + it is pretty useless as you can't access anything or even distinguish + between insert and remove events. + + The new code splits the childEvent() handler into two methods + childInsertEvent() and childRemoveEvent(). The code is disabled for now + behind the ENABLE_CHILDEVENTS define because there seem to be some problems + with reentrancy. This problem occurs if the callback is invoked because + kjsembed created an object. + + - Added my coverage checking scripts to the tools directory. These aren't + exactly the best, but they give an idea of which classes need adding. + + - Removed hard-coded list length from the event type <-> handler name map. + + - Commented out some unused args. + + - Updated TODO list. + +2004-01-10 Saturday 14:33 rich + + - Add exception example + +2004-01-10 Saturday 14:23 rich + + - Throw an exception when we fail to create a plugin too. + +2004-01-10 Saturday 14:11 geiseri + + change the enums to work as they do, not as we hoped ;) + +2004-01-10 Saturday 14:09 geiseri + + update the test + +2004-01-10 Saturday 01:50 geiseri + + buttonmaker cleanup and moved to kjsuic + +2004-01-10 Saturday 01:45 geiseri + + more changes to handle containers properly + +2004-01-10 Saturday 00:28 geiseri + + some docs, and a minor cleanup to make it even cooler + +2004-01-10 Saturday 00:19 geiseri + + This is a really simple class that simplifies dealing with UI files. + It basicly wraps the loadUI function and autocreates an object for the + main form, and presents the objects as properties. + +2004-01-07 Wednesday 11:46 geiseri + + EnvelopeMaker example for KJSEmbed: + This example will create postscript files for #10 Envelopes from a simple form. + It will generate compliant postnet barcodes. Im not sure if this works outside + of the united states, but it works here. It also is a nice example of how KJSEmbed + can be used to build simple one off apps for your company. + +2004-01-02 Friday 23:27 geiseri + + more exploration of how this works + +2004-01-02 Friday 16:34 aseigo + + exec the application so something actually happens + +2004-01-02 Friday 16:31 geiseri + + added some examples to test bumpmap code. + +2004-01-02 Friday 16:31 geiseri + + fixed some minor issues with the bump map stuff + +2004-01-02 Friday 16:30 geiseri + + Added abillity to set image mask correctly now. + +2004-01-02 Friday 01:41 zrusin + + This is a huge present for geiseri. Fixing the biggest problem he had + with his buttonmaker demo. + +2004-01-01 Thursday 02:23 geiseri + + Removed the extra JSProxy argument from the convertToValue() function. + All types should now be a ValueProxy, or a OpaqueProxy. + +2003-12-31 Wednesday 11:54 geiseri + + use new QPixmap code + +2003-12-31 Wednesday 11:12 geiseri + + updated todo list + +2003-12-31 Wednesday 11:11 geiseri + + missing include + +2003-12-31 Wednesday 11:10 geiseri + + Moved Pen -> ValueProxy + Moved Painter -> OpaqueProxy + Moved Pixmap -> ValueProxy + + Fixed Pen and Pixmap handleing in the bindings + Simplified Pixmap and Pen hadeling more + + Updated button maker to use new pillbox code + +2003-12-30 Tuesday 14:23 geiseri + + move buttonmaker.js to new QPainter stuff + +2003-12-30 Tuesday 14:17 geiseri + + more for the pillbox test, we can paint directly on widgets now + +2003-12-30 Tuesday 13:37 geiseri + + desktop file + +2003-12-30 Tuesday 13:37 geiseri + + + Added test for pillbox generation + package script to make ButtonMaker installed as a real app. + +2003-12-30 Tuesday 13:24 geiseri + + compile the correct file. + +2003-12-30 Tuesday 11:41 geiseri + + compile the listview bindings... + +2003-12-30 Tuesday 11:07 rich + + - Oops + +2003-12-30 Tuesday 10:56 geiseri + + moved arg extraction code to slotutils + converted QPainter bindings to Opaque Proxy... it has issues still, but pending + QPixmaps conversion they cannot all be fixed yet. + added arg extraction methods to simplify the code + +2003-12-29 Monday 16:08 rich + + - Added a test program for the qlistview. + +2003-12-29 Monday 16:08 rich + + - Added the binding for QListViewItem and the latest xsl templates. + +2003-12-28 Sunday 21:22 rich + + - Massive improvements to the binding generation tool. It can now create + usable code!!! To prove this, I've added a new binding to the builtins + directory for QDir. This binding was generated directly from the qdir.h + header file using the scripts in the tools directory. There is a simple test + program in the test directory. + +2003-12-28 Sunday 17:56 rich + + - More work on the bindings generator. + +2003-12-28 Sunday 15:55 rich + + - More work towards automating the bindings process. It's getting there! + +2003-12-28 Sunday 08:49 larkang + + CVS_SILENT ignore + +2003-12-28 Sunday 08:43 larkang + + Some srcdir!=builddir fixes + + Ok'd by Richard Dale + +2003-12-22 Monday 10:11 wildfox + + Fix invalid kjscmd sources, use /usr/bin/env kjscmd everywhere and chmod +x the right .js files + +2003-12-22 Monday 07:57 cartman + + CVS_SILENT Add a GenericName. Use konsole icon as the app already uses it in title. + +2003-12-21 Sunday 19:05 geiseri + + Changes to the plugins to autoregister... more later once i get a real network connection. + +2003-12-20 Saturday 22:42 zrusin + + Fixing makefiles and a path. The makefile's in kjsembed need cleaning up, Coolo? :) + +2003-12-20 Saturday 21:40 rich + + - Added a gray button template + +2003-12-20 Saturday 21:08 rich + + - Added buttonmaker to the index page of the demos. + +2003-12-20 Saturday 20:48 rich + + - Fix warning caused by attempting to overwrite the x and y properties of the + widget. + +2003-12-20 Saturday 20:43 rich + + - Added support for command line args to the button maker. It will now read + the first argument and use that as the text. I also improved the defaults + including making it attempt to load the default button image on startup. + +2003-12-20 Saturday 19:57 rich + + - Added keyboard shortcuts to buttonmaker + +2003-12-18 Thursday 17:19 geiseri + + start of docs for this class, since an example will be in order. + +2003-12-18 Thursday 17:15 geiseri + + Added support for adding bindings via KParts Plugins. + I have tested ValueProxy and OpaqueProxy plugins and those work perfectly. + QObject based plugins are mostly working, but enums seem broken. + + The plugin interface is pretty thin right now, because I dont think we need + a heck of alot to bootstrap the process of adding a binding. + + This is a start, I feel we need to ship 3.2 with this since we need a way to + add bindings later without rebuilding kjsembed. This also allows us to get + arround messy instances where we may or may not want to have custom + bindings to interfaces that are in KDE but may not make sense to be built + into KJSEmbed. + + This api is subject to change as we kick it arround and clean it up, but so far + it seems to work for my tests. + +2003-12-18 Thursday 14:00 geiseri + + more clear idea of what happend when calling this slot. + +2003-12-18 Thursday 13:58 geiseri + + Brush bindings to make the painter more fun. + +2003-12-18 Thursday 02:23 geiseri + + maby even save the file too... + +2003-12-18 Thursday 02:14 geiseri + + used the text box stuff to center the image. + +2003-12-18 Thursday 02:02 geiseri + + a nice button for testing. + +2003-12-18 Thursday 01:49 geiseri + + This might not be the right place for it, but we need a good way to get + the bounding boxes of text drawn on the painter with the current font + metrics. Ideally we can move this later when we bind QFontMetrics? + +2003-12-17 Wednesday 23:37 geiseri + + Added a neat demo applet to show off KJSEmbed. Its only a start, but a + very good example of how KJSEmbed can do pretty powerful things in less + than 100 Lines of code. + +2003-12-17 Wednesday 18:50 geiseri + + painter fixes to change the font. + +2003-12-17 Wednesday 18:12 geiseri + + group single arg members together + +2003-12-17 Wednesday 18:10 geiseri + + Added ability to connect Qt signals to KJS Slots that have a single QFont or QColor. + Not as cool as I would have liked, but I guess its okay. + +2003-12-16 Tuesday 18:21 geiseri + + cleaned up the Image headers + +2003-12-16 Tuesday 18:21 geiseri + + Moved DCOPClient code into a OpaqueProxy class. This put it all + into one place. The big issue now is that until Pixmap is moved + to a ValueProxy it will crash KJSEmbed when you pass pixmaps + over DCOP. + +2003-12-16 Tuesday 18:17 geiseri + + fixed test to reflect the real DCOP api + +2003-12-16 Tuesday 14:11 rich + + - Fix imagegallery script for exceptions. + +2003-12-16 Tuesday 14:01 rich + + - Fixed for new names of System. + +2003-12-16 Tuesday 12:51 geiseri + + properties -> methods + +2003-12-16 Tuesday 12:32 geiseri + + move properties -> methods + +2003-12-16 Tuesday 12:29 geiseri + + make sure tables can stay in sync + +2003-12-16 Tuesday 12:23 geiseri + + comment out unused functions for now + +2003-12-16 Tuesday 12:05 rich + + - Fix image code. + +2003-12-16 Tuesday 11:42 geiseri + + Start of move from opaque proxy to valueproxy + Cleanup in Image to make it easier to follow. + +2003-12-15 Monday 19:40 rich + + - Removed moc reference from ImageImp - it's not a QObject anymore. + + - Fixed a crash when the factory is asked for an invalid part. + +2003-12-15 Monday 18:35 rich + + - Improved the code of the image binding: + + - Changed the name from Image to ImageImp as now that it doesn't use + QObject, this class only handles the methods. + + - Added support for the enums from KImageEffect. The output of the test + program should now be upside down. + + - Added a second parameter to the save() method that specifies the format to + save in. + + - Made all the constants defined in enums read-only. This means scripts can no + longer corrupt the API (at least in this fashion). + +2003-12-15 Monday 17:06 rich + + - Fixed the new image binding support so it works for the test program I've + added. I expect there is more work to be done to make this work nicely with + the property support, but you can load, transform and save files again. + +2003-12-14 Sunday 12:36 geiseri + + Fixed the Image stuff so it will at least load. + + Came to the conclusion that there is all wrong, and we should revert + back to the QObject bindings. The current implimentation makes + no sense for how the Image binding is suppose to operate. + + Maby we really wanted a JSValueProxy? + + Rich please review this and let me know your thoughts. + +2003-12-14 Sunday 11:02 geiseri + + Attempt at activating the Image bindings. + +2003-12-14 Sunday 10:45 rich + + - const fix for gcc 3.3. + +2003-12-14 Sunday 10:39 rich + + - Minor fixups. + +2003-12-14 Sunday 10:23 rich + + - Add pen bindings + +2003-12-14 Sunday 10:08 rich + + - Started adding the framework needed to allow custom value types to become + first class citizens. + + - Replaced the NewQObject method of the factory with NewInstance which + supports the creation of instances of any type. + + - Added support for event types to the opaque proxy. + +2003-12-12 Friday 23:58 geiseri + + removed old kdDebug statements and moved the ones that made + sense to kdWarning. + +2003-12-12 Friday 23:56 geiseri + + half of the move from QObject binding to JSProxyImp + rich this needs to be enabled, i was unsure of how to activate + it. + + also am i correct in assuming that properties will no longer work for + Image now that we are using a non QObject binding? + +2003-12-12 Friday 17:10 rich + + - Moved the registration of the global objects so it is handled inside the + JSBuiltins class rather than the part. + +2003-12-12 Friday 17:03 rich + + - oops 2 + +2003-12-12 Friday 17:02 rich + + - oops + +2003-12-12 Friday 16:49 geiseri + + example to show failure in enums on slots + +2003-12-12 Friday 16:48 geiseri + + more fixes for enum values. + +2003-12-12 Friday 15:18 rich + + - Replaced the QObject wrapper for QTextStream with a native binding + class. This reduces the overhead of this binding, and allows more + flexibility in the API we present to scripts. The new binding provides the + same API to scripts as the old one, except that the current() and + setCurrent() methods have been removed as they are redundant. + + This binding is the first one to be based on the JSOpaqueProxy class, but + this will in future be a common approach to wrapping non-QObject classes. + + - Made a few methods of the factory that were previously protected have + private access. These methods are only useful internally, so there is no + reason to make them visible to users. + + - Renamed System.in -> System.stdin to avoid nameclash with the in operator + and made corresponding changes to the other stdio streams. + +2003-12-10 Wednesday 21:05 rich + + - Major rewrite of the documentation generator script. The new version is a + lot cleaner and uses JS exceptions to handle problems rather than having + a hard-coded list of trouble-some classes. This change also makes a single + function responsible for the page template. The docs have also gained a + bunch of new index pages. + +2003-12-09 Tuesday 20:42 geiseri + + example for message boxes. + +2003-12-09 Tuesday 20:40 geiseri + + Added support for: + alert(textMessage); + confirm(textMessage); + promp(textMessage, [inputDefault]); + i18n(text); + + Added examples of the message boxes. + + i18n sorta works but may get removed if i cannot get it to work reliably. + +2003-12-08 Monday 18:22 rich + + - Fix for gcc 2.95. + +2003-12-08 Monday 17:53 rich + + - Don't use -no-undefined as this now requires libkjsembed. + +2003-12-08 Monday 17:16 rich + + - Fix for --noexec -> --exec change. + +2003-12-07 Sunday 21:00 geiseri + + Added a neat demo to show off event handling, and how generally awesome + kjsembed is. + + Classic Space Invaders: + Keys: + <- go left + -> go right + <space> fire + Mouse: + click mouse to fire. + + Have fun. + +2003-12-07 Sunday 20:59 geiseri + + Fixed some small confusion on the event mapper. + +2003-12-07 Sunday 13:19 geiseri + + We can now grab windows. Not sure how you get the winID yet though. + +2003-12-06 Saturday 21:21 geiseri + + Reflect namechange from Dcop -> DCOPClient. + +2003-12-06 Saturday 20:59 geiseri + + Added ability to connect dcop signals to kjs dcop slots. + Added example to show this off. + Removed a few compiler warnings. + +2003-12-05 Friday 18:13 geiseri + + reflect a name change in the dcop client object. + +2003-12-05 Friday 18:12 geiseri + + The ability to export a JS Method to a dcop interface now works. + use DCOPInterface.publish("returnType signaure(ArgType)"); + as the format for publishing an interface. The rest is transparent + to the user. + +2003-12-05 Friday 15:19 rich + + - Add a d pointer. + +2003-12-04 Thursday 20:54 rich + + - Moved call to custombindings to a standalone method that encapsulates the + qobject handling. + + - Added warnings for unsupported methods that are defined in the + custombindings enum. + + - Fix warning in resources.cpp. + +2003-12-04 Thursday 18:35 rich + + - Changed the inline version methods to non-inline. This means that the + concept behind these methods might actually work! + +2003-12-04 Thursday 18:33 rich + + - Update js class reference. + +2003-12-03 Wednesday 20:57 rich + + - Fixed a whole bunch of examples to call application.exec() themselves now + that kjscmd no longer does this automatically. + + - Moved call that adds custom object bindings into the factory. + + - Changed the default context Object for the parts execute methods to be the + global object of the interpreter, and changed the default global object to + be the one defined in libkjs. + + - Added a new optinal argument to the runFile() method of the part (and the + load() method it is bound to) that allows you to specify the context object + for the executed script. + + - Removed the virtual for the overloaded version of the part's execute() + method. + + - Made the part add its own binding to the interpreter instead of getting + kjscmd to do it, this means that the methods will be available when the code + is embedded in apps as well as standalone. + + - Simplified the API for publishing objects. + + - Changed the publish() method to use the Object prototype. + - Simplified the addObject() method by using the factory properly. + - Renamed the publish() method to addObject() making the API + self-consistent (and made the code match). + - Fixed the design.h docs for the above. + + - Removed the createProxy() method that takes no context from the factory, and + replaced by making the context default to 0 on the overloaded + implementation. In many cases we were using because there was no sane + context to choose which indicates that the previous API was poor. + +2003-12-03 Wednesday 17:47 rich + + - Oops. Finish removing self binding class. + +2003-12-03 Wednesday 17:39 rich + + - Changed the default behaviour of kjscmd to /not/ call the exec() method of + the application. This method has available to scripts for some time now, and + the old behaviour forced scripts that called exec() themselves to include + convoluted work arounds. + + - Removed the mainwin option from kjscmd as scripts can now handle this + themselves. + + - Modified dumpCompletion() to use convertToValue(). + + - Removed the SelfBinding class as it is now unused. + +2003-11-30 Sunday 23:32 geiseri + + Merged CVS with local changes. + +2003-11-30 Sunday 23:31 geiseri + + Added test that agrivates odd bug where "this" gets trashed. + +2003-11-30 Sunday 23:31 geiseri + + Added QStringList -> KJS Array support. + Added QPen -> Bindings::Pen support. + +2003-11-30 Sunday 23:30 geiseri + + Added DCOP remoteFunctions, remoteInterfaces, + remoteObjects, registeredApplication. + +2003-11-28 Friday 20:30 rich + + - More work on using XSLT to generate the bindings. The code present at the + moment goes some way towards allowing us to move automatically from + doxygen's xml output mode to a set of JS bindings. + +2003-11-28 Friday 04:27 coolo + + kdebindings relying on kdesdk? Next century perhaps + +2003-11-27 Thursday 21:05 rich + + - Added some basic support for QScrollView illustrated by the imagetweak + example, which will become more feature-full in future. + + - Added the very incomplete beginning of support for generating bindings from + doxygen's xml output. + +2003-11-27 Thursday 19:43 rich + + - Moved the TODO list from the top-level directory to the docs directory. + +2003-11-27 Thursday 19:34 rich + + - Moved the methods that wrap events into a standalone class + JSEventUtils. This class is not used directly, instead there is now an + additional createProxy() method in the JSFactory. + + This change is a step towards adding some custom methods to enable us to + provide support for all the methods of the event classes, rather than just + the data members. + +2003-11-22 Saturday 23:20 geiseri + + Moved the dcop call and send into the custom bindings. + Rich im not sure if this is the correct location for these, but + they currently work. + + Added a demo to show off the new dcop stuff, requires + KWeatherService from kdetoys to be running, since i dont + know how to start a service from KJSEmbed yet. + +2003-11-22 Saturday 01:49 geiseri + + Added variable length args to K/QListView. + Added ability to handle Strings vs Pixmaps correctly. + Added native method for grabWidget on QWidget, this + may get moved to Pixmap when i figure out how to handle + a widget pointer. + +2003-11-22 Saturday 00:54 geiseri + + Make the compiler a little quieter by commenting out unused args in functions. + +2003-11-21 Friday 20:13 rich + + - Moved the native binding classes in builtins from the KJSEmbed::Bindings + namespace to the KJSEmbed::BuiltIns namespaces. Moved JSProxyImp from the + KJSEmbed::Bindings namespace to the KJSEmbed namespace. + + - Minor cleanups to SAX handling that make the code a bit easier to follow. + +2003-11-21 Friday 17:22 rich + + - Update the demo to work properly with the changes made to the names of the + widgets in the console a few weeks ago. + +2003-11-20 Thursday 20:04 rich + + - Renamed the 'global' object to 'Global' for consistency with web browsers. + + - Fixed some minor documentation error in the new builtin objects Ian added + (they're not QObject wrappers!). + + - Added basic support for loading files via the SAX api, a callback based + mechanism for processing XML. The implementation is far from complete, but + it is enough to let you load some XML without hastle. You can use the api by + calling saxLoadFile( Object, String ) which takes as parameters, the object + implementing the callbacks and the name of the file to be loaded. + + The callback methods that are currently working are: + + Boolean startDocument() + Boolean endDocument() + Boolean startElement( namespaceURI, localName, qName ) + - note that the attrs argument is missing. + Boolean endElement( namespaceURI, localName, qName ) + Boolean characters( chars ) + + For a more detailed look at what's going on with all this, check out the + example in docs/examples/sax. + +2003-11-20 Thursday 16:50 geiseri + + update the Todos so we know where we stand... still have to go back and check what is done. + +2003-11-20 Thursday 01:13 geiseri + + Fixed the index to show the actual functions. + +2003-11-20 Thursday 01:04 geiseri + + update readme + +2003-11-20 Thursday 01:03 geiseri + + merge with changes from head. + +2003-11-20 Thursday 01:02 geiseri + + Added a completion object for the KDevelop KJSEmbed support. + You can expose this via KJSEmbed's console via the raw() function + that behaves just like dump() only it returns an array instead + of a string. + +2003-11-19 Wednesday 21:55 geiseri + + Updated docs to reflect the latest API. These where generated with build-docs.js. Its starting to look like this might not be the best place to keep this stuff since we can now autogenerate it almost completely. Maby this will be the last update. + +2003-11-19 Wednesday 21:53 geiseri + + updated build-docs.js so that it now generates almost exactly what build-docs.sh does... only about 50x faster + +2003-11-19 Wednesday 14:47 geiseri + + This is a sucky fix, but it works... this function really needs a clean up + all these arrays screaming to be put out of their misery... + + any takers ;) + +2003-11-19 Wednesday 00:58 geiseri + + Added support for KIconLoader and KStdDirs so we can find junk in KDE. + Exposed : + findResource, addResourceType, kde_default, + addResourceDir, findResourceDir, saveLocation, + makeDir, exists, realPath + BarIcon, DesktopIcon, SmallIcon, MainBarIcon, UserIcon + +2003-11-19 Wednesday 00:53 geiseri + + Updated docs for latest code in cvs. Has new StdDirs and StdIcons stuff. + Added SQL docs. + +2003-11-18 Tuesday 19:02 rich + + - Fixed the image fun example. You can now pass pens around. + +2003-11-18 Tuesday 18:16 rich + + - Minor change to debug output and an increase in the maximum number of args + to slots. + +2003-11-17 Monday 19:20 rich + + - Added a mention of the scribble demo + +2003-11-16 Sunday 02:23 geiseri + + yay we can now populate a KListView from an SQL query... maby we need to put in a better demo app ;) + +2003-11-16 Sunday 02:04 geiseri + + hrmmm it seems that implantQVariant dosent work as i thought it should. it seems once that is fixed things may + work a bit better. + +2003-11-16 Sunday 01:36 geiseri + + Fixed the QPainter crash, it seems i had a booliean mistake + Added QVariant insertion support for DCOP... this still crashes, but gets further. + +2003-11-14 Friday 22:48 rich + + - Fixed a problem in StdDialog where the bindings were returning strings that + told you 'this is null' rather than the real null value when the file + dialogs were cancelled. This error caused bad behaviour in the xmlgui demo. + + - Improved the type handling of the JSFactory class. + + - The mapping between typenames and proxy types now supports all the proxy + types. This is essential if we are to support creation of non-QObject + proxies properly. + + - Removed the 'special case' code that handled identification of classes + supported by QWidgetFactory. + + - You can now remove support for particular classes by calling addType() and + specifying the proxy type TypeInvalid. I'm not sure how useful this is, + but we may as well allow it since it is trivial to implement. + + - Split the code that adds the types into one method for each type of + object. + + - Added some new JS methods to the Factory: + + - isSupported(String) + Returns true iff the specified type is supported by the factory. + - types() + Returns an array naming all the types supported by the factory. This + list includes objects which can be wrapped but not created unlike the + constructors method. + + - The methods now use QString rather than QCString to avoid needing lots of + charset conversions as these are an expensive operation. + + - Added a new method addObjectTypes() that is responsible for telling the + factory about all the QObject types it knows about that do not have any + sort of custom bindings. The list of currently unsupported types was + created by the scripts and data files in docs/examples/coverage/. + + - The readFile() method now throws an exception when the file cannot be + loaded. + +2003-11-14 Friday 18:40 rich + + - Fixed the imageviewer example. + + - It now loads the image specified on the command line rather than + hard-coding the name. + + - Restructured the code so the water color operation is a function. + + - Changed the code so it no longer uses return outside of a function (this + is invalid js and causes a warning from the interpreter). Instead, we use + throw which lets us send a message up the call stack to whatever invoked + us. This is a nice technique as it means things will work properly both + standalone, when we're called from another script and when we're called + by something that embeds the kjsembed part. + + - Added a new binding to the System class that lets you call exit. This is + needed because the kjscmd tool is currently calls exec() automatically. It's + a band-aid rather than a real fix, but it will give us time to decide on the + best solution to the problem. + + - System.exit() Exits with the status code 0 + - System.exit(Number) Exits with the status code specified. + + - Added support for the QLayout classes QHBoxLayout and QVBoxLayout. In + addition to the slots and properties, the following custom bindings are + available for box layouts: + + - addWidget + - addSpacing + - addStretch + - addLayout + + The creation code is current ifdef'd out as there are some problems, but the + methods are available to layouts created elsewhere. + +2003-11-14 Friday 06:08 faure + + CVS_SILENT -I.. should be before all_includes + +2003-11-11 Tuesday 19:27 geiseri + + yay more crashing test cases :) + +2003-11-10 Monday 23:33 geiseri + + nice little test to crash dcop with :) + +2003-11-10 Monday 23:12 geiseri + + fixes for dcop so it actually gets to the point of crashing, added a pen type + +2003-11-10 Monday 23:11 geiseri + + Yay we can now officially do SQL queries... we really need a SQL cursor though to make it + realy useful. + +2003-11-10 Monday 23:10 geiseri + + Tried to get further, you can now set a pixmap, still cannot change it, no clue why... + Added a pen type, it wont marshall properly, more type fun rich :) + + we crash when you do a drawText() it seems the qstring's dptr goes invalid... yeah thats cool + +2003-11-10 Monday 23:09 geiseri + + Fixed a few things, we can now attach, and call commands, but now im getting the same issue we + have in painter. Things crash when reading a QString that has been passed in... not sure why + rich you have ideas? + +2003-11-01 Saturday 11:34 rich + + - Attempt to fix problem with geiseri's SQL code. + +2003-10-30 Thursday 20:20 rich + + - Moved the factory method implementations from JSBuiltInImp to + JSFactoryImp. The previous location was a mistake and made no sense at all. + + - Fixed the handling of KParts - the object was being registered incorrectly + which meant things were totally borked. + +2003-10-30 Thursday 20:01 staniek + + retval fixed + +2003-10-30 Thursday 19:29 rich + + - Split the JSValueProxy into two in order to solve the problem that QObject + wrapper classes were broken by the increasing type-safety of the code. + + - JSValueProxy now handles variant proxies and nothing else. + - JSOpaqueProxy takes over the handling of opaque pointer proxies. + + - Fixed the slot return code to fall back to the opaque type if the return + type is a pointer, but is not known by the factory as a QObject. + + - convertToValue() now returns Undefined() for invalid QVariant values and + unsupported types. This prevents scripts incorrectly reporting that the + method was successfull. + + - NOTE: These changes have fixed the problems that were occuring with QObject + wrapper types. + +2003-10-30 Thursday 17:57 rich + + - Made the remaining methods use the new naming code made possible by the + InternalFunctionImp code. This means that all the methods implemented in + native code now behave properly. The new code for adding the methods to + their parent objects is table driven which should make it easier to + maintain (or at least so I hope). + + The methods that are wrappers for slots still need to be changed to use the + new code properly. + + - Removed the old ChangeLog stub (the real thing is in the docs directory). + + - Added d pointers to anything that didn't have one. + + - Removed the remaining createImp() methods because since the code was + refactored to remove the misuse of the part's imp they're a unnecessary + blight on the API. + + - Removed some TODO items that have been implemented. + +2003-10-29 Wednesday 19:32 rich + + - Changed the base class of JSProxyImp from ObjectImp to the newly public + InternalFunctionImp (the internal here refers to the fact they are native + code rather than JS). This change fixes the problem that scripts could not + properly inspect the methods (for example instanceof was broken). The + InternalFunctionImp constructor requires an ExecState, so a few incidental + changes were required to accomodate this. + + NOTE: This change requires the patch to KJS that I just committed. + + - Added some missing d pointers. + + - Improvements to doc comments. + +2003-10-24 Friday 21:30 rich + + - Added a new class JSBuiltInImp that implements the bindings for the methods + defined by JSBuiltIn. Moved the code for these bindings out of the part imp + into the new class. + + - Minor cleanups to the initialisation of the builtins. + + - Improved class docs. + + - Made a couple more methods return exceptions instead of Null on + errors. These error types need to be centralised somewhere, perhaps in the + JSBuiltIn class. + +2003-10-24 Friday 20:13 rich + + - Added some properties to the KPart that let scripts query the version of + KJSEmbed they are running in. + + - Improvements to the XMLActionClient class. + + - Removed the XMLActionRunner member from the kpart because the default + runner is now an opaque class and you can do what you need via the + XMLActionClient. + + - Fixed a potential crash in XMLActionClient (caused by the bad choice of + semantics when changing the runner). + + - The actions are now deleted with the action client, this prevents a crash + when an action that was left behind is invoked. + + - Added a copy constructor to XMLActionScript to ensure the semantics are + sane. + +2003-10-24 Friday 19:01 rich + + - Added a new class JSFactoryImp which implements the constructors for + JSFactory. This is rather better than stuffing all this stuff into + KJSEmbedPartImp as we did before. + + - Renamed some of the public classes to add the js name prefix. + - factory.h/.cpp -> jsfactory.h/.cpp + - securitypolicy.h/.cpp -> jssecuritypolicy.h/.cpp + + - Moved JSProxyImp into its own file. + + - Moved the handling of JSBuiltIn from the factory to the part. This change + makes the logic make more sense, and removes a couple of methods that only + existed to work around the previous location in the factory. + +2003-10-23 Thursday 19:26 rich + + - Started moving the builtin objects out of the factory and into a standalone + class JSBuiltIn. The part will ultimately be responsible for managing the + JSBuiltIn class which should simplify the factory (useful when we have + multiple factories). + + NOTE: Access to the QObject-based wrapper objects is broken at the + moment. This is a known issue and is being addressed, but as things are being + restructured a bit fixing it will have to wait so I don't have to do it twice. + +2003-10-18 Saturday 19:43 rich + + - Began adding support for non-QObject ptr types. + + - The part no longer inherits XMLActionRunner, instead there's an internal + class that binds the two together. This makes the class hierarchy a lot + cleaner and reduces the linking between the xml action handling and kjsembed + which are really fairly distinct. Possibly this separation should go even + further and the part should avoid automatically creating an XMLActionClient + now that scripts can do this themselves. + + - Made some of the methods of the factory object take 'const QString &' rather + than 'QString'. + + - Reworked the handling of the JSFactory object. The factory is now a propery + of the kpart rather than being global. This means that applications can have + multiple active parts, each with their own factory. This change has required + changes throughout KJSEmbed: + + - Changes to allow the static js objects to know which factory they should + be using. + + - Changes to the proxies so they know which part they use rather than just + which interpreter. This has required changes all over the place, but + better now than later. + +2003-10-18 Saturday 16:16 geiseri + + imageviewer with nifty watercolor effect now. + +2003-10-18 Saturday 15:32 geiseri + + More updates to the SQL support. Changed the name to make it more clear + that it was SQL. Still cannot get SqlDatabase.exec() to return a real + query, even thought the database says its all good. + +2003-10-17 Friday 21:52 rich + + - Removed the createSubProxy() method of JSObjectProxy and made the JSFactory + take over this operation completely. + + - Made a create() method in the factory that returns a pre-wrapped + object. This method also throws a JS exception if creation fails instead of + needing the client to check the return value. + + - Removed support for the create() method that early scripts used to + instantiate things, now you must always use new to create objects. This + method was only ever introduced because I hadn't figured out how to define + proper constructors, so no one should really miss it. + +2003-10-17 Friday 17:50 rich + + - Moved the kjsconsole plugin into its own directory. This has been requested + by people working on a couple of apps that would like to use the code. This + is a good idea anyway because it makes the separation between the core of + kjsembed and the clients clearer. + + - Fixed a few unused parameter warnings. + +2003-10-17 Friday 17:26 rich + + - Moved builtins to a new directory. This isn't really needed yet, by doing it + now we avoid lots of pain later. + + - Improved support for QTimer. + + - You now have access to the start(), stop() and isActive() methods. + - Added an example that uses the new timer support. + +2003-10-17 Friday 10:57 rich + + - Removed kpublished as it is unnecessary and seems to be unmaintained. + +2003-10-11 Saturday 20:05 rich + + - Extended the code for dumping slots so the output includes the return type. + + - Added a debug area (80001) to the list in kdecore and changed all the debug + messages to use it. + + - Added the ability to tell the factory that particular class names are + qobjects and made the creation code call it when it creates an object that + is an instance of an unsupported class. Note that this code does not + understand namespaces, so you need to explicitly qualify everything for it + to work properly. + + - Changed the addConstructors method of the factory up so that it uses the + fully qualified names for the bindings classes. + + - Changed the jscript() method of the console widget to use the qualified + name for the part. + +2003-10-11 Saturday 16:26 rich + + - Fixed code for implanting Qt types in unsupported signatures. The code was + ignoring the index of the parameter. + + - Improved slot parameter support. + + - Abort on the first unsuppored type so we don't waste time if we're already + stuffed. + + - If the parameter type is a pointer and the passed value is a proxy we now + pass the value to the slot. Hopefully this will work for both + JSObjectProxy values and for opaque values. + + - If the parameter type is supported by QVariant and the passed value is a + proxy we should now support that too. + +2003-10-11 Saturday 15:32 rich + + - Began to add some flesh to the JSProxy class. + + - Added a bunch of methods to handle the type conversions and tests + cleanly. Used these to centralise a whole bunch of down-casts making the + rest of the code a lot more readable. + + - Added an implant method for proxy classes. This method will make it possible + to pass QObjects, opaque values and unsupported variant types as parameters + to slots. + +2003-10-09 Thursday 21:14 rich + + - Made the arguments passed around during slot invocation a lot simpler. We + now pass around the slotimpl itself rather than all of the members it holds. + +2003-10-09 Thursday 20:41 rich + + - Did some tidying up of the slot handling code. + + - Removed unused JSObjectProxyImp constructor. + + - Lots of work on handling slots that return pointers. Slots that return types + supported by QWidgetFactory now work, adding support for the other QObject + types will be pretty simple at this point. The code really needs to be a lot + more generic - rather than asking the factory if the object is a QObject, it + should be asking the factory if there is a wrapper available for the class. + + - Did most of the grunt work required to handle slot pointer return types + properly. At the time we bind a slot we extract the return type from the + metaobject, the classname we obtain is stored in the slot binding + implementation. + + - Extended the slot invocation stuff to use the addition information about + the return type we've now stored. + +2003-10-08 Wednesday 20:37 rich + + - Added some notes to the TODO file that show how we can extract the return + type of a slot that returns an object from the metainfo. + + - Tidied up and documented the console widget class. + + - Removed the clear button Ian added. I really don't think this fits very + well as it removes the correspondence with a normal console. I've added an + access to for the hbox that arranges the entry fields to make it possible + for client class to do this sort of thing themselves if they feel it is + needed. This accessor also lets you use the console widget in a + non-interactive fashion as you can hide the entire entry section. + + - Initialised proc to 0 and made the child handling slots back into slots so + that the process invocation code will work properly. + + - Changed the names of the child objects to be lower-case for consistency + with everything else. + + - Moved the popup title out of the d pointer object since we're not + retaining b/c for kjsembed this release. + + - Set both large and small WM icons. + + - Updated result handling code to use the facilities the part provides now. + +2003-10-02 Thursday 02:11 geiseri + + added the abilty to clear the cmd line with a button... not sure if i like this operation yet.... maby clear + should clear the log, and when you execute a command the line should get cleared. going to play with this for a + while + +2003-10-02 Thursday 02:01 geiseri + + Added support for the javascript mime type. + Added desktop file so clicking on a js script will execute it... NOTE: im not happy about this but i cannot + figure out how to get it to open in a text editor when its chmod -x and kjscmd when its +x... ideall this will + be fixed in the next few days or ill disable the kjscmd desktop file. + +2003-09-28 Sunday 13:30 geiseri + + start of port ob build-docs.js to kjs + +2003-09-27 Saturday 20:37 geiseri + + updated the docs to reflect the new members + +2003-09-19 Friday 19:58 rich + + - Improved the System class API: + + - Added new method bool writeFile( filename, text ). + - Renamed System.stdin etc. to System.in, System.out and System.err. + - Fixed examples for the new names. + + - Started adding support for classes. The first stage here has been to add + (somewhat messy) support for associating enum values with the correct + type. This means that rather than having to reference these values via the + class instance, you can say things like: + + var f = new QFrame(); + f.frameShape = QFrame.WinPanel | QFrame.Sunken; + + It is important to note that with the current code, the enum values are not + available until after the first instance of the specified type has been + created. + + - Moved EventType back into the cpp class as it is only used internally. + +2003-09-18 Thursday 19:35 rich + + - Added a new class JSProxy to be a baseclass for JSValueProxy and + JSObjectProxy. + + - Moved the event handler mapping code into a standalone class JSEventMapper + which will be its final location. Added various methods etc. to make this + work with everything else. + + - Added a new example that creates a complete KDE mainwindow with all the + standard menus and toolbar using the KStdAction bindings and XMLGUI. This + example also shows how you can wire a KAction to a JS function using the + slot support by adding proper support for the file open action. + +2003-09-18 Thursday 18:36 mueller + + unbreak compilation. I wonder why I waste time on fixing it if the + fixes get reverted anyway. + +2003-09-18 Thursday 16:58 rich + + - Fix geiseri's code from last night. + + - Fix Makefile.am to work properly. + +2003-09-18 Thursday 15:48 rich + + - Minor updates + +2003-09-17 Wednesday 22:13 geiseri + + workarround for Qt bug where moc cannot handle ',' any more... + +2003-09-17 Wednesday 21:38 geiseri + + crackrock EVERYWHERE! im going to bed... + +2003-09-17 Wednesday 21:33 geiseri + + god dammnit, i obviously cannot code anymore this evening... + +2003-09-17 Wednesday 21:09 geiseri + + Added start of bindings for a KConfig object. + this is mostly untested, but it compiles so we can start to debug it. + +2003-09-17 Wednesday 01:43 geiseri + + im sure rich really dosent want credit for this sucker ;) + +2003-09-17 Wednesday 01:41 geiseri + + Added SQL Database and Query bindings. + Known issue is with Database::exec(); This returns a Qt SQL Query. I added what I thought was the + correct constructor to Query() so that we could handle it from JS, but it keeps responding that the query + is a null type. Rich what is the correct way to handle these types? Once this is resolved we can start + on the more advanced SQL features. + +2003-09-17 Wednesday 01:37 geiseri + + Added demo of SQL features. We can now connect to the database, but there are some issues with the + query. + +2003-09-16 Tuesday 01:26 geiseri + + Added support for QMovie so we can spice up our boring GUIs... + +2003-09-15 Monday 22:52 geiseri + + fixed Painter::drawText to really draw text + added: + void drawArc( ... ); + void drawPie( ... ); + void drawPixmap ( ... ); + void drawImage ( ... ); + void drawTiledPixmap ( ... ); + + void scale ( ... ); + void shear ( ... ); + void rotate ( ... ); + void translate ( ... ); + to Painter + +2003-09-15 Monday 20:18 geiseri + + changed image viewer to apply some effects. + +2003-09-15 Monday 20:17 geiseri + + Moved image_imp from a QImage * to a QImage value. + Added image effect members to pixmap_imp + Added image effect members to image_imp + + These need more testing but just a simple test seems to pass and look good. + + +2003-09-15 Monday 19:07 rich + + - Added 3 new methods to the KPart that provide access to the defined + constructors. These replace the dumpConstructors() function in + jsbindings.h which has been now been removed. + + QStringList constructorNames() const; + KJS::Value constructors() const; + KJS::List constructorList() const; + + - Moved some methods of the part so they are no longer slots since it + seems that returning non-ptr, non-variant types like KJS::Object + through a slot isn't going to work due to limitations in moc. The + same limitations apply to properties unfortunately. + + - Added more debug info. + +2003-09-15 Monday 17:04 geiseri + + Added support for the following events: + QKeyEvent, QWheelEvent, QFocusEvent, QPaintEvent, QMoveEvent + QResizeEvent, QCloseEvent, QShowEvent, QHideEvent, and QIMEvent. + + These need to be tested and it should be noted funcitons that return void, are not currently implemented. + + +2003-09-14 Sunday 18:18 rich + + - The events are now defined using an array, this makes it much easier + to maintain and to add support for new event handlers. + + - Added a binding to QApplication::exec(). If this works ok, I think I + should probably make no-exec mode the default and leave the decision + entirely up to the script. This would mean I'd need to add a -exec + option to allow you to use the console widget with non-graphical + scripts. + + - Various clean ups. + + - Added support for the QObject className() method to the object + proxy, and an extra method superClassName() that queries the + metaobject. + + - Note that I'm still working on the 'no default value' problem. + +2003-09-11 Thursday 18:30 rich + + - Rename the new factory to avoid the reserved word. + +2003-09-11 Thursday 05:45 rich + + - Doh, forgot the code + +2003-09-10 Wednesday 20:20 rich + + - Added support for some more of the QMouseEvent class. + state() + stateAfter() + globalX() + globalY() + + - Fixed some of the KMainWindow method bindings which were totally + broken. These bugs explain why a number of things I was trying to + write never worked. + + - Added a binding to KStdAction. This lets you create instances of any + of the standard KDE actions from scripts. For example, you can write + the following: + + var act = StdAction.quit( recv, slot, parent, name ); + + Note that at the moment the receiver and slot cannot be a JS object + and method, they must be a slot defined in C++. + + - Added an example to docs/examples/actions/ + + +2003-09-06 Saturday 17:36 rich + + - Added getParentNode() to the DOM api. + + - Added implementation of KJS::Identifer::qstring(). + + - Added the JSObjectEventProxy class. This class forwards Qt events to + javascript handler methods. This means you can now write scripts + that handle events! + + The basic method it uses is to install an event filter for the + target of the JSObjectProxy it is created for and test if any events + the target receives should be forwarded using a bit array. If the + event needs forwarding it looks up the name of the handler and calls + it, if not then processing occurs as normal. + + The creation of the event proxy is handled by the object proxy which + overrides the set property handling in ObjectImp to detect when a + script assigns to a method that is an eventhandler. The event proxy + is created the first time this happens (and is deleted when the last + handler is removed). + + In order to implement the scheme described, there needs to be a + both a mapping between handler names and QEvent::Type, and a mapping + between the type and the handler. The first is used to determine + if assigning to a property should cause any event types to be + forwarded (and which types they are), the second lets the event + filter know which js method it should call. + + In addition to supporting the standard event handlers needed to + write Qt/KDE wrappers, this code is intended to support weird + compatibility stuff like kaxul. :-) This requirement means we need + to allow for the possibility of custom event types, events mapping + to custom handler names, and also custom signatures in event + handlers. The same difficulties occur when support for custom + QEvents is considered. This side of things is very much a work in + progress. + + At the moment both mappings are stored in the factory object, but + I'm not convinced this should be their real location. If anyone has + any thoughts on this, then please let me know. The other big + question is the time at which names should be resolved to + (hopefully) callable objects. + + +2003-09-03 Wednesday 17:02 rich + + - Added bindings to KColorDialog and KPropertiesDialog to StdDialog. + + - Moved StdDialog binding code from the factory to the class itself. + + - Added support for creating QScrollView and QCanvasView widgets. + + - Added support for KMainWindow::createGUI(). + + +2003-08-27 Wednesday 18:37 rich + + - Fixed tree example (I added a sh-style comment) and added a better + demo ui file. + +2003-08-27 Wednesday 18:24 rich + + - Added binding to isWidgetType(). + + - Added an example that generates a graphical tree of the QWidget + hierarchy. + + - Fixed const warning in convertToValue(). Various other irritating + const fixes. + + - Added support for enums! This means that you can now use enums that + have been declared using Q_ENUM in scripts. The enums are published + as properties of the object itself for now, rather than the class + (this will be fixed). This means that for now you do things like + this: + + f = new QFrame(); + f.frameShape = f.Panel; + + - Added a new demo 'frame' that illustrates QFrame and enum support. + + +2003-08-27 Wednesday 14:30 geiseri + + made the slot invoke a little smarter. we now have both the old and new methods to keep everyone happy. + +2003-08-26 Tuesday 20:10 rich + + - Moved code for adding custom functions to the corresponding imp + class. + + - Added context information to convertToValue() so that we can ensure + the security policy is followed. Without this change, proxies that + are created by this method will revert to the default policy. This + fixes the security hole I referred to earlier. + + - Added a binding to JSValueProxy that returns the name of the + contained type. + + - Added a new native binding StdDialog that will provide an easy way + to access the common KDE dialogs. This class is far from complete at + the moment. + + getOpenURL(...) + getSaveURL(...) + getExistingDirectory(...) + getOpenFileName(...) + getExistingURL(...) + getImageOpenURL(...) + getSaveFileName(...) + + +2003-08-21 Thursday 19:45 rich + + - Added a factory method for proxies that are explicitly published. + + - Renamed some ExecState params called 'state' to 'exec' for + consistency and reordered some method args for the same reason. + + - Moved the JS method load() out of the factory object and into the + global namespace. + + - Added an example showing how to write scripts that span multiple + source files. + + +2003-08-21 Thursday 18:36 rich + + - Modified the JSFactory class so that it is no longer used via static + method calls. These changes have been made so that host applications + can define custom factories. There are more changes to come in this + area, so please don't use on it yet. + + - Moved creation of sub-proxies to the factory. + + - Something seems to have broken the listview example. I'm not sure if + it is one of my changes, or if it's the generic slot support geiseri + added. + + +2003-08-18 Monday 23:48 geiseri + + Variable length slots now work for the currently known types. Things seem + to pass the old tests, and some new dcop tests now pass. QVariants still + need to be handled. I leave for my flight in 17hours so im not optimistic + ill get in one more commit. Rich please dont try to clean this up yet, as + ill probibly work on it before i get net access on thursday. + + +2003-08-18 Monday 23:46 geiseri + + Make this work with Qt 3.2... not sure if this has bad side effects yet, + please test. + + +2003-08-18 Monday 15:40 rich + + + drawRoundRect(). + + - Added a new example that illustrates support for KListView. + + - JSValueProxy instances that contain a QVariant can now be converted + back to QVariant. + + - Moved JSValueProxy out of the Bindings namespace. + + - Added a new example that tests the support for opaque values. + + - Did a bit of work on the Painter binding, still doesn't work + though. :-( + + - Added support for opening files (ro/rw) a TextStream is returned. + (currently commented out as it is flawed). + + +2003-08-18 Monday 13:39 geiseri + + it helps rich to debug it if he has the same code. + +2003-08-17 Sunday 11:46 rich + + - Added a new class JSValueProxy which provides an opaque binding to + either a QVariant or a void pointer. + + - Extended the property handling code to automatically generate opaque + bindings for unknown types. + + - Added a new method Factory.widgets() that returns a list of the + widgets supported by QWidgetFactory. + + - Added support for pointer slot return values. + + +2003-08-16 Saturday 18:33 rich + + - Moved the implementations of the custom methods (ie. those that are + not slots) to their own class. + + - Documentation + + - Made the built-in objects use the default Object prototype for their + KJS::Object. + + +2003-08-16 Saturday 17:16 rich + + - Added some more doc comments. + + - Added support for slot signatures needed by NetAccess: + + slot(const KURL&,const QString&) + slot(const QString&,const KURL&) + + +2003-08-16 Saturday 16:48 rich + + - Minor cleanups of the kpublished code. + + - Cleaned up the factory's create methods. There is now one for each + type of object created. + + - Fixed NetAccess (I was too enthusiastic in converting stuff to + KURL). + + +2003-08-16 Saturday 15:52 rich + + - Modify KIO::NetAccess binding to use KURLs now we support the 2 + argument variant. + + +2003-08-16 Saturday 15:42 rich + + - Added support for slots that take 2 kurls. + + +2003-08-16 Saturday 15:01 jowenn + + A modified dcopidl* toolchain for restricting which slots should be published to kjsembed. It's quite generic from the idea, so it should be usable with any other script language too. It's a first try/begin though, so it doesn't do much yet except for the test also committed I hope to get signal restrictions to work too and fix some compatibility problems with Qt's moc + +2003-08-16 Saturday 14:41 rich + + - Added support for a 4 argument for of createROPart() to allow you to + specify custom constraints for the KTrader query. + + +2003-08-16 Saturday 13:48 zrusin + + Fix implicit casts. + +2003-08-15 Friday 19:53 rich + + Update changelog and docs + +2003-08-15 Friday 19:46 rich + + - Ensure we add the args array to the application object even when it + is empty. + + - Improved the readonlypart demo to be proper browser (ie. make links + work). + + - Improved factory creation code. + + +2003-08-15 Friday 18:45 rich + + - Added support for creating read-only KParts. + + - Added an example that displays the KDE homepage in a KHTMLPart. This + example also shows the use of the main window bindings. + + +2003-08-15 Friday 18:08 zrusin + + Use new instead of app.create and a few path fixes. + +2003-08-15 Friday 17:55 zrusin + + Make the new call work with NetAccess + +2003-08-15 Friday 17:49 rich + + - Added compatibility with KDE 3.1 so I can actually use this stuff! + + - Minor cleanups to the examples. + + +2003-08-15 Friday 09:13 zrusin + + Don't crash when creating widgets/dialogs from ui files (and use more + sensible way of detecting kjscmd) + +2003-08-15 Friday 04:59 zrusin + + Adding KIO::NetAccess binding. So now from within scripts you can do: + var net = application.create( 'NetAccess', 'net' ); + net.download( 'http://www.kde.org/media/images/kde_logo.jpg', '~/logo.jpg' ); + To download anything you want. It be cool if one could disable the progress + dialog for netaccess. + +2003-08-14 Thursday 22:00 rich + + - Added some more slot signatures: + + - slot(const QString &,uint) + - slot(const QString &, bool) + - slot(int,const QColor &) + - slot(int,int,int,int,int) + - slot(const QPixmap&) + - slot(const QRect&,bool) + - slot(const QString&,bool) + - slot(const QString&,bool,bool) + - slot(const QString&,int,int) + - slot(int,const QColor&,bool) + - slot(int,const QColor&) + - slot(int,int,float,float) + - slot(const QString&,bool,bool,bool) + + - Added a utility method for getting the QWidget in a proxy. + + - Added support for QPixmap properties. + + - Added imageviewer example. + + +2003-08-14 Thursday 19:07 zrusin + + Yeah, real funny + +2003-08-14 Thursday 19:02 zrusin + + Correct makefile for a static lib. + +2003-08-14 Thursday 18:02 rich + + - It helps if we actually make the QString,QString slots available to + the JS interpreter... + +2003-08-14 Thursday 17:57 rich + + - Added a JS prefix to a couple of classes. + + - Added support for slots with 2 string arguments + + +2003-08-14 Thursday 14:39 rich + + - Add support for the full loadui command including the connector. + +2003-08-14 Thursday 14:16 rich + + - Make kawil happy by fixing the parent argument to loadui. + +2003-08-13 Wednesday 15:58 zrusin + + Adding bindings as a subdir dir. Fixing the non-working implicit cast of + QString to const char* to make it compile. + Rich are sure the bindings lib should be installable shared lib, and not + a static, non-installable one? + + +2003-08-12 Tuesday 18:06 rich + + Oops + +2003-08-12 Tuesday 18:03 rich + + Moved to bindings/ + +2003-08-12 Tuesday 17:57 rich + + - Moved the QObject classes that only exist to provide bindings into a + new directory. This will hold all the classes that exist only to + provide a binding. + +2003-08-12 Tuesday 17:02 rich + + Grr, i fucked this up again + +2003-08-12 Tuesday 16:29 rich + + - Added calculator example + +2003-08-12 Tuesday 16:24 rich + + - Factory can now create KMainWindow. + + - Added binding methods to KMainWindow. + - setCentralWidget() + - actionCollection() + + - SlotUtils is no longer used by inheritence, woo hoo! + This means that apps will be able to extend it soon. + + +2003-08-08 Friday 01:04 staikos + + This thing really hampers Konqueror startup time, and it provides nothing of + value to konqueror itself. Any solution, rich? Do we really need it? + + +2003-07-30 Wednesday 18:52 rich + + + - Added support for calling slots with signatures uint, long and ulong + as methods. + + - Added support for connecting signals with unsupported signatures to + JS methods. Note that currently *none* of the arguments will be + passed to the script in this situation. + + - Minor fixes to docs. + + - Added an example 'connect' that shows how the most common types of + signal can be connected to JS methods. + + +2003-07-29 Tuesday 17:34 rich + + Try make things work for jowenn + +2003-07-28 Monday 08:39 mueller + + unbreak compilation (gcc 3.4+) + +2003-07-28 Monday 08:38 mueller + + I don't know how this code is ever supposed to compile, but at least it + will produce the .moc files correctly. + +2003-07-27 Sunday 20:25 rich + + - Added d pointer to SlotUtils. Constructor and destructor no longer + inline, this should make compatibility easier. + + - More doc improvements. + + - Removed the overloaded openURL() method that takes a string as we + support KURL parameters now. + + - Started implementing support for connecting signals to Javascript + functions. The code for this is mostly in the SlotProxy class. + + - Modified the docviewer example to make use of the JS slot + support. This example now works pretty much the way it is intended + too! + + +2003-07-27 Sunday 18:00 mueller + + unbreak compilation (gcc 3.4+) + +2003-07-27 Sunday 18:00 mueller + + libkjs is not in my kdebindings + +2003-07-27 Sunday 16:19 rich + + - Fixed Makefile.am problem. + +2003-07-26 Saturday 22:32 rich + + - Removed the default value of 0 for the wparent of one of the + KJSEmbedPart constructors. This means that the defaults no longer + trigger the crash-on-exit bug. + + - Made createInterpreter() protected because calling it twice calls a + memory leak and there's no need for apps to use it anyway. + + - Added an accessor for the completion object of the last script. + + - Renamed executeScript() to runFile(), and loadScript() to loadFile() + to make the semantics clearer. + + - Replaces some overloaded methods with default arguments. + + - Fixed the 3 argument version of connect to match Qt, and tidied up + the way connect is processed. Matching changes for disconnect. + + - Added support for the slot signatures: + + - int,int,int,int,bool. + - QRect, bool + + +2003-07-26 Saturday 17:51 rich + + - Made the makefile put the changelog in the docs dir + +2003-07-26 Saturday 17:44 rich + + - Moved low-level slot handling into a standalone class SlotUtils that + JSObjectProxyImp inherits. This makes the code a lot easier to work + on as the JS glue and the Qt glue are no longer stuck together. + + +2003-07-26 Saturday 17:09 rich + + - Documentation updates + +2003-07-26 Saturday 16:49 rich + + - Added links to QSA and a tutorial on inheritence in JS. + +2003-07-26 Saturday 16:35 rich + + - Added some information about planned changes. + +2003-07-19 Saturday 16:47 rich + + - Removed kspy dependency + +2003-07-18 Friday 20:39 rich + + - Added constructors for the Painter object. + + - Added a new binding Pixmap that provides an interface to QPixmap. + + - Removed duplication of the BindingObject construction code. The + custom binding objects now use the same code as the classes defined + by QWidgetFactory. + + - Removed test signals and slots from the kpart. + + - Added support for widget classes to the script that generates the JS + API reference. This means the reference manual now includes every Qt + and KDE object available! + + - Started writing a JS documentation viewer. + + - Started adding support for custom methods: + + - jsobjectproxy.cpp Added insertItem method for QListBox + - jsobjectproxy_imp.cpp + - jsobjectproxy_imp.h + + - Cleanups + + - kjsembedpart.h Tidy the code up and document + - kjsembedpart_imp.cpp Added a new method constructors that + - returns an + array of constructors. + - kjsembedpart_imp.h + - pixmap_imp.cpp Added pixmap property + - pixmap_imp.h + + - Improved docs + + - docs/index.html Added link to mozilla js language page + + - Improved access to bindings + + - factory.cpp Added constructors() + - jsobjectproxy.h Added addBindingCustom() + + - Converted state -> exec for some more functions. + + - Added some custom bindings for useful widgets. This code needs + cleaning up more before it is ready for prime time. The methods + added are: + + QListBox::addItem() + KListView::addColumn() + QListView::addColumn() + KListView::insertItem() + QListView::insertItem() + + - Started writing a new example that provides a documentation browser + for KJSEmbed. + + +2003-07-11 Friday 21:43 rich + + - Added constructors for the Painter object. + + - Added a new binding Pixmap that provides an interface to QPixmap. + + - Removed duplication of the BindingObject construction code. The + custom binding objects now use the same code as the classes defined + by QWidgetFactory. + + - Removed test signals and slots from the kpart. + + - Added support for widget classes to the script that generates the JS + API reference. This means the reference manual now includes every Qt + and KDE object available! + + +2003-07-10 Thursday 20:35 rich + + - Added a document that describes the types used to pass data between + Qt and scripts. + + - Improved the documentation front page and stylesheet. + + +2003-07-10 Thursday 17:56 rich + + - Fixed links to examples. + + + - Minor doc changes. + + +2003-07-05 Saturday 20:43 rich + + - Added support for getting the values of rect, size and point + properties. The values are returned as arrays, the types are as + follows: QRect -> [x,y,w,h], QSize -> [w,h], QPoint -> [x,y] + + - Changed the prototypes of a couple of methods that extract values so + they take a KJS::ExecState parameter. This is required for us to + create arrays etc. in order to return complex values. + + - Began renaming the KJS::ExecState variables to 'exec' rather than + 'state' for consistency with KJS. + + - Split the dumpObject() method into two, one that dumps the JS + properties, and one for the Qt properties. + + +2003-07-04 Friday 21:34 rich + + - Added support for passing sizes to slots. A size is represented + either as an array with two elements [width,height], or as an object + with the properties 'width' and 'height'. + + - Improved slot publishing code so that overloaded slots are + supported. The first slot is published as before, subsequent slots + with the same name get the number of arguments they require + appended. + + - Removed the childAt() and findChild() methods from the JSObjectProxy + object. The child() method provides the same facilities via a + unified interface. + + - Added some type information to the dump output. + + +2003-07-04 Friday 16:33 rich + + - Renamed the ConstructXXX constants to NewXXX. + + - Added support for reading Color, Font and KeySequence types. + + +2003-07-02 Wednesday 20:13 rich + + - Made slots() list slots with all signatures not just those we can + use as methods because we can connect to a slot even if the + signature is not supported. + + - Added signals() to list the signals emitted by an object. + + - Added signals and slots sections to the dump() output and + regenerated the JS API documentation. + + +2003-07-02 Wednesday 19:19 rich + + - Fixed problem with XMLActionClient caused by one of the previous + renaming exercises. + + - Added the ability to connect signals to signals. This is handled + transparently to the script, so you can simply treat the signal you + want to emit indirectly like the slots we already + support. Internally, the code will try for a slot first then try for + signal if that fails. This is ok because you can't have a signal and + a slot with the same name and signature. + + - Added a test program for the above, test_connectsignal.js. + + - Minor fixes to the tutorial. + + +2003-06-28 Saturday 21:09 rich + + - Added support both 3 and 4 argument forms of connect and disconnect. + + - Added a couple more examples. + + - Added support for creating QObject and QTimer. + + - Added some scripts to the docs directory that build a reference + manual for the JS API. Added the results too. + + +2003-06-28 Saturday 15:13 rich + + - Added support for disconnect + +2003-06-28 Saturday 14:03 rich + + Added test script for connect + +2003-06-28 Saturday 13:58 rich + + - Support for connect + + - You can now connect a signal defined by one QObject, to a slot + defined in another. + + - Improved the dump function: + + - Now lists qt properties in their own section. + + +2003-06-28 Saturday 10:51 rich + + - Remove accidental change to Makefile.am + +2003-06-28 Saturday 10:47 rich + + - Simplified the slot handling by moving the slot signature into a + separate variable. + + - Fixed a bug in the handling of child lookup by name (we always got + the first child irrespective of the name). + + - Simplified the various child lookup functions to be handled in one + place. + + - More simplifications of the process of implanting parameter values. + + - Protected slot invocation against being called with the wrong number + of arguments. + + - Update copyright dates. + + - More work on DOM support: + - Boolean hasAttribute( name ) + - Value getAttribute( name ) + - Boolean setAttribute( name, value ) + + +2003-06-26 Thursday 20:09 rich + + - Make DOM the primary implementation + +2003-06-26 Thursday 19:56 rich + + - Actually adding the bindings is likely to improve the user + experience. :-) + + +2003-06-26 Thursday 19:22 rich + + - Started adding a DOM API to the object tree. For now we'll start + with getElementById() to keep pmax happy. :-) + + +2003-06-25 Wednesday 18:17 rich + + - Fixed a bug left over from the regexp code. + +2003-06-16 Monday 21:02 rich + + Oops + +2003-06-16 Monday 21:02 rich + + - Added utility methods for marshalling common types and used them to + simplify the slot invocation code. + + - Removed a bunch of extraneous QRegExps. + +2003-06-16 Monday 20:10 rich + + - Split the addition of bindings for object proxy. + + - Added a stub class for QObject binding classes (the stub for native + bindings will arrive soon). + + - Added support for QVariant return values. + + +2003-06-16 Monday 11:36 staikos + + handle QString returns properly + also be more debuggable + +2003-06-15 Sunday 22:14 rich + + - Split up the slot invocation code to make it easy to work on. + + - Added support for slot return values. The following types are + currently supported: + + - bool + - int + - QString + - const char * + + - Improved the self-documentation facilities. + + - Improved the output of the dump() method. + - Added a classes() method that lists the available classes. + + +2003-06-15 Sunday 17:45 rich + + - Fixed the additional slot invocation stuff. + + - Updated changelog. + +2003-06-14 Saturday 23:10 rich + + - Publish the JSEmbedPart as the global property 'part'. + + - Added the ability to run code with a specified 'this' object. + The default is now to run things with a null this. + + - Added an accessor for the XMLActionClient. + + - Added support for more slot signatures: + + - mySlot(const KURL &) + - mySlot(int,int,int,int) + + - Improved console widget + + - Use KLineEdit and a KCompletion rather than a combo. + - Added a prompt label with a keyboard accelerator. + - QTextEdit -> KTextEdit. + - Pass the console widget the part rather than the interpreter. + + - Provide access to the default execution context, and the ability to + change it. + +2003-06-09 Monday 03:51 staikos + + Add support for QObjects that can self-bind JS methods. + Rich: this is more or less just a demo. It's not the ideal way for this to work + but I have not been able to find an alternative approach in JS or in C++. We + might be stuck with it. Please review. We can back it out later if a better + solution is available. Meanwhile, it solves my problem with StringBundle. + + +2003-06-07 Saturday 22:53 rich + + Added an example that displays a graphical tree + +2003-06-06 Friday 13:21 staikos + + argh was not supposed to revert the last change + +2003-06-06 Friday 13:19 staikos + + revert the asserts .. if people want to do this, let it crash + +2003-06-06 Friday 13:09 staikos + + delete the part on exit + +2003-06-06 Friday 12:33 staikos + + deparentification + + (don't crash) + +2003-06-06 Friday 00:44 staikos + + assert() the crash case in here so that a developer knows it will happen before + he gets very far + +2003-06-06 Friday 00:30 staikos + + directions on how to keep it from crashing if you don't realise what it does + with double parent objects in the constructor + + +2003-05-22 Thursday 17:34 geiseri + + Some fixes for makefile.am + +2003-05-22 Thursday 16:56 rich + + + - Fixed some problems with KJS::Identifier support. + + - Added a very basic QPainter binding for drawing on QPixmaps. The following + drawing operations are supported: + + - void moveTo( int x, int y ); + - void lineTo( int x, int y ); + - void drawPoint( int x, int y ); + - void drawLine( int x1, int y1, int x2, int y2 ); + - void drawRect( int x, int y, int w, int h ); + - void drawRoundRect( int x, int y, int w, int h, int = 25, int = 25 ); + - void drawEllipse( int x, int y, int w, int h ); + - void drawText( int x, int y, const QString &txt ); + + - Fixed a problem with the --mainwin option. + + - Added another example script. + +2003-05-19 Monday 10:59 mueller + + CVS_SILENT compiler warnings + +2003-04-23 Wednesday 01:21 geiseri + + Added a close button so that it could close without hitting the kill + button. + +2003-04-03 Thursday 14:55 geiseri + + KJS is mostly ported to the new api. + +2003-04-03 Thursday 14:55 geiseri + + Start of DCOP support for new KJSEmbed. + +2003-02-21 Friday 10:36 pmk + + Updated for changes to KJS API - use Identifier instead of UString + +2003-02-04 Tuesday 17:50 rich + + - Added support for more QWidgets: + + QSplitter, QMainWindow, QProgressDialog. + + - Improved dump() function, now spits out a nice HTML table of the + properties etc. + + - Renamed JSObjectProxy::jscript() to interpreter() (for consistency). + + - KJSCmd can now create a KMainWindow (dunno how useful this is + without the other additions I'm planning though). + +2003-01-31 Friday 22:19 rich + + - Switched order of args to convertToVariant() to match everything + else. + + - Added a new global method 'dump(Object)' that returns information + about the specified object. The information returned depends on the + type of the object. + +2003-01-31 Friday 19:16 rich + + + - Renamed KJSEmbedPart::jscript() to KJSEmbedPart::interpreter() for + consistency. + + - Renamed publish() to addObject(), and publishStdBindings() to + addStdBindings(). This is more consistent with QSA, and makes the + API more familiar to developers familiar with the rest of KDE/Qt. + +2003-01-31 Friday 18:52 rich + + + - Moved loadScript(filename) from main.cpp into the KPart, and renamed + the existing loadXX() to executeXX() which is better anyway. + + - Added -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST to the build flags. + + - Added a standalone factory class. This class is responsible for + creating the various objects, and for creating bindings. + + - Split the code that creates the standard bindings into individual + methods. + + - Moved bindings classes into their own namespace KJSEmbed::Bindings, + this has affected the Bind_Image, Bind_TextStream, and the XXImp + classes. + + - Renamed SecurityPolicy to JSSecurityPolicy, and ActionData to + XMLActionData. + +2003-01-14 Tuesday 22:35 rich + + - Remove messagelog + +2003-01-14 Tuesday 22:34 rich + + + - Created a KJSEmbedPartImp class which replaces the internal + MethodImp and ConstructorImp classes used before. This makes the + public header files a lot cleaner, and makes the code easier to + follow. + + - Created a JSObjectProxyImp class which does the same for + JSObjectProxy. + + - Removed the legacy isAllowed(...) methods from JSObjectProxy, use + the SecurityPolicy class instead. + + - Merged the reduntant class MessageLogWidget into JSConsoleWidget. + + - Moved Bind_Image and Bind_TextStream to their own files. + + - Moved the KJS::Value <-> QVariant functions to jsbinding. + + - Improved the JSObjectProxy + + - Tidied up the code for registering and calling slots. + + - The slots(), properties() and children() methods now return + Arrays. + +2003-01-14 Tuesday 15:56 rich + + - Made QVariant <-> KJS::Value conversions standalone methods. + + - Made the argument ordering of the create() methods consistant + throughout. + + - Added accessor to allow you to get the QObject a proxy is bound to. + + - Now defines constructors for all the widgets supported by the + QWidgetFactory. This change is very important as it eliminates what + was the single most noticable difference between the C++ and + Javascript objects. Using constructors properly has the added bonus + that the Javascript interpreter can now correctly determine the + class of the objects. + + - Supported Qt Widgets: + + QPushButton, QToolButton, QCheckBox, QRadioButton, + QGroupBox, QButtonGroup, QIconView, QTable, + QListBox, QListView, QLineEdit, QSpinBox, + QMultiLineEdit, QLabel, TextLabel, PixmapLabel, + QLayoutWidget, QTabWidget, QComboBox, + QWidget, QDialog, QWizard, QLCDNumber, + QProgressBar, QTextView, QTextBrowser, + QDial, QSlider, QFrame, Line, QTextEdit, + QDateEdit, QTimeEdit, QDateTimeEdit, QScrollBar, + QPopupMenu, QWidgetStack, QMainWindow, + QDataTable, QDataBrowser, QDataView, + QVBox, QHBox, QGrid + + - Supported KDE Widgets: + + KActiveLabel, KCharSelect, KColorButton, KColorCombo, + KComboBox, KCModule, KDateWidget, KDatePicker, KDialog, + KDualColorButton, KEditListBox, KFontCombo, KGradientSelector, + KHistoryCombo, KHSSelector, KLed, KListBox, KListView, + KLineEdit, KPasswordEdit, KProgress, KPushButton, + KRestrictedLine, KIconButton, KIntSpinBox, KRuler, + KSqueezedTextLabel, KTextBrowser, KTextEdit, + KURLLabel, KURLRequester, + KIntNumInput, KDoubleNumInput, KDoubleSpinBox + + - Added constructors for the custom builtin objects Image and + TextStream. + +2003-01-11 Saturday 21:50 rich + + - Added a binding to QImage::smoothScale(w,h,ScaleMin). This should + really be handled by the enum property support, but as that doesn't + exist yet we'll do it the hard way. + + - Added a readFile(name) method to the global JS object. It returns + the file contents as a string, or null if the file could not be + read. + + - Added README files to some of the examples. + + - Added a println() method to the global object. The old print() + method has been changed so it no longer appends a newline. + + - Added an example that generates an image gallery. + + - Thumbnails of the images are created automatically. + + - Descriptions of the images are inserted in the generated page if + there is a file called <imgname>.htm. + + - Automatically skips its own thumbnails. + + - Files that aren't understood are ignored so you can just pass '*' + when you call it from the command line. + + - Includes an example shellscript that ensures the images are sorted + by their modification time. + + - Updated copyright info. + +2003-01-10 Friday 23:54 rich + + - Added Image binding. + + - Provides a binding to some basic QImage and QImageIO operations. + - Added example that prints info about an image. + - Added an example that scales an image and writes it in a specified + - format. + + - Added support for (int, int) slots. I really need to make this code + handle the args generically. + + - kjscmd now makes args following the script name available to JS as + application.args[]. + + - Strip #! line that contains kjscmd from the script so the scripts + can be run just by making them executable. + +2003-01-06 Monday 18:23 rich + + - Added the tutorial i am working on so people can see how to use this stuff + +2003-01-06 Monday 17:38 rich + + - Add link to tutorial devel site + +2003-01-06 Monday 17:09 rich + + KJSEmbed 0.2 + ============ + + Massively updated and improved version of KJSEmbed. Still a few things + to go though, including the tutorial. + + - Fixed i18n of js console widget + + - Fixed text spacing in console widget + + - Fixed design flaw in security model + + The old model was flawed because sub-proxies would always revert + to the default policy rather than using the custom policy defined + by a subclass. The policy is now a standalone object, so the problem + is fixed. + + - Added lots of documentation and a Doxygen config file. + + - Extended factory class to create the following types: + + - Any QWidget sub-class + - KAction + - KToggleAction + + - Added a command line tool for invoking js scripts + + - Improved JSObjectProxy Massively + + - Create child widgets from a script + - Create KActions and KToggleActions from a script + - Call slots from scripts + + - Added support for additional property types + +2002-11-29 Friday 12:28 mueller + + backport install dir fix + +2002-11-29 Friday 12:28 mueller + + install in the right path + +2002-11-07 Thursday 15:30 coolo + + little cleanup + +2002-03-08 Friday 13:53 rich + + kdoc fixes + +2002-03-08 Friday 12:43 rich + + Updates for kjs changes in HEAD + +2001-11-16 Friday 04:59 faure + + Let $(all_includes) be last otherwise my script gets unhappy ;) + +2001-11-15 Thursday 14:19 mueller + + ignore + +2001-11-13 Tuesday 18:38 rich + + Added an example of how to use the example. :-) + +2001-11-13 Tuesday 17:12 wgreven + + Fix compililation for builddir != srcdir. + +2001-11-13 Tuesday 15:56 rich + + A library for embedding kjs with transparent bindings to QObjects and + their properties, a dialog loader and a hook loader for client apps. + diff --git a/kjsembed/docs/Makefile.am b/kjsembed/docs/Makefile.am new file mode 100644 index 00000000..a485debe --- /dev/null +++ b/kjsembed/docs/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=embedding diff --git a/kjsembed/docs/TODO b/kjsembed/docs/TODO new file mode 100644 index 00000000..06cfb0e4 --- /dev/null +++ b/kjsembed/docs/TODO @@ -0,0 +1,81 @@ + Planned Changes + =============== + +Core +==== + +- Handle non-standard signatures (that are combinations of supported + types). [Working, but variant support is incomplete] + +- The factory class needs to become responsible for the bindings as + well as the creation of the objects themselves. [Partially working] + +- At the moment a lot of the standard bindings etc. are rebound for + each proxy. This is ridiculous and totally unnecessary. + +- When a proxy is created, it should use create-on-first-use semantics + to define the JS object defining its class. This object can then be + used to store the method and property wrappers. In addition, by + setting the prototype correctly for the created instance we can get + inheritence working properly. + +- Extend the type handling code in slotutils.cpp to support opaque pointer + types properly. + +- Enable emission of signals from JS that can be connected in C++ + +- DOM Level 2 support. + +- Clean up slot handeling code. + +- Clean up opaque proxy so the pointers can be GCed. + +- Clear up ownership issues with respects to objects generated from + applications that embed KJSEmbed and wrap internal objects with + opaque proxies. + +Bind Wizard +=========== + +- Missing arg types: + - QColorGroup & + - QPainter * + +Bindings +======== + +- Add more Bind_XXX classes. + +- Move to the same pattern as the KJS/DOM bindings for better + inheritence support. + +- Support for QSignal + +- A generic wrapper for QStyle so you can write styles in JS. + +License Clarification +===================== + +<kupid> I talked to Matthias and we'll have to explictly state somewhere in the license that you're not +allowed to create the widgets with it. They way he saw it is that there should be any problem because +if you write a script and it's internal and you don't redistribute it then it can be whatever you want, if you +do redistribute it then it's a script and the code is right there so you might as well make it explicit that +it's gpl or lgpl +<richmoore> i don't quite follow +<richmoore> are you saying that if you use the widget factory then the license degrades from LGPL to +GPL? +<richmoore> (this would make sense btw) +<kupid> Yes, that's the thing, we just can't allow people to use GPL licensed Qt classes under LGPL +<richmoore> that's fair enough +<richmoore> i was aware of that +<richmoore> i think the easiest solution is to allow a script to specify a license and use that to +determine the available bindings (and to provide a pure-LGPL build target with no qt support) +<richmoore> a 'check-license' mode is also a good idea +<richmoore> the same situation will apply when i add bindings for Kalle's charting library +<richmoore> this is one of the reasons why i want the bindings to be dynamically loaded +<richmoore> thanks for checking this, it is good to know the trolls opinion here +<kupid> That sounds great (sorry for having a slow response time but I'm running around the labs) +<richmoore> no problem + + + diff --git a/kjsembed/docs/build-docs.js b/kjsembed/docs/build-docs.js new file mode 100644 index 00000000..04f276c1 --- /dev/null +++ b/kjsembed/docs/build-docs.js @@ -0,0 +1,230 @@ +#!/usr/bin/env kjscmd + +function write_page( name, body ) +{ + var markUp = ""; + + markUp += '<html>\n'; + + markUp += '<head>\n'; + markUp += '<title>' + name + '</title>\n'; + markUp += '<style type="text/css"><!--\n'; + markUp += 'h1 { text-align: center; background-color: #ccccff; }\n'; + markUp += 'h2 { background-color: #eeeeff; }\n'; + markUp += 'h3 { background-color: #eeeeff; }\n'; + markUp += 'th { background-color: #cccccc; }\n'; + markUp += 'td { background-color: #eeeeee; }\n'; + markUp += '--></style>\n'; + markUp += '</head>\n'; + + markUp += '<body>\n'; + markUp += '<a href="index.html">All Objects</a>'; + markUp += '| <a href="index-static.html">Statics</a>'; + markUp += '| <a href="index-objects.html">Objects</a>'; + markUp += '| <a href="index-kjsembedobjects.html">KJSEmbed Objects</a>'; + markUp += '| <a href="index-qtobjects.html">Qt Objects</a>'; + markUp += '| <a href="index-kdeobjects.html">KDE Objects</a>'; + markUp += '| <a href="index-exceptions.html">Exceptions</a>'; + markUp += '| <a href="index-nocreate.html">Uncreatable Objects</a>\n'; + markUp += '<h1>' + name + '</h1>\n'; + markUp += '<hr>\n'; + markUp += body; + markUp += '<hr>\n'; + markUp += '</body>\n'; + + markUp += '</html>\n'; + return markUp; +} + +function write_classlist( title, intro, classlist ) +{ + text = '<h3>'+title+'</h3>'; + text += intro; + text += '<ul>\n'; + + var hrefroot = ''; + for ( var i = 0; i < classlist.length; i++ ) + { + text += '<li>'; + var href = classlist[i].toLowerCase() + '.html'; + href = href.replace( /.*::/, '' ); + + var name = classlist[i]; + text += '<a href="' + hrefroot + href + '">' + name + '</a>\n'; + } + text += '</ul>\n'; + + return text; +} + +function write_classes( title, desc, sections ) +{ + var txt = desc; + for ( var i = 0; i < sections.length; i += 3 ) { + txt += write_classlist( sections[ i ], sections[ i+1 ], sections[ i+2 ] ); + } + + return write_page( title, txt ); +} + +function generate_docs_object( name, obj ) +{ + var fileText = write_page( name, + 'Bindings for the ' + name + ' class.<br />' + dump(obj) ); + System.writeFile("jsref/" + name.toLowerCase() + ".html", fileText); +} + +function generate_docs_nocreate( name ) +{ + var fileText = write_page( name, + 'Bindings for the ' + name + ' class.<br />' + + 'This class is understood by the interpreter, but cannot be created from scripts.' ); + + System.writeFile("jsref/" + name.toLowerCase() + ".html", fileText); +} + +// +// Document the static objects +// +function document_statics( statics ) +{ + for ( var idx = 0; idx < statics.length; idx++ ) { + var name = statics[idx]; + try + { + var obj = eval( name ); + var fileText = write_page( name, + 'Bindings for the static ' + name + ' object.' + dump(obj) ); + System.writeFile("jsref/" + name.toLowerCase() + ".html", fileText); + } + catch(x) + { + println("Error: " + x ); + } + } +} + +// +// Build script that will document the constructable objects +// + +function document_constructable( objects ) +{ + for ( var idx = 0; idx < objects.length; idx++ ) + { + println('Document class: ' + objects[idx] ); + + try { + generate_docs_object( objects[idx], Factory.createObject( objects[idx] )); + println(', Success'); + } + catch(x) { + println(', Error ' + x ); + generate_docs_nocreate( objects[idx] ); + nocreate.push( objects[idx] ); + } + } +} +//// +//// Main +//// + + +var statics = [ 'Factory', 'System', 'Global', 'StdDialog', + 'StdAction', 'StdDirs', 'StdIcons', 'Qt' ]; +qttps = []; +kdetps = []; +kjsetps = []; +other = []; +nocreate = []; +var expts = [ 'ReferenceError', 'EvalError', 'RangeError', 'TypeError' ]; +tps = Factory.types().sort(); + +statics.sort(); +expts.sort(); + +cons = Factory.constructors().sort(); +cons += 'Part'; + +for ( var i=0; i < tps.length; i++ ) { + + if ( /^Q/.test(tps[i]) ) { + qttps.push( tps[i] ); + } + else if ( /^KJSEmbed::/.test(tps[i]) ) { + if ( tps[i] != 'KJSEmbed::Bindings::JSDCOPInterface' ) { + kjsetps.push( tps[i] ); + } + } + else if ( /^K/.test(tps[i]) ) { + kdetps.push( tps[i] ); + } + else { + other.push( tps[i] ); + } +} + +// +// Generate object reference pages +// + +document_constructable( tps ); +document_statics( statics ); +document_statics( expts ); + +generate_docs_object( 'TextStream', System.stdin ); +generate_docs_object( 'Application', application ); +generate_docs_object( 'KJSEmbedPart', part ); +generate_docs_object( 'QListViewItem', new QListViewItem(new QListView()) ); +generate_docs_object( 'QCheckListItem', new QCheckListItem(new QListView()) ); +generate_docs_object( 'QCanvasText', new QCanvasText(new QCanvas()) ); + +other.push( 'Application' ); +other.sort(); + +// +// Generate index pages +// +index = [ 'Static Objects', + 'Statics that are available to scripts as JS objects.', + statics, + + 'Object Types', + 'The non-widget objects that are defined for scripts.', + other, + + 'KJSEmbed Objects', + 'KDE objects that are available to scripts as JS objects.', + kjsetps, + + 'Qt Objects', + 'Qt objects that are available to scripts as JS objects.', + qttps, + + 'KDE Objects', + 'KDE objects that are available to scripts as JS objects.', + kdetps, + + 'Exception Types', + 'Exceptions that are defined for scripts.', + expts, + + 'Unconstructable Types', + 'Known type that scripts cannot create.', + nocreate + ]; + +System.writeFile( "jsref/index.html", + write_classes( 'All Scriptable Objects', + 'The full set of objects that can be accessed by scripts.', + index ) ); + +System.writeFile( "jsref/index-static.html", write_classes( index[0], index[1], ['','',index[2]] ) ); +System.writeFile( "jsref/index-objects.html", write_classes( index[3], index[4], ['','',index[5]] ) ); +System.writeFile( "jsref/index-kjsembedobjects.html", write_classes( index[6], index[7], ['','',index[8]] ) ); +System.writeFile( "jsref/index-qtobjects.html", write_classes( index[9], index[10], ['','',index[11]] ) ); +System.writeFile( "jsref/index-kdeobjects.html", write_classes( index[12], index[13], ['','',index[14]] ) ); +System.writeFile( "jsref/index-exceptions.html", write_classes( index[15], index[16], ['','',index[17]] ) ); +System.writeFile( "jsref/index-nocreate.html", write_classes( index[18], index[19], ['','',index[20]] ) ); + +System.exit(0); diff --git a/kjsembed/docs/build-docs.sh b/kjsembed/docs/build-docs.sh new file mode 100755 index 00000000..815fead4 --- /dev/null +++ b/kjsembed/docs/build-docs.sh @@ -0,0 +1,87 @@ +#!/bin/sh -x + +# Settings +JS='../kjscmd --noexec' +REF='jsref' + +# Examples and changelog +(cd examples ; w3m -dump index.html > README) + +# Constructor Index +$JS write_classes.js > $REF/classes.html + +# Constructor Index +$JS write_widgets.js > $REF/widgets.html + +# Global Objects +$JS write_docs.js 'this' 'this' 'Default context scripts are executed in.' > $REF/this.html + +$JS write_docs.js 'Global' 'global' 'The global object.' > $REF/global.html +$JS write_docs.js 'Application' 'application' 'Global application object.' > $REF/application.html +$JS write_docs.js 'Part' 'part' 'Part used by the interpreter.' > $REF/part.html +$JS write_docs.js 'StdDirs' 'StdDirs' 'Provides access to KStandardDirs.' > $REF/stddirs.html +$JS write_docs.js 'StdIcons' 'StdIcons' 'Provides access to the KIconLoader.' > $REF/stdicons.html + +# Custom Objects +$JS write_docs.js 'Image' 'new Image()' 'Bindings to the QImage class.' > $REF/image.html +$JS write_docs.js 'Pixmap' 'new Pixmap()' 'Bindings to the QPixmap class.' > $REF/pixmap.html +$JS write_docs.js 'Painter' 'new Painter()' 'Bindings for painting on Pixmaps.' > $REF/painter.html +$JS write_docs.js 'NetAccess' 'new NetAccess()' 'Bindings for KIO::NetAccess.' > $REF/netaccess.html +$JS write_docs.js 'DCOPObject' 'new DCOPObject()' 'Provides support for DCOP.' > $REF/dcop.html +$JS write_docs.js 'SqlDatabase' 'new SqlDatabase()' 'Provides support for QtSQL Databases.' > $REF/sqldatabase.html +$JS write_docs.js 'SqlQuery' 'new SqlQuery()' 'Provides support for QtSQL Queries.' > $REF/sqlquery.html +$JS write_docs.js 'TextStream' 'System.stdin' 'Bindings for QTextSteam.' > $REF/textstream.html +$JS write_docs.js 'Config' 'new Config()' 'Bindings to the KConfig class.' > $REF/config.html + +# Qt Objects +OBJECTS="QPushButton QToolButton QCheckBox QRadioButton" +OBJECTS="$OBJECTS QGroupBox QButtonGroup QIconView QTable" +OBJECTS="$OBJECTS QListBox QListView QLineEdit QSpinBox" +OBJECTS="$OBJECTS QMultiLineEdit QLabel TextLabel PixmapLabel" +OBJECTS="$OBJECTS QLayoutWidget QTabWidget QComboBox" +OBJECTS="$OBJECTS QWidget QDialog QWizard QLCDNumber" +OBJECTS="$OBJECTS QProgressBar QTextView QTextBrowser" +OBJECTS="$OBJECTS QDial QSlider QFrame Line QTextEdit" +OBJECTS="$OBJECTS QDateEdit QTimeEdit QDateTimeEdit QScrollBar" +OBJECTS="$OBJECTS QPopupMenu QWidgetStack QMainWindow" +OBJECTS="$OBJECTS QDataTable QDataBrowser QDataView" +OBJECTS="$OBJECTS QVBox QHBox QGrid" + +for OBJ in $OBJECTS ; +do + FILENAME=`echo $OBJ | tr '[A-Z]' '[a-z]'` + $JS write_docs.js "$OBJ" "new $OBJ()" "Bindings for a $OBJ." > "$REF/$FILENAME.html" ; +done + +OBJECTS="" + +OBJECTS="$OBJECTS KActiveLabel KCharSelect KColorButton KColorCombo" +OBJECTS="$OBJECTS KComboBox KCModule KDateWidget KDatePicker KDialog" +OBJECTS="$OBJECTS KDualColorButton KEditListBox KFontCombo KGradientSelector" +OBJECTS="$OBJECTS KHistoryCombo KHSSelector KLed KListBox KListView" +OBJECTS="$OBJECTS KLineEdit KPasswordEdit KProgress KPushButton" +OBJECTS="$OBJECTS KRestrictedLine KIconButton KIntSpinBox KRuler" +OBJECTS="$OBJECTS KSqueezedTextLabel KTextBrowser KTextEdit" +OBJECTS="$OBJECTS KURLLabel KURLRequester" +OBJECTS="$OBJECTS KIntNumInput KDoubleNumInput KDoubleSpinBox" + +for OBJ in $OBJECTS ; +do + FILENAME=`echo $OBJ | tr '[A-Z]' '[a-z]'` + $JS write_docs.js "$OBJ" "new $OBJ()" "Bindings for a $OBJ." > "$REF/$FILENAME.html" ; +done + + +OBJECTS="$OBJECTS QSplitter" +OBJECTS="$OBJECTS QObject QTimer" + +OBJECTS="$OBJECTS KMainWindow KAction KToggleAction" + +for OBJ in $OBJECTS ; +do + FILENAME=`echo $OBJ | tr '[A-Z]' '[a-z]'` + $JS write_docs.js "$OBJ" "new $OBJ()" "Bindings for a $OBJ." > "$REF/$FILENAME.html" ; +done + + + diff --git a/kjsembed/docs/changes.html b/kjsembed/docs/changes.html new file mode 100644 index 00000000..853b71c2 --- /dev/null +++ b/kjsembed/docs/changes.html @@ -0,0 +1,11 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed ChangeLog</title> +</head> +<body bgcolor="#eeeeee"> +<div align="right"><a href="ChangeLog">Change Log (text version)</a></div> +<h1>KJSEmbed ChangeLog</h1> +<embed src="ChangeLog" width="100%" height="90%"> +</body> +</html> diff --git a/kjsembed/docs/classdocs/dummy.txt b/kjsembed/docs/classdocs/dummy.txt new file mode 100644 index 00000000..8d1c8b69 --- /dev/null +++ b/kjsembed/docs/classdocs/dummy.txt @@ -0,0 +1 @@ + diff --git a/kjsembed/docs/conventions.html b/kjsembed/docs/conventions.html new file mode 100644 index 00000000..32d88440 --- /dev/null +++ b/kjsembed/docs/conventions.html @@ -0,0 +1,28 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed Documentation Conventions</title> +</head> +<body> +<h1>KJSEmbed Documentation Conventions</h1> +<hr> +The conventions used by these documents are illustrated in the table +below. +<br><br> +<center> +<table> +<tr><th class="indextitle">Notation</th> +<th class="indextitle">Meaning</th></tr> +<tr><td class="indexkey">'a value'</td> +<td class="indexvalue">Indicates a String value.</td></tr> +<tr><td class="indexkey">[a,b..]</td> +<td class="indexvalue">Indicates an Array value.</td></tr> +<tr><td class="indexkey">obj.prop</td> +<td class="indexvalue">Indicates that a value will be taken from the +property 'prop' of the Object 'obj'.</td></tr> +</table> +</center> + +<hr> +</body> +</html> diff --git a/kjsembed/docs/embedding/Makefile.am b/kjsembed/docs/embedding/Makefile.am new file mode 100644 index 00000000..13c617f2 --- /dev/null +++ b/kjsembed/docs/embedding/Makefile.am @@ -0,0 +1,2 @@ + +SUBDIRS=simple-embed diff --git a/kjsembed/docs/embedding/qtembed/main.cpp b/kjsembed/docs/embedding/qtembed/main.cpp new file mode 100644 index 00000000..b2d7d3d1 --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/main.cpp @@ -0,0 +1,18 @@ +// +// Author: Ian Reinhart Geiser <geiseri@kde.org>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <qapplication.h> +#include "posviewimp.h" + +int main ( int argc, char ** argv ) +{ + QApplication app( argc, argv ); + POSViewImp *view = new POSViewImp; + app.setMainWidget(view); + view->show(); + return app.exec(); +} diff --git a/kjsembed/docs/embedding/qtembed/posviewbase.ui b/kjsembed/docs/embedding/qtembed/posviewbase.ui new file mode 100755 index 00000000..9d8bad1a --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/posviewbase.ui @@ -0,0 +1,183 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>POSViewBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>POSViewBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>492</width> + <height>298</height> + </rect> + </property> + <property name="caption"> + <string>Point of Sale v1.0</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>appFrame</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Recipt</string> + </property> + </widget> + <widget class="QTextBrowser"> + <property name="name"> + <cstring>recipt</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="textFormat"> + <enum>LogText</enum> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>POSViewBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>POSViewBase</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/embedding/qtembed/posviewimp.cpp b/kjsembed/docs/embedding/qtembed/posviewimp.cpp new file mode 100644 index 00000000..7d4aebc9 --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/posviewimp.cpp @@ -0,0 +1,30 @@ +// +// Author: Ian Reinhart Geiser <geiseri@kde.org>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "posviewimp.h" + +#include <kjsembed/kjsembedpart.h> +#include <kjsembed/jsconsolewidget.h> +#include <kjsembed/jsbinding.h> + +#include <qgroupbox.h> +#include <qdatetime.h> +#include <qcolor.h> + +POSViewImp::POSViewImp(QWidget *parent, const char *name) + :POSViewBase(parent, name) +{ + m_part = new KJSEmbed::KJSEmbedPart(0, "kjsembed_part", this,"JSEmbed"); + m_part->addObject(appFrame, "appFrame"); + loadScript(); +} + +void POSViewImp::loadScript() +{ + m_part->runFile("test.js", m_part->globalObject() ); +} + + diff --git a/kjsembed/docs/embedding/qtembed/posviewimp.h b/kjsembed/docs/embedding/qtembed/posviewimp.h new file mode 100644 index 00000000..3fce0965 --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/posviewimp.h @@ -0,0 +1,26 @@ +// +// Author: Ian Reinhart Geiser <geiseri@kde.org>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef POSVIEWIMP_H +#define POSVIEWIMP_H + +#include "posviewbase.h" +namespace KJSEmbed { + class KJSEmbedPart; +}; + +class POSViewImp: public POSViewBase { + Q_OBJECT +public: + POSViewImp( QWidget *parent = 0, const char *name = 0 ); + +public slots: + void loadScript(); +private: + KJSEmbed::KJSEmbedPart *m_part; +}; + +#endif diff --git a/kjsembed/docs/embedding/qtembed/qtembed.pro b/kjsembed/docs/embedding/qtembed/qtembed.pro new file mode 100755 index 00000000..5b0f4c6b --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/qtembed.pro @@ -0,0 +1,12 @@ +include( ../../../qjsembed.pri ) +TEMPLATE = app + +# Input +HEADERS += posviewimp.h +INTERFACES += posviewbase.ui +SOURCES += main.cpp posviewimp.cpp + + +LIBS += -L../../../bin -lqjsembed +INCLUDEPATH += ../../../.. ../../.. + diff --git a/kjsembed/docs/embedding/qtembed/test.js b/kjsembed/docs/embedding/qtembed/test.js new file mode 100644 index 00000000..7a5c3bc0 --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/test.js @@ -0,0 +1,3 @@ +var vbox = new QVBoxLayout( appFrame ); +var view = Factory.loadui("view.ui", appFrame, appFrame ); +view.show();
\ No newline at end of file diff --git a/kjsembed/docs/embedding/qtembed/view.ui b/kjsembed/docs/embedding/qtembed/view.ui new file mode 100755 index 00000000..c714ff00 --- /dev/null +++ b/kjsembed/docs/embedding/qtembed/view.ui @@ -0,0 +1,85 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>view</class> +<widget class="QWidget"> + <property name="name"> + <cstring>view</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>285</width> + <height>197</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>mSKU</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>mPrice</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>SKU:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Price:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Product:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>mProduct</cstring> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>mImage</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/embedding/simple-embed/Makefile.am b/kjsembed/docs/embedding/simple-embed/Makefile.am new file mode 100644 index 00000000..44607f91 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/Makefile.am @@ -0,0 +1,40 @@ +## Makefile.am for embedjs + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = embedjs + +# set the include path for X, qt and KDE +INCLUDES = -I$(top_srcdir) $(all_includes) + +# the library search path. +embedjs_LDFLAGS = $(KDE_RPATH) $(all_libraries) + +# the libraries to link against. +embedjs_LDADD = $(LIB_KFILE) $(LIB_KDEPRINT) -lkjs $(top_builddir)/kjsembed/libkjsembed.la + +# which sources should be compiled for embedjs +embedjs_SOURCES = main.cpp embedview.ui embedviewimp.cpp + +# these are the headers for your project + + +# client stuff + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/embedjs.pot + +KDE_ICON = embedjs + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = embedjs.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/embedjs +rc_DATA = embedjsui.rc +noinst_HEADERS = embedviewimp.h +noinst_DATA = test.js diff --git a/kjsembed/docs/embedding/simple-embed/README b/kjsembed/docs/embedding/simple-embed/README new file mode 100644 index 00000000..f04a5635 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/README @@ -0,0 +1,81 @@ +----------------------------------------------- +Kde application framework template quickstart +Author: Thomas Nagy +Date: 2004-03-22 +----------------------------------------------- + +This README file explains you basic things for starting with +this application template. + + +** Building and installing ** + +* Build the configure script by "make -f Makefile.cvs" + +* To clean, use "make clean", and to clean everything +(remove the makefiles, etc), use "make distclean" + +* To distribute your program, try "make dist". +This will make a compact tarball archive of your release with the +necessary scripts inside. + +* Modifying the auto-tools scripts +for automake scripts there is an excellent tutorial there : +http://developer.kde.org/documentation/other/makefile_am_howto.html + +* Simplify your life : install the project in your home directory for +testing purposes. +./configure --prefix=/home/user/dummyfolder/ +In the end when you finished the development you can +rm -rf /home/user/dummyfolder/ +without fear. + + +** Technologies ** + +* Build the menus of your application easily +kde applications now use an xml file (*ui.rc file) to build the menus. +This allow a great customization of the application. However, when +programming the menu is shown only after a "make install" + +For more details, consult : +http://devel-home.kde.org/~larrosa/tutorial/p9.html +http://developer.kde.org/documentation/tutorials/xmlui/preface.html + +* Use KConfig XT to create your configuration dialogs and make +them more maintainable. + +For more details, consult : +http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html + +* With KParts, you can embed other kde components in your program, or make your program +embeddable in other apps. For example, the kmplayer kpart can be called to play videos +in your app. + +For more details, consult : +http://www-106.ibm.com/developerworks/library/l-kparts/ +http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html +http://developer.kde.org/documentation/tutorials/developing-a-plugin-structure/index.html + +* With dcop, you can control your app from other applications +Make sure to include K_DCOP and a kdcop: section in your .h file +http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html + + +** Documentation ** + +* For the translations : +1. Download a patched gettext which can be found at: + http://public.kde.planetmirror.com/pub/kde/devel/gettext-kde/ +2. Install that gettext in ~/bin/ +3. cd ~/yourproject, export PATH=~/bin:$PATH, export +KDEDIR=/where_your_KDE3_is +4. make -f admin/Makefile.common package-messages +5. make package-messages +6. Translate the po files (not the pot!!) with kbabel or xemacs + +* Do not forget to write the documentation for your kde app +edit the documentation template index.docbook in doc/ + + + diff --git a/kjsembed/docs/embedding/simple-embed/demo.html b/kjsembed/docs/embedding/simple-embed/demo.html new file mode 100644 index 00000000..8b8f236e --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/demo.html @@ -0,0 +1,93 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed Documentation</title> +</head> +<body> +<h1>KJSEmbed Documentation</h1> +<hr> + +<h3>Introduction</h3> + +The KJSEmbed library is an easy-to-use wrapper around the KDE +ECMAScript interpreter (kjs) that makes it easy to add scriptability +to an application. The kjsembed library is distributed in the +kdebindings module of KDE. This library provides a binding between +Qt/KDE applications and KJS. + +<h3>Discussion Forums</h3> + +There is now a KJSEmbed mailing list, see +<a href="http://mail.kde.org/mailman/listinfo/kjsembed">http://mail.kde.org/mailman/listinfo/kjsembed</a> +for more information about the list. In addition to the mailing list, +KJSEmbed is discussed on the #kaxul IRC channel (on the freenode IRC network). + +<h3>Learning KJSEmbed</h3> + +An introduction to KJSEmbed. The example scripts demonstrate the use +of all the major objects, and even provides some useful tools. The +tutorial provides a basic introduction to using KJSEmbed, though it is +a little out of date. + +<ul> + <li><b><a href="examples/index.html">Examples</a></b><br> + Example scripts showing how to use KJSEmbed.</li> + <li><b><a href="tutorial">Tutorial</a></b><br> + A tutorial for the library. NOTE: Some of the info here is out of date, see the + examples for cleaner ways to do things.</li> + <li><b><a href="ChangeLog">ChangeLog</a></b><br> + A log of the change history generated from CVS commit messages.</li> + <li><b><a href="TODO">TODO</a></b><br> + The todo list for KJSEmbed.</li> +</ul> + +<h3>Reference Information</h3> + +A reference manual for both the C++ and Javascript APIs defined by +KJSEmbed. The C++ API is of interest to developers looking to adding +scripting to support to their applications, the JS API is for people +who want to write scripts. + +<h4>JavaScript API</h4> +<ul> + <li><b><a href="types.html">KJSEmbed Type Reference</a></b><br> + Documents the custom data types KJSEmbed uses to represent complex types. + <li><b><a href="jsref/index.html">KJSEmbed Class Reference</a></b><br> + Documents the types of object scripts are allowed to create. + <li><b><a href="jsref">KJSEmbed Scripting Reference</a></b><br> + Partial reference to the API available to scripts.</li> +</ul> + +<h4>Host API</h4> +<ul> + <li><b><a href="classdocs/index.html">KJSEmbed Native API Reference</a> (C++)</b><br> + Reference manual for the C++ API of the KJSEmbed library.</li> +</ul> + +<h3>Appendices</h3> +<ul> + <li><b><a href="conventions.html">Document Conventions</a></b><br> + Explains the typographical conventions used by the documents.</li> + + <li><b><a href="kjsembed-qsa.html">KJSEmbed and QSA</a></b><br> + Discusses the differences between KJSEmbed and QSA.</li> +</ul> + +<h3>References</h3> +<ul> + <li><b><a href="http://www.mozilla.org/js/language/">Mozilla Javascript Resources</a></b><br> + Mozilla's Javascript resources page, includes links to the various + releases of the ECMA-262 specification that define the language. + </li> + <li><b><a href="http://www.kevlindev.com/tutorials/javascript/inheritance/">Inheritance in Javascript</a></b><br> + A tutorial on how to implement inheritence in JavaScript. + </li> + <li><b><a href="http://doc.trolltech.com/qsa/">Qt Script for Applications Documentation</a></b><br> + The documentation for QSA, this is Trolltech's ECMAScript binding + for Qt. + </li> +</ul> + +<hr> +</body> +</html> diff --git a/kjsembed/docs/embedding/simple-embed/embedjs.desktop b/kjsembed/docs/embedding/simple-embed/embedjs.desktop new file mode 100644 index 00000000..19629691 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/embedjs.desktop @@ -0,0 +1,29 @@ +[Desktop Entry] +Name=EmbedJS +Name[xx]=xxEmbedJSxx +Exec=embedjs %i %m -caption "%c" +Icon=embedjs +Categories=Qt;KDE;Debugger;Development; +Type=Application +DocPath=embedjs/embedjs.html +Comment=A KDE KPart Application +Comment[ca]=Una aplicació KPart per a KDE +Comment[da]=Et KDE KPart program +Comment[de]=Eine KDE-Komponenten-Anwendung +Comment[el]=Μια εφαρμογή KPart του KDE +Comment[es]=Una aplicación KPart de KDE +Comment[et]=KDE KPart rakendus +Comment[fr]=Une application KPart pour KDE. +Comment[hu]=KPart-alapú KDE-alkalmazás +Comment[it]=Applicazione KPart di KDE +Comment[nl]=Een KDE KPart-toepassing +Comment[pt]=Uma aplicação KPart do KDE +Comment[pt_BR]=Um Aplicativo KPart do KDE +Comment[ru]=Приложение KPart для KDE +Comment[sl]=Program KPart za KDE +Comment[sr]=KDE KPart програм +Comment[sv]=Ett KDE Kpart-program +Comment[ta]=கெடி கெபார்ட் பயன்பாடு +Comment[xx]=xxA KDE KPart Applicationxx +Comment[zh_CN]=一个KDE KPart应用程序 +Terminal=false diff --git a/kjsembed/docs/embedding/simple-embed/embedjs.lsm b/kjsembed/docs/embedding/simple-embed/embedjs.lsm new file mode 100644 index 00000000..c4955cbd --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/embedjs.lsm @@ -0,0 +1,16 @@ +Begin3 +Title: EmbedJS -- Some description +Version: 0.1 +Entered-date: +Description: +Keywords: KDE Qt +Author: Richard Moore <rich@kde.org> +Maintained-by: Richard Moore <rich@kde.org> +Home-page: +Alternate-site: +Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils + xxxxxx embedjs-0.1.tar.gz + xxx embedjs-0.1.lsm +Platform: Linux. Needs KDE +Copying-policy: LGPL +End diff --git a/kjsembed/docs/embedding/simple-embed/embedjsui.rc b/kjsembed/docs/embedding/simple-embed/embedjsui.rc new file mode 100644 index 00000000..b7138c3b --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/embedjsui.rc @@ -0,0 +1,14 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="embedjs" version="1"> +<MenuBar> + <Menu name="tools"><text>&Tools</text> + <Action name="word_count" /> + </Menu> + <Menu name="settings"><text>&Settings</text> + <Action name="show_console" /> + </Menu> + <Menu name="custom"><text>C&ustom</text> + <Action name="custom_action" /> + </Menu> +</MenuBar> +</kpartgui> diff --git a/kjsembed/docs/embedding/simple-embed/embedview.ui b/kjsembed/docs/embedding/simple-embed/embedview.ui new file mode 100644 index 00000000..43be65ab --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/embedview.ui @@ -0,0 +1,183 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>EmbedView</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Title:</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_dept</cstring> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>m_name</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Department:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_title</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>m_customOptions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Custom Options</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_console</cstring> + </property> + <property name="text"> + <string>Console</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="stdItem" stdset="0"> + <number>0</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>280</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_ok</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="stdItem" stdset="0"> + <number>1</number> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_cancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="stdItem" stdset="0"> + <number>2</number> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>m_ok</sender> + <signal>clicked()</signal> + <receiver>Form1</receiver> + <slot>okClicked()</slot> + </connection> + <connection> + <sender>m_cancel</sender> + <signal>clicked()</signal> + <receiver>Form1</receiver> + <slot>cancelClicked()</slot> + </connection> + <connection> + <sender>m_console</sender> + <signal>clicked()</signal> + <receiver>Form1</receiver> + <slot>consoleClicked()</slot> + </connection> +</connections> +<slots> + <slot>okClicked()</slot> + <slot>cancelClicked()</slot> + <slot>consoleClicked()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/embedding/simple-embed/embedviewimp.cpp b/kjsembed/docs/embedding/simple-embed/embedviewimp.cpp new file mode 100644 index 00000000..a1355909 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/embedviewimp.cpp @@ -0,0 +1,78 @@ +// +// Author: Ian Reinhart Geiser <geiseri@kde.org>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <kjsembed/kjsembedpart.h> +#include <kjsembed/jsconsolewidget.h> +#include <kjsembed/jsbinding.h> + +#include "embedviewimp.h" +#include <klineedit.h> +#include <qgroupbox.h> + +#include <qdatetime.h> +#include <qcolor.h> + +EmbedViewImp::EmbedViewImp(QWidget *parent, const char *name) + :EmbedView(parent, name) +{ + m_part = new KJSEmbed::KJSEmbedPart(0, "kjsembed_part", this,"JSEmbed"); + m_part->addObject(m_name, "Name"); + m_part->addObject(m_dept, "Dept"); + m_part->addObject(m_title, "Title"); + m_part->addObject(m_customOptions, "CustomOptions"); + m_part->addObject(this, "EmbedInterface"); +} + +void EmbedViewImp::okClicked() +{ + KJS::List args; + KJS::Value val = m_part->callMethod("handleOk", args); + QMap<QString, QVariant> personalData = KJSEmbed::convertToVariant(m_part->globalExec(), val).toMap(); + QDate birthday = personalData["birthday"].toDate(); + QColor eyecolor = personalData["eyeColor"].toColor(); + QString notes = personalData["notes"].toString(); + + kdDebug() << "birthday: " << birthday << endl; + kdDebug() << "eyecolor: " << eyecolor << endl; + kdDebug() << "notes: " << notes << endl; + +} + +void EmbedViewImp::cancelClicked() +{ + m_name->setText(""); + m_title->setText(""); + m_dept->setText(""); +} + +void EmbedViewImp::consoleClicked() +{ + m_part->view()->setHidden(!m_part->view()->isHidden()); +} + +bool EmbedViewImp::runScript( const QString &file ) +{ + return m_part->runFile(file, m_part->globalObject() ); +} + +QVariant EmbedViewImp::someValue() const +{ + QMap<QString,QVariant> returnMap; + returnMap["name"] = m_name->text(); + returnMap["title"] = m_title->text(); + returnMap["dept"] = m_dept->text(); + return QVariant(returnMap); +} + +void EmbedViewImp::setSomeValue( const QVariant &val ) +{ + QMap<QString,QVariant> map = val.toMap(); + m_name->setText(map["name"].toString()); + m_title->setText(map["title"].toString()); + m_dept->setText(map["dept"].toString()); +} + +#include "embedviewimp.moc" diff --git a/kjsembed/docs/embedding/simple-embed/embedviewimp.h b/kjsembed/docs/embedding/simple-embed/embedviewimp.h new file mode 100644 index 00000000..c56f078c --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/embedviewimp.h @@ -0,0 +1,34 @@ +// +// Author: Ian Reinhart Geiser <geiseri@kde.org>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EMBEDVIEWIMP_H +#define EMBEDVIEWIMP_H + +#include "embedview.h" +namespace KJSEmbed { + class KJSEmbedPart; +} + +class EmbedViewImp: public EmbedView { + Q_OBJECT + +public: + EmbedViewImp( QWidget *parent = 0, const char *name = 0 ); + + bool runScript( const QString &file ); + +public slots: + virtual void cancelClicked(); + virtual void okClicked(); + virtual void consoleClicked(); + + QVariant someValue() const; + void setSomeValue( const QVariant &var ); +private: + KJSEmbed::KJSEmbedPart *m_part; +}; + +#endif diff --git a/kjsembed/docs/embedding/simple-embed/hi16-app-embedjs.png b/kjsembed/docs/embedding/simple-embed/hi16-app-embedjs.png Binary files differnew file mode 100644 index 00000000..4ed606c1 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/hi16-app-embedjs.png diff --git a/kjsembed/docs/embedding/simple-embed/hi32-app-embedjs.png b/kjsembed/docs/embedding/simple-embed/hi32-app-embedjs.png Binary files differnew file mode 100644 index 00000000..45ae1a11 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/hi32-app-embedjs.png diff --git a/kjsembed/docs/embedding/simple-embed/main.cpp b/kjsembed/docs/embedding/simple-embed/main.cpp new file mode 100644 index 00000000..74c5d241 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/main.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2004 by Richard Moore * + * rich@kde.org * + * * + * This program 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 program 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 General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "embedviewimp.h" +#include <kapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <klocale.h> + +static const char description[] = + I18N_NOOP("A KDE Application"); + +static const char version[] = "0.1"; + +int main(int argc, char **argv) +{ + KAboutData about("embedjs", I18N_NOOP("EmbedJS"), version, description, + KAboutData::License_LGPL, "(C) 2004 Ian Reinhart Geiser", 0, 0, "geiseri@kde.org"); + about.addAuthor( "Ian Reinhart Geiser", 0, "geiseri@kde.org" ); + KCmdLineArgs::init(argc, argv, &about); + KApplication app; + + EmbedViewImp *view = new EmbedViewImp; + app.setMainWidget(view); + view->show(); + view->runScript("test.js"); + return app.exec(); +} diff --git a/kjsembed/docs/embedding/simple-embed/test.js b/kjsembed/docs/embedding/simple-embed/test.js new file mode 100644 index 00000000..2511a465 --- /dev/null +++ b/kjsembed/docs/embedding/simple-embed/test.js @@ -0,0 +1,37 @@ +#!/usr/bin/env kjsembed + +CustomOptions.orientation = Qt.Vertical; +CustomOptions.columns = 1; + +var box = new QVBox(CustomOptions); +var row1 = new QHBox(box); +var dateLabel = new QLabel(row1); +dateLabel.text = "Birthday:"; +var birthday = new KDateWidget(row1); + +var row2 = new QHBox(box); +var eyeLabel = new QLabel(row2); +eyeLabel.text = "Eye color:"; +var eyeColor = new KColorButton(row2); + +var row3 = new QHBox(box); +var notes = new KTextEdit(row3); + +box.show(); + +function handleOk() +{ + var personelData = []; // make this an array so it will convert properly + personelData = {birthday:birthday.date, eyeColor:eyeColor.color, notes:notes.text }; +// personelData[birthday] = birthday.date; +// personelData[eyeColor] = eyeColor.color; +// personelData[notes] = notes.text; + return personelData; +} + +function handleCancel() +{ + notes.text = ""; +} + + diff --git a/kjsembed/docs/examples/README b/kjsembed/docs/examples/README new file mode 100644 index 00000000..db1e2e37 --- /dev/null +++ b/kjsembed/docs/examples/README @@ -0,0 +1,67 @@ +KJSEmbed Examples + +This directory contains a number of example files that illustrate the various +features of KJSEmbed. + +Demos + +This section contains examples that show how the features of KJSEmbed can be +combined to create useful tools. + +ButtonMaker An application for creating buttons for web sites. +EnvelopeMaker An application for creating printed envelopes. +xmlgui Creates a complete KDE GUI shell using XMLGUI and KStdAction. +readonlypart A simple web browser that embeds KHTMLPart. +readwritepart Shows how to embed a read-write KPart. +calc A simple calculator application. +grepdialog Loads .ui files to provide a GUI for grep. +docviewer KJSEmbed documentation browser. +SAX Demos that show how to use the SAX API from JS. +DCOP Using DCOP from scripts. +Command Line An interactive command-line prompt for KJSEmbed implemented as a + script. + +Advanced Demos + +This section contains examples that illustrate some of the more advanced +features of KJSEmbed. + +htmlinfo Reports information about an HTML file. +imageinfo Various scripts using the Image builtin object. +html2text Uses the KParts::Plugin to extend KWrite. +eventhandling Two demos that show off event handling, including the standard + scribble demo. +SQL Support Accessing SQL databases. + +Examples + +This section contains examples that illustrate particular KJSEmbed facilities. + +customwidget Creates a simple form directly from Javascript. +treeview Two examples that create a graphical tree. One from a JS + data structure, the other from the widget tree of a ui file. +qobject-dom Illustrates the QObject DOM API. +connect-cpp Connects a signal to slot. +connect Connects signals of various types to JS methods. +imageviewer Illustrates the use of QPixmap values. +netaccess Illustrates the bindings to KIO::NetAccess. +listview Creates a simple KListView. +frame Shows off QFrame support and the use of enums. +timer Creates a flashing LED using QTimer. +Actions A simple KAction demo. +Built-In Messages Demonstrates the built-in message dialogs. +Image Tweak Tweaking images. +Image Fun More fun with images +Space Invaders A space invaders game. +JS UIC An easy way to deal with UI files. +Multi-file Scripts Multi-file Scripts. +Opaque Values Opaque types. +Standard Icons Loading standard icons. +QComboBox A simple demo of QComboBox. +Embedding several Shows how to embed multiple parts in the same script. +KParts +Writing data Shows how to send data directly to a part, rather than +directly to a viewing a file. +KPart + +------------------------------------------------------------------------------- diff --git a/kjsembed/docs/examples/actions/simple-actions.js b/kjsembed/docs/examples/actions/simple-actions.js new file mode 100644 index 00000000..121c9d15 --- /dev/null +++ b/kjsembed/docs/examples/actions/simple-actions.js @@ -0,0 +1,19 @@ +#!/usr/bin/env kjscmd + +var mw = new KMainWindow(); + +var view = new KTextEdit(mw); +mw.setCentralWidget( view ); + +mw.open = function() { + System.err.println('open!!!!!!!!!!!!!!!!!!!!!!!!'); +} + +StdAction.quit( mw, 'close()', mw.actionCollection() ); +StdAction.open( 0, 0, mw.actionCollection() ); + + +mw.createGUI("kjscmdui.rc"); +mw.show(); + +application.exec(); diff --git a/kjsembed/docs/examples/builtins/messages.js b/kjsembed/docs/examples/builtins/messages.js new file mode 100755 index 00000000..4fba62bf --- /dev/null +++ b/kjsembed/docs/examples/builtins/messages.js @@ -0,0 +1,8 @@ +#!/usr/bin/env kjscmd + +var text = prompt("Enter some text.", "Some text"); +var cnf = confirm("Did you really mean to enter " + text ); +if ( cnf == 3) { + alert("Good job entering " + text ); +} else + alert("Maby you need to try harder next time."); diff --git a/kjsembed/docs/examples/buttonmaker/01.png b/kjsembed/docs/examples/buttonmaker/01.png Binary files differnew file mode 100644 index 00000000..8866be37 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/01.png diff --git a/kjsembed/docs/examples/buttonmaker/02.png b/kjsembed/docs/examples/buttonmaker/02.png Binary files differnew file mode 100644 index 00000000..d531ab8b --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/02.png diff --git a/kjsembed/docs/examples/buttonmaker/03.png b/kjsembed/docs/examples/buttonmaker/03.png Binary files differnew file mode 100644 index 00000000..e83f9d61 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/03.png diff --git a/kjsembed/docs/examples/buttonmaker/04.png b/kjsembed/docs/examples/buttonmaker/04.png Binary files differnew file mode 100644 index 00000000..2dae0228 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/04.png diff --git a/kjsembed/docs/examples/buttonmaker/05.png b/kjsembed/docs/examples/buttonmaker/05.png Binary files differnew file mode 100644 index 00000000..1a7293e5 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/05.png diff --git a/kjsembed/docs/examples/buttonmaker/06.png b/kjsembed/docs/examples/buttonmaker/06.png Binary files differnew file mode 100644 index 00000000..f5074bc7 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/06.png diff --git a/kjsembed/docs/examples/buttonmaker/07.png b/kjsembed/docs/examples/buttonmaker/07.png Binary files differnew file mode 100644 index 00000000..861253d8 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/07.png diff --git a/kjsembed/docs/examples/buttonmaker/08.png b/kjsembed/docs/examples/buttonmaker/08.png Binary files differnew file mode 100644 index 00000000..c48e10cf --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/08.png diff --git a/kjsembed/docs/examples/buttonmaker/09.png b/kjsembed/docs/examples/buttonmaker/09.png Binary files differnew file mode 100644 index 00000000..7ed0db8d --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/09.png diff --git a/kjsembed/docs/examples/buttonmaker/ButtonMakerUI.ui b/kjsembed/docs/examples/buttonmaker/ButtonMakerUI.ui new file mode 100644 index 00000000..23c30593 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/ButtonMakerUI.ui @@ -0,0 +1,592 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Form1</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>646</width> + <height>456</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>PreviewBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Preview</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>Preview</cstring> + </property> + <property name="text"> + <string>none</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Button text:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>text</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>Text</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>Mode</cstring> + </property> + <property name="title"> + <string>Base Image</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Srcimg</cstring> + </property> + <property name="text"> + <string>Source &image:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>BaseImage</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>81</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_2</cstring> + </property> + <property name="text"> + <string>X scale:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>Xscale</cstring> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4_2</cstring> + </property> + <property name="text"> + <string>Y scale:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>Yscale</cstring> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Pillbox</cstring> + </property> + <property name="text"> + <string>Generate pillbox</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Width:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>Xsize</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maxValue"> + <number>512</number> + </property> + <property name="value"> + <number>128</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Height:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>Ysize</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maxValue"> + <number>512</number> + </property> + <property name="value"> + <number>32</number> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Base color:</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>BaseColor</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string></string> + </property> + <property name="color"> + <color> + <red>0</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>TextBox</cstring> + </property> + <property name="title"> + <string>Text Style</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Font style:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>font</cstring> + </property> + </widget> + <widget class="KFontRequester"> + <property name="name"> + <cstring>Font</cstring> + </property> + <property name="preview"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>Text X offset:</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>XOffset</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_2_2</cstring> + </property> + <property name="text"> + <string>Text Y offset:</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>YOffset</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Text colors:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>textColors</cstring> + </property> + </widget> + <widget class="KDualColorButton"> + <property name="name"> + <cstring>TextColors</cstring> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Shadow offset:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>offset</cstring> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>Offset</cstring> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>Srcimg</sender> + <signal>toggled(bool)</signal> + <receiver>BaseImage</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>Srcimg</sender> + <signal>toggled(bool)</signal> + <receiver>Xscale</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>Srcimg</sender> + <signal>toggled(bool)</signal> + <receiver>Yscale</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>Pillbox</sender> + <signal>toggled(bool)</signal> + <receiver>Ysize</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>Pillbox</sender> + <signal>toggled(bool)</signal> + <receiver>Xsize</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>Pillbox</sender> + <signal>toggled(bool)</signal> + <receiver>BaseColor</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kfontrequester.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kdualcolorbutton.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/buttonmaker/buttonmaker.desktop b/kjsembed/docs/examples/buttonmaker/buttonmaker.desktop new file mode 100644 index 00000000..0e6deaa4 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/buttonmaker.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Exec=kjscmd `kde-config --prefix`/share/apps/buttonmaker/buttonmaker.js +GenericName=Webpage Button Maker +Icon=exec +MimeType= +Name=ButtonMaker +StartupNotify=true +Terminal=false +Type=Application +X-KDE-SubstituteUID=false diff --git a/kjsembed/docs/examples/buttonmaker/buttonmaker.js b/kjsembed/docs/examples/buttonmaker/buttonmaker.js new file mode 100755 index 00000000..ac85b878 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/buttonmaker.js @@ -0,0 +1,266 @@ +#!/usr/bin/env kjscmd + +StdDirs.addResourceType("buttonmaker", StdDirs.kde_default("data") + "/buttonmaker"); + +var imgfx = new ImageFX(); +var win = new KMainWindow(this); + +try { +//var view = Factory.loadui(StdDirs.findResource("buttonmaker", "ButtonMakerUI.ui"), this, win); + var view = Factory.loadui("ButtonMakerUI.ui", this, win); +} +catch(err) +{ + alert( err ); + exit(); +} + +var quitAction = StdAction.quit( 0, 0, win.actionCollection() ); +var saveAction = StdAction.save( 0, 0, win.actionCollection() ); +var newAction = StdAction.fileNew( 0, 0, win.actionCollection() ); + +win.connect( quitAction, 'activated()', this, 'exit'); +win.connect( saveAction, 'activated()', this, 'saveImage'); +win.connect( newAction, 'activated()', this, 'resetView'); + + +win.connect(view.TextBox.Font, 'fontSelected(const QFont&)', this, 'updateUI' ); +win.connect(view.TextBox.TextColors, 'fgChanged(const QColor&)', this, 'updateUI' ); +win.connect(view.TextBox.TextColors, 'bgChanged(const QColor&)', this, 'updateUI' ); +win.connect(view.TextBox.Offset, 'valueChanged(int)', this, 'updateUI' ); +win.connect(view.TextBox.YOffset, 'valueChanged(int)', this, 'updateUI' ); +win.connect(view.TextBox.XOffset, 'valueChanged(int)', this, 'updateUI' ); + +win.connect(view.Text, 'returnPressed(const QString&)', this, 'updateUI'); + +win.connect(view.Mode, 'released(int)', this, 'changeMode'); +win.connect(view.Mode.Xsize, 'valueChanged(int)', this, 'updatePillBox' ); +win.connect(view.Mode.Ysize, 'valueChanged(int)', this, 'updatePillBox' ); +win.connect(view.Mode.BaseColor, 'changed(const QColor&)', this, 'updatePillBox' ); +win.connect(view.Mode.BaseImage, 'urlSelected(const QString&)', this, 'loadImage'); + +win.connect(view.Mode.Xscale, 'valueChanged(int)', this, 'updateUI' ); +win.connect(view.Mode.Yscale, 'valueChanged(int)', this, 'updateUI' ); + +var bgimage = new Pixmap(); +bgimage.resize(16,32); +bgimage.fill("blue"); + +resetView(); + +win.createGUI("buttonmaker.rc"); +win.setCentralWidget(view); +win.setCaption("ButtonMaker"); +win.show(); +application.exec(); + +function CustomPillBox() +{ + this.a = new Image(); + this.b = new Image(); + this.c = new Image(); + this.d = new Image(); + this.e = new Image(); + this.f = new Image(); + this.g = new Image(); + this.h = new Image(); + this.i = new Image(); + + this.height = function() { + return this.a.height() + this.d.height() + this.g.height(); + } + + this.width = function() { + return this.a.width() + this.b.width() + this.c.width(); + } + + this.loadImages = function() { + return ( + this.a.load(StdDirs.findResource("buttonmaker", "01.png")) && + this.b.load(StdDirs.findResource("buttonmaker", "02.png")) && + this.c.load(StdDirs.findResource("buttonmaker", "03.png")) && + this.d.load(StdDirs.findResource("buttonmaker", "04.png")) && + this.e.load(StdDirs.findResource("buttonmaker", "05.png")) && + this.f.load(StdDirs.findResource("buttonmaker", "06.png")) && + this.g.load(StdDirs.findResource("buttonmaker", "07.png")) && + this.h.load(StdDirs.findResource("buttonmaker", "08.png")) && + this.i.load(StdDirs.findResource("buttonmaker", "09.png"))); + } + + this.colorize = function( color ) { + var percent = 0.55; + this.a = imgfx.blendColor( color, this.a, percent); + this.b = imgfx.blendColor( color, this.b, percent); + this.c = imgfx.blendColor( color, this.c, percent); + this.d = imgfx.blendColor( color, this.d, percent); + this.e = imgfx.blendColor( color, this.e, percent); + this.f = imgfx.blendColor( color, this.f, percent); + this.g = imgfx.blendColor( color, this.g, percent); + this.h = imgfx.blendColor( color, this.h, percent); + this.i = imgfx.blendColor( color, this.i, percent); + } + + this.resize = function( newW, newH ) { + + this.b.smoothScale( newW - ( this.a.width() + this.c.width() ), this.b.height() ); + this.h.smoothScale( newW - ( this.g.width() + this.i.width() ), this.h.height() ); + + this.d.smoothScale( this.d.width(), newH - ( this.a.height() + this.g.height() ) ); + this.f.smoothScale( this.f.width(), newH - ( this.c.height() + this.i.height() ) ); + + this.e.smoothScale( newW - ( this.a.width() + this.c.width() ), + newH - ( this.c.height() + this.i.height() ) ); + } + + this.pixmap = function(width, height){ + this.resize(width, height); + var pix = new Pixmap(); + pix.resize(width, height); + pix.fill("white"); + + var painter = new Painter(); + try { + if( painter.begin(pix) ) + { + //painter.drawRect(0,0,this.width(), this.height()); + painter.drawImage(0, 0, this.a, 0, 0, -1, -1, 0); + painter.drawImage(0, this.a.height(), this.d, 0, 0, -1, -1, 0); + painter.drawImage(0, ( this.height() - this.g.height() ) ,this.g, 0, 0, -1, -1, 0); + + painter.drawImage(this.a.width(), 0, this.b, 0, 0, -1, -1, 0); + painter.drawImage(this.d.width(), this.b.height(), this.e, 0, 0, -1, -1, 0); + painter.drawImage(this.g.width(), ( this.height() - this.h.height() ) ,this.h, 0, 0, -1, -1, 0); + + painter.drawImage(this.a.width() + this.b.width(), 0, this.c, 0, 0, -1, -1, 0); + painter.drawImage(this.d.width() + this.e.width(), this.c.height(), this.f, 0, 0, -1, -1, 0); + painter.drawImage(this.g.width() + this.h.width(), ( this.height() - this.i.height() ) ,this.i, 0, 0, -1, -1, 0); + if( painter.end() ) + pix = painter.pixmap(); + } + else + alert("Could not paint to the pixmap."); + } catch (err) { alert(err); } + return pix; + } + +} + +function render(txt, bgimg, font, offset, fgColor, bgColor, xOffset, yOffset) +{ + var h = bgimg.height(); + var w = bgimg.width(); + var fg = new Pen(); + var bg = new Pen(); + fg.setColor(fgColor); + bg.setColor(bgColor); + + var painter = new Painter(); + try { + if (painter.begin(bgimg)) + { + painter.scale( view.Mode.Xscale.value, view.Mode.Yscale.value ); + painter.setPen(bg); + painter.setFont(font); + var box = painter.textBox(txt); + var txtX = (w/2) - (box.width()/2) + xOffset; + var txtY = (h/2) + (box.height()/2) + yOffset; + painter.drawText(txtX+offset,txtY+offset,txt); + painter.setPen(fg); + painter.drawText(txtX,txtY,txt); + painter.end() + return painter.pixmap(); + } + else + alert("Could not paint to the pixmap."); + } catch (err) { alert(err); } + return new Pixmap(); +} + +function changeMode(mode) +{ + if( mode == 0) + { + loadImage(view.Mode.BaseImage.url); + } + else + { + var pb = new CustomPillBox(); + if ( !pb.loadImages() ) + alert("Error Loading Resources!"); + else + { + pb.colorize(view.Mode.BaseColor.color); + bgimage = pb.pixmap(view.Mode.Xsize.value,view.Mode.Ysize.value); + } + updateUI(); + } +} + +function updatePillBox() +{ + var pb = new CustomPillBox(); + if ( !pb.loadImages() ) + alert("Error Loading Resources!"); + else + { + pb.colorize(view.Mode.BaseColor.color); + bgimage = pb.pixmap(view.Mode.Xsize.value,view.Mode.Ysize.value); + } + updateUI(); +} + +function updateUI() +{ + view.PreviewBox.Preview.pixmap = render(view.Text.text, + bgimage, + view.TextBox.Font.font, + view.TextBox.Offset.value, + view.TextBox.TextColors.foreground, + view.TextBox.TextColors.background, + view.TextBox.XOffset.value, + view.TextBox.YOffset.value); + win.adjustSize(); +} + +function saveImage() +{ + var img = new Image(this); + var fileName = StdDialog.getSaveFileName(); + if( fileName != "") + { + var pixmap = render(view.Text.text, + bgimage, + view.TextBox.Font.font, + view.TextBox.Offset.value, + view.TextBox.TextColors.foreground, + view.TextBox.TextColors.background, + view.TextBox.XOffset.value, + view.TextBox.YOffset.value); + img.setPixmap(pixmap); + img.save(fileName); + } +} + +function resetView() +{ + view.TextBox.Offset.value = 1; + if ( application.args.length > 0 ) + view.Text.text = application.args[0]; + else + view.Text.text = ""; + view.TextBox.Font.font = ""; + view.TextBox.TextColors.foreground = "black"; + view.TextBox.TextColors.background = "white"; + view.Mode.BaseImage.url = StdDirs.findResource("buttonmaker", "default.png"); + loadImage(view.Mode.BaseImage.url); +} + +function loadImage(file) +{ + var img = new Image(this); + if (img.load(file) ) + { + bgimage = img.pixmap(); + updateUI(); + } +} diff --git a/kjsembed/docs/examples/buttonmaker/default.png b/kjsembed/docs/examples/buttonmaker/default.png Binary files differnew file mode 100644 index 00000000..6a113a17 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/default.png diff --git a/kjsembed/docs/examples/buttonmaker/gray.png b/kjsembed/docs/examples/buttonmaker/gray.png Binary files differnew file mode 100644 index 00000000..16dc6281 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/gray.png diff --git a/kjsembed/docs/examples/buttonmaker/package.sh b/kjsembed/docs/examples/buttonmaker/package.sh new file mode 100644 index 00000000..e8563b9a --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/package.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +mkdir -p share/applnk/Scripts +mkdir -p share/apps/buttonmaker +mkdir -p share/apps/kjsembed + +RCSC="01.png 02.png 03.png 04.png 05.png 06.png 07.png 08.png 09.png default.png" + +cp buttonmaker.js $RCSC ButtonMakerUI.ui share/apps/buttonmaker +cp buttonmaker.desktop share/applnk/Scripts +cp kjsuic.js share/apps/kjsembed + +shar -M -z -X share > buttonmaker.sh +rm -rf share diff --git a/kjsembed/docs/examples/buttonmaker/pillbox.js b/kjsembed/docs/examples/buttonmaker/pillbox.js new file mode 100755 index 00000000..25c50ae1 --- /dev/null +++ b/kjsembed/docs/examples/buttonmaker/pillbox.js @@ -0,0 +1,172 @@ +#!/usr/bin/env kjscmd + +function BaseImage() +{ + this.a = new Image(this); + this.b = new Image(this); + this.c = new Image(this); + this.d = new Image(this); + this.e = new Image(this); + this.f = new Image(this); + this.g = new Image(this); + this.h = new Image(this); + this.i = new Image(this); + + this.height = function() { + return this.a.height() + this.d.height() + this.g.height(); + } + + this.width = function() { + return this.a.width() + this.b.width() + this.c.width(); + } + + this.loadImages = function() { + return ( + this.a.load("01.png") && + this.b.load("02.png") && + this.c.load("03.png") && + this.d.load("04.png") && + this.e.load("05.png") && + this.f.load("06.png") && + this.g.load("07.png") && + this.h.load("08.png") && + this.i.load("09.png") ); + } + + this.colorize = function( color ) { + var percent = 0.55; + var imgfx = new ImageFX(); + + this.a = imgfx.blendColor( color, this.a, percent); + this.b = imgfx.blendColor( color, this.b, percent); + this.c = imgfx.blendColor( color, this.c, percent); + this.d = imgfx.blendColor( color, this.d, percent); + this.e = imgfx.blendColor( color, this.e, percent); + this.f = imgfx.blendColor( color, this.f, percent); + this.g = imgfx.blendColor( color, this.g, percent); + this.h = imgfx.blendColor( color, this.h, percent); + this.i = imgfx.blendColor( color, this.i, percent); + } + + this.resize = function( newW, newH ) { + + this.b.smoothScale( newW - ( this.a.width() + this.c.width() ), this.b.height() ); + this.h.smoothScale( newW - ( this.g.width() + this.i.width() ), this.h.height() ); + + this.d.smoothScale( this.d.width(), newH - ( this.a.height() + this.g.height() ) ); + this.f.smoothScale( this.f.width(), newH - ( this.c.height() + this.i.height() ) ); + + this.e.smoothScale( newW - ( this.a.width() + this.c.width() ), + newH - ( this.c.height() + this.i.height() ) ); + } + + this.test = function( parent ) { + var box = new QHBox(parent); + var vbox1 = new QVBox(box); + var vbox2 = new QVBox(box); + var vbox3 = new QVBox(box); + var l1 = new QLabel(vbox1); + l1.pixmap = this.a.pixmap(); + + var l2 = new QLabel(vbox1); + l2.pixmap = this.d.pixmap(); + + var l3 = new QLabel(vbox1); + l3.pixmap = this.g.pixmap(); + + var l4 = new QLabel(vbox2); + l4.pixmap = this.b.pixmap(); + + var l5 = new QLabel(vbox2); + l5.pixmap = this.e.pixmap(); + + var l6 = new QLabel(vbox2); + l6.pixmap = this.h.pixmap(); + + var l7 = new QLabel(vbox3); + l7.pixmap = this.c.pixmap(); + + var l8 = new QLabel(vbox3); + l8.pixmap = this.f.pixmap(); + + var l9 = new QLabel(vbox3); + l9.pixmap = this.i.pixmap(); + } + + this.pixmap = function(width, height){ + var pix = new Pixmap(this); + pix.resize(width,height); + pix.fill("white"); + var painter = new Painter(this); + if( painter.begin(pix) ) + { + this.paint(painter); + if( painter.end() ) + return painter.pixmap(); + } + return pix; + } + + this.paint = function(painter){ + + painter.drawRect(0,0,this.width(), this.height()); + + painter.drawImage(0, 0, this.a, 0, 0, -1, -1, 0); + painter.drawImage(0, this.a.height(), this.d, 0, 0, -1, -1, 0); + painter.drawImage(0, ( this.height() - this.g.height() ) ,this.g, 0, 0, -1, -1, 0); + + painter.drawImage(this.a.width(), 0, this.b, 0, 0, -1, -1, 0); + painter.drawImage(this.d.width(), this.b.height(), this.e, 0, 0, -1, -1, 0); + painter.drawImage(this.g.width(), ( this.height() - this.h.height() ) ,this.h, 0, 0, -1, -1, 0); + + painter.drawImage(this.a.width() + this.b.width(), 0, this.c, 0, 0, -1, -1, 0); + painter.drawImage(this.d.width() + this.e.width(), this.c.height(), this.f, 0, 0, -1, -1, 0); + painter.drawImage(this.g.width() + this.h.width(), ( this.height() - this.i.height() ) ,this.i, 0, 0, -1, -1, 0); + } + + this.widget = function(canvas) { + var painter = new Painter(this); + if( painter.begin(canvas) ) + { + this.paint(painter); + if( painter.end() ) + return true; + } + return false; + } +} + + +var base = new BaseImage(); +var label = new QLabel(this); + + +if ( !base.loadImages() ) + alert("Error Loading Resources!"); + +base.colorize("blue"); +var H = 128; +var W = 128; + +base.resize(W,H); + +var box = new QHBox(this); +var label = new QLabel(box); +label.resize(W,H); +label.paintEvent = function(ev) +{ + println("paint..."); + base.widget(label); +} + +var label2 = new QLabel(box); +label2.pixmap = base.pixmap(W,H); + +base.test(box); + +box.show(); +box.resize(W*3, H) + +application.exec(); + +//img.load("cl.png"); img.blendColor( "blue", 0.20); img.smoothScale(16,128); lab.pixmap = img.pixmap diff --git a/kjsembed/docs/examples/calc/calc.js b/kjsembed/docs/examples/calc/calc.js new file mode 100755 index 00000000..8ff7a403 --- /dev/null +++ b/kjsembed/docs/examples/calc/calc.js @@ -0,0 +1,65 @@ +#!/usr/bin/env kjscmd + + +function Calculator(ui) +{ + // Setup entry functions + var display = ui.child('display'); + this.display = display; + + this.one = function() { display.intValue = display.intValue*10+1; } + this.two = function() { display.intValue = display.intValue*10+2; } + this.three = function() { display.intValue = display.intValue*10+3; } + this.four = function() { display.intValue = display.intValue*10+4; } + this.five = function() { display.intValue = display.intValue*10+5; } + this.six = function() { display.intValue = display.intValue*10+6; } + this.seven = function() { display.intValue = display.intValue*10+7; } + this.eight = function() { display.intValue = display.intValue*10+8; } + this.nine = function() { display.intValue = display.intValue*10+9; } + this.zero = function() { display.intValue = display.intValue*10+0; } + + ui.connect( ui.child('one'), 'clicked()', this, 'one' ); + ui.connect( ui.child('two'), 'clicked()', this, 'two' ); + ui.connect( ui.child('three'), 'clicked()', this, 'three' ); + ui.connect( ui.child('four'), 'clicked()', this, 'four' ); + ui.connect( ui.child('five'), 'clicked()', this, 'five' ); + ui.connect( ui.child('six'), 'clicked()', this, 'six' ); + ui.connect( ui.child('seven'), 'clicked()', this, 'seven' ); + ui.connect( ui.child('eight'), 'clicked()', this, 'eight' ); + ui.connect( ui.child('nine'), 'clicked()', this, 'nine' ); + ui.connect( ui.child('zero'), 'clicked()', this, 'zero' ); + + this.val = 0; + this.lastop = function() {} + + this.plus = function() + { + this.val = display.intValue+this.val; + display.intValue = 0; + this.lastop=this.plus + } + + this.minus = function() + { + this.val = display.intValue-this.val; + display.intValue = 0; + this.lastop=this.minus; + } + + + ui.connect( ui.child('plus'), 'clicked()', this, 'plus' ); + ui.connect( ui.child('minus'), 'clicked()', this, 'minus' ); + + this.equals = function() { this.lastop(); display.intValue = this.val; } + this.clear = function() { this.lastop=function(){}; display.intValue = 0; this.val = 0; } + + ui.connect( ui.child('equals'), 'clicked()', this, 'equals' ); + ui.connect( ui.child('clear'), 'clicked()', this, 'clear' ); +} + +var ui = Factory.loadui('calc.ui'); +var calc = new Calculator(ui); + +ui.show(); +application.exec(); + diff --git a/kjsembed/docs/examples/calc/calc.ui b/kjsembed/docs/examples/calc/calc.ui new file mode 100644 index 00000000..773ea848 --- /dev/null +++ b/kjsembed/docs/examples/calc/calc.ui @@ -0,0 +1,258 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>calc</class> +<widget class="QWidget"> + <property name="name"> + <cstring>calc</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>237</width> + <height>159</height> + </rect> + </property> + <property name="caption"> + <string>JS Calculator</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLCDNumber"> + <property name="name"> + <cstring>display</cstring> + </property> + <property name="numDigits"> + <number>18</number> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="1" column="3"> + <property name="name"> + <cstring>plus</cstring> + </property> + <property name="text"> + <string>+</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="4"> + <property name="name"> + <cstring>all_clear</cstring> + </property> + <property name="text"> + <string>AC</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="3"> + <property name="name"> + <cstring>minus</cstring> + </property> + <property name="text"> + <string>-</string> + </property> + </widget> + <widget class="QPushButton" row="3" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>equals</cstring> + </property> + <property name="text"> + <string>=</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="4"> + <property name="name"> + <cstring>clear</cstring> + </property> + <property name="text"> + <string>CL</string> + </property> + </widget> + <widget class="QPushButton" row="3" column="1"> + <property name="name"> + <cstring>zero</cstring> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="0"> + <property name="name"> + <cstring>four</cstring> + </property> + <property name="text"> + <string>4</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="1"> + <property name="name"> + <cstring>two</cstring> + </property> + <property name="text"> + <string>2</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>five</cstring> + </property> + <property name="text"> + <string>5</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="2"> + <property name="name"> + <cstring>three</cstring> + </property> + <property name="text"> + <string>3</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="0"> + <property name="name"> + <cstring>seven</cstring> + </property> + <property name="text"> + <string>7</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="2"> + <property name="name"> + <cstring>six</cstring> + </property> + <property name="text"> + <string>6</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>eight</cstring> + </property> + <property name="text"> + <string>8</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="2"> + <property name="name"> + <cstring>nine</cstring> + </property> + <property name="text"> + <string>9</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="0"> + <property name="name"> + <cstring>one</cstring> + </property> + <property name="text"> + <string>1</string> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>plus</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>plus()</slot> + </connection> + <connection> + <sender>minus</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>minus()</slot> + </connection> + <connection> + <sender>equals</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>equals()</slot> + </connection> + <connection> + <sender>zero</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>zero()</slot> + </connection> + <connection> + <sender>four</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>four()</slot> + </connection> + <connection> + <sender>two</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>two()</slot> + </connection> + <connection> + <sender>five</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>five()</slot> + </connection> + <connection> + <sender>three</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>three()</slot> + </connection> + <connection> + <sender>seven</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>seven()</slot> + </connection> + <connection> + <sender>six</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>six()</slot> + </connection> + <connection> + <sender>eight</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>eight()</slot> + </connection> + <connection> + <sender>nine</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>nine()</slot> + </connection> + <connection> + <sender>one</sender> + <signal>clicked()</signal> + <receiver>calc</receiver> + <slot>one()</slot> + </connection> +</connections> +<slots> + <slot>one()</slot> + <slot>two()</slot> + <slot>three()</slot> + <slot>four()</slot> + <slot>five()</slot> + <slot>six()</slot> + <slot>seven()</slot> + <slot>eight()</slot> + <slot>nine()</slot> + <slot>zero()</slot> + <slot>plus()</slot> + <slot>minus()</slot> + <slot>equals()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/examples/cmdline/cmdline.js b/kjsembed/docs/examples/cmdline/cmdline.js new file mode 100755 index 00000000..9c96c6cb --- /dev/null +++ b/kjsembed/docs/examples/cmdline/cmdline.js @@ -0,0 +1,78 @@ +#!/usr/bin/env kjscmd + +function list(obj) +{ + println( obj ); + + for ( var i in obj ) { + try { + tp = typeof obj[i]; + + count = 20 - i.length; + spc = ''; + for ( var s=0; s < count; s++ ) + spc = spc + ' '; + + println( ' ' + i + spc + tp ); + } + catch(err) { + println( ' ' + i + spc + 'Error, ' + err ); + } + } +} + +function help() +{ + println(); + println( 'KJSCmd ' + part.versionString + ' Prompt' ); + println( '=======' + '===' + '=======' ); + println(); + println( "Type 'quit' to exit, and 'help' for this text. Anything else" ); + println( 'is evaluated by the KJSCmd engine and the result displayed.' ); + println(); +} + +function cmd_prompt() +{ + System.stdout.print( 'kjscmd> ' ); + return System.stdin.readLine(); +} + +// +// Main +// + +println( "KJSCmd " + part.versionString + " (type 'help' for more information)" ); +done = false; + +do { + + line = cmd_prompt(); + + if ( line == 'quit' ) { + done = true; + } + else if ( line == 'help' ) { + help(); + } + else if ( line == '' ) { + // DO NOTHING + } + else if ( line == null ) { + done = true; + } + else { + try { + output = eval( line ); + + if ( typeof(output) != 'undefined' ) + println( output ); + } + catch(err) { + println( 'Error: ' + err ); + } + } + +} while ( !done ); + +System.exit(0); diff --git a/kjsembed/docs/examples/combobox/combo.js b/kjsembed/docs/examples/combobox/combo.js new file mode 100644 index 00000000..3ac40491 --- /dev/null +++ b/kjsembed/docs/examples/combobox/combo.js @@ -0,0 +1,17 @@ +#!/usr/bin/env kjscmd + +// Example that uses QComboBox + +var hbox = new QHBox(); + +var l = new QLabel( hbox ); +l.text = 'Combo test'; + +var cb = new QComboBox( hbox ); +cb.insertItem( 'test 1' ); +cb.insertItem( 'test 2' ); +cb.insertItem( 'test 3' ); +cb.insertItem( 'test 4' ); + +hbox.show(); +application.exec(); diff --git a/kjsembed/docs/examples/connect-cpp/connect-cpp.js b/kjsembed/docs/examples/connect-cpp/connect-cpp.js new file mode 100644 index 00000000..c79d1dea --- /dev/null +++ b/kjsembed/docs/examples/connect-cpp/connect-cpp.js @@ -0,0 +1,36 @@ +#!/usr/bin/env kjscmd + +function item( parent ) +{ + var hbox = new QHBox( parent ); + + var led = new KLed( hbox ); + var btn = new QCheckBox( hbox ); + btn.checked = true; + btn.text = 'Toggle LED'; + + var r = Math.random(); + if ((r > 0.5)&&(r < 0.7)) + led.color = 'red'; + else if (r >= 0.7) + led.color = 'blue'; + + led.connect( btn, 'toggled(bool)', 'toggle()' ); +} + +var vbox = new QVBox( 'test' ); +vbox.margin = 6; +vbox.spacing = 4; + +var ttl = new QLabel( vbox ); +ttl.text = '<h1>Connections</h1>'; + +for ( var i = 0 ; i < 10 ; i++ ) + item( vbox ); + +var quit = new QPushButton( vbox ); +quit.text = '&Quit'; +vbox.connect( quit, 'clicked()', 'close()' ); + +vbox.show(); +application.exec(); diff --git a/kjsembed/docs/examples/connect/connect.js b/kjsembed/docs/examples/connect/connect.js new file mode 100644 index 00000000..aa56a366 --- /dev/null +++ b/kjsembed/docs/examples/connect/connect.js @@ -0,0 +1,45 @@ +#!/usr/bin/env kjscmd + +// +// Demo that connects C++ signals to JS slots of various types. +// + +// Load the demo gui +var top = Factory.loadui( 'connect.ui' ); + +// Util func to print a msg +function msg(s) +{ + top.child('output').append(s); +} + +// JS object we connect to +function DemoObj() +{ + this.func_void = function() { msg('void'); } + this.func_bool = function(b) { msg(b); } + this.func_int = function(i) { msg(i); } + this.func_string = function(s) { msg(s); } + this.func_double = function(d) { msg(d); } +} + +// +// Main +// + +var obj = new DemoObj(); + +var ve = top.child('v'); +var be = top.child('b'); +var ie = top.child('i'); +var se = top.child('s'); +var de = top.child('d'); + +top.connect( ve, 'clicked()', obj, 'func_void' ); +top.connect( be, 'toggled(bool)', obj, 'func_bool' ); +top.connect( ie, 'valueChanged(int)', obj, 'func_int' ); +top.connect( se, 'textChanged(const QString&)', obj, 'func_string' ); +top.connect( de, 'valueChanged(double)', obj, 'func_double' ); + +top.show(); +application.exec(); diff --git a/kjsembed/docs/examples/connect/connect.ui b/kjsembed/docs/examples/connect/connect.ui new file mode 100644 index 00000000..5b172a8d --- /dev/null +++ b/kjsembed/docs/examples/connect/connect.ui @@ -0,0 +1,160 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>demo</class> +<widget class="QWidget"> + <property name="name"> + <cstring>demo</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>434</width> + <height>348</height> + </rect> + </property> + <property name="caption"> + <string>Connect Demo</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="3" column="1"> + <property name="name"> + <cstring>s</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>160</red> + <green>239</green> + <blue>139</blue> + </color> + </property> + <property name="frameShape"> + <enum>Box</enum> + </property> + <property name="text"> + <string>Slot Output</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="KDoubleNumInput" row="5" column="1"> + <property name="name"> + <cstring>d</cstring> + </property> + </widget> + <widget class="QSpinBox" row="4" column="1"> + <property name="name"> + <cstring>i</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>160</red> + <green>239</green> + <blue>139</blue> + </color> + </property> + <property name="frameShape"> + <enum>Box</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="text"> + <string>Signal Source</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>b</cstring> + </property> + <property name="text"> + <string>Bool</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>v</cstring> + </property> + <property name="text"> + <string>Void</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Double:</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Int:</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>String:</string> + </property> + </widget> + <widget class="KTextBrowser" row="1" column="2" rowspan="6" colspan="1"> + <property name="name"> + <cstring>output</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <spacer row="6" column="1"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>ktextbrowser.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/customwidget/README b/kjsembed/docs/examples/customwidget/README new file mode 100644 index 00000000..6100357d --- /dev/null +++ b/kjsembed/docs/examples/customwidget/README @@ -0,0 +1,2 @@ +This example shows how scripts can create widgets directly. It creates +and displays the window shown in customwidget.png. diff --git a/kjsembed/docs/examples/customwidget/custom_widget.js b/kjsembed/docs/examples/customwidget/custom_widget.js new file mode 100755 index 00000000..dbab2d8f --- /dev/null +++ b/kjsembed/docs/examples/customwidget/custom_widget.js @@ -0,0 +1,57 @@ +#!/usr/bin/env kjscmd + +// +// Script demonstrating how to create a custom widget. +// + +function createField( parent ) +{ + var hbox = new QHBox( box, 'hb' ); + + var label = new QLabel( hbox ); + label.text = 'Filename:'; + var ed = new QLineEdit( hbox, 'lineed' ); + ed.text = './my_file.txt'; + var pb = new QPushButton( hbox, 'button' ); + pb.text = 'Br&owse'; + var led = new KLed( hbox, 'led' ); +} + +function createGroup( parent ) +{ + var grp = new QGroupBox( box, 'grp' ); + grp.columns = 1; + grp.title = 'A QGroupBox'; + + var cb1 = new QCheckBox( grp, 'check1' ); + var cb2 = new QCheckBox( grp, 'check2' ); + cb1.text = 'Check Box One'; + cb2.text = 'Check Box Two'; + + return grp; +} + +// Outer layout +var box = new QVBox(); +box.margin = 6; + +// Title +var ttl = new QLabel( box, 'title' ); +ttl.text = '<qt><center><h3>KJSEmbed Object Creation Demo</h3></center><hr></qt>'; + +// Named field +createField( box ); + +// Text editor +var l = new QLabel( box, 'tl' ); +l.txt = 'Editable Text Widget:'; +var txt = new QTextEdit( box, 'text_edit' ); +txt.text = '<qt>This is an editable text widget created from <i>Javascript</i> using the ' + + '<b>KJSEmbed</b> library. As you can see, the facilities are powerful enough ' + + 'for many useful applications to be found.</qt>'; + +// Group of check boxes +var grp = createGroup( box ); + +box.show(); +application.exec(); diff --git a/kjsembed/docs/examples/dcop/interface.js b/kjsembed/docs/examples/dcop/interface.js new file mode 100755 index 00000000..ed699768 --- /dev/null +++ b/kjsembed/docs/examples/dcop/interface.js @@ -0,0 +1,17 @@ +#!/usr/bin/env kjscmd + +function someInterface( foo ) +{ + println("Foo happend with " + foo ); +} + +function anotherInterface( bar ) +{ + return "Bar " + bar; +} + +var dcop = new DCOPInterface(this, "someInterface"); +dcop.publish("void someInterface(QString)"); +dcop.publish("QString anotherInterface(QString)"); + +application.exec(); diff --git a/kjsembed/docs/examples/dcop/rss.js b/kjsembed/docs/examples/dcop/rss.js new file mode 100755 index 00000000..c1eb3882 --- /dev/null +++ b/kjsembed/docs/examples/dcop/rss.js @@ -0,0 +1,39 @@ +#!/usr/bin/env kjscmd + +function newArticles( articles ) +{ + + var box = new QVBox(main); + var count = articles.call("count()"); + var label = new QLabel(box); + var list = new KListBox(box); + + + label.text = count + " articles for " + articles.call("title()"); + for( var idx = 0; idx < count; ++idx) + { + var article = articles.call("article(int)", idx); + list.insertItem( article.call( "title()" )); + } + box.show(); + return true; +} + +var main = new QHBox(this) +var dcop = new DCOPInterface(this, "news"); +dcop.publish("void newArticles(DCOPRef)"); + +var client = new DCOPClient(this); +var feeds = client.call( "rssservice", "RSSService", "list()" ); + +for( var idx = 0; idx < feeds.length; ++idx) +{ + var doc = client.call( "rssservice", "RSSService", "add(QString)", feeds[idx] ); + client.connectDCOPSignal("rssservice", doc.obj(), "documentUpdated(DCOPRef)", + "news","newArticles(DCOPRef)"); + doc.call("refresh()"); +} +main.show(); + +application.exec(); + diff --git a/kjsembed/docs/examples/dcop/signalslot.js b/kjsembed/docs/examples/dcop/signalslot.js new file mode 100755 index 00000000..884faa29 --- /dev/null +++ b/kjsembed/docs/examples/dcop/signalslot.js @@ -0,0 +1,25 @@ +#!/usr/bin/env kjscmd + +function newWeather( station ) +{ + var temp = client.call("KWeatherService", "WeatherService", "temperature(QString)", "KMKE"); + var name = client.call("KWeatherService", "WeatherService", "stationName(QString)", "KMKE"); + var label = new QLabel(this); + label.text = "The temperature at " + name + " is " + temp; + label.show(); +} + +var client = new DCOPClient(this); +if ( client.attach() ) +{ + var dcop = new DCOPInterface(this, "weather"); + dcop.publish("void newWeather(QString)"); + + client.connectDCOPSignal("KWeatherService", "WeatherService", "fileUpdate(QString)", + "weather","newWeather(QString)"); + + + client.send("KWeatherService", "WeatherService", "update(QString)", "KMKE"); + + application.exec(); +} diff --git a/kjsembed/docs/examples/dcop/weather.js b/kjsembed/docs/examples/dcop/weather.js new file mode 100755 index 00000000..8d8a59c3 --- /dev/null +++ b/kjsembed/docs/examples/dcop/weather.js @@ -0,0 +1,25 @@ +#!/usr/bin/env kjscmd + +var dcop = new DCOPClient(this); +var box = new QHBox(this); +var go = new KPushButton(box); +var loc = new KLineEdit(box); + +go.pixmap = StdIcons.DesktopIcon("go",32); +go.connect(go, "clicked()", this, "getWeather"); + +dcop.attach(); +box.show(); + +function getWeather() +{ + if ( dcop.isAttached() ) + { + var icn = new Image(this); + icn.pixmap = dcop.call("KWeatherService","WeatherService","icon(QString)", loc.text); + icn.smoothScale(32,32); + go.pixmap = icn.pixmap; + } +} + +application.exec(); diff --git a/kjsembed/docs/examples/docviewer/docviewer.js b/kjsembed/docs/examples/docviewer/docviewer.js new file mode 100644 index 00000000..56ccfa0e --- /dev/null +++ b/kjsembed/docs/examples/docviewer/docviewer.js @@ -0,0 +1,223 @@ +#!/usr/bin/env kjscmd + +// Populates the sidebar listview +function setup_sidebar( builtins, special, qt, kde, all ) +{ + var qobjects = Factory.constructors().sort(); + + for ( var i=0; i < qobjects.length ; i++ ) { + all.insertItem( qobjects[i] ); + + if ( /^Q/.test(qobjects[i]) ) + qt.insertItem( qobjects[i] ); + else if ( /^K/.test(qobjects[i]) ) + kde.insertItem( qobjects[i] ); + else + special.insertItem( qobjects[i] ); + } + + qt.insertItem( 'Qt' ); + builtins.insertItem( 'System' ); + builtins.insertItem( 'StdIcons' ); + builtins.insertItem( 'Factory' ); + builtins.insertItem( 'StdDirs' ); + builtins.insertItem( 'StdAction' ); +} + +// +// Main +// + +// Create the UI +var mw = new KMainWindow(this); +var ac = mw.actionCollection(); + +var split = new QSplitter( mw ); +mw.setCentralWidget( split ); + +side = new QToolBox( split, 'sidebar' ); +view = new QTabWidget( split, 'mainview' ); + +// Load the view +jsview = Factory.createROPart( "text/html", view, "js" ); +cppview = Factory.createROPart( "text/html", view, "cpp" ); + +js = view.child(4); +cpp = view.child(6); + +view.addTab( js, '&Javascript' ); +view.addTab( cpp, '&C++' ); + +view.set_class = function( clazz ) +{ + var nm; + + clazz = clazz.replace( '^[^QK]*', '' ); + + if ( /^Q/.test(clazz) ) + nm = 'http://doc.trolltech.com/3.2/' + clazz.toLowerCase() + '.html'; + else if ( /^K/.test(clazz) ) + nm = 'http://developer.kde.org/documentation/library/cvs-api/kdeui/html/class' + clazz + '.html'; + + + cppview.openURL( nm ); + + // JS docs + jsview.openStream( 'text/html', 'file:///index.html' ); + jsview.writeStream( '<html>' ); + jsview.writeStream( '<head>' ); + jsview.writeStream( '<style type="text/css"><!--' ); + jsview.writeStream( 'h1 { text-align: center; background-color: #ccccff; }' ); + jsview.writeStream( 'h2 { background-color: #eeeeff; }' ); + jsview.writeStream( 'h3 { background-color: #eeeeff; }' ); + jsview.writeStream( 'th { background-color: #cccccc; }' ); + jsview.writeStream( 'td { background-color: #eeeeee; }' ); + jsview.writeStream( 'table { font-family: sans-serif; font-size: 8pt }' ); + jsview.writeStream( '--></style>' ); + jsview.writeStream( '</head>' ); + jsview.writeStream( '<body>' ); + jsview.writeStream( '<h1>' + clazz + '</h1>' ); + + try { + var obj = eval('new '+clazz+'(this)'); + jsview.writeStream( dump(obj) ); + } + catch ( err ) { + try { + var obj = eval(clazz); + jsview.writeStream( dump(obj) ); + } + catch ( err2 ) { + jsview.writeStream( '<font color="red">Error dumping object: ' + err + '<hr>' + err2 + '</font>' ); + } + } + + jsview.writeStream( '</body>' ); + jsview.writeStream( '</html>' ); + jsview.closeStream(); +} + +view.setup = function() +{ + // JS docs + jsview.openStream( 'text/html', 'file:///index.html' ); + jsview.writeStream( '<html>' ); + jsview.writeStream( '<head>' ); + jsview.writeStream( '<style type="text/css"><!--' ); + jsview.writeStream( 'h1 { text-align: center; background-color: #ccccff; }' ); + jsview.writeStream( 'h2 { background-color: #eeeeff; }' ); + jsview.writeStream( 'h3 { background-color: #eeeeff; }' ); + jsview.writeStream( 'table { font-family: sans-serif; font-size: 8pt }' ); + jsview.writeStream( '--></style>' ); + jsview.writeStream( '</head>' ); + jsview.writeStream( '<body>' ); + jsview.writeStream( '<h1>Script Reference</h1>' ); + jsview.writeStream( '</body>' ); + jsview.writeStream( '</html>' ); + jsview.closeStream(); + + // C++ docs + cppview.openStream( 'text/html', 'file:///index.html' ); + cppview.writeStream( '<html>' ); + cppview.writeStream( '<head>' ); + cppview.writeStream( '<style type="text/css"><!--' ); + cppview.writeStream( 'h1 { text-align: center; background-color: #ccccff; }' ); + cppview.writeStream( 'h2 { background-color: #ccccff; }' ); + cppview.writeStream( 'h3 { background-color: #ddddff; }' ); + cppview.writeStream( 'table { font-family: sans-serif; font-size: 8pt }' ); + cppview.writeStream( '--></style>' ); + cppview.writeStream( '</head>' ); + cppview.writeStream( '<body>' ); + cppview.writeStream( '<h1>C++ Reference</h1>' ); + cppview.writeStream( '</body>' ); + cppview.writeStream( '</html>' ); + cppview.closeStream(); + + jsview.connect( jsview.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' ); + cppview.connect( cppview.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' ); +} + +// Setup the sidebar +builtinside = new KListView( side, 'builtinside' ); +builtinside.addColumn( 'Class' ); +builtinside.resizeMode = 2; // LastColumn + +builtinside.changed = function() +{ + var item = this.selectedItem(); + view.set_class( item.text(0) ); +} + +specialside = new KListView( side, 'specialsidebar' ); +specialside.addColumn( 'Class' ); +specialside.resizeMode = 2; // LastColumn + +specialside.changed = function() +{ + var item = this.selectedItem(); + view.set_class( item.text(0) ); +} + +qtside = new KListView( side, 'qtsidebar' ); +qtside.addColumn( 'Class' ); +qtside.resizeMode = 2; // LastColumn + +qtside.changed = function() +{ + var item = this.selectedItem(); + view.set_class( item.text(0) ); +} + +kdeside = new KListView( side, 'kdesidebar' ); +kdeside.addColumn( 'Class' ); +kdeside.resizeMode = 2; // LastColumn + +kdeside.changed = function() +{ + var item = this.selectedItem(); + view.set_class( item.text(0) ); +} + +allside = new KListView( side, 'allsidebar' ); +allside.addColumn( 'Class' ); +allside.resizeMode = 2; // LastColumn + +allside.changed = function() +{ + var item = this.selectedItem(); + view.set_class( item.text(0) ); +} + +side.addItem( builtinside, '&Builtins' ); +side.addItem( specialside, 'K&JSEmbed' ); +side.addItem( kdeside, '&KDE' ); +side.addItem( qtside, '&Qt' ); +side.addItem( allside, '&All' ); + +setup_sidebar( builtinside, specialside, qtside, kdeside, allside ); + +kdeside.connect( kdeside, 'selectionChanged()', kdeside, 'changed' ); +qtside.connect( qtside, 'selectionChanged()', qtside, 'changed' ); +specialside.connect( specialside, 'selectionChanged()', specialside, 'changed' ); +builtinside.connect( builtinside, 'selectionChanged()', builtinside, 'changed' ); +allside.connect( allside, 'selectionChanged()', allside, 'changed' ); + +// +// Activate XMLGUI and show the window +// +var quitAction = StdAction.quit( 0, 0, mw.actionCollection() ); +mw.connect( quitAction, 'activated()', this, 'exit'); + +mw.createGUI( 'stdactionsui.rc' ); +side.maximumWidth = 250; +mw.resize( 800, 550 ); + +mw.show(); + +// +// Connect together +// +view.setup(); + +application.exec(); + diff --git a/kjsembed/docs/examples/docviewer/docviewer.ui b/kjsembed/docs/examples/docviewer/docviewer.ui new file mode 100644 index 00000000..0cdb1930 --- /dev/null +++ b/kjsembed/docs/examples/docviewer/docviewer.ui @@ -0,0 +1,69 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>doc_viewer</class> +<widget class="QWidget"> + <property name="name"> + <cstring>doc_viewer</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>166</width> + <height>132</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>KJSEmbed Doc Viewer</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>&Search:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>search_edit</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Object types:</string> + </property> + </widget> + <widget class="KListBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>toc_view</cstring> + </property> + <property name="resizePolicy"> + <enum>AutoOne</enum> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>search_edit</cstring> + </property> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistbox.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/envelopemaker/EnvelopeMakerUI.ui b/kjsembed/docs/examples/envelopemaker/EnvelopeMakerUI.ui new file mode 100644 index 00000000..2e8658b3 --- /dev/null +++ b/kjsembed/docs/examples/envelopemaker/EnvelopeMakerUI.ui @@ -0,0 +1,568 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>Form1</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>338</width> + <height>409</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>From Address</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14_2</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout11_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>38</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>retAddress1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_4_2</cstring> + </property> + <property name="text"> + <string>City/state, zipcode:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout10_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>68</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>retAddress2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="1"> + <property name="name"> + <cstring>layout9_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>68</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>retAddress3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>layout8_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer4_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>70</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>retAddress4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_2_2_2</cstring> + </property> + <property name="text"> + <string>Address line 2:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_2_3</cstring> + </property> + <property name="text"> + <string>Address line 1:</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>To Address</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>38</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>mailAddress1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>City/state, zipcode:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>68</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>mailAddress2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="1"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>68</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>mailAddress3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>70</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>mailAddress4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_2_2</cstring> + </property> + <property name="text"> + <string>Address line 2:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Address line 1:</string> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>151</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>barcode</cstring> + </property> + <property name="text"> + <string>Generate PostNet bar code</string> + </property> + </widget> + </vbox> + </widget> + <widget class="KFontRequester"> + <property name="name"> + <cstring>font</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>exit</cstring> + </property> + <property name="text"> + <string>&Quit</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>90</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>save</cstring> + </property> + <property name="text"> + <string>&Save</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>print</cstring> + </property> + <property name="text"> + <string>&Print</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kfontrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/envelopemaker/README b/kjsembed/docs/examples/envelopemaker/README new file mode 100644 index 00000000..3df8d4fd --- /dev/null +++ b/kjsembed/docs/examples/envelopemaker/README @@ -0,0 +1,6 @@ +#To install +>unshar -d $YOURKDEDIR envelopemaker.sh + +#To package +>sh -x package.sh +from inside of this directory. diff --git a/kjsembed/docs/examples/envelopemaker/env.js b/kjsembed/docs/examples/envelopemaker/env.js new file mode 100755 index 00000000..4d26c295 --- /dev/null +++ b/kjsembed/docs/examples/envelopemaker/env.js @@ -0,0 +1,253 @@ +#!/usr/bin/env kjscmd + +StdDirs.addResourceType("envelopemaker", StdDirs.kde_default("data") + "/envelopemaker"); + +var win = new KMainWindow(this); +var view = Factory.loadui(StdDirs.findResource("envelopemaker", "EnvelopeMakerUI.ui"), this, win); +//var view = Factory.loadui("EnvelopeMakerUI.ui", this, win); +var Print = view.child('print'); +var Save = view.child('save'); +var Exit = view.child('exit'); + +Print.connect(Print, 'clicked()', this, 'print'); +Save.connect(Save, 'clicked()', this, 'save'); +Exit.connect(Exit, 'clicked()', this, 'exit'); + +var env = new envelope(); +env.init(); + +win.setCentralWidget(view); +win.setCaption("EnvelopeMaker"); +win.show(); +application.exec(); + +function setupEnvelope() +{ + var fontName = /(.+)[,](.+)[,](.+)[,](.+)[,](.+)[,](.+)[,](.+)[,](.+)[,](.+)[,](.+)/.exec(view.child('font').font); + + env.returnfont = fontName[1]; + env.returnpointsize = fontName[2]; + env.mailfont = fontName[1]; + env.mailpointsize = fontName[2]; + env.retAddress[0] = view.child('retAddress1').text; + env.retAddress[1] = view.child('retAddress2').text; + env.retAddress[2] = view.child('retAddress3').text; + env.retAddress[3] = view.child('retAddress4').text; + env.mailAddress[0] = view.child('mailAddress1').text; + env.mailAddress[1] = view.child('mailAddress2').text; + env.mailAddress[2] = view.child('mailAddress3').text; + env.mailAddress[3] = view.child('mailAddress4').text; + if ( view.child('barcode').checked ) + { + if( env.getZip() == "" ) + { + alert("You must enter a valid 9 digit Zipcode"); + return false; + } + } + return true; +} + +function print() +{ + if (setupEnvelope() ) + { + var dcop = new DCOPClient(); + if( dcop.attach() ) + { + var ps = env.header(); + ps += env.returnAddress(); + ps += env.mailingAddress(); + if( view.child('barcode').checked ) + ps += env.barcode(); + ps += env.footer(); + if ( !dcop.send("kprinterservice", "printer", "printStream(const QString&)", ps ) ) + { + alert("There was an error talking to the KPrinterService, please check that it is running."); + } + + } + + } +} + +function save() +{ + if (setupEnvelope() ) + { + var ps = env.header(); + ps += env.returnAddress(); + ps += env.mailingAddress(); + if( view.child('barcode').checked ) + ps += env.barcode(); + ps += env.footer(); + var fileName = StdDialog.getSaveFileName(); + if( fileName != "") + { + System.writeFile(fileName, ps); + } + } +} + +function envelope() +{ + this.init = function() + { + + this.leftmargin = 0.30; + this.ewidth = 9.5; + this.eheight = 4.125; + this.linepos = 0; + this.normalpaper = 11; + this.normalwidth = 8.5; + + this.feedcenter = this.normalwidth/2 - this.eheight/2 + this.topmargin = 0.30 + this.feedcenter; + this.x0 = 0; + this.y0 = Math.round((this.normalpaper - this.ewidth) * 72); + this.xpos = Math.round(0.40*72*this.ewidth); + this.ypos = Math.round(-0.40*72*this.eheight); + this.xloc = Math.round(this.x0 + (this.topmargin * 72)); + this.yloc = Math.round(this.y0 + (this.leftmargin * 72)); + + this.returnfont = "Times-Roman"; + this.returnpointsize = 12; + this.mailfont = "Times-Roman"; + this.mailpointsize = 10; + this.retAddress = ["Ian Reinhart Geiser","601 Coach Hill Ct","West Chester PA, 19380"]; + this.mailAddress = ["SourceXtreme, Inc","1149 Broad Run Road","Coatesville, PA 39380-9176"]; + this.zipcode = "0"; + } + + this.getZip = function() + { + var mailAddress = /.+,[\s]*.{2,2}[\s]+([\d]{5,5})[-]*([\d]{4,4})/.exec(this.mailAddress); + if( mailAddress ) + return mailAddress[1] + mailAddress[2]; + else + return ""; + } + + this.header = function() + { + var ps = ""; + ps += "%!\n"; + ps += "% EnvelopeMaker\n"; + // Page size + // Comm #10 Envelope 297 x 684 + // C5 Envelope 461 x 648 + // DL Envelope 312 x 624 + ps += "newpath\n"; + return ps; + } + + this.returnAddress = function() + // Return address + { + var ps = this.xloc + " " + this.yloc + " translate\n"; + ps += "90 rotate"; + for ( var idx = 0; idx < this.retAddress.length; ++idx) + { + if( this.retAddress[idx] != "") + { + ps += "/" + this.returnfont + " findfont " + this.returnpointsize + " scalefont setfont\n"; + ps += "0 " + this.linepos + " moveto\n"; + ps += "(" + this.retAddress[idx] + ") show\n"; + this.linepos -= this.returnpointsize; + } + } + return ps; + } + + this.mailingAddress = function() + // Mailing Address + { + var ps = ""; + for ( var idx = 0; idx < this.mailAddress.length; ++idx) + { + if( this.mailAddress[idx] != "") + { + ps += "/" + this.mailfont + " findfont " + this.mailpointsize + " scalefont setfont\n"; + ps += this.xpos + " " + this.ypos + " moveto\n"; + ps += "(" + this.mailAddress[idx] + ") show\n"; + this.ypos -= this.mailpointsize; + } + } + return ps; + } + + this.footer = function() + { + return "showpage\n"; + } + + this.barcode = function() + { + this.zipcode = this.getZip(); + if( this.zipcode.length != 9) + return ""; + + var ps = ""; + + this.xpos = Math.round((this.ewidth - 3.875) * 72); + this.ypos = Math.round((-1 * this.eheight + 0.375) * 72); + + var code = [ [1, 1, 0, 0, 0], [0, 0, 0, 1, 1], [0, 0, 1, 0, 1], [0, 0, 1, 1, 0], + [0, 1, 0, 0, 1], [0, 1, 0, 1, 0], [0, 1, 1, 0, 0], [1, 0, 0, 0, 1], + [1, 0, 0, 1, 0],[1, 0, 1, 0, 0] ]; + var ziparray = new Array(10); + + var zipsum = 0; + for ( var idx = 0; idx < this.zipcode.length; ++idx) + { + ziparray[idx] = this.zipcode.substring(idx, idx+1); + zipsum += ziparray[idx]; + } + var correctcode = 10 - zipsum % 10; + if( correctcode == 10) + correctcode = 0; + ziparray[9] = correctcode; + + // Set our barcode dimensions to the POSTNET spec. + // Width = 0.02" + // Space between CL's (pitch) = 0.05" + // Height of 1's = 0.125" + // Height of 0's = 0.05" + + var pitch = 3.6; //points + var linewidth = 1.44; //points + var height = 0; + + var pos = 0; + ps += "newpath\n"; + ps += this.xpos + " " + this.ypos + " translate\n"; + ps += pos + " 0 moveto\n"; + ps += linewidth + " setlinewidth\n"; + + // Frame bar + var height = Math.round(0.125 * 72); + ps += "0 " + height + " rlineto\n"; + + // Actual barcode + for( var idx = 0; idx < ziparray.length; ++idx) + { + for (var idx2 = 0; idx2 < code[ ziparray[idx] ].length; ++idx2) + { + pos = Math.round(pos + pitch); + ps += pos + " 0 moveto\n"; + var line = code[ ziparray[idx] ][idx2]; + height = Math.round((0.05 + line * 0.075) * 72); + ps += "0 " + height + " rlineto\n"; + } + } + + // Frame bar + pos = Math.round(pos + pitch); + ps += pos + " 0 moveto\n"; + height = Math.round(0.125 * 72); + ps += "0 " + height + " rlineto\n"; + ps += "stroke\n"; + + return ps; + } +}
\ No newline at end of file diff --git a/kjsembed/docs/examples/envelopemaker/envelopemaker.desktop b/kjsembed/docs/examples/envelopemaker/envelopemaker.desktop new file mode 100644 index 00000000..ba71a225 --- /dev/null +++ b/kjsembed/docs/examples/envelopemaker/envelopemaker.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Exec=kjscmd `kde-config --prefix`/share/apps/envelopemaker/env.js +GenericName=A #10 Envelope maker +Icon=exec +MimeType= +Name=Envelope Maker +StartupNotify=true +Terminal=false +Type=Application +X-KDE-SubstituteUID=false diff --git a/kjsembed/docs/examples/envelopemaker/package.sh b/kjsembed/docs/examples/envelopemaker/package.sh new file mode 100644 index 00000000..f83bcdc2 --- /dev/null +++ b/kjsembed/docs/examples/envelopemaker/package.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +mkdir -p share/applnk/Scripts +mkdir -p share/apps/envelopemaker + +cp env.js EnvelopeMakerUI.ui share/apps/envelopemaker +cp envelopemaker.desktop share/applnk/Scripts + +shar -M -z -X share > envelopemaker.sh +rm -rf share diff --git a/kjsembed/docs/examples/eventhandling/jsboard.js b/kjsembed/docs/examples/eventhandling/jsboard.js new file mode 100644 index 00000000..91e9a0f2 --- /dev/null +++ b/kjsembed/docs/examples/eventhandling/jsboard.js @@ -0,0 +1,89 @@ +#!/usr/bin/env kjscmd + +// Globals +var frame = new QFrame(this); +var labels = new Array(); +var startPos = new Point(0,0); +var lastPos = new Point(0,0); + +frame.resize(300,300); +frame.paletteBackgroundColor = "blue"; + +var target = new Target(frame,"Target"); +for( var idx = 0; idx < 3; ++idx) + labels[idx] = new Block(frame, "Label " + idx); + +frame.show(); +application.exec(); + +function Target( parent, text) +{ + var x = Math.floor( Math.random() * parent.width ); + var y = Math.floor( Math.random() * parent.height ); + var w = 100; + var h = 100; + + this.label = new QLabel(parent); + this.text = text; + this.label.paletteBackgroundColor = "green"; + this.label.geometry = new Rect(x,y,w,h); + + this.checkInside = function( objectRect ) + { + return this.label.geometry.contains(objectRect); + } + +} + +function Block(parent,text) +{ + this.label = new QLabel(parent); + var x = Math.floor( Math.random() * parent.width ); + var y = Math.floor( Math.random() * parent.height ); + var w = 25; + var h = 25; + this.label.text = text; + this.label.geometry = new Rect(x,y,w,h); + this.label.frameShape = QFrame.WinPanel; + this.label.frameShadow = QFrame.Plain; + this.label.paletteBackgroundColor = "white"; + this.label.setMouseTracking(true); + this.label.adjustSize(); + + // Event handlers + this.label.mousePressEvent = function(ev) + { + //println("Press: " + this.text); + startPos = this.pos; + lastPos = ev.globalPos; + println("Start: " + startPos.x() + "," + startPos.y()); + + } + + this.label.mouseReleaseEvent = function(ev) + { + if( target.checkInside(this.geometry) ) + alert( "You got " + this.text + " on target!" ); + else + { + println("Reset: " + startPos.x() + "," + startPos.y()); + this.pos = startPos; + } + } + + this.label.mouseMoveEvent = function(ev) + { + if( ev.state == 1) + { + var xDelta = ev.globalX - lastPos.x(); + var yDelta = ev.globalY - lastPos.y(); + this.move( this.x + xDelta, this.y + yDelta ); + lastPos = ev.globalPos; + } + } +} + + + + + diff --git a/kjsembed/docs/examples/eventhandling/mousetrack.js b/kjsembed/docs/examples/eventhandling/mousetrack.js new file mode 100644 index 00000000..9c970c42 --- /dev/null +++ b/kjsembed/docs/examples/eventhandling/mousetrack.js @@ -0,0 +1,21 @@ +#!/usr/bin/env kjscmd + +// +// The standard 'scribble' application coded using kjsembed +// + + +var mousetrack = new QWidget(this); +mousetrack.setMouseTracking(true); +x=0; +y=0; + +mousetrack.mouseMoveEvent = function(ev) +{ + this.drawLine(x,y,ev.x,ev.y); + x = ev.x; + y = ev.y; +} + +mousetrack.show(); +application.exec(); diff --git a/kjsembed/docs/examples/eventhandling/scribble.js b/kjsembed/docs/examples/eventhandling/scribble.js new file mode 100644 index 00000000..0ffcdb07 --- /dev/null +++ b/kjsembed/docs/examples/eventhandling/scribble.js @@ -0,0 +1,34 @@ +#!/usr/bin/env kjscmd + +// +// The standard 'scribble' application coded using kjsembed +// + + +var scribble = new QWidget(this); +scribble.line=false; +var x=0; +var y=0; + +scribble.mousePressEvent = function(ev) +{ + if ( ev.button == 2 ) { + this.drawText(ev.x,ev.y,'KJSEmbed!'); + } + else { + x = ev.x; + y = ev.y; + line=true; + } +} + +scribble.mouseReleaseEvent = function(ev) +{ + if ( line ) + this.drawLine(x,y,ev.x,ev.y); + line = false; +} + +scribble.show(); +application.exec(); + diff --git a/kjsembed/docs/examples/frame/frame.js b/kjsembed/docs/examples/frame/frame.js new file mode 100644 index 00000000..d19fc4de --- /dev/null +++ b/kjsembed/docs/examples/frame/frame.js @@ -0,0 +1,28 @@ +#!/usr/bin/env kjscmd + +// Demo of QFrame and enum support + +function add_frame( parent ) +{ + var v = new QVBox( parent ); + v.margin = 6; + + return new QFrame( v ); +} + +var top = new QVBox(); +var hbox = new QHBox( top ); + +var f = add_frame( hbox ); +f.frameShape = QFrame.Box; + +f = add_frame( hbox ); +f.frameShape = QFrame.WinPanel | QFrame.Sunken; + +f = add_frame( hbox ); +f.frameShape = QFrame.PopupPanel; + +top.resize(300,200); + +top.show(); +application.exec(); diff --git a/kjsembed/docs/examples/grepdialog/README b/kjsembed/docs/examples/grepdialog/README new file mode 100644 index 00000000..e126113f --- /dev/null +++ b/kjsembed/docs/examples/grepdialog/README @@ -0,0 +1,6 @@ +Illustrates a number of useful facilities: + +- Creating dialogs from .ui files. +- Reading files from stdin and parsing them with JS regexps. +- Displaying formatted text using QML. +- Using shell scripts with kjscmd. diff --git a/kjsembed/docs/examples/grepdialog/grepdlg.js b/kjsembed/docs/examples/grepdialog/grepdlg.js new file mode 100644 index 00000000..2df87d98 --- /dev/null +++ b/kjsembed/docs/examples/grepdialog/grepdlg.js @@ -0,0 +1,23 @@ +// Create and show the dialog +var dlg = Factory.loadui('grepdlg.ui'); +dlg.exec(); + +// Extract the parameters +var search = dlg.child('search_edit').text; +var files = dlg.child('files_edit').text; +var matchcase = dlg.child('case_check').checked; +var shownumbers = dlg.child('shownumbers_check').checked; + +// Build the command line +var options = ''; +if ( !matchcase ) { + options += '-i '; +} +if ( shownumbers ) { + options += '-n '; +} + +cmd = 'grep -H '+options+"'"+search+"' "+files; + +// Print the command line +print( cmd ); diff --git a/kjsembed/docs/examples/grepdialog/grepdlg.ui b/kjsembed/docs/examples/grepdialog/grepdlg.ui new file mode 100644 index 00000000..53a169bd --- /dev/null +++ b/kjsembed/docs/examples/grepdialog/grepdlg.ui @@ -0,0 +1,199 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>GrepDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>GrepDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>319</width> + <height>213</height> + </rect> + </property> + <property name="caption"> + <string>Grep Dialog</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>search_edit</cstring> + </property> + <property name="text"> + <string>KJSEmbed</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>&Search for:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>search_edit</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>In &files:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>files_edit</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>files_edit</cstring> + </property> + <property name="text"> + <string>*</string> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="5" column="1"> + <property name="name"> + <cstring>case_check</cstring> + </property> + <property name="text"> + <string>Match &case</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel3_2</cstring> + </property> + <property name="text"> + <string>Options:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="font"> + <font> + <pointsize>12</pointsize> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Grep Dialog</string> + </property> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="6" column="1"> + <property name="name"> + <cstring>shownumbers_check</cstring> + </property> + <property name="text"> + <string>Show line &numbers</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>GrepDialog</receiver> + <slot>accept()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/examples/grepdialog/grepresults.js b/kjsembed/docs/examples/grepdialog/grepresults.js new file mode 100644 index 00000000..99a698cd --- /dev/null +++ b/kjsembed/docs/examples/grepdialog/grepresults.js @@ -0,0 +1,36 @@ +// Create the dialog +var dlg = Factory.loadui('grepresults.ui'); +var text = dlg.child('results_text'); + +function build_row( file, line, text ) +{ + file = file.replace( /:$/, "" ); + line = line.replace( /:$/, "" ); + return '<tr bgcolor="#eeeeff">' + +'<td><b><font color="blue">'+file+'</font></b></td>' + +'<td align="center"><b><font color="red">'+line+'</font></b></td>' + +'<td>'+text+'</td></tr>'; +} + +var s = '<table cellspacing="2"><tr bgcolor="#cccccc">'; +s += '<th><b>File</b></th>'; +s += '<th align="center"><b>Line</b></th>'; +s += '<th><b>Text</b></th></tr>'; + +var line = readLine(); +while ( line != null ) { + line.replace( /&/g,"&"); + line = line.replace( /"/g,"""); + line = line.replace( /</g,"<"); + + fields = line.match( /^([^:]+:)(\d+:)?(.*)/ ); + + s += build_row( fields[1], fields[2], fields[3] ); + line = readLine(); +} + +s += '</table>'; +text.text = s; + +// Show dialog +dlg.exec(); diff --git a/kjsembed/docs/examples/grepdialog/grepresults.ui b/kjsembed/docs/examples/grepdialog/grepresults.ui new file mode 100644 index 00000000..4bec43f4 --- /dev/null +++ b/kjsembed/docs/examples/grepdialog/grepresults.ui @@ -0,0 +1,131 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>GrepResults</class> +<widget class="QDialog"> + <property name="name"> + <cstring>GrepResults</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>578</width> + <height>324</height> + </rect> + </property> + <property name="caption"> + <string>Grep Results</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="font"> + <font> + <pointsize>12</pointsize> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Grep Results</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QTextEdit"> + <property name="name"> + <cstring>results_text</cstring> + </property> + <property name="frameShape"> + <enum>Box</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="textFormat"> + <enum>RichText</enum> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="undoRedoEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&Dismiss</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>GrepResults</receiver> + <slot>accept()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/examples/grepdialog/guigrep b/kjsembed/docs/examples/grepdialog/guigrep new file mode 100755 index 00000000..490e4676 --- /dev/null +++ b/kjsembed/docs/examples/grepdialog/guigrep @@ -0,0 +1,6 @@ +#!/bin/sh + +KJSCMD="`which kjscmd`" +GREP_CMD=`$KJSCMD grepdlg.js` +VIEW_CMD="$KJSCMD grepresults.js" +eval $GREP_CMD | $VIEW_CMD diff --git a/kjsembed/docs/examples/html2text/html2text.js b/kjsembed/docs/examples/html2text/html2text.js new file mode 100644 index 00000000..a8d6dd9a --- /dev/null +++ b/kjsembed/docs/examples/html2text/html2text.js @@ -0,0 +1,7 @@ +Factory.load('html2text_plugin.js'); + +var line = readLine(); +while ( line != null ) { + print( html2text(line) ); + line = readLine(); +} diff --git a/kjsembed/docs/examples/html2text/html2text_plugin.js b/kjsembed/docs/examples/html2text/html2text_plugin.js new file mode 100644 index 00000000..61146537 --- /dev/null +++ b/kjsembed/docs/examples/html2text/html2text_plugin.js @@ -0,0 +1,19 @@ + +function html2text( html ) +{ + var text = html.replace( /<[^>]*>/g, '' ); + text = text.replace( /"/g, '"' ); + text = text.replace( /</g, '<' ); + text = text.replace( /&/g, '&' ); + + return text; +} + +function text2html( text ) +{ + var html = text.replace( /&/g,"&"); + html = html.replace( /"/g,"""); + html = html.replace( /</g,"<"); + + return html; +} diff --git a/kjsembed/docs/examples/html2text/html2text_plugin.xml b/kjsembed/docs/examples/html2text/html2text_plugin.xml new file mode 100644 index 00000000..634b88cd --- /dev/null +++ b/kjsembed/docs/examples/html2text/html2text_plugin.xml @@ -0,0 +1,24 @@ +<!DOCTYPE actionset> +<actionset> +<header> + <name>html2text_actions</name> + <label>HTML To Text Actions</label> + <script type="js" src="html2text_plugin.js"></script> +</header> +<action> + <name>html_to_text</name> + <type>KAction</type> + <icons>text</icons> + <label><text>Convert HTML To Text</text></label> + <statustext>Converts the selected text from HTML to text.</statustext> + <script type="js">kpart.selectedText = html2text( kpart.selectedText )</script> +</action> +<action> + <name>text_to_html</name> + <type>KAction</type> + <icons>html</icons> + <label><text>Quote For HTML</text></label> + <statustext>Quotes the selected text for inclusion in an HTML document.</statustext> + <script type="js">kpart.selectedText = text2html( kpart.selectedText )</script> +</action> +</actionset> diff --git a/kjsembed/docs/examples/html2text/html2text_pluginui.rc b/kjsembed/docs/examples/html2text/html2text_pluginui.rc new file mode 100644 index 00000000..7738100c --- /dev/null +++ b/kjsembed/docs/examples/html2text/html2text_pluginui.rc @@ -0,0 +1,10 @@ +<!DOCTYPE kpartgui>
+<kpartplugin name="html2text_plugin" library="libkjsembedplugin">
+<MenuBar>
+ <Menu name="tools"><Text>&Tools</Text>
+ <Action name="html_to_text"/>
+ <Action name="text_to_html"/>
+ <Action name="jsconsole"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/kjsembed/docs/examples/html2text/test.htm b/kjsembed/docs/examples/html2text/test.htm new file mode 100644 index 00000000..457327d0 --- /dev/null +++ b/kjsembed/docs/examples/html2text/test.htm @@ -0,0 +1,208 @@ +<html> +<head> +<style type="text/css"> +<!-- +h1 { + background-color: #ccccee; + text-align: center; +} +h3 { + background-color: #ccccee; +} +li { + padding: 4px; +} +pre { + background-color: #CCCCCC; + margin-right: 16px; + margin-left: 16px; + padding: 6px; +} +.imgcaption { + font-weight: bold; + text-align: center; +} +.precaption { + font-weight: bold; + text-align: center; +} +--> +</style> +</head> +<body> +<h1> KJSEmbed</h1> +<h3>Introduction</h3> +<p>KJSEmbed is a library for embedding the KJS Javascript (ECMAScript) interpreter + in KDE applications. It provides developers with an easy way to allow users + to extend application, and can even be used with applications that have not + been designed with this in mind thanks to a KParts plugin. In addition, KJSEmbed + provides a command line tool for running scripts so users can easily create + simple applications of their own in Javascript. KJSEmbed scripts are surprisingly + powerful because they access the properties and slots of QObjects, and can even + load widgets and dialogs created with Qt's graphical dialog editor.</p> +<h3>Features</h3> +<p>To give you an idea of what KJSEmbed provides, here is a brief summary of the + more interesting features:</p> +<ul> + <li>KParts plugin for extending existing KDE applications with scripts. </li> + <li>KPart for embedding Javascript in your own applications.</li> + <li>Console dialog that can be used to execute Javascript interactively.</li> + <li>Command line tool for running scripts (this can even operate without an + X server if you don't need to display a GUI).</li> + <li>Define new KActions using XML.</li> + <li>Scripts can access the properties and slots of QObjects as if they were + normal Javascript properties and methods.</li> + <li>Scripts can load dialogs and widgets created with Qt Designer.</li> + <li>Scripts can create instances of anu QWidget subclass supported by QWidgetFactory.</li> + <li>Making your own QObjects/QWidgets available for scripting is one-liner.</li> + <li>Scripts can traverse the widget tree, so your entire application can be + made scriptable without explicitly binding every object.</li> +</ul> +<h3>First Steps - The Console Dialog</h3> +<p>The quickest way to see what KJSEmbed can do is with kjscmd, a tool for running + scripts from the command line. To begin, we'll run kjscmd without any parameters + which brings up the KJSEmbed console dialog. The console provides an easy way + to run short (one line) scripts, as you can see in figure 1 the scripts have + full access to the core Javascript language, and to standard objects such as + Math. In addition to the standard Javascript operations, this screenshot also + demonstrates the global function print() provided by KJSEmbed.</p> +<pre> +-- Enter a JS expression and press enter -- +kjs> 10+20 +30 +kjs> print(&quot;Hello World!&quot;) +Hello World! +undefined +kjs> Math.sin(0) +0 +kjs> Math.cos(0) +1 +</pre> +<p class="imgcaption">Figure 1: The KJSEmbed Console Dialog</p> +<p>Things get more interesting when you realise that we also have access to the + widgets that make up the dialog, as you can in figure 2:</p> +<pre> +kjs> console +JSConsoleWidget (KJSEmbed::JSConsoleWidget) +kjs> console.childCount() +4 +kjs> console.childAt(1) +CmdEdit (QComboBox) +kjs> console.childAt(2) +RunButton (QPushButton) +kjs> console.child(&quot;RunButton&quot;) +RunButton (QPushButton) +kjs> console.child(&quot;RunButton&quot;).text = &quot;Go!&quot; +Go! +kjs> console.caption = &quot;Different Title&quot; +Different Title +kjs&gt; console.child(&quot;Title&quot;).hide() +undefined +</pre> +<p class="imgcaption">Figure 2: Modifying the Console Dialog</p> +<p>As you can see, the console dialog has been made available to scripts as the + global variable 'console'. We can access the child widgets that make up the + dialog either by index using the childCount() and childAt() methods, or by name + using the child() method. As well as being able to see the widgets, we can modify + them by setting properties - in this example, we modify the caption property + of the widget 'console' (changing the window title) and the text property of + the widget 'RunButton' (changing the label it displays). For the sake of completeness, + the final command illustrates the other way of modifying widgets available to + us - it calls hide() slot of the widget 'Title' (what this does is left as an + exercise for the reader).</p> +<h3>Displaying A Grep Dialog</h3> +<p>Now that we've seen how to use kjscmd interactively, lets take a look at a + more complex example that displays a dialog for running grep. The complete script + is shown in listing 1 and as you'll see, is very simple. Loading and displaying + the dialog takes only two lines of code because KJSEmbed provides a built-in + Factory object that supports Designer files, most of the work is getting the + values out of the dialog and building the command line.</p> +<pre> +// Create and show the dialog +var dlg = Factory.loadui('grepdlg.ui'); +dlg.exec(); + +// Extract the parameters +var search = dlg.child('search_edit').text; +var files = dlg.child('files_edit').text; +var matchcase = dlg.child('case_check').checked; +var invert = dlg.child('invert_check').checked; + +// Build the command line +var options; +if ( matchcase ) { + options = '-i'; +} +if ( invert ) { + options += ' -v'; +} + +cmd = 'grep '+options+&quot;'&quot;+search+&quot;' &quot;+files; + +// Print the command line +print( cmd ); +</pre> +<p class="precaption">Listing 1: A Script That Displays the Grep Dialog</p> +<p>In order to find out what the user asked us to search for we need to extract + the contents of the various fields in our dialog. We know that the field for + entering the text to be searched for is a QLineEdit called 'search_edit', so + we can use the child() method to get hold of it (this method searches through + the children of an object until it finds one with a matching name). Once we've + found the right object getting hold of the text is easy because all QLineEdits + make their contents available as a property called 'text'. The code that gets + the value of the check boxes is almost identical, except that these are QCheckBoxes + so it's the 'checked' property we're interested in.</p> +<p align="center"><img src="grepdlg.png" alt="Grep Dialog Screenshot" width="327" height="241"></p> +<p class="imgcaption">Figure 3: The Grep Dialog</p> +<p>When this script is run you'll see a dialog like the one shown in figure 3.</p> +<h3>Extending Applications with Javascript Plugins</h3> +<p>As its name implies KJSEmbed is not just a tool for writing standalone Javascript + tools, it also provides facilities for extending existing applications, these + facilities being with a KParts plugin for running scripts. The next example + uses the plugin to add a simple HTML-to-text action to Kate, the standard KDE + editor. </p> +<pre> +function html2text( html ) +{ + var text = html.replace( /&lt;[^&gt;]*&gt;/g, '' ); + text = text.replace( /&amp;quot;/g, '&quot;' ); + text = text.replace( /&amp;lt;/g, '&lt;' ); + text = text.replace( /&amp;amp;/g, '&amp;' ); + return text; +} + +function text2html( text ) +{ + var html = text.replace( /&amp;/g,&quot;&amp;amp;&quot;); + html = html.replace( /&quot;/g,&quot;&amp;quot;&quot;); + html = html.replace( /&lt;/g,&quot;&amp;lt;&quot;); + return html; +} +</pre> +<p>The details...</p> +<pre>&lt;!DOCTYPE actionset&gt;<br>&lt;actionset&gt;<br>&lt;header&gt;<br> &lt;name&gt;html2text_actions&lt;/name&gt;<br> &lt;label&gt;HTML To Text Actions&lt;/label&gt;<br> &lt;script type=&quot;js&quot; src=&quot;html2text_plugin.js&quot;&gt;&lt;/script&gt;<br>&lt;/header&gt;<br>&lt;action&gt;<br> &lt;name&gt;html_to_text&lt;/name&gt;<br> &lt;type&gt;KAction&lt;/type&gt;<br> &lt;icons&gt;text&lt;/icons&gt;<br> &lt;label&gt;&lt;text&gt;Convert HTML To Text&lt;/text&gt;&lt;/label&gt;<br> &lt;statustext&gt;Converts the selected text from HTML to text.&lt;/statustext&gt;<br> &lt;script type=&quot;js&quot;&gt;kpart.selectedText = html2text( kpart.selectedText )&lt;/script&gt;<br>&lt;/action&gt;<br>&lt;action&gt;<br> &lt;name&gt;text_to_html&lt;/name&gt;<br> &lt;type&gt;KAction&lt;/type&gt;<br> &lt;icons&gt;html&lt;/icons&gt;<br> &lt;label&gt;&lt;text&gt;Quote For HTML&lt;/text&gt;&lt;/label&gt;<br> &lt;statustext&gt;Quotes the selected text for inclusion in an HTML document.&lt;/statustext&gt;<br> &lt;script type=&quot;js&quot;&gt;kpart.selectedText = text2html( kpart.selectedText )&lt;/script&gt;<br>&lt;/action&gt;<br>&lt;/actionset&gt;<br></pre> +<p><br> + The xmlgui:</p> +<pre> +&lt;!DOCTYPE kpartgui&gt;<br>&lt;kpartplugin name=&quot;html2text_plugin&quot; library=&quot;libkjsembedplugin&quot;&gt;<br>&lt;MenuBar&gt;<br> &lt;Menu name=&quot;tools&quot;&gt;&lt;Text&gt;&amp;amp;Tools&lt;/Text&gt;<br> &lt;Action name=&quot;html_to_text&quot;/&gt;<br> &lt;Action name=&quot;text_to_html&quot;/&gt;<br> &lt;Action name=&quot;jsconsole&quot;/&gt;<br> &lt;/Menu&gt;<br>&lt;/MenuBar&gt;<br>&lt;/kpartplugin&gt;<br> </pre> +<h3>Missing</h3> +<ul> + <li>XMLActions</li> + <li>Plugin</li> + <li>MainWindow</li> +</ul> +<h3>References</h3> +<dl> + <dt><a href="http://www.mozilla.org/js/language/">http://www.mozilla.org/js/language/</a></dt> + <dd>Javascript (ECMAScript) language information.</dd> +</dl> +<h3>To Do</h3> +<ul> + <li>Replace figures 1 and 2 with images</li> + <li></li> +</ul> +<p>&nbsp;</p> +<p>&nbsp;</p> +<p>&nbsp;</p> +</body> +</html> diff --git a/kjsembed/docs/examples/html2text/text2html.js b/kjsembed/docs/examples/html2text/text2html.js new file mode 100755 index 00000000..7e4311ca --- /dev/null +++ b/kjsembed/docs/examples/html2text/text2html.js @@ -0,0 +1,9 @@ +#!/usr/bin/env kjscmd + +Factory.load('html2text_plugin.js'); + +var line = readLine(); +while ( line != null ) { + print( text2html(line) ); + line = readLine(); +} diff --git a/kjsembed/docs/examples/htmlinfo/htmlinfo.js b/kjsembed/docs/examples/htmlinfo/htmlinfo.js new file mode 100755 index 00000000..6b5609ca --- /dev/null +++ b/kjsembed/docs/examples/htmlinfo/htmlinfo.js @@ -0,0 +1,63 @@ +#!/usr/bin/env kjscmd + +// +// Script to report info about an HTML file. +// + +function parse_attrs( src ) +{ + var attrs = new Array(); + var attr_name; + var attr_value; + + while ( src.length > 0 ) { + // Attr name + var am = src.match( /^\s*(\w+)\s*(=?)\s*/ ); + attr_name = am[1]; + src = src.slice( am[0].length ); + + // If attr has a value + if ( am[2] == '=' ) { + + if ( src.charAt(0) == '"' ) { + vm = src.match( /(\"[^\"]*\")\s*/ ); + attr_value = vm[1]; + src = src.slice( vm[0].length ); + } + else { + vm = src.match( /(\S+)\s*/ ); + attr_value = vm[1]; + src = src.slice( vm[0].length ); + } + + } + else { + attr_value = null; + } + src.replace( /^\s*/m, '' ); + + attrs.push( [ attr_name, attr_value ] ); + } + + return attrs; +} + +function process_tag_img( src ) +{ + var tag = src.match( /<\s*(img)\s*([^>]*)\s*>/i ); + var elem = tag[1]; + var attrs = parse_attrs( tag[2] ); + + warn( 'Element: '+elem ); + for ( var i=0 ; i < attrs.length; i++ ) { + warn( '\t '+attrs[i][0]+' = '+attrs[i][1] ); + } +} + +var file = application.args[0]; +var text = System.readFile( file ); +var imgs = text.match( /<\s*img\s*[^>]*\s*>/ig ); + +for ( var i=0 ; i < imgs.length ; i++ ) { + process_tag_img( imgs[i] ); +} diff --git a/kjsembed/docs/examples/imagefun/base.png b/kjsembed/docs/examples/imagefun/base.png Binary files differnew file mode 100644 index 00000000..46e60196 --- /dev/null +++ b/kjsembed/docs/examples/imagefun/base.png diff --git a/kjsembed/docs/examples/imagefun/bump.js b/kjsembed/docs/examples/imagefun/bump.js new file mode 100755 index 00000000..f6a0ded6 --- /dev/null +++ b/kjsembed/docs/examples/imagefun/bump.js @@ -0,0 +1,87 @@ +#!/usr/bin/env kjscmd + +function makeShape() +{ + var img = new Pixmap(this); + var mask = new Pixmap(this); + var painter = new Painter(this); + + var brush = new Brush(this); + brush.setColor("black"); + brush.setStyle(Brush.SolidBrush); + var pen = new Pen(this); + pen.setColor("black"); + + mask.resize(128,64); + img.resize(128,64); + img.fill("white"); + + + if( painter.begin( img ) ) + { + painter.setPen(pen); + painter.setBrush(brush); + painter.drawRoundRect( 2,2,126,62, 25, 25 ); + if( painter.end() ) + img = painter.pixmap(); + } + + img.setMask( img.createHeuristicMask(true) ); + return img; +} + +function makeGradient(size) +{ + var img = new Image(); + img.gradient(size, "white", "black", img.PyramidGradient, 0); + return img; + +} + +function bump() +{ + var img1 = new Image(); + var map = new Image(); + var mask = new Pixmap(); + + img1.load( img1Loc ); + map.load( img2Loc ); + if ( !img1.isOk() && !map.isOk() ) { + var pix = makeShape(); + img1.setPixmap(pix); + map = makeGradient( pix.size() ); + mask = pix.mask(); + } + + println("Size 1: " + img1.width() + "x" + img1.height() ); + println("Size 2: " + map.width() + "x" + map.height() ); + var azmiuth = ui.child('azimuth').value; //135.0; + var elevation = ui.child('elevation').value; //45; + var depth = ui.child('depth').value; //3; + var xofs = ui.child('xofs').value; //5; + var yofs = ui.child('yofs').value; //5; + var waterlevel = ui.child('waterlevel').value; //0; + var ambient = ui.child('ambient').value; //0; + var compensate = ui.child('compensate').checked; //false; + var invert = ui.child('invert').checked; //false; + var type= ui.child('type').currentItem; //Image.Linear; + var tiled = ui.child('tiled').checked; //false; + img1.bumpmap(map, azmiuth, elevation, depth, xofs, yofs, waterlevel, ambient, compensate, invert, type, tiled); + var pix = img1.pixmap(); +// var pix = map.pixmap(); +// pix.setMask(mask); + view.pixmap = pix; +} + + var img1Loc = application.args[0]; + var img2Loc = application.args[1]; + + var ui = Factory.loadui('bump.ui'); + var go = ui.child('go'); + var view = ui.child('view'); + + go.connect(go, "clicked()", this, "bump"); + + ui.show(); + + application.exec(); diff --git a/kjsembed/docs/examples/imagefun/bump.ui b/kjsembed/docs/examples/imagefun/bump.ui new file mode 100644 index 00000000..90c5cc95 --- /dev/null +++ b/kjsembed/docs/examples/imagefun/bump.ui @@ -0,0 +1,327 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>Form1</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>524</width> + <height>445</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>121</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>go</cstring> + </property> + <property name="text"> + <string>Go</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>view</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>2</horstretch> + <verstretch>2</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Depth:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>depth</cstring> + </property> + <property name="value"> + <number>3</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="4" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel9</cstring> + </property> + <property name="text"> + <string>Type:</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Linear</string> + </property> + </item> + <item> + <property name="text"> + <string>Spherical</string> + </property> + </item> + <item> + <property name="text"> + <string>Sinuosidal</string> + </property> + </item> + <property name="name"> + <cstring>type</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Y offset:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>yofs</cstring> + </property> + <property name="minValue"> + <number>0</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Elevation:</string> + </property> + </widget> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>elevation</cstring> + </property> + <property name="value"> + <number>45</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="text"> + <string>Ambient:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>ambient</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>X offset:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>xofs</cstring> + </property> + <property name="minValue"> + <number>0</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Azimuth:</string> + </property> + </widget> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>azimuth</cstring> + </property> + <property name="value"> + <number>135</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="text"> + <string>Water level:</string> + </property> + </widget> + <widget class="KIntSpinBox"> + <property name="name"> + <cstring>waterlevel</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="4" column="5"> + <property name="name"> + <cstring>tiled</cstring> + </property> + <property name="text"> + <string>Tiled</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>invert</cstring> + </property> + <property name="text"> + <string>Invert</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>compensate</cstring> + </property> + <property name="text"> + <string>Compensate</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/imagefun/bumptest.png b/kjsembed/docs/examples/imagefun/bumptest.png Binary files differnew file mode 100644 index 00000000..b6954838 --- /dev/null +++ b/kjsembed/docs/examples/imagefun/bumptest.png diff --git a/kjsembed/docs/examples/imagefun/mask-gradient.png b/kjsembed/docs/examples/imagefun/mask-gradient.png Binary files differnew file mode 100644 index 00000000..67fe031f --- /dev/null +++ b/kjsembed/docs/examples/imagefun/mask-gradient.png diff --git a/kjsembed/docs/examples/imagefun/mask-noise.png b/kjsembed/docs/examples/imagefun/mask-noise.png Binary files differnew file mode 100644 index 00000000..c7d8bb72 --- /dev/null +++ b/kjsembed/docs/examples/imagefun/mask-noise.png diff --git a/kjsembed/docs/examples/imagefun/rotate.js b/kjsembed/docs/examples/imagefun/rotate.js new file mode 100755 index 00000000..c7869017 --- /dev/null +++ b/kjsembed/docs/examples/imagefun/rotate.js @@ -0,0 +1,26 @@ +#!/usr/bin/env kjscmd + +// Applies a rotate of 90 degrees to the image +function apply_rotate( img ) +{ + var foo = img.Rotate90; + println(foo); + img.rotate(foo); + return img; +} + +if ( application.args.length == 0 ) { + throw 'Usage:\n\timageviewer imgfile ...'; +} +else { + var loc = application.args[0]; + var img = new Image(); + img.load( loc ); + if ( !img.isOk() ) { + throw 'Failed to load image ' + loc; + } + + img = apply_rotate( img ); + + img.save( loc ); +} diff --git a/kjsembed/docs/examples/imagefun/title.js b/kjsembed/docs/examples/imagefun/title.js new file mode 100755 index 00000000..749899be --- /dev/null +++ b/kjsembed/docs/examples/imagefun/title.js @@ -0,0 +1,36 @@ +#!/usr/bin/env kjscmd + +var textlayer = new Pixmap(); +var painter = new Painter(); + +var w = 100; +var h = 100; +var test = "This is a test"; +var pn = new Pen(this); +var bsh = new Brush(this); + +bsh.setColor("red"); + +pn.setWidth(2); +pn.setColor("red"); + +textlayer.resize( w,h); +textlayer.fill("white"); +if (painter.begin(textlayer) ) +{ + painter.setPen(pn); + painter.setBrush(bsh); + painter.drawRoundRect( 5, 5, w-5, h-5, 25, 25 ); + if( painter.end() ) + { + var lbl = new QLabel(); + var img = new Image(this); + img.setPixmap( painter.pixmap() ); + + img.emboss(0,1); + lbl.pixmap=img.pixmap(); + lbl.show(); + application.exec(); + + } +} diff --git a/kjsembed/docs/examples/imageinfo/README b/kjsembed/docs/examples/imageinfo/README new file mode 100644 index 00000000..3940153a --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/README @@ -0,0 +1,22 @@ +A number of utilities showing the facilties for dealing with image +files. The scripts here are independent from each other. + +imageinfo.js Prints the width, height, depth and format of + images that are in a supported format. This script + is a good example of how to process arguments + passed on the command line. + +imagescale.js Loads an image, scales it to the specified size, + then saves using the specified name and format. + +imagegallery.js Creates an image gallery from a list of images + specified on the command line. This script brings + together the facilities used in the other examples + to create a tool that is useful in the real world. + +imagegallery.sh Creates a gallery sorted by the timestamps of the + image files. This is a very simplistic example of + how you can combine kjscmd with shell scripts. + +example* thumb-* Example output from the image gallery script. + diff --git a/kjsembed/docs/examples/imageinfo/example.html b/kjsembed/docs/examples/imageinfo/example.html new file mode 100644 index 00000000..c5b5fd69 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example.html @@ -0,0 +1,44 @@ +<html> +<head> +<title>Image Gallery</title> +</head> +<body> +<h1 align="center">Image Gallery</h1> +<hr> +<p>Here are some images, the larger ones have been scaled down to ensure this page loads quickly. Click on an image or filename to see it full size.</p> +<table border=0 width="90%" cellpadding="12" cellspacing="1"> +<tr> +<td align="center"><a href="example1.png"><img border=0 width=197 height=160 src=thumb-example1.png></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example1.png">example1.png</a></b> (848x686)<p>This image shows the results of running the imagegallery script. As you can +see the script automatically creates thumbnails (using QImage::smoothScale() +for quality) and includes image descriptions if present. The descriptions can +include HTML markup <b>like</b> <i>this</i>, and even +<a href="http://xmelegance.org/kjsembed/">links</a>. + +</p> +</td> +</tr> +<tr> +<td align="center"><a href="example2.png"><img border=0 width=217 height=160 src=thumb-example2.png></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example2.png">example2.png</a></b> (340x250)<p>This image shows +<a href="http://developer.kde.org/documentation/library/cvs-api/classref/kdeui/KPassivePopup.html">KPassivePopup</a> +telling a user they have new mail. The popup is adject to the source of the +message (in this example that is <a href="http://kmail.kde.org/">KMail</a>) and +<i>does not steal the focus</i>, or otherwise interfere with whatever the user is +currently doing. The dialog is automatically hidden after a timeout (or if the +user clicks on it). +</p> +</td> +</tr> +<tr> +<td align="center"><a href="example3.png"><img border=0 width=203 height=160 src=thumb-example3.png></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example3.png">example3.png</a></b> (274x215)<p><i>No Description</i></p> +</td> +</tr> +<tr> +<td align="center"><a href="example4.png"><img border=0 width=158 height=160 src=thumb-example4.png></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example4.png">example4.png</a></b> (560x567)<p><i>No Description</i></p> +</td> +</tr> +</table> +</body></html> diff --git a/kjsembed/docs/examples/imageinfo/example1.htm b/kjsembed/docs/examples/imageinfo/example1.htm new file mode 100644 index 00000000..b18ff23c --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example1.htm @@ -0,0 +1,6 @@ +This image shows the results of running the imagegallery script. As you can +see the script automatically creates thumbnails (using QImage::smoothScale() +for quality) and includes image descriptions if present. The descriptions can +include HTML markup <b>like</b> <i>this</i>, and even +<a href="http://xmelegance.org/kjsembed/">links</a>. + diff --git a/kjsembed/docs/examples/imageinfo/example1.png b/kjsembed/docs/examples/imageinfo/example1.png Binary files differnew file mode 100644 index 00000000..53408e63 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example1.png diff --git a/kjsembed/docs/examples/imageinfo/example2.htm b/kjsembed/docs/examples/imageinfo/example2.htm new file mode 100644 index 00000000..651048b3 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example2.htm @@ -0,0 +1,7 @@ +This image shows +<a href="http://developer.kde.org/documentation/library/cvs-api/classref/kdeui/KPassivePopup.html">KPassivePopup</a> +telling a user they have new mail. The popup is adject to the source of the +message (in this example that is <a href="http://kmail.kde.org/">KMail</a>) and +<i>does not steal the focus</i>, or otherwise interfere with whatever the user is +currently doing. The dialog is automatically hidden after a timeout (or if the +user clicks on it). diff --git a/kjsembed/docs/examples/imageinfo/example2.png b/kjsembed/docs/examples/imageinfo/example2.png Binary files differnew file mode 100644 index 00000000..902af717 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example2.png diff --git a/kjsembed/docs/examples/imageinfo/example3.png b/kjsembed/docs/examples/imageinfo/example3.png Binary files differnew file mode 100644 index 00000000..c2b98665 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example3.png diff --git a/kjsembed/docs/examples/imageinfo/example4.png b/kjsembed/docs/examples/imageinfo/example4.png Binary files differnew file mode 100644 index 00000000..9c2d9ae3 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/example4.png diff --git a/kjsembed/docs/examples/imageinfo/imagegallery.js b/kjsembed/docs/examples/imageinfo/imagegallery.js new file mode 100755 index 00000000..4cc5bc2d --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/imagegallery.js @@ -0,0 +1,113 @@ +#!/usr/bin/env kjscmd + +// +// Script to create an image gallery for a set of images. +// + +var default_title = 'Image Gallery'; +var default_intro = 'Here are some images, the larger ones have been scaled down to ' + + 'ensure this page loads quickly. Click on an image or filename ' + + 'to see it full size.'; +var default_width = 250; +var default_height = 160; + +function write_header( title, intro ) +{ + println( '<html>' ); + println( '<head>' ); + println( '<title>'+title+'</title>' ); + println( '</head>' ); + println( '<body>' ); + println( '<h1 align="center">'+title+'</h1>' ); + println( '<hr>' ); + println( '<p>'+intro+'</p>' ); + println( '<table border=0 width="90%" cellpadding="12" cellspacing="1">' ); +} + +function write_footer() +{ + println( '</table>' ); + println( '</body></html>' ); +} + +function write_image( name, w, h, thumb, tw, th, desc ) +{ + println( '<tr>' ); + + print( '<td align="center">' ); + print( '<a href="'+name+'">' ); + print( '<img border=0 width='+tw+' height='+th+' src="'+thumb+'">' ); + print( '</a>' ); + println( '</td>' ); + + print( '<td width="60%" valign="top" align="justify">' ); + print( '<b><a href="'+name+'">'+name+'</a></b>'+' ('+w+'x'+h+')' ); +// println( '<hr>' ); + println( '<p>'+desc+'</p>' ); + println( '</td>' ); + + println( '</tr>' ); +} + +// Create a thumbnail and write the img tag. +function process_image( name, desc ) +{ + var img = new Image(); + img.load( name ); + if ( !img.isOk() ) { + warn( 'Failed to load image '+name); + return null; + } + + var w = img.width(); + var h = img.height(); + + if ( (w > default_width) || (h > default_height) ) { + img.smoothScaleMin( default_width, default_height ); + } + + var tw = img.width(); + var th = img.height(); + + var thumb = 'thumb-'+name; + img.save( thumb ); + + if ( !img.isOk() ) { + warn( 'Failed to save thumbnail '+thumb); + return null; + } + + write_image( name, w, h, thumb, tw, th, desc ); +} + +if ( application.args.length == 0 ) { + System.stderr.println( 'Usage:' ); + System.stderr.println( '\timagegallery imgfile ...' ); +} +else { + write_header( default_title, default_intro ); + + for ( var i = 0 ; i < application.args.length ; i++ ) { + var name = application.args[i]; + if ( name.match( /^thumb-/ ) ) { + // Ignore thumbnails + } + else { + + var desc_file = name.replace( /\.[^\.]+$/, '.htm' ); + var desc; + try { + desc = System.readFile( desc_file ); + } + catch(x) { + desc = '<i>No Description</i>'; + } + process_image( name, desc ); + } + } + + write_footer(); +} + + + diff --git a/kjsembed/docs/examples/imageinfo/imagegallery.sh b/kjsembed/docs/examples/imageinfo/imagegallery.sh new file mode 100755 index 00000000..cf3952c4 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/imagegallery.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# +# Uses imagegallery.js to create a thumbnail page where the newest +# images are shown first. +# + +./imagegallery.js `ls --color=never -1 -t $* | xargs echo -n` diff --git a/kjsembed/docs/examples/imageinfo/imageinfo.js b/kjsembed/docs/examples/imageinfo/imageinfo.js new file mode 100755 index 00000000..957b1a49 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/imageinfo.js @@ -0,0 +1,37 @@ +#!/usr/bin/env kjscmd + +// +// Script to load an image and report some info about it. +// + +function image_info( name ) +{ + var img = new Image(); + img.load( name ); + if ( !img.isOk() ) { + return null; + } + + return img.width()+' x '+img.height()+' x '+img.depth()+ '\t'+img.format(); +} + +if ( application.args.length == 0 ) { + System.err.println( 'Usage:' ); + System.err.println( '\timageinfo imgfile ...' ); +} +else { + for ( var i = 0 ; i < application.args.length ; i++ ) { + var prefix = ''; + if ( application.args.length > 1 ) { + prefix = application.args[i] + ':\t'; + } + + var msg = image_info( application.args[i] ); + if ( msg ) { + System.err.println( prefix + msg ); + } + } +} + + + diff --git a/kjsembed/docs/examples/imageinfo/imagescale.js b/kjsembed/docs/examples/imageinfo/imagescale.js new file mode 100755 index 00000000..51ead9b5 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/imagescale.js @@ -0,0 +1,28 @@ +#!/opt/kde3/bin/kjscmd + +// +// Load an image, scale it, and save it in the specified format. +// + +if ( application.args.length >= 3 ) { + var infile = application.args[0]; + var outfile = application.args[1]; + var scale = application.args[2]; + + var img = new Image(); + img.load( infile ); + if ( img.isOk() ) { + if ( application.args.length > 3 ) { + img.format = application.args[3]; + } + + img.smoothScale( img.width*(scale/100.0), img.height*(scale/100.0) ); + img.save( outfile ); + } +} +else { + System.out.println( 'Usage:' ); + System.err.println( '\timagescale imgfile outfile percent [format]' ); +} + + diff --git a/kjsembed/docs/examples/imageinfo/thumb-example1.png b/kjsembed/docs/examples/imageinfo/thumb-example1.png Binary files differnew file mode 100644 index 00000000..79eca5d7 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/thumb-example1.png diff --git a/kjsembed/docs/examples/imageinfo/thumb-example2.png b/kjsembed/docs/examples/imageinfo/thumb-example2.png Binary files differnew file mode 100644 index 00000000..f4c805e7 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/thumb-example2.png diff --git a/kjsembed/docs/examples/imageinfo/thumb-example3.png b/kjsembed/docs/examples/imageinfo/thumb-example3.png Binary files differnew file mode 100644 index 00000000..7a449b6c --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/thumb-example3.png diff --git a/kjsembed/docs/examples/imageinfo/thumb-example4.png b/kjsembed/docs/examples/imageinfo/thumb-example4.png Binary files differnew file mode 100644 index 00000000..42fb6022 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/thumb-example4.png diff --git a/kjsembed/docs/examples/imageinfo/thumbs.html b/kjsembed/docs/examples/imageinfo/thumbs.html new file mode 100644 index 00000000..674dcfe5 --- /dev/null +++ b/kjsembed/docs/examples/imageinfo/thumbs.html @@ -0,0 +1,44 @@ +<html> +<head> +<title>Image Gallery</title> +</head> +<body> +<h1 align="center">Image Gallery</h1> +<hr> +<p>Here are some images, the larger ones have been scaled down to ensure this page loads quickly. Click on an image or filename to see it full size.</p> +<table border=0 width="90%" cellpadding="12" cellspacing="1"> +<tr> +<td align="center"><a href="example1.png"><img border=0 width=197 height=160 src="thumb-example1.png"></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example1.png">example1.png</a></b> (848x686)<p>This image shows the results of running the imagegallery script. As you can +see the script automatically creates thumbnails (using QImage::smoothScale() +for quality) and includes image descriptions if present. The descriptions can +include HTML markup <b>like</b> <i>this</i>, and even +<a href="http://xmelegance.org/kjsembed/">links</a>. + +</p> +</td> +</tr> +<tr> +<td align="center"><a href="example2.png"><img border=0 width=217 height=160 src="thumb-example2.png"></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example2.png">example2.png</a></b> (340x250)<p>This image shows +<a href="http://developer.kde.org/documentation/library/cvs-api/classref/kdeui/KPassivePopup.html">KPassivePopup</a> +telling a user they have new mail. The popup is adject to the source of the +message (in this example that is <a href="http://kmail.kde.org/">KMail</a>) and +<i>does not steal the focus</i>, or otherwise interfere with whatever the user is +currently doing. The dialog is automatically hidden after a timeout (or if the +user clicks on it). +</p> +</td> +</tr> +<tr> +<td align="center"><a href="example3.png"><img border=0 width=203 height=160 src="thumb-example3.png"></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example3.png">example3.png</a></b> (274x215)<p><i>No Description</i></p> +</td> +</tr> +<tr> +<td align="center"><a href="example4.png"><img border=0 width=158 height=160 src="thumb-example4.png"></a></td> +<td width="60%" valign="top" align="justify"><b><a href="example4.png">example4.png</a></b> (560x567)<p><i>No Description</i></p> +</td> +</tr> +</table> +</body></html> diff --git a/kjsembed/docs/examples/imagetweak/example1.png b/kjsembed/docs/examples/imagetweak/example1.png Binary files differnew file mode 100644 index 00000000..53408e63 --- /dev/null +++ b/kjsembed/docs/examples/imagetweak/example1.png diff --git a/kjsembed/docs/examples/imagetweak/example2.png b/kjsembed/docs/examples/imagetweak/example2.png Binary files differnew file mode 100644 index 00000000..902af717 --- /dev/null +++ b/kjsembed/docs/examples/imagetweak/example2.png diff --git a/kjsembed/docs/examples/imagetweak/example3.png b/kjsembed/docs/examples/imagetweak/example3.png Binary files differnew file mode 100644 index 00000000..c2b98665 --- /dev/null +++ b/kjsembed/docs/examples/imagetweak/example3.png diff --git a/kjsembed/docs/examples/imagetweak/example4.png b/kjsembed/docs/examples/imagetweak/example4.png Binary files differnew file mode 100644 index 00000000..9c2d9ae3 --- /dev/null +++ b/kjsembed/docs/examples/imagetweak/example4.png diff --git a/kjsembed/docs/examples/imagetweak/imagetweak.js b/kjsembed/docs/examples/imagetweak/imagetweak.js new file mode 100755 index 00000000..df7c86f9 --- /dev/null +++ b/kjsembed/docs/examples/imagetweak/imagetweak.js @@ -0,0 +1,76 @@ +#!/usr/bin/env kjscmd + +if ( application.args.length == 0 ) { + throw 'Usage:\n\timagetweak imgfile ...'; +} + +// +// Setup main window +// +var mw = new KMainWindow(); +var view = new QScrollView( mw, 'view' ); +mw.setCentralWidget( view ); + +var lbl = new QLabel( view, 'view' ); +view.addChild( lbl ); + +// +// Load image +// +var loc = application.args[0]; +var img = new Image(); + +img.load( loc ); +if ( !img.isOk() ) { + throw 'Failed to load image ' + loc; +} + +lbl.pixmap=img.pixmap(); + +// +// Actions +// +var ac = mw.actionCollection(); + +// +// Create the quit action and connect it to a C++ slot +// +StdAction.quit( application, 'quit()', ac ); + +// +// We'll wire the file open action up to a JS function +// + +mw.openFile = function() { + var filename = StdDialog.getOpenFileName( '.', '*' ); + if ( filename.length > 0 ) { + view.text = System.readFile( filename ); + } +} + +var open_action = StdAction.open( null, '', ac ); +open_action.connect( open_action, 'activated()', mw, 'openFile' ); + +// +// We'll just accept the default for the rest of the actions +// + +StdAction.aboutApp( null, '', ac ); +StdAction.aboutKDE( null, '', ac ); +StdAction.help( null, '', ac ); +StdAction.helpContents( null, '', ac ); +StdAction.openRecent( null, '', ac ); +StdAction.save( null, '', ac ); +StdAction.saveAs( null, '', ac ); +StdAction.showMenubar( null, '', ac ); +StdAction.showStatusbar( null, '', ac ); +StdAction.showToolbar( null, '', ac ); + +// +// Activate XMLGUI and show the window +// +mw.createGUI( 'stdactionsui.rc' ); +mw.resize( 500, 350 ); +mw.show(); + +application.exec(); diff --git a/kjsembed/docs/examples/imageviewer/imageviewer.js b/kjsembed/docs/examples/imageviewer/imageviewer.js new file mode 100644 index 00000000..f69d63c3 --- /dev/null +++ b/kjsembed/docs/examples/imageviewer/imageviewer.js @@ -0,0 +1,61 @@ +#!/usr/bin/env kjscmd + +// Applies a water color effect filter to the image +function apply_watercolor( img ) +{ + var imgfx = new ImageFX(); + img = imgfx.contrast(img, 200); + img = imgfx.despeckle(img); + img = imgfx.despeckle(img); + img = imgfx.despeckle(img); + img = imgfx.sharpen(img); + return img; +} + +if ( application.args.length == 0 ) { + throw 'Usage:\n\timageviewer imgfile ...'; +} +else { + var loc = application.args[0]; + var lbl = new QLabel(); + + var img = new Image(); + img.load( loc ); + if ( !img.isOk() ) { + throw 'Failed to load image ' + loc; + } + + println(img.isOk()); + img = apply_watercolor( img ); + + lbl.pixmap = img.pixmap(); + lbl.resize(img.width(), img.height()); + lbl.show(); + application.exec(); +} + +/* +int watercolor(imgdes *srcimg, imgdes *resimg) +{ + imgdes tmpsrc; + int cols, rows, rcode; + double gamma = 0.7; + + cols = CALC_WIDTH(srcimg); + rows = CALC_HEIGHT(srcimg); + + allocimage(&tmpsrc, cols, rows, srcimg->bmh->biBitCount); + copyimage(srcimg, &tmpsrc); + + gammabrighten(gamma, &tmpsrc, &tmpsrc); + removenoise(&tmpsrc, &tmpsrc); + removenoise(&tmpsrc, &tmpsrc); + removenoise(&tmpsrc, &tmpsrc); + sharpen(&tmpsrc, &tmpsrc); + + rcode = copyimage(&tmpsrc, resimg); + + freeimage(&tmpsrc); + + +*/ diff --git a/kjsembed/docs/examples/imunge/effectbrowser.ui b/kjsembed/docs/examples/imunge/effectbrowser.ui new file mode 100644 index 00000000..b3ee2255 --- /dev/null +++ b/kjsembed/docs/examples/imunge/effectbrowser.ui @@ -0,0 +1,151 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>EffectBrowser</class> +<widget class="QWidget"> + <property name="name"> + <cstring>EffectBrowser</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>353</width> + <height>240</height> + </rect> + </property> + <property name="caption"> + <string>Image Effects Browser</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="3" column="1"> + <property name="name"> + <cstring>settings_group</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Settings</string> + </property> + </widget> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>preview</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="backgroundMode"> + <enum>PaletteDark</enum> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><h3>Image Effects Browser</h3></string> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + </widget> + <widget class="KListView" row="2" column="0" rowspan="2" colspan="1"> + <column> + <property name="text"> + <string>Effect Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>false</bool> + </property> + </column> + <property name="name"> + <cstring>effects</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="55092">789cccbd47b7eb38b2ef397f9fa2d6e5ecae5e7cf266d0035266cb6da7ed77af1ed07b2f1aa9bf7c83883f704c56d5cd7c75bb5f95d6c9ca5f8a22114044202200f0fccffffcdbe7d3fddffef37ffe8fea625c02eb6f966f947ffb4fbb4e92ebfff57fff9fffcffff88fe160f0b7fecf68389bfe6df41fffc7fff80febf96fd6df9401ff5fcff64232ffde36244f7a762ac953fefd56f29cf35cf2a267f3072ff9f733c906e7836493f35eb2c59fd74ab6797b1f243bfcfb46b2cb7fef0a1e72799c5af2907f7f94cce5732cc963fefd483297cf3a8387d43f992999ffde0c25f3dfb79a64de5f662099dfcfe924cf386f24f3fe4a44ff0fd17e5b327f9e772799dfcfb8078fa87d662499cbebbb9249de6fc9bcbd9d2f99dab795ccc7b31a48e6e3b71a4ae6e315ed25f3f1b04f82a93f0dc1636a9ff32999daf32599f757a54ae6fde17e48e6fae23892b97e78a2bd63ea1f438cef849e97e892f9f7652b99b76f3d91cce53763f0947e6f08fd9c1137b664de5e43c83fc7f53bf0022cf475499c8be719c4f113d824de5cc01671fd0eb6895dbaff50d8ab174ae6f2ad3ac9a47f63c924df4832d73f732a99f777f324998fb73993ccfb5f7f96ccc7df3a49e6e3514592b9bd3aa664ae1fd6bd646eaf9a2b98f4ddf52573fdb58e60d89f6d49e6df9b13c97c3c1d45326fbf634826ffb2934cfee40086fdf88164de7ff65232d9eb9b646e1fa607867e9bbe641a8f816092cf14f2423f4d070c7d8b9f25f3e7bbaf60e89fb791ccfb3b15df43ffe22f30f42f13f240ffea1b18fab716bf877ee967b043dc92bf1f0ea16fdd9af3a8f740bc3dbe64f2f70bc9bcbfcd2fc9bcbfbd4432f90b4730f5cff55e3297bfc9c0187f732899f4772099c6e35b321f7f6b0fc6f8daa6649aff7692f9f3724d32d7f7cb4932ef6ffb4e32e9b302c6f86723c9dcdefc50326f9ff32e99f7975382a10fd75c32d7e795906742fdd3bd49e6df67a2bdd09ff20886beb89164fefcd54932ef9ffa2c98fca72bda0b7d6a9f25f3feb0c4f842bf9a07b0d02fd13fd0afe2090cffd6c660e85b24ae87be05a40f63e1df8277c9bc7debab643e5e575732efef6e2799cb1bfcf89ecbdbed2573fd5cfd781e1fcf952d98fa3b91cf277f74cd24f3fe0f3ec08807ba8d64ae9fc54232e98f27993faff9f13df787ae680ff4d57995cce57103c95c7fac3bc97c7c7c5f308d67b8028bf9f72299cbd3dc49e6f2981f92797fd69664de5f7e2499dbb33b92ccdb6f2dc1d067772099fca72e99b7ff6a49a6f946f437f4b9bd48267934b0d0ef77c9bc7dad68df9cee9fee25f3fe69447fcc31df88f1843eaf6e92f9f3da89649a0fee25f3f1cb85be41ff0331bed07f5f8ca7f0a7d43f13a1df9d2a99f777f32899dfffea80111faeae92b93cee41f090f7effa0c463ce77f48a6f9ee51321fafeb4930f547bb01433fecb164fe7cff5b321f2f2f92ccfb3f93d793bd745b30f421ae2593bfd94be6fd1b2692b93cde4e32b79fda164ced8ddec1d017e74332f9dbb564de5e772899e299140c7dcaa692b93db8df92797fe61d18fe3117e303fd59b792e979b164de3f8918ff05f5cf46f40ff4c715e301fdb9bd80e13f57f792797fad4a30fce906bf17f3f51ae331c4fc19a13d43f89780e693a9f0a7ed028cebfd4e321fafe6198c7cc00b2473f9bc77c95cdf4a4ff0908fc75a5c8f78bfb52553fcf02999ebbfdf08a6f10e5ec1c2bfdc49a6f97c2b99e6ff27c9642f3fbee7fab416f2407fc299643efe912f99ec692099cbd3b492b9bc9ab8ff94c63711fd0bfdb2a792c93e2ac9140f689229df5125f3feed5660e85ffd2a99fce34432efdfee00867e5e14c9941f8ec0d0bfcc904cf9572a99b7a76e25f3fe73c760a1afaa646ebf99e85fe86f2ec61bfaea0b79e11f0ba12f2eda8bfb4b7d267b98897c64dd81a1cfeb503297afbd934cf1d45e30fc93f81ef363b896ccefbf3a4a26793dc1149fae7d30f247ff2a99ea1d3fbee7fed68b05a31eb1924cf9c2083ca5f6076bc9542fd948e6fa900e2473fdbbbc09463d630246be1a6692f9f84481643edef95532b73f5df01cfd7993ccdb7be92453beb5924cf3c14432efbf5cfc7e01fffa2999e6bfb1646e5f9b022ce2cba364de3e37114cfec132c0d047f74d32f9e37b30f26b2f05431f5763c9bc7f42c1d04797e6cf99d0c71be41fc21fa52a18fe24207d9f0bfd5a1d04d3f8570fe009d573dca3642e7fbb054f697ca237c1246f3a944cf53a5b32c5a72f60f81bd796ccaf4f2bc994af2d2593be6f2453bea682e7345eed4e32d5ff14c9bcbf2f57c95cff7dd15ef8a35097ccdb93cd25537e2bfa6b3124fffd055ec2bfcc24537c548045fe518331decda7647ebd2eda6ba37fc478c01f6d44ffb8d43e1ded17e3af3960cc97f5022cf481e257a6dd149fd96bf08cc6ffe64aa6f92604c35eec4032b7efab2799e2375b30e94b2aae5f50ff58aa642e6fe148a67ce1065e927fb80d2553bd2494cc9fdf3e49a6fc45c863c07e1dc97cfcd3a3606a5f7d05633e887682497faf4bb08df8e2030cfb2bc9de17a2ff4bf49f886762f4cf10f666bd80618f3e8dff92f5177f5e914be6ed2f36e005c91b5f24533cf22598ecafeec04be467ae64f28757b041bfaf5f040f29fe68c0268d9726da63917e14a2bdd0c7f424998f5f44fdb314fd91bf83a18f8105467fdc4660e86783e789fee94a30e215e3118c78a3a0f9dc60fd45fa34072f491fc329d8a0f685a964aae7dfc0265d5f2f05537f568f60d86bb091ccfbe36248e6fad988dfbba85f8e24533e48f66f88fe892b30fa67634ba6f97508467f6d1cb0a827435ed11f35fa6388f9c9a7f8c814f157fd065e92fe5f6e6083e42f5cb0897ac417d8227dca3fc036f55fb305431fba77c1747f3b02bba4df3ad9ab29e42f669229df46fb647fe460d8d3aa0243fecd2758d4bbefc0a21eb403a33f2a8a772c263f6fff35055ba827d1f85aa2bf2f1a58f4f70a8cfb252a18febdf1c0f02701f58f2dda7f5d48a6fe9b8071fff21d2cfc83603caf51c1b87fb106433f4b1a1f87fd17eebf1b17ec903efbd43e46b0f71a0c79cb2d58c4e72d18cf2f1bb078be0dc6f3339abf5cd11f8906c6f5de1a8cf846e3f6c1cbe724df068cf6548964ae3f1b130c7f9096608c7f7603a3bde90e8ce7bb2f60b4d77e00c39f075c9f98f639e47fa34832d7e7f84c2c9eb7ba80216ffb08c6f3cc042cd64f1a30e42f9760d88fe382d19e1ced19c11e42aebf0cf17cd306435ecb04a33d610e16f20b16f1470a16ed3981457cf9443c82bdae2660e19f79bc341c8be7d70e18cfd71ec022df8ac178feaa05e379d72bf108e3df70ff369cc8fe1d8345bc9c81d1fe60452cfaeb7a03c3be74ba7e2adbd382f1fbcb3b18e3910dc1689f4df24e657fd4603cafb2c168bffb0cc6f32b1ebf0c67e2fe01e9d34cdcef1283e12faa6f30ee67f860e1ffe660a1efdc7f0ee7e2fed58c58b6e70cc6ef8d002cd6173db0a83f2dc0d0b78edbf77021e5bd078bf6aec1f87d41fabd14f2155bb0f8fd108cdfeb2330da93de83f1fc8ac6d310f2ac1a309ed772ff3734c5fdb48d64ee0fb72e58d4e75ec0f87d7202a33f0d713df4a5237bb7e4782a60b11ee681d15eed112cee1782a1cf158f4f86b6b8bf6581c5fa2af5a733823f762d30eed7d2efdd11f2efcd1d18d76bdc5e468311f2a3c007e379f5082cea75f760e8fbfa8d782cf49dfba3d150fcbebc030b7bdc83a17f099faf472371ffe64c2ceed73460e883cefb6b3416f7ab4fc463e10f2c30e46b8927e279b94b2cee6f6cc1d087ec092cec4930c6f342f24f85fc46442caef75660e8cf85fb93d18cfd9ec783f1162ceaa37cfe19cdc5fd3ceabfb990d79d80d13eeb152cd64fe9fa85f8de7c05a33df9188cf66cbec0d0c7f50d0c7df3b8ff1f2d85bcce002ce227078ceb1d0f2cfca54e3c41fb6f74bd21ef5780f17c5d058bf53beeaf46e618ebd77a2299c77f5bba9f25c6b7f4c1c2bfbd80d19eeb07f104fda1933cb678de2603e37eba01c6ef6f57b0a8ff71ff3d72c6a8b7e8d47faee88fb507c6effd188cdf3bdc1ec67d38c739e2e3c5a63393e21723269e60fde4f22c99d677b93e307577285eb7b8fd8f27ecfe9cf50e0c7d8a79ff8ca7ec7bfefb6b412cc627db81c57e823730ead9eb1158d43fb8bce399b8fe7a0716eb5d7330c663c3fb733c67eda1fa484d2cc6c39a83a11fed193ca57a651282b13e16f3f96ebc9860bdc8d880c5fe810c2cf21bae8fe3e544d4cb23c93c5ed30a30ea071b170cff92d0f81813d443d71730eaed9a07c6f53eb7b7b1c9bee7fa117c49a6f5024b30c5b3760cb6b19ec9e3adb13331e8face93ccfbaf3883f13c23013ba8a72e05d3fd0d1b8c7c734df23b53d8df86facf9da03e7e1b80f1fc82f7e76430813e6d63e229fa3be5e333194e4cd40b52b04ded31b8fe4e4653110ff2fa0a73a736f28d9a788afd67fa180cfd6a1db0588fe3fe7f32610accfb77c3f59721f2c77c493cc5fe0aaf00e37eb731788afa4e059ed1f8361f60d48f6dde1f93d914ebc7460a46bd2fe4fd37994fc7940f6cbec1e89f98cf5f93a578def5013c433d86da6f4c51bf09b9bd4dcce982f2b39cebcbc49a22fff6b83e4dec29ea15d95932adb704c433acffebf43c776ad1fd039d7886f5d315bf3f5356f09acf77d3d1d4a5fa65734f3cc3fe035d134cf7372c30ec355b824dc413dc3fb0e9906574dcdf79c4e2f74501c6fa5b74104cdfb73c3e9d4ea6d6887f7fdb10b3e791bef1f9940ddf1ceb078fe005f5b7c5e7e3e96c86f58f8d0246fd3a76c1f311f9b377b043e31bf07c693a9fa1de19df816dec07f804bb584fa3fe5accc47a86069e517b82002cd6f775b043f39bc6e3dde9923d8eeb7332035bd47f3705ec60ff824d3cc7fecf84ebefd498c19e2faf609bfa2be6f9f0d49c2d51cff5c016e5fb2b176c8f78fb8b15d8a5fa99c9e7d7a93543fdab1b831dfafde6287844f5d10e8cf1af49bfac39c63bff024f499e98ee6fb3fb937f7d023bd4fed407bb435aafb124d37e2d5d30b53f03cf87d43eeb0d8cf5dd7803c67cb7e1f63d75587f707df1e9fece7c30a2fd5d7b30f6b3469f9269fdc792cce5594dc1587fba52ffb84c1edebecd5e326f7f41faebceb19f2cda8271bfa6133ca2e727e0118d4fb2164cfa9c2892f978af4c30eca1f1c19321d7bf2bff7e3660e34ff5e53bb043cfaf5dc174bf6c0076a97fdb929805acfcfb6d0446bdbee4ed9f0d857eddd660f89b6e2298da5f05c4ac3f687e6bc0c311ad87e07a263f9f0fda77f094da537f8067245fc5f569369a1963d29f2b31eb5fdabfe20ba6e7a777e0d188ff3eb9815906c29fa78227d04f053ca3f6b65c3f6663260fd553a93d2cfca4fec91bc95cfeea041e517f5fb8fece2662fcdd023c86ff33c1d31167cd06cf21cf5c308d679d8017d41f0df72fb3e9cc1ef3ebab14ec8c69bfc05432ed47d38885fe5d4cc9b4fe37028fc8fecb37c9649f25784cf6ebbf82e7f47dbc042fe87e05f5cf4ce8936b82e7f4fb36113ca6f17a002fe8f986b8de80fe8bef4dd28fc292cce52fa68269fc4d1effb0db2f49decd0c0c7fdc92fe2ce6131a3f6d2d98fcb7bf02cf49bf370330d68fea5a30fdde38831dfabea3fe59b2fea178b0009bd41e4f03db23aeff37713decb5f00593fc2df5a7c1ee47eb6f2330eadd17156c8ea87ff7609bfc45590b267f78d5c02e714bfa6ab2f1207ff80136c87ef22918f34dfe06c67cd186c48b018dafcee3cd99c5ee47faa48217647f99609bf4c7a0f1b2160392afa3f6da6cfc68bcd69279ff949f6093daef4ec1f067f5817831a4e76de8f70ebb9ece177c806d6abfb3235ec0dfba2bc9b4df9bc6d7ed1376ae5f5c3fe703263f6f4f520a1e53fc99102f66d4be8cf7cf7cc8e4e3d7673e784c7cdd82a7d4de5a03c3fe751e9f3265c2fca09be009d94fc2e397394b87c99f186bf08cfa4fe3fd3b9fb0e7717dacc792e97c0b8f5f58f8bb20d6793d613e5f2cc7b49fc5005bd49e35b56fb1c4fcecf1fe9e2fd9f7743dfdde582ca83f8267b049ed59f3f9686eb2eb69fd782699d62fa83de67244f67de1fa3eb79643b237ef2698f4ab9e8347d4feb0008fc99e1c6a8fbd70d05f4762261e6f9f46e3e730a6f3160618fdbbe6f9c6dc5d0ea8bd0df5bf6b88f89aebdfa25f00a5f8ff4e32edd749c0636aff66019ee17939780e7de2f92a73f643e8bb031e537b7c133c237bf5dec073ba7f44f71f1a225ea3e78f447f79dfe011ddcfe3f22dc68c29feff06e379ba0e9ed2ef0b1effb1747d44f3b1fd0d5ed2f78d0236c65cdf367c7e5fb0009858bf07cfd15f7bf082f4a3492473f96f19d8257b6df8f82e66cb05f55fbe223630ff6f797cbc98b3f67079527afe82319d17e1f6b7581a03fafdc693ccc7d7a0fb194b97da7bbb111b63f2af1bae9f0bd31810eb7cbd61612d1dd2bf94da671943c8cfe7af856d8c69be6e0563be594f2573fdd7b8bd2c1c763ded0f53c01392c7bb4ae6fdd3717d5db8c684fa4bbb134cdfa767f094e28180fba3e5c080fff15fc0b309f5ef9764d24ff13dfc43cae7a3e5d0807d6cf8782d47acbdfcfeed0b783ea1fad50ebca0ef6f3ed82079a32f30f2c5644f6c627f5acce7df655fd0e1e3930460a662dc3f1cc14beaaf40133ca178a8069bf47cdf90ccc74ff3c10e8de78dfa676c8afd09b564daff5982b1ff36a6f64c58ffd2fed40b7836a1fac504bc9c50fd6101c6fc97abc426e2b3700fc67911f3018cf33ac99d643e1edd198cf3176e07463da4fa0063bf8826be47bd53e7fe773965e345fded806db217eb1d8c78f29612b3f6923ea9603cbffb0663bf4949d7b38083c663b3022f68fceb7bb043f6118682a9ff8c02ec92bfcbe9fe7dba49f5c30d18fb636c9e2f2ce7ecf7144f2a6097e4bbe5c4ecf7140fcdc0b0b734018bfde03a784af3c53504cfb15f47dc0ffb0bbb8160ecbffc002fa95e58edc1d8bf1a4dc1163d2f36c1a8575495609c5f1a4aa6f3a134febd83e2ed2f376093faafa3e72fcc01f1f50b3c217ddd5660ac37ad63f00cfe5407cf69beef5230ea35c6026c60bfe55532e55b39d8a4eb6f73b0d8df20ee6f637fe04a32cdff03b043fd757b904cf9d9168c7ae7ed2299ce7b3692697fc898d8c2f99ddb128cf3b317f49f85fa6348f75f1a06d9afb604c37ff817b04dfa1c0ec10ee9bb4ef22ecd015d7fdd8047345eb5079e907e598e60d2d7b40363ffe3762598e2d5750e16e703d692297ffc128cf35768af897afb36108cfaee5c32d56b0f9269fe2e24f3f61731d880ff5125d37ed80558ac974c25d37ec09d64de7fe64132f73fea27d8a2f15732c9b4bea008a6f655a23fb1dfb28c24d3fe470d8c7ae1ed5132e95b2099cf8fa6e82fd4e3c32fc9b4bee3125b38ef7723ff641816d99b7d03dbe48fc22bd8a1f9f95a825d9adf4af28706eb1ede5eaf060fe97aaf133ca1fc5605237e6d8ee009e5bbd5198cf58b4efc1efb6fb71730f67bae66e025c5df8a09c6fecae020998fafd248a6f3ba909fd93b6f4f71025bb0af52329ddf9849e6cf533fc036e993924ba6f96726993f2fcec00ef57ff12e99e2c34a32ed7f0cc1f017d5bb649aef7cc9bc3f22f13c97fa4fc3f859388f5a6d25f3f69443c1d86f3b06e37c4be54ae6edd354c9bc7dd791643aefdc4aa67acf2b18e7f134f13dced325a4ef26d3379affc95f9826e2cb952a99c6f7153ca57835fd0463ff691108267fb579028b78c2001b34dee14532bf7f62814df88b4832d52f2ab085f59d0118eba3752899ecff2699eae307c9b43fb405431f9454329d2fbb97ccdb938cc02ee95b2adaebd2f8b590dfc279e448974ce3f12998e67b4d30ce074713c934ff403e0be72d2dba9fc5e607defeca014fc85f5413f094e2313b954cfea0114cfe467901233fd41792a99e6a49a6f527c198afd71bc9549fb9822dea8fba944cf9502799dad782b17e6d7592c9be6782495fea42321fdff8c7f77cbcb477b043fa1deb9229ff4904e37cc697641a7f0decd27828aa647abfc45032ade7b982495f13b25fcbc2fb0c944032d9cb93606abf5949a6f314cf60bc4fc00a24f3f6b79960d29f5a914cf11dfa53d87bf82999d6df303e16ceb755a4cf369b3fc8ff7660ec3f57de04933ff0f760ac5f665bc114df2b67c1a44f57156c507f5f1cc9b49ff3198cfdc69bab60aac7ac4f601be7fd22c1781fc95132ddaf95ccdbabd492b93e794f60e883229e87fd9ef959326fbf3a964cf9e00318fe5d9d4be6fda192fed916ce83a92f92a93dbe64ca8fd11f229e4c6f92f9f3938164ca1f4f82b1fe994ae6df871f60acf79a6bc9bc7f62f49785f3b1b75230d95775914cf30bfacfc279b22df90f47c413a621995f9f7be011f99b6d2b98e2136d021e4f683d63059e4cb83e7ae2fa19dd4f3b83e734df943118f581f22099cba33c8397549f592dc026d69b8f9279fb6f9f60e453d6156c537f5a63c9644f8160aa47695330fc8dee0aa6e7c5b964f28791648a6fe692297e580aa6fa6628da8bf8c3bc974cf9642118fa38954cf58f89649acf1692e93c27e9936361ffbdd149e6df2b9e609c1f7d96ccf549ad24d37974e887d0676721998f8fba924cf1fa9364b247713df687754f92e9fc672399ea45a23d581f35af92f9f7b9f81eef13885ac1181f4b32d5dfa10f16f6a3044bc974dee9158cfd3f892399fcbb2d993fff26fa6786fd3ba23f711ef146d7bbcc7e283f7b944ce7995ec0639aafab25784af671db0a9e52feb200cfc9fe320f2cec650f5e52beae7d49a6f319e2fe4bd457766083f453bf80b11fa878154cf6b2adc1585f37c4fde0af235530f251717fc45b9e90d7c17ca848a67add5530ad1f74a160aa8f76e279c8e7c34630f97f3b174cf2379a645abf247fe35a781f90ff2818f3c1443297571d49a67cfd4930cd87da1b58e8ff5630ece74b32cd1fa564aaef7982697dc87900633f73694ae6faa0be4aa6fd789a648aa724637fd25a32ed3f79924ceb3d3330f6f325ad64de1fd98364927f2598facbd42553fd3594ccafcf311e16cecbdf22c95c5e652a99de7f267e8ff3c9e1bb641a6f4732bf3efb008bfd812f92297eb32473794b31bec87fa30a2ccea3ee0493ff30f79269bfe23718f53e6b2099ea0377609c7f34be2453fc7b914cf91c1f2f63c0e6478a0fb6e019d58be207c1538aff8fe039e503712b99e6eb5c3297a750c04b1afff22618fb1922c1347fc73bc9b47f4630f2f9eda360b2efab2e98fcd1ea158cfd83452598f47f6b48e6cf8feec1a8b7a40bc1f05f3bc9bcffb61918f596f85d32d5e3447fbaa48ff94030f6ffdc24737bf267c416f6a7ac3f2453fe580bc67e99122cceeb9c24533d6b2299f4ad108cfce30773fd500cc9341f7792a9fe6b0ba6f5da6b2399ce372ec1d85f1d9d25f3efd59b60f89f3bc9bc3fd4a364f22f6f60ec97543792797fa8a960d8c74d32f9932918f61ed49269ff832d99e44d24f3f61a23c1d43f96fc1ef1fe1c8cf763448e645a3f16cfc3fe3d632899e2955832cdafd01f0be7d5ad4a32ad9f3792b9fcc64030ced3d792b93e9723c9b41feb02c6fe67732b99f68b7c4aa6faa3180f9c17f6499ffa032dc46bf098ec5d8f24d3fe08133ca1f530ed049e527eb7f50593ffb83c48a6fd570a7846f7d36b30e6fff25b32d5ab73c1145f28ef82299ed1e660d473b64f92a9def92698fcdd5a3cdf46fd24914cfbcd74c9b43e21e445fda611f7437cb1fe124cf65edcc02edd3f7225d3fb001e05d3fc5ebd108b7879bb93ccfbc72f05937e66a9605abf538e92493f56e021d99f6249a6fa5b2b98fc9f72914cedc3785a789f52f12698e42943c964ef17c9e40fe792697e1849e6f2648e60ac470660bc9f243b4aa6fd3fa1647ebda20826f9d24c32ef0ff55e32d5d7447f60fe2f9f25933f5a4aa6f8e62c18f9502299f40ffa61e1fd4b4a2899f6279492495ed19e29e297028cf795048d64dedef05530e29137c9e47fe4efb19f740cc6fed152134ced0f55c9fcfb488c17dedf74b9934cf64dfa3c326754ffab0cc1643f510ac67a78ba04633e77466083ecb309c026cdffa921998f476582b19fa7ba0aa6f93e5e0ba6fca6188051bf4b447bb1bf4aff00237ff60f92e9fd41f792e9bc7d2599e6f717c1d8cf247e8f7a5d160ba6fecf23c1b4bf21a0f86264e13c72f82499f2fd57c1f06727c954bfcec098df755b30d9ef7a2e98ecdf78974cf54cb447d47b3d5330e2cb0fc9b4df47dc0ffbd12ea9647a9fec1e2cde07f92e99f60b1c05239e3e4ba6f9df974cf9d74932ed9ffff17b2e5f70014f90ef288261df8664b25f5332bd6f0ae36be1fc4ef92499f22d4b3297ff593c0fefb7525dc9e4df3c30de5fa53a9229feb12553bc2ec66f46f2565f92c97f37609ca7b4df25d37e825a32adff89fba39eaafb92293fea24f3ebb7627cb13ebbfd944cfbadbf2453fe37154cf287a664d257d15e715e80fa6fcce673f2af117846f94076075e503d2188c1d88f9a9b82c91f2457c954cf38832df2279ba9647adfe70a8cfaecf62098e2ef6e2699ce27ed04533cb2d5c0d8efaa3c09a6fa46f12199ec5d3c0feba51dcd9f63517f5dbd0886bd3f4be6d76f7f30d59b62c164afde5432d5271f2453bdf0118c7abd77124ced4f1ac914afae2553bd5edc0ff3b9f32498ec6d1308a6f66c55c9341fdd83313f9ba23da8ef46a564dabf664aa6fd21f27b8a37e291643abfe249a6f9ce174cfb13a2028cf78b25b9647a1fd4a364f20fdf92c97f0c25d37a512599d607a03f22bf375ac994ffa49229ff78944cf94a2618fe48fe1ef59e4632bd3f270163becf2ac994bf8beb71fe4b0d2453bd27964cf552d13fa807da2f9269ff612499e627d13ed40f424330b55f13d763bfc6ed4332c50f37c1f0f78a64daff3d964cfb43c578637daf7a138cfd39429f719e6745fa30314df21f590ec6fedd32134cfbb10c5d30f98bcb8b64da2f3c01dbd87fbc174cf5c92001e37c4d25eee760fff1b7605a0fc8b792e9fc81b8bf43f149740263ff68fe2a989eb722fb9c8878201849a6f75f9e25d3f37cc974fee15532bdaf752898ecdd0904d37a475080512faf7e30e9432e18e7f56e82914f5482c91e0bf13ce4ff7e2698c627fb924cebcfe2f7d8ff1b3e80719eaa934cfaee3992491e717ff80f6f2699f22ff13dcecfa753c9e4bf0e92293f394aa6fd139660b2cfc8904cf9df4230e68b4a32add78bf1c0feda740ec6fbebcab3648a8f2792c95fd492299e1848a67ccd164cf25b2d58f887ab64f2379d64de3fea4132bd6f4efc7e8e7827944cfb7f1e2553bd4f134cfa6c799269ffb6781eea8df14432b57f2718ebe591645a2f8b05231f15bfc77e0f652699e229f13cbc7faa9a4ba6f361427fb03f5013fa8cf5e2c495ccbfd73dc924af180fec0fd33e24737922f17c9c6f6cc91ea626f69b5e13f082fccfe64d32d547bfc0385f565ec0886fba1cecd07a663394ccfb237b05633d627b144cf6779949a6f75fd682c93f06349f4dc5fa433d154cfaace982697d721b4aa6f3c11918f585742299fce5bd64aa67958229be5ac560ac27ac12c178bfd79b64da0ff1e37b7adf95fc3dcef70592a95ebb174cfe3a10cf47fda01c08c67e1b5f32bdcfb0134cfde12a92493ed17f585fc81f25d378dc49a6f8e253308d57249e3f417c7a904cfbcd7e30c5d382b11e982592797f24df82b1de954ba67aa6907f4af69baec138af6c8d24533d692f99ea733bc1e4ff3c0b2cde37be944cfe712499f2b1b964b2675732c52bd0670bfb45d54832e58fba64da0fb301e3fd8d4a2499d67f857ee0fc72f82d99be5f81713e3e194aa6fd49e27e588fb89ec1884fae13c9d4ffa27fb0bff0229e67537fae481f66e612fb2d776083ec3debc026eaa53618f18a3b0323fe580f04d3f5c98b64da7f63825df217852e99ce77907c33113f6c4dc134df6f1f24d37c9982b17ee04f05537b9a77c9148f88dfa3deb07a92ccfb7f73168cf365778229be48bf25537d19f28bf501e55e309d4fc94f92c97fcec158cf2b12c1e41fbb4fc9b43e3d104cf3f7f6158cf87ebb170cffe448267942c1e47fba05187f1f455049a6f5614330f4ff0d8cf3b88ab83fde3770d94ba6fafc12bca0f6a557c1c80f6dc9644fb964aa7f1492a99eb1934cf3f718bc44fd632199f2ab67c914bfd782518f16e389f78346a23dd8bfa58c25d379ba4030c95b5f2453fc5c824deacfec2299f6eb6c25d37ae74630e2b94632ad170bf9b13fb87b964cf514713df61bd4aa643a9f0f7bb31cecbf10fa28f6e3f89269bd83e2adb9399f52bd33032fa6fcfef9086cd07e8d95f81eeb1b97a964b2bf0dd8a2f958ff02dbb41fbbbb825d9a3f2eb5608a3fe28560caafb6141fcd45fdb11a83b11e180f05d37e5c5f114cfe669d8051ef6f3dc1a40fab108cf3d9e55a30ce3b1a60d4d78bab649a5fe5f7645f978364dededbb360f247452899ea616730d6e7d6779269fdfb4330f9bbd4148cf8e7058cf5b8e44932bdffe25e30f6835c24d3f9d1b964b27f713decdd16ed9b937fd2f792a99ed2082679a247b0380f33964cf3ab18af05c52f57d1df381f5baf2453bcff0046fcacfe60daaf6a4aa6f9ed4b30ce7fce25d3fedd1918f65f8af1c37e6d4f954cf9cf5a32c927fa17fbede254326faf22aec77c1bd582a9fd971d58ecef3524d3fe5ea1bfd84f97d1f82ec47a83be124cf5c8ca07dba4efbab8de9df2dffba44f0b51afeb5cc1747d32154cf61eecc043ccf74f9269ffd3098cf7495c1e25d3f9c14a30ad9f281f92693de2001ee3bcf34430e94f71114cfe259883f17ef6b52599de2f36144cfaa23c4aa6fafd188cfa79d60a267de832c1345f1786649a3f7e30cd97a2bdc86ff55232c54fb9648a6fc4f367e44fbaa1649a5f669269ffb7f87e4ef6915f2453beaf4ba6f9443c1feb655a2c99e47b944cfb532493ff6bef25d3f86ec1e2bc532318ef1712fa82f3cdc55e32b5ff1b0c7b5acd25d3df9fa04ba67ac25e32bd0f44b4cfc0f95ad13f787f759c08c6fb8f34c9141f6e2453fee80b46fe22fac7c2fbafef24933f17fa8efdf9590dc6fb8d4a8a079626ceb3d513b04bfa5a527cb664f645eb65067848f359fd8369bfec063cc27ae45532d5e31f25f3f15c3d83315f5d12c9544f740553fe1e6592a93f3dc158bfb88127145ffb9560b2873a96cce5d75f25537ce90ba6fa62f283a95e2ae49bd2f82b0f82c93ef385645a6f17ed453d39984aa6fac04c32fdfd5607c1a42ff14a30cdb7b74232e5a76f60e483fe5132cdafb960c4fb5f60c4aba52218ebaf7b30d69fb6e27b9c1f0ceec1d82f962b92c95f1d24537da7148cf93d05239f534f92e9bc8bb81fcefb1547c9544fabc1383fe68af1c67e92f807d3fe43213ff6af7662fcb19fdaa37cc410f5ebfc5e30cd1f6b07ecd2f85a347e06332faa8f1cc0d0efdb17784cf6e91a82499ff44ff004eb318f92693fdebd649adf5f05937efa67c1347fe91618e7bb6e7782112faa60ac8736a1601a8fac00a31ee98c05e37d155bc1347ff8aa647a1fc009bca0f1f21682c99f9ae2fe0b6acf360763fd62bb168cfcb0148cf7790879f1be9ad4954cf53cd17fd8bfe49f24533db1164cfdbd7d07e33cd346fc1efb17b789643a4f300423bf303760bcdfec42f669b27885ee47f38169e1bc977e124cf18d3706e3fd11fa163c22fdda9482a7b43e7805c3ff058660ba9f2b9e87f364d14632d5fb4792e9ef37fe02e33cd926028bf364efe039c9b712f747fdd9ad24d3f58231fee58b601affdb9b648a6f7230dedfe12d25d3fa760a467d3817f218145fd99f9269bda1924cefdf93df23fe7e009b349f98623c2c1a5ffb2298ee97d8609c3f32e6609c3f8b2cc9646f0bc914cf3f4aa6786607c6fe958ee20f8bcdafb43f81e20b165e93fe5c3e25d37e30f13dea3ddd093cc27ede2d18f5983804e3fd1d9a25989ed7168269ff61fa089e223f9e8167d47f862699d6f39e25d3fe68152ce2b70318e7c9ec67c9f4fe12138cf70f252918f1932b9e67507caf08f9f1be9938069b648fc15e308dbf32108cf7df88e7637f627c150cff7a0163ff42f000c6f99c88ec9b4d37a867d1fc62b3f1a3fd3c743f5b8c5ff102463cb2da82117fb4df9269bde12498ec510f25d3fef01c8cfcb8b425d37eaa5232bd5f2506235ed85a9269bda4154ce31d89f6cef17ea8037841f76b447b17d84fb6012fa9fd6b211fea49978b608a4f0c156c423f3bc9b49f3602c31e6f7bc1d0bf4a32c50fe44f6c1bfb3be22918e7e93a6287d907adb70ec063eacfd51b784afdb3d1c0c85f8a5232cd97afe0398ddf652d99fcf75130e5879d09c67c961482c97eae7bb049f74b3ac9349e86649a4f2692b93cb978be8df749b88229be509660eca7f39f24d3f922713dd6afaedf8269bcd690c7c6f9d755001e52bc5b533ceb5a63d29fab2199ce63edc1139a9f82083c25f9f5068cf745dd2cf082c6238d25d3fb1d378229bf503ec178dfce6a0946fce9bd0aa6fe5ccf04e37d0af27aca77ac1bd8a2e747df9229fe2dc136f98ffc4530e9f34a934cf9f10fa6e78be739387f48fde9daa8f7273c3e310716f67b260f9269ffde1318efefb91e24537dcd06e3fd79f6156ca0deb1904cf6a080d1fe6a2199e67b5f303d4fbb801dd8fb0a8cf8f9a611db78ff5dac8211df745f60d413133e7e2c389be17ccc183c27ff97459279ffac4b30de27947e0826f94c4532bd7f5d032fa9fd6d2a784af58e21d8a0f9e1aa48a6f53f5b30d58ffd6730de5f94ad89ed01d9ef86eb2b0b2eb0feac6fc04b92af7525d3fbcd8f6093fccde64532d9cb4d30c57fe1128cfd33eb77c1a41feb028cf7355a1f82e9f9ee1cec62ffea9b60f227892918e785f0bd8dfdafe9b3601a4f270463fda81980f17ea59adbbf3966fd41ef472dc14bf2075b1b6c60fdec4132d50f0bc9944f1cc126c693dad7bf5e9ff2075c6f63bd6b45fd33b1e6549fb8adc0580fdc7682c97fdd5ab035a5f74309c67961e50bec523c1de2f736eaf7f11c3ca4feaba8bfa6d664467fffdc080c7f53b492a97e6f08a6f686776013fab4964cf69982717ed224ff30b5b15fe81608c6fbd3ce60c48b2d8dd78cdd8ff2eb5430c5839b5730f2dff60086be74a4af33d6ff148fdd8391ff6a74bf390b30693de808b6917f64c436ce8fdf1230f6bfb7345e0b6b3a27fbe9c0f319bdaf8bfcc782a5f7e43f0f60cc4705f99f256b3fedf71c826d92ef3625b627349f68dcdf9b2c9f9b927f237d3458ffd1fc5b8327f007241f530f1aaf6b00467cad51ffb2f8674efd41fed5b6711ed0e4fac192cf39b57733022fe97ecf977feda32abf7d8c9f3e26ffa7827fa74fcf0afb9da5daaac3fe58ff6a0be8f3df21cb2f72b9ecf3bb5c0afe9b90afff77f7df5116d62247f5d81ffad87ddba87590cbfd87bfb3f1f9779605f20899fa6be8cfffb79fff167b71e9f393743ffadc1663f4e33aa96fbdedf8eccf3f18b9ffff65e16dfbc90e6009240d1fa9bf2b3bc9439ee0df4d1661eb3f64f9313a3f24f3e4e717cbfa7791e5379fecfefa91d758f05a8e94457a8a7f2b590235542335561335553335570b364ea55aa917b5669f86e951ab76ec7365b2de544dd5d99f15ff9dc67eb1fe379365a3aed827652391a85bf6b963d2ecd43dfbec982c07464726dd91fdfb4e3da9f74cce7bf5817d0c76e53ff4daff5b6479e43dfdc446e699fddb597d515fb94ebda9efea87faa906ec9a9449f8c524f85607ea501da96375a24ed5993a67d2fc1bc9c25a7a5637ec9f91ba607f02d8fd92c9f2cafe6929aafaa4284cc7be15431d2ba662b18fad380af31a8aa7f8ff3d92fcf7cc954aa0844aa4c44aa2a44aa6e44ccf5ca63d2dfbf4b6622a059b45064aa954ca45a9954669954eb92a3745537465a5acffe8b5ff37cab251b6ca9db253cf8aa2ec95036bf1513929f7ca83f2a83c29cfca5979515e9537e55df9503e952ff6dfbf9581325446ca589928d37f23596c65a6cc9505d3b393b26413cd83f261288661b044c0b00dc7700dcff08dc0088dc8888dc4488dccc88dc2288dcab8a87746fddf23c99f9345b58ca6ff23a390df6677a3353ae36adc0ccdd08d95b13636c6d6b83376c69efd391847e364dcb3cf897d8e8c1fd8e7d178329e8db3f162bc1a6fc6bbf1c1b4b0cf02685e757f9b797f9aadfe999ff8af6561527c1a5feccfb7313086c6c818315fd4186363624c8d194b9916c6b2370ad3304dd3326de3683aa68b8fc73ebe19b04f684666c465eaa53a9a31936a6726666a66666e16666956e6c5accdc66ccdcebc9a375333757365aecdcd2f33b1f2eb1cfcd764311a736bde3169becd9db9e7b21ccc8379344fe6bdf9603e9a4fe6b379365fcc57f3cd7c373fcc4ff38b7dbecd8139c467648ed967c23e63736aceccb9b960992a3334e3de322cd3b22cdb722cd7f22cdf0aacd08aacd84aacd4caacdc2aac12b9dc2f91c5ffaa2c56655dac4b3f2e566d0cad5a3d5b8dd55a9d75b56e9666e9d6ca5a5b1bd6d3f7ccd96ead3bd6522689b5b3f61677bfd6019f2393666a9dac7beb817d1ead27ebd93ab351da592fd6abf566bd5b1fd6274b98bf5884b0601e3d61b3e9c0faeea3cf1fd1d1bfa2634cb31a8bfe82f001fff74a89aca135b2c6d6c49a5a336b6e2d7acdb196cc74fa4a9ed18f85b5b34d48f2439643bf4c614e6ddb766cd77ab03ddbb7033bb42326cfc178b4633bb1533bb37336abda766197ea935dd997de92fecce74fc932307756cdc6646055aa67d77663b776675fed9badd9ba71303fec95bdb6376c249ef9676fed9924625414662bcc5e602bf766681bf6d6beb377f6de3eb0cfde3eda27fb9e8debde7eb01fed27fbd93eb319d7b35fec57656fbfb1d1b07efffcafc9f27cb16a66274cb78cc6f8b4df992c1ff6a7fd657fdb037bc8faf3c47a7864bbe6dc1edb137b6a2db924bb7e64fab161ff9cb1f6ce85fd9b91bdb0972c485698ddcc1dc3311d662c8eed384cd2bde33a9ee33b8113b218f5dd89545df17fcdecfe155954d7183ab113333bb1edda499cd4c9ec2f27778a5e0ea7640ff0ed3d6b55653d3b17361acf4cc706cc6216dc6ed8ff3b356b6be3b44ca6b9d3998173756e8e66f7938feeac9cb5b3b1b7ecf78eb365d21c8d9d73e7ec9cbd73708ecec9b9771e7ec9107ecb7a7eb6a03f234b2f09f3c683fe7ecea3f3e43c3b67e7c58cadb33db1ced6b33d6656cc3ece2b6b5dc5dab5c0a7f765ec63cfe9e374f8bc39efbd24f6d20e9d0f66fd47e7d3f9ea7fe954ce379366dffff5f6cec8e9ff5acca933b3eb9fe4f8576599ab9db3b05f9c25fba1e21a6ce2b08c23f34accd3bab6ebb8aebd702a73e17ab66b1f5d9ff9a8931b981fccdacfaca5f76ec86c2ae673e6d18ddcd84d98bde0e3746e6a7acc73b02b594fbcd93336be67377373b7704bb7722f6e6d176e63356e6b358ae67656f3afe8987a70afaaeddeecd6d55cdd5db96b3626cfeec6dd9a43f7ceddb97b3622dbde86dd837bb4576e6031ed331df7e4debb0feea3fbe43e1b817b765fdc472195fbeabeb9efec5707f7c3f9703fdd2ff7db1db84377c474f1c0fe7dec4edca93b73e7eec25daabd2f6091b8a7aa81f70fbdda9f91c533d8f46d79b6e778ae937b9e71b2179eef055ec8e4601fdbf0222ff612e6030eb6d1eb8c977a99977b85577a9577f16aaff15aaff3aedecdd33cdd5b796b36e7c7c6c9db785befce7a70471ebb0b1b5d9dfd3ff36fde8e59cec1db7b07efe89dbc7bb5f01e58467af31ebcc71f5af5bb1ff853b23c79cfded97bf15ebd37a730637362dbde3bd32f2e099368cbe6f229b39ae7de76bd0fefd3fbf2bebd8137f446ded89b78536fe6cdbd85b76441d7a3aff8866ffa966ffb8e71f45ddfb31e7c9ff9e8ad6df8811ff663e547ee8069e4831ffb899ffa198bd6be51bffd523c9189fe75599e2f7eee177ee957fec5af0d6603e6d46f7a49fc967d3aff6acead27ffd6cf77bee6ebfeca5ffb1b7febdff93b7fef1ffca37f62f966a2bef8f78aea3ff88ffe93ffec9ffd17ffd57ff3df8da3bdf03ffc4fff8bf9f485bd30c74ee57ffb037fe88f8cbd3ff627fed49ff9737fa1382c27fd6679f70f597ea97dfc99d8d25f066aa004060b112da65f6aff97c0f7fae5b7811d38fe3570cd0fe31478811f04411844411c24411a64411e14411954c14509839a7d1afb3d68838ee59af3e06a3f07b7400bf460c5fc48ef0d9560ddeb99ad30d906f6c27a0e36ecaedbe02ed8057ba50e0e4a191c8353708f0af54f35ab3f2d8b1d3c048fc153f01c9ccdd829ad73f012bcf6da15bc05ef81137c049fccf38c83afe03b1804c360148c8309fb330d66c19c49b47016c1325443253442d3188416fbc39c71e8865ee88741188651c86cc73a8709f3cb4698f29881c50f61d6fbfc300f8bb00cabf012d661e32fd421d3b41fb2387f94e5e77af6cf63d25f1db661175ec39b19875aa8b3bbafac636f27e13a5c33795e8c7b2f0d37e136bc0b77e13e3c84c7f014de870fe163f8143e8767f52d7c095fc337ab08dfc38ff033fc62d2982c22f6d97ff90e07e1301c8563e3184ed82cb40dd6e1943d63e6ee99fd7c9b53f6dfe7e1225c466aa428456444e68fcacdaf5a46b288ff862c28f1d4c8525fd5d7c88e1c7f19b9e673e41987c8376751c02375a61351c8e2f7cf88e524511c25511a65c62dca8347ab65f369cafe3c4645f01895aa1255d125aaa3266a5910d345d7e8166966678ccc75d4467ab48ad6d126da4677c629da452c82f0039ef778d68ecdb40bf6bc7d74888ed129ba77d2e8217aecefcdabed866af4d1eeaff6f2932c068fb043b77516ca2e7a8a9ea373f4629ea357f6a437e6750d16a79ca37773c2e6e8aad7eae823fa8cbea2ef68a0ce153f1a2aea8f2a2c7f9e1b8da27134096d2b8ca6d1cc8aa379b48896b11a2b56111b319bac629b85166eccbc3d9f73962c7f93b29843e33ef6e3200ea3fb388ae3f081f554cadbcafc5a1f25fe2c0b7ff68f7131d4f8f9e22cd4f73889d3388bf3b888cbb86277bcb0f87111d7d6dedd5b4f7c2639b959dcc46ddcc557ff515dfdb4f662cb3bbaca5875e25bacc5ba3f8b57f13adec4dbf82edec57ba5890fea323ec6a7f83e7e881fe327e3143fb3d866c9bc7380b86e689de373fc120ce2d76011bfc5effd88736b3055a38fdeff992c0ad34726cb6b9cb8adba8a3f4c23fe649db7641ec6b09ee3da665ed3fc0c33f6dcaff83b1ec4c378a456eaca7e51ee94713c862c3c1eecff9dfdb7493c55f57816cfe345bc4c54e3c17e4894c448ccc44aecc449dcc44bfc24484263efde9b3e8bd8d887e7a42c3b65f3d6d17c4da2244e92244db2a84872b1baf07765b1c886f8155b36bbb2fe65914fa2b8499194e69b71f26fd69e8dc9d9b998dff6c13ad953e39054c925a99326d6d5f7beea9db4ccca52f40d55c1d97d95bb385332bb4abae49adc12cd38252ceb4956c93ad924dbe42eba26bb641f1c9243724cd82c657a8ec272014364d94c9b4b2f4dee9387e4d158264f09b34ab146d2e722ff4c96e499f5e198e50e2bf6efe7e4257935dfad3e3f3f276f56ff8afa7df26ece8dfb709c7c249fc957f29d0c143d192a8b64c4abe3bdc7b4fbac8dc9c264b2df93713231de9269324be6c63159d8c76469c6a99a2aa9919aa995daa9e3dfa76eeaa5bef1603a2cbfe1b2f45910cb54b769601cd3308dd2384dd294cbc2d76dfa7cc4180aaff6932c96b0fe3453466e6b97cc8e9d344f8bb4343fd22a4c98f75a5afdfe8687f4621becee75daa46ddaa5d7d451f4a04b6fa996ea91c9fd3f978549c3644957e93adda4dbf42eddb15fedd3837d4c8fe9c9d8a7f7e943fa18fae953642b7a344c9fd373fa92bed2c8902c2ca7db4681719fbea5efe947fa997ef5feb197a56f7f9f5bfd2acb8f91e17a78607dbb5412ff2139a7dfce9069eb673ae86da5f7c54ee5fa696f8f553a4ac7e9249da6b3a4b50b65c3f42c5177fe23ef31361a7d0edad724d379ba4897999a29c63163f971b4efb3e3ccecb3e2649559999d39ea57ea0475e6665ee66781e9fa81a3a06ab0eb675096e1c5599845599c25ce23b3172e8b6af5b9d52fb2889a9add3f99d14efd4a064ccf952c553eb2cc74cc2fe61b077dcecbf477613d982316e37efaeb2ccf8aaccc2a61e7e45b98b34db24b56678d5dc763f53b6bb32ebb662c62f343d6df6ff6c2fd66de9c652c99661ce3a74ccf56d93adb306bd3b36d76e74efa5999c53363a603cf76bfcd8445369691edb23d93e5901db313d31d85db7491ddff268bf28b2ca67a973d3032b24743c99eb82ccc37f67d642ebcc4661146f69c9db397ec357bcbde852c1855577d4bdaec23fb8c9e93419a655fd97736c8d8e866a36cec8eb24936355da7cc66d9bcf7ebacbf17d93257734509552b377233b7723b77d8377d3d6dc29edad74398b7cedddccbfdec900779a828ff4496be024a7dabf8bd36f63edacc23c330ee982cbd97efed70c024619219f7799c27fe364ff32c3c30597eac4172bf95e779919779a556f925aff3266f8d63dee5d75eb7dc613f1ef9cdfdeeb3e25cb316f153aee7ab7cad9eed32dfe4dbfcced67396c1b09879c8729a4bafd9feb7719f29f93e3fe4c73cc88e4c9b1392c52afe812cbd0f559209d332db2ed5263f1926f32baed05ca6678eed5877ecbfbce6f7fe5dfe104cf347a3fd690d92d97afe943f671725cecff94bfe9abfe5ef7dd4937ff49909af719cddaf6cca73628dcd8871fe997fe5dff9404d9cc833f3613ecac7f1579ff1997dbc4c51b4cfee30c9a7f92cc9988e1d59a699f47e377c0bdffe200bb75792259fab7b854d65ea77be302c63cfd2fb1dd5bc481673943bf9b2500b8545f5b3e8814547b6dcabc0575793b1fa919f0ba33059b7d9ac557d2cbfe8f312ebaeb7e4c2e96b1785cb62ad53e1157e111461112923d52ee22229d22233f67d5ec365611ac6aecdd98cb92f8aa22caa3c2459faf6b398f5f597f9e5375958c6b34f6fcc62be8b0b7be4ce74a97227646177ae8ba6688b2e288a6b714bf25f7684303d53fc645268855eac8ab5710835e7b597a5d8b06cabaf6a7ef4d5be60cd243916dbe2aed815fbe2a0d8c5317b284ec57df1503c16cc3efa1a279764614e0b268f7128cec54bf15abcfd248b1aaa7f57164fcab22bde59fe742a3ed894b5efa33c5420875c9645f1597c15dfc5a01806398ba2c90bffd8555114a3625c4c8a692f4931ebd72c989ea8c5bc8f467b5b6677e03163b12cd5ecbb544287c540d7d250c2d22cadd22e9dd2354ebc22c2ae36c7f6a1f498cdc6a55f06e1ae64290dd731f7efc822d654c40cf3adb665c472b053191b2ecbef852cfb5e16f3cb3a9749999659996749745f163f564a7824669465599597b22e9b5e92b2cd34661b565f3b6371dc985bb4e10ffaaca7ecca6b79b3be4acd0a4a9d8d67c4a45995eb72536e992cbabdeda326368e5bebbecf64cabb7257ee7b591425cd7a6d28b552fb45961fd13ef773ea8dcd103b75c56439183e1bebc81c5b7d3d2cb0674e63cfcb63792aefcb87f2b17c6271ce86e527a398c594ca9d5d97cfe5b97c295fcbb7f29d79d12eef32adafee9bb3bebec13f337b5f7eb079bc2c3fcbaff2bb1c985d392c47e5b89c94d3c42d67e5bc5c944be3c45c7d156a7c4c0f665f1939564a655466d06746a7e0d4ef2ab2aadf62fedefb3059d8b7663f36c8d834bbaa2c26cbbd19b2deec97483a264b6b06c6a1b22bc79bc5e3a00996e5c4dc562e538ba86236cfa29545e5574115329fca66bb3ea736471513d73a313946fd9a4515dbdb2aa9d22aabf2aaa84a2bacaaea52d55553b5556745c1b1ba062b362e5ba7a355b57ebda3aff254b74aabf42467b21c83a36ad9f51f641151a5cf6571d488e9e246bd315559556b264bc4662c268b193269f64c96a37bf65a6fae2e2387e9eb5bb5a9b6d55db5abf6cab53a54c7ea54f575e17be6c717d681c5d5233e26a3fe2ebd3d570f4c96c7eaa97af646d5b97ab1aaead5dc556fd57bf5517d565ff128afabef5e966ac07ac2e5f5cf678bddb11a56a36a9ce4ce23c6c5339adf627e4bca6270efba60d1ee539ac5a36a524db98e912c51af654c965335f33a8f656bca3c34ccae9a87af9eaac6ac3f17d5f2a26637f7f5a25cb81fb615f38349d17f26b406c3ee7570377d7e75312fd6c5be38e1cbc5bd78179f8d897f092e6134b8449798c9d2b91fccbadefb159cde673059946a7449823e47f6d9c7fea32ca859283c96225912f549bdbfa4ec9e593fc6fdfa9c6df523d4af3d18a774e75d2fb9925e8ad0c8eefbbcfd525eaacbe5525f9a4b6b9c2edde56a6fcdd1e5165f98bd93244764f10773e445d68e5da55df4cbeab2b6c2cbe6b2bddc5d7655a7b697fde57039ba2fbd2c173633b1d8cde27fd5d684fde2fef27079e4b2a0adfd5add3f95256071f24d29c2faf27479eeb585d61bfb95a07ecd81e9d8a377f35545b3df7975c88ca6feec72bebc5c5ecdc4383afae58daf136d8235f75dbd7e8db92c7c3d96f5f196c5dd5333bebc5f3e2e9f97afcb777cbcf06a13d388e16578195dc66c869ddb6c66cd466c967db5ee7adbbf4c2ed3cb8ccba2f0bcc2fe5d16392f4096545373b5cdcf97f9657159f6eb90bdcdb2d8b85fd50accc08d8c83a7298f8a1fb4c620fca8d55a49b6b5519bc98ac9f9565bb56def1cc38bfaf99ecd8d336ef74cc7b8341e9b3146e6dcdef82cdeac9ddaadbddaaf83484b46e9ad0eeba88eeb84e5ca9fcce3796c6e9db008f4c9dd32590e755a67756e325990875bfd0aeaeff9cbcfb2287eaa2b6e5dd4a5f25557c68149c0bc0fb3dfa8978569716cc69eee2b6aa9cc422bfc8caa9a4590ec7f0d6b5beb7eb84347cdaf2c63af9cd73063f67faa22f6ebdeaff7d27875c746f9cbfc626d5cd6d7fa566bb55eafea35d36ca77c8af27a536fcdd8b9b23cdceb6318d6239bdec2eabb7a57efcb3d932515759e3fe695d8112074cc55efd44370523ae5b13e184cb3597e7f6fdbbc12cfda581f599b4ff57dfde0b6a1556d13b77eac9fea67e3549feb17a65b8bfab59f159cd728b02d1691ceeb37bfb1b7fe376fd994b220ca89acbdfb5abfd71ff56738a8bfeaef7a500fcba01e992ed3c27db17077aec3f29881cb324b63578feb493de5b2507ef20f7264f6a797a59ffb13f6ff0d9bfda7f5ac9ed70b9657b2fc8bc52e5b7b592f9d779bcdc98dda288de13f5a35f3ca1f8dd958c64363db47f6d9374e3f438693be6ed3fbb2c665ff34a2d0def09a9af1cb1ae0d074eb5be3357e1334a1f3d4444ddc244dcafae291e54977eeaec9ac2dfb158b429bbc299ab2a9b8bdd09ca8f42b763fcb42732397c5e4b364aa8cd2cc99c77a7369eaa6316377c3eefb7039352d0b8359d6e186c6aee99a6b738badd0b48a466b74fbc18c9b557aecc7c57c6fd64cdfc76c2c3efa5cbdd9345bebdcdcb9dbbe8283d53fac9c9b5ebfb3a4d935fbe6604d9a63736aee9b0726c363f3d43c3799bbeb6be64c2fe3e6dcbc34afcd9b948559c51f65a1d95ecaa2f1959bb5faa138cd7bf3c1a22ac7ff609e89d973bfa6686f9b4fe3e0dbcd57f31dbae167ad3483669828d60b7bde283359ae356bc66c961b46611f41369366dacc9ab971b296eeb6e1e3815566167d9b9ed3354b63efad5bb5555aa3355bcbe8ebd581396efb15c45d9f2b87ba71689dd66dbdd6ef63181e7719aadfaf09ff365752a5cfa4bdc2fdfa937a8bc76de03dc65d1b1afd4afdb658703fbbed6dba8d8c531bb7499b865ef5de666d9e9fdaa22ddbcad8370fed85595585fce4beaddba66ddbaebd5e5876dfded8bcf3ddd70ee4eabfefed5aaddf1de36baddeaeda755bb35f6dda6df0dede056f5ec89eb7734a63d7eedb437b6c4f52163f38fd41161bd97abff39945bc2c951e313ddbe5b9a2b7f7ed43fbc8b4f7686ffa9d05b5d53ef55adf326fdf9edb97f6d518861f4e5c44ed5bb269df59ccb3cf3b7bc9645ef5f949fbd17eb65fed773b6887eda865b3068b697aed123b19f67e906bf6b69db0acf8d44edb593b6751cb397875ed76d12e3bb59fdbeace38754a67746667c571922779af472c8e39fe4116e75759d84c99a94967770e93e6dab99d67192cd770d89cb063be56ef7c7b5b9f7d3753baa00bbba8da767197746997b1b0b8e8ca7e6dc8db75157bfea5abbbc6df756dd775d7eed6699ddeadfaac8e723b5ec95b326b687b8fe2fb4e65dce75db7ee36eeaedb76776c02d875fbe6397aef0eddb13b75f7dd43f7f8ab2cbfc563b40fdae2fbb87b59fabdb76ef7d43de7cfddb97be95e6bc738b9ae7de8ff1a4166c38eb3eddeba77964f9cba8feeb3fbeabe9d85fad80dba6137eac6d19d195b0b33f6b56ed24dbb5937ef16ddf2aa5e95ab71358d9dfbca7763f9bd1ce6d00ffa99fd6ad97bc7bada4cbe73b7bb322bb18ee1cadd5d5deffdea3109dfaffe35b886d7280fa302b66ffe1d1d13eb0b72bf196a7fdcef5de36b52b2d65d53ebe19ab119ef6c9dddcf7eb5f79ab3ff5a5ccb6bc5e29897ebe55a5bfeb5b9b6d7ee7acd27d7db55bb321d5533b30bdf8da69c5c57d7f57573dde6937efe655aa8f4750ce623a2be06c6f7638dd87c74ecfd38d515ade7de5aaa8171bcde5d77d7bdda3847b5edab2c5993353c07367f9c07f8afd7f89ca7ebe17a8cd953afa7eb3d3dddbf998b6641d1eef5e1fa787dba3e5fcfd797eb6bad3069deaeefd78febe7f5ebfa5d75d74139bc0eafa3eb987d26d7e975769d7b6bd60b8bcccccceb92dba2f5f327f2dd7d73c7fc1c27ebcc52c3a79b7263f955348c4c36f3b9aa6dbf33591cbebef31764b99937eb66df1cd6379ecb66877edf8bad140b2fb9b139d0b8f7b51b0b346f8152ddc25b748bd5db2db9a5b7ec96df8a68d025e15755df4a7377ab6e97f0e3c626c65b5bac6e9db1ef772df0fd16d6af1f5eafb0d86cc4246aee7236b3dcaeb7db4d4bc6d133cb2d44fefb87ddf3ffb52ce6e34dbfad6eeb86c5860d1b0d663515f3f8ecff6d8fc5eecc9fe593dbe6b6bdddd5a5fa62d7cae2b65386b7fdeda0d4ea58dd869f55773bde4eb7fbcbddede1f6787bba3ddfce51623f180fb71733643e7af24759983454afa4fbbfdede54f7f67efb48068a226ac97f7d7d3f2a6e9fb7afdbf76dc02b565f2cb35c58776c86d89a73162f6d6e43e3741bddc6b7c96d9abab759eadce6f1241ef77bf56f8bc80a5fa2eab6d4d4a8d394a85202f5ac199aa9599aadb1b16e5acdedade4e78fbbef3396c82759cc58f3345f0bb4508bf242d1d20ce3f287d3597fc25e1eb5584bb454cbfad981dd7b617e7a119385f624cdedad96f733a75668a5566917ad564325615ed0b65fe289b25322add15aadd3aedacdf84c1dd573979aa6e9da4a5b6b1b7ba16da99af0ebc8b03f2a8bb1ad7667dada9db653bba0b9bddbef2c7f37642dcfa1f8f22fc8926a7beda01db59376af3db008efce9cfa1f2c3bda71eb6451633568f92e43ed517bd29eb5b3f6a2bd46b935d2de8c85f61e4fb40f36269f2c216e94246ccb2767e999da97f6ad0d3436a6edeeefd98bf5dcee2c35f2b59136d6260a8bd955d72eed525db37111f562ef2fcbf2a84db59936d716da52578d7da8318f79673d9993b86e6fecb363518056b6bac26c79a71bbad92a9dab5bc64db77527327457c97596ee844e7fe622ce597e32d4033dd4233dd6133dedc7e0d74f98f5b2447e2f95bbd7333dcfebb2d20bf6fbfe0c84266b797c86ff2b3a16157aa957fa45aff5466ff5aedf11c3f2de39af8f322fa45ffb798faffbfaa6ebbe66817ed3355dd757fa5adfe85bfdcef850bff59dbe77c6d5413fe847fda4dfeb0ffaa3fe14bd07aece722db28dde4ef86e0bf3e78fe9e8e764adbfe8af4aa36ead86cdca34abf4f6eff075c43fbd8724c9f537fdbdb8ea1ffaa7fea57febcc07588affed6ed3ca56a3f7beea637afd3a561f4733895c33d687fa888dd0589fe8537da6cff585be5ca92b6565accc95e5eddd3c7ded778d38d5ca5e39b6e1eec90f0b0ff68b2cae7170dc95bbf2567e3c535f56415f310a4e2cdeea57df6a5a7bfb73b2048fab701505b355bc4a56e92a5be5ed78555807166b6efa5ccb3afe248bc9b28265dee5ceed8565b4b755b9aa5697555dcd568d3e5ab5b1c7f7c23129dcddaaeb76abab395e752c5bbbe3f66e626ef955166f7533e3b261f9d270a5b1f178e335567efeafaf2afd9571311f57fa6ab55a6bb362b8daacb6abbbcbc76ad75767d2a05f79b0b67d0ecf64796372ec983c0adfc570cff7819ef85efea3d8cf6bdcbbdf76e87ff8cd6abf3aac8ead1d7cb84edffa7e9e679aa6b63b6627bfcae2af4eab7b9643ad570fcdfbea919fce727f3a052c4f69fca971795a3dafceab176db67ad5ebd5dbea7df5b1fa8cbff26ef595f615a31fbbddf98749f7c177bc0f9d57f6795b7daf06d17e35147b2cfbbdbccd9339ee7739b58bd5a8d72e173b9358e3acdf65b1ceab717d67ec5693d574355bcd51c3b7708ec1fdf3314c92af16abe55a5d2b6b439badcdb5b5b6d7ceda5d7bc69e45cffb1f7bdefb489eaffb32097a7b62b3105fc7e3fba9f9beea7e36627e6318266b7f1dacc3c0091cbecb91452c6431bd17f85d967e7473dbd8d7efeb681dab77e20c2d9745f9b16be9cff8b1f03198af933c5d5bc1789daeb375be2ed6e5ba5a5fd6b5b5b437741601fbf7fbd5b30fbe57a25f6bb15a16fc34ceba757416dfb3e83e9ce9d77ecd807df6ebceefd6cc62bc50c8d2eeb411f366bfd90bd7d26374b7beadb53573e4b2fee5fed5793f628aba5eaf37ebedfa6ebd5befd787f5717d5adfaf1fd68feba790c5fdd69eef5ac1b8b04fbf9ef76a7e704b3e584bbedb9f5950bffba8f7e2eb7e97fcb1df83b63eaf5f02d736cc28effa73246c8e1feb193f73d2e7373edfafe4b23c69bb7e5dbf35cafa7dfdc1e617c8f2f7f78ffdf38ff3283f69566595d196e7f5e7fa6bfdbd1eac87eb11d335bea38c568b980e4db0afbf8fa6c6acc7cffc04c6b2dfadd7cbe90f7a7bea77569a43967505d5e0a69a713e6171d79d36d1f3f5b8f776eb49bfa3b61f93cb389f38de7aba9eade7eabdd8d32b674be7afc8f2d3d9621ecf798f6a11dcaf179774bdcc5f36ea46d9181bb37faead164ebf368979c230a77db5439cb4602336661ab91436d3dc39174ba1fd0a2caa7f6511e4ae0f0b36569fdfacc6cce59f8ce3c6c9271b77e36dfc4d607da94f56f35b9bfed2b8fc7eb6381a2a9ee2da55972acd26dc449b78936cd24db6c9f9aa0bcb6eac27ffdbf68bbc782effdf76ae6549552488eee733a6f615fdba7dbb6356a899203e5a6db51f3b4444f0c14b1489987f9faa8202a4bd37b457331113b9d010943a661645669d93b6d9e37b5a6207f5ce54d90a7b630ee6244ed8f3c2d4532060d9afca32ad349d280e4d481246103617866ae8b10a11c3b2b36c86248e1fe983506f36cb7bd7f59cde1344592e9dd23decc91c0e90c0115250a0014d680104cf80a691efb672cf7c667bc1191af13a6a6c8d2ed758790ea8a041fba8a546ca6681e23a2c67047dffd9b4a1130fb9e20cbad0833e2ce34747a706bc2c0e85fef98baee722bfd4f4404187dc51957668dcd0c2d0b660004318c12b8c61025378f3347fb13bb0acbe5df0f8ab3a31cdd0e01d3ee0136ee036e9c2ddb1ed7437f7e95459c13d7169c0bcfd003fe0117eb2bb700a4ff08c94def1b9eef5e9337dca1557dfc052a8ea8aefae6ed98c216b9d45ef4ffa485524aebeeaa181333471eeaa5edbb7f71bff47100423b4421517519a70a1686ff7106f632dbe471b97ebe0a027b3a4874ec8a276354cdffc603e255ca59dee228325a4b8c2354b719e8d29bbca113774bcb961e319c8f15c1f6327bd3884873ca043ee1bdcda7dce35430f7d0c30740718e10e636fed2f7ddd7f0cc2861b3aa1161991827b3cecfa8d66ec6112bce2115354f693204dfadb96d559cd6ccab25f967cd21655d61b3627a2d61336b0892d72a03dc20e53978ef868d8fa229f5faee75a7fe935c07eb745b764495b08ec7d0311d5f514356ca3bffd70224ff774bfb3f1822818bb5ad8461d3bd8c5de6e837df6fe0507fb088787258ef015c7d68bd0fa1a7cc79ef3f0a8623d21573237714a0f6bb636061dba66de58d0211dac1b76bfe293ef6039b59ad281736c393795d713791dceebf80ee712f96e3009ddd07544a5d179e13613e6e4967d435ca3ec245389a0cad56bfd58aad7bf7aee9fc122ff178e852391e3f3ba9c7d9399eff23a234758aeb7d96b869def6fe7fb0f468e60216ac18678a2378b9890bd31a42ee18c42f1d27b720dcf09969c1fb0909d7904e76ec356026184f0baafc89d66956e3da5fecbf6f6f369d67545d6b5c5d924df135a7ec542cb5e26e49a7cbfc201afa191da8093df3604f79408ae9ab0ad576031ca9ca3caca1635c83935653d22cfb448ce3bcf6adc752c32e62a9eb9443352aa19aaaae7e288acea1ab4729f2cb50e052bf5d4871cf952b02732ae47d9db635ea9689b453c57bc2062244752ad5f5e84c592fcc3e1ee4c949995795bc152fdbea830d827ffc84c20e9088f91d2fb395e4b665b520152c3422492ebf27dce3a1163b10a2cc60916c11710bad85b6ed69a7320cdc09db863ceee0a1533e20c1ccef6c814cd995eb334f9fc9ecf4b7ebda988b5c23b67b1108e04dff03d63da7fc32f8b9a5f4caeec2fc7c9c7e6f5bc5e154b795ce2e596e3679fca7dd222b624e3bc58134fe3a1e0bbcd199677fcb81c4b3d6a7ea7d6aeb0fb7e71ceb9a3f5738b7cbeda2ba7de3ba79caf57e52fff15fb1fcbbfd3fefcfbaf3ffe0193cc32fd</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/imunge/imageeffect.png b/kjsembed/docs/examples/imunge/imageeffect.png Binary files differnew file mode 100644 index 00000000..1a976ab7 --- /dev/null +++ b/kjsembed/docs/examples/imunge/imageeffect.png diff --git a/kjsembed/docs/examples/imunge/imunge.js b/kjsembed/docs/examples/imunge/imunge.js new file mode 100755 index 00000000..72de2c5c --- /dev/null +++ b/kjsembed/docs/examples/imunge/imunge.js @@ -0,0 +1,239 @@ +#!/usr/bin/env kjscmd + +// +// Setup main window +// +mw = new KMainWindow(); +ac = mw.actionCollection(); +mb = mw.menuBar(); +sb = mw.statusBar(); +mw.setStandardToolBarMenuEnabled( true ); + +view = new QScrollView( mw, 'view' ); + +lbl = new QLabel( view, 'view' ); +lbl.alignment = Qt.AlignCenter; +lbl.text = 'No Content'; + +view.addChild( lbl ); + +mw.setCentralWidget( view ); + +/////////////////////////////////////////////////////////////////////////////////////// + +// +// Center the image in the view +// +mw.update_layout = function() +{ + var x = 0; + var y = 0; + + if ( lbl.width < view.width ) + x = Math.floor( (view.width - lbl.width) / 2 ); + if ( lbl.height < view.height ) + y = Math.floor( (view.height - lbl.height) / 2 ); + + view.addChild( lbl, x, y ); +} + +mw.resizeEvent = function(ev) +{ + this.update_layout(); +} + +mw.update_view = function() +{ + lbl.pixmap = this.img.pixmap(); + + lbl.adjustSize(); + this.update_layout(); +} + +// +// Load the specified image +// +mw.load = function( filename ) +{ + if ( /^\w+:/.test( filename ) ) + filename = filename.replace( /^\w+:/, '' ); + + this.img = new Image(); + this.img.load( filename ); + + if ( !this.img.isOk() ) { + throw 'Failed to load image ' + filename; + } + + sb.message( filename ); + this.imgfile = filename; + this.update_view(); +} + +// +// Save the specified image +// +mw.save = function( filename ) +{ + var ok = this.img.save( filename ); + + if ( !ok ) { + throw 'Failed to save image ' + filename; + } +} + +// +// Open an image file. +// +mw.openFile = function() +{ + var filename = StdDialog.getOpenFileName( '.' ); + + if ( filename.length > 0 ) { + this.load( filename ); + openrecent_action.addURL( filename ); + openrecent_action.saveEntries( System.KJSConfig.kconfig(), 'test' ); + System.KJSConfig.sync(); + } +} + +// +// Save an image file. +// +mw.saveFile = function() +{ + this.save( this.imgfile ); +} + +// +// Save an image file. +// +mw.saveFileAs = function() +{ + var filename = StdDialog.getSaveFileName( '.' ); + + if ( filename.length > 0 ) { + if ( this.save( filename ) ) { + sb.message( filename ); + this.imgfile = filename; + openrecent_action.addURL( filename ); + openrecent_action.saveEntries( System.KJSConfig.kconfig(), 'test' ); + System.KJSConfig.sync(); + } + } +} + +mw.saveCopyAs = function() +{ + var filename = StdDialog.getSaveFileName( '.' ); + + if ( filename.length > 0 ) { + this.save( filename ); + } +} + +mw.fileProperties = function() +{ + var net = new NetAccess( null, 'net' ); + net.propertiesDialog( 'file:' + this.imgfile ); +} + +mw.run_ksnapshot = function() +{ + shell( 'ksnapshot' ); +} + +// +// Setup the actions +// +mw.setup_actions = function() +{ + // File menu + open_action = StdAction.open( null, '', ac ); + open_action.connect( open_action, 'activated()', this, 'openFile' ); + + openrecent_action = StdAction.openRecent( null, '', ac ); + openrecent_action.connect( openrecent_action, 'urlSelected(const KURL&)', this, 'load' ); + openrecent_action.loadEntries( System.KJSConfig.kconfig(), 'test' ); + + save_action = StdAction.save( null, '', ac ); + save_action.connect( save_action, 'activated()', this, 'saveFile' ); + + saveas_action = StdAction.saveAs( null, '', ac ); + saveas_action.connect( saveas_action, 'activated()', this, 'saveFileAs' ); + + savecopyas_action = new KAction( ac, 'save_copy_as_action' ); + savecopyas_action.text = 'Save Copy As...'; + savecopyas_action.icon = 'filesaveas'; + savecopyas_action.connect( savecopyas_action, 'activated()', this, 'saveCopyAs' ); + + fileproperties_action = new KAction( ac, 'file_properties_action' ); + fileproperties_action.text = 'Properties...'; + fileproperties_action.connect( fileproperties_action, 'activated()', this, 'fileProperties' ); + + StdAction.quit( application, 'quit()', ac ); + + // View menu +// StdAction.fitToPage( null, '', ac ); +// StdAction.fitToWidth( null, '', ac ); +// StdAction.fitToHeight( null, '', ac ); +// StdAction.actualSize( null, '', ac ); + +// StdAction.zoomIn( null, '', ac ); +// StdAction.zoomOut( null, '', ac ); +// StdAction.zoom( null, '', ac ); + +// StdAction.redisplay( null, '', ac ); + + // Effects + browseeffects_action = new KAction( ac, 'browseeffects_action' ); + browseeffects_action.text = 'Browse Effects...'; + browseeffects_action.shortcut = 'Ctrl+E'; + browseeffects_action.connect( browseeffects_action, 'activated()', this, 'browse_effects' ); + + this.create_effect_browser(); + this.create_all_effects( mw, ac ); + this.create_image_operations( mw, ac ); + + // Tools + ksnapshot_action = new KAction( ac, 'ksnapshot_action' ); + ksnapshot_action.text = 'KSnapshot'; + ksnapshot_action.icon = 'ksnapshot'; + ksnapshot_action.connect( ksnapshot_action, 'activated()', this, 'run_ksnapshot' ); + + scriptconsole_action = new KToggleAction( ac, 'scriptconsole_action' ); + scriptconsole_action.text = 'Script Console'; + scriptconsole_action.icon = 'konsole'; + scriptconsole_action.connect( scriptconsole_action, 'toggled(bool)', part.view(), 'setShown(bool)' ); + + // Settings + showmenubar_action = StdAction.showMenubar( null, '', ac ); + showmenubar_action.connect( showmenubar_action, 'toggled(bool)', mb, 'setShown(bool)' ); + + showstatusbar_action = StdAction.showStatusbar( null, '', ac ); + showstatusbar_action.connect( showstatusbar_action, 'toggled(bool)', sb, 'setShown(bool)' ); + + // Help + StdAction.aboutApp( null, '', ac ); + StdAction.aboutKDE( null, '', ac ); + StdAction.help( null, '', ac ); + StdAction.helpContents( null, '', ac ); +} + +// +// Activate XMLGUI and show the window +// +load( 'imunge_actions.js' ); +mw.setup_actions(); + +cwd = (new QDir()).absPath(); +mw.createGUI( cwd + '/imungeui.rc' ); +mw.resize( 700, 500 ); + +if ( application.args.length ) + mw.load( application.args[0] ); + +mw.show(); +mw.update_layout(); + +application.exec(); diff --git a/kjsembed/docs/examples/imunge/imunge_actions.js b/kjsembed/docs/examples/imunge/imunge_actions.js new file mode 100755 index 00000000..586641d9 --- /dev/null +++ b/kjsembed/docs/examples/imunge/imunge_actions.js @@ -0,0 +1,320 @@ + +// +// Effect Browser +// + +mw.create_effect_browser = function() +{ + this.effectsdlg = new QDialog( this ); + var vb = new QVBoxLayout( this.effectsdlg ); + + this.effects = Factory.loadui( 'effectbrowser.ui', null, this.effectsdlg ); + vb.addWidget( this.effects ); +} + +mw.add_action = function( act ) +{ + var lv = this.effects.child( 'effects' ); + var txt = act.text.replace( /&/g, '' ); + + lv.insertItem( txt ); +} + +mw.browse_effects = function() +{ + this.effects.child('preview').pixmap = lbl.pixmap; + + this.effectsdlg.exec(); +} + +/** + * Creates the actions for the image effects and defines the functions that + * provide the implementations. + */ +mw.create_all_effects = function( mw, ac ) +{ + this.imgfx = new ImageFX(); + + // + // Water color + // + var action = new KAction( ac, 'watercolor_action' ); + action.text = '&Water Color'; + action.icon = 'imageeffect'; + + mw.apply_watercolor = function() + { + this.img.setPixmap( lbl.pixmap ); + + this.img = this.imgfx.contrast(this.img, 200); + this.img = this.imgfx.despeckle(this.img); + this.img = this.imgfx.despeckle(this.img); + this.img = this.imgfx.despeckle(this.img); + this.img = this.imgfx.sharpen(this.img); + + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_watercolor' ); + this.add_action( action ); + + // + // To Gray + // + action = new KAction( ac, 'togray_action' ); + action.text = '&Grayscale'; + action.icon = 'imageeffect'; + + mw.apply_togray = function() + { + this.img = this.imgfx.toGray(this.img, false); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_togray' ); + this.add_action( action ); + + // + // Charcoal + // + action = new KAction( ac, 'charcoal_action' ); + action.text = '&Charcoal'; + action.icon = 'imageeffect'; + + mw.apply_charcoal = function() + { + this.img = this.imgfx.charcoal(this.img, 0.2); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_charcoal' ); + this.add_action( action ); + + // + // Implode + // + var action = new KAction( ac, 'implode_action' ); + action.text = '&Implode'; + action.icon = 'imageeffect'; + + mw.apply_implode = function() + { + this.img = this.imgfx.implode(this.img, 30, 'white'); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_implode' ); + this.add_action( action ); + + // + // Emboss + // + action = new KAction( ac, 'emboss_action' ); + action.text = '&Emboss'; + action.icon = 'imageeffect'; + + mw.apply_emboss = function() + { + this.img = this.imgfx.emboss(this.img); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_emboss' ); + this.add_action( action ); + + // + // Normalize + // + action = new KAction( ac, 'normalize_action' ); + action.text = '&Normalize'; + action.icon = 'imageeffect'; + + mw.apply_normalize = function() + { + this.img = this.imgfx.normalize(this.img); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_normalize' ); + this.add_action( action ); + + // + // Equalize + // + action = new KAction( ac, 'equalize_action' ); + action.text = 'Equa&lize'; + action.icon = 'imageeffect'; + + mw.apply_equalize = function() + { + this.img = this.imgfx.equalize(this.img); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_equalize' ); + this.add_action( action ); + + // + // Despeckle + // + action = new KAction( ac, 'despeckle_action' ); + action.text = '&Despeckle'; + action.icon = 'imageeffect'; + + mw.apply_despeckle = function() + { + this.img = this.imgfx.despeckle(this.img); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_despeckle' ); + this.add_action( action ); +} + +mw.create_image_operations = function( mw, ac ) +{ + var action; + + // + // Crop + // + action = new KAction( ac, 'crop_action' ); + action.text = 'Crop...'; + action.icon = 'crop'; + + mw.crop_image = function() + { + lbl.mousePressEvent = function(ev) + { + lbl.startx = ev.x; + lbl.starty = ev.y; + lbl.lastx = ev.x; + lbl.lasty = ev.y; + } + + lbl.mouseMoveEvent = function(ev) + { + if ( + ( Math.abs( lbl.lastx - ev.x ) > 2 ) + || ( Math.abs( lbl.lasty - ev.y ) > 2 ) + ) { + this.repaint4( Math.min( lbl.lastx, lbl.startx ), + Math.min( lbl.lasty, lbl.starty ), + Math.abs( lbl.lastx - lbl.startx ), + Math.abs( lbl.lasty - lbl.starty ) ); + + this.drawLine( ev.x, ev.y, ev.x, lbl.starty ); + this.drawLine( ev.x, lbl.starty, lbl.startx, lbl.starty ); + this.drawLine( lbl.startx, lbl.starty, lbl.startx, ev.y ); + this.drawLine( lbl.startx, ev.y, ev.x, ev.y ); + lbl.lastx = ev.x; + lbl.lasty = ev.y; + } + } + + lbl.mouseReleaseEvent = function(ev) + { + lbl.mousePressEvent = function(ev) {}; + lbl.mouseMoveEvent = function(ev) {}; + lbl.mouseReleaseEvent = function(ev) {}; + + var pix = new Pixmap(); + var w = Math.abs( ev.x - lbl.startx ); + var h = Math.abs( ev.y - lbl.starty ); + pix.resize( w, h ); + +// var p = new Painter(); +// p.setDevice( lbl ); +// p.drawRect( w/2, h/2, w/4, h/4 ); + + mw.img.setPixmap( pix ); + mw.update_view(); + +// var pix = lbl.pixmap; +// pix.resize( Math.abs( ev.x - lbl.startx ), Math.abs( ev.y - lbl.starty ) ); +// mw.img.setPixmap( pix ); +// mw.update_view(); + } + + } + + action.connect( action, 'activated()', this, 'crop_image' ); + + // + // Resize + // + action = new KAction( ac, 'resize_action' ); + action.text = 'Resize...'; + action.icon = 'transform'; + + mw.resize_image = function() + { + var dlg = Factory.loadui( 'resizeparams.ui', null, this ); + if ( !dlg.exec() ) { + return; + } + this.img.smoothScale( dlg.child('width_input').value, + dlg.child('height_input').value ); + this.update_view(); + } + + action.connect( action, 'activated()', this, 'resize_image' ); + + // + // Rotate right + // + action = new KAction( ac, 'rotate_right_action' ); + action.text = 'Rotate &Right'; + action.icon = 'rotate_cw'; + + mw.apply_rotate_right = function() + { + this.img = this.imgfx.rotate( this.img, this.imgfx.Rotate90 ); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_rotate_right' ); + + // + // Rotate left + // + action = new KAction( ac, 'rotate_left_action' ); + action.text = 'Rotate &Left'; + action.icon = 'rotate'; + + mw.apply_rotate_left = function() + { + this.img = this.imgfx.rotate( this.img, this.imgfx.Rotate90 ); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_rotate_left' ); + + // + // Mirror Vertical + // + action = new KAction( ac, 'mirror_vertical_action' ); + action.text = 'Mirror &Vertical'; + + mw.apply_mirror_vertical = function() + { + this.img.mirror( false, true ); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_mirror_vertical' ); + + // + // Mirror Horizontal + // + action = new KAction( ac, 'mirror_horizontal_action' ); + action.text = 'Mirror &Horizontal'; + + mw.apply_mirror_horizontal = function() + { + this.img.mirror( true, false ); + this.update_view(); + } + + action.connect( action, 'activated()', mw, 'apply_mirror_horizontal' ); +} diff --git a/kjsembed/docs/examples/imunge/imungeui.rc b/kjsembed/docs/examples/imunge/imungeui.rc new file mode 100644 index 00000000..4e1fc916 --- /dev/null +++ b/kjsembed/docs/examples/imunge/imungeui.rc @@ -0,0 +1,58 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="imunge" version="1"> +<MenuBar> + <Menu name="file"><text>&File</text> + <Action name="save_copy_as_action" append="save_merge" /> + <Action name="file_properties_action" /> + </Menu> + <Menu name="image"><text>&Image</text> + <Action name="resize_action" /> + <Action name="crop_action" /> + <Action name="rotate_left_action" /> + <Action name="rotate_right_action" /> + <Action name="mirror_vertical_action" /> + <Action name="mirror_horizontal_action" /> + </Menu> + <Menu name="effects"><text>&Effects</text> + <Action name="browseeffects_action" /> + <Separator/> + <Action name="watercolor_action" /> + <Action name="charcoal_action" /> + <Action name="implode_action" /> + <Action name="emboss_action" /> + <Action name="normalize_action" /> + <Action name="equalize_action" /> + <Action name="despeckle_action" /> + <Action name="togray_action" /> + </Menu> + <Menu name="tools"><text>&Tools</text> + <Action name="scriptconsole_action" /> + </Menu> +</MenuBar> +<!-- +<ToolBar name="view"><text>View Toolbar</text> + <Action name="view_zoom_in"/> + <Action name="view_zoom_out"/> + <Action name="view_zoom"/> + <Separator/> + <Action name="view_actual_size"/> + <Action name="view_fit_to_page"/> +</ToolBar> +--> +<ToolBar name="operations" position="left" iconText="icontextright"><text>Operations</text> + <Action name="resize_action" /> + <Action name="crop_action" /> + <Action name="rotate_left_action" /> + <Action name="rotate_right_action" /> +</ToolBar> +<ToolBar name="effects" position="left" iconText="icontextright"><text>Effects</text> + <Action name="watercolor_action" /> + <Action name="charcoal_action" /> + <Action name="implode_action" /> + <Action name="emboss_action" /> + <Action name="normalize_action" /> + <Action name="equalize_action" /> + <Action name="despeckle_action" /> + <Action name="togray_action" /> +</ToolBar> +</kpartgui> diff --git a/kjsembed/docs/examples/imunge/resizeparams.ui b/kjsembed/docs/examples/imunge/resizeparams.ui new file mode 100644 index 00000000..fe66f437 --- /dev/null +++ b/kjsembed/docs/examples/imunge/resizeparams.ui @@ -0,0 +1,193 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>ResizeParams</class> +<widget class="QDialog"> + <property name="name"> + <cstring>ResizeParams</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>371</width> + <height>200</height> + </rect> + </property> + <property name="caption"> + <string>Resize Image</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KIntNumInput" row="3" column="1"> + <property name="name"> + <cstring>height_input</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Width:</string> + </property> + </widget> + <widget class="KIntNumInput" row="2" column="1"> + <property name="name"> + <cstring>width_input</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Height:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><h3>Resize Image</h3></string> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>ResizeParams</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>ResizeParams</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/imunge/transform.png b/kjsembed/docs/examples/imunge/transform.png Binary files differnew file mode 100644 index 00000000..3a5ca2b3 --- /dev/null +++ b/kjsembed/docs/examples/imunge/transform.png diff --git a/kjsembed/docs/examples/index.html b/kjsembed/docs/examples/index.html new file mode 100644 index 00000000..bed4b787 --- /dev/null +++ b/kjsembed/docs/examples/index.html @@ -0,0 +1,121 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>KJSEmbed Examples</title> +<link href="../kjsembed.css" rel="stylesheet" type="text/css"> +</head> +<body> +<h1>KJSEmbed Examples</h1> +This directory contains a number of example files that illustrate the +various features of KJSEmbed. + +<h3>Demos</h3> +<p> +This section contains examples that show how the features of KJSEmbed +can be combined to create useful tools. +</p> +<center> +<table> +<tr><td><a href="buttonmaker">ButtonMaker</a></td> +<td>An application for creating buttons for web sites.</td></tr> +<tr><td><a href="envelopemaker">EnvelopeMaker</a></td> +<td>An application for creating printed envelopes.</td></tr> +<tr><td><a href="xmlgui">xmlgui</a></td> +<td>Creates a complete KDE GUI shell using XMLGUI and KStdAction.</td></tr> +<tr><td><a href="readonlypart">readonlypart</a></td> +<td>A simple web browser that embeds KHTMLPart.</td></tr> +<tr><td><a href="readwritepart">readwritepart</a></td> +<td>Shows how to embed a read-write KPart.</td></tr> +<tr><td><a href="calc">calc</a></td> +<td>A simple calculator application.</td></tr> +<tr><td><a href="grepdialog">grepdialog</a></td> +<td>Loads .ui files to provide a GUI for grep.</td></tr> +<tr><td><a href="docviewer">docviewer</a></td> +<td>KJSEmbed documentation browser.</td></tr> +<tr><td><a href="sax">SAX</a></td> +<td>Demos that show how to use the SAX API from JS.</td></tr> +<tr><td><a href="dcop">DCOP</a></td> +<td>Using DCOP from scripts.</td></tr> +<tr><td><a href="cmdline">Command Line</a></td> +<td>An interactive command-line prompt for KJSEmbed implemented as a script.</td></tr> +</table> +</center> + +<h3>Advanced Demos</h3> +<p> +This section contains examples that illustrate some of the more +advanced features of KJSEmbed. +</p> +<center> +<table> +<tr><td><a href="htmlinfo">htmlinfo</a></td> +<td>Reports information about an HTML file.</td></tr> +<tr><td><a href="imageinfo">imageinfo</a></td> +<td>Various scripts using the Image builtin object.</td></tr> +<tr><td><a href="html2text">html2text</a></td> +<td>Uses the KParts::Plugin to extend KWrite.</td></tr> +<tr><td><a href="eventhandling">eventhandling</a></td> +<td>Two demos that show off event handling, including +the standard scribble demo.</td></tr> +<tr><td><a href="sql">SQL Support</a></td> +<td>Accessing SQL databases.</td></tr> +</table> +</center> + +<h3>Examples</h3> +<p> +This section contains examples that illustrate particular KJSEmbed +facilities. +</p> +<center> +<table> +<tr><td><a href="customwidget">customwidget</a></td> +<td>Creates a simple form directly from Javascript.</td></tr> +<tr><td><a href="treeview">treeview</a></td> +<td>Two examples that create a graphical tree. One +from a JS data structure, the other from the widget tree of a ui file.</td></tr> +<tr><td><a href="qobject-dom">qobject-dom</a></td> +<td>Illustrates the QObject DOM API.</td></tr> +<tr><td><a href="connect-cpp">connect-cpp</a></td> +<td>Connects a signal to slot.</td></tr> +<tr><td><a href="connect">connect</a></td> +<td>Connects signals of various types to JS methods.</td></tr> +<tr><td><a href="imageviewer">imageviewer</a></td> +<td>Illustrates the use of QPixmap values.</td></tr> +<tr><td><a href="netaccess">netaccess</a></td> +<td>Illustrates the bindings to KIO::NetAccess.</td></tr> +<tr><td><a href="listview">listview</a></td> +<td>Creates a simple KListView.</td></tr> +<tr><td><a href="frame">frame</a></td> +<td>Shows off QFrame support and the use of enums.</td></tr> +<tr><td><a href="timer">timer</a></td> +<td>Creates a flashing LED using QTimer.</td></tr> +<tr><td><a href="actions">Actions</a></td> +<td>A simple KAction demo.</td></tr> +<tr><td><a href="builtins">Built-In Messages</a></td> +<td>Demonstrates the built-in message dialogs.</td></tr> +<tr><td><a href="imagetweak">Image Tweak</a></td> +<td>Tweaking images.</td></tr> +<tr><td><a href="imagefun">Image Fun</a></td> +<td>More fun with images</td></tr> +<tr><td><a href="invaders">Space Invaders</a></td> +<td>A space invaders game.</td></tr> +<tr><td><a href="kjsuic">JS UIC</a></td> +<td>An easy way to deal with UI files.</td></tr> +<tr><td><a href="multifile">Multi-file Scripts</a></td> +<td>Multi-file Scripts.</td></tr> +<tr><td><a href="opaquevalues">Opaque Values</a></td> +<td>Opaque types.</td></tr> +<tr><td><a href="stdicons">Standard Icons</a></td> +<td>Loading standard icons.</td></tr> +<tr><td><a href="combobox">QComboBox</a></td> +<td>A simple demo of QComboBox.</td></tr> +<tr><td><a href="multipart">Embedding several KParts</a></td> +<td>Shows how to embed multiple parts in the same script.</td></tr> +<tr><td><a href="livedata">Writing data directly to a KPart</a></td> +<td>Shows how to send data directly to a part, rather than viewing a file.</td></tr> +</table> +</center> +<hr> +</body> +</html> diff --git a/kjsembed/docs/examples/invaders/invaders.js b/kjsembed/docs/examples/invaders/invaders.js new file mode 100755 index 00000000..55531258 --- /dev/null +++ b/kjsembed/docs/examples/invaders/invaders.js @@ -0,0 +1,282 @@ +#!/usr/bin/env kjscmd + +/* Classic space invaders. + By Ian Reinhart Geiser + + Based off of the Web based JS by Sam Dodge (nancied@mac.com) +*/ +var patno = 1; +var cr = "\r\n"; +var spcf1 = ""; +var spcf2 = ""; +var spcf3 = ""; +var hitflag = 0; +var score = 0; +var selec = 0; +var rsmiss = ""; +var timer = new QTimer(this); +timer.connect(timer, "timeout()", this, "doTurn"); + +var win = new KMainWindow(this); +var box = new QVBox(win); +var view = new QLabel(box); +//view.setMouseTracking(true); + +view.font = "courier,12,-1,5,75,0,0,0,0,0" + view.paletteBackgroundColor = "black"; +view.paletteForegroundColor = "green"; + +win.setCentralWidget(box); +win.show(); +restarter(); +view.focusPolicy = 1; +view.setFocus(); + + +view.mousePressEvent = function(ev) +{ + fire(); +} + +view.keyPressEvent = function(ev) +{ + if (ev.key == 4116) + gormax(); + if (ev.key == 4114) + golmax(); + if (ev.key == 32) + fire(); +} + +application.exec(); + +function gameBoard(arn) +{ + this.length = arn; + for (var ar1 = 0; ar1 <= arn; ar1++) { + this[ar1] = 1; + } + return this; +} + +function init() +{ + blankx = new gameBoard(63); + for (var makeblank = 0; makeblank < 63; makeblank++) { + blankx[makeblank] = ""; + for (var addBlank = 0; addBlank < makeblank; addBlank++) { + blankx[makeblank] = blankx[makeblank] + " "; + } + } + faker = new gameBoard(24); + face = new gameBoard(2); + face[1] = " <OvO> "; + face[2] = " <oVo> "; + mestotal = new gameBoard(4); + doTurn(); +} + +function restarter() +{ + inplay = 0; + blankno = 0; + totalblank = ""; + lr = 1; + lowerlf = ""; + downlf = ""; + downno = 0; + missilex = 99; + missiley = 99; + mychrx = 1; + myblank = ""; + mymove = 0; + selec = 1; + starter(); +} + +function starter() +{ + view.text = cr + cr + cr + cr + cr + cr + cr + cr + cr + cr + + " Control the ship and stop the enemy invasion!" + cr + + cr + cr + " Click to begin!"; + selec = 1; +} + +function goleft() +{ + mymove = 0; + mychrx = mychrx - 1; + if (mychrx <= 0) { + mychrx = 1; + } +} + +function goright() +{ + mymove = mychrx = mychrx + 1; + if (mychrx >= 56) { + mychrx = 55; + } +} + +function golmax() +{ + if (inplay == 1) { + mymove = -1; + } +} + +function gormax() +{ + if (inplay == 1) { + mymove = 1; + } +} + +function fire() +{ + if (inplay == 0) { + if (selec == 1) { + selec = 9; + inplay = 1; + init(); + } + } else { + if (missiley == 99) { + missiley = 18; + missilex = mychrx + 3; + } + } +} + +function gameover() +{ + score = 0; + for (var enerme = 1; enerme < 25; enerme++) { + if (faker[enerme] == 1) { + score = score + 1; + } + } + if (score == 0) { + view.text = cr + cr + cr + cr + cr + cr + cr + cr + + " Congratulations!" + cr + cr + + " YOU STOPPED THE ENEMY SQUAD!!"; + } else { + view.text = cr + cr + cr + cr + cr + cr + cr + cr + + " GAME OVER" + cr + cr + + " " + score + " INVADERS GOT THROUGH"; + } + inplay = 0; +} + +function doTurn() +{ + if (missiley != 99) { + missiley = missiley - 1; + } + if (missiley < 0) { + missiley = 99; + } + mychrx = mychrx + mymove; + if (mychrx <= 0) { + mychrx = 1; + } + if (mychrx >= 56) { + mychrx = 55; + } + blankno = blankno + lr; + totalblank = blankx[blankno]; + if (blankno >= 20) { + lr = -1; + downno = downno + 1; + blankno = 20; + } + if (blankno <= 0) { + lr = 1; + downno = downno + 1; + blankno = 0; + } + if (downno >= 12) { + gameover(); + } + downlf = ""; + for (var upperspc = 0; upperspc < downno; upperspc++) { + if (missiley == upperspc) { + downlf = downlf + blankx[missilex] + "^" + cr; + } else { + downlf = downlf + cr; + } + } + if (inplay == 1) { + patno = patno + 1; + if (patno >= 3) { + patno = 1; + } + for (var addline = 1; addline < 5; addline++) { + mestotal[addline] = totalblank; + rsmiss = ""; + if (missiley == (downno + addline * 2 - 2)) { + if (blankno <= missilex) { + hitflag = parseInt((missilex - blankno) / 7, 10); + if (hitflag < 6) { + if ((missilex - blankno - (hitflag * 7)) >= 1) { + if ((missilex - blankno - (hitflag * 7)) <= 5) { + if (faker[(addline * 6) + hitflag - 5] == + 1) { + faker[(addline * 6) + hitflag - 5] = 0; + missiley = 99; + } + } + } + } else { + if (missilex > (blankno + 42)) { + rsmiss = blankx[missilex - blankno - 42] + "^"; + } + } + } else { + mestotal[addline] = blankx[missilex] + "^"; + if (missilex < (blankno - 1)) { + mestotal[addline] = + mestotal[addline] + blankx[blankno - 1 - + missilex]; + } + } + } + for (var addfaker = 1; addfaker < 7; addfaker++) { + if (faker[(addline * 6) + addfaker - 6] == 1) { + mestotal[addline] = mestotal[addline] + face[patno]; + } else { + mestotal[addline] = mestotal[addline] + " "; + } + } + mestotal[addline] = mestotal[addline] + rsmiss; + } + spcf1 = cr; + spcf2 = cr; + spcf3 = cr; + if (missiley == (downno + 1)) { + spcf1 = blankx[missilex] + "^" + cr; + } + if (missiley == (downno + 3)) { + spcf2 = blankx[missilex] + "^" + cr; + } + if (missiley == (downno + 5)) { + spcf3 = blankx[missilex] + "^" + cr; + } + lowerlf = ""; + + for (var lowerspc = 0; lowerspc < (11 - downno); lowerspc++) { + if (missiley == (downno + 7 + lowerspc)) { + lowerlf = lowerlf + blankx[missilex] + "^" + cr; + } else { + lowerlf = lowerlf + cr; + } + } + myblank = blankx[mychrx]; + view.text = downlf + mestotal[1] + cr + spcf1 + + mestotal[2] + cr + spcf2 + mestotal[3] + cr + spcf3 + + mestotal[4] + + cr + lowerlf + myblank + "" + cr + myblank + "-<!>-"; + timer.start(250, true); + } +} diff --git a/kjsembed/docs/examples/kjsuic/kjsuic.js b/kjsembed/docs/examples/kjsuic/kjsuic.js new file mode 100644 index 00000000..f95aa5ee --- /dev/null +++ b/kjsembed/docs/examples/kjsuic/kjsuic.js @@ -0,0 +1,47 @@ +/* +* To use this fuction provide the ui file name, the parent +* that will handle the slots of the form, and the parent +* widget that will handle the UI portion. +* +* var form = kjsuic("EnvelopeMakerUI.ui", this, this); +* println(dump(form)); +* +* This will then return you a widget object that has properties +* that are the main child widgets in the UI file. So if you have +* a KLineEdit called "myLineEdit" in the UI file then there would +* be a member of the form called myLineEdit. (ex: form.myLineEdit ) +* +* If there are container widgets present then the children will show +* up as properties of those widgets. So if you have a groupbox called +* "Group" and a KLineEdit inside of it called "editor" you would address +* this as "Group.editor". +* +* An important note: Take care when using UI files with this that have +* widget names that do not conflict with current Qt properties as the Qt +* properties will take precident over the added widgets. +*/ + +function kjsuic(uifile, slotParent, parent) +{ + var widget = Factory.loadui(uifile, slotParent, parent); + var lst = widget.children(); + addChildren( widget ) + return widget; +} + +function addChildren( widget ) +{ + var lst = widget.children(); + for( var idx = 0; idx < lst.length; ++idx) + { + var str = "widget." + lst[idx] + " = widget.child('" + lst[idx] + "');"; + eval(str); + var typeName = widget.child(lst[idx]).className(); + + if( typeName == "QGroupBox" || typeName == "QButtonGroup" || typeName == "QFrame") + { + eval("addChildren( widget." + lst[idx] + ");"); + } + } +} + diff --git a/kjsembed/docs/examples/listview/listview.js b/kjsembed/docs/examples/listview/listview.js new file mode 100644 index 00000000..5bca90c5 --- /dev/null +++ b/kjsembed/docs/examples/listview/listview.js @@ -0,0 +1,22 @@ +#!/usr/bin/env kjscmd + +// Create main view +var mw = new KMainWindow(); +var box = new QVBox( mw ); +mw.setCentralWidget(box); + +var lv = new KListView( box ); + +lv.addColumn('Pix'); +lv.addColumn('One'); +lv.addColumn('Two'); +lv.addColumn('Three'); + +lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" ); +lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" ); +lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" ); +lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" ); + + +mw.show(); +application.exec(); diff --git a/kjsembed/docs/examples/livedata/livepartdata.js b/kjsembed/docs/examples/livedata/livepartdata.js new file mode 100644 index 00000000..345e84e9 --- /dev/null +++ b/kjsembed/docs/examples/livedata/livepartdata.js @@ -0,0 +1,25 @@ +#!/usr/bin/env kjscmd + +// Create the UI +var mw = new KParts_MainWindow(); +var ac = mw.actionCollection(); + +var split = new QSplitter( mw ); +mw.setCentralWidget( split ); + +var view = Factory.createROPart( "text/html", split, "html" ); + +view.openStream( 'text/html', 'file:///index.html' ); +view.writeStream( '<html><body><h1>Inserting Data Directly</h1>This shows how ' ); +view.writeStream( 'you can send data to a part directly from a script. </body></html>' ); +view.closeStream(); + +// +// Activate XMLGUI and show the window +// +StdAction.quit( mw, 'close()', mw.actionCollection() ); + +mw.resize( 700, 500 ); + +mw.show(); +application.exec(); diff --git a/kjsembed/docs/examples/madminute/configdialog.ui b/kjsembed/docs/examples/madminute/configdialog.ui new file mode 100644 index 00000000..3760c11d --- /dev/null +++ b/kjsembed/docs/examples/madminute/configdialog.ui @@ -0,0 +1,274 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>configDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>configDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>258</width> + <height>204</height> + </rect> + </property> + <property name="caption"> + <string>Configure Mad Minute</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <property name="modal"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><H2>General Settings</H2></string> + </property> + </widget> + <widget class="Line" row="1" column="0"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Operations:</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>addition</cstring> + </property> + <property name="text"> + <string>Addition</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>subtraction</cstring> + </property> + <property name="text"> + <string>Subtraction</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Time:</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>time</cstring> + </property> + <property name="suffix"> + <string> seconds</string> + </property> + <property name="maxValue"> + <number>120</number> + </property> + <property name="minValue"> + <number>30</number> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="6" column="0"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="4" column="0"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + </hbox> + </widget> + <widget class="QLayoutWidget" row="5" column="0"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2_2</cstring> + </property> + <property name="text"> + <string>Maximum Value</string> + </property> + <property name="toolTip" stdset="0"> + <string>the maximum value the number will reach</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>maximum</cstring> + </property> + <property name="value"> + <number>20</number> + </property> + <property name="minValue"> + <number>5</number> + </property> + <property name="maxValue"> + <number>1000</number> + </property> + <property name="toolTip" stdset="0"> + <string>the maximum value the number will reach</string> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>configDialog</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>configDialog</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/kjsembed/docs/examples/madminute/helpdialog.ui b/kjsembed/docs/examples/madminute/helpdialog.ui new file mode 100644 index 00000000..baa1a4e4 --- /dev/null +++ b/kjsembed/docs/examples/madminute/helpdialog.ui @@ -0,0 +1,85 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>helpDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>helpDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>343</width> + <height>398</height> + </rect> + </property> + <property name="caption"> + <string>Help Using MadMinute</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <property name="modal"> + <bool>true</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTextBrowser"> + <property name="name"> + <cstring>helpText</cstring> + </property> + <property name="text"> + <string><h2>Mad Minute</h2> +This is a small mathdrill program to help students become faster at simple addition and subtraction. To configure the application select the "<b>Preferences</b>" and set the time of the drill and the types of problems that are covered. Currently addition and subtraction are covered. + +Once the application is configured the student can start the drill by pressing the "<b>Go</b>" button or "<tt>Ctrl+G</tt>". Once the drill is started the student may answer the questions as fast as they can and press the "<tt>Enter</tt> key to submit the answer. The drill will notify the student when it is complete.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>221</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton7</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>pushButton7</sender> + <signal>clicked()</signal> + <receiver>helpDialog</receiver> + <slot>accept()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/examples/madminute/madminute.js b/kjsembed/docs/examples/madminute/madminute.js new file mode 100755 index 00000000..a2762cde --- /dev/null +++ b/kjsembed/docs/examples/madminute/madminute.js @@ -0,0 +1,161 @@ +#!/usr/bin/env kjscmd + +StdDirs.addResourceType("madminute", StdDirs.kde_default("data") + "/madminute"); +try { + //var view = Factory.loadui( StdDirs.findResource("madminute", "madminute.ui"), this, mw ); + var view = Factory.loadui( "madminute.ui" ); + +} catch( err ) { + alert( err ); + exit(0); +} +var Addition = 1; +var Subtraction = 2; + +var config = new Config("madminute"); +config.setGroup("Game Options"); +// Timer +var timer = new QTimer(this); +// Current Argument 1 +var arg1 = 0; +// Current Argument 2 +var arg2 = 0; +// Current Operation +var operation = Addition; +// Acceptable operations 1 = Addition 2 = Subtraction 3 = Both +var operations = config.readNumEntry("Operations", Addition); +// Time to run the drill +var drillTime = config.readNumEntry("Drill Time", 60); +// maxInput is maximum value for the numbers in the question +var maxInput = config.readNumEntry("Maximum Input", 10); +var total = 0; + +view.connect(view.fileExitAction, 'activated()', application, 'quit()'); +view.connect(view.fileGoAction, 'activated()', this, 'start'); +view.connect(view.editPreferencesAction, 'activated()', this, 'configure'); +view.connect(view.helpAboutAction, 'activated()', this, 'about'); +view.connect(view.helpHelpAction, 'activated()', this, 'helpDialog'); + + +view.connect( view.qt_central_widget.answer, 'returnPressed()', this, 'checkAnswer' ); +view.connect( timer, 'timeout()', this, 'countdown'); + +view.qt_central_widget.answer.enabled = false; + +view.show(); +// Run the main event loop. +application.exec(); + +function configure() +{ + //var configUI = Factory.loadui( StdDirs.findResource("madminute", "configdialog.ui"), this, mw ); + var configUI = Factory.loadui( "configdialog.ui" ); + configUI.connect( configUI.buttonHelp, 'clicked()', this, 'helpDialog'); + configUI.addition.checked = false; + configUI.subtraction.checked == false; + configUI.time.value = drillTime; + configUI.maximum.value = maxInput; + if( operations == 1 ) + configUI.addition.checked = true; + if( operations == 2 ) + configUI.subtraction.checked = true; + if( operations == 3 ) + { + configUI.addition.checked = true; + configUI.subtraction.checked = true; + } + + if ( configUI.exec() == 1 ) + { + operations = 0; + if( configUI.addition.checked == true ) + operations += 1; + if( configUI.subtraction.checked == true ) + operations += 2; + drillTime = configUI.time.value; + maxInput = configUI.maximum.value; + config.setGroup("Game Options"); + config.writeNumEntry("Operations",operations); + config.writeNumEntry("Drill Time", drillTime ); + config.writeNumEntry("Maximum Input", maxInput ); + config.sync(); + } +} + +function about() +{ + alert("<h2>MadMinute 1.0</h2>A math tutoring drill to help students master basic math skills.<br>Copyright 2004 Ian Reinhart Geiser <a href='mailto:geiseri@kde.org'>geiseri@kde.org</a>"); +} + +function helpDialog() +{ + //var helpUI = Factory.loadui( StdDirs.findResource("madminute", "helpdialog.ui"), this, mw ); + var helpUI = Factory.loadui( "helpdialog.ui" ); + helpUI.exec(); +} + +function askQuestion() +{ + arg1 = Math.floor( Math.random() * maxInput ); + arg2 = Math.floor( Math.random() * maxInput ); + if( operations == 3 ) + operation = Math.floor( (Math.random() * 2)+1); + else + operation = operations; + + var operationText = ""; + if( operation == Addition ) + operationText = " + "; + else if( operation == Subtraction ) + { + operationText = " - "; + if( arg1 < arg2 ) + { + var arg = arg1; + arg1 = arg2; + arg2 = arg; + } + } + view.qt_central_widget.question.text = "<h2>" + arg1 + operationText + arg2 + "=</h2>"; +} + +function checkAnswer( ) +{ + var answer = 0; + if( operation == Addition ) + answer = (arg1 + arg2) ; + else if( operation == Subtraction ) + answer = (arg1 - arg2) ; + if( view.qt_central_widget.answer.text == answer ) + { + view.qt_central_widget.correct.value++; + } + total++; + askQuestion(); + view.qt_central_widget.answer.text = ""; +} + +function start() +{ + askQuestion(); + total = 0; + timer.start(1000); + view.fileGoAction.enabled = false; + view.qt_central_widget.answer.enabled = true; + view.qt_central_widget.answer.setFocus(); + view.qt_central_widget.timeleft.progress = drillTime; + view.qt_central_widget.correct.value = 0; +} + +function countdown() +{ + view.qt_central_widget.timeleft.progress--; + if( view.qt_central_widget.timeleft.progress == 0 ) + { + timer.stop(); + view.fileGoAction.enabled = true; + view.qt_central_widget.answer.enabled = false; + alert( "<h1>Times Up!</h1>You got " + view.qt_central_widget.correct.value + " out of " + total + " questions correct." ); + } +} + diff --git a/kjsembed/docs/examples/madminute/madminute.ui b/kjsembed/docs/examples/madminute/madminute.ui new file mode 100644 index 00000000..dadab4d8 --- /dev/null +++ b/kjsembed/docs/examples/madminute/madminute.ui @@ -0,0 +1,361 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>MainWindow</class> +<author>Ian Reinhart Geiser <geiseri@kde.org></author> +<widget class="QMainWindow"> + <property name="name"> + <cstring>MadMinute</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>362</width> + <height>212</height> + </rect> + </property> + <property name="caption"> + <string>Mad Minute</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>3</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><h1>Question:</h1></string> + </property> + </widget> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>question</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>128</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>answer</cstring> + </property> + <property name="minimumSize"> + <size> + <width>64</width> + <height>0</height> + </size> + </property> + <property name="maxLength"> + <number>4</number> + </property> + <property name="trapEnterKeyEvent" stdset="0"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><h2>Time left:</h2></string> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + </widget> + <widget class="QProgressBar"> + <property name="name"> + <cstring>timeleft</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>0</height> + </size> + </property> + <property name="totalSteps"> + <number>60</number> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><h2>Correct answers:</h2></string> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLCDNumber"> + <property name="name"> + <cstring>correct</cstring> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="numDigits"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>Flat</enum> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<menubar> + <property name="name"> + <cstring>MenuBar</cstring> + </property> + <item text="&File" name="fileMenu"> + <action name="fileGoAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Edit" name="Edit"> + <action name="editPreferencesAction"/> + </item> + <item text="&Help" name="helpMenu"> + <action name="helpHelpAction"/> + <separator/> + <action name="helpAboutAction"/> + </item> +</menubar> +<toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>toolBar</cstring> + </property> + <property name="label"> + <string>Tools</string> + </property> + <action name="fileGoAction"/> + <action name="fileExitAction"/> + </toolbar> +</toolbars> +<actions> + <action> + <property name="name"> + <cstring>fileGoAction</cstring> + </property> + <property name="iconSet"> + <iconset>image0</iconset> + </property> + <property name="text"> + <string>Go...</string> + </property> + <property name="menuText"> + <string>&Go...</string> + </property> + <property name="accel"> + <string>Ctrl+G</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileExitAction</cstring> + </property> + <property name="iconSet"> + <iconset>image1</iconset> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuText"> + <string>E&xit</string> + </property> + <property name="accel"> + <string>Ctrl+Q</string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpHelpAction</cstring> + </property> + <property name="iconSet"> + <iconset>image2</iconset> + </property> + <property name="text"> + <string>Help...</string> + </property> + <property name="menuText"> + <string>&Help...</string> + </property> + <property name="accel"> + <string>Ctrl+H</string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAboutAction</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="menuText"> + <string>&About</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>editPreferencesAction</cstring> + </property> + <property name="iconSet"> + <iconset>image3</iconset> + </property> + <property name="text"> + <string>&Preferences...</string> + </property> + <property name="menuText"> + <string>&Preferences...</string> + </property> + <property name="toolTip"> + <string>Preferences...</string> + </property> + </action> +</actions> +<images> + <image name="image0"> + <data format="PNG" length="1197">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000047449444154388d85954d881c4518869fe954c7eaa447a7704752eaae6925c2b0041dff60050dee4554f09083889780ab8778080a8a821ea3b9683cede610c82d5efc3dad62400f4bb2c2c68c1174c4153bb84baadd8ca9d6b4a97252997898cd269a44bfcb4bd55bf5f4cbd7dd5535fea3da3bbf8b75aa9aa6424bc906ef0d5a6a67bc2fa4742bf3ef8ef7afb5b7f61fd009504f81bd1ba1c60876234243c8cf825e02731cd407edb0fbf081fd07ceff2f78e2959377f8cabea853fd8c13b2d1ba3589903099810f507a389203951b748bd249c161aa7cf7643a3bffe6bb6f86ab82db3b4fde06761f327bacbdd933f58842371cd96882739024e01c1060fe84e35827e1a36f72bca72b43fe6a9b0f3f9dd93f1300d65d9e34f4ed74b6297bf4f1fb93da6b4f248c36a0797dccdb9fc0b63bc155900888fb90dd14d3ba05b25b143f9c64c4a3ee2bfacd633bb68d2ecf7d3577610ddcbcebd93dc8ece9c936b51d0fc69cea3b92f53145e978622266f727967b6e4f284a07514cfe87a3be214648c7961bebb5b91f7a37fa818a533f7b68e2de8973eb862df87a42a7a37bb68cd5e5d44331651f9a22a6fa031031ea0678783ce1b9fd30d98a31d5253f163141407a9d6271d96feec9d671d59fcfa3f6ceaf63d04f39caeb1fdf0a45652140b7e7b001f29e5d7b070777c11b1f73852f01951a5443d67de5b797b41a9196ba09feeeecd62cf2804491f74092acaafac757737017bc7368d52fc0148ae92fe148aeb141453acdc62d7a2c32de689063307c72b7584d5c9855b5fcbb0eee82e939c82b98ed3af21e747b8004e38d46e8b1484abd016137660db596b0a8a021f4aaaa2bc017e19d1c20c1035a0ee7659a25045b8fbc3780a6dbb370063ac66081ee298bb3f051d75d157c119e572001e387ea2b0342459196da11fc5950cc97e0bca6b30879a9985d0642724df0e45ba053f0805c552d952798bf2253990258eaf61cd643b704ef212f879b8dbf369400a6022918523d98caac24c82292a95c01735c8b64908861020464e9f02fbbd8bb2b92caa19f3556d7a540700399ca1f1ba163a2e1d1a73e30e5f7bfcb00e0d8945ea6e29f3d9e9a7164abf39b1a97d69595055ffe49d93dd410f674043011de3e2c857adf96965623414968e9a1b6472ef5f8e5030cfd14da97f94a800be07dfec564a3730438b30e60e1d8c285e6d6ed3ffb10b74a6f6e7b6024ad55f490a24ec0f0f0d63abbdf336b63adea546e38ae826171390c8ae5ee518dd947bff39d409c593b84a6b6e9df967c76d4d31c5f2ecde62d37dd8e486054d5f9fcdba1d62e805675ac87d17a9d133dc7a902ba27f3a3edf54b7b46c2170bcdb4d9db3bbdf7fc1a78eeabb90b4fde2b4e17fdb453f66fdeb0b86236fbb3627d1814b54c29cab396469a602a4369030b3f1583c55f42756265f1333d58da9786d9058158d93bbdf71c5ce50679fda5d7235bd98d9d746ad27bbf5dcb6cdc78af1b2332a13224427b53fa1599ba1f65d53df460da39622bfbab4a5579cd1be462bdf0fc0b358f5f5fd26ad8a0c7907a8c60eb081511cc5f09b290a16336097bdae3cf48a49bd93f33b89cf1376f8d272940ee2b7c0000000049454e44ae426082</data> + </image> + <image name="image1"> + <data format="PNG" length="1290">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000004d149444154388dad95c18b1cc715c67fdd5b0bd5a637a98e6760ca48ce1644c42d2c875d64889428209dec0d092822979890201d0c91738a6fc644b6ff053be0837d11f6c1b0ca21201f1c5660c752b08c56b0e016ec921a7616aad10e9e22db680aa999f2a1676d27b9a62e4555bdfaea7bef7daf1e742391b0c0ff61cc7192e41018881795fc8911bca895320e1ecdf7d1802374d7da801612db06a490d086a8918b2e786b036fbfebc3a787c00910dfecc93faf3d65aea8f3bf8952789083046f4119fe63ce35d65b4c6e08de2295c67a1b8ba00837ae27d777ea2b2f8dc36b09c01f94fce90b4f9b4fca5f5f9e55f546d4f5044bc0088915605ab06d6000d4024c5ee00468240e30025c2e290289fdf066babe539f5900f8a5126fac5dbafca3eafee64c6ded2fb4d127fdef88d4febb490714e9e2638ba979662d6d9ed0e989232b693b1ea6593a4d5d9ba4e67b47d2f0a0490ad94bf72533f3b849b7ef6d0901a073f5a4171e5d3b6ce6a3c965627da01c18e4f98b14277f0e1914f38464072fe33e5fc77cf43ed60f31522536d4d1088913012de593298083389003a6044c4f263604564eaea15f5da738d3813299c2a68529b004faec05f41fd729974f7561536582901835c0411487aab0de920989f59e72b9a4f8ed652860ba7d87f0e1fb54c30a932b5c1b289f5a217bfe12688dfcc50b98ab16d758b494d87a0890a487fa33cae0040c728d3eff0af4355477f057dfc2dddde0f4f93fa15f7f8f72658dfa9fd799fcf51d3880eca8419f5a43e7ba4ba45a8616d2439d5a6f512d0425e1d9e3004cfef60e555d9129cd444c01a84540f634d5ce2df8c77ac7eae4055c3b99e30cd1cc81dd9c3121503e7dae331e4df03b15e591151c50e4a6f32c5fc6b6600625936ae3eb722b8f9dfee6fc1098396304d830e9d88e2b20609b1a0d4c1adbd935c34eb78d0360baef6011ea03074262fd10f96d6093ebb9f83500c5a0c449d97922a05073c66a1990e89ec1898cacafe11198bee93ccf07c07fc5d848891ddeec5ed205e50f56b1e30a291593a606c0353548891d571c2f4f75b62d7c31dac4e419d6db6fc5b80d98dc802cc8bc85ea4ec7faf95730474a6ce329a4eade930adb7856ca73f0e30b1df0ce065a0e4048746eb084eeab3cd753bfd73fec2f2fcd421c3d08695e8fc89e390dba40f47a148da7babb81dcdaa6dabdc5896757c87ef63bf86ec674dfd1def880d12cb08489a37b1fa7f65fe36157206d884669366b8f1994f87a88fcfb35b2e72e911d5b255b5ea568a6505714cb2f7795083081ecf30d262d185d62f72d5a69427babab3c8d4cacb718c0fa3a9a5c259bb7af51ba0acefc8ae2c469283228560f73cd646b03b979131b02461aec818b5a40b56731422602c005bf5b04052a605a99b8e0a3e9ad24616ce1a36b7cf1c9358e9767a1a9410d98da4d4012da80d1251cb8785c97c964eb066adfe15a7617004a21c647bdbb987d5fb32fc24c43740f7d5c9232ba5988fd87216eef6e46be74717baf8a4b24d1cddab8949a387a308a196dac76efc5706323a98775f259135e5a0092dba1dd5d7d18c8c793b347fbc712d93649f1582f1ddddf4b8de8a5ed782feda7836e3dcbd3b05ba55923d2d1cec769df87b4b97b3be1f66749bde7d3eacbf6ca6bf79babffdbf3242f6a298d6d7924054968e9624f402209040cdff4bcd08668845c746db0aee5edbf8cbb9ef715f3313f39c80fcae40000000049454e44ae426082</data> + </image> + <image name="image2"> + <data format="PNG" length="1007">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b649444154388d8d953d681c4714c77f7bec89397bc5ed9215dc1611b790e6440acba4c885a4f0419a54c2e9ae9555b870a5ca10630c6e84102e4c70714e6975318210a7085c29a508da26f80409ec2104bbe01337426bef200d6c8ad9b53e1239996678efddfce777f33ed6e23f567fad10b1c4c7c54142e090c59249b46ea90f9db3ae0a741f142eb084a607cc034d00a539c2661fcd10d88ad62df9bf846fad158ecae8872eab52d1eeb6a953c7faa20d49066818fe4981e6343a608cc386926c8e9e58d995c2b71e144d058f84cd4aa7c5b5e5af4038b0d082d729840ec4192cf8b0fd176c47f0728f77523140f370f4d43afa877049fab8e373b71332b3fca5210c04080d8d003805ea308d41f8104b485378fc1327293c43f2dde8a921af55c22aa32f6cee840133cb9f9b439e0dc22d4531a2005e080a7369cb87d5af99118a3b40bfd2ab55890a5d56439febb73f8391040f087c68d40d697e6c48392dc567cdc59e80860bb76f701d586ddf2fdcf3c44b4946bbd78178020248d419e13483e11ec41a7efcfd5c523cd84dcdefa9832b682bc91240adbf560834bd9b2dea4a1b8a510a8173767eb877e6f76c202f03c7e68d5fec80ca01415d38f4da770b61c7121f984f145657409442cb81577fc06266c45cdbf83b3e84ad1c1a0d00b6c7f06a6488d30c3c8115a7cc0b1bbf868b03343b3e8c2646a4da877ba6222abbd786f063239abc811f7620744d22431784497653691c5b4d8c239e40c785ed29346c88a6d0b28dedd9b07823873923fa3a868d5f40298831c471d97faadc6ba1cbb1d21c79024665dd4e33704bdbb3c19d8585f08cf4fb5f4d35601bd26a571a84c311705c8b2587d8ecef4e28c0fcedf7bb362481037999b017bf19d2a46ce0242bab2883a9a25019fbc0612d5ab7149a616073aa7449c04592288174023f47e6b2ca2fce133b20334e85c3301d58aaaae3add184b1d2305520044c357484b1d1b07b90130890f9a5b836769442ae18ab8cadf70d12ad5b12878d64c2dbd033efb7300752c042008b217cdb6d70b303fdeea5f81ca02051bc559a8d7460c6e8d9ac906c4ac5f3971127ae369d27e60c71e8425eb6722c219c2be31ec46f7276c69c2429cf81cd4aefc2d8ecdc2b9ab83c72352bdf7cca35d180d037c5dffda44c9832890d040c471049de25070c84c3c3f1937f199bd56adf2b1ca0df80d5964fbbe34feb41e859429b048d929c44368ae8203f4d6463ac341bc0663af8c0a0bf70c1fdc245b284434f65cc0b87a692a64e55c6be7018aa8cadea4d2faf2b85abd55a2984b0f94869664bd73170980e3efc31fd1b46ffa51cb01b5f6d0000000049454e44ae426082</data> + </image> + <image name="image3"> + <data format="PNG" length="919">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000035e49444154388da5d44f681c6518c7f16fea56de815978a7a430537621532874da0ab341a18d14760b1e62f06229825ea2e2a182f4d22292830d45a4e45082b908896b21a71a8dc89a43211921261121c922c62d1e76722899c52ebb832e9d173b301e26a5cd1fc95a7f976767e6e133ef3c0f6c0fbbb2b1bcb56e64842bfb0cfc468481a2dd505fa2337a7ae0d8e6eefeae53f96ea9dcaa3f4c76e4ef2499bfbb9aac2ed4879f190698b9335f6efdbe0b4f9264e3ee56b234572ffe2f7cfa76a5bcf54b6b0f3e7dbbe27705ccdf592d4f7e5e71f77b363955996dd577c2f59f5bc9bff53f9d43c15fc1b089e54d8c4fef689e189f761d6117456f94de789496762644c646f140d8b66c8606fb659fb4bdb19b293e7673da75f2056f60f094d4b21a44c0612002bbd7c6eff8f240b816f8908753e76c696179374627871d697bce594b6240bb1d81f6a42effba8c8aadcd83e08c8c8d9007483b67110d4a69dd93e50b2ff683041e80a16b3b2a6d81ead40e849fcb9fe83f993b9a77e3e7638e9b5944af207b4423680564f52c41ab4d56d7f0ff08507fc6284dd1a9c7eec41bebdaa74347ef7d32d754fb8ec214e6e817b3df842216444db084b15dad27d70d2014b41b0a5bb7289d9c73ed13f62d62bc8753851df34e924402f400bcffde988bc07bf7b58b5298604b1bbfe363eb69b532267ed34f17b7721527f6089b01d6799bb54555b5a174e4c35af8f40b7a1eff18b93ce9fa1dff56a1af505442e19836b5fb352c61f26a69009933a87957710eafa105ebe90e3ac00b03048b7e155d948e5d590ff7c08ff3faa5913e81d5a7088a027e5020cf9985f280bb200bb187ca041842000a1044b142cb5b2c78546d281dbf919e7c0fbc5f66ae15ae5f38637d6c64d7a0574047812ed213eb405381eef09bd7a8a2533a3d520bbb82373e72a41fe30d9570d123901a84a4e36846291e02b1c6f71e550b4a5dc100aba38ef443bc8baf982eb93045ef2b20025f4116c8001d87af571adf760d032c7d909efcadb3b89c17d068a77810a6a3510af292b5458343ff057ef9b35a68e994a67ea44a55a69f9fdb0633db4d0202a2ee96b73b95b71db919e3bd73a6ed6a39052fd950f5d33fab18167eb2ba5bde7e99b9ecc84688f7a6db760d3d04292054ac6d9aacdcd7469f190618bbe4481e31eb64298699364219a11f337eedabdaf57f008dc09ee67a81bacc0000000049454e44ae426082</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/examples/multifile/multifile.js b/kjsembed/docs/examples/multifile/multifile.js new file mode 100755 index 00000000..03d7c10e --- /dev/null +++ b/kjsembed/docs/examples/multifile/multifile.js @@ -0,0 +1,10 @@ +#!/usr/bin/env kjscmd + +// Shows you how to use multiple script files. + +var a = ':-)'; + +println( 'multifile: Starting...' ); +load( 'otherfile.js' ); +println( 'multifile: Ending, ' + a ); + diff --git a/kjsembed/docs/examples/multifile/otherfile.js b/kjsembed/docs/examples/multifile/otherfile.js new file mode 100644 index 00000000..577f6598 --- /dev/null +++ b/kjsembed/docs/examples/multifile/otherfile.js @@ -0,0 +1,5 @@ +#!/usr/bin/env kjscmd + +println( 'otherfile: Hello!' ); +println( 'otherfile: ' + a ); +println( 'otherfile: Goodbye' ); diff --git a/kjsembed/docs/examples/multipart/multipart.js b/kjsembed/docs/examples/multipart/multipart.js new file mode 100644 index 00000000..89402f79 --- /dev/null +++ b/kjsembed/docs/examples/multipart/multipart.js @@ -0,0 +1,56 @@ +#!/usr/bin/env kjscmd + +// +// Example of loading several parts from a script +// + +// +// Main +// +var qd = new QDir(); + +var dir = 'file://' + qd.path() + '/../'; +var file = dir + 'index.html'; + +// Create the UI +var mw = new KParts_MainWindow(); +var ac = mw.actionCollection(); + +var split = new QSplitter( mw ); +mw.setCentralWidget( split ); + +// +// Load the sidebar +// +var side = Factory.createROPart( "inode/directory", split, "sidebar" ); + +// +// Load the views +// +var views = new QSplitter( split ); +views.orientation = 1; + +var top = Factory.createROPart( "text/html", views, "html" ); + +var bottom = Factory.createROPart( "text/plain", views, "source" ); + +// +// Glue it together +// +top.connect(side.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' ) +bottom.connect(side.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' ) + +side.openURL( dir ); +top.openURL( file ); +bottom.openURL( file ); + +// +// Activate XMLGUI and show the window +// +StdAction.quit( mw, 'close()', mw.actionCollection() ); + +mw.resize( 700, 500 ); +split.child(1).maximumWidth = 200; + +mw.show(); +application.exec(); diff --git a/kjsembed/docs/examples/netaccess/net.js b/kjsembed/docs/examples/netaccess/net.js new file mode 100755 index 00000000..c406d79b --- /dev/null +++ b/kjsembed/docs/examples/netaccess/net.js @@ -0,0 +1,24 @@ +#!/usr/bin/env kjscmd + +var net = new NetAccess( null, 'net' ); + +var loc = '/tmp/test.jpg'; + +var ret = net.download( 'http://www.kde.org/media/images/kde_logo.jpg', loc ); + +if ( ret ) { + var mime = net.mimetype( loc ); + print( "Mimetype = " + mime + '\n' ); + var img = new Image(); + img.load( loc ); + if ( !img.isOk() ) { + warn( 'Failed to load image '+loc); + } else { + print( 'Image ' + loc + ' is OK \n' ); + var lbl = new QLabel(); + lbl.pixmap = img.pixmap(); + lbl.show(); + application.exec(); + } +} +net.del( loc ); diff --git a/kjsembed/docs/examples/opaquevalues/opaque.js b/kjsembed/docs/examples/opaquevalues/opaque.js new file mode 100755 index 00000000..f92fb6f2 --- /dev/null +++ b/kjsembed/docs/examples/opaquevalues/opaque.js @@ -0,0 +1,26 @@ +#!/usr/bin/env kjscmd + +// Usage: kjscmd --noexec opaque.js 2>/dev/null + +// +// Test QVariant support +// + +var w = new QLabel(); +w.text = 'Test'; + +var sp = w.sizePolicy; +println(sp); + +var cr = w.childrenRegion; +println(cr); + +// +// Test void * support +// + +var view = part.view(); +println(view); +println(dump(view)); + +application.quit(); diff --git a/kjsembed/docs/examples/qdocviewer/docviewer.ui b/kjsembed/docs/examples/qdocviewer/docviewer.ui new file mode 100755 index 00000000..33db5ff2 --- /dev/null +++ b/kjsembed/docs/examples/qdocviewer/docviewer.ui @@ -0,0 +1,523 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>HelpUI</class> +<widget class="QMainWindow"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>760</width> + <height>471</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>3</number> + </property> + <property name="spacing"> + <number>2</number> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QToolBox"> + <property name="name"> + <cstring>Navbar</cstring> + </property> + <property name="currentIndex"> + <number>5</number> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>StaticObjects</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>Static Objects</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>StaticObjectList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>ObjectTypes</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>Object Types</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ObjectTypeList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>KJSEmbedObjects</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>KJSEmbed Objects</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>KJSEmbedObjectList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>QtObjects</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>Qt Objects</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>QtObjectList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>KDEObjects</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>KDE Objects</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>KDEObjectList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>ExceptionTypes</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>Exception Types</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>ExceptionTypeList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>UnconstructableTypes</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>Unconstructable Types</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="spacing"> + <number>1</number> + </property> + <widget class="QListBox" row="0" column="0"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>UnconstructableTypeList</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>Search</cstring> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <attribute name="label"> + <string>Search</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>4</number> + </property> + <property name="spacing"> + <number>2</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>SearchLine</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>Search</cstring> + </property> + <property name="text"> + <string>Search</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QListBox"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>SearchResults</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + </widget> + </vbox> + </widget> + </widget> + <widget class="QTextBrowser"> + <property name="name"> + <cstring>HelpPage</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="textFormat"> + <enum>RichText</enum> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +<menubar> + <property name="name"> + <cstring>MenuBar</cstring> + </property> + <item text="&File" name="fileMenu"> + <action name="fileSaveAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Edit" name="editMenu"> + <separator/> + <action name="editCopyAction"/> + <action name="editPasteAction"/> + <separator/> + <action name="editFindAction"/> + </item> + <item text="&Help" name="helpMenu"> + <separator/> + <action name="helpAboutAction"/> + </item> +</menubar> +<toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>toolBar</cstring> + </property> + <property name="label"> + <string>Tools</string> + </property> + <action name="fileExitAction"/> + <action name="editCopyAction"/> + </toolbar> +</toolbars> +<actions> + <action> + <property name="name"> + <cstring>fileSaveAction</cstring> + </property> + <property name="iconSet"> + <iconset>image0</iconset> + </property> + <property name="text"> + <string>Save</string> + </property> + <property name="menuText"> + <string>&Save</string> + </property> + <property name="accel"> + <string>Ctrl+S</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileExitAction</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuText"> + <string>E&xit</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>editCopyAction</cstring> + </property> + <property name="iconSet"> + <iconset>image1</iconset> + </property> + <property name="text"> + <string>Copy</string> + </property> + <property name="menuText"> + <string>&Copy</string> + </property> + <property name="accel"> + <string>Ctrl+C</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editPasteAction</cstring> + </property> + <property name="iconSet"> + <iconset>image2</iconset> + </property> + <property name="text"> + <string>Paste</string> + </property> + <property name="menuText"> + <string>&Paste</string> + </property> + <property name="accel"> + <string>Ctrl+V</string> + </property> + </action> + <action> + <property name="name"> + <cstring>editFindAction</cstring> + </property> + <property name="iconSet"> + <iconset>image3</iconset> + </property> + <property name="text"> + <string>Find</string> + </property> + <property name="menuText"> + <string>&Find...</string> + </property> + <property name="accel"> + <string>Ctrl+F</string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAboutAction</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="menuText"> + <string>&About</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> +</actions> +<images> + <image name="image0"> + <data format="PNG" length="217">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000a049444154789cd5954d0a802010859fd14668e18de662d222bc98376a21b4ac451992c66469e0b7f187f1f11c47052a218e762daddbfb9e99f6568f80b5364b8588ce35440400e80a398ce8f99034d2292cc37c8ebd530feb583a05e954341f8a027b2a7d3a1f09bf854dc5d5d953aa396e4f38cab199e2d2e108abe156f82e30977fcb4d8ff942d75dbebed2e143953a93f6caad3d6111f44b7d4f820ff9c0069bb51ecd122066740000000049454e44ae426082</data> + </image> + <image name="image1"> + <data format="PNG" length="248">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000bf49444154789cd593410a83301045df488ee51dbc8c3ba98bf46a9eabd385350d266362444a3f0c4266fcf3f824f06f12402b66da8c55f3de2212cf9d92cb98c0ba2d7c4544cf9a07638bbad53c4491235ecf7cc1623697a92540c11ff4fda75275015d24a9389e7d6f53df4fe4ccab323eea0f03c0c4b2a0712ce6add89b59b7661c3be095985f261679ee4ebcc22c9788551fe6a2cbc4969a894bcb6f23ee361aab62e252c57294dfbfb610bbf2c897b8a46cc6677eaa519571fa087ea83762da9aba45b637520000000049454e44ae426082</data> + </image> + <image name="image2"> + <data format="PNG" length="270">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000d549444154789cc5955d0a84300c8427e2a90a9e6c8b0f4b3dd982d7ca3e58d7fe4cd0ba5d7640024df265da0a057e2439c9eb8d9eaa8841a0c9aad8c82ab32f9c425be1e30e0dcf00c00308f0b3a7a07410a9d7142e00b42c5a5fab696b979b1c837fc0c316b6e4165b64f78d716359919bdc4570de47c04732dd5e5bcc35f0c97762ae787936dccf7513577e79f48c4b27aa0f1327b240f5117fcbe348aa33b6e0224b054d0746b8025e2e3b3e73cde0dd1c97f02e8ed9d0af1db381224bdf33eee698a934a0f617b45540d00bcf4ca08fc0dff406e325c198b16b67fb0000000049454e44ae426082</data> + </image> + <image name="image3"> + <data format="PNG" length="662">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000025d49444154789cd593a172db4010863f670a56ecc42278d0653693a0c21c68d6c2e60df21a818111349499c254a8329b55f0e089ddb15ba602b79d6692d699b6d399fee86e67e7db7f77efe07fd3e2c74bd775b3730eef3d5115002382b5166b2d5757578b1729bf02b76d3b0f8703b92d58aed7600400ef1ce3c70306a8aa8aebebeb57c117dfa06ddb525dd754efb600a82a49138a123532ec3ac42b9bcde655ce2ffabe9f87c340fde13dcb4d8daaa24e48ee12c6823808c107969b1a8a9ce3f1f8aa515c38e7c8ada5aa6b00c45f129c67d223938c88e6c860d118b1d592d139baae9bcf83a78965b5465134801b1d2e1f4945c0e350096408ea154490c2e0bd3fef5853c2e486a0019f4d84f58418418362b0408e8b23c924501093314dd359f01b809814112025144015f1964c0bbc1b484b07e4688880c029ebd78e4141f5b434fd76864c053f1e084b0f8580265440634044ce838bbcc03987a61350a3a2285e1d5a4414d0708aa598082162ad3d0fb6d6e287cfa498508d274050447370428c91af8d10fd4481608c390b5e00dcddddcd8e80a9de420248e804840856f03e02907d729465c9ba5ae3468731e6a79fe50260b55a6102c4ee40a6894c33f2cb0cb106512814f8f899b22cb9b9b959b8d1f1f8f848d334b46dfbe29bfe5eadeffbf9783c323a871881ecb4200d1151a8eb9aed76bb00188661eeba8efd7e8f3186ed76cb6ab57ae2fe591b5dd7cdde7b628c8808799e63ada5aaaa67b9bbdd6e6e9a06ef3d755d3f29fec7eafb7ebebdbd9dadb5735996f3fdfdfdfca2e3dfd5c3c3c3dc340dd334b1d96cfe1e184e63dceff7a494fe26f61fe90bbc4c5e59b8ac895e0000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>fileExitAction</sender> + <signal>activated()</signal> + <receiver>Form1</receiver> + <slot>close()</slot> + </connection> +</connections> +<tabstops> + <tabstop>SearchLine</tabstop> + <tabstop>Search</tabstop> + <tabstop>SearchResults</tabstop> + <tabstop>HelpPage</tabstop> + <tabstop>StaticObjectList</tabstop> + <tabstop>ObjectTypeList</tabstop> + <tabstop>KJSEmbedObjectList</tabstop> + <tabstop>QtObjectList</tabstop> + <tabstop>KDEObjectList</tabstop> + <tabstop>ExceptionTypeList</tabstop> + <tabstop>UnconstructableTypeList</tabstop> +</tabstops> +<layoutdefaults spacing="2" margin="3"/> +</UI> diff --git a/kjsembed/docs/examples/qdocviewer/qdocviewer.js b/kjsembed/docs/examples/qdocviewer/qdocviewer.js new file mode 100644 index 00000000..41ae2835 --- /dev/null +++ b/kjsembed/docs/examples/qdocviewer/qdocviewer.js @@ -0,0 +1,201 @@ +#!/usr/bin/env qjscmd +// Populates the sidebar listview +function setup_sidebar( special, qt, all ) +{ + var qobjects = Factory.constructors().sort(); + + for ( var i=0; i < qobjects.length ; i++ ) { + all.insertItem( qobjects[i] ); + + if ( /^Q/.test(qobjects[i]) ) + qt.insertItem( qobjects[i] ); + else + special.insertItem( qobjects[i] ); + } +} + +function documentStaticObject( type ) +{ + HelpPage.text ="<h1>" + type + "</h1><HR>"; + try{ + var obj = eval( type ); + HelpPage.text += dump(obj); + } + catch (error) + { + HelpPage.text += "This object is not supported by this version of KJSEmbed"; + } +} + +function documentConstructableObject( type ) +{ + HelpPage.text ="<h1>" + type + "</h1><HR>"; + if ( type!= 'TextStream' ) + { + try { + HelpPage.text += dump(Factory.createObject( type )); + } + catch(x) { + HelpPage.text +='Bindings for the ' + type + ' class.<br /> This class is understood by the interpreter, but cannot be created from scripts.' + } + } +} + +function populateStaticObjects() +{ + StaticObjectList.clear(); + var statics = [ 'Factory', 'System', 'Global', 'StdDialog', + 'StdAction', 'StdDirs', 'StdIcons', 'Qt' ]; + for ( var idx = 0; idx < statics.length; idx++ ) + { + StaticObjectList.insertItem(statics[idx]); + } +} + +function populateExceptions() +{ + var expts = [ 'ReferenceError', 'EvalError', 'RangeError', 'TypeError' ]; + for ( var idx = 0; idx < expts.length; idx++ ) + { + ExceptionTypeList.insertItem(expts[idx]); + } +} + +function populateObjects() +{ + var tps = Factory.types().sort(); + QtObjectList.clear(); + KJSEmbedObjectList.clear(); + KDEObjectList.clear(); + ObjectTypeList.clear(); + + cons = Factory.constructors().sort(); + cons += 'Part'; + + for ( var i=0; i < tps.length; i++ ) { + + if ( /^Q/.test(tps[i]) ) { + QtObjectList.insertItem( tps[i] ); + } + else if ( /^KJSEmbed::/.test(tps[i]) ) { + if ( tps[i] != 'KJSEmbed::Bindings::JSDCOPInterface' ) { + KJSEmbedObjectList.insertItem( tps[i] ); + } + } + else if ( /^K/.test(tps[i]) ) { + KDEObjectList.insertItem( tps[i] ); + } + else { + ObjectTypeList.insertItem( tps[i] ); + } + } +} +// +// Main +// + +// Create the UI +var mw = Factory.loadui("docviewer.ui"); +//mw.qt_central_widget.HelpPage.text = dump(mw.qt_central_widget.Navbar.StaticObjects.StaticObjectList); +var HelpPage = mw.qt_central_widget.HelpPage; +var StaticObjectList = mw.qt_central_widget.Navbar.StaticObjects.StaticObjectList; +var ExceptionTypeList = mw.qt_central_widget.Navbar.ExceptionTypes.ExceptionTypeList; +var KDEObjectList = mw.qt_central_widget.Navbar.KDEObjects.KDEObjectList; +var QtObjectList = mw.qt_central_widget.Navbar.QtObjects.QtObjectList; +var KJSEmbedObjectList = mw.qt_central_widget.Navbar.KJSEmbedObjects.KJSEmbedObjectList; +var ObjectTypeList = mw.qt_central_widget.Navbar.ObjectTypes.ObjectTypeList; + +populateStaticObjects(); +populateExceptions(); +populateObjects(); + +mw.connect( StaticObjectList, 'highlighted(const QString&)', this, 'documentStaticObject' ); +mw.connect( ExceptionTypeList, 'highlighted(const QString&)', this, 'documentStaticObject' ); +mw.connect( KDEObjectList, 'highlighted(const QString&)', this, 'documentConstructableObject' ); +mw.connect( QtObjectList, 'highlighted(const QString&)', this, 'documentConstructableObject' ); +mw.connect( KJSEmbedObjectList, 'highlighted(const QString&)', this, 'documentConstructableObject' ); +mw.connect( ObjectTypeList, 'highlighted(const QString&)', this, 'documentConstructableObject' ); + + +mw.show(); +application.exec(); +/* + +side = new QTabWidget( split, 'sidebar' ); +view = new QTabWidget( split, 'mainview' ); + +// Load the view +js = new QTextEdit( view, 'js' ); +js.setReadOnly( true ); + +view.addTab( js, '&Javascript' ); + +view.set_class = function( clazz ) +{ + clazz = clazz.replace( '^[^QK]*', '' ); + + // JS docs + var s = ''; + + s = s + '<html>'; + s = s + '<body>'; + s = s + '<h1>' + clazz + '</h1>'; + + try { + var obj = eval('new '+clazz+'()'); + s = s + dump(obj); + } + catch ( err ) { + s = s + '<font color="red">Error dumping object: ' + err + '</font>'; + } + + s = s + '</body>'; + s = s + '</html>'; + + js.text = s; +} + +view.setup = function() +{ + // JS docs + var s = ''; + s = s + '<html>'; + s = s + '<body>'; + s = s + '<h1>Script Reference</h1>'; + s = s + '</body>'; + s = s + '</html>'; + + js.text = s; +} + +// Setup the sidebar +specialside = new QListBox( side, 'specialsidebar' ); +qtside = new QListBox( side, 'qtsidebar' ); +allside = new QListBox( side, 'allsidebar' ); + +side.addTab( specialside, '&Special' ); +side.addTab( qtside, '&Qt' ); +side.addTab( allside, '&All' ); + +setup_sidebar( specialside, qtside, allside ); + +qtside.connect( qtside, 'highlighted(const QString&)', view, 'set_class' ); +specialside.connect( specialside, 'highlighted(const QString&)', view, 'set_class' ); +allside.connect( allside, 'highlighted(const QString&)', view, 'set_class' ); + +// +// Show the window +// + +side.maximumWidth = 250; +mw.resize( 800, 550 ); + +mw.show(); + +// +// Connect together +// +view.setup(); + +application.exec(); +*/ diff --git a/kjsembed/docs/examples/qobject-dom/qobject-dom.js b/kjsembed/docs/examples/qobject-dom/qobject-dom.js new file mode 100644 index 00000000..db9d381d --- /dev/null +++ b/kjsembed/docs/examples/qobject-dom/qobject-dom.js @@ -0,0 +1,24 @@ +#!/usr/bin/env kjscmd + +// +// Tests the DOM methods +// + +var box = console.getElementById('cmd_box'); +var btn = box.child('run_button'); + +print('Button: '); +println(btn); + +println( 'Property: enabled' ); +print( 'hasAttribute: ' ); +println( btn.hasAttribute('enabled') ); +print( 'getAttribute: ' ); +println( btn.getAttribute('enabled') ); +print( 'setAttribute: ' ); +println( btn.setAttribute('enabled', false) ); +print( 'getAttribute: ' ); +println( btn.getAttribute('enabled') ); + +println(); +println( 'Now the console will be displayed with button disabled' ); diff --git a/kjsembed/docs/examples/readonlypart/README b/kjsembed/docs/examples/readonlypart/README new file mode 100644 index 00000000..41a5cf1a --- /dev/null +++ b/kjsembed/docs/examples/readonlypart/README @@ -0,0 +1,3 @@ +Shows how to load read only parts from a script. The example will load +the URL specified on the command line into a KHTML part. If no URL is +specified then www.kde.org is loaded. diff --git a/kjsembed/docs/examples/readonlypart/readonlypart.js b/kjsembed/docs/examples/readonlypart/readonlypart.js new file mode 100755 index 00000000..0f57b763 --- /dev/null +++ b/kjsembed/docs/examples/readonlypart/readonlypart.js @@ -0,0 +1,24 @@ +#!/usr/bin/env kjscmd + +// Example that provides a basic HTML browser + +// Get URL to load +var url = 'http://www.kde.org/'; +if ( application.args.length ) + url = application.args[0]; + +// Create the UI +var mw = new KMainWindow(); +var box = new QHBox( mw ); +mw.setCentralWidget(box); + +// Create the view +var view = Factory.createROPart( "text/html", box, "view" ); +view.connect(view.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' ) +view.openURL( url ); + +// Show the GUI +mw.resize(650,500); +mw.show(); + +application.exec(); diff --git a/kjsembed/docs/examples/readwritepart/README b/kjsembed/docs/examples/readwritepart/README new file mode 100644 index 00000000..41a5cf1a --- /dev/null +++ b/kjsembed/docs/examples/readwritepart/README @@ -0,0 +1,3 @@ +Shows how to load read only parts from a script. The example will load +the URL specified on the command line into a KHTML part. If no URL is +specified then www.kde.org is loaded. diff --git a/kjsembed/docs/examples/readwritepart/readwritepart.js b/kjsembed/docs/examples/readwritepart/readwritepart.js new file mode 100755 index 00000000..3cc9c18c --- /dev/null +++ b/kjsembed/docs/examples/readwritepart/readwritepart.js @@ -0,0 +1,25 @@ +#!/usr/bin/env kjscmd + +// Example that embeds a read-write kpart + +// Get URL to load +var url = 'http://www.kde.org/'; +if ( application.args.length ) + url = application.args[0]; + +// Create the UI +var mw = new KMainWindow(); +var box = new QHBox( mw ); +mw.setCentralWidget(box); + +// Create the view +var view = Factory.createRWPart( "text/plain", box, "view" ); + +// Open the file +view.openURL( url ); + +// Show the GUI +mw.resize(650,500); +mw.show(); + +application.exec(); diff --git a/kjsembed/docs/examples/sax/saxdefaults.js b/kjsembed/docs/examples/sax/saxdefaults.js new file mode 100644 index 00000000..f4a7d3da --- /dev/null +++ b/kjsembed/docs/examples/sax/saxdefaults.js @@ -0,0 +1,37 @@ +#!/usr/bin/env kjscmd + +sax = new Object(); + +// This method is not implemented, so we rely on the default +//sax.startDocument = function() { +// println( "start document" ); +// return true; +//} + +sax.startElement = function( namespace, localname, qualifiedname ) { + println( "start: '" + namespace + "', '" + localname + "', '" + qualifiedname + "'" ); + return true; +} + +sax.endElement = function( namespace, localname, qualifiedname ) { + println( "end: '" + namespace + "', '" + localname + "', '" + qualifiedname + "'" ); + return true; +} + +sax.characters = function( chars ) { + println( "characters: '" + chars + "'" ); + return true; +} + +sax.endDocument = function() { + println( "end document" ); + return true; +} + +try { + saxLoadFile( sax, application.args[0] ); +} +catch( theErr ) +{ + println(theErr); +} diff --git a/kjsembed/docs/examples/sax/saxdemo.js b/kjsembed/docs/examples/sax/saxdemo.js new file mode 100644 index 00000000..c39ac619 --- /dev/null +++ b/kjsembed/docs/examples/sax/saxdemo.js @@ -0,0 +1,36 @@ +#!/usr/bin/env kjscmd + +sax = new Object(); + +sax.startDocument = function() { + println( "start document" ); + return true; +} + +sax.startElement = function( namespace, localname, qualifiedname ) { + println( "start: '" + namespace + "', '" + localname + "', '" + qualifiedname + "'" ); + return true; +} + +sax.endElement = function( namespace, localname, qualifiedname ) { + println( "end: '" + namespace + "', '" + localname + "', '" + qualifiedname + "'" ); + return true; +} + +sax.characters = function( chars ) { + println( "characters: '" + chars + "'" ); + return true; +} + +sax.endDocument = function() { + println( "end document" ); + return true; +} + +try { + saxLoadFile( sax, application.args[0] ); +} +catch( theErr ) +{ + println(theErr); +} diff --git a/kjsembed/docs/examples/sax/saxerror.xml b/kjsembed/docs/examples/sax/saxerror.xml new file mode 100644 index 00000000..5ebe78a1 --- /dev/null +++ b/kjsembed/docs/examples/sax/saxerror.xml @@ -0,0 +1,3 @@ +<atag> + <tag2>some text</error> +</atag> diff --git a/kjsembed/docs/examples/sax/saxnamespace.xml b/kjsembed/docs/examples/sax/saxnamespace.xml new file mode 100644 index 00000000..2c74ab3c --- /dev/null +++ b/kjsembed/docs/examples/sax/saxnamespace.xml @@ -0,0 +1,3 @@ +<space:outer> + <container:tag>this tag is in the namespace container</container:tag> +</space:outer> diff --git a/kjsembed/docs/examples/sax/saxtest.xml b/kjsembed/docs/examples/sax/saxtest.xml new file mode 100644 index 00000000..a74dd479 --- /dev/null +++ b/kjsembed/docs/examples/sax/saxtest.xml @@ -0,0 +1,9 @@ +<atag> + <tag2>some text</tag2> + <tag2>some text</tag2> + <tag2>some text</tag2> + <tag2>some text</tag2> + <nesting> + <one><two><three/></two></one> + </nesting> +</atag> diff --git a/kjsembed/docs/examples/sql/sql.js b/kjsembed/docs/examples/sql/sql.js new file mode 100755 index 00000000..5ef568de --- /dev/null +++ b/kjsembed/docs/examples/sql/sql.js @@ -0,0 +1,57 @@ +#!/usr/bin/env kjscmd + +var db = new SqlDatabase(); +var mw = new KMainWindow(); +var box = new QVBox( mw ); +mw.setCentralWidget(box); + +if ( db.addDatabase("QMYSQL3", "test" )) +{ + db.databaseName = "XXXX"; + db.userName = "XXXX"; + db.password = "XXXX"; + db.hostName = "XXXX"; + db.port = 3306; + println("Database Name:" + db.databaseName); + println("User Name:" + db.userName); + println("Password:" + db.password); + println("Host Name:" + db.hostName); + println("Port:" + db.port); + println("Driver Name:" + db.driverName); + var list = new KListView(box); + list.addColumn('One'); + list.addColumn('Two'); + list.addColumn('Three'); + if( db.open() ) + { + var query = db.exec("select * from tasks" ); + println(query.size + " Results returned"); + if (query.active) + { + println(query.size + " Results returned"); + if( query.first() ) + { + while( query.next()) + { + println(query.value(0).toString() + " " + + query.value(1).toString() + " " + + query.value(2).toString()); + + list.insertItem(query.value(0).toString(), + query.value(1).toString(), + query.value(2).toString()); + } + } + else + println("Query Error: " + query.lastError); + } + else + println("Database Connection Error: " + db.lastError); + + } + else + println("Database Open Error: " + db.lastError); +} +else + println("Database Connection Error: " + db.lastError); +mw.show(); diff --git a/kjsembed/docs/examples/stdicons/stdicons.js b/kjsembed/docs/examples/stdicons/stdicons.js new file mode 100755 index 00000000..e01c96ec --- /dev/null +++ b/kjsembed/docs/examples/stdicons/stdicons.js @@ -0,0 +1,17 @@ +#!/usr/bin/env kjscmd + +var mainBox = new QVBox(this); +var Icon1 = new QLabel(mainBox); +var Icon2 = new QLabel(mainBox); +var Icon3 = new QLabel(mainBox); +var Icon4 = new QLabel(mainBox); +var Icon5 = new QLabel(mainBox); + +Icon1.pixmap = StdIcons.BarIcon("openterm"); +Icon2.pixmap = StdIcons.DesktopIcon("folder"); +Icon3.pixmap = StdIcons.SmallIcon("folder"); +Icon4.pixmap = StdIcons.MainBarIcon("fileclose"); +Icon5.pixmap = StdIcons.UserIcon("ftp"); + +mainBox.show(); +application.exec(); diff --git a/kjsembed/docs/examples/systemtray/kjstray.png b/kjsembed/docs/examples/systemtray/kjstray.png Binary files differnew file mode 100644 index 00000000..f77ae150 --- /dev/null +++ b/kjsembed/docs/examples/systemtray/kjstray.png diff --git a/kjsembed/docs/examples/systemtray/systemtray.js b/kjsembed/docs/examples/systemtray/systemtray.js new file mode 100755 index 00000000..5ecc55f0 --- /dev/null +++ b/kjsembed/docs/examples/systemtray/systemtray.js @@ -0,0 +1,30 @@ +#!/usr/bin/env kjscmd + +// +// Example that uses KSystemTray +// + +// Create the main window +mainwin = new QTextEdit(this); +mainwin.text = '<qt>This is the main window for a script that illustrates ' + + 'the use of the <i>System Tray</i>.'; + +// Create the tray icon +trayicon = new KSystemTray( mainwin ); + +// Set the pixmap of the tray icon (we force it to be loaded from the cwd here) +cwd = (new QDir()).absPath(); +trayicon.pixmap = trayicon.loadIcon( cwd + '/kjstray.png' ); + +// Ensure we quit when you choose the option from the tray item's menu +application.connect( trayicon, 'quitSelected()', 'quit()' ); + +// Get the context menu +var menu = trayicon.contextMenu(); +menu.insertItem("My Item"); + +// Show both the main window and the icon +trayicon.show(); +mainwin.show(); + +application.exec(); diff --git a/kjsembed/docs/examples/timer/timer.js b/kjsembed/docs/examples/timer/timer.js new file mode 100644 index 00000000..fabb669f --- /dev/null +++ b/kjsembed/docs/examples/timer/timer.js @@ -0,0 +1,10 @@ +#!/usr/bin/env kjscmd + +var led = new KLed(); +var timer = new QTimer(); +led.connect( timer, 'timeout()', 'toggle()' ); + +timer.start( 500 ); + +led.show(); +application.exec(); diff --git a/kjsembed/docs/examples/treeview/showtree.js b/kjsembed/docs/examples/treeview/showtree.js new file mode 100644 index 00000000..76872d35 --- /dev/null +++ b/kjsembed/docs/examples/treeview/showtree.js @@ -0,0 +1,68 @@ +#!/usr/bin/env kjscmd + +function buildViewNode( node, parent ) +{ + var l = new QLabel( parent, 'node' ); + l.text = '<center><table cellspacing=0>' + + '<tr><th bgcolor="#aaaaee"><b>' + node.text + '</b></th></tr>' + + '<tr><td bgcolor="#ccccee">' + node.text + '</td></tr>' + + '<tr><td bgcolor="#ccccee">' + node.text + '</td></tr>' + + '</table></center>'; + + return l; +} + +function buildView( node, parent ) +{ + // No children + if ( node.children.length == 0 ) { + return buildViewNode( node, parent ); + } + + // Create container node + var vbox = new QVBox( parent, 'subtree' ); + vbox.margin = 8; + vbox.spacing = 6; + + var vnode = buildViewNode( node, vbox ); + + // Create children + var hbox = new QHBox( vbox, 'child_nodes' ); + hbox.spacing = 6; + + for ( var i = 0 ; i < node.children.length ; i++ ) { + buildView( node.children[i], hbox ); + } + + return vbox; +} + +function buildNode( ttl ) +{ + var node = new Object(); + node.text = ttl; + node.children = []; + return node; +} + +// Create Tree Model +var root = buildNode( 'Root' ); + +root.children = [ buildNode('One'), buildNode('Two'), buildNode('Three') ]; +root.children[0].children = [ buildNode('One'), buildNode('Two') ]; +root.children[0].children = [ buildNode('One'), buildNode('Two') ]; +root.children[1].children = [ buildNode('One'), buildNode('Two') ]; +root.children[1].children = [ buildNode('One'), buildNode('Two'), buildNode('Three') ]; +root.children[2].children = [ buildNode('One') ]; +root.children[2].children = [ buildNode('One'), buildNode('Two'), buildNode('Three') ]; + +// Create View +var box = new QVBox( 'tree_view' ); +box.margin = 6; + +var view = buildView( root, box ); +var spacer = new QLabel( box ); + +box.show(); + + diff --git a/kjsembed/docs/examples/treeview/showtree.png b/kjsembed/docs/examples/treeview/showtree.png Binary files differnew file mode 100644 index 00000000..8806d46d --- /dev/null +++ b/kjsembed/docs/examples/treeview/showtree.png diff --git a/kjsembed/docs/examples/treeview/tree2.js b/kjsembed/docs/examples/treeview/tree2.js new file mode 100644 index 00000000..d8b8e09d --- /dev/null +++ b/kjsembed/docs/examples/treeview/tree2.js @@ -0,0 +1,56 @@ +#!/usr/bin/env kjscmd + +// Demo that creates a tree from a ui file using QHBox and QBox. + +function create_item( node, parent ) +{ + var l = new QLabel( parent ); + l.paletteBackgroundColor = '#aaaaee'; + l.frameShape = 1; + l.frameWidth = 1; + l.alignment = 0x44; + + l.text = node.name; + return l; +} + +function create_subtree_layout( parent ) +{ + var vb = new QVBox( parent ); + vb.margin = 12; + + return vb; +} + +function create_child_layout( parent ) +{ + var hb = new QHBox( parent ); + hb.margin = 6; + + return hb; +} + +function create_tree( node, parent ) +{ + var outer = create_subtree_layout( parent ); + + create_item( node, outer ); + + var inner = create_child_layout( outer ); + + for ( var i = 0 ; i < node.childCount() ; i++ ) { + var child = node.child(i); + if ( child.isWidgetType() ) + create_tree( child, inner ); + } + + return outer; +} + +var ui = Factory.loadui( 'treetest.ui' ); +var top = new QHBox(); +create_tree( ui, top ); + +top.show(); + + diff --git a/kjsembed/docs/examples/treeview/treetest.ui b/kjsembed/docs/examples/treeview/treetest.ui new file mode 100644 index 00000000..c645e9c2 --- /dev/null +++ b/kjsembed/docs/examples/treeview/treetest.ui @@ -0,0 +1,111 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>Form1</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>291</width> + <height>116</height> + </rect> + </property> + <widget class="QSplitter"> + <property name="name"> + <cstring>splitter1</cstring> + </property> + <property name="geometry"> + <rect> + <x>12</x> + <y>12</y> + <width>269</width> + <height>92</height> + </rect> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton1</cstring> + </property> + <property name="text"> + <string>pushButton1</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton2</cstring> + </property> + <property name="text"> + <string>pushButton2</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton3</cstring> + </property> + <property name="text"> + <string>pushButton3</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton4</cstring> + </property> + <property name="text"> + <string>pushButton4</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton5</cstring> + </property> + <property name="text"> + <string>pushButton5</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton6</cstring> + </property> + <property name="text"> + <string>pushButton6</string> + </property> + </widget> + </vbox> + </widget> + </widget> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kjsembed/docs/examples/xmlgui/xmlgui.js b/kjsembed/docs/examples/xmlgui/xmlgui.js new file mode 100755 index 00000000..ac0f7113 --- /dev/null +++ b/kjsembed/docs/examples/xmlgui/xmlgui.js @@ -0,0 +1,113 @@ +#!/usr/bin/env kjscmd + +// +// Setup main window +// +var mw = new KMainWindow(); + +var view = new QTextEdit( mw, 'view' ); +view.text = '<h1>Hello World</h1>' + + '<p>This application is written entirely in Javascript and works ' + + 'thanks to KJSEmbed</p>'; + +mw.setCentralWidget( view ); + +// +// Actions +// +var ac = mw.actionCollection(); + +// +// Create the quit action and connect it to a C++ slot +// +StdAction.quit( application, 'quit()', ac ); + +// +// We'll wire the file open action up to a JS function +// + +mw.openFile = function() { + var filename = StdDialog.getOpenFileName( '.', '*' ); + if ( filename.length > 0 ) { + view.text = System.readFile( filename ); + } +} + +var open_action = StdAction.open( null, '', ac ); +open_action.connect( open_action, 'activated()', mw, 'openFile' ); + +// +// We'll just accept the default for the rest of the actions +// + +StdAction.aboutApp( null, '', ac ); +StdAction.aboutKDE( null, '', ac ); +StdAction.actualSize( null, '', ac ); +StdAction.addBookmark( null, '', ac ); +StdAction.back( null, '', ac ); +StdAction.close( null, '', ac ); +StdAction.configureNotifications( null, '', ac ); +StdAction.configureToolbars( null, '', ac ); +StdAction.copy( null, '', ac ); +StdAction.cut( null, '', ac ); +StdAction.deselect( null, '', ac ); +StdAction.editBookmarks( null, '', ac ); +StdAction.fileNew( null, '', ac ); +StdAction.find( null, '', ac ); +StdAction.findNext( null, '', ac ); +StdAction.findPrev( null, '', ac ); +StdAction.fitToHeight( null, '', ac ); +StdAction.fitToPage( null, '', ac ); +StdAction.fitToWidth( null, '', ac ); +StdAction.forward( null, '', ac ); +StdAction.help( null, '', ac ); +StdAction.helpContents( null, '', ac ); +StdAction.home( null, '', ac ); +StdAction.keyBindings( null, '', ac ); +StdAction.mail( null, '', ac ); +StdAction.openRecent( null, '', ac ); +StdAction.paste( null, '', ac ); +StdAction.preferences( null, '', ac ); +StdAction.print( null, '', ac ); +StdAction.printPreview( null, '', ac ); +StdAction.redisplay( null, '', ac ); +StdAction.redo( null, '', ac ); +StdAction.replace( null, '', ac ); +StdAction.reportBug( null, '', ac ); +StdAction.revert( null, '', ac ); +StdAction.save( null, '', ac ); +StdAction.saveAs( null, '', ac ); +StdAction.saveOptions( null, '', ac ); +StdAction.selectAll( null, '', ac ); +StdAction.showMenubar( null, '', ac ); +StdAction.showStatusbar( null, '', ac ); +StdAction.showToolbar( null, '', ac ); +StdAction.spelling( null, '', ac ); +StdAction.tipofDay( null, '', ac ); +StdAction.undo( null, '', ac ); +StdAction.up( null, '', ac ); +StdAction.whatsThis( null, '', ac ); +StdAction.zoom( null, '', ac ); +StdAction.zoomIn( null, '', ac ); +StdAction.zoomOut( null, '', ac ); + +// +// There are two different Go menus define in XMLGUI, and we're using +// the browser oriented one, so we don't use these actions. +// + +//StdAction.firstPage( null, '', ac ); +//StdAction.goGoto( null, '', ac ); +//StdAction.gotoLine( null, '', ac ); +//StdAction.gotoPage( null, '', ac ); +//StdAction.lastPage( null, '', ac ); +//StdAction.next( null, '', ac ); +//StdAction.prior( null, '', ac ); + +// +// Activate XMLGUI and show the window +// +mw.createGUI( 'stdactionsui.rc' ); +mw.resize( 500, 350 ); +mw.show(); +application.exec(); diff --git a/kjsembed/docs/features.html b/kjsembed/docs/features.html new file mode 100644 index 00000000..676b4a51 --- /dev/null +++ b/kjsembed/docs/features.html @@ -0,0 +1,38 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed Features</title> +</head> +<body> +<h1>KJSEmbed Features</h1> +<hr> +<h2>Introduction</h2> + +This document is a high-level summary of the feature set of KJSEmbed. + +<h2>Qt Integration</h2> +<ul> +<li>Generic proxy class providing access to any QObject. +<li>Call slots from scripts as if they are JS methods. +<li>Connect signals to JS methods as if they are slots. +<li>Navigate the QObject tree using a DOM compatible API. +<li>Load designer's UI files to dynamically load dialogs and widgets. +<li>Create any QWidget supported by QWidgetFactory. +<li>Custom factory for creating QObjects (such as QTimer). +<li>An opaque wrapper handling any QVariant value and any pointer. +</ul> + +<h2>KDE Integration</h2> +<ul> +<li>Create KParts from scripts (including KHTMLPart). +<li>Create KAction classes. +<li>Support for KDE's XMLGUI framework. +<li>Create any KDE widget supported by the KDE designer plugin (and a few +extras). + +</ul> + + +<hr> +</body> +</html> diff --git a/kjsembed/docs/images/embedjs.png b/kjsembed/docs/images/embedjs.png Binary files differnew file mode 100644 index 00000000..eb18347a --- /dev/null +++ b/kjsembed/docs/images/embedjs.png diff --git a/kjsembed/docs/images/jscalc.png b/kjsembed/docs/images/jscalc.png Binary files differnew file mode 100644 index 00000000..097b3f7c --- /dev/null +++ b/kjsembed/docs/images/jscalc.png diff --git a/kjsembed/docs/index.html b/kjsembed/docs/index.html new file mode 100644 index 00000000..3c86c42d --- /dev/null +++ b/kjsembed/docs/index.html @@ -0,0 +1,98 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed Documentation</title> +</head> +<body> +<h1>KJSEmbed Documentation</h1> +<hr> + +<h3>Introduction</h3> + +The KJSEmbed library is an easy-to-use wrapper around the KDE +ECMAScript interpreter (kjs) that makes it easy to add scriptability +to an application. The kjsembed library is distributed in the +kdebindings module of KDE. This library provides a binding between +Qt/KDE applications and KJS. As well as working in its native KDE environment, +the library supports a Qt-only build that has no KDE dependencies. + +<h3>Discussion Forums</h3> + +There is now a KJSEmbed mailing list, see +<a href="http://mail.kde.org/mailman/listinfo/kjsembed">http://mail.kde.org/mailman/listinfo/kjsembed</a> +for more information about the list. In addition to the mailing list, +KJSEmbed is discussed on the #kaxul IRC channel (on the freenode IRC network). + +<h3>Learning KJSEmbed</h3> + +An introduction to KJSEmbed. The example scripts demonstrate the use +of all the major objects, and even provides some useful tools. The +tutorial provides a basic introduction to using KJSEmbed, though it is +a little out of date. + +<ul> + <li><b><a href="examples/index.html">Examples</a></b><br> + Example scripts showing how to use KJSEmbed.</li> + <li><b><a href="tutorial">Tutorial</a></b><br> + A tutorial for the library. NOTE: Some of the info here is out of date, see the + examples for cleaner ways to do things.</li> + <li><b><a href="changes.html">ChangeLog</a></b><br> + A log of the change history generated from CVS commit messages.</li> + <li><b><a href="TODO">TODO</a></b><br> + The todo list for KJSEmbed.</li> +</ul> + +<h3>Reference Information</h3> + +A reference manual for both the C++ and Javascript APIs defined by +KJSEmbed. The C++ API is of interest to developers looking to adding +scripting to support to their applications, the JS API is for people +who want to write scripts. + +<h4>JavaScript API</h4> +<ul> + <li><b><a href="types.html">Type Reference</a></b><br> + Documents the custom data types KJSEmbed uses to represent complex types. + <li><b><a href="jsref/index.html">Object Reference</a></b><br> + Documents the types of object scripts are allowed to create. +</ul> + +<h4>Host API</h4> +<ul> + <li><b><a href="classdocs/index.html">C++ API Reference</a> (C++)</b><br> + Reference manual for the C++ API of the KJSEmbed library.</li> + <li><b><a + href="http://webcvs.kde.org/kdebindings/kjsembed/kjscmd.cpp?view=markup">Example of embedding</a></b><br> + KJSCmd is a simple example of embedding the interpreter. +</ul> + +<h3>Appendices</h3> +<ul> + <li><b><a href="qtonly.html">Qt Only Mode</a></b><br> + How to build KJSEmbed with no KDE dependency.</li> + + <li><b><a href="conventions.html">Document Conventions</a></b><br> + Explains the typographical conventions used by the documents.</li> + + <li><b><a href="kjsembed-qsa.html">KJSEmbed and QSA</a></b><br> + Discusses the differences between KJSEmbed and QSA.</li> +</ul> + +<h3>References</h3> +<ul> + <li><b><a href="http://www.mozilla.org/js/language/">Mozilla Javascript Resources</a></b><br> + Mozilla's Javascript resources page, includes links to the various + releases of the ECMA-262 specification that define the language. + </li> + <li><b><a href="http://www.kevlindev.com/tutorials/javascript/inheritance/">Inheritance in Javascript</a></b><br> + A tutorial on how to implement inheritence in JavaScript. + </li> + <li><b><a href="http://doc.trolltech.com/qsa/">Qt Script for Applications Documentation</a></b><br> + The documentation for QSA, this is Trolltech's ECMAScript binding + for Qt. + </li> +</ul> + +<hr> +</body> +</html> diff --git a/kjsembed/docs/jsref/dummy.txt b/kjsembed/docs/jsref/dummy.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/kjsembed/docs/jsref/dummy.txt diff --git a/kjsembed/docs/kjsembed-qsa.html b/kjsembed/docs/kjsembed-qsa.html new file mode 100644 index 00000000..2de920d8 --- /dev/null +++ b/kjsembed/docs/kjsembed-qsa.html @@ -0,0 +1,43 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed and QSA</title> +</head> +<body> +<h1>KJSEmbed and QSA</h1> +<hr> + +<h3>Introduction</h3> + +There are a lot of similarities between QSA and KJSEmbed, and this has +led to some confusion. This document aims to shed some light on the +differences between the two libraries. + +<h3>The Differences</h3> + +<ul> + <li>QSA has a nice built in script editor which kjsembed does not, + but kjsembed can load designers ui files anyway and it would be easy + to add.</li> + + <li>KJSEmbed has facilities for working with KActions and can even + load them from XML files.</li> + + <li>KJSEmbed makes it easier to operate with Qt types than QSA. Take + a look at the <a href="types.html">types documentation</a> for more details.</li> + + <li>KJSEmbed has support for KDE specific types such as KURL. QSA + does not support these types by default, but does provide facilities + for adding support yourself.</li> + + <li>KJSEmbed can access the DOM from a KHTML part so it can work + nicely with HTML and XML documents. Note that this binding is only + available if the host application chooses to publish the DOM to the + interpreter.</li> + + <li>KJSEmbed is LGPL while QAS is GPL.</li> +</ul> + +<hr> +</body> +</html> diff --git a/kjsembed/docs/kjsembed.css b/kjsembed/docs/kjsembed.css new file mode 100644 index 00000000..34568f34 --- /dev/null +++ b/kjsembed/docs/kjsembed.css @@ -0,0 +1,47 @@ +h1 { text-align: center; background-color: #ccccff; } +h2 { background-color: #eeeeff; } +h3 { background-color: #eeeeff; } +h4 { background-color: #eeeeff; } + +A { text-decoration: none; font-weight: bold } + +table { width: 80%; } + +th { + background-color: #ccccff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} + +td { + background-color: #ddddff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} + +td.indexvalue { + background-color: #ddddff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} diff --git a/kjsembed/docs/qtonly.html b/kjsembed/docs/qtonly.html new file mode 100644 index 00000000..dbfd8ab6 --- /dev/null +++ b/kjsembed/docs/qtonly.html @@ -0,0 +1,21 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed Qt-Only Mode</title> +</head> +<body> +<h1>KJSEmbed Qt-Only Mode</h1> +<hr> +KJSEmbed supports a Qt-only mode that has no KDE dependency. You can build +it in this mode as follows: +<ul> +<li>Checkout kjsembed as normal +<li>cd into the kjsembed directory +<li>Set your CVSROOT to point to the KDE CVS repository +<li>Run ./setup_qtonly <i>(this will build both the qt-only library and +qjscmd, a KDE-free tool for running scripts)</i> +</ul> + +<hr> +</body> +</html> diff --git a/kjsembed/docs/tutorial/grepdlg.png b/kjsembed/docs/tutorial/grepdlg.png Binary files differnew file mode 100644 index 00000000..b61bc511 --- /dev/null +++ b/kjsembed/docs/tutorial/grepdlg.png diff --git a/kjsembed/docs/tutorial/kjsembed.html b/kjsembed/docs/tutorial/kjsembed.html new file mode 100644 index 00000000..a304c3de --- /dev/null +++ b/kjsembed/docs/tutorial/kjsembed.html @@ -0,0 +1,213 @@ +<html> +<head> +<style type="text/css"> +<!-- +h1 { + background-color: #ccccee; + text-align: center; +} +h3 { + background-color: #ccccee; +} +li { + padding: 4px; +} +pre { + background-color: #CCCCCC; + margin-right: 16px; + margin-left: 16px; + padding: 6px; +} +.imgcaption { + font-weight: bold; + text-align: center; +} +.precaption { + font-weight: bold; + text-align: center; +} +--> +</style> +</head> +<body> +<h1> KJSEmbed</h1> +<h3>Introduction</h3> +<p>KJSEmbed is a library for embedding the KJS Javascript (ECMAScript) interpreter + in KDE applications. It provides developers with an easy way to allow users + to extend application, and can even be used with applications that have not + been designed with this in mind thanks to a KParts plugin. In addition, KJSEmbed + provides a command line tool for running scripts so users can easily create + simple applications of their own in Javascript. KJSEmbed scripts are surprisingly + powerful because they access the properties and slots of QObjects, and can even + load widgets and dialogs created with Qt's graphical dialog editor.</p> +<h3>Features</h3> +<p>To give you an idea of what KJSEmbed provides, here is a brief summary of the + more interesting features:</p> +<ul> + <li>KParts plugin for extending existing KDE applications with scripts. </li> + <li>KPart for embedding Javascript in your own applications.</li> + <li>Console dialog that can be used to execute Javascript interactively.</li> + <li>Command line tool for running scripts (this can even operate without an + X server if you don't need to display a GUI).</li> + <li>Define new KActions using XML.</li> + <li>Scripts can connect signals to slots.</li> + <li>Scripts can access the properties and slots of QObjects as if they were + normal Javascript properties and methods.</li> + <li>Scripts can load dialogs and widgets created with Qt Designer.</li> + <li>Scripts can create instances of anu QWidget subclass supported by QWidgetFactory.</li> + <li>Making your own QObjects/QWidgets available for scripting is one-liner.</li> + <li>Scripts can traverse the widget tree, so your entire application can be + made scriptable without explicitly binding every object.</li> +</ul> +<h3>First Steps - The Console Dialog</h3> +<p>The quickest way to see what KJSEmbed can do is with kjscmd, a tool for running + scripts from the command line. To begin, we'll run kjscmd without any parameters + which brings up the KJSEmbed console dialog. The console provides an easy way + to run short (one line) scripts, as you can see in figure 1 the scripts have + full access to the core Javascript language, and to standard objects such as + Math. In addition to the standard Javascript operations, this screenshot also + demonstrates the global function print() provided by KJSEmbed.</p> +<pre> +-- Enter a JS expression and press enter -- +kjs> 10+20 +30 +kjs> print("Hello World!") +Hello World! +undefined +kjs> Math.sin(0) +0 +kjs> Math.cos(0) +1 +</pre> +<p class="imgcaption">Figure 1: The KJSEmbed Console Dialog</p> +<p>Things get more interesting when you realise that we also have access to the + widgets that make up the dialog, as you can in figure 2:</p> +<pre> +kjs> console +JSConsoleWidget (KJSEmbed::JSConsoleWidget) +kjs> console.childCount() +4 +kjs> console.child(1) +CmdEdit (QComboBox) +kjs> console.child(2) +RunButton (QPushButton) +kjs> console.child("RunButton") +RunButton (QPushButton) +kjs> console.child("RunButton").text = "Go!" +Go! +kjs> console.caption = "Different Title" +Different Title +kjs> console.child("Title").hide() +undefined +</pre> +<p class="imgcaption">Figure 2: Modifying the Console Dialog</p> +<p>As you can see, the console dialog has been made available to scripts as the + global variable 'console'. We can access the child widgets that make up the + dialog either by index using the childCount() and child() methods, or by name + using the child() method (you can also use getElementById() if you + want a DOM-style API. As well as being able to see the widgets, we can modify + them by setting properties - in this example, we modify the caption property + of the widget 'console' (changing the window title) and the text property of + the widget 'RunButton' (changing the label it displays). Again, + there is a DOM-like way to do this - the setAttribute() and + getAttribute() methods. For the sake of completeness, the final + command illustrates the other way of modifying widgets available to + us - it calls hide() slot of the widget 'Title' (what this does is + left as an exercise for the reader).</p> +<h3>Displaying A Grep Dialog</h3> +<p>Now that we've seen how to use kjscmd interactively, lets take a look at a + more complex example that displays a dialog for running grep. The complete script + is shown in listing 1 and as you'll see, is very simple. Loading and displaying + the dialog takes only two lines of code because KJSEmbed provides a built-in + Factory object that supports Designer files, most of the work is getting the + values out of the dialog and building the command line.</p> +<pre> +// Create and show the dialog +var dlg = Factory.loadui('grepdlg.ui'); +dlg.exec(); + +// Extract the parameters +var search = dlg.child('search_edit').text; +var files = dlg.child('files_edit').text; +var matchcase = dlg.child('case_check').checked; +var invert = dlg.child('invert_check').checked; + +// Build the command line +var options; +if ( matchcase ) { + options = '-i'; +} +if ( invert ) { + options += ' -v'; +} + +cmd = 'grep '+options+"'"+search+"' "+files; + +// Print the command line +print( cmd ); +</pre> +<p class="precaption">Listing 1: A Script That Displays the Grep Dialog</p> +<p>In order to find out what the user asked us to search for we need to extract + the contents of the various fields in our dialog. We know that the field for + entering the text to be searched for is a QLineEdit called 'search_edit', so + we can use the child() method to get hold of it (this method searches through + the children of an object until it finds one with a matching name). Once we've + found the right object getting hold of the text is easy because all QLineEdits + make their contents available as a property called 'text'. The code that gets + the value of the check boxes is almost identical, except that these are QCheckBoxes + so it's the 'checked' property we're interested in.</p> +<p align="center"><img src="grepdlg.png" alt="Grep Dialog Screenshot" width="327" height="241"></p> +<p class="imgcaption">Figure 3: The Grep Dialog</p> +<p>When this script is run you'll see a dialog like the one shown in figure 3.</p> +<h3>Extending Applications with Javascript Plugins</h3> +<p>As its name implies KJSEmbed is not just a tool for writing standalone Javascript + tools, it also provides facilities for extending existing applications, these + facilities being with a KParts plugin for running scripts. The next example + uses the plugin to add a simple HTML-to-text action to Kate, the standard KDE + editor. </p> +<pre> +function html2text( html ) +{ + var text = html.replace( /<[^>]*>/g, '' ); + text = text.replace( /&quot;/g, '"' ); + text = text.replace( /&lt;/g, '<' ); + text = text.replace( /&amp;/g, '&' ); + return text; +} + +function text2html( text ) +{ + var html = text.replace( /&/g,"&amp;"); + html = html.replace( /"/g,"&quot;"); + html = html.replace( /</g,"&lt;"); + return html; +} +</pre> +<p>The details...</p> +<pre><!DOCTYPE actionset><br><actionset><br><header><br> <name>html2text_actions</name><br> <label>HTML To Text Actions</label><br> <script type="js" src="html2text_plugin.js"></script><br></header><br><action><br> <name>html_to_text</name><br> <type>KAction</type><br> <icons>text</icons><br> <label><text>Convert HTML To Text</text></label><br> <statustext>Converts the selected text from HTML to text.</statustext><br> <script type="js">kpart.selectedText = html2text( kpart.selectedText )</script><br></action><br><action><br> <name>text_to_html</name><br> <type>KAction</type><br> <icons>html</icons><br> <label><text>Quote For HTML</text></label><br> <statustext>Quotes the selected text for inclusion in an HTML document.</statustext><br> <script type="js">kpart.selectedText = text2html( kpart.selectedText )</script><br></action><br></actionset><br></pre> +<p><br> + The xmlgui:</p> +<pre> +<!DOCTYPE kpartgui><br><kpartplugin name="html2text_plugin" library="libkjsembedplugin"><br><MenuBar><br> <Menu name="tools"><Text>&amp;Tools</Text><br> <Action name="html_to_text"/><br> <Action name="text_to_html"/><br> <Action name="jsconsole"/><br> </Menu><br></MenuBar><br></kpartplugin><br> </pre> +<h3>Missing</h3> +<ul> + <li>XMLActions</li> + <li>Plugin</li> + <li>MainWindow</li> +</ul> +<h3>References</h3> +<dl> + <dt><a href="http://www.mozilla.org/js/language/">http://www.mozilla.org/js/language/</a></dt> + <dd>Javascript (ECMAScript) language information.</dd> +</dl> +<h3>To Do</h3> +<ul> + <li>Replace figures 1 and 2 with images</li> + <li></li> +</ul> +<p> </p> +<p> </p> +<p> </p> +</body> +</html> + diff --git a/kjsembed/docs/tutorial/passwordfileviewdlg.ui b/kjsembed/docs/tutorial/passwordfileviewdlg.ui new file mode 100644 index 00000000..5ff8c59c --- /dev/null +++ b/kjsembed/docs/tutorial/passwordfileviewdlg.ui @@ -0,0 +1,205 @@ +<!DOCTYPE UI><UI> +<class>password_viewer</class> +<widget> + <class>QDialog</class> + <property stdset="1"> + <name>name</name> + <cstring>password_viewer</cstring> + </property> + <property> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>493</width> + <height>357</height> + </rect> + </property> + <property> + <name>caption</name> + <string>Password File Viewer</string> + </property> + <property> + <name>sizeGripEnabled</name> + <bool>true</bool> + </property> + <grid> + <property> + <name>margin</name> + <number>11</number> + </property> + <property> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="0" rowspan="1" colspan="2" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property> + <name>font</name> + <font> + <pointsize>12</pointsize> + <bold>1</bold> + </font> + </property> + <property> + <name>text</name> + <string>Password File Viewer</string> + </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="2" > + <class>Line</class> + <property stdset="1"> + <name>name</name> + <cstring>Line1</cstring> + </property> + <property> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + </widget> + <spacer row="3" column="0" > + <property> + <name>name</name> + <cstring>Spacer2</cstring> + </property> + <property> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget row="3" column="1" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>PushButton5</cstring> + </property> + <property> + <name>text</name> + <string>&Dismiss</string> + </property> + </widget> + <widget row="2" column="0" rowspan="1" colspan="2" > + <class>QListView</class> + <column> + <property> + <name>text</name> + <string>User Name</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Password</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>User Id</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Group Id</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Real Name</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Home Directory</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Shell</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <property stdset="1"> + <name>name</name> + <cstring>view</cstring> + </property> + </widget> + </grid> +</widget> +<connections> +</connections> +</UI> diff --git a/kjsembed/docs/types.html b/kjsembed/docs/types.html new file mode 100644 index 00000000..1b3f2120 --- /dev/null +++ b/kjsembed/docs/types.html @@ -0,0 +1,124 @@ +<html> +<head> +<link href="kjsembed.css" rel="stylesheet" type="text/css"> +<title>KJSEmbed Types</title> +</head> +<body> +<h1>KJSEmbed Types</h1> +<hr> +<h2>Introduction</h2> + +KJSEmbed adds a number of custom types to those defined by ECMA in +addition to the objects themselves. These types are used to pass +complex datatypes between scripts and the C++ code that is hosting the +script. This document describes the representations used to pass +information in each direction. + +<p> + +It should be noted that currently only a single representation is +available to scripts accessing native types. Scripts should not rely +on this behaviour as the restriction may be removed in a future +release of KJSEmbed so this, though the current script API will +continue to be supported. + +<h2>Fundamental Types</h2> + +<h3>Numbers</h3> +<ul> +<li>int -> Number +<li>uint -> Number +<li>float -> Number +<li>double -> Number +<li>Number -> int +<li>Number -> uint +<li>Number -> float +<li>Number -> double +</ul> + +<h3>Strings</h3> +<ul> +<li>QString -> String +<li>QCString -> String +<li>const char * -> String +<li>String -> QString +<li>String -> QCString +<li>String -> const char * +</ul> + +<h2>Qt Object Types</h2> + +<h3>QColor</h3> +Represents a color, possibly including an alpha channel. +<ul> +<li>QColor -> '#rrggbb' +<li>'#rrggbb' -> QColor +<li>'#rrggbbaa' -> QColor +</ul> + +<h3>QPoint</h3> +Represents a point. +<ul> +<li>QPoint -> [x,y] +<li>[x,y] -> QPoint +<li>obj.x obj.y -> QPoint +</ul> + +<h3>QSize</h3> +Represents a size. +<ul> +<li>QSize -> [w,h] +<li>[w,h] -> QSize +<li>obj.w obj.h -> QSize +</ul> + +<h3>QRect</h3> +Represents a rectangle. +<ul> +<li>QRect -> [x,y,w,h] +<li>[x,y,w,h] -> QRect +<li>obj.x obj.y obj.w obj.h -> QRect +</ul> + +<h3>QDate</h3> +Represents a date. +<ul> +<li>QDate -> '' +</ul> + +<h3>QTime</h3> +Represents a time. +<ul> +<li>QTime -> '' +</ul> + +<h3>QDateTime</h3> +Represents a date/time pair. +<ul> +<li>QDateTime -> '' +</ul> + +<h3>QKeySequence</h3> +Represents a sequence of keys, eg. it is used for accelerators. +<ul> +<li>QKeySequence -> '' +</ul> + +<h3>QFont</h3> +Represents a font. +<ul> +<li>QFont -> '' +</ul> + +<h2>KDE Object Types</h2> + +<h3>KURL</h3> +Represents a URL. +<ul> +<li>KURL -> '' +<li>'' -> KURL +</ul> + +<hr> +</body> +</html> diff --git a/kjsembed/docs/write_classes.js b/kjsembed/docs/write_classes.js new file mode 100644 index 00000000..ed47578c --- /dev/null +++ b/kjsembed/docs/write_classes.js @@ -0,0 +1,36 @@ + +text = ''; + + +text += '<html>\n'; + +text += '<head>\n'; +text += '<title>Constructors</title>\n'; +text += '<link href="../kjsembed.css" rel="stylesheet" type="text/css">\n'; +text += '</head>\n'; + +text += '<body>\n'; +text += '<h1>Constructors</h1>\n'; +text += '<hr>\n'; + +text += 'Object that scripts can create. This list includes objects\n'; +text += 'defined by QWidgetFactory as well as those with custom bindings.\n'; +text += '<ul>\n'; + + +var hrefroot = 'jsref/'; +var cons = constructors().sort(); +for ( var i = 0; i < cons.length; i++ ) { + text += '<li>'; + var href = cons[i].toLowerCase() + '.html'; + var name = cons[i]; + text += '<a href="' + hrefroot + href + '">' + name + '</a>\n'; +} +text += '</ul>\n'; +text += '<hr>\n'; +text += '</body>\n'; + +text += '</html>'; + +println( text ); + diff --git a/kjsembed/docs/write_docs.js b/kjsembed/docs/write_docs.js new file mode 100644 index 00000000..91e7c7a6 --- /dev/null +++ b/kjsembed/docs/write_docs.js @@ -0,0 +1,26 @@ + +var name = application.args[0]; +var src = application.args[1]; +var desc = application.args[2]; +var obj = eval(src); + +println( '<html>' ); + +println( '<head>' ); +println( '<title>' + name + '</title>' ); +println( '<link href="../kjsembed.css" rel="stylesheet" type="text/css">' ); +println( '</head>' ); + +println( '<body>' ); +println( '<h1>' + name + '</h1>' ); +println( '<hr>' ); + +println( desc ); +println( dump(obj) ); +println( '<hr>' ); +println( '</body>' ); + +println( '</html>' ); + +application.quit(); + |