[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Public Types | Public Member Functions | Static Public Member Functions | List of all members
KLFLibWidgetFactory Class Referenceabstract

Create Associated Widgets to resources for Open/Create/Save actions. More...

#include <klflibview.h>

Inheritance diagram for KLFLibWidgetFactory:
Inheritance graph
[legend]
Collaboration diagram for KLFLibWidgetFactory:
Collaboration graph
[legend]

Public Types

typedef
KLFLibEngineFactory::Parameters 
Parameters
 

Public Member Functions

 KLFLibWidgetFactory (QObject *parent)
 
virtual QStringList supportedTypes () const =0
 List the supported widget types that this factory can create. More...
 
virtual QString widgetTypeTitle (const QString &wtype) const =0
 The human-readable label for this type of input. More...
 
virtual QWidgetcreatePromptUrlWidget (QWidget *wparent, const QString &wtype, QUrl defaultlocation=QUrl())=0
 
virtual QUrl retrieveUrlFromWidget (const QString &wtype, QWidget *widget)=0
 
virtual bool hasCreateWidget (const QString &wtype) const
 
virtual QWidgetcreatePromptCreateParametersWidget (QWidget *wparent, const QString &wtype, const Parameters &defaultparameters=Parameters())
 
virtual Parameters retrieveCreateParametersFromWidget (const QString &wtype, QWidget *widget)
 
virtual bool hasSaveToWidget (const QString &wtype) const
 
virtual QWidgetcreatePromptSaveToWidget (QWidget *wparent, const QString &wtype, KLFLibResourceEngine *resource, const QUrl &defaultUrl)
 
virtual QUrl retrieveSaveToUrlFromWidget (const QString &wtype, QWidget *widget)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent=0)
 
 blockSignals (bool block)
 
 childEvent (QChildEvent *event)
 
 children ()
 
 connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoCompatConnection)
 
 connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type=Qt::AutoCompatConnection)
 
 connectNotify (const char *signal)
 
 customEvent (QEvent *event)
 
 deleteLater ()
 
 destroyed (QObject *obj=0)
 
 disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
 disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0)
 
 disconnect (const QObject *receiver, const char *method=0)
 
 disconnectNotify (const char *signal)
 
 dumpObjectInfo ()
 
 dumpObjectTree ()
 
 dynamicPropertyNames ()
 
 event (QEvent *e)
 
 eventFilter (QObject *watched, QEvent *event)
 
 findChild (const QString &name=QString()
 
 findChildren (const QString &name=QString()
 
 findChildren (const QRegExp &regExp)
 
 inherits (const char *className)
 
 installEventFilter (QObject *filterObj)
 
 isWidgetType ()
 
 killTimer (int id)
 
 metaObject ()
 
 moveToThread (QThread *targetThread)
 
 parent ()
 
 property (const char *name)
 
 receivers (const char *signal)
 
 removeEventFilter (QObject *obj)
 
 sender ()
 
 setParent (QObject *parent)
 
 setProperty (const char *name, const QVariant &value)
 
 signalsBlocked ()
 
 startTimer (int interval)
 
 thread ()
 
 timerEvent (QTimerEvent *event)
 
 tr (const char *sourceText, const char *comment=0, int n=-1)
 
 trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
 staticMetaObject
 
 QObject (QObject *parent, const char *name)
 
 checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
 child (const char *objName, const char *inheritsClass=0, bool recursiveSearch=true)
 
 className ()
 
 insertChild (QObject *object)
 
 isA (const char *className)
 
 name ()
 
 name (const char *defaultName)
 
 normalizeSignalSlot (const char *signalSlot)
 
 removeChild (QObject *object)
 
 setName (const char *name)
 
- Public Member Functions inherited from KLFFactoryBase
 KLFFactoryBase (KLFFactoryManager *factoryManager)
 
virtual ~KLFFactoryBase ()
 

Static Public Member Functions

static KLFLibWidgetFactoryfindFactoryFor (const QString &wtype)
 
static QStringList allSupportedWTypes ()
 

Detailed Description

Create Associated Widgets to resources for Open/Create/Save actions.

Widget-types are associated User Interface widgets with the actions "Open Resource", "Create Resource" and "Save Resource To New Location". The typical example would be to show a file dialog to enter a file name for file-based resources (eg. Sqlite database).

Widget-types are not directly one-to-one mapped to url schemes, because for example multiple schemes can be accessed with the same open resource parameters (eg. a file name for both "klf+sqlite" and "klf+legacy"). Thus each scheme tells with Widget-Type it requires to associate with "open" or "create new" or "save to" actions (eg. wtype=="LocalFile" or similar logical name).

The widget type is given by the Engine Factory.

See also KLFLibBasicWidgetFactory and KLFLibEngineFactory.

Definition at line 339 of file klflibview.h.

Member Typedef Documentation

A generalized way of passing arbitrary parameters for creating new resources.

See KLFLibEngineFactory::createResource().

Some parameters have special meaning to the system; see retrieveCreateParametersFromWidget().

Definition at line 351 of file klflibview.h.

Constructor & Destructor Documentation

KLFLibWidgetFactory::KLFLibWidgetFactory ( QObject parent)

Simple constructor. Pass the parent object of this factory as parameter. This can be the application object qApp for example.

Definition at line 288 of file klflibview.cpp.

Member Function Documentation

QStringList KLFLibWidgetFactory::allSupportedWTypes ( )
static

Returns a concatenated list of all supported widget types all registered factories support.

Definition at line 300 of file klflibview.cpp.

References KLFFactoryManager::allSupportedTypes().

Referenced by KLFLibCreateResourceDlg::KLFLibCreateResourceDlg(), and KLFLibOpenResourceDlg::KLFLibOpenResourceDlg().

QWidget * KLFLibWidgetFactory::createPromptCreateParametersWidget ( QWidget wparent,
const QString wtype,
const Parameters defaultparameters = Parameters() 
)
virtual

create a widget that will prompt to user the different settings for the new resource that is about to be created. Do not reimplement this function if hasCreateWidget() returns false. Information to which URL to store the resource should be included in these parameters!

The created widget should be child of wparent.

Reimplemented in KLFLibBasicWidgetFactory.

Definition at line 311 of file klflibview.cpp.

Referenced by KLFLibCreateResourceDlg::KLFLibCreateResourceDlg(), and KLFLibExportDialog::KLFLibExportDialog().

QWidget * KLFLibWidgetFactory::createPromptSaveToWidget ( QWidget wparent,
const QString wtype,
KLFLibResourceEngine resource,
const QUrl defaultUrl 
)
virtual

Creates a widget to prompt the user to save the resource resource to a different location, by default defaultUrl.

The created widget should be child of wparent.

Definition at line 328 of file klflibview.cpp.

virtual QWidget* KLFLibWidgetFactory::createPromptUrlWidget ( QWidget wparent,
const QString wtype,
QUrl  defaultlocation = QUrl() 
)
pure virtual

Create a widget of logical type wtype (eg. "LocalFile", ...) that will prompt to user for various data needed to open some given kind of library resource. It could be a file selection widget, or a text entry for a hostname, etc. The widget should present data corresponding to defaultlocation as default location if that parameter is non-empty.

The widget should have a void readyToOpen(bool isReady) signal, that is emitted to synchronize the enabled state of the "open" button. The widget should also have a "readyToOpen" Qt property (static or dynamic, doesn't matter), that can be retrieved with QObject::property(), that contains the current status of if the widget is ready to open.

The create widget should be a child of wparent.

Implemented in KLFLibBasicWidgetFactory.

Referenced by KLFLibOpenResourceDlg::KLFLibOpenResourceDlg().

KLFLibWidgetFactory * KLFLibWidgetFactory::findFactoryFor ( const QString wtype)
static
bool KLFLibWidgetFactory::hasCreateWidget ( const QString wtype) const
virtual
Returns
whether this widget type (wtype) can create user-interface widgets to create new resources (eg. a new library sqlite file, etc.)

Reimplemented in KLFLibBasicWidgetFactory.

Definition at line 306 of file klflibview.cpp.

bool KLFLibWidgetFactory::hasSaveToWidget ( const QString wtype) const
virtual

Returns TRUE if this widget type (wtype) can create user-interface widgets to save an existing open resource as a new name (eg. to another (new) library sqlite file, etc.)

Definition at line 324 of file klflibview.cpp.

KLFLibWidgetFactory::Parameters KLFLibWidgetFactory::retrieveCreateParametersFromWidget ( const QString wtype,
QWidget widget 
)
virtual

Get the parameters edited by user, that are stored in widget GUI.

Some special parameters are recognized by the system:

  • param["klfScheme"]=url-scheme is MANDATORY: it tells the caller which kind of scheme the resource should be.
  • param["klfRetry"]=true will cause the dialog not to exit but re-prompt user to possibly change his input (could result from user clicking "No" in a "Overwrite?" dialog presented in a possible reimplementation of this function).
  • param["klfCancel"]=true will cause the "create resource" process to be cancelled.
  • Not directly recognized by the system, but a common standard: param["klfDefaultSubResource"] is the name of the default sub-resource to create if the resource supports sub-resources, and param["klfDefaultSubResourceTitle"] its title, if the resource supports sub-resource properties.

If an empty Parameters() is returned, it is also interpreted as a cancel operation.

Reimplemented in KLFLibBasicWidgetFactory.

Definition at line 318 of file klflibview.cpp.

Referenced by KLFLibCreateResourceDlg::getCreateParameters(), and KLFLibExportDialog::showExportDialogCreateResource().

QUrl KLFLibWidgetFactory::retrieveSaveToUrlFromWidget ( const QString wtype,
QWidget widget 
)
virtual

Returns the URL to "save to copy", from the data entered by user in the widget widget, which was previously returned by createPromptSaveToWidget().

Definition at line 335 of file klflibview.cpp.

virtual QUrl KLFLibWidgetFactory::retrieveUrlFromWidget ( const QString wtype,
QWidget widget 
)
pure virtual

Get the URL edited by user, that are stored in user-interface widgets in widget GUI. widget is never other than a QWidget returned by createPromptUrlWidget().

Implemented in KLFLibBasicWidgetFactory.

Referenced by KLFLibOpenResourceDlg::retrieveRawUrl().

virtual QStringList KLFLibWidgetFactory::supportedTypes ( ) const
pure virtual

List the supported widget types that this factory can create.

eg. "LocalFile", ...

Implements KLFFactoryBase.

Implemented in KLFLibBasicWidgetFactory.

virtual QString KLFLibWidgetFactory::widgetTypeTitle ( const QString wtype) const
pure virtual

The human-readable label for this type of input.

Returns a human-readable label that describes the kind of input the widget type wtype provides (eg. "Local File", "Remote Database Connection", etc.)

Implemented in KLFLibBasicWidgetFactory.

Referenced by KLFLibCreateResourceDlg::KLFLibCreateResourceDlg(), and KLFLibOpenResourceDlg::KLFLibOpenResourceDlg().


The documentation for this class was generated from the following files:

Generated by doxygen 1.8.5