mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +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)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
loadPlugin();
|
||||
}
|
||||
|
||||
void DatetimePlugin::loadPlugin()
|
||||
{
|
||||
if (m_pluginLoaded)
|
||||
return;
|
||||
|
||||
m_pluginLoaded = true;
|
||||
m_dateTipsLabel = new TipsWidget;
|
||||
m_refershTimer = new QTimer(this);
|
||||
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_refershTimer, &QTimer::timeout, this, &DatetimePlugin::updateCurrentTimeString);
|
||||
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
}
|
||||
|
||||
@ -225,10 +236,16 @@ void DatetimePlugin::updateCurrentTimeString()
|
||||
|
||||
void DatetimePlugin::refreshPluginItemsVisible()
|
||||
{
|
||||
if (!pluginIsDisable())
|
||||
if (!pluginIsDisable()) {
|
||||
|
||||
if (!m_pluginLoaded) {
|
||||
loadPlugin();
|
||||
return;
|
||||
}
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
else
|
||||
} else {
|
||||
m_proxyInter->itemRemoved(this, pluginName());
|
||||
}
|
||||
}
|
||||
|
||||
void DatetimePlugin::propertiesChanged()
|
||||
|
@ -66,15 +66,16 @@ private slots:
|
||||
void refreshPluginItemsVisible();
|
||||
void propertiesChanged();
|
||||
|
||||
private:
|
||||
void loadPlugin();
|
||||
|
||||
private:
|
||||
QPointer<DatetimeWidget> m_centralWidget;
|
||||
QPointer<TipsWidget> m_dateTipsLabel;
|
||||
|
||||
QTimer *m_refershTimer;
|
||||
|
||||
QString m_currentTimeString;
|
||||
|
||||
QDBusInterface *m_interface;
|
||||
bool m_pluginLoaded;
|
||||
};
|
||||
|
||||
#endif // DATETIMEPLUGIN_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user