Create Associated Widgets to resources for Open/Create/Save actions. More...
#include <klflibview.h>
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 QWidget * | createPromptUrlWidget (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 QWidget * | createPromptCreateParametersWidget (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 QWidget * | createPromptSaveToWidget (QWidget *wparent, const QString &wtype, KLFLibResourceEngine *resource, const QUrl &defaultUrl) |
virtual QUrl | retrieveSaveToUrlFromWidget (const QString &wtype, QWidget *widget) |
![]() | |
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 ®Exp) | |
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) | |
![]() | |
KLFFactoryBase (KLFFactoryManager *factoryManager) | |
virtual | ~KLFFactoryBase () |
Static Public Member Functions | |
static KLFLibWidgetFactory * | findFactoryFor (const QString &wtype) |
static QStringList | allSupportedWTypes () |
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.
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.
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.
|
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().
|
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().
|
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.
|
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().
|
static |
Finds the factory in the list of registered factories that can handle the widget-type wtype
.
Definition at line 294 of file klflibview.cpp.
References KLFFactoryManager::findFactoryFor().
Referenced by KLFLibCreateResourceDlg::getCreateParameters(), KLFLibCreateResourceDlg::KLFLibCreateResourceDlg(), KLFLibExportDialog::KLFLibExportDialog(), KLFLibOpenResourceDlg::KLFLibOpenResourceDlg(), and KLFLibOpenResourceDlg::retrieveRawUrl().
|
virtual |
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.
|
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.
|
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.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().
|
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.
|
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().
|
pure virtual |
List the supported widget types that this factory can create.
eg. "LocalFile"
, ...
Implements KLFFactoryBase.
Implemented in KLFLibBasicWidgetFactory.
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().