10#include "RenderPlugin.h"
13#include "DialogConfigurationInterface.h"
14#include "MarbleDebug.h"
16#include "RenderPluginModel.h"
17#include "RenderState.h"
21#include <QStandardItem>
26class Q_DECL_HIDDEN RenderPlugin::Private
29 Private(
const MarbleModel *marbleModel)
30 : m_marbleModel(marbleModel)
34 , m_userCheckable(true)
41 const MarbleModel *
const m_marbleModel;
51RenderPlugin::RenderPlugin(
const MarbleModel *marbleModel)
52 : d(new Private(marbleModel))
54 connect(&d->m_action, SIGNAL(toggled(
bool)),
this, SLOT(setVisible(
bool)));
55 connect(
this, SIGNAL(visibilityChanged(
bool,
QString)), &d->m_action, SLOT(setChecked(
bool)));
56 connect(
this, SIGNAL(enabledChanged(
bool)), &d->m_action, SLOT(setVisible(
bool)));
57 connect(
this, SIGNAL(enabledChanged(
bool)), SIGNAL(actionGroupsChanged()));
59 connect(
this, SIGNAL(visibilityChanged(
bool,
QString)),
this, SIGNAL(repaintNeeded()));
60 connect(
this, SIGNAL(settingsChanged(
QString)),
this, SIGNAL(repaintNeeded()));
63RenderPlugin::~RenderPlugin()
70 return d->m_marbleModel;
76 d->m_action.setChecked(visible());
77 d->m_action.setIcon(icon());
78 d->m_action.setText(guiString());
79 d->m_action.setToolTip(description());
96 d->m_item.setText(name());
97 d->m_item.setEditable(
false);
98 d->m_item.setCheckable(
true);
100 d->m_item.setToolTip(description());
104 d->m_item.setData(nameId(), RenderPluginModel::NameId);
105 d->m_item.setData((
bool)qobject_cast<DialogConfigurationInterface *>(
this), RenderPluginModel::ConfigurationDialogAvailable);
106 d->m_item.setData(backendTypes(), RenderPluginModel::BackendTypes);
107 d->m_item.setData(version(), RenderPluginModel::Version);
108 d->m_item.setData(aboutDataText(), RenderPluginModel::AboutDataText);
109 d->m_item.setData(copyrightYears(), RenderPluginModel::CopyrightYears);
114void RenderPlugin::applyItemState()
119void RenderPlugin::retrieveItemState()
124void RenderPlugin::setEnabled(
bool enabled)
126 if (enabled == d->m_enabled)
129 d->m_enabled = enabled;
133 Q_EMIT enabledChanged(enabled);
136void RenderPlugin::setVisible(
bool visible)
138 if (visible == d->m_visible)
141 d->m_visible = visible;
143 Q_EMIT visibilityChanged(visible, nameId());
146void RenderPlugin::setUserCheckable(
bool checkable)
148 if (checkable != d->m_userCheckable) {
149 d->m_action.setEnabled(checkable);
150 d->m_userCheckable = checkable;
151 Q_EMIT userCheckableChanged(checkable);
155bool RenderPlugin::enabled()
const
160bool RenderPlugin::visible()
const
165bool RenderPlugin::isUserCheckable()
const
167 return d->m_userCheckable;
174 result.
insert(QStringLiteral(
"enabled"), enabled());
175 result.
insert(QStringLiteral(
"visible"), visible());
182 setEnabled(settings.
value(QStringLiteral(
"enabled"), enabled()).toBool());
183 setVisible(settings.
value(QStringLiteral(
"visible"), visible()).toBool());
188 return UnknownRenderType;
191RenderState RenderPlugin::renderState()
const
193 return RenderState(name());
196QString RenderPlugin::runtimeTrace()
const
206void RenderPlugin::restoreDefaultSettings()
213 return settings().keys();
220 settings[key] = value;
221 setSettings(settings);
235#include "moc_RenderPlugin.cpp"
This file contains the headers for MarbleModel.
The data model (not based on QAbstractModel) for a MarbleWidget.
RenderType
A Type of plugin.
Binds a QML item to a specific geodetic location in screen coordinates.
bool contains(const Key &key) const const
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
void setIcon(const QIcon &icon)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)