Made a step in removing knowledge of DatabaseWindow from QueryTab as an effort to move
in the direction of a plugin system. DatabaseWindow now passes a Context to QueryTab and other pages that give those pages an API for passing information up the system without knowing anything about the sytem.
This commit is contained in:
parent
f6ea2ce0a6
commit
2a7e505dbf
13 changed files with 220 additions and 113 deletions
44
pglab/IPluginContentWidgetContext.h
Normal file
44
pglab/IPluginContentWidgetContext.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef IPLUGINCONTENTWIDGETCONTEXT_H
|
||||
#define IPLUGINCONTENTWIDGETCONTEXT_H
|
||||
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
#include "tsqueue.h"
|
||||
|
||||
class OpenDatabase;
|
||||
class PluginContentWidget;
|
||||
|
||||
/** This class serves to isolate the plugin from the actual construct in which it is
|
||||
* used.
|
||||
*
|
||||
* It provides functions for operating on the context without needing to many details.
|
||||
*/
|
||||
class IPluginContentWidgetContext {
|
||||
public:
|
||||
|
||||
virtual ~IPluginContentWidgetContext() = default;
|
||||
/** Tells the context what to use as a caption for this content widget.
|
||||
*
|
||||
* Depending on the context the caption might not be visible or used as the caption
|
||||
* of a window or tab.
|
||||
*/
|
||||
virtual void setCaption(PluginContentWidget *content, const QString &caption, const QString &hint = {}) = 0;
|
||||
/** Tells the context what icon to use.
|
||||
*
|
||||
* In general the icon is used in a similar place as the caption.
|
||||
* \param iconname Assumed to be the name of an iconresource. The system will look for different
|
||||
* sizes under :/icons/<size>/iconname
|
||||
*/
|
||||
virtual void setIcon(PluginContentWidget *content, const QString &iconname) = 0;
|
||||
|
||||
/** Returns an OpenDatabase object the widget can use to access
|
||||
* the database.
|
||||
*/
|
||||
virtual std::shared_ptr<OpenDatabase> getDatabase() = 0;
|
||||
|
||||
virtual void QueueTask(TSQueue::t_Callable c) = 0;
|
||||
|
||||
virtual void showStatusMessage(const QString &msg) = 0;
|
||||
};
|
||||
|
||||
#endif // IPLUGINCONTENTWIDGETCONTEXT_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue