Merge remote-tracking branch 'upstream/maintain/5.1' into uos

Change-Id: I9379a941c0ff0dc99e1868e85eb7208c13ad4a40
This commit is contained in:
chenjun 2020-08-03 19:14:26 +08:00
commit a68b828c7e
12 changed files with 37 additions and 34 deletions

View File

@ -189,6 +189,12 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
}
AppItem *item = new AppItem(path);
if (m_appIDist.contains(item->appId())) {
delete item;
return;
}
manageItem(item);
connect(item, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection);
@ -196,6 +202,7 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
connect(item, &AppItem::requestCancelPreview, m_appInter, &DBusDock::CancelPreviewWindow);
m_itemList.insert(insertIndex, item);
m_appIDist.append(item->appId());
if (index != -1) {
emit itemInserted(insertIndex - 1, item);
@ -219,6 +226,8 @@ void DockItemManager::appItemRemoved(const QString &appId)
appItemRemoved(app);
}
}
m_appIDist.removeAll(appId);
}
void DockItemManager::appItemRemoved(AppItem *appItem)

View File

@ -79,6 +79,7 @@ private:
static DockItemManager *INSTANCE;
QList<QPointer<DockItem>> m_itemList;
QList<QString> m_appIDist;
};
#endif // DOCKITEMMANAGER_H

View File

@ -224,7 +224,6 @@ void PreviewContainer::onSnapshotClicked(const WId wid)
Q_EMIT requestActivateWindow(wid);
m_needActivate = true;
m_waitForShowPreviewTimer->stop();
requestCancelPreviewWindow();
requestHidePopup();
}
@ -248,8 +247,6 @@ void PreviewContainer::previewEntered(const WId wid)
m_floatingPreview->trackWindow(snap);
requestCancelPreviewWindow();
if (m_waitForShowPreviewTimer->isActive()) {
return;
}

View File

@ -311,7 +311,6 @@ void MainPanelControl::updateAppAreaSonWidgetSize()
m_appAreaSonWidget->adjustSize();
moveAppSonWidget();
updateFixedAreaIcon();
}
void MainPanelControl::setPositonValue(Dock::Position position)
@ -567,7 +566,6 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
if (event->type() == QEvent::LayoutRequest) {
m_appAreaSonWidget->adjustSize();
resizeDockIcon();
updateFixedAreaIcon();
} else {
moveAppSonWidget();
}
@ -1118,22 +1116,6 @@ void MainPanelControl::resizeDesktopWidget()
m_desktopWidget->setFixedSize(0, 0);
}
void MainPanelControl::updateFixedAreaIcon()
{
QLayoutItem *appLayoutItem = m_appAreaSonLayout->itemAt(0);
if (appLayoutItem) {
QWidget *appWidget = appLayoutItem->widget();
if (appWidget) {
int w = appWidget->width();
int h = appWidget->height();
for (int i = 0; i < m_fixedAreaLayout->count(); ++ i) {
// 取最近较小偶数, 去抖
m_fixedAreaLayout->itemAt(i)->widget()->setFixedSize((w | 1) - 1, (h | 1) - 1);
}
}
}
}
/**
* @brief MainPanelControl::checkNeedShowDesktop
*

View File

@ -104,9 +104,8 @@ private:
void resizeDockIcon();
void calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, PluginsItem *shutdownPlugin, PluginsItem *keyboardPlugin, PluginsItem *notificationPlugin);
void resizeDesktopWidget();
void updateFixedAreaIcon();
bool checkNeedShowDesktop();
public slots:
void insertItem(const int index, DockItem *item);
void removeItem(DockItem *item);

View File

@ -59,8 +59,8 @@ void DatetimePlugin::init(PluginProxyInterface *proxyInter)
QSettings settings("deepin", "dde-dock-datetime");
if (QFile::exists(settings.fileName())) {
Dock::DisplayMode mode = displayMode();
const QString key = QString("pos_%1").arg(mode);
proxyInter->saveValue(this, key, settings.value(key, mode == Dock::DisplayMode::Fashion ? 5 : -1));
const QString key = QString("pos_%1_%2").arg(pluginName()).arg(mode);
proxyInter->saveValue(this, key, settings.value(key, mode == Dock::DisplayMode::Fashion ? 6 : -1));
QFile::remove(settings.fileName());
}
@ -110,15 +110,15 @@ int DatetimePlugin::itemSortKey(const QString &itemKey)
{
Q_UNUSED(itemKey);
const QString key = QString("pos_%1").arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 5).toInt();
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 6).toInt();
}
void DatetimePlugin::setSortKey(const QString &itemKey, const int order)
{
Q_UNUSED(itemKey);
const QString key = QString("pos_%1").arg(Dock::Efficient);
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -77,3 +77,17 @@ QWidget *KeyboardPlugin::itemTipsWidget(const QString &itemKey)
return nullptr;
}
int KeyboardPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 2).toInt();
}
void KeyboardPlugin::setSortKey(const QString &itemKey, const int order)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
m_proxyInter->saveValue(this, key, order);
}

View File

@ -40,6 +40,9 @@ public:
QWidget *itemWidget(const QString &itemKey) override;
QWidget *itemTipsWidget(const QString &itemKey) override;
int itemSortKey(const QString &itemKey) override;
void setSortKey(const QString &itemKey, const int order) override;
private:
DBusAdaptors *m_dbusAdaptors = nullptr;
};

View File

@ -216,7 +216,7 @@ void ShutdownPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
int ShutdownPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient);
return m_proxyInter->getValue(this, key, 6).toInt();
return m_proxyInter->getValue(this, key, 5).toInt();
}
void ShutdownPlugin::setSortKey(const QString &itemKey, const int order)

View File

@ -369,8 +369,7 @@ void SoundApplet::toggleMute()
void SoundApplet::onPlaySoundEffect()
{
// set the mute property to false to play sound effects.
m_defSinkInter->SetMuteQueued(false);
}
void SoundApplet::increaseVolumeChanged()

View File

@ -293,9 +293,6 @@ int AbstractContainer::whereToInsert(FashionTrayWidgetWrapper *wrapper)
return m_wrapperList.size();
}
if (wrapper->absTrayWidget()->trayTyep() == AbstractTrayWidget::TrayType::SystemTray)
destSortKey += m_wrapperList.size();
// 当目标插入位置为列表的大小时将从最后面追加到列表中
int destIndex = m_wrapperList.size();
for (int i = 0; i < m_wrapperList.size(); ++i) {

View File

@ -140,6 +140,7 @@ QWidget *SystemTrayItem::trayTipsWidget()
if (m_pluginInter->itemTipsWidget(m_itemKey)) {
m_pluginInter->itemTipsWidget(m_itemKey)->setAccessibleName(m_pluginInter->pluginName());
}
return m_pluginInter->itemTipsWidget(m_itemKey);
}
@ -148,6 +149,7 @@ QWidget *SystemTrayItem::trayPopupApplet()
if (m_pluginInter->itemPopupApplet(m_itemKey)) {
m_pluginInter->itemPopupApplet(m_itemKey)->setAccessibleName(m_pluginInter->pluginName());
}
return m_pluginInter->itemPopupApplet(m_itemKey);
}