mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
feat(datetime):first add plugin crash
This commit is contained in:
parent
bbfdee3a4d
commit
95a8af7688
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
DatetimePlugin::DatetimePlugin(QObject *parent)
|
DatetimePlugin::DatetimePlugin(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
, m_pluginLoaded(false)
|
||||||
{
|
{
|
||||||
m_interface = new QDBusInterface("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "com.deepin.daemon.Timedate");
|
m_interface = new QDBusInterface("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "com.deepin.daemon.Timedate");
|
||||||
|
|
||||||
@ -64,6 +65,15 @@ void DatetimePlugin::init(PluginProxyInterface *proxyInter)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatetimePlugin::loadPlugin()
|
||||||
|
{
|
||||||
|
if (m_pluginLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_pluginLoaded = true;
|
||||||
m_dateTipsLabel = new TipsWidget;
|
m_dateTipsLabel = new TipsWidget;
|
||||||
m_refershTimer = new QTimer(this);
|
m_refershTimer = new QTimer(this);
|
||||||
m_dateTipsLabel->setObjectName("datetime");
|
m_dateTipsLabel->setObjectName("datetime");
|
||||||
@ -87,6 +97,7 @@ void DatetimePlugin::init(PluginProxyInterface *proxyInter)
|
|||||||
connect(m_centralWidget, &DatetimeWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, pluginName()); });
|
connect(m_centralWidget, &DatetimeWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, pluginName()); });
|
||||||
|
|
||||||
connect(m_refershTimer, &QTimer::timeout, this, &DatetimePlugin::updateCurrentTimeString);
|
connect(m_refershTimer, &QTimer::timeout, this, &DatetimePlugin::updateCurrentTimeString);
|
||||||
|
|
||||||
m_proxyInter->itemAdded(this, pluginName());
|
m_proxyInter->itemAdded(this, pluginName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,10 +236,16 @@ void DatetimePlugin::updateCurrentTimeString()
|
|||||||
|
|
||||||
void DatetimePlugin::refreshPluginItemsVisible()
|
void DatetimePlugin::refreshPluginItemsVisible()
|
||||||
{
|
{
|
||||||
if (!pluginIsDisable())
|
if (!pluginIsDisable()) {
|
||||||
|
|
||||||
|
if (!m_pluginLoaded) {
|
||||||
|
loadPlugin();
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_proxyInter->itemAdded(this, pluginName());
|
m_proxyInter->itemAdded(this, pluginName());
|
||||||
else
|
} else {
|
||||||
m_proxyInter->itemRemoved(this, pluginName());
|
m_proxyInter->itemRemoved(this, pluginName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatetimePlugin::propertiesChanged()
|
void DatetimePlugin::propertiesChanged()
|
||||||
|
@ -66,15 +66,16 @@ private slots:
|
|||||||
void refreshPluginItemsVisible();
|
void refreshPluginItemsVisible();
|
||||||
void propertiesChanged();
|
void propertiesChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loadPlugin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<DatetimeWidget> m_centralWidget;
|
QPointer<DatetimeWidget> m_centralWidget;
|
||||||
QPointer<TipsWidget> m_dateTipsLabel;
|
QPointer<TipsWidget> m_dateTipsLabel;
|
||||||
|
|
||||||
QTimer *m_refershTimer;
|
QTimer *m_refershTimer;
|
||||||
|
|
||||||
QString m_currentTimeString;
|
QString m_currentTimeString;
|
||||||
|
|
||||||
QDBusInterface *m_interface;
|
QDBusInterface *m_interface;
|
||||||
|
bool m_pluginLoaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATETIMEPLUGIN_H
|
#endif // DATETIMEPLUGIN_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user