Kexi/Junior Jobs/Map Browser Form Widget

From KDE Community Wiki
Revision as of 22:02, 17 February 2011 by Jstaniek (talk | contribs)

Map browser widget is a GUI element that displays globe and map for given location.

Definitions

  • Kexi Forms: one of Kexi core plugins, provided for handling form-based data entry and browsing. A form is consisted of widgets, possibly nested. The implementation of Kexi froms is independent of the Qt Designer forms but similar in many regards. The differences most visible to the user are:
    • definitions of kexi forms are stored in the kexi project, i.e. databaseeven if in the future, exporting to separate file could be provided);
    • kexi forms offer data-aware widgets, e.g. text boxes, that can be bound to database table or query fields.
  • Kexi form widgets and factories: building blocks of kexi forms, e.g. buttons, text boxes. Technically, kexi widgets can be instantiated through Kexi widget plugins, so called factories. Each widget is of a given class, named using identifier (unique within the whole kexi session). One widget factory can be capable of creating widget instances of one or more classes. Kexi has currently two built-in factories: standard factory and container factory (these would be finally merged into one since there is no point in separation). Built-in factory means that it is always available in the default kexi build and should be thus present in properly packaged kexi application.

The Goal

Deliver extra "Map Browser" widget compatible with Kexi Forms.

Requirements

  • Design and implement widget and provide it through separate factory using the kexi widget factory API
  • All the code should be stored in this tree in calligra/:
kexi/formeditor/factories/mapbrowser/CMakeLists.txt
kexi/formeditor/factories/mapbrowser/MapBrowserFactory.h
kexi/formeditor/factories/mapbrowser/MapBrowserFactory.cpp
kexi/formeditor/factories/mapbrowser/MapBrowserWidget.h
kexi/formeditor/factories/mapbrowser/MapBrowserWidget.cpp
  • To implement the widget derive from Marble::MarbleWidget class
  • Do not export the any class, just export the plugin using K_EXPORT_KEXI_FORM_WIDGET_FACTORY_PLUGIN(MapWidgetFactory, mapbrowser) in MapBrowserFactory.cpp
  • Class name of the widget should be KexiMapBrowser
  • User-visible name of the widget should be "Map Browser"
  • Name prefix of the widget should be "map"
  • User-visible description of the widget should be "Map browser"
  • class name of the factory should be MapBrowserFactory, and the name passed to the KFormDesigner::WidgetFactory constructor should be "mapbrowser"
  • provide translations (i18n()) for all user-visible property names in the factory constructor (see StdWidgetFactory for reference), e.g.
m_propDesc["longitude"] = i18n("Longitude");
    • hide properties "presistentTileCacheLimit", "volatileTileCacheLimit", "mapThemeId" (these are too technical)
  • the build should be allowed for mapbrowser/CMakeLists.txt inly if the marble library, try to copy appropriate FindMarble.cmake file to calligra/cmake/modules
  • Testing: proper implementation should after installing provide map browser widget within the widget palette of "Form Design" tab. Inserting the map browser widget should show it, changing properties through the property editor should work, switching to data view mode should display the browser properly and the browser's contents (map) should be available for zooming (using the wheel) and panning (using the mouse move). All these mouse actions should be disabled on the widget in design mode, so the user is able to drag and drop the widget within the form.

Extensions

  • Data binding: ideally, any data properties should be provided for read/write binding to the database source; however to do this, custom binding GUI in the form designer should be delivered; this is not yet supported by Kexi API
    • (Projection, longitude, latitude) tuple could be combined in a single data structure and supported natively in kexi as extra data type for easier binding

Hints

  • The directory of the forms framework is kexi/kformeditor/, standard factory is implemented in kexi/formeditor/
  • The widget factory API is provided by the KFormDesigner::WidgetFactory base class. Inherit it as StdWidgetFactory does.
  • The MarbeWidget is exposed in Qt Designer if you compile it or install appropriate 'devel' package. Trying the MarbleWidget in the Qt Designer can be useful to get accustomed with the features. Similarly, it is suggested to try the Marble application.

Notes of the Developer

(Please insert notes here)