mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
feat(tray): hide layout when zh_CN locale
Change-Id: I96b8c93d902026e4b6e4249e51dd0b3aee2a06f3
This commit is contained in:
parent
13259cf3aa
commit
3486d0c108
Notes:
gerrit
2018-06-07 11:45:44 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: kirigayakazushin <lxz@ilxz.me> Submitted-by: kirigayakazushin <lxz@ilxz.me> Submitted-at: Thu, 07 Jun 2018 11:45:44 +0800 Reviewed-on: https://cr.deepin.io/35397 Project: dde/dde-dock Branch: refs/heads/master
@ -35,7 +35,14 @@ DBusAdaptors::~DBusAdaptors()
|
||||
|
||||
QString DBusAdaptors::layout() const
|
||||
{
|
||||
const auto layouts = m_keyboard->currentLayout().split(';');
|
||||
QStringList layouts = m_keyboard->currentLayout().split(';');
|
||||
layouts.removeAll(QString(""));
|
||||
|
||||
// Hide layout if user is chinese
|
||||
QLocale locale;
|
||||
if (locale.language() == QLocale::Chinese) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
if (!layouts.isEmpty())
|
||||
return layouts.first();
|
||||
|
@ -203,6 +203,14 @@ void IndicatorTrayWidget::setPixmapData(const QByteArray &data)
|
||||
rawPixmap.setDevicePixelRatio(devicePixelRatioF());
|
||||
d->label->setPixmap(rawPixmap);
|
||||
d->updateContent();
|
||||
|
||||
if (data.isEmpty()) {
|
||||
Q_EMIT removed();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Q_EMIT delayLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
void IndicatorTrayWidget::setPixmapPath(const QString &text)
|
||||
@ -210,6 +218,14 @@ void IndicatorTrayWidget::setPixmapPath(const QString &text)
|
||||
Q_D(IndicatorTrayWidget);
|
||||
d->label->setPixmap(QPixmap(text));
|
||||
d->updateContent();
|
||||
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT removed();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Q_EMIT delayLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
void IndicatorTrayWidget::setText(const QString &text)
|
||||
@ -217,6 +233,14 @@ void IndicatorTrayWidget::setText(const QString &text)
|
||||
Q_D(IndicatorTrayWidget);
|
||||
d->label->setText(text);
|
||||
d->updateContent();
|
||||
|
||||
if (text.isEmpty()) {
|
||||
Q_EMIT removed();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Q_EMIT delayLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
void IndicatorTrayWidget::iconPropertyChanged(const QDBusMessage &msg)
|
||||
@ -289,7 +313,5 @@ void IndicatorTrayWidgetPrivate::initDBus(const QString &indicatorKey)
|
||||
QDBusInterface interface(dbusService, dbusPath, dbusInterface, bus, q);
|
||||
interface.asyncCall(methodName);
|
||||
});
|
||||
|
||||
Q_EMIT q->delayLoaded();
|
||||
});
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ public Q_SLOTS:
|
||||
|
||||
Q_SIGNALS:
|
||||
void delayLoaded();
|
||||
void removed();
|
||||
void clicked(uint8_t, int, int);
|
||||
|
||||
private:
|
||||
|
@ -211,6 +211,8 @@ void SystemTrayPlugin::trayAdded(const QString itemKey)
|
||||
|
||||
auto addTrayWidget = [ = ](AbstractTrayWidget * trayWidget) {
|
||||
if (trayWidget) {
|
||||
if (m_trayList.values().contains(trayWidget)) return;
|
||||
|
||||
m_trayList.insert(itemKey, trayWidget);
|
||||
m_fashionItem->setMouseEnable(m_trayList.size() == 1);
|
||||
if (!m_fashionItem->activeTray()) {
|
||||
@ -239,6 +241,9 @@ void SystemTrayPlugin::trayAdded(const QString itemKey)
|
||||
trayWidget, [ = ]() {
|
||||
addTrayWidget(trayWidget);
|
||||
});
|
||||
connect(trayWidget, &IndicatorTrayWidget::removed, this, [=] {
|
||||
trayRemoved(m_trayList.key(trayWidget));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user