From 6c9c162f11bb425718c715b9ec8b59030cf80b3b Mon Sep 17 00:00:00 2001 From: Fanpengcheng Date: Tue, 27 Oct 2020 13:48:58 +0800 Subject: [PATCH 01/38] Revert "fix: show slow" This reverts commit 710aba548904adf01ef0bdb4ad819f62e5761239. --- frame/window/mainwindow.cpp | 6 ------ frame/window/mainwindow.h | 1 - 2 files changed, 7 deletions(-) diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 032d1f95f..20d8cb47a 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -151,18 +151,12 @@ void MainWindow::callShow() qApp->setProperty("CANSHOW", true); launch(); - - m_callShowEventLoop.exec(); } void MainWindow::showEvent(QShowEvent *e) { QWidget::showEvent(e); - if (m_callShowEventLoop.isRunning()) { - m_callShowEventLoop.quit(); - } - // connect(qGuiApp, &QGuiApplication::primaryScreenChanged, // windowHandle(), [this](QScreen * new_screen) { // QScreen *old_screen = windowHandle()->screen(); diff --git a/frame/window/mainwindow.h b/frame/window/mainwindow.h index 0e30cb5a8..0496f1f8a 100644 --- a/frame/window/mainwindow.h +++ b/frame/window/mainwindow.h @@ -182,7 +182,6 @@ private: bool m_launched; QString m_registerKey; QStringList m_registerKeys; - QEventLoop m_callShowEventLoop; }; #endif // MAINWINDOW_H From dd3e6fa98d4932ba84243a48ea3ca869dda57683 Mon Sep 17 00:00:00 2001 From: xmuli Date: Wed, 21 Oct 2020 17:41:06 +0800 Subject: [PATCH 02/38] fix: Fix dde-dock incorrectly set to right angle Fix dde-dock set to right angle after every logout or reboot Log: --- frame/window/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 20d8cb47a..dbe913133 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -332,7 +332,7 @@ void MainWindow::adjustShadowMask() if (Dtk::Core::DSysInfo::isCommunityEdition()) { auto theme = DGuiApplicationHelper::instance()->systemTheme(); - radius = theme->windowRadius(); + radius = theme->windowRadius(radius); } int newRadius = composite && isFasion ? radius : 0; From 199d0a73458347732102bb759bca625c8a690e65 Mon Sep 17 00:00:00 2001 From: lxz Date: Wed, 28 Oct 2020 16:06:01 +0800 Subject: [PATCH 03/38] fix: cannot min/restore window dock get the focus Bug: https://pms.uniontech.com/zentao/bug-view-49686.html Log: Change-Id: I983fd173bd0c00584d4ba6d40d29d771f5ea5a85 --- frame/window/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index dbe913133..23f53bb1c 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -91,6 +91,9 @@ MainWindow::MainWindow(QWidget *parent) setAccessibleName("mainwindow"); m_mainPanel->setAccessibleName("mainpanel"); setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_X11DoNotAcceptFocus); + setWindowFlags(Qt::WindowDoesNotAcceptFocus); + setMouseTracking(true); setAcceptDrops(true); From 165fe9586c817bb31ca833841ad6e77104f09b6e Mon Sep 17 00:00:00 2001 From: xiaoyaobing Date: Sat, 24 Oct 2020 11:03:03 +0800 Subject: [PATCH 04/38] =?UTF-8?q?fix:=20=E6=89=93=E5=BC=80=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E7=AA=97=E5=8F=A3=E5=9C=A8=E6=A1=8C=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E4=BB=BB=E5=8A=A1=E6=A0=8F=E9=A2=84=E8=A7=88=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E7=82=B9=E5=87=BB=E7=AA=97=E5=8F=A3=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E7=AA=97=E5=8F=A3=E8=A2=AB=E5=85=B3?= =?UTF-8?q?=E9=97=AD=EF=BC=8C=E5=85=B6=E5=AE=83=E7=AA=97=E5=8F=A3=E8=A2=AB?= =?UTF-8?q?=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 中间预览窗口较特殊,点击关闭时中间预览和左侧首个预览,鼠标没有离开事件,修改为当点击中间和左侧首个预览窗口关闭按钮,发送关闭信号处理逻辑 Log: 修复任务栏打开多个窗口在桌面,在任务栏预览窗口点击窗口关闭按钮,窗口被关闭,其它窗口被隐藏 Bug: https://pms.uniontech.com/zentao/bug-view-48677.html Change-Id: Ief953f2501e75950374d7b617136641719186fa0 --- frame/item/components/appsnapshot.cpp | 2 ++ frame/item/components/appsnapshot.h | 1 + frame/item/components/previewcontainer.cpp | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/frame/item/components/appsnapshot.cpp b/frame/item/components/appsnapshot.cpp index f97a80dcc..e5d235df2 100644 --- a/frame/item/components/appsnapshot.cpp +++ b/frame/item/components/appsnapshot.cpp @@ -108,6 +108,8 @@ void AppSnapshot::closeWindow() const e.xclient.data.l[0] = XInternAtom(display, "WM_DELETE_WINDOW", false); e.xclient.data.l[1] = CurrentTime; + Q_EMIT requestCloseAppSnapshot(); + XSendEvent(display, m_wid, false, NoEventMask, &e); XFlush(display); } diff --git a/frame/item/components/appsnapshot.h b/frame/item/components/appsnapshot.h index 9943cb565..ee1de0da4 100644 --- a/frame/item/components/appsnapshot.h +++ b/frame/item/components/appsnapshot.h @@ -68,6 +68,7 @@ signals: void entered(const WId wid) const; void clicked(const WId wid) const; void requestCheckWindow() const; + void requestCloseAppSnapshot() const; public slots: void fetchSnapshot(); diff --git a/frame/item/components/previewcontainer.cpp b/frame/item/components/previewcontainer.cpp index e4d91dfb4..2cc081586 100644 --- a/frame/item/components/previewcontainer.cpp +++ b/frame/item/components/previewcontainer.cpp @@ -120,6 +120,7 @@ void PreviewContainer::checkMouseLeave() m_needActivate = false; emit requestActivateWindow(m_floatingPreview->trackedWid()); } else { + Q_EMIT requestHidePopup(); emit requestCancelPreviewWindow(); } } @@ -170,6 +171,15 @@ void PreviewContainer::appendSnapWidget(const WId wid) connect(snap, &AppSnapshot::clicked, this, &PreviewContainer::onSnapshotClicked, Qt::QueuedConnection); connect(snap, &AppSnapshot::entered, this, &PreviewContainer::previewEntered, Qt::QueuedConnection); connect(snap, &AppSnapshot::requestCheckWindow, this, &PreviewContainer::requestCheckWindows, Qt::QueuedConnection); + connect(snap, &AppSnapshot::requestCloseAppSnapshot, this, [this](){ + if (!m_wmHelper->hasComposite()) + return ; + + if (m_currentWId != m_snapshots.lastKey()) { + Q_EMIT requestHidePopup(); + Q_EMIT requestCancelPreviewWindow(); + } + }); m_windowListLayout->addWidget(snap); From 61e3f404cc9ae3a94ee4804aa240378085bf30ee Mon Sep 17 00:00:00 2001 From: lxz Date: Thu, 29 Oct 2020 10:30:08 +0800 Subject: [PATCH 05/38] fix: remove dbus service file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dock不需要提供该文件,因为dock作为桌面环境组件,由startdde进行控制。 Log: Change-Id: I14eb5086e042d61607c2298978a52c208096c8aa --- CMakeLists.txt | 4 ---- frame/com.deepin.dde.Dock.service | 3 --- 2 files changed, 7 deletions(-) delete mode 100644 frame/com.deepin.dde.Dock.service diff --git a/CMakeLists.txt b/CMakeLists.txt index b7138f46d..088188a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,9 +69,5 @@ install(FILES "dde-dock.pc" install(FILES "cmake/DdeDock/DdeDockConfig.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/DdeDock) -## services files -install(FILES frame/com.deepin.dde.Dock.service - DESTINATION /usr/share/dbus-1/services) - install(FILES gschema/com.deepin.dde.dock.module.gschema.xml DESTINATION share/glib-2.0/schemas) diff --git a/frame/com.deepin.dde.Dock.service b/frame/com.deepin.dde.Dock.service deleted file mode 100644 index 440fa07b7..000000000 --- a/frame/com.deepin.dde.Dock.service +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=com.deepin.dde.Dock -Exec=/usr/bin/dde-dock From 35df09ee53857ecf462dd36113303bedd380283c Mon Sep 17 00:00:00 2001 From: Fanpengcheng Date: Fri, 30 Oct 2020 14:37:40 +0800 Subject: [PATCH 06/38] =?UTF-8?q?fix:=20=E7=B4=A7=E6=80=A5=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=BB=E5=8A=A1=E6=A0=8F=E6=97=A0=E6=B3=95=E7=BD=AE?= =?UTF-8?q?=E9=A1=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 系qt和x的一些接口冲突,导致设置DOCK角色失败 Log: Change-Id: I28e0cd64a9717f60e6bf060cb369ea637386875d --- frame/util/multiscreenworker.cpp | 3 --- frame/window/mainwindow.cpp | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 9e599fcbe..85364056f 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -932,9 +932,6 @@ void MultiScreenWorker::initMembers() m_delayTimer->setInterval(2000); m_delayTimer->setSingleShot(true); - // 设置应用角色为任务栏 - XcbMisc::instance()->set_window_type(xcb_window_t(parent()->winId()), XcbMisc::Dock); - // init check checkDaemonDockService(); checkDaemonDisplayService(); diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 23f53bb1c..44b5417aa 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -92,7 +92,10 @@ MainWindow::MainWindow(QWidget *parent) m_mainPanel->setAccessibleName("mainpanel"); setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_X11DoNotAcceptFocus); + + // 确保下面两行代码的先后顺序,否则会导致任务栏界面不再置顶 setWindowFlags(Qt::WindowDoesNotAcceptFocus); + XcbMisc::instance()->set_window_type(xcb_window_t(this->winId()), XcbMisc::Dock); setMouseTracking(true); setAcceptDrops(true); From 52b13f8b19ec2b43309d12263981f81edc5b2e61 Mon Sep 17 00:00:00 2001 From: Xie Chuan Date: Thu, 29 Oct 2020 08:49:00 +0800 Subject: [PATCH 07/38] =?UTF-8?q?fix=20:=E5=A4=9A=E6=AC=A1=E5=90=91?= =?UTF-8?q?=E5=8F=B3=E6=97=8B=E8=BD=AC=E5=B1=8F=E5=B9=95=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A0=8F=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多次旋转屏幕后,声音信息发生改变,触发了对野指针的判断 Log: 修复多次向右旋转屏幕导致任务栏消失问题 Bug: https://pms.uniontech.com/zentao/bug-view-51625.html Change-Id: Ie2c7c43255412b86e63a16bc487d2edb2d09d153 --- plugins/sound/soundapplet.cpp | 2 +- plugins/sound/soundapplet.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index 76dc51928..130e49fa4 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -263,7 +263,7 @@ void SoundApplet::defaultSinkChanged() QString portId = m_defSinkInter->activePort().name; uint cardId = m_defSinkInter->card(); //最后一个设备会被移除,但是当在控制中心选中此设备后需要添加,并勾选 - if (m_lastPort && m_lastPort->cardId() == cardId && m_lastPort->id() == portId) { + if (!m_lastPort.isNull() && m_lastPort->cardId() == cardId && m_lastPort->id() == portId) { startAddPort(m_lastPort); } activePort(portId,cardId); diff --git a/plugins/sound/soundapplet.h b/plugins/sound/soundapplet.h index 8860e8c62..516efd521 100644 --- a/plugins/sound/soundapplet.h +++ b/plugins/sound/soundapplet.h @@ -153,7 +153,7 @@ private: QStandardItemModel *m_model; QList m_ports; QString m_deviceInfo; - Port *m_lastPort;//最后一个因为只有一个设备而被直接移除的设备 + QPointer m_lastPort;//最后一个因为只有一个设备而被直接移除的设备 }; #endif // SOUNDAPPLET_H From 306f3213073d5f2b2ddf681c80484c7a280edccf Mon Sep 17 00:00:00 2001 From: liuxing Date: Mon, 2 Nov 2020 12:12:26 +0800 Subject: [PATCH 08/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E5=BC=80=E6=9C=BA=E5=87=A0=E7=8E=87=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit startdde启动过快导致任务栏还没启动时callshow被调用,调用失败导致任务栏不显示。延迟RegisterDdeSession解决 Log: 解决任务栏开机几率无法显示问题 Bug: https://pms.uniontech.com/zentao/bug-view-52917.html Change-Id: I19fc19607160e66d294dbf63211fe3da84f7b890 --- frame/main.cpp | 25 ------------------------- frame/window/mainwindow.cpp | 28 ++++++++++++++++++++++++++++ interfaces/pluginsiteminterface.h | 2 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/frame/main.cpp b/frame/main.cpp index f86035e54..b244884f0 100644 --- a/frame/main.cpp +++ b/frame/main.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include @@ -60,27 +59,6 @@ const QString g_cfgPath = QStandardPaths::standardLocations(QStandardPaths::Conf using namespace std; -// let startdde know that we've already started. -void RegisterDdeSession() -{ - QString envName("DDE_SESSION_PROCESS_COOKIE_ID"); - - QByteArray cookie = qgetenv(envName.toUtf8().data()); - qunsetenv(envName.toUtf8().data()); - - if (!cookie.isEmpty()) { - QDBusPendingReply r = DDBusSender() - .interface("com.deepin.SessionManager") - .path("/com/deepin/SessionManager") - .service("com.deepin.SessionManager") - .method("Register") - .arg(QString(cookie)) - .call(); - - qDebug() << Q_FUNC_INFO << r.value(); - } -} - bool IsSaveMode() { QSettings settings(g_cfgPath, QSettings::IniFormat); @@ -250,9 +228,6 @@ int main(int argc, char *argv[]) return -1; } - qDebug() << "\n\ndde-dock startup"; - RegisterDdeSession(); - #ifndef QT_DEBUG QDir::setCurrent(QApplication::applicationDirPath()); #endif diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 44b5417aa..5475caf2a 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -75,6 +76,27 @@ const QPoint scaledPos(const QPoint &rawXPos) : rawXPos; } +// let startdde know that we've already started. +void RegisterDdeSession() +{ + QString envName("DDE_SESSION_PROCESS_COOKIE_ID"); + + QByteArray cookie = qgetenv(envName.toUtf8().data()); + qunsetenv(envName.toUtf8().data()); + + if (!cookie.isEmpty()) { + QDBusPendingReply r = DDBusSender() + .interface("com.deepin.SessionManager") + .path("/com/deepin/SessionManager") + .service("com.deepin.SessionManager") + .method("Register") + .arg(QString(cookie)) + .call(); + + qDebug() << Q_FUNC_INFO << r.value(); + } +} + MainWindow::MainWindow(QWidget *parent) : DBlurEffectWidget(parent) , m_mainPanel(new MainPanelControl(this)) @@ -157,6 +179,12 @@ void MainWindow::callShow() qApp->setProperty("CANSHOW", true); launch(); + + // 预留200ms提供给窗口初始化再通知startdde,不影响启动速度 + QTimer::singleShot(200, this, []{ + qDebug() << "\n\ndde-dock startup RegisterDdeSession"; + RegisterDdeSession(); + }); } void MainWindow::showEvent(QShowEvent *e) diff --git a/interfaces/pluginsiteminterface.h b/interfaces/pluginsiteminterface.h index 7f2a6092d..80ee6528f 100644 --- a/interfaces/pluginsiteminterface.h +++ b/interfaces/pluginsiteminterface.h @@ -234,7 +234,7 @@ protected: /// \brief m_proxyInter /// NEVER delete this object. /// - PluginProxyInterface *m_proxyInter; + PluginProxyInterface *m_proxyInter = nullptr; }; QT_BEGIN_NAMESPACE From 8f2df319c8f9b92e214d93e87d072ea5ef01c1c6 Mon Sep 17 00:00:00 2001 From: xuyanghe Date: Tue, 3 Nov 2020 14:17:32 +0800 Subject: [PATCH 09/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E9=9F=B3=E9=87=8F=E6=8B=96=E5=88=B0=E6=9C=80=E5=8F=B3=E8=BE=B9?= =?UTF-8?q?=E6=A6=82=E7=8E=87=E6=80=A7=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=98=AF?= =?UTF-8?q?100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refreshTips更新音量的时候也会调用DBus里的当前音量,这里直接修改为显示从后端volumeChanged信号传过来的音量值.优化一部分函数 Log: 任务栏音量拖到最右边概率性显示不是100% Bug: https://pms.uniontech.com/zentao/bug-view-52597.html Change-Id: I7267de814acd3e18e0df6526afadae1f34cbb47c --- plugins/sound/soundapplet.cpp | 4 +++- plugins/sound/sounditem.cpp | 26 +++++++++++--------------- plugins/sound/sounditem.h | 3 ++- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index 130e49fa4..9f0e21006 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -258,7 +258,9 @@ void SoundApplet::defaultSinkChanged() m_defSinkInter = new DBusSink("com.deepin.daemon.Audio", defSinkPath.path(), QDBusConnection::sessionBus(), this); connect(m_defSinkInter, &DBusSink::VolumeChanged, this, &SoundApplet::onVolumeChanged); - connect(m_defSinkInter, &DBusSink::MuteChanged, this, &SoundApplet::onVolumeChanged); + connect(m_defSinkInter, &DBusSink::MuteChanged, this, [ = ] { + onVolumeChanged(m_defSinkInter->volume()); + }); QString portId = m_defSinkInter->activePort().name; uint cardId = m_defSinkInter->card(); diff --git a/plugins/sound/sounditem.cpp b/plugins/sound/sounditem.cpp index e80f5c4e7..b3e2b7b27 100644 --- a/plugins/sound/sounditem.cpp +++ b/plugins/sound/sounditem.cpp @@ -56,7 +56,7 @@ SoundItem::SoundItem(QWidget *parent) m_applet->setVisible(false); connect(m_applet, static_cast(&SoundApplet::defaultSinkChanged), this, &SoundItem::sinkChanged); - connect(m_applet, &SoundApplet::volumeChanged, this, &SoundItem::refreshTips, Qt::QueuedConnection); + connect(m_applet, &SoundApplet::volumeChanged, this, &SoundItem::refresh, Qt::QueuedConnection); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [ = ] { refreshIcon(); @@ -65,7 +65,7 @@ SoundItem::SoundItem(QWidget *parent) QWidget *SoundItem::tipsWidget() { - refreshTips(true); + refreshTips(m_applet->volumeValue(), true); m_tipsLabel->resize(m_tipsLabel->sizeHint().width() + 10, m_tipsLabel->sizeHint().height()); @@ -163,6 +163,12 @@ void SoundItem::paintEvent(QPaintEvent *e) painter.drawPixmap(rf.center() - rfp.center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap); } +void SoundItem::refresh(const int volume) +{ + refreshIcon(); + refreshTips(volume, false); +} + void SoundItem::refreshIcon() { if (!m_sinkInter) @@ -211,31 +217,21 @@ void SoundItem::refreshIcon() update(); } -void SoundItem::refreshTips(const bool force) +void SoundItem::refreshTips(const int volume, const bool force) { if (!force && !m_tipsLabel->isVisible()) return; - if (!m_sinkInter) - return; - QString value; if (m_sinkInter->mute()) { m_tipsLabel->setText(QString(tr("Mute"))); } else { - if (m_sinkInter->volume() * 1000 < m_applet->volumeValue()) - value = QString::number(m_applet->volumeValue() / 10) + '%'; - else - value = QString::number(m_sinkInter->volume() * 100) + '%'; - m_tipsLabel->setText(QString(tr("Volume %1").arg(value))); + m_tipsLabel->setText(QString(tr("Volume %1").arg(QString::number(volume) + '%'))); } } void SoundItem::sinkChanged(DBusSink *sink) { m_sinkInter = sink; - - connect(m_sinkInter, &DBusSink::MuteChanged, this, &SoundItem::refreshIcon); - connect(m_sinkInter, &DBusSink::VolumeChanged, this, &SoundItem::refreshIcon); - refreshIcon(); + refresh(m_applet->volumeValue()); } diff --git a/plugins/sound/sounditem.h b/plugins/sound/sounditem.h index b50737672..c3105d192 100644 --- a/plugins/sound/sounditem.h +++ b/plugins/sound/sounditem.h @@ -49,6 +49,7 @@ public: void invokeMenuItem(const QString menuId, const bool checked); void refreshIcon(); + void refreshTips(const int volume, const bool force = false); signals: void requestContextMenu() const; @@ -59,8 +60,8 @@ protected: void paintEvent(QPaintEvent *e); private slots: - void refreshTips(const bool force = false); void sinkChanged(DBusSink *sink); + void refresh(const int volume); private: Dock::TipsWidget *m_tipsLabel; From 35807b284f9b6c0728cc11a751f0a1c46dd98755 Mon Sep 17 00:00:00 2001 From: xuyanghe Date: Wed, 28 Oct 2020 09:48:04 +0800 Subject: [PATCH 10/38] =?UTF-8?q?fix:=20=E8=B0=83=E8=8A=82=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A0=8F=E9=9F=B3=E9=87=8F=E4=B8=8E=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E8=BE=93=E5=87=BA=E9=9F=B3=E9=87=8F=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏向后端发送了音量变化,后端接受并返回一个改变完成的信号,控制中心接受到了信号,但是任务栏没有接收到信号.收到后端的音量变化信号后,不再通过DBus调用获取属性值,而是使用后端传过来的参数值 Log: 调节任务栏音量与控制中心输出音量不同步 Bug: https://pms.uniontech.com/zentao/bug-view-48689.html Change-Id: I79c6efdf712df8a2e32a496ead689c471afdba39 --- plugins/sound/soundapplet.cpp | 8 +++----- plugins/sound/soundapplet.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index 9f0e21006..f04d9efc6 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -207,7 +207,6 @@ void SoundApplet::initUi() connect(m_audioInter, &DBusAudio::PortEnabledChanged, [this](uint cardId, QString portId) { portEnableChange(cardId, portId); });; - connect(this, static_cast(&SoundApplet::defaultSinkChanged), this, &SoundApplet::onVolumeChanged); connect(m_listView, &DListView::clicked, this, [this](const QModelIndex & idx) { const Port * port = m_listView->model()->data(idx, Qt::WhatsThisPropertyRole).value(); if (port) { @@ -271,13 +270,12 @@ void SoundApplet::defaultSinkChanged() activePort(portId,cardId); emit defaultSinkChanged(m_defSinkInter); + onVolumeChanged(m_defSinkInter->volume()); } -void SoundApplet::onVolumeChanged() +void SoundApplet::onVolumeChanged(double volume) { - const float volume = m_defSinkInter->volume(); - - m_volumeSlider->setValue(std::min(150.0f, volume * 100.0f)); + m_volumeSlider->setValue(static_cast(std::min(150.0, volume * 100.0))); m_soundShow->setText(QString::number(volume * 100) + '%'); emit volumeChanged(m_volumeSlider->value()); diff --git a/plugins/sound/soundapplet.h b/plugins/sound/soundapplet.h index 516efd521..f6e159a9b 100644 --- a/plugins/sound/soundapplet.h +++ b/plugins/sound/soundapplet.h @@ -115,7 +115,7 @@ signals: private slots: void defaultSinkChanged(); - void onVolumeChanged(); + void onVolumeChanged(double volume); void volumeSliderValueChanged(); void sinkInputsChanged(); void toggleMute(); From db0c0039d4daaaa936693b109c271b599cabc8e3 Mon Sep 17 00:00:00 2001 From: chengbo Date: Thu, 29 Oct 2020 18:08:30 +0800 Subject: [PATCH 11/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4=E5=B7=A6=E8=BE=B9=EF=BC=8C?= =?UTF-8?q?=E6=91=A9=E7=81=AF=E7=AA=97=E5=8F=A3=E8=BF=98=E6=98=AF=E4=BB=8E?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除定时器,使用监听Dock的FrontendWindowRect change信号,重新更新IconGeometries Log: 魔灯效果下,窗口效果跟随任务栏位置 Bug: https://pms.uniontech.com/zentao/bug-view-44736.html Change-Id: I5e6caf7872dc37c34d8e5fb99676d7b35940dff3 --- frame/controller/dockitemmanager.cpp | 2 ++ frame/controller/dockitemmanager.h | 2 ++ frame/item/appitem.cpp | 2 ++ frame/item/appitem.h | 2 ++ frame/util/multiscreenworker.cpp | 1 + frame/util/multiscreenworker.h | 2 ++ frame/window/mainwindow.cpp | 2 ++ 7 files changed, 13 insertions(+) diff --git a/frame/controller/dockitemmanager.cpp b/frame/controller/dockitemmanager.cpp index 1fc483664..1ca1fea36 100644 --- a/frame/controller/dockitemmanager.cpp +++ b/frame/controller/dockitemmanager.cpp @@ -48,6 +48,8 @@ DockItemManager::DockItemManager(QObject *parent) connect(it, &AppItem::requestPreviewWindow, m_appInter, &DBusDock::PreviewWindow); connect(it, &AppItem::requestCancelPreview, m_appInter, &DBusDock::CancelPreviewWindow); + connect(this, &DockItemManager::requestUpdateDockItem, it, &AppItem::requestUpdateEntryGeometries); + m_itemList.append(it); } diff --git a/frame/controller/dockitemmanager.h b/frame/controller/dockitemmanager.h index e74c4fb16..d545b36ec 100644 --- a/frame/controller/dockitemmanager.h +++ b/frame/controller/dockitemmanager.h @@ -54,6 +54,8 @@ signals: void requestWindowAutoHide(const bool autoHide) const; void requestRefershWindowVisible() const; + void requestUpdateDockItem() const; + public slots: void refershItemsIcon(); void sortPluginItems(); diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index a05127613..0ea4e297b 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -116,6 +116,8 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries, Qt::QueuedConnection); connect(m_retryObtainIconTimer, &QTimer::timeout, this, &AppItem::refershIcon, Qt::QueuedConnection); + connect(this, &AppItem::requestUpdateEntryGeometries, this, &AppItem::updateWindowIconGeometries); + updateWindowInfos(m_itemEntryInter->windowInfos()); refershIcon(); diff --git a/frame/item/appitem.h b/frame/item/appitem.h index a414125e4..104c11211 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -63,6 +63,8 @@ signals: void requestCancelPreview() const; void dragReady(QWidget *dragWidget); + void requestUpdateEntryGeometries() const; + private: void moveEvent(QMoveEvent *e) override; void paintEvent(QPaintEvent *e) override; diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 85364056f..59353e086 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -722,6 +722,7 @@ void MultiScreenWorker::onRequestUpdateFrontendGeometry() #endif m_dockInter->SetFrontendWindowRect(int(rect.x()), int(rect.y()), uint(rect.width()), uint(rect.height())); + emit requestUpdateDockEntry(); } void MultiScreenWorker::onRequestNotifyWindowManager() diff --git a/frame/util/multiscreenworker.h b/frame/util/multiscreenworker.h index 008fef6bd..c89ab2f99 100644 --- a/frame/util/multiscreenworker.h +++ b/frame/util/multiscreenworker.h @@ -287,6 +287,8 @@ signals: void requestStopShowAni(); void requestStopHideAni(); + void requestUpdateDockEntry(); + public slots: void onAutoHideChanged(bool autoHide); /** diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 5475caf2a..996325508 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -327,6 +327,8 @@ void MainWindow::initConnections() connect(m_multiScreenWorker, &MultiScreenWorker::opacityChanged, this, &MainWindow::setMaskAlpha, Qt::QueuedConnection); connect(m_multiScreenWorker, &MultiScreenWorker::displayModeChanegd, this, &MainWindow::adjustShadowMask, Qt::QueuedConnection); + connect(m_multiScreenWorker, &MultiScreenWorker::requestUpdateDockEntry, DockItemManager::instance(), &DockItemManager::requestUpdateDockItem); + // 更新拖拽区域 connect(m_multiScreenWorker, &MultiScreenWorker::requestUpdateDragArea, this, &MainWindow::resetDragWindow); From 11de4a6b918444be04206e56cbf1ff1c1a9b6b80 Mon Sep 17 00:00:00 2001 From: Xie Chuan Date: Wed, 11 Nov 2020 11:12:28 +0800 Subject: [PATCH 12/38] =?UTF-8?q?fix:=20=E9=87=8D=E5=90=AF=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E6=A1=8C=E9=9D=A2=EF=BC=8C=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多任务视图插件设置成不加载后,但当特效模式发生改变后仍会加载插件,对未初始化的野指针进行了调用,导致崩溃,应在特效模式发生改变后添加插件是否禁用判断, Log: 修复重启进入桌面,任务栏消失问题 Bug: https://pms.uniontech.com/zentao/bug-view-53982.html Change-Id: Ib320654dcb8cd72e3043dbc35df21c61a2352792 --- plugins/multitasking/multitaskingplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/multitasking/multitaskingplugin.cpp b/plugins/multitasking/multitaskingplugin.cpp index 455314353..271e8a3dd 100644 --- a/plugins/multitasking/multitaskingplugin.cpp +++ b/plugins/multitasking/multitaskingplugin.cpp @@ -39,7 +39,7 @@ MultitaskingPlugin::MultitaskingPlugin(QObject *parent) m_tipsLabel->setObjectName("multitasking"); connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasCompositeChanged, this, [ = ] { - if (!m_proxyInter) + if (!m_proxyInter || !m_pluginLoaded) return; if (DWindowManagerHelper::instance()->hasComposite()) { From ae9ec31514887b3a94ac04f86c553c95002a101d Mon Sep 17 00:00:00 2001 From: Fanpengcheng Date: Fri, 13 Nov 2020 10:44:35 +0800 Subject: [PATCH 13/38] =?UTF-8?q?feat:=20=E9=81=BF=E5=85=8D=E5=8F=8D?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E7=BD=AE=E7=AA=97=E5=8F=A3=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免反复设置窗口工作位置,导致任务栏的日志一直在输出中 Log: Change-Id: I657a825a14fb9288d2dada2fb8c81006743123f7 --- frame/util/multiscreenworker.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 59353e086..1c9a54087 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -727,23 +727,33 @@ void MultiScreenWorker::onRequestUpdateFrontendGeometry() void MultiScreenWorker::onRequestNotifyWindowManager() { + static QRect lastRect = QRect(); + + const auto ratio = qApp->devicePixelRatio(); + const QRect rect = getDockShowGeometry(m_ds.current(), m_position, m_displayMode); + + // 已经设置过了,避免重复设置 + if (rect == lastRect) + return; + lastRect = rect; + // 先清除原先的窗管任务栏区域 XcbMisc::instance()->clear_strut_partial(xcb_window_t(parent()->winId())); // 在副屏时,且为一直显示时,不要挤占应用,这是sp3的新需求 if (m_ds.current() != m_ds.primary() && m_hideMode == HideMode::KeepShowing) { + lastRect = QRect(); qDebug() << "don`t set dock area"; return; } // 除了"一直显示"模式,其他的都不要设置任务栏区域 if (m_hideMode != Dock::KeepShowing) { + lastRect = QRect(); return; } - const auto ratio = qApp->devicePixelRatio(); - - const QRect rect = getDockShowGeometry(m_ds.current(), m_position, m_displayMode); + qDebug() <<"Update Window WorkArea:" << rect; const QPoint &p = rawXPosition(rect.topLeft()); From 47a1138808b55531ad016ff48d45434d9c42e935 Mon Sep 17 00:00:00 2001 From: Fanpengcheng Date: Sat, 14 Nov 2020 21:35:06 +0800 Subject: [PATCH 14/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=89?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E6=89=93=E5=BC=80=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=EF=BC=8C=E7=AA=97=E5=8F=A3=E6=94=B6=E5=9B=9E=E7=89=B9=E6=95=88?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用快捷键打开的应用,在窗口切换位置时,未通知窗管更新应用图标在任务栏的位置导致 Log: Bug: https://pms.uniontech.com/zentao/bug-view-44736.html Change-Id: Id7e5b8c99e43b4ca579f51637dd59d2a2f3da419 --- frame/controller/dockitemmanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/frame/controller/dockitemmanager.cpp b/frame/controller/dockitemmanager.cpp index 1ca1fea36..fa87e4c12 100644 --- a/frame/controller/dockitemmanager.cpp +++ b/frame/controller/dockitemmanager.cpp @@ -201,6 +201,7 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index) connect(item, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection); connect(item, &AppItem::requestPreviewWindow, m_appInter, &DBusDock::PreviewWindow); connect(item, &AppItem::requestCancelPreview, m_appInter, &DBusDock::CancelPreviewWindow); + connect(this, &DockItemManager::requestUpdateDockItem, item, &AppItem::requestUpdateEntryGeometries); m_itemList.insert(insertIndex, item); m_appIDist.append(item->appId()); From bae08557e89aa55615f1a31716fc6b74dd60b737 Mon Sep 17 00:00:00 2001 From: chenwei Date: Wed, 9 Dec 2020 15:43:45 +0800 Subject: [PATCH 15/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A6?= =?UTF-8?q?=E9=94=AE=E4=BB=BB=E5=8A=A1=E6=A0=8F=E4=B8=8A=E7=9A=84=E5=A3=B0?= =?UTF-8?q?=E9=9F=B3=E6=8F=92=E4=BB=B6tips=E4=B8=8D=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 字体大小改变,导致空间高度计算错误 Log: 修复左键任务栏上的声音插件tips不完整的bug Bug: https://pms.uniontech.com/zentao/bug-view-56909.html Change-Id: I89c62ecba61b40d833180e940c090101b6ace3f5 --- plugins/sound/soundapplet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index 6d1b27375..dd2bf3804 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -622,7 +622,8 @@ void SoundApplet::updateListHeight() //显示声音设备列表高度 = 设备的高度 + 间隔 + 边距 int viewHeight = visualHeight + m_listView->spacing() * count * 2 + listMargin; // 设备信息高度 = 设备标签 + 分隔线 + 滚动条 + 间隔 - int infoHeight = m_soundShow->height() + m_separator->height() + m_volumeSlider->height() + m_centralLayout->spacing() * 3 + DEVICE_SPACING; + int labelHeight = m_deviceLabel->height() > m_soundShow->height() ? m_deviceLabel->height() : m_soundShow->height(); + int infoHeight = labelHeight + m_separator->height() + m_volumeSlider->height() + m_centralLayout->spacing() * 3 + DEVICE_SPACING; int margain = m_centralLayout->contentsMargins().top() + m_centralLayout->contentsMargins().bottom(); //整个界面高度 = 显示声音设备列表高度 + 设备信息高度 + 边距 int totalHeight = viewHeight + infoHeight + margain; From 1294473e0f13e6dc773f56f950355ccda6b75c6a Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Fri, 11 Dec 2020 14:53:06 +0800 Subject: [PATCH 16/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=8C=BA=E5=9F=9F=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏会在特殊场景下(切换分辨率)收不到qt-dbus-factory的ScreenHeightChanged信号,导致任务栏的高度计算错误。 Log: 修复任务栏显示区域异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-57569.html Bug: https://pms.uniontech.com/zentao/bug-view-56391.html Bug: https://pms.uniontech.com/zentao/bug-view-56388.html Bug: https://pms.uniontech.com/zentao/bug-view-56010.html Change-Id: I3e7c0b7cbcdc1f60faf528084222ce0f2bc9d245 --- frame/util/multiscreenworker.cpp | 57 ++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 97315f8ad..ac163b663 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -183,19 +183,29 @@ void MultiScreenWorker::handleDbusSignal(QDBusMessage msg) return; // 返回的数据中,这一部分对应的是数据发送方的interfacename,可判断是否是自己需要的服务 QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName != "com.deepin.dde.daemon.Dock") - return; - QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); - QStringList keys = changedProps.keys(); - foreach (const QString &prop, keys) { - if (prop == "Position") { - onPositionChanged(); - } else if (prop == "DisplayMode") { - onDisplayModeChanged(); - } else if (prop == "HideMode") { - onHideModeChanged(); - } else if (prop == "HideState") { - onHideStateChanged(); + if (interfaceName == "com.deepin.dde.daemon.Dock") { + QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); + QStringList keys = changedProps.keys(); + foreach (const QString &prop, keys) { + if (prop == "Position") { + onPositionChanged(); + } else if (prop == "DisplayMode") { + onDisplayModeChanged(); + } else if (prop == "HideMode") { + onHideModeChanged(); + } else if (prop == "HideState") { + onHideStateChanged(); + } + } + } else if (interfaceName == "com.deepin.daemon.Display") { + QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); + QStringList keys = changedProps.keys(); + foreach (const QString &prop, keys) { + if (prop == "ScreenHeight") { + m_screenRawHeight = m_displayInter->screenHeight(); + } else if (prop == "ScreenWidth") { + m_screenRawWidth = m_displayInter->screenWidth(); + } } } } @@ -942,7 +952,7 @@ void MultiScreenWorker::onRequestDelayShowDock(const QString &screenName) void MultiScreenWorker::initMembers() { - m_monitorUpdateTimer->setInterval(10); + m_monitorUpdateTimer->setInterval(100); m_monitorUpdateTimer->setSingleShot(true); m_delayTimer->setInterval(2000); @@ -976,7 +986,14 @@ void MultiScreenWorker::initGSettingConfig() void MultiScreenWorker::initConnection() { - //FIX: 这里关联信号有时候收不到,未查明原因,handleDbusSignal处理 + /** FIXME + * 这里关联的信号有时候收不到是因为 qt-dbus-factory 中的 changed 的信号有时候会发不出来, + * qt-dbus-factory 中的 DBusExtendedAbstractInterface::internalPropGet 在同步调用情况下,会将缓存中的数据写入属性中, + * 导致后面 onPropertyChanged 中的判断认为属性值没变,就没有发出 changed 信号。 + * 建议:前端仅在初始化时主动获取一次 dbus 中的值存储在成员变量中,并建立 changed 信号连接,后面所有用到那个值的地方,均获取成员变量; + * 或去修改 qt-dbus-factory,取消 DBusExtendedAbstractInterface::internalPropGet 中将数据写入属性值, + * 但是 qt-dbus-factory 修改涉及面较广,需要大量测试确认没有问题,再合入。 + */ #if 0 // connect(m_dockInter, &DBusDock::PositionChanged, this, &MultiScreenWorker::onPositionChanged); // connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &MultiScreenWorker::onDisplayModeChanged); @@ -989,6 +1006,12 @@ void MultiScreenWorker::initConnection() "PropertiesChanged", "sa{sv}as", this, SLOT(handleDbusSignal(QDBusMessage))); + QDBusConnection::sessionBus().connect("com.deepin.daemon.Display", + "/com/deepin/daemon/Display", + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + "sa{sv}as", + this, SLOT(handleDbusSignal(QDBusMessage))); #endif connect(&m_mtrInfo, &MonitorInfo::monitorChanged, this, &MultiScreenWorker::requestUpdateMonitorInfo); @@ -1450,9 +1473,7 @@ void MultiScreenWorker::checkDaemonDockService() void MultiScreenWorker::checkDaemonDisplayService() { - auto connectionInit = [ = ](DisplayInter * displayInter) { - connect(displayInter, &DisplayInter::ScreenWidthChanged, this, [ = ](ushort value) {m_screenRawWidth = value;}); - connect(displayInter, &DisplayInter::ScreenHeightChanged, this, [ = ](ushort value) {m_screenRawHeight = value;}); + auto connectionInit = [ = ](DisplayInter *displayInter) { connect(displayInter, &DisplayInter::MonitorsChanged, this, &MultiScreenWorker::onMonitorListChanged); connect(displayInter, &DisplayInter::MonitorsChanged, this, &MultiScreenWorker::requestUpdateRegionMonitor); connect(displayInter, &DisplayInter::PrimaryRectChanged, this, &MultiScreenWorker::primaryScreenChanged, Qt::QueuedConnection); From b5d4942c821a91ece6fccec652d4b7176dcd7d21 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Tue, 8 Dec 2020 13:45:51 +0800 Subject: [PATCH 17/38] =?UTF-8?q?fix:=20=E5=88=86=E5=89=B2=E7=BA=BF?= =?UTF-8?q?=E4=B8=8D=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏位置由下变为左/右时,分割线不居中。 Log: 修复分割线不居中的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-57665.html Change-Id: Idde420334c51ff9e32871119fe2351210f301264 --- frame/panel/mainpanelcontrol.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 235c1bee4..adf2ba008 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -111,20 +111,18 @@ void MainPanelControl::initUi() m_mainPanelLayout->addWidget(m_fixedAreaWidget); m_fixedSpliter->setObjectName("spliter_fix"); - m_mainPanelLayout->addWidget(m_fixedSpliter, Qt::AlignCenter); + m_mainPanelLayout->addWidget(m_fixedSpliter); /* 应用程序区域 */ m_appAreaWidget->setAccessibleName("AppFullArea"); m_mainPanelLayout->addWidget(m_appAreaWidget); - m_appAreaSonLayout->setSpacing(0); - m_appAreaSonLayout->setContentsMargins(0, 0, 0, 0); m_appAreaSonWidget->setObjectName("apparea"); m_appAreaSonWidget->setLayout(m_appAreaSonLayout); m_appAreaSonLayout->setSpacing(0); m_appAreaSonLayout->setContentsMargins(0, 0, 0, 0); m_appSpliter->setObjectName("spliter_app"); - m_mainPanelLayout->addWidget(m_appSpliter, Qt::AlignCenter); + m_mainPanelLayout->addWidget(m_appSpliter); /* 托盘区域 */ m_trayAreaWidget->setObjectName("trayarea"); @@ -134,7 +132,7 @@ void MainPanelControl::initUi() m_mainPanelLayout->addWidget(m_trayAreaWidget); m_traySpliter->setObjectName("spliter_tray"); - m_mainPanelLayout->addWidget(m_traySpliter, Qt::AlignCenter); + m_mainPanelLayout->addWidget(m_traySpliter); /* 插件区域 */ m_pluginAreaWidget->setObjectName("pluginarea"); @@ -148,6 +146,9 @@ void MainPanelControl::initUi() m_mainPanelLayout->setSpacing(0); m_mainPanelLayout->setContentsMargins(0, 0, 0, 0); + m_mainPanelLayout->setAlignment(m_fixedSpliter, Qt::AlignCenter); + m_mainPanelLayout->setAlignment(m_appSpliter, Qt::AlignCenter); + m_mainPanelLayout->setAlignment(m_traySpliter, Qt::AlignCenter); connect(GSettingsByLaunch(), &QGSettings::changed, this, &MainPanelControl::onGSettingsChanged); } From 5d03f9153de33d38096f8d3a1043705f1175c7e1 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 17 Dec 2020 16:50:11 +0800 Subject: [PATCH 18/38] =?UTF-8?q?fix:=20=E8=93=9D=E7=89=99tips=E6=9C=AA?= =?UTF-8?q?=E5=8F=8A=E6=97=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当鼠标放在蓝牙图标上显示tips时,蓝牙状态变化后没有刷新tips Log: 修复蓝牙tips未及时更新的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58250.html Change-Id: I08a07f33d2312412734a09d1115ed211c62eace0 --- plugins/bluetooth/bluetoothitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index b8670b1de..07c1ab0c0 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -56,6 +56,7 @@ BluetoothItem::BluetoothItem(QWidget *parent) connect(m_applet, &BluetoothApplet::deviceStateChanged, [&](const Device::State state) { m_devState = state; refreshIcon(); + refreshTips(); }); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothItem::refreshIcon); connect(m_applet,&BluetoothApplet::noAdapter,this,&BluetoothItem::noAdapter); @@ -223,4 +224,3 @@ void BluetoothItem::paintEvent(QPaintEvent *event) const QRectF &rfp = QRectF(m_iconPixmap.rect()); painter.drawPixmap(rf.center() - rfp.center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap); } - From 5a0049ff62fe57ab313c0e9cabc387660e578a4f Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 17 Dec 2020 09:51:28 +0800 Subject: [PATCH 19/38] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设置固定大小改变了第三方插件本身的大小,导致显示不全。 Log: 修复插件区域图标显示异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-57018.html Change-Id: I64a3eb432dd5168db973ee2c158999ffa68a0f32 --- frame/panel/mainpanelcontrol.cpp | 35 ++++---------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index adf2ba008..1a06e0598 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -1041,15 +1041,6 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, m_tray->centralWidget()->setProperty("iconSize", tray_item_size); } - if (shutdownPlugin) - shutdownPlugin->setFixedSize(tray_item_size, tray_item_size); - if (keyboardPlugin) - keyboardPlugin->setFixedSize(tray_item_size, tray_item_size); - if (notificationPlugin) - notificationPlugin->setFixedSize(tray_item_size, tray_item_size); - if (trashPlugin) - trashPlugin->setFixedSize(tray_item_size, tray_item_size); - //因为日期时间大小和其他插件大小有异,为了设置边距,在各插件中增加了一层布局 //因此需要通过多一层布局来获取各插件 if ((m_position == Position::Top) || (m_position == Position::Bottom)) { @@ -1058,18 +1049,9 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, QLayout *layout = m_pluginLayout->itemAt(i)->layout(); if (layout) { PluginsItem *pItem = static_cast(layout->itemAt(0)->widget()); - if (pItem && pItem != trashPlugin && pItem != shutdownPlugin && pItem != keyboardPlugin && pItem !=notificationPlugin) { - // 根据大小策略控制插件大小 - switch (pItem->pluginSizePolicy()) { - case PluginsItemInterface::System: + if (pItem) { + if (pItem->sizeHint().width() == -1) { pItem->setFixedSize(tray_item_size, tray_item_size); - break; - case PluginsItemInterface::Custom: - pItem->setFixedSize(pItem->sizeHint().width(), h); - break; - default: - pItem->setFixedSize(tray_item_size, tray_item_size); - break; } } } @@ -1080,18 +1062,9 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, QLayout *layout = m_pluginLayout->itemAt(i)->layout(); if (layout) { PluginsItem *pItem = static_cast(layout->itemAt(0)->widget()); - if (pItem && pItem != trashPlugin && pItem != shutdownPlugin && pItem != keyboardPlugin && pItem !=notificationPlugin) { - // 根据大小策略控制插件大小 - switch (pItem->pluginSizePolicy()) { - case PluginsItemInterface::System: + if (pItem) { + if (pItem->sizeHint().width() == -1) { pItem->setFixedSize(tray_item_size, tray_item_size); - break; - case PluginsItemInterface::Custom: - pItem->setFixedSize(w, pItem->sizeHint().height()); - break; - default: - pItem->setFixedSize(tray_item_size, tray_item_size); - break; } } } From a9f403fbee7c5606143e90e299e775519b8b1dc3 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 17 Dec 2020 15:21:44 +0800 Subject: [PATCH 20/38] =?UTF-8?q?fix:=20=E6=97=B6=E9=97=B4=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E8=BF=94=E5=9B=9E=E5=A4=A7=E5=B0=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在切换任务栏位置时时间插件返回的大小有问题。 Log: 修复时间插件显示不完整的问题。 Change-Id: I84c3004728f725fc81e6c46ee1f6817c778fa589 --- plugins/datetime/datetimewidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index a3151664e..d194b57a7 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -135,7 +135,7 @@ QSize DatetimeWidget::curTimeSize() const dateSize.setWidth(QFontMetrics(m_dateFont).boundingRect("0000/00/00").size().width()); } } - return QSize(std::max(timeSize.width(), dateSize.width()) + 2, height()); + return QSize(std::max(timeSize.width(), dateSize.width()), timeSize.height() + dateSize.height()); } else { while (std::max(QFontMetrics(m_timeFont).boundingRect(timeString).size().width(), QFontMetrics(m_dateFont).boundingRect("0000/00/00").size().width()) > (width() - 4)) { m_timeFont.setPixelSize(m_timeFont.pixelSize() - 1); @@ -150,7 +150,7 @@ QSize DatetimeWidget::curTimeSize() const } } m_timeOffset = (timeSize.height() - dateSize.height()) / 2 ; - return QSize(width(), timeSize.height() + dateSize.height()); + return QSize(std::max(timeSize.width(), dateSize.width()), timeSize.height() + dateSize.height()); } } From b6da22b85e0961df8796cf602aa6ec53e526d04e Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 17 Dec 2020 17:09:26 +0800 Subject: [PATCH 21/38] =?UTF-8?q?fix:=20=E8=93=9D=E7=89=99=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=9C=AA=E5=8F=8A=E6=97=B6=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当开机时连接蓝牙设备,重启过程中关闭已连接的蓝牙设备,在特定机型上开机时,蓝牙的状态为 StateAvailable (这个状态的意思是识别的蓝牙设备可以连接,但未连接成功的状态, 可能出现的情况:蓝牙信号不好,意外断开连接或连接不上;蓝牙设备将配对信息删除,导致本机连不上蓝牙设备), 原来的代码中没有在 StateAvailable 状态更新图标(目的是因为当有多个蓝牙设备连接,其中一台因为上述原因断开连接时,不去更新蓝牙图标状态,只有在没有设备连接的情况下, 状态才会变为 StateUnavailable,更新图标为灰色)。如果不在一开始更新一下图标,就会导致开机时是 StateAvailable 状态,不刷新图标,显示默认的蓝色蓝牙图标。 故在初始化的时候先刷新一遍图标,如果后面状态有变化再触发更新蓝牙图标状态。 Log: 修复蓝牙图标未及时刷新的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58253.html Change-Id: I511e541b86b713fdc353793ff042d7abc5ec3414 --- plugins/bluetooth/bluetoothitem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index 07c1ab0c0..061905698 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -45,9 +45,12 @@ BluetoothItem::BluetoothItem(QWidget *parent) : QWidget(parent) , m_tipsLabel(new TipsWidget(this)) , m_applet(new BluetoothApplet(this)) + , m_devState(Device::State::StateUnavailable) + , m_adapterPowered(m_applet->poweredInitState()) { m_applet->setVisible(false); - m_adapterPowered = m_applet->poweredInitState(); + m_tipsLabel->setVisible(false); + refreshIcon(); connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) { m_adapterPowered = powered; From b01ed5c347fd383eb205e2f21818e567c08dc2bd Mon Sep 17 00:00:00 2001 From: chenwei Date: Fri, 18 Dec 2020 10:58:17 +0800 Subject: [PATCH 22/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A0=8F=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 字符长度改变,控件大小未更新 Log: 设置短时间为09:40,任务栏的时间显示不对 Bug: https://pms.uniontech.com/zentao/bug-view-57609.html Change-Id: I31da80c427f191285506f5bfcaf3fb359332b5e9 --- plugins/datetime/datetimewidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index d194b57a7..227e789f1 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -86,6 +86,10 @@ void DatetimeWidget::setShortDateFormat(int type) default: m_shortDateFormat = "yyyy-MM-dd"; break; } update(); + adjustSize(); + if (isVisible()) { + emit requestUpdateGeometry(); + } } /** @@ -100,6 +104,10 @@ void DatetimeWidget::setShortTimeFormat(int type) default: m_shortTimeFormat = "hh:mm"; break; } update(); + adjustSize(); + if (isVisible()) { + emit requestUpdateGeometry(); + } } QSize DatetimeWidget::curTimeSize() const From 3250451447866f8cf7a6e1477846d1c6805eb81d Mon Sep 17 00:00:00 2001 From: xmuli Date: Fri, 18 Dec 2020 14:07:27 +0800 Subject: [PATCH 23/38] fix: fix dde-dock windowRadius bug fix windowRadius about dde-dock Log: Bug: https://pms.uniontech.com/zentao/bug-view-58296.html Change-Id: I1565cd0209ca7a9c27a0d6b151ae43c407917540 --- frame/window/mainwindow.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 996325508..8c66dd3ec 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -254,7 +254,7 @@ void MainWindow::resizeEvent(QResizeEvent *event) // 任务栏大小、位置、模式改变都会触发resize,发射大小改变信号,供依赖项目更新位置 Q_EMIT panelGeometryChanged(); - adjustShadowMask(); + m_shadowMaskOptimizeTimer->start(); return DBlurEffectWidget::resizeEvent(event); } @@ -301,8 +301,9 @@ void MainWindow::initConnections() { connect(m_shadowMaskOptimizeTimer, &QTimer::timeout, this, &MainWindow::adjustShadowMask, Qt::QueuedConnection); - connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &MainWindow::compositeChanged, Qt::QueuedConnection); + connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, m_shadowMaskOptimizeTimer, static_cast(&QTimer::start)); connect(&m_platformWindowHandle, &DPlatformWindowHandle::frameMarginsChanged, m_shadowMaskOptimizeTimer, static_cast(&QTimer::start)); + connect(&m_platformWindowHandle, &DPlatformWindowHandle::windowRadiusChanged, m_shadowMaskOptimizeTimer, static_cast(&QTimer::start)); connect(m_dbusDaemonInterface, &QDBusConnectionInterface::serviceOwnerChanged, this, &MainWindow::onDbusNameOwnerChanged); @@ -378,10 +379,6 @@ void MainWindow::adjustShadowMask() clipPath.addRect(QRect(QPoint(0, 0), this->geometry().size())); m_platformWindowHandle.setClipPath(newRadius != 0 ? QPainterPath() : clipPath); - - // 临时解决方案: 在控制中心修改圆角之后, 会过几秒才会刷新显示 ??? - if (Dtk::Core::DSysInfo::isCommunityEdition()) - update(); } void MainWindow::onDbusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) From 1fe8ddfcaca33c91a6bf40485731540947a94751 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Tue, 22 Dec 2020 00:24:45 +0800 Subject: [PATCH 24/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E8=93=9D=E7=89=99=E6=8F=92=E4=BB=B6=E8=AE=BE=E5=A4=87=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=97=A0=E6=B3=95=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在刚开机时,蓝牙插件在获取适配器信息时,可能在将检测到的设备ID与已存在的设备列表比较时,将检测到的ID存入QMap,但是没有存入对象, 后面仅通过判断ID时,认为适配器已经加入QMap中,就不再加入设备对象,后面在判断对象是否为空的地方,都直接返回了,导致信号连接没有触发。 Log: 修复任务栏蓝牙插件设备列表无法刷新的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-57913.html Change-Id: If43ae449e378fde23649eba2fd4208a4d01b375d --- .../bluetooth/componments/adaptersmanager.cpp | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/bluetooth/componments/adaptersmanager.cpp b/plugins/bluetooth/componments/adaptersmanager.cpp index 2421d8e8f..6afbaa532 100644 --- a/plugins/bluetooth/componments/adaptersmanager.cpp +++ b/plugins/bluetooth/componments/adaptersmanager.cpp @@ -150,6 +150,10 @@ void AdaptersManager::onAdapterPropertiesChanged(const QString &json) const QString id = obj["Path"].toString(); QDBusObjectPath dPath(id); + if (!m_adapters.contains(id)) { + return; + } + Adapter *adapter = const_cast(m_adapters[id]); if (adapter) { inflateAdapter(adapter, obj); @@ -180,6 +184,10 @@ void AdaptersManager::removeAdapter(const QString &json) QJsonObject obj = doc.object(); const QString id = obj["Path"].toString(); + if (!m_adapters.contains(id)) { + return; + } + const Adapter *result = m_adapters[id]; Adapter *adapter = const_cast(result); if (adapter) { @@ -196,6 +204,10 @@ void AdaptersManager::addDevice(const QString &json) const QString adapterId = obj["AdapterPath"].toString(); const QString deviceId = obj["Path"].toString(); + if (!m_adapters.contains(adapterId)) { + return; + } + const Adapter *result = m_adapters[adapterId]; Adapter *adapter = const_cast(result); if (adapter) { @@ -214,6 +226,10 @@ void AdaptersManager::removeDevice(const QString &json) const QString adapterId = obj["AdapterPath"].toString(); const QString deviceId = obj["Path"].toString(); + if (!m_adapters.contains(adapterId)) { + return; + } + const Adapter *result = m_adapters[adapterId]; Adapter *adapter = const_cast(result); if (adapter) { @@ -247,11 +263,11 @@ void AdaptersManager::adapterAdd(Adapter *adapter, const QJsonObject &adpterObj) QString id = adapter->id(); if (!id.isEmpty()) { - // in case memory leaks - if (m_adapters.contains(id)) { - return; + if (!m_adapters.contains(id)) { + m_adapters[id] = adapter; + } else if (m_adapters[id] == nullptr) { + m_adapters[id] = adapter; } - m_adapters[id] = adapter; } } From a8c6a0bed0a04bb2759cbd83df6aaac1814eae03 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Mon, 21 Dec 2020 15:33:20 +0800 Subject: [PATCH 25/38] =?UTF-8?q?fix:=20=E8=93=9D=E7=89=99=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原来的qSort排序没生效,未在添加设备的同时更新设备的时间。 设备是按照发现的先后顺序添加至qlist中的,不改变原来list中的设备顺序,直接按照顺序添加至布局中即可将后发现的设备显示在最上面。 删除原来根据蓝牙设备信号变化排序列表的相关代码。 Log: 修复蓝牙列表排序问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58098.html Change-Id: I88adb0123731a080d81e7f17f574083470503338 --- plugins/bluetooth/componments/adapteritem.cpp | 29 ++++--------------- plugins/bluetooth/componments/adapteritem.h | 1 - plugins/bluetooth/componments/deviceitem.cpp | 5 ---- plugins/bluetooth/componments/deviceitem.h | 1 - 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/plugins/bluetooth/componments/adapteritem.cpp b/plugins/bluetooth/componments/adapteritem.cpp index 0afd571fb..ad4f11be3 100644 --- a/plugins/bluetooth/componments/adapteritem.cpp +++ b/plugins/bluetooth/componments/adapteritem.cpp @@ -157,20 +157,6 @@ void AdapterItem::deviceItemPaired(const bool paired) } } -void AdapterItem::deviceRssiChanged() -{ - auto device = qobject_cast(sender()); - if (device) { - DeviceItem *deviceItem = m_deviceItems.value(device->id()); - Device::State state = device->state(); - if (deviceItem && Device::StateConnected == state) - qSort(m_sortConnected); - else - qSort(m_sortUnConnect); - moveDeviceItem(state, deviceItem); - } -} - void AdapterItem::removeDeviceItem(const Device *device) { if (!device) @@ -213,7 +199,6 @@ void AdapterItem::deviceChangeState(const Device::State state) if (index < 0) { m_sortConnected.removeOne(deviceItem); m_sortUnConnect << deviceItem; - qSort(m_sortUnConnect); moveDeviceItem(state, deviceItem); } }; @@ -241,7 +226,6 @@ void AdapterItem::deviceChangeState(const Device::State state) if (index < 0) { m_sortUnConnect.removeOne(deviceItem); m_sortConnected << deviceItem; - qSort(m_sortConnected); moveDeviceItem(state, deviceItem); } } @@ -298,7 +282,6 @@ void AdapterItem::createDeviceItem(Device *device) connect(device, &Device::nameChanged, deviceItem, &DeviceItem::setTitle); connect(device, &Device::stateChanged, deviceItem, &DeviceItem::changeState); connect(device, &Device::stateChanged, this, &AdapterItem::deviceChangeState); - connect(device, &Device::rssiChanged, this, &AdapterItem::deviceRssiChanged); connect(deviceItem, &DeviceItem::clicked, m_adaptersManager, [this, deviceItem](Device *device) { m_adaptersManager->connectDevice(device, m_adapter); m_deviceLayout->removeWidget(deviceItem); @@ -317,13 +300,13 @@ void AdapterItem::updateView() void AdapterItem::showDevices(bool powered) { - if (m_sortConnected.size()) - qSort(m_sortConnected); - if (m_sortUnConnect.size()) - qSort(m_sortUnConnect); - QList deviceItems; - deviceItems << m_sortConnected << m_sortUnConnect; + for (DeviceItem *deviceItem : m_sortConnected) { + deviceItems.push_front(deviceItem); // 已连接设备倒序放进list里 + } + for (DeviceItem *deviceItem : m_sortUnConnect) { + deviceItems.push_front(deviceItem); // 未连接设备倒序放进list里 + } // 在蓝牙关闭的时候,会出现不在connected和Unconnect列表中的设备(连接/关闭中的状态),关闭的时候使用总表参数 qDebug() << m_sortConnected.size() << m_sortUnConnect.size() << m_deviceItems.size(); diff --git a/plugins/bluetooth/componments/adapteritem.h b/plugins/bluetooth/componments/adapteritem.h index 8564f0d4d..5b2f6ed1a 100644 --- a/plugins/bluetooth/componments/adapteritem.h +++ b/plugins/bluetooth/componments/adapteritem.h @@ -54,7 +54,6 @@ signals: private slots: void deviceItemPaired(const bool paired); - void deviceRssiChanged(); void removeDeviceItem(const Device *device); void showAndConnect(bool change); void addDeviceItem(const Device *constDevice); diff --git a/plugins/bluetooth/componments/deviceitem.cpp b/plugins/bluetooth/componments/deviceitem.cpp index 3523e7a33..9cce307e8 100644 --- a/plugins/bluetooth/componments/deviceitem.cpp +++ b/plugins/bluetooth/componments/deviceitem.cpp @@ -102,11 +102,6 @@ DeviceItem::DeviceItem(Device *d, QWidget *parent) changeState(m_device->state()); } -bool DeviceItem::operator <(const DeviceItem &item) -{ - return this->device()->deviceTime() < item.device()->deviceTime(); -} - void DeviceItem::setTitle(const QString &name) { m_title->setText(nameDecorated(name)); diff --git a/plugins/bluetooth/componments/deviceitem.h b/plugins/bluetooth/componments/deviceitem.h index 6aec96973..b1bdf1e42 100644 --- a/plugins/bluetooth/componments/deviceitem.h +++ b/plugins/bluetooth/componments/deviceitem.h @@ -44,7 +44,6 @@ class DeviceItem : public QWidget Q_OBJECT public: explicit DeviceItem(Device *d, QWidget *parent = nullptr); - bool operator <(const DeviceItem &item); void setTitle(const QString &name); inline QString title() { return m_title->text(); } From 4013fe035c133f28c40e09fe5edd2137df26dc9f Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Tue, 22 Dec 2020 21:43:14 +0800 Subject: [PATCH 26/38] =?UTF-8?q?fix:=20=E8=93=9D=E7=89=99=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用 push_front 应先将未连接设备从头插入,再将已连接设备从头插入,保证最终的列表中,已连接设备在最前面。 Log: 修复蓝牙列表排序问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58098.html Change-Id: I35219ea97181a8889cec91b1b2d0293511acbb6f --- plugins/bluetooth/componments/adapteritem.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/bluetooth/componments/adapteritem.cpp b/plugins/bluetooth/componments/adapteritem.cpp index ad4f11be3..e60a5dddb 100644 --- a/plugins/bluetooth/componments/adapteritem.cpp +++ b/plugins/bluetooth/componments/adapteritem.cpp @@ -301,12 +301,12 @@ void AdapterItem::updateView() void AdapterItem::showDevices(bool powered) { QList deviceItems; - for (DeviceItem *deviceItem : m_sortConnected) { - deviceItems.push_front(deviceItem); // 已连接设备倒序放进list里 - } for (DeviceItem *deviceItem : m_sortUnConnect) { deviceItems.push_front(deviceItem); // 未连接设备倒序放进list里 } + for (DeviceItem *deviceItem : m_sortConnected) { + deviceItems.push_front(deviceItem); // 已连接设备倒序放进list里 + } // 在蓝牙关闭的时候,会出现不在connected和Unconnect列表中的设备(连接/关闭中的状态),关闭的时候使用总表参数 qDebug() << m_sortConnected.size() << m_sortUnConnect.size() << m_deviceItems.size(); @@ -342,4 +342,3 @@ void AdapterItem::refresh() return; m_adaptersManager->adapterRefresh(m_adapter); } - From 8adb1f62c5d9377b3bd3722098edce67e73ad2c0 Mon Sep 17 00:00:00 2001 From: dongrui Date: Thu, 24 Dec 2020 15:22:35 +0800 Subject: [PATCH 27/38] =?UTF-8?q?fix:=20=E6=97=B6=E9=97=B4=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重启后,dde-dock进程已经起来,但是com.deepin.daemon.Timedate服务还没有起来,所以dock读取不到正确的值,按照0来设置的日期格式。 在datetime.json中加入"depends-daemon-dbus-service"字段控制插件的载入 Log: 解决时间日期格式与后端设置不匹配的问题 Bug: https://pms.uniontech.com/zentao/bug-view-58940.html Change-Id: I23f0afbb76aa6503ba2adcbb024842ead8bce004 --- plugins/datetime/datetime.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/datetime/datetime.json b/plugins/datetime/datetime.json index c08700b90..0404bcb19 100644 --- a/plugins/datetime/datetime.json +++ b/plugins/datetime/datetime.json @@ -1,3 +1,4 @@ { - "api": "1.2.3" + "api": "1.2.3", + "depends-daemon-dbus-service": "com.deepin.daemon.Timedate" } From 3b3c303bf996179f6ea13fb67a8899ff1b54a03d Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Mon, 28 Dec 2020 09:51:35 +0800 Subject: [PATCH 28/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=8F=82=E6=95=B0=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前用QTimer定时1秒钟后将插件的配置信息写入GSettings,但在配置比较差的机型上插件还没有加载完,导致往GSettings里写配置信息的时候漏了一两个插件。 改为当有插件被用户移动、移除或检测到新的插件时,直接调用更新GSettings中的插件配置信息。 Log: 修复自动化测试发现任务栏插件参数缺失的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-59243.html Change-Id: I4dc37ad7f611fabf479375f100506ef84f3f78d3 --- frame/controller/dockitemmanager.cpp | 25 +++++++++++-------------- frame/controller/dockitemmanager.h | 3 +-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/frame/controller/dockitemmanager.cpp b/frame/controller/dockitemmanager.cpp index fa87e4c12..7aa6a9aea 100644 --- a/frame/controller/dockitemmanager.cpp +++ b/frame/controller/dockitemmanager.cpp @@ -32,7 +32,6 @@ DockItemManager *DockItemManager::INSTANCE = nullptr; DockItemManager::DockItemManager(QObject *parent) : QObject(parent) - , m_updatePluginsOrderTimer(new QTimer(this)) , m_appInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this)) , m_pluginsInter(new DockPluginsController(this)) { @@ -55,11 +54,6 @@ DockItemManager::DockItemManager(QObject *parent) // 托盘区域和插件区域 由DockPluginsController获取 - // 更新插件顺序 - m_updatePluginsOrderTimer->setSingleShot(true); - m_updatePluginsOrderTimer->setInterval(1000); - connect(m_updatePluginsOrderTimer, &QTimer::timeout, this, &DockItemManager::updatePluginsItemOrderKey); - // 应用信号 connect(m_appInter, &DBusDock::EntryAdded, this, &DockItemManager::appItemAdded); connect(m_appInter, &DBusDock::EntryRemoved, this, static_cast(&DockItemManager::appItemRemoved), Qt::QueuedConnection); @@ -73,9 +67,6 @@ DockItemManager::DockItemManager(QObject *parent) // 刷新图标 QMetaObject::invokeMethod(this, "refershItemsIcon", Qt::QueuedConnection); - - // 启动的时候把插件名写入配置(自动化测试需要) - m_updatePluginsOrderTimer->start(); } DockItemManager *DockItemManager::instance(QObject *parent) @@ -116,10 +107,12 @@ void DockItemManager::refershItemsIcon() } } +/** + * @brief 将插件的参数(Order, Visible, etc)写入gsettings + * 自动化测试需要通过dbus(GetPluginSettings)获取这些参数 + */ void DockItemManager::updatePluginsItemOrderKey() { - Q_ASSERT(sender() == m_updatePluginsOrderTimer); - int index = 0; for (auto item : m_itemList) { if (item.isNull() || item->itemType() != DockItem::Plugins) @@ -161,9 +154,10 @@ void DockItemManager::itemMoved(DockItem *const sourceItem, DockItem *const targ // update plugins sort key if order changed if (moveType == DockItem::Plugins || replaceType == DockItem::Plugins - || moveType == DockItem::TrayPlugin || replaceType == DockItem::TrayPlugin - || moveType == DockItem::FixedPlugin || replaceType == DockItem::FixedPlugin) - m_updatePluginsOrderTimer->start(); + || moveType == DockItem::TrayPlugin || replaceType == DockItem::TrayPlugin + || moveType == DockItem::FixedPlugin || replaceType == DockItem::FixedPlugin) { + updatePluginsItemOrderKey(); + } // for app move, index 0 is launcher item, need to pass it. if (moveType == DockItem::App && replaceType == DockItem::App) @@ -297,6 +291,7 @@ void DockItemManager::pluginItemInserted(PluginsItem *item) insertIndex ++; } + updatePluginsItemOrderKey(); emit itemInserted(insertIndex - firstPluginPosition, item); } @@ -307,6 +302,8 @@ void DockItemManager::pluginItemRemoved(PluginsItem *item) emit itemRemoved(item); m_itemList.removeOne(item); + + updatePluginsItemOrderKey(); } void DockItemManager::reloadAppItems() diff --git a/frame/controller/dockitemmanager.h b/frame/controller/dockitemmanager.h index d545b36ec..b074c9263 100644 --- a/frame/controller/dockitemmanager.h +++ b/frame/controller/dockitemmanager.h @@ -59,7 +59,6 @@ signals: public slots: void refershItemsIcon(); void sortPluginItems(); - void updatePluginsItemOrderKey(); void itemMoved(DockItem *const sourceItem, DockItem *const targetItem); void itemAdded(const QString &appDesktop, int idx); @@ -70,11 +69,11 @@ private: void appItemRemoved(AppItem *appItem); void pluginItemInserted(PluginsItem *item); void pluginItemRemoved(PluginsItem *item); + void updatePluginsItemOrderKey(); void reloadAppItems(); void manageItem(DockItem *item); private: - QTimer *m_updatePluginsOrderTimer; DBusDock *m_appInter; DockPluginsController *m_pluginsInter; From 6929caf73ab4b392ca33fcabb2bcd6115513afc6 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Tue, 29 Dec 2020 10:06:10 +0800 Subject: [PATCH 29/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=BD=8D=E7=BD=AE=E5=90=8E=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E7=89=B9=E6=95=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本意为:在任务栏属性改变需要调整圆角时,用一个QTimer统一处理,避免重复调用, 但是由于我们这边做了一次裁剪区域,窗管根据我们设置的圆角半径也会裁剪一次,导致最后模糊特效出现异常。 故这里去掉设置裁剪区域,并整理了一下代码结构。 Log: 修复任务栏切换位置模糊特效异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-59099.html Change-Id: Idead1337e5dae432912fe7eb087d9012746247a1 --- frame/window/mainwindow.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 8c66dd3ec..4e8c88f1d 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -355,30 +355,20 @@ void MainWindow::getTrayVisableItemCount() void MainWindow::adjustShadowMask() { - if (!m_launched) + if (!m_launched || m_shadowMaskOptimizeTimer->isActive()) return; - if (m_shadowMaskOptimizeTimer->isActive()) - return; - - const bool composite = m_wmHelper->hasComposite(); - const bool isFasion = m_multiScreenWorker->displayMode() == Fashion; - DStyleHelper dstyle(style()); - int radius = dstyle.pixelMetric(DStyle::PM_TopLevelWindowRadius); - - if (Dtk::Core::DSysInfo::isCommunityEdition()) { - auto theme = DGuiApplicationHelper::instance()->systemTheme(); - radius = theme->windowRadius(radius); + int radius = 0; + if (m_wmHelper->hasComposite() && m_multiScreenWorker->displayMode() == DisplayMode::Fashion) { + if (Dtk::Core::DSysInfo::isCommunityEdition()) { // 社区版圆角与专业版不同 + DPlatformTheme *theme = DGuiApplicationHelper::instance()->systemTheme(); + radius = theme->windowRadius(radius); + } else { + radius = dstyle.pixelMetric(DStyle::PM_TopLevelWindowRadius); + } } - - int newRadius = composite && isFasion ? radius : 0; - m_platformWindowHandle.setWindowRadius(newRadius); - - QPainterPath clipPath; - clipPath.addRect(QRect(QPoint(0, 0), this->geometry().size())); - - m_platformWindowHandle.setClipPath(newRadius != 0 ? QPainterPath() : clipPath); + m_platformWindowHandle.setWindowRadius(radius); } void MainWindow::onDbusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) From 8d38378f540e542e16f86426af05f8f86c4a6174 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 31 Dec 2020 17:59:18 +0800 Subject: [PATCH 30/38] =?UTF-8?q?fix:=20=E5=BA=94=E7=94=A8=E5=9B=BE?= =?UTF-8?q?=E6=A0=87tips=E4=BD=8D=E7=BD=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 因为之前修改图标点击范围的问题,在图标的外面加了一层布局,导致在计算tips位置的时候,多加了一个边距。 这里是以图标与父控件的相对坐标的迭代计算得到tips应该显示的位置,原来的图标范围与任务栏边距为0,当加了一层布局后, 还是完全以图标为原点迭代计算就不对了,这里应该根据任务栏的位置调整参与计算的图标相对于父控件的x,y坐标,再进行累加。 (这里图标的父控件与外层的控件之间的间距为0,如果后续调整边距,这里需要重新调整这个计算) Log: 修复任务栏应用图标预览窗口位置显示错误的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58703.html Change-Id: I0644a9df38b802d7a4d3a5374ed5eaabfd35885d --- frame/item/dockitem.cpp | 74 +++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 47 deletions(-) diff --git a/frame/item/dockitem.cpp b/frame/item/dockitem.cpp index 34b775a86..1868c8b5b 100644 --- a/frame/item/dockitem.cpp +++ b/frame/item/dockitem.cpp @@ -277,11 +277,6 @@ void DockItem::showHoverTips() if (PopupWindow->model()) return; - // if not in geometry area - const QRect r(topleftPoint(), size()); - if (!r.contains(QCursor::pos())) - return; - QWidget *const content = popupTips(); if (!content) return; @@ -376,61 +371,47 @@ bool DockItem::checkAndResetTapHoldGestureState() const QPoint DockItem::popupMarkPoint() { QPoint p(topleftPoint()); - int margin = PLUGIN_MARGIN; - if (itemType() == Plugins){ - PluginsItem *pluginItem = dynamic_cast(this); - if (nullptr != pluginItem){ - if (pluginItem->pluginName() == "datetime") - margin = 0; - } - } const QRect r = rect(); switch (DockPosition) { - case Top: { - if (itemType() == Plugins) { - p += QPoint(r.width() / 2, r.height() + margin); - } else { - p += QPoint(r.width() / 2, r.height()); - } + case Top: + p += QPoint(r.width() / 2, r.height()); break; - } - case Bottom: { - if (itemType() == Plugins) { - p += QPoint(r.width() / 2, 0 - margin); - } else { - p += QPoint(r.width() / 2, 0); - } + case Bottom: + p += QPoint(r.width() / 2, 0); break; - } - case Left: { - if (itemType() == Plugins) { - p += QPoint(r.width() + margin, r.height() / 2); - } else { - p += QPoint(r.width(), r.height() / 2); - } + case Left: + p += QPoint(r.width(), r.height() / 2); break; - } - case Right: { - if (itemType() == Plugins) { - p += QPoint(0 - margin, r.height() / 2); - } else { - p += QPoint(0, r.height() / 2); - } + case Right: + p += QPoint(0, r.height() / 2); break; - } } return p; } const QPoint DockItem::topleftPoint() const { - QPoint p; - const QWidget *w = this; - do { + QPoint p = this->pos(); + /* 由于点击范围的问题,在图标的外面加了一层布局,这个布局的边距需要考虑 */ + switch (DockPosition) { + case Top: + p.setY(p.y() * 2); + break; + case Bottom: + p.setY(0); + break; + case Left: + p.setX(p.x() * 2); + break; + case Right: + p.setX(0); + break; + } + const QWidget *w = qobject_cast(this->parent()); + while (w) { p += w->pos(); w = qobject_cast(w->parent()); - } while (w); - + } return p; } @@ -461,4 +442,3 @@ bool DockItem::isDragging() { return m_draging; } - From 783f0972826d04f30bcb6a63b4cc21dd27c4eff6 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Tue, 5 Jan 2021 12:45:46 +0800 Subject: [PATCH 31/38] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=8A=A8=E7=94=BB=E9=87=8D=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏图标拖出任务栏后,从任务栏移除,松开后再加入任务栏。 Log: 修复任务栏图标动画异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-59031.html Change-Id: Id8324b01a464255f73570b38c3237cc3bf95291d --- frame/item/components/appdragwidget.cpp | 52 ++++++++++++++++++++++++- frame/item/components/appdragwidget.h | 7 ++++ frame/panel/mainpanelcontrol.cpp | 38 +++++++++++++----- frame/panel/mainpanelcontrol.h | 1 + 4 files changed, 87 insertions(+), 11 deletions(-) diff --git a/frame/item/components/appdragwidget.cpp b/frame/item/components/appdragwidget.cpp index 473318e39..6f4aed3ff 100644 --- a/frame/item/components/appdragwidget.cpp +++ b/frame/item/components/appdragwidget.cpp @@ -137,12 +137,16 @@ void AppDragWidget::mouseMoveEvent(QMouseEvent *event) void AppDragWidget::dragEnterEvent(QDragEnterEvent *event) { event->accept(); + m_bDragDrop = true; } void AppDragWidget::dragMoveEvent(QDragMoveEvent *event) { Q_UNUSED(event); showRemoveTips(); + if (isRemoveItem() && m_bDragDrop) { + emit requestRemoveItem(); + } } const QPoint AppDragWidget::topleftPoint() const @@ -191,6 +195,7 @@ const QPoint AppDragWidget::popupMarkPoint(Dock::Position pos) void AppDragWidget::dropEvent(QDropEvent *event) { m_followMouseTimer->stop(); + m_bDragDrop = false; if (isRemoveAble()) { if (DWindowManagerHelper::instance()->hasComposite()) { @@ -198,6 +203,7 @@ void AppDragWidget::dropEvent(QDropEvent *event) } else { hide(); } + emit animationFinished(); AppItem *appItem = static_cast(event->source()); appItem->undock(); m_popupWindow->setVisible(false); @@ -261,6 +267,7 @@ void AppDragWidget::initAnimations() connect(m_animGroup, &QParallelAnimationGroup::stateChanged, this, &AppDragWidget::onRemoveAnimationStateChanged); connect(m_goBackAnim, &QPropertyAnimation::finished, this, &AppDragWidget::hide); + connect(m_goBackAnim, &QPropertyAnimation::finished, this, &AppDragWidget::animationFinished); } void AppDragWidget::initConfigurations() @@ -304,6 +311,13 @@ void AppDragWidget::onRemoveAnimationStateChanged(QAbstractAnimation::State newS hide(); } } + +/** + * @brief 判断图标拖到一定高度后是否可以移除 + * + * @return true + * @return false + */ bool AppDragWidget::isRemoveAble() { const QPoint &p = QCursor::pos(); @@ -334,6 +348,40 @@ bool AppDragWidget::isRemoveAble() return false; } +/** + * @brief 判断应用区域图标是否拖出任务栏 + * + * @return true + * @return false + */ +bool AppDragWidget::isRemoveItem() +{ + const QPoint &p = QCursor::pos(); + switch (m_dockPosition) { + case Dock::Position::Left: + if ((p.x() > m_dockGeometry.topRight().x())) { + return true; + } + break; + case Dock::Position::Top: + if ((p.y() > m_dockGeometry.bottomLeft().y())) { + return true; + } + break; + case Dock::Position::Right: + if ((m_dockGeometry.topLeft().x() > p.x())) { + return true; + } + break; + case Dock::Position::Bottom: + if ((m_dockGeometry.topLeft().y() > p.y())) { + return true; + } + break; + } + return false; +} + void AppDragWidget::enterEvent(QEvent *event) { if (m_goBackAnim->state() != QPropertyAnimation::State::Running @@ -344,7 +392,7 @@ void AppDragWidget::enterEvent(QEvent *event) void AppDragWidget::showRemoveTips() { - bool model = true; + bool model = true; Dock::Position pos = Dock::Position::Bottom; DockPopupWindow *popup = m_popupWindow; @@ -382,4 +430,4 @@ void AppDragWidget::moveEvent(QMoveEvent *event) { Q_UNUSED(event); showRemoveTips(); -} \ No newline at end of file +} diff --git a/frame/item/components/appdragwidget.h b/frame/item/components/appdragwidget.h index 888fc22d3..130b02cf5 100644 --- a/frame/item/components/appdragwidget.h +++ b/frame/item/components/appdragwidget.h @@ -49,6 +49,10 @@ public: void setOriginPos(const QPoint position); bool isRemoveAble(); +signals: + void requestRemoveItem(); + void animationFinished(); + protected: void mouseMoveEvent(QMouseEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override; @@ -68,6 +72,7 @@ private: const QPoint popupMarkPoint(Dock::Position pos); const QPoint topleftPoint() const; void showRemoveTips(); + bool isRemoveItem(); private: AppGraphicsObject *m_object; @@ -90,6 +95,8 @@ private: * dock栏上应用区驻留应用被拖拽远离dock的距离除以dock的宽或者高(更小的一个)的比值 */ double m_distanceMultiple; + + bool m_bDragDrop = false; // 图标是否被拖拽 }; #endif /* APPDRAGWIDGET_H */ diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 1a06e0598..99746d82d 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -402,6 +402,9 @@ void MainPanelControl::moveItem(DockItem *sourceItem, DockItem *targetItem) removeItem(sourceItem); // insert new position + if (sourceItem->isDragging()) { + m_dragIndex = idx; + } insertItem(idx, sourceItem); } @@ -510,8 +513,10 @@ void MainPanelControl::handleDragMove(QDragMoveEvent *e, bool isFilter) e->accept(); - if (targetItem == sourceItem) + if (targetItem == sourceItem) { + m_dragIndex = -1; return; + } moveItem(sourceItem, targetItem); emit itemMoved(sourceItem, targetItem); @@ -686,6 +691,25 @@ void MainPanelControl::startDrag(DockItem *item) m_appDragWidget = nullptr; }); + connect(m_appDragWidget, &AppDragWidget::requestRemoveItem, this, [ = ] { + if (-1 != m_appAreaSonLayout->indexOf(item)) { + m_dragIndex = m_appAreaSonLayout->indexOf(item); + removeItem(item); + } + }); + + connect(m_appDragWidget, &AppDragWidget::animationFinished, this, [ = ] { + m_appDragWidget = nullptr; + if (qobject_cast(item)->isValid()) { + if (-1 == m_appAreaSonLayout->indexOf(item) && m_dragIndex != -1) { + insertItem(m_dragIndex, item); + m_dragIndex = -1; + } + item->setDraging(false); + item->update(); + } + }); + appDrag->appDragWidget()->setOriginPos((m_appAreaSonWidget->mapToGlobal(item->pos()))); appDrag->appDragWidget()->setDockInfo(m_position, QRect(mapToGlobal(pos()), size())); const QPixmap &dragPix = qobject_cast(item)->appIcon(); @@ -709,15 +733,11 @@ void MainPanelControl::startDrag(DockItem *item) drag->setMimeData(new QMimeData); drag->exec(Qt::MoveAction); - // app关闭特效情况下移除 - if (item->itemType() == DockItem::App && !DWindowManagerHelper::instance()->hasComposite()) { - if (m_appDragWidget->isRemoveAble()) - qobject_cast(item)->undock(); + if (item->itemType() != DockItem::App || m_dragIndex == -1) { + m_appDragWidget = nullptr; + item->setDraging(false); + item->update(); } - - m_appDragWidget = nullptr; - item->setDraging(false); - item->update(); } DockItem *MainPanelControl::dropTargetItem(DockItem *sourceItem, QPoint point) diff --git a/frame/panel/mainpanelcontrol.h b/frame/panel/mainpanelcontrol.h index 215528f8b..6ca8b7fa7 100755 --- a/frame/panel/mainpanelcontrol.h +++ b/frame/panel/mainpanelcontrol.h @@ -145,6 +145,7 @@ private: bool m_isHover; // 判断鼠标是否移到desktop区域 bool m_needRecoveryWin; // 判断鼠标移出desktop区域是否恢复之前窗口 bool m_isEnableLaunch; // 判断是否使能了com.deepin.dde.dock.module.launcher + int m_dragIndex = -1; // 记录应用区域被拖拽图标的位置 }; #endif // MAINPANELCONTROL_H From acfc60cf999857c1e03fc83a10512c5ba7853273 Mon Sep 17 00:00:00 2001 From: zsien Date: Thu, 17 Dec 2020 10:05:27 +0800 Subject: [PATCH 32/38] fix(network): displayed the wrong AP signal strength MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当多个 AP 为同一个 SSID,并且连接到此 SSID 时,由于通过 SSID 判断,所以会匹配到不正确的 AP 信息。 直接监听 activeApInfo 的改变,减少判断。 Log: 修复信号强度显示错误 Bug: https://pms.uniontech.com/zentao/bug-view-50453.html Change-Id: I9673b814fc02a55c06a057ef6d20e9dba49189ad (cherry picked from commit f01d5442fc37938239858e0be1b679a396aec740) --- plugins/network/item/wirelessitem.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/network/item/wirelessitem.cpp b/plugins/network/item/wirelessitem.cpp index 243964278..129293b5e 100644 --- a/plugins/network/item/wirelessitem.cpp +++ b/plugins/network/item/wirelessitem.cpp @@ -66,11 +66,8 @@ WirelessItem::WirelessItem(WirelessDevice *device) update(); }); - connect(static_cast(m_device.data()), &WirelessDevice::apInfoChanged, this, [ = ](QJsonObject info) { - const auto &activeApInfo = static_cast(m_device.data())->activeApInfo(); - if (activeApInfo.value("Ssid").toString() == info.value("Ssid").toString()) { - m_activeApInfo = info; - } + connect(static_cast(m_device.data()), &WirelessDevice::activeApInfoChanged, this, [ = ](QJsonObject activeApInfo) { + m_activeApInfo = activeApInfo; update(); }); From 9d2d4855f5a9e079f7aedffeff778a675a637a13 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Wed, 6 Jan 2021 18:24:13 +0800 Subject: [PATCH 33/38] =?UTF-8?q?fix:=20=E6=97=8B=E8=BD=AC=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E4=BB=BB=E5=8A=A1=E6=A0=8F=E9=AB=98=E5=BA=A6=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前参与计算的屏幕高度和宽度是所有屏幕的高度和宽度(当有多个屏幕时,将所有屏幕拼在一起当做一个整体,取最大宽度和高度), 但是任务栏计算高度时,应该用当前所在的屏幕高度、宽度来计算。 Log: 修复旋转屏幕导致任务栏高度异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-60056.html Change-Id: I40a57781dc942d89e7f3debdb91cb2b0cddf5dcc --- frame/util/multiscreenworker.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index ac163b663..5ea1c48f5 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -751,6 +751,7 @@ void MultiScreenWorker::onRequestNotifyWindowManager() if (rect == lastRect) return; lastRect = rect; + qDebug() << "dock geometry:" << rect; // 先清除原先的窗管任务栏区域 XcbMisc::instance()->clear_strut_partial(xcb_window_t(parent()->winId())); @@ -768,9 +769,10 @@ void MultiScreenWorker::onRequestNotifyWindowManager() return; } - qInfo() <<"Update Window WorkArea:" << rect; - const QPoint &p = rawXPosition(rect.topLeft()); + qDebug() << "dock topLeft position:" << p; + + QScreen const *currentScreen = Utils::screenAtByScaled(rect.topLeft()); XcbMisc::Orientation orientation = XcbMisc::OrientationTop; uint strut = 0; @@ -786,11 +788,7 @@ void MultiScreenWorker::onRequestNotifyWindowManager() break; case Position::Bottom: orientation = XcbMisc::OrientationBottom; - strut = m_screenRawHeight - p.y(); - //m_rotations 这里面是保存当前屏幕旋转那个方向正常情况分别依次向下,向右,向上,向左 - if(m_rotations.size() >= 4 && (m_monitorRotation == m_rotations[1] || m_monitorRotation == m_rotations[3])) { - strut = m_screenRawWidth - p.y(); - } + strut = currentScreen->geometry().height() * ratio - p.y(); strutStart = p.x(); strutEnd = qMin(qRound(p.x() + rect.width() * ratio), rect.right()); break; @@ -802,16 +800,12 @@ void MultiScreenWorker::onRequestNotifyWindowManager() break; case Position::Right: orientation = XcbMisc::OrientationRight; - strut = m_screenRawWidth - p.x(); - //m_rotations 这里面是保存当前屏幕旋转那个方向正常情况分别依次向下,向右,向上,向左 - if(m_rotations.size() >= 4 && (m_monitorRotation == m_rotations[1] || m_monitorRotation == m_rotations[3])) { - strut = m_screenRawHeight - p.x(); - } + strut = currentScreen->geometry().width() * ratio - p.x(); strutStart = p.y(); strutEnd = qMin(qRound(p.y() + rect.height() * ratio), rect.bottom()); break; } - + qDebug() << "set dock geometry to xcb:" << strut << strutStart << strutEnd; XcbMisc::instance()->set_strut_partial(parent()->winId(), orientation, strut + WINDOWMARGIN * ratio, strutStart, strutEnd); } From 860b78cd5f0ef9dba6c946de5021b279a88b9666 Mon Sep 17 00:00:00 2001 From: dongrui Date: Thu, 7 Jan 2021 13:20:43 +0800 Subject: [PATCH 34/38] =?UTF-8?q?fix:=20=E6=A1=8C=E9=9D=A2=E5=92=8C?= =?UTF-8?q?=E5=A4=9A=E4=BB=BB=E5=8A=A1=E8=A7=86=E5=9B=BE=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=90=8E=E9=87=8D=E6=96=B0=E6=B7=BB=E5=8A=A0=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E6=B7=BB=E5=8A=A0=E9=A1=BA=E5=BA=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将后插入的FixedPlugin类插件放置在已插入的FixedPlugin后面 Log: 修复桌面和多任务视图移除后重新添加没有按照添加顺序显示 Bug: https://pms.uniontech.com/zentao/bug-view-58711.html Change-Id: I34108bf5f3a263d4d49162496dd5a2e0e0249282 --- frame/util/abstractpluginscontroller.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/frame/util/abstractpluginscontroller.cpp b/frame/util/abstractpluginscontroller.cpp index f6a166321..ad5011ad6 100644 --- a/frame/util/abstractpluginscontroller.cpp +++ b/frame/util/abstractpluginscontroller.cpp @@ -52,16 +52,35 @@ void AbstractPluginsController::saveValue(PluginsItemInterface *const itemInter, { // is it necessary? // refreshPluginSettings(); + int fixedPluginCount(0); // FixPlugin Counts // save to local cache QJsonObject localObject = m_pluginSettingsObject.value(itemInter->pluginName()).toObject(); localObject.insert(key, QJsonValue::fromVariant(value)); //Note: QVariant::toJsonValue() not work in Qt 5.7 - m_pluginSettingsObject.insert(itemInter->pluginName(), localObject); // save to daemon QJsonObject remoteObject, remoteObjectInter; remoteObjectInter.insert(key, QJsonValue::fromVariant(value)); //Note: QVariant::toJsonValue() not work in Qt 5.7 remoteObject.insert(itemInter->pluginName(), remoteObjectInter); + + if (itemInter->type() == PluginsItemInterface::Fixed && key == "enable" && !value.toBool()) { + // 遍历FixPlugin插件个数 + for (auto it(m_pluginsMap.begin()); it != m_pluginsMap.end();) { + if (it.key()->type() == PluginsItemInterface::Fixed) { + fixedPluginCount++; + } + ++it; + } + // 修改插件的order值,位置为队尾 + QString name = localObject.keys().last(); + localObject.insert(name, QJsonValue::fromVariant(fixedPluginCount)); //Note: QVariant::toJsonValue() not work in Qt 5.7 + + // daemon中同样修改 + remoteObjectInter.insert(name, QJsonValue::fromVariant(fixedPluginCount)); //Note: QVariant::toJsonValue() not work in Qt 5.7 + remoteObject.insert(itemInter->pluginName(), remoteObjectInter); + } + + m_pluginSettingsObject.insert(itemInter->pluginName(), localObject); m_dockDaemonInter->MergePluginSettings(QJsonDocument(remoteObject).toJson(QJsonDocument::JsonFormat::Compact)); } From acbf68cca31e447a081ee7fd968362dbd5b4c0b1 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 7 Jan 2021 21:56:53 +0800 Subject: [PATCH 35/38] =?UTF-8?q?fix:=20=E6=97=B6=E9=97=B4=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏参数变化时,时间插件没有同步刷新布局。 Log: 修复时间插件显示异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-59013.html Bug: https://pms.uniontech.com/zentao/bug-view-60340.html Bug: https://pms.uniontech.com/zentao/bug-view-59126.html Change-Id: I6df9a6155dcff38758ef06b2ca12826761037fab --- frame/panel/mainpanelcontrol.cpp | 18 +++++++++++++++++- frame/panel/mainpanelcontrol.h | 1 + frame/window/mainwindow.cpp | 1 + plugins/datetime/datetimewidget.cpp | 5 ++--- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 99746d82d..bdfdd993c 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -342,6 +342,9 @@ void MainPanelControl::insertItem(int index, DockItem *item) break; } resizeDockIcon(); + QTimer::singleShot(0, [ = ] { + updatePluginsLayout(); + }); } void MainPanelControl::removeItem(DockItem *item) @@ -869,9 +872,22 @@ void MainPanelControl::moveAppSonWidget() m_appAreaSonWidget->move(rect.x(), rect.y()); } +void MainPanelControl::updatePluginsLayout() +{ + for (int i = 0; i < m_pluginLayout->count(); ++i) { + QLayout *layout = m_pluginLayout->itemAt(i)->layout(); + if (layout) { + PluginsItem *pItem = static_cast(layout->itemAt(0)->widget()); + if (pItem && pItem->sizeHint().width() != -1) { + pItem->updateGeometry(); + } + } + } +} + void MainPanelControl::itemUpdated(DockItem *item) { - item->parentWidget()->adjustSize(); + item->updateGeometry(); resizeDockIcon(); } diff --git a/frame/panel/mainpanelcontrol.h b/frame/panel/mainpanelcontrol.h index 6ca8b7fa7..e6ecb06af 100755 --- a/frame/panel/mainpanelcontrol.h +++ b/frame/panel/mainpanelcontrol.h @@ -65,6 +65,7 @@ public: void setPositonValue(Position position); void setDisplayMode(DisplayMode dislayMode); void getTrayVisableItemCount(); + void updatePluginsLayout(); MainPanelDelegate *delegate() const; void setDelegate(MainPanelDelegate *delegate); diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 4e8c88f1d..598570229 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -254,6 +254,7 @@ void MainWindow::resizeEvent(QResizeEvent *event) // 任务栏大小、位置、模式改变都会触发resize,发射大小改变信号,供依赖项目更新位置 Q_EMIT panelGeometryChanged(); + m_mainPanel->updatePluginsLayout(); m_shadowMaskOptimizeTimer->start(); return DBlurEffectWidget::resizeEvent(event); diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index 227e789f1..50fbc0ef0 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -61,7 +61,6 @@ void DatetimeWidget::set24HourFormat(const bool value) m_24HourFormat = value; update(); - adjustSize(); if (isVisible()) { emit requestUpdateGeometry(); } @@ -86,7 +85,7 @@ void DatetimeWidget::setShortDateFormat(int type) default: m_shortDateFormat = "yyyy-MM-dd"; break; } update(); - adjustSize(); + if (isVisible()) { emit requestUpdateGeometry(); } @@ -104,7 +103,7 @@ void DatetimeWidget::setShortTimeFormat(int type) default: m_shortTimeFormat = "hh:mm"; break; } update(); - adjustSize(); + if (isVisible()) { emit requestUpdateGeometry(); } From dc40bf513b498ec6e89749096cfa0d91b1162247 Mon Sep 17 00:00:00 2001 From: chenwei Date: Fri, 8 Jan 2021 14:33:08 +0800 Subject: [PATCH 36/38] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=93=9D?= =?UTF-8?q?=E7=89=99=E6=8F=92=E4=BB=B6=E7=95=8C=E9=9D=A2=E7=9B=B8=E5=85=B3?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据设计图更新任务栏插件主界面 Log: 根据设计图更新任务栏插件主界面 Bug: https://pms.uniontech.com/zentao/bug-view-59037.html Bug: https://pms.uniontech.com/zentao/bug-view-57897.html Change-Id: Idaa6009ca361b4a7ee515cb4e6d0bee9ecac1b54 --- frame/window/accessible.h | 15 - plugins/bluetooth/bluetoothapplet.cpp | 331 ----------------- plugins/bluetooth/bluetoothapplet.h | 83 ----- plugins/bluetooth/bluetoothitem.cpp | 21 +- plugins/bluetooth/bluetoothitem.h | 3 +- plugins/bluetooth/componments/adapteritem.cpp | 344 ------------------ plugins/bluetooth/componments/adapteritem.h | 88 ----- .../bluetooth/componments/adaptersmanager.cpp | 18 +- .../bluetooth/componments/adaptersmanager.h | 11 +- .../componments/bluetoothadapteritem.cpp | 276 ++++++++++++++ .../componments/bluetoothadapteritem.h | 126 +++++++ .../bluetooth/componments/bluetoothapplet.cpp | 257 +++++++++++++ .../bluetooth/componments/bluetoothapplet.h | 112 ++++++ .../componments/bluetoothconstants.h | 18 +- plugins/bluetooth/componments/device.cpp | 1 - plugins/bluetooth/componments/deviceitem.cpp | 189 ---------- plugins/bluetooth/componments/deviceitem.h | 97 ----- plugins/bluetooth/componments/switchitem.cpp | 137 ------- plugins/bluetooth/componments/switchitem.h | 64 ---- 19 files changed, 800 insertions(+), 1391 deletions(-) delete mode 100644 plugins/bluetooth/bluetoothapplet.cpp delete mode 100644 plugins/bluetooth/bluetoothapplet.h delete mode 100644 plugins/bluetooth/componments/adapteritem.cpp delete mode 100644 plugins/bluetooth/componments/adapteritem.h create mode 100644 plugins/bluetooth/componments/bluetoothadapteritem.cpp create mode 100644 plugins/bluetooth/componments/bluetoothadapteritem.h create mode 100644 plugins/bluetooth/componments/bluetoothapplet.cpp create mode 100644 plugins/bluetooth/componments/bluetoothapplet.h delete mode 100644 plugins/bluetooth/componments/deviceitem.cpp delete mode 100644 plugins/bluetooth/componments/deviceitem.h delete mode 100644 plugins/bluetooth/componments/switchitem.cpp delete mode 100644 plugins/bluetooth/componments/switchitem.h diff --git a/frame/window/accessible.h b/frame/window/accessible.h index 8c185ee83..0bac46ce9 100644 --- a/frame/window/accessible.h +++ b/frame/window/accessible.h @@ -38,7 +38,6 @@ //#include "../plugins/sound/componments/horizontalseparator.h" #include "../plugins/show-desktop/showdesktopwidget.h" -#include "../plugins/bluetooth/componments/deviceitem.h" #include "../plugins/network/networkitem.h" #include "../plugins/network/item/applet/devicecontrolwidget.h" #include "../plugins/datetime/datetimewidget.h" @@ -88,11 +87,6 @@ SET_FORM_ACCESSIBLE(AttentionContainer, "attentioncontainer") SET_FORM_ACCESSIBLE(HoldContainer, "holdcontainer") SET_FORM_ACCESSIBLE(NormalContainer, "normalcontainer") SET_FORM_ACCESSIBLE(SpliterAnimated, "spliteranimated") -//SET_BUTTON_ACCESSIBLE(SoundItem, "plugin-sounditem") -//SET_FORM_ACCESSIBLE(SoundApplet, "soundapplet") -//SET_FORM_ACCESSIBLE(SinkInputWidget, "sinkinputwidget") -//SET_SLIDER_ACCESSIBLE(VolumeSlider, QAccessible::Slider, "volumeslider") -//SET_FORM_ACCESSIBLE(HorizontalSeparator, "horizontalseparator") SET_FORM_ACCESSIBLE(DatetimeWidget, "plugin-datetime") SET_FORM_ACCESSIBLE(OnboardItem, "plugin-onboard") SET_FORM_ACCESSIBLE(TrashWidget, "plugin-trash") @@ -119,9 +113,7 @@ SET_FORM_ACCESSIBLE(QScrollArea, "QScrollArea") SET_FORM_ACCESSIBLE(QFrame, "QFrame") SET_FORM_ACCESSIBLE(QGraphicsView, "QGraphicsView") SET_FORM_ACCESSIBLE(DragWidget, "DragWidget") -SET_FORM_ACCESSIBLE(MenueItem, "MenueItem") SET_FORM_ACCESSIBLE(NetworkItem, "NetworkItem") -SET_FORM_ACCESSIBLE(DeviceItem, "DeviceItem") SET_FORM_ACCESSIBLE(StateButton, "StateButton") SET_FORM_ACCESSIBLE(DeviceControlWidget, "DeviceControlWidget") @@ -157,11 +149,6 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec USE_ACCESSIBLE(classname, SpliterAnimated); USE_ACCESSIBLE(classname, IndicatorTrayWidget); USE_ACCESSIBLE(classname, XEmbedTrayWidget); - // USE_ACCESSIBLE(classname, SoundItem); - // USE_ACCESSIBLE(classname, SoundApplet); - // USE_ACCESSIBLE(classname, SinkInputWidget); - // USE_ACCESSIBLE(classname, VolumeSlider); - // USE_ACCESSIBLE(classname, HorizontalSeparator); USE_ACCESSIBLE(classname, DesktopWidget); USE_ACCESSIBLE(classname, DatetimeWidget); USE_ACCESSIBLE(classname, OnboardItem); @@ -193,9 +180,7 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec USE_ACCESSIBLE(classname, QFrame); USE_ACCESSIBLE(classname, QGraphicsView); USE_ACCESSIBLE(classname, DragWidget); - USE_ACCESSIBLE(classname, MenueItem); USE_ACCESSIBLE(classname, NetworkItem); - USE_ACCESSIBLE(classname, DeviceItem); USE_ACCESSIBLE(classname, StateButton); USE_ACCESSIBLE(classname, DeviceControlWidget); diff --git a/plugins/bluetooth/bluetoothapplet.cpp b/plugins/bluetooth/bluetoothapplet.cpp deleted file mode 100644 index 940c66bcd..000000000 --- a/plugins/bluetooth/bluetoothapplet.cpp +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "bluetoothapplet.h" -#include "componments/switchitem.h" -#include "componments/deviceitem.h" -#include "componments/adapter.h" -#include "componments/switchitem.h" -#include "componments/adaptersmanager.h" -#include "componments/adapteritem.h" -#include "componments/bluetoothconstants.h" - -#include -#include - -#include -#include - -DGUI_USE_NAMESPACE - -extern void initFontColor(QWidget *widget) -{ - if (!widget) - return; - - auto fontChange = [&](QWidget *widget){ - QPalette defaultPalette = widget->palette(); - defaultPalette.setBrush(QPalette::WindowText, defaultPalette.brightText()); - widget->setPalette(defaultPalette); - }; - - fontChange(widget); - - QObject::connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, widget, [=]{ - fontChange(widget); - }); -} - -BluetoothApplet::BluetoothApplet(QWidget *parent) - : QScrollArea(parent) - , m_line(new HorizontalSeparator(this)) - , m_appletName(new QLabel(this)) - , m_centralWidget(new QWidget) - , m_centrealLayout(new QVBoxLayout) - , m_adapterLayout(new QVBoxLayout) - , m_menueLayout(new QHBoxLayout) - , m_openControlCenter(new MenueItem(this)) - , m_textLayout(new QVBoxLayout) - , m_adaptersManager(new AdaptersManager(this)) -{ - m_line->setVisible(false); - m_adapterLayout->setContentsMargins(0, 0, 0, 0); - - QFont defaultFont = font(); - auto titlefont = QFont(defaultFont.family(), defaultFont.pointSize() + 2); - - m_appletName->setText(tr("Bluetooth")); - m_appletName->setFont(titlefont); - initFontColor(m_appletName); - m_appletName->setVisible(false); - - m_openControlCenter->setText(tr("Bluetooth settings")); - m_textLayout->addWidget(m_openControlCenter); - m_textLayout->setContentsMargins(10, 0, 0, 0); - initFontColor(m_openControlCenter); - m_openControlCenter->setFixedHeight(ITEMHEIGHT); - m_openControlCenter->setVisible(false); - - QHBoxLayout *appletNameLayout = new QHBoxLayout; - appletNameLayout->setMargin(0); - appletNameLayout->setSpacing(0); - appletNameLayout->addSpacing(MARGIN); - appletNameLayout->addWidget(m_appletName); - appletNameLayout->addStretch(); - - m_menueLayout->setMargin(0); - m_menueLayout->setSpacing(0); - m_menueLayout->addSpacing(MARGIN); - - m_centrealLayout->setMargin(0); - m_centrealLayout->setSpacing(0); - m_centrealLayout->addLayout(appletNameLayout); - m_centrealLayout->addWidget(m_line); - m_centrealLayout->addLayout(m_adapterLayout); - m_centrealLayout->addLayout(m_textLayout); - m_centralWidget->setLayout(m_centrealLayout); - m_centralWidget->setFixedWidth(POPUPWIDTH); - m_centralWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - - setFixedWidth(POPUPWIDTH); - setWidget(m_centralWidget); - setContentsMargins(0, 0, 0, 0); - setFrameShape(QFrame::NoFrame); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_centralWidget->setAutoFillBackground(false); - viewport()->setAutoFillBackground(false); - - connect(m_adaptersManager, &AdaptersManager::adapterIncreased, this, &BluetoothApplet::addAdapter); - connect(m_adaptersManager, &AdaptersManager::adapterDecreased, this, &BluetoothApplet::removeAdapter); - connect(m_openControlCenter, &MenueItem::clicked, []{ - DDBusSender() - .service("com.deepin.dde.ControlCenter") - .interface("com.deepin.dde.ControlCenter") - .path("/com/deepin/dde/ControlCenter") - .method(QString("ShowModule")) - .arg(QString("bluetooth")) - .call(); - }); -} - -void BluetoothApplet::setAdapterPowered(bool powered) -{ - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem) - adapterItem->setPowered(powered); - } -} - -bool BluetoothApplet::poweredInitState() -{ - return m_adaptersManager->defaultAdapterInitPowerState(); -} - -bool BluetoothApplet::hasAadapter() -{ - return m_adaptersManager->adaptersCount(); -} - -QStringList BluetoothApplet::connectedDevsName() -{ - QStringList devicesName; - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem) { - devicesName << adapterItem->connectedDevsName(); - } - } - return devicesName; -} - -void BluetoothApplet::onPowerChanged() -{ - bool powerState = false; - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem->isPowered()) { - powerState = true; - break; - } - } - emit powerChanged(powerState); - - m_openControlCenter->setVisible(powerState); -} - -void BluetoothApplet::onDeviceStateChanged() -{ - Device::State deviceState = Device::StateUnavailable; - for (AdapterItem *adapterItem : m_adapterItems) { - if (Device::StateAvailable == adapterItem->currentDeviceState()) { - deviceState = Device::StateAvailable; - continue; - } - if (Device::StateConnected == adapterItem->currentDeviceState()) { - deviceState = Device::StateConnected; - break; - } - } - - emit deviceStateChanged(deviceState); - updateView(); -} - -void BluetoothApplet::addAdapter(Adapter *adapter) -{ - if (!adapter) - return; - - if (!m_adapterItems.size()) { - emit justHasAdapter(); - } - - QString adapterId = adapter->id(); - //dde-session-daemon重启的时候,同一个Id的蓝牙设备会再次添加一次,因此需要先移除以前的 - if (m_adapterItems.contains(adapterId)) { - AdapterItem *adapterItem = m_adapterItems.value(adapterId); - if (adapterItem) { - m_adapterLayout->removeWidget(adapterItem); - delete adapterItem; - m_adapterItems.remove(adapterId); - } - } - - auto adatpterItem = new AdapterItem(m_adaptersManager, adapter, this); - m_adapterItems[adapterId] = adatpterItem; - m_adapterLayout->addWidget(adatpterItem); - getDevieInitStatus(adatpterItem); - - connect(adatpterItem, &AdapterItem::deviceStateChanged, this, &BluetoothApplet::onDeviceStateChanged); - connect(adatpterItem, &AdapterItem::powerChanged, this, &BluetoothApplet::onPowerChanged); - connect(adatpterItem, &AdapterItem::sizeChange, this, &BluetoothApplet::updateView); - - updateView(); -} - -void BluetoothApplet::removeAdapter(Adapter *adapter) -{ - if (adapter) { - QString adapterId = adapter->id(); - AdapterItem *adapterItem = m_adapterItems.value(adapterId); - if (adapterItem) { - m_adapterLayout->removeWidget(adapterItem); - delete adapterItem; - m_adapterItems.remove(adapterId); - updateView(); - if (!m_adapterItems.size()) - emit noAdapter(); - } - } -} - -void BluetoothApplet::updateView() -{ - int contentHeight = 0; - int itemCount = 0; - bool isPowered = false; - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem) { - contentHeight += CONTROLHEIGHT; - if (adapterItem->isPowered()) { - isPowered = true; - itemCount += adapterItem->deviceCount(); - } - } - } - m_openControlCenter->setVisible(isPowered); - if (isPowered) { - contentHeight += ITEMHEIGHT; - } - - int adaptersCnt = m_adapterItems.size(); - if (adaptersCnt > 1) { - m_line->setVisible(true); - m_appletName->setVisible(true); - } else { - m_line->setVisible(false); - m_appletName->setVisible(false); - } - - if (adaptersCnt > 1) - contentHeight += m_appletName->height(); - - contentHeight += itemCount * ITEMHEIGHT; - m_centralWidget->setFixedHeight(contentHeight); - setFixedHeight(itemCount <= 10 ? contentHeight : 10 * ITEMHEIGHT); - setVerticalScrollBarPolicy(itemCount <= 10 ? Qt::ScrollBarAlwaysOff : Qt::ScrollBarAlwaysOn); -} - -void BluetoothApplet::getDevieInitStatus(AdapterItem *item) -{ - if (!item) - return; - - bool powered = item->isPowered(); - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem != item) { - if (adapterItem->isPowered()) { - powered = true; - break; - } - } - } - emit powerChanged(powered); - - Device::State deviceState = item->initDeviceState(); - Device::State otherDeviceState = Device::StateUnavailable; - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem != item) { - if (Device::StateAvailable == adapterItem->currentDeviceState()) { - otherDeviceState = Device::StateAvailable; - continue; - } - if (Device::StateConnected == adapterItem->currentDeviceState()) { - otherDeviceState = Device::StateConnected; - break; - } - } - } - - switch (deviceState) { - case Device::StateConnected: - emit deviceStateChanged(deviceState); - break; - case Device::StateUnavailable: - emit deviceStateChanged(otherDeviceState); - break; - case Device::StateAvailable: { - if (otherDeviceState != Device::StateConnected) - emit deviceStateChanged(deviceState); - else - emit deviceStateChanged(otherDeviceState); - } - break; - } -} - -void BluetoothApplet::setAdapterRefresh() -{ - for (AdapterItem *adapterItem : m_adapterItems) { - if (adapterItem) - adapterItem->refresh(); - } -} diff --git a/plugins/bluetooth/bluetoothapplet.h b/plugins/bluetooth/bluetoothapplet.h deleted file mode 100644 index ed0870c1a..000000000 --- a/plugins/bluetooth/bluetoothapplet.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef BLUETOOTHAPPLET_H -#define BLUETOOTHAPPLET_H - -#include "componments/device.h" - -#include - -class QLabel; -class QVBoxLayout; -class QHBoxLayout; -class Adapter; -class AdapterItem; -class HorizontalSeparator; -class MenueItem; -class AdaptersManager; -class BluetoothApplet : public QScrollArea -{ - Q_OBJECT -public: - explicit BluetoothApplet(QWidget *parent = nullptr); - void setAdapterPowered(bool powered); - void setAdapterRefresh(); - bool poweredInitState(); - bool hasAadapter(); - QStringList connectedDevsName(); - -public slots : - void addAdapter(Adapter *adapter); - void removeAdapter(Adapter *adapter); - -signals: - void powerChanged(bool powered); - void deviceStateChanged(const Device::State state); - void noAdapter(); - void justHasAdapter(); - -private slots: - void onPowerChanged(); - void onDeviceStateChanged(); - -private: - void updateView(); - void getDevieInitStatus(AdapterItem *item); - -private: - HorizontalSeparator *m_line; - QLabel *m_appletName; - QWidget *m_centralWidget; - QVBoxLayout *m_centrealLayout; - QVBoxLayout *m_adapterLayout; - QHBoxLayout *m_menueLayout; - MenueItem *m_openControlCenter; - QVBoxLayout *m_textLayout; - - AdaptersManager *m_adaptersManager; - - QMap m_adapterItems; - Device::State m_initDeviceState; -}; - -#endif // BLUETOOTHAPPLET_H diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index 061905698..ea3a8f167 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -24,7 +24,7 @@ #include "constants.h" #include "../widgets/tipswidget.h" #include "../frame/util/imageutil.h" -#include "bluetoothapplet.h" +#include "componments/bluetoothapplet.h" #include #include @@ -48,22 +48,23 @@ BluetoothItem::BluetoothItem(QWidget *parent) , m_devState(Device::State::StateUnavailable) , m_adapterPowered(m_applet->poweredInitState()) { + setAccessibleName("BluetoothPluginItem"); m_applet->setVisible(false); m_tipsLabel->setVisible(false); refreshIcon(); - connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) { + connect(m_applet, &BluetoothApplet::powerChanged, [ & ] (bool powered) { m_adapterPowered = powered; refreshIcon(); }); - connect(m_applet, &BluetoothApplet::deviceStateChanged, [&](const Device::State state) { - m_devState = state; + connect(m_applet, &BluetoothApplet::deviceStateChanged, [ & ] (const Device* device) { + m_devState = device->state(); refreshIcon(); refreshTips(); }); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothItem::refreshIcon); - connect(m_applet,&BluetoothApplet::noAdapter,this,&BluetoothItem::noAdapter); - connect(m_applet,&BluetoothApplet::justHasAdapter,this,&BluetoothItem::justHasAdapter); + connect(m_applet, &BluetoothApplet::noAdapter, this, &BluetoothItem::noAdapter); + connect(m_applet, &BluetoothApplet::justHasAdapter, this, &BluetoothItem::justHasAdapter); } QWidget *BluetoothItem::tipsWidget() @@ -128,9 +129,6 @@ void BluetoothItem::invokeMenuItem(const QString menuId, const bool checked) void BluetoothItem::refreshIcon() { - if (!m_applet) - return; - QString stateString; QString iconString; @@ -164,16 +162,13 @@ void BluetoothItem::refreshIcon() void BluetoothItem::refreshTips() { - if (!m_applet) - return; - QString tipsText; if (m_adapterPowered) { switch (m_devState) { case Device::StateConnected: { QStringList textList; - for (QString devName : m_applet->connectedDevsName()) { + for (QString devName : m_applet->connectedDevicesName()) { textList << tr("%1 connected").arg(devName); } m_tipsLabel->setTextList(textList); diff --git a/plugins/bluetooth/bluetoothitem.h b/plugins/bluetooth/bluetoothitem.h index 7edce591c..3e1c21a3c 100644 --- a/plugins/bluetooth/bluetoothitem.h +++ b/plugins/bluetooth/bluetoothitem.h @@ -30,6 +30,7 @@ #define BLUETOOTH_KEY "bluetooth-item-key" class BluetoothApplet; + namespace Dock { class TipsWidget; } @@ -63,8 +64,8 @@ signals: private: Dock::TipsWidget *m_tipsLabel; BluetoothApplet *m_applet; - QPixmap m_iconPixmap; + QPixmap m_iconPixmap; Device::State m_devState; bool m_adapterPowered; }; diff --git a/plugins/bluetooth/componments/adapteritem.cpp b/plugins/bluetooth/componments/adapteritem.cpp deleted file mode 100644 index e60a5dddb..000000000 --- a/plugins/bluetooth/componments/adapteritem.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "adapteritem.h" -#include "switchitem.h" -#include "deviceitem.h" -#include "adapter.h" -#include "adaptersmanager.h" -#include "bluetoothconstants.h" - -#include -#include - -extern void initFontColor(QWidget *widget); - -AdapterItem::AdapterItem(AdaptersManager *adapterManager, Adapter *adapter, QWidget *parent) - : QScrollArea(parent) - , m_centralWidget(new QWidget(this)) - , m_line(new HorizontalSeparator(this)) - , m_deviceLayout(new QVBoxLayout) - , m_adaptersManager(adapterManager) - , m_adapter(adapter) - , m_switchItem(new SwitchItem(this)) -{ - m_centralWidget->setFixedWidth(POPUPWIDTH); - m_line->setVisible(true); - m_deviceLayout->setMargin(0); - m_deviceLayout->setSpacing(0); - - m_switchItem->setTitle(adapter->name()); - m_switchItem->setChecked(adapter->powered(),false); - m_switchItem->setLoading(adapter->discover()); - - m_deviceLayout->addWidget(m_switchItem, Qt::AlignCenter); - m_deviceLayout->addWidget(m_line); - m_centralWidget->setFixedWidth(POPUPWIDTH); - m_centralWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - m_centralWidget->setLayout(m_deviceLayout); - - setFixedWidth(POPUPWIDTH); - setWidget(m_centralWidget); - setFrameShape(QFrame::NoFrame); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_centralWidget->setAutoFillBackground(false); - viewport()->setAutoFillBackground(false); - - QMap myDevices = adapter->devices(); - for (const Device *constDevice : myDevices) { - auto device = const_cast(constDevice); - if (device) - createDeviceItem(device); - } - - m_initDeviceState = Device::StateUnavailable; - for (const Device *constDevice : myDevices) { - auto device = const_cast(constDevice); - if (device) { - if (device->state() == Device::StateAvailable) { - m_initDeviceState = Device::StateAvailable; - continue; - } - if (device->state() == Device::StateConnected && device->connectState()) { - m_initDeviceState = Device::StateConnected; - break; - } - } - } - - connect(m_switchItem, &SwitchItem::checkedChanged, this, &AdapterItem::showAndConnect); - connect(m_switchItem, &SwitchItem::refresh, this, &AdapterItem::refresh); - connect(m_switchItem, &SwitchItem::justUpdateView, [&](bool checked){ - showDevices(checked); - emit powerChanged(checked); - }); - connect(adapter, &Adapter::nameChanged, m_switchItem, &SwitchItem::setTitle); - connect(adapter, &Adapter::deviceAdded, this, &AdapterItem::addDeviceItem); - connect(adapter, &Adapter::deviceRemoved, this, &AdapterItem::removeDeviceItem); - connect(adapter, &Adapter::poweredChanged, m_switchItem, [=](const bool powered){ - m_switchItem->setChecked(powered, false); - }); - - connect(adapter, &Adapter::discoveringChanged, m_switchItem, [=](const bool discovering){ - m_switchItem->setLoading(discovering); - }); - - showDevices(adapter->powered()); -} - -int AdapterItem::deviceCount() -{ - return m_deviceItems.size(); -} - -void AdapterItem::setPowered(bool powered) -{ - m_switchItem->setChecked(powered,true); -} - -bool AdapterItem::isPowered() -{ - return m_switchItem->checkState(); -} - -QStringList AdapterItem::connectedDevsName() -{ - QStringList devsName; - for (DeviceItem *devItem : m_sortConnected) { - if (devItem) { - devsName << devItem->title(); - } - } - - return devsName; -} - -void AdapterItem::deviceItemPaired(const bool paired) -{ - auto device = qobject_cast(sender()); - if (device) { - DeviceItem *deviceItem = m_deviceItems.value(device->id()); - if (paired) { - int index = m_sortConnected.indexOf(deviceItem); - - if (index < 0) { - m_sortUnConnect.removeOne(deviceItem); - m_sortConnected << deviceItem; - } - } else { - int index = m_sortUnConnect.indexOf(deviceItem); - - if(index < 0){ - m_sortConnected.removeOne(deviceItem); - m_sortUnConnect << deviceItem; - } - } - showDevices(m_adapter->powered()); - } -} - -void AdapterItem::removeDeviceItem(const Device *device) -{ - if (!device) - return; - - DeviceItem *deviceItem = m_deviceItems.value(device->id()); - if (deviceItem) { - m_deviceItems.remove(device->id()); - m_sortConnected.removeOne(deviceItem); - m_sortUnConnect.removeOne(deviceItem); - m_deviceLayout->removeWidget(deviceItem); - delete deviceItem; - } - showDevices(m_adapter->powered()); -} - -void AdapterItem::showAndConnect(bool change) -{ - m_adaptersManager->setAdapterPowered(m_adapter, change); - showDevices(change); - emit powerChanged(change); -} - -void AdapterItem::addDeviceItem(const Device *constDevice) -{ - auto device = const_cast(constDevice); - if (!device) - return; - - createDeviceItem(device); - showDevices(m_adapter->powered()); -} - -void AdapterItem::deviceChangeState(const Device::State state) -{ - auto device = qobject_cast(sender()); - - auto setUnavailableItem = [this](const Device::State state, DeviceItem *deviceItem){ - int index = m_sortUnConnect.indexOf(deviceItem); - if (index < 0) { - m_sortConnected.removeOne(deviceItem); - m_sortUnConnect << deviceItem; - moveDeviceItem(state, deviceItem); - } - }; - - if (device) { - DeviceItem *deviceItem = m_deviceItems.value(device->id()); - if (deviceItem) { - switch (state) { - case Device::StateUnavailable: { - setUnavailableItem(state, deviceItem); - } - break; - case Device::StateAvailable: { - int index = m_sortUnConnect.indexOf(deviceItem); - if (index < 0) - m_sortConnected.removeOne(deviceItem); - } - break; - case Device::StateConnected: { - if (!device->connectState()) { - setUnavailableItem(state, deviceItem); - break; - } - int index = m_sortConnected.indexOf(deviceItem); - if (index < 0) { - m_sortUnConnect.removeOne(deviceItem); - m_sortConnected << deviceItem; - moveDeviceItem(state, deviceItem); - } - } - break; - } - } - - if (m_sortConnected.size() > 0) - m_currentDeviceState = Device::StateConnected; - else if (state == Device::StateAvailable) - m_currentDeviceState = Device::StateAvailable; - else - m_currentDeviceState = Device::StateUnavailable; - - emit deviceStateChanged(); - } -} - -void AdapterItem::moveDeviceItem(Device::State state, DeviceItem *item) -{ - int size = m_sortConnected.size(); - int index = 0; - switch (state) { - case Device::StateUnavailable: - case Device::StateAvailable: { - index = m_sortUnConnect.indexOf(item); - index += size; - } - break; - case Device::StateConnected: { - index = m_sortUnConnect.indexOf(item); - } - break; - } - index += 2; - m_deviceLayout->removeWidget(item); - m_deviceLayout->insertWidget(index, item); -} - -void AdapterItem::createDeviceItem(Device *device) -{ - if (!device) - return; - - QString deviceId = device->id(); - auto deviceItem = new DeviceItem(device, this); - m_deviceItems[deviceId] = deviceItem; - if (device->state() == Device::StateConnected) - m_sortConnected << deviceItem; - else - m_sortUnConnect << deviceItem; - - connect(device, &Device::pairedChanged, this, &AdapterItem::deviceItemPaired); - connect(device, &Device::nameChanged, deviceItem, &DeviceItem::setTitle); - connect(device, &Device::stateChanged, deviceItem, &DeviceItem::changeState); - connect(device, &Device::stateChanged, this, &AdapterItem::deviceChangeState); - connect(deviceItem, &DeviceItem::clicked, m_adaptersManager, [this, deviceItem](Device *device) { - m_adaptersManager->connectDevice(device, m_adapter); - m_deviceLayout->removeWidget(deviceItem); - m_deviceLayout->insertWidget(1, deviceItem); - }); -} - -void AdapterItem::updateView() -{ - int contentHeight = m_switchItem->height(); - contentHeight += (m_deviceLayout->count() - 2) * ITEMHEIGHT; - m_centralWidget->setFixedHeight(contentHeight); - setFixedHeight(contentHeight); - emit sizeChange(); -} - -void AdapterItem::showDevices(bool powered) -{ - QList deviceItems; - for (DeviceItem *deviceItem : m_sortUnConnect) { - deviceItems.push_front(deviceItem); // 未连接设备倒序放进list里 - } - for (DeviceItem *deviceItem : m_sortConnected) { - deviceItems.push_front(deviceItem); // 已连接设备倒序放进list里 - } - - // 在蓝牙关闭的时候,会出现不在connected和Unconnect列表中的设备(连接/关闭中的状态),关闭的时候使用总表参数 - qDebug() << m_sortConnected.size() << m_sortUnConnect.size() << m_deviceItems.size(); - if (powered) { - for (DeviceItem *deviceItem : deviceItems) { - if (deviceItem) { - m_deviceLayout->addWidget(deviceItem); - deviceItem->setVisible(powered); - } - } - } else { - for (DeviceItem *deviceItem : m_deviceItems) { - if (deviceItem) { - m_deviceLayout->removeWidget(deviceItem); - deviceItem->setVisible(powered); - } - } - - for (DeviceItem *deviceItem : m_sortConnected) { - if (deviceItem) { - m_adaptersManager->disconnectDevice(deviceItem->device()); - } - } - } - - m_line->setVisible(powered); - updateView(); -} - -void AdapterItem::refresh() -{ - if (m_adapter->discover()) - return; - m_adaptersManager->adapterRefresh(m_adapter); -} diff --git a/plugins/bluetooth/componments/adapteritem.h b/plugins/bluetooth/componments/adapteritem.h deleted file mode 100644 index 5b2f6ed1a..000000000 --- a/plugins/bluetooth/componments/adapteritem.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef ADAPTERITEM_H -#define ADAPTERITEM_H - -#include "device.h" - -#include - -class QLabel; -class QVBoxLayout; -class HorizontalSeparator; -class Adapter; -class SwitchItem; -class DeviceItem; -class AdaptersManager; -class MenueItem; -class AdapterItem : public QScrollArea -{ - Q_OBJECT -public: - explicit AdapterItem(AdaptersManager *a, Adapter *adapter, QWidget *parent = nullptr); - int deviceCount(); - void setPowered(bool powered); - bool isPowered(); - inline Device::State initDeviceState() { return m_initDeviceState; } - inline Device::State currentDeviceState() { return m_currentDeviceState; } - QStringList connectedDevsName(); - -signals: - void deviceStateChanged(); - void powerChanged(bool powered); - void sizeChange(); - -private slots: - void deviceItemPaired(const bool paired); - void removeDeviceItem(const Device *device); - void showAndConnect(bool change); - void addDeviceItem(const Device *constDevice); - void deviceChangeState(const Device::State state); - void moveDeviceItem(Device::State state, DeviceItem *item); - -public slots: - void refresh(); - -private: - void createDeviceItem(Device *device); - void updateView(); - void showDevices(bool powered); - -private: - QWidget *m_centralWidget; - HorizontalSeparator *m_line; - QVBoxLayout *m_deviceLayout; - - AdaptersManager *m_adaptersManager; - - Adapter *m_adapter; - SwitchItem *m_switchItem; - QMap m_deviceItems; - Device::State m_initDeviceState; - Device::State m_currentDeviceState; - QList m_sortConnected; - QList m_sortUnConnect; - QMap m_devicesState; -}; - -#endif // ADAPTERITEM_H diff --git a/plugins/bluetooth/componments/adaptersmanager.cpp b/plugins/bluetooth/componments/adaptersmanager.cpp index 6afbaa532..88235a960 100644 --- a/plugins/bluetooth/componments/adaptersmanager.cpp +++ b/plugins/bluetooth/componments/adaptersmanager.cpp @@ -37,11 +37,11 @@ AdaptersManager::AdaptersManager(QObject *parent) this)) , m_defaultAdapterState(false) { - connect(m_bluetoothInter, &DBusBluetooth::AdapterAdded, this, &AdaptersManager::addAdapter); - connect(m_bluetoothInter, &DBusBluetooth::AdapterRemoved, this, &AdaptersManager::removeAdapter); + connect(m_bluetoothInter, &DBusBluetooth::AdapterAdded, this, &AdaptersManager::onAddAdapter); + connect(m_bluetoothInter, &DBusBluetooth::AdapterRemoved, this, &AdaptersManager::onRemoveAdapter); connect(m_bluetoothInter, &DBusBluetooth::AdapterPropertiesChanged, this, &AdaptersManager::onAdapterPropertiesChanged); - connect(m_bluetoothInter, &DBusBluetooth::DeviceAdded, this, &AdaptersManager::addDevice); - connect(m_bluetoothInter, &DBusBluetooth::DeviceRemoved, this, &AdaptersManager::removeDevice); + connect(m_bluetoothInter, &DBusBluetooth::DeviceAdded, this, &AdaptersManager::onAddDevice); + connect(m_bluetoothInter, &DBusBluetooth::DeviceRemoved, this, &AdaptersManager::onRemoveDevice); connect(m_bluetoothInter, &DBusBluetooth::DevicePropertiesChanged, this, &AdaptersManager::onDevicePropertiesChanged); #ifdef QT_DEBUG @@ -112,7 +112,7 @@ void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powe } } -void AdaptersManager::connectDevice(Device *device, Adapter *adapter) +void AdaptersManager::connectDevice(const Device *device, Adapter *adapter) { if (device) { QDBusObjectPath path(device->id()); @@ -171,14 +171,14 @@ void AdaptersManager::onDevicePropertiesChanged(const QString &json) } } -void AdaptersManager::addAdapter(const QString &json) +void AdaptersManager::onAddAdapter(const QString &json) { const QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8()); auto adapter = new Adapter(this); adapterAdd(adapter, doc.object()); } -void AdaptersManager::removeAdapter(const QString &json) +void AdaptersManager::onRemoveAdapter(const QString &json) { QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8()); QJsonObject obj = doc.object(); @@ -197,7 +197,7 @@ void AdaptersManager::removeAdapter(const QString &json) } } -void AdaptersManager::addDevice(const QString &json) +void AdaptersManager::onAddDevice(const QString &json) { const QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8()); const QJsonObject obj = doc.object(); @@ -219,7 +219,7 @@ void AdaptersManager::addDevice(const QString &json) } } -void AdaptersManager::removeDevice(const QString &json) +void AdaptersManager::onRemoveDevice(const QString &json) { QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8()); QJsonObject obj = doc.object(); diff --git a/plugins/bluetooth/componments/adaptersmanager.h b/plugins/bluetooth/componments/adaptersmanager.h index fa8b1fb24..38ab42c4a 100644 --- a/plugins/bluetooth/componments/adaptersmanager.h +++ b/plugins/bluetooth/componments/adaptersmanager.h @@ -35,7 +35,7 @@ public: explicit AdaptersManager(QObject *parent = nullptr); void setAdapterPowered(const Adapter *adapter, const bool &powered); - void connectDevice(Device *device, Adapter *adapter); + void connectDevice(const Device *device, Adapter *adapter); bool defaultAdapterInitPowerState(); int adaptersCount(); void adapterRefresh(const Adapter *adapter); @@ -49,11 +49,11 @@ private slots: void onAdapterPropertiesChanged(const QString &json); void onDevicePropertiesChanged(const QString &json); - void addAdapter(const QString &json); - void removeAdapter(const QString &json); + void onAddAdapter(const QString &json); + void onRemoveAdapter(const QString &json); - void addDevice(const QString &json); - void removeDevice(const QString &json); + void onAddDevice(const QString &json); + void onRemoveDevice(const QString &json); private: void adapterAdd(Adapter *adapter, const QJsonObject &adpterObj); @@ -62,7 +62,6 @@ private: private: DBusBluetooth *m_bluetoothInter; QMap m_adapters; - bool m_defaultAdapterState; }; diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.cpp b/plugins/bluetooth/componments/bluetoothadapteritem.cpp new file mode 100644 index 000000000..a02a5d8ab --- /dev/null +++ b/plugins/bluetooth/componments/bluetoothadapteritem.cpp @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. + * + * Author: chenwei + * + * Maintainer: chenwei + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "bluetoothadapteritem.h" +#include "componments/adapter.h" +#include "bluetoothapplet.h" +#include "bluetoothconstants.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +BluetoothDeviceItem::BluetoothDeviceItem(QStyle *style, const Device *device, DListView *parent) + : m_style(style) + , m_device(device) + , m_standarditem(new DStandardItem()) + , m_loading(new DSpinner(parent)) +{ + initActionList(); + initConnect(); +} + +BluetoothDeviceItem::~BluetoothDeviceItem() +{ + if (m_loading != nullptr) { + delete m_loading; + m_loading = nullptr; + } +} + +void BluetoothDeviceItem::initActionList() +{ + m_labelAction = new DViewItemAction(Qt::AlignLeft | Qt::AlignVCenter, QSize(), QSize(), false); + m_stateAction = new DViewItemAction(Qt::AlignLeft | Qt::AlignVCenter, QSize(), QSize(), true); + + m_loading->setFixedSize(QSize(24, 24)); + m_stateAction->setWidget(m_loading); + + m_standarditem->setAccessibleText(m_device->name()); + m_standarditem->setActionList(Qt::RightEdge, {m_stateAction}); + m_standarditem->setActionList(Qt::LeftEdge, {m_labelAction}); + + m_labelAction->setText(m_device->name()); + updateDeviceState(m_device->state()); + updateIconTheme(DGuiApplicationHelper::instance()->themeType()); +} + +void BluetoothDeviceItem::initConnect() +{ + connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothDeviceItem::updateIconTheme); + connect(m_device, &Device::stateChanged, this, &BluetoothDeviceItem::updateDeviceState); +} + +void BluetoothDeviceItem::updateIconTheme(DGuiApplicationHelper::ColorType type) +{ + if (type == DGuiApplicationHelper::LightType) { + if (!m_device->deviceType().isEmpty()) { + m_deviceIcon = LightString.arg(m_device->deviceType()); + } else { + m_deviceIcon = LightString.arg("other"); + } + } else { + if (!m_device->deviceType().isEmpty()) { + m_deviceIcon = DarkString.arg(m_device->deviceType()); + } else { + m_deviceIcon = DarkString.arg("other"); + } + } + m_labelAction->setIcon(QIcon(m_deviceIcon)); +} + +void BluetoothDeviceItem::updateDeviceState(Device::State state) +{ + m_labelAction->setText(m_device->name()); + if (state == Device::StateAvailable) { + m_loading->start(); + m_stateAction->setVisible(true); + m_standarditem->setCheckState(Qt::Unchecked); + } else if (state == Device::StateConnected){ + m_loading->stop(); + m_stateAction->setVisible(false); + m_standarditem->setCheckState(Qt::Checked); + emit requestTopDeviceItem(m_standarditem); + } else { + m_loading->stop(); + m_stateAction->setVisible(false); + m_standarditem->setCheckState(Qt::Unchecked); + } + emit deviceStateChanged(m_device); +} + +BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent) + : QWidget(parent) + , m_adapter(adapter) + , m_adapterLabel(new SettingLabel(adapter->name(), this)) + , m_adapterStateBtn(new DSwitchButton(this)) + , m_deviceListview(new DListView(this)) + , m_deviceModel(new QStandardItemModel(m_deviceListview)) +{ + initData(); + initUi(); + initConnect(); +} + +BluetoothAdapterItem::~BluetoothAdapterItem() +{ + qDeleteAll(m_deviceItems); +} + +void BluetoothAdapterItem::onConnectDevice(const QModelIndex &index) +{ + const QStandardItemModel *deviceModel = dynamic_cast(index.model()); + if (!deviceModel) + return; + DStandardItem *deviceitem = dynamic_cast(deviceModel->item(index.row())); + + foreach(const auto item, m_deviceItems) { + if (item->standardItem() == deviceitem) { + emit connectDevice(item->device(), m_adapter); + } + } +} + +void BluetoothAdapterItem::onTopDeviceItem(DStandardItem *item) +{ + if (!item || item->row() == -1 || item->row() == 0) + return; + + int index1 = item->row(); + QStandardItem *index = m_deviceModel->takeItem(index1, 0); + m_deviceModel->removeRow(index1); + m_deviceModel->insertRow(0, index); +} + +void BluetoothAdapterItem::onAdapterNameChanged(const QString name) +{ + m_adapterLabel->label()->setText(name); +} + +int BluetoothAdapterItem::currentDeviceCount() +{ + return m_deviceItems.size(); +} + +QStringList BluetoothAdapterItem::connectedDevicesName() +{ + QStringList devsName; + for (BluetoothDeviceItem *devItem : m_deviceItems) { + if (devItem && devItem->device()->state() == Device::StateConnected) { + devsName << devItem->device()->name(); + } + } + + return devsName; +} + +void BluetoothAdapterItem::initData() +{ + if (!m_adapter->powered()) + return; + + foreach(const auto device, m_adapter->devices()) { + if (!m_deviceItems.contains(device->id())) + onDeviceAdded(device); + } + emit deviceCountChanged(); +} + +void BluetoothAdapterItem::onDeviceAdded(const Device *device) +{ + int insertRow = 0; + foreach(const auto item, m_deviceItems) { + if (item->device()->connectState()) { + insertRow++; + } + } + + BluetoothDeviceItem *item = new BluetoothDeviceItem(style(), device, m_deviceListview); + connect(item, &BluetoothDeviceItem::requestTopDeviceItem, this, &BluetoothAdapterItem::onTopDeviceItem); + connect(item, &BluetoothDeviceItem::deviceStateChanged, this, &BluetoothAdapterItem::deviceStateChanged); + + m_deviceItems.insert(device->id(), item); + m_deviceModel->insertRow(insertRow, item->standardItem()); + emit deviceCountChanged(); +} + +void BluetoothAdapterItem::onDeviceRemoved(const Device *device) +{ + if(m_deviceItems.isEmpty()) + return; + + m_deviceModel->removeRow(m_deviceItems.value(device->id())->standardItem()->row()); + m_deviceItems.value(device->id())->deleteLater(); + m_deviceItems.remove(device->id()); + emit deviceCountChanged(); +} + +void BluetoothAdapterItem::initUi() +{ + setAccessibleName(m_adapter->name()); + setContentsMargins(0, 0, 0, 0); + m_adapterLabel->setFixedSize(ItemWidth, TitleHeight); + m_adapterLabel->addSwichButton(m_adapterStateBtn); + DFontSizeManager::instance()->bind(m_adapterLabel->label(), DFontSizeManager::T4); + + m_adapterStateBtn->setChecked(m_adapter->powered()); + + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setMargin(0); + mainLayout->setSpacing(0); + + m_deviceListview->setAccessibleName("DeviceItemList"); + m_deviceListview->setModel(m_deviceModel); + m_deviceListview->setItemSpacing(1); + m_deviceListview->setItemSize(QSize(ItemWidth, DeviceItemHeight)); + m_deviceListview->setBackgroundType(DStyledItemDelegate::ClipCornerBackground); + m_deviceListview->setItemRadius(0); + m_deviceListview->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_deviceListview->setSelectionMode(QAbstractItemView::NoSelection); + m_deviceListview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_deviceListview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_deviceListview->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); + m_deviceListview->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + mainLayout->addWidget(m_adapterLabel); + mainLayout->addSpacing(2); + mainLayout->addWidget(m_deviceListview); +} + +void BluetoothAdapterItem::initConnect() +{ + connect(m_adapter, &Adapter::deviceAdded, this, &BluetoothAdapterItem::onDeviceAdded); + connect(m_adapter, &Adapter::deviceRemoved, this, &BluetoothAdapterItem::onDeviceRemoved); + connect(m_adapter, &Adapter::nameChanged, this, &BluetoothAdapterItem::onAdapterNameChanged); + connect(m_deviceListview, &DListView::clicked, this, &BluetoothAdapterItem::onConnectDevice); + connect(m_adapter, &Adapter::poweredChanged, this, [ = ] (bool state) { + initData(); + m_deviceListview->setVisible(state); + m_adapterStateBtn->setChecked(state); + m_adapterStateBtn->setEnabled(true); + emit adapterPowerChanged(); + }); + connect(m_adapterStateBtn, &DSwitchButton::clicked, this, [ = ] (bool state){ + qDeleteAll(m_deviceItems); + m_deviceItems.clear(); + m_deviceModel->clear(); + m_deviceListview->setVisible(false); + m_adapterStateBtn->setEnabled(false); + emit requestSetAdapterPower(m_adapter, state); + }); +} diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.h b/plugins/bluetooth/componments/bluetoothadapteritem.h new file mode 100644 index 000000000..699eb4a09 --- /dev/null +++ b/plugins/bluetooth/componments/bluetoothadapteritem.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. + * + * Author: chenwei + * + * Maintainer: chenwei + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BLUETOOTHADAPTERITEM_H +#define BLUETOOTHADAPTERITEM_H + +#include "componments/device.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE + +DWIDGET_BEGIN_NAMESPACE +class DSwitchButton; +class DStandardItem; +class DListView; +class DSpinner; +DWIDGET_END_NAMESPACE + +class Adapter; +class SettingLabel; +class QStandardItemModel; + +const QString LightString = QString(":/light/buletooth_%1_light.svg"); +const QString DarkString = QString(":/dark/buletooth_%1_dark.svg"); + +class BluetoothDeviceItem : public QObject +{ + Q_OBJECT +public: + explicit BluetoothDeviceItem(QStyle *style = nullptr, const Device *device = nullptr, DListView *parent = nullptr); + virtual ~BluetoothDeviceItem(); + + DStandardItem *standardItem() { return m_standarditem; } + const Device *device() { return m_device; } + +public slots: + // 系统主题发生改变时更新蓝牙图标 + void updateIconTheme(DGuiApplicationHelper::ColorType type); + // 更新蓝牙设备的连接状态 + void updateDeviceState(Device::State state); + +signals: + void requestTopDeviceItem(DStandardItem *item); + void deviceStateChanged(const Device* device); + +private: + void initActionList(); + void initConnect(); + + DStyleHelper m_style; + QString m_deviceIcon; + + const Device *m_device = nullptr; + DStandardItem *m_standarditem = nullptr; + DViewItemAction *m_labelAction = nullptr; + DViewItemAction *m_stateAction = nullptr; + DSpinner *m_loading = nullptr; +}; + +class BluetoothAdapterItem : public QWidget +{ + Q_OBJECT +public: + explicit BluetoothAdapterItem(Adapter *adapter, QWidget *parent = nullptr); + ~BluetoothAdapterItem(); + Adapter *adapter() { return m_adapter; } + int currentDeviceCount(); + QStringList connectedDevicesName(); + +public slots: + // 添加蓝牙设备 + void onDeviceAdded(const Device *device); + // 移除蓝牙设备 + void onDeviceRemoved(const Device *device); + // 连接蓝牙设备 + void onConnectDevice(const QModelIndex &index); + // 将已连接的蓝牙设备放到列表第一个 + void onTopDeviceItem(DStandardItem* item); + // 设置蓝牙适配器名称 + void onAdapterNameChanged(const QString name); + +signals: + void adapterPowerChanged(); + void requestSetAdapterPower(Adapter *adapter, bool state); + void connectDevice(const Device *device, Adapter *adapter); + void deviceCountChanged(); + void deviceStateChanged(const Device* device); + +private: + void initData(); + void initUi(); + void initConnect(); + + Adapter *m_adapter = nullptr; + SettingLabel *m_adapterLabel = nullptr; + DSwitchButton *m_adapterStateBtn = nullptr; + DListView *m_deviceListview = nullptr; + QStandardItemModel *m_deviceModel = nullptr; + + QMap m_deviceItems; +}; + +#endif // BLUETOOTHADAPTERITEM_H diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp new file mode 100644 index 000000000..afbb5628c --- /dev/null +++ b/plugins/bluetooth/componments/bluetoothapplet.cpp @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. + * + * Author: chenwei + * + * Maintainer: chenwei + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "bluetoothapplet.h" +#include "device.h" +#include "bluetoothconstants.h" +#include "adaptersmanager.h" +#include "adapter.h" +#include "bluetoothadapteritem.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +SettingLabel::SettingLabel(QString text, QWidget *parent) + : QWidget(parent) + , m_label(new DLabel(text, this)) + , m_layout(new QHBoxLayout(this)) +{ + setAccessibleName("BluetoothSettingLabel"); + setContentsMargins(0, 0, 0, 0); + m_layout->setMargin(0); + m_layout->addSpacing(20); + m_layout->addWidget(m_label, 0, Qt::AlignLeft | Qt::AlignHCenter); +} + +void SettingLabel::addSwichButton(DSwitchButton *button) +{ + m_layout->addWidget(button, 0, Qt::AlignRight | Qt::AlignHCenter); + m_layout->addSpacing(10); +} + +void SettingLabel::mousePressEvent(QMouseEvent *ev) +{ + if (ev->button() == Qt::LeftButton) { + Q_EMIT clicked(); + return; + } + + return QWidget::mousePressEvent(ev); +} + +void SettingLabel::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setPen(Qt::NoPen); + if (DApplicationHelper::instance()->themeType() == DApplicationHelper::LightType) { + painter.setBrush(QColor(0, 0, 0, 0.03 * 255)); + } else { + painter.setBrush(QColor(255, 255, 255, 0.03 * 255)); + } + painter.drawRoundedRect(rect(), 0, 0); + + return QWidget::paintEvent(event); +} + +BluetoothApplet::BluetoothApplet(QWidget *parent) + : QWidget(parent) + , m_contentWidget(new QWidget(this)) + , m_adaptersManager(new AdaptersManager(this)) + , m_settingLabel(new SettingLabel(tr("Bluetooth settings"), this)) + , m_mainLayout(new QVBoxLayout(this)) + , m_contentLayout(new QVBoxLayout(m_contentWidget)) +{ + initUi(); + initConnect(); +} + +bool BluetoothApplet::poweredInitState() +{ + foreach(const auto adapter, m_adapterItems) { + if (adapter->adapter()->powered()) { + return true; + } + } + + return false; +} + +bool BluetoothApplet::hasAadapter() +{ + return m_adaptersManager->adaptersCount(); +} + +void BluetoothApplet::setAdapterRefresh() +{ + for (BluetoothAdapterItem *adapterItem : m_adapterItems) { + if (adapterItem->adapter()->discover()) + m_adaptersManager->adapterRefresh(adapterItem->adapter()); + } + updateSize(); +} + +void BluetoothApplet::setAdapterPowered(bool state) +{ + for (BluetoothAdapterItem *adapterItem : m_adapterItems) { + if (adapterItem) + m_adaptersManager->setAdapterPowered(adapterItem->adapter(), state); + } +} + +QStringList BluetoothApplet::connectedDevicesName() +{ + QStringList deviceList; + for (BluetoothAdapterItem *adapterItem : m_adapterItems) { + if (adapterItem) + deviceList << adapterItem->connectedDevicesName(); + } + + return deviceList; +} + +void BluetoothApplet::onAdapterAdded(Adapter *adapter) +{ + if (!m_adapterItems.size()) { + emit justHasAdapter(); + } + if (m_adapterItems.contains(adapter->id())) { + onAdapterRemoved(m_adapterItems.value(adapter->id())->adapter()); + } + + BluetoothAdapterItem *adapterItem = new BluetoothAdapterItem(adapter, this); + connect(adapterItem, &BluetoothAdapterItem::requestSetAdapterPower, this, &BluetoothApplet::onSetAdapterPower); + connect(adapterItem, &BluetoothAdapterItem::connectDevice, m_adaptersManager, &AdaptersManager::connectDevice); + connect(adapterItem, &BluetoothAdapterItem::deviceCountChanged, this, &BluetoothApplet::updateSize); + connect(adapterItem, &BluetoothAdapterItem::adapterPowerChanged, this, &BluetoothApplet::updateBluetoothPowerState); + connect(adapterItem, &BluetoothAdapterItem::deviceStateChanged, this, &BluetoothApplet::deviceStateChanged); + + m_adapterItems.insert(adapter->id(), adapterItem); + m_contentLayout->insertWidget(0, adapterItem, Qt::AlignTop | Qt::AlignVCenter); + updateBluetoothPowerState(); + updateSize(); +} + +void BluetoothApplet::onAdapterRemoved(Adapter *adapter) +{ + m_contentLayout->removeWidget(m_adapterItems.value(adapter->id())); + m_adapterItems.value(adapter->id())->deleteLater(); + m_adapterItems.remove(adapter->id()); + if (m_adapterItems.isEmpty()) { + emit noAdapter(); + } + updateBluetoothPowerState(); + updateSize(); +} + +void BluetoothApplet::onSetAdapterPower(Adapter *adapter, bool state) +{ + m_adaptersManager->setAdapterPowered(adapter, state); + updateSize(); +} + +void BluetoothApplet::updateBluetoothPowerState() +{ + foreach(const auto item, m_adapterItems) { + if (item->adapter()->powered()) { + emit powerChanged(true); + return; + } + } + emit powerChanged(false); + updateSize(); +} + +void BluetoothApplet::initUi() +{ + setFixedWidth(ItemWidth); + setAccessibleName("BluetoothApplet"); + setContentsMargins(0, 0, 0, 0); + + m_settingLabel->setFixedHeight(DeviceItemHeight); + DFontSizeManager::instance()->bind(m_settingLabel->label(), DFontSizeManager::T7); + + m_contentWidget->setContentsMargins(0, 0, 0, 0); + m_contentLayout->setMargin(0); + m_contentLayout->setSpacing(0); + m_contentLayout->addWidget(m_settingLabel, 0, Qt::AlignBottom | Qt::AlignVCenter); + + QScrollArea *scroarea = new QScrollArea(this); + m_contentWidget->setAttribute(Qt::WA_TranslucentBackground); + + scroarea->setWidgetResizable(true); + scroarea->setFrameStyle(QFrame::NoFrame); + scroarea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scroarea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + scroarea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); + scroarea->setContentsMargins(0, 0, 0, 0); + scroarea->setWidget(m_contentWidget); + + m_mainLayout->setMargin(0); + m_mainLayout->setSpacing(0); + m_mainLayout->addWidget(scroarea); + updateSize(); +} + +void BluetoothApplet::initConnect() +{ + connect(m_adaptersManager, &AdaptersManager::adapterIncreased, this, &BluetoothApplet::onAdapterAdded); + connect(m_adaptersManager, &AdaptersManager::adapterDecreased, this, &BluetoothApplet::onAdapterRemoved); + + connect(m_settingLabel, &SettingLabel::clicked, this, [ = ] { + DDBusSender() + .service("com.deepin.dde.ControlCenter") + .interface("com.deepin.dde.ControlCenter") + .path("/com/deepin/dde/ControlCenter") + .method(QString("ShowModule")) + .arg(QString("bluetooth")) + .call(); + }); +} + +void BluetoothApplet::updateSize() +{ + int hetght = 0; + int count = 0; + foreach(const auto item, m_adapterItems) { + hetght += TitleHeight + TitleSpace; + if (item->adapter()->powered()) { + count += item->currentDeviceCount(); + hetght += count * DeviceItemHeight; + } + } + + hetght += DeviceItemHeight; + int maxHeight = (TitleHeight + TitleSpace) + MaxDeviceCount * DeviceItemHeight; + hetght = hetght > maxHeight ? maxHeight : hetght; + setFixedSize(ItemWidth, hetght); +} + diff --git a/plugins/bluetooth/componments/bluetoothapplet.h b/plugins/bluetooth/componments/bluetoothapplet.h new file mode 100644 index 000000000..94b719052 --- /dev/null +++ b/plugins/bluetooth/componments/bluetoothapplet.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. + * + * Author: chenwei + * + * Maintainer: chenwei + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BLUETOOTHAPPLET_H +#define BLUETOOTHAPPLET_H + +#include +#include + +#include + +class QVBoxLayout; +class QHBoxLayout; + +class Device; +class Adapter; +class BluetoothAdapterItem; +class AdaptersManager; + +DWIDGET_BEGIN_NAMESPACE +class DLabel; +class DSwitchButton; +class DListView; +DWIDGET_END_NAMESPACE + +DWIDGET_USE_NAMESPACE + +class SettingLabel : public QWidget +{ + Q_OBJECT +public: + explicit SettingLabel(QString text, QWidget *parent = nullptr); + void addSwichButton(DSwitchButton *button); + DLabel *label() { return m_label; } +signals: + void clicked(); + +protected: + void mousePressEvent(QMouseEvent *ev) override; + void paintEvent(QPaintEvent *event) override; + +private: + DLabel *m_label = nullptr; + QHBoxLayout *m_layout = nullptr; +}; + +class BluetoothApplet : public QWidget +{ + Q_OBJECT +public: + explicit BluetoothApplet(QWidget *parent = nullptr); + bool poweredInitState(); + // 当前是否有蓝牙适配器 + bool hasAadapter(); + // 刷新蓝牙适配器搜索到的设备列表 + void setAdapterRefresh(); + // 设置当前所有蓝牙适配器的电源状态 + void setAdapterPowered(bool state); + // 已连接蓝牙设备名称列表,用于获取鼠标悬浮在蓝牙插件上时tips显示内容 + QStringList connectedDevicesName(); + +signals: + void noAdapter(); + void justHasAdapter(); + void powerChanged(bool state); + void deviceStateChanged(const Device* device); + +public slots: + // 蓝牙适配器增加 + void onAdapterAdded(Adapter *adapter); + // 蓝牙适配器移除 + void onAdapterRemoved(Adapter *adapter); + // 设置蓝牙适配器电源是否开启 + void onSetAdapterPower(Adapter *adapter, bool state); + // 更新蓝牙适配器电源状态,用于更新任务栏蓝牙插件图标的显示状态 + void updateBluetoothPowerState(); + +private: + void initUi(); + void initConnect(); + // 更新蓝牙插件主界面大小 + void updateSize(); + QWidget *m_contentWidget = nullptr; + AdaptersManager *m_adaptersManager = nullptr; + SettingLabel *m_settingLabel = nullptr; + QVBoxLayout *m_mainLayout = nullptr; + QVBoxLayout *m_contentLayout = nullptr; + + QStringList m_connectDeviceName; + QMap m_adapterItems; +}; + +#endif // BLUETOOTHAPPLET_H diff --git a/plugins/bluetooth/componments/bluetoothconstants.h b/plugins/bluetooth/componments/bluetoothconstants.h index 94dde45ca..c92c9ecf2 100644 --- a/plugins/bluetooth/componments/bluetoothconstants.h +++ b/plugins/bluetooth/componments/bluetoothconstants.h @@ -1,18 +1,10 @@ #ifndef BLUETOOTHCONSTANTS_H #define BLUETOOTHCONSTANTS_H -#define POPUPWIDTH (200) -#define ITEMHEIGHT (30) -#define CONTROLHEIGHT (35) -#define CONTROLTITLEHEIGHT (45) -#define LIGHTSUFFIX ("_dark.svg") -#define DARKSUFFIX (".svg") -#define MARGIN (12) -#define SWITCHBUTTONWIDTH (50) - -#define LIGHTICON "light/buletooth_" -#define DARKICON "dark/buletooth_" -#define LIGHTICONSUFFIX "_light.svg" -#define DARKICONSUFFIX "_dark.svg" +const int DeviceItemHeight = 36; +const int ItemWidth = 300; +const int TitleHeight = 46; +const int TitleSpace = 2; +const int MaxDeviceCount = 8; #endif // BLUETOOTHCONSTANTS_H diff --git a/plugins/bluetooth/componments/device.cpp b/plugins/bluetooth/componments/device.cpp index f7c72b6f7..daa2a2169 100644 --- a/plugins/bluetooth/componments/device.cpp +++ b/plugins/bluetooth/componments/device.cpp @@ -57,7 +57,6 @@ Device::Device(QObject *parent) Device::~Device() { - emit stateChanged(StateUnavailable); } void Device::updateDeviceTime() diff --git a/plugins/bluetooth/componments/deviceitem.cpp b/plugins/bluetooth/componments/deviceitem.cpp deleted file mode 100644 index 9cce307e8..000000000 --- a/plugins/bluetooth/componments/deviceitem.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "deviceitem.h" -#include "constants.h" -#include "bluetoothconstants.h" -#include "util/imageutil.h" -#include "util/statebutton.h" - -#include -#include - -#include -#include - -DGUI_USE_NAMESPACE - -extern void initFontColor(QWidget *widget); - -DeviceItem::DeviceItem(Device *d, QWidget *parent) - : QWidget(parent) - , m_title(new QLabel(this)) - , m_state(new StateButton(this)) - , m_loadingStat(new DSpinner) - , m_line(new HorizontalSeparator(this)) - , m_typeIcon(new QLabel(this)) -{ - m_device = d; - - setFixedHeight(ITEMHEIGHT); - auto themeChanged = [&](DApplicationHelper::ColorType themeType){ - QString iconPrefix; - QString iconSuffix; - switch (themeType) { - case DApplicationHelper::UnknownType: - case DApplicationHelper::LightType: { - iconPrefix = LIGHTICON; - iconSuffix = LIGHTICONSUFFIX; - } - break; - case DApplicationHelper::DarkType: { - iconPrefix = DARKICON; - iconSuffix = DARKICONSUFFIX; - } - } - - QString iconString; - if (!m_device->deviceType().isEmpty()) - iconString = iconPrefix + m_device->deviceType() + iconSuffix; - else - iconString = iconPrefix + QString("other") + iconSuffix; - m_typeIcon->setPixmap(ImageUtil::loadSvg(iconString, ":/", PLUGIN_ICON_MIN_SIZE, devicePixelRatioF())); - }; - - themeChanged(DApplicationHelper::instance()->themeType()); - - m_state->setType(StateButton::Check); - m_state->setFixedSize(PLUGIN_ICON_MAX_SIZE, PLUGIN_ICON_MAX_SIZE); - m_state->setVisible(false); - - m_title->setText(nameDecorated(m_device->name())); - initFontColor(m_title); - - m_line->setVisible(false); - m_loadingStat->setFixedSize(20, 20); - m_loadingStat->setVisible(false); - - auto itemLayout = new QHBoxLayout; - itemLayout->setMargin(0); - itemLayout->setSpacing(0); - itemLayout->addSpacing(MARGIN); - itemLayout->addWidget(m_typeIcon); - itemLayout->addSpacing(5); - itemLayout->addWidget(m_title); - itemLayout->addStretch(); - itemLayout->addWidget(m_state); - itemLayout->addWidget(m_loadingStat); - itemLayout->addSpacing(MARGIN); - setLayout(itemLayout); - - connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, themeChanged); - - changeState(m_device->state()); -} - -void DeviceItem::setTitle(const QString &name) -{ - m_title->setText(nameDecorated(name)); -} - -void DeviceItem::mousePressEvent(QMouseEvent *event) -{ - m_device->updateDeviceTime(); - emit clicked(m_device); - QWidget::mousePressEvent(event); -} - -void DeviceItem::paintEvent(QPaintEvent *e) -{ - if (LightType == DApplicationHelper::instance()->themeType()) { - QPainter painter(this); - QRect rc = rect(); - rc.moveTop(1); - painter.fillRect(rc, QColor(255, 255, 255, 51)); - - QWidget::paintEvent(e); - } -} - -void DeviceItem::changeState(const Device::State state) -{ - switch (state) { - case Device::StateUnavailable: { - m_state->setVisible(false); - m_loadingStat->stop(); - m_loadingStat->hide(); - m_loadingStat->setVisible(false); - } - break; - case Device::StateAvailable: { - m_state->setVisible(false); - m_loadingStat->start(); - m_loadingStat->show(); - m_loadingStat->setVisible(true); - } - break; - case Device::StateConnected: { - m_loadingStat->stop(); - m_loadingStat->hide(); - m_loadingStat->setVisible(false); - m_state->setVisible(true); - } - break; - } -} - -QString DeviceItem::nameDecorated(const QString &name) -{ - return QFontMetrics(m_title->font()).elidedText(name, Qt::ElideRight, POPUPWIDTH - MARGIN * 2 - PLUGIN_ICON_MIN_SIZE - 30); -} - -HorizontalSeparator::HorizontalSeparator(QWidget *parent) - : QWidget(parent) -{ - setFixedHeight(2); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); -} - -void HorizontalSeparator::paintEvent(QPaintEvent *e) -{ - QWidget::paintEvent(e); - - QPainter painter(this); - if (LightType == DApplicationHelper::instance()->themeType()) { - painter.fillRect(rect(), QColor(0, 0, 0, 10)); - } else if (DarkType == DApplicationHelper::instance()->themeType()) { - painter.fillRect(rect(), QColor(255, 255, 255, 13)); - } -} - -MenueItem::MenueItem(QWidget *parent) - : QLabel(parent) -{ -} - -void MenueItem::mousePressEvent(QMouseEvent *event) -{ - QLabel::mousePressEvent(event); - emit clicked(); -} diff --git a/plugins/bluetooth/componments/deviceitem.h b/plugins/bluetooth/componments/deviceitem.h deleted file mode 100644 index b1bdf1e42..000000000 --- a/plugins/bluetooth/componments/deviceitem.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef DEVICEITEM_H -#define DEVICEITEM_H - -#include "device.h" - -#include - -#include - -DWIDGET_USE_NAMESPACE - -enum ColorType { - UnknownType, - LightType, - DarkType -}; - -class StateButton; -class HorizontalSeparator; -class DeviceItem : public QWidget -{ - Q_OBJECT -public: - explicit DeviceItem(Device *d, QWidget *parent = nullptr); - - void setTitle(const QString &name); - inline QString title() { return m_title->text(); } - - inline Device *device() { return m_device; } - inline const Device *device() const { return m_device; } - -protected: - void mousePressEvent(QMouseEvent *event) override; - void paintEvent(QPaintEvent *e) override; - -signals: - void clicked(Device *); - -public slots: - void changeState(const Device::State state); - -private: - QString nameDecorated(const QString &name); - -private: - QLabel *m_title; - StateButton *m_state; - DSpinner *m_loadingStat; - Device *m_device; - HorizontalSeparator *m_line; - QLabel *m_typeIcon; -}; - -class HorizontalSeparator : public QWidget -{ - Q_OBJECT -public: - explicit HorizontalSeparator(QWidget *parent = nullptr); - -protected: - void paintEvent(QPaintEvent *e); -}; - -class MenueItem : public QLabel -{ - Q_OBJECT -public: - explicit MenueItem(QWidget *parent = nullptr); -signals: - void clicked(); -protected: - void mousePressEvent(QMouseEvent *event) override; -}; - -#endif // DEVICEITEM_H diff --git a/plugins/bluetooth/componments/switchitem.cpp b/plugins/bluetooth/componments/switchitem.cpp deleted file mode 100644 index 56ca4b305..000000000 --- a/plugins/bluetooth/componments/switchitem.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "switchitem.h" -#include "bluetoothconstants.h" - -#include -#include -#include - -#include -#include -#include -#include - -extern void initFontColor(QWidget *widget); - -SwitchItem::SwitchItem(QWidget *parent) - : QWidget(parent) - , m_title(new QLabel(this)) - , m_switchBtn(new DSwitchButton(this)) - , m_default(false) -{ - initFontColor(m_title); - - DFontSizeManager::instance()->bind(m_title, DFontSizeManager::T4, QFont::Medium); - m_switchBtn->setFixedWidth(SWITCHBUTTONWIDTH); - - const QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/wireless/resources/wireless/refresh_dark.svg"); - - m_loadingIndicator = new DLoadingIndicator; - m_loadingIndicator->setSmooth(true); - m_loadingIndicator->setAniDuration(500); - m_loadingIndicator->setAniEasingCurve(QEasingCurve::InOutCirc); - m_loadingIndicator->installEventFilter(this); - m_loadingIndicator->setFixedSize(pixmap.size() / devicePixelRatioF()); - m_loadingIndicator->viewport()->setAutoFillBackground(false); - m_loadingIndicator->setFrameShape(QFrame::NoFrame); - m_loadingIndicator->installEventFilter(this); - - auto themeChanged = [&](DApplicationHelper::ColorType themeType){ - Q_UNUSED(themeType) - setLoadIndicatorIcon(); - }; - themeChanged(DApplicationHelper::instance()->themeType()); - - setFixedHeight(CONTROLTITLEHEIGHT); - auto switchLayout = new QHBoxLayout; - switchLayout->setSpacing(0); - switchLayout->setMargin(0); - switchLayout->addSpacing(MARGIN); - switchLayout->addWidget(m_title); - switchLayout->addStretch(); - switchLayout->addWidget(m_loadingIndicator); - switchLayout->addSpacing(MARGIN); - switchLayout->addWidget(m_switchBtn); - switchLayout->addSpacing(5); - setLayout(switchLayout); - - connect(m_switchBtn, &DSwitchButton::toggled, [&](bool change) { - m_checkState = change; - m_loadingIndicator->setVisible(change); - emit checkedChanged(change); - }); - connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, themeChanged); -} - -void SwitchItem::setChecked(const bool checked,bool notify) -{ - m_checkState = checked; - if(!notify) { // 防止收到蓝牙开启或关闭信号后再触发一次打开或关闭 - m_switchBtn->blockSignals(true); - m_switchBtn->setChecked(checked); - m_switchBtn->blockSignals(false); - emit justUpdateView(checked); - } - else { - m_switchBtn->setChecked(checked); - } -} - -void SwitchItem::setTitle(const QString &title) -{ - int width = POPUPWIDTH - MARGIN * 2 - m_switchBtn->width() - 3; - QString strTitle = QFontMetrics(m_title->font()).elidedText(title, Qt::ElideRight, width); - m_title->setText(strTitle); -} - -bool SwitchItem::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == m_loadingIndicator) { - if (event->type() == QEvent::MouseButtonPress) { - if(!m_loadingIndicator->loading()) - Q_EMIT refresh(); - } - } - return false; -} - -void SwitchItem::setLoading(const bool bloading) -{ - m_loadingIndicator->setLoading(bloading); -} - -void SwitchItem::setLoadIndicatorIcon() -{ - QString filePath = ":/wireless/resources/wireless/refresh.svg"; - if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) - filePath = ":/wireless/resources/wireless/refresh_dark.svg"; - const QPixmap pixmap = DHiDPIHelper::loadNxPixmap(filePath); - m_loadingIndicator->setImageSource(pixmap); -} - -//void SwitchItem::mousePressEvent(QMouseEvent *event) -//{ -// emit clicked(m_adapterId); -// QWidget::mousePressEvent(event); -//} diff --git a/plugins/bluetooth/componments/switchitem.h b/plugins/bluetooth/componments/switchitem.h deleted file mode 100644 index e49003f2a..000000000 --- a/plugins/bluetooth/componments/switchitem.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: zhaolong - * - * Maintainer: zhaolong - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef SWITCHITEM_H -#define SWITCHITEM_H - -#include -#include -#include - -DGUI_USE_NAMESPACE -DWIDGET_USE_NAMESPACE - -class QLabel; -class SwitchItem : public QWidget -{ - Q_OBJECT -public: - explicit SwitchItem(QWidget *parent = nullptr); - void setChecked(const bool checked = true,bool notify = false); - void setTitle(const QString &title); - void setLoading(const bool bloading); - void setLoadIndicatorIcon(); - inline bool checkState() { return m_checkState; } - - inline bool isdefault() { return m_default; } - inline void setDefault(bool def) { m_default = def; } - -signals: - void checkedChanged(bool checked); - void justUpdateView(bool checked); - void refresh(); - -protected: - bool eventFilter(QObject *obj,QEvent *event) override; - -private: - QLabel *m_title; - DSwitchButton *m_switchBtn; - bool m_default; - bool m_checkState; - DLoadingIndicator *m_loadingIndicator; -}; - -#endif // SWITCHITEM_H From d3b230a56949c6139783bf6470cd902b75c89665 Mon Sep 17 00:00:00 2001 From: chenwei Date: Fri, 8 Jan 2021 11:19:02 +0800 Subject: [PATCH 37/38] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A0=8F=E7=BF=BB=E8=AF=91=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新任务栏翻译文件 Log: 更新任务栏翻译文件 Change-Id: Ib39f6b154c188633c7fd833b2fc717657e1e8714 --- translations/dde-dock.ts | 16 +- translations/dde-dock_ar.ts | 8 - translations/dde-dock_bo.ts | 491 +++++++++++++++++++++++++++++++++ translations/dde-dock_ca.ts | 10 +- translations/dde-dock_cs.ts | 18 +- translations/dde-dock_da.ts | 8 - translations/dde-dock_de.ts | 16 +- translations/dde-dock_en_AU.ts | 8 - translations/dde-dock_es.ts | 8 - translations/dde-dock_fa.ts | 185 ++++++++++--- translations/dde-dock_fi.ts | 10 +- translations/dde-dock_fr.ts | 18 +- translations/dde-dock_gl_ES.ts | 44 ++- translations/dde-dock_hi_IN.ts | 8 - translations/dde-dock_hr.ts | 8 - translations/dde-dock_hu.ts | 58 ++-- translations/dde-dock_it.ts | 10 +- translations/dde-dock_ja.ts | 207 ++++++++++---- translations/dde-dock_ko.ts | 8 - translations/dde-dock_lt.ts | 8 - translations/dde-dock_ms.ts | 34 +-- translations/dde-dock_nl.ts | 12 +- translations/dde-dock_pl.ts | 10 +- translations/dde-dock_pt.ts | 14 +- translations/dde-dock_pt_BR.ts | 12 +- translations/dde-dock_ro.ts | 30 +- translations/dde-dock_ru.ts | 10 +- translations/dde-dock_si.ts | 8 - translations/dde-dock_sk.ts | 8 - translations/dde-dock_sl.ts | 255 ++++++++++++----- translations/dde-dock_sq.ts | 14 +- translations/dde-dock_sr.ts | 10 +- translations/dde-dock_tr.ts | 10 +- translations/dde-dock_ug.ts | 10 +- translations/dde-dock_uk.ts | 10 +- translations/dde-dock_vi.ts | 8 - translations/dde-dock_zh_CN.ts | 12 +- translations/dde-dock_zh_HK.ts | 18 +- translations/dde-dock_zh_TW.ts | 12 +- 39 files changed, 1082 insertions(+), 562 deletions(-) create mode 100644 translations/dde-dock_bo.ts diff --git a/translations/dde-dock.ts b/translations/dde-dock.ts index bea512f19..98aeabbea 100644 --- a/translations/dde-dock.ts +++ b/translations/dde-dock.ts @@ -1,6 +1,4 @@ - - - + AbstractPluginsController @@ -17,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth settings @@ -291,7 +285,7 @@ Connection failed - + Connection failed @@ -423,10 +417,6 @@ Device Device - - Application - Application - SoundItem @@ -498,4 +488,4 @@ Wireless Network %1 - + \ No newline at end of file diff --git a/translations/dde-dock_ar.ts b/translations/dde-dock_ar.ts index 7c2356c13..853cfd770 100644 --- a/translations/dde-dock_ar.ts +++ b/translations/dde-dock_ar.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - البلوتوث - Bluetooth settings إعدادات البلوتوث @@ -421,10 +417,6 @@ Device الجهاز - - Application - تطبيق - SoundItem diff --git a/translations/dde-dock_bo.ts b/translations/dde-dock_bo.ts new file mode 100644 index 000000000..a58dbf309 --- /dev/null +++ b/translations/dde-dock_bo.ts @@ -0,0 +1,491 @@ + + + AbstractPluginsController + + The plugin %1 is not compatible with the system. + འཇུག་ཆས་%1དང་རྒྱུད་ཁོངས་ཀྱི་པར་གཞི་ཕན་ཚུན་མི་མཐུན་པ། + + + + AppDragWidget + + Remove + སྤོ་འབུད། + + + + BluetoothApplet + + Bluetooth settings + སོ་སྔོན་སྒྲིག་འགོད། + + + + BluetoothItem + + Turn off + སོ་སྔོན་ཁ་རྒྱོབ། + + + Turn on + སོ་སྔོན་ཁ་ཕྱེ། + + + Bluetooth settings + སོ་སྔོན་སྒྲིག་འགོད། + + + %1 connected + %1མཐུད་ཟིན། + + + Connecting... + སྦྲེལ་བཞིན་པ། + + + Bluetooth + སོ་སྔོན། + + + Turned off + སོ་སྔོན་ཁ་རྒྱོབ། + + + + BluetoothPlugin + + Bluetooth + སོ་སྔོན། + + + + DBusAdaptors + + Add keyboard layout + མཐེབ་གཞོང་བཀོད་པ་སྣོན་པ། + + + + DatetimePlugin + + Datetime + དུས་ཚོད། + + + 12-hour time + ཆུ་ཚོད་12ཀྱི་ལུགས། + + + 24-hour time + ཆུ་ཚོད་24ཡི་ལུགས། + + + Time settings + དུས་ཚོད་སྒྲིག་འགོད། + + + + DeviceItem + + Enable network + དྲ་རྒྱ་སྤྱོད་པ། + + + Disable network + དྲ་རྒྱ་ཁ་རྒྱོབ། + + + Network settings + དྲ་རྒྱ་སྒྲིག་འགོད། + + + + DialogManager + + Are you sure you want to empty %1 items? + ཁྱོད་ཀྱིས་སྙིགས་སྣོད་ནང་གི་ནང་དོན་%1དག་གཙང་སེལ་བྱེད་རྒྱུ་ཡིན་པ་གཏན་ཁེལ་ལམ། + + + Cancel + འདོར་བ། + + + Delete + སུབ་པ། + + + This action cannot be restored + བཀོལ་སྤྱོད་འདི་བྱས་ཚེ་སོར་ཆུད་ཐབས་བྲལ། + + + + DiskControlItem + + Unknown device + མ་ཤེས་པའི་སྒྲིག་ཆས། + + + Unknown volume + ཤོང་ཚད་མ་ཤེས་པ། + + + + DiskMountPlugin + + Disk + སྡུད་སྡེར། + + + Open + ཁ་ཕྱེ་བ། + + + Unmount all + ཚང་མ་བཤིག་འདོན་བྱེད། + + + + LauncherItem + + Launcher + འགོ་སློང་ཆས། + + + + MenuWorker + + Fashion Mode + དར་སྲོལ་དཔེ་རྣམ། + + + Efficient Mode + ལས་ཆོད་ཆེ་བའི་དཔེ་རྣམ། + + + Top + གོང་། + + + Bottom + འོག + + + Left + གཡོན། + + + Right + གཡས། + + + Keep Shown + རྟག་ཏུ་མངོན་སྟོན་བྱེད། + + + Keep Hidden + རྟག་ཏུ་ཡིབ་པ། + + + Smart Hide + རིག་ནུས་གབ་ཡིབ། + + + Mode + དཔེ་རྣམ། + + + Location + གནས་ས། + + + Status + རྣམ་པ། + + + Plugins + འཇུག་ཆས། + + + + MultitaskingPlugin + + Multitasking View + འགན་མང་མཐོང་རིས། + + + Undock + བསྡད་པ་གཙང་སེལ། + + + + NetworkItem + + Disable wired connection + སྐུད་ཡོད་དྲ་རྒྱ་ཁ་རྒྱོབ། + + + Enable wired connection + སྐུད་ཡོད་དྲ་རྒྱ་སྤྱོད་པ། + + + Disable wireless connection + སྐུད་མེད་དྲ་རྒྱ་ཁ་རྒྱོབ། + + + Enable wireless connection + སྐུད་མེད་དྲ་རྒྱ་སྤྱོད་པ། + + + Disable network + དྲ་རྒྱ་ཁ་རྒྱོབ། + + + Enable network + དྲ་རྒྱ་སྤྱོད་པ། + + + Network settings + དྲ་རྒྱ་སྒྲིག་འགོད། + + + Device disabled + སྒྲིག་ཆས་སྤྱོད་མི་ཆོག + + + Wireless connection: %1 + སྐུད་མེད་དྲ་རྒྱ། %1 + + + Wired connection: %1 + སྐུད་ཡོད་དྲ་རྒྱ། %1 + + + Not connected + སྦྲེལ་མེད་པ། + + + Connecting + སྦྲེལ་བཞིན་པ། + + + Connected but no Internet access + དྲ་རྒྱ་དང་འབྲེལ་ཟིན་ཡང་མཉམ་སྦྲེལ་དྲ་རྒྱར་འཛུལ་མི་ཐུབ། + + + Network cable unplugged + དྲ་སྐུད་མཐུད་མི་འདུག + + + Wireless Network + སྐུད་མེད་དྲ་རྒྱ། + + + Wired Network + སྐུད་ཡོད་དྲ་རྒྱ། + + + Connection failed + + + + + NetworkPlugin + + Network + དྲ་རྒྱ། + + + Wired Network + སྐུད་ཡོད་དྲ་རྒྱ། + + + Wired Network %1 + སྐུད་ཡོད་དྲ་རྒྱ་%1 + + + + OnboardPlugin + + Onboard + བརྙན་ཡོལ་མཐེབ་གཞོང་། + + + Settings + སྒྲིག་འགོད། + + + + PowerPlugin + + Power + གློག་ཁུངས་དོ་དམ། + + + Power settings + གློག་ཁུངས་སྒིག་འགོད། + + + Capacity %1, %2 min remaining + གློག་ཚད་%1 སྐར་མ་%2ལྷག་འདུག + + + Capacity %1, %2 hr %3 min remaining + གློག་ཚད་%1 ཆུ་ཚོད་%2དང་སྐར་མ་%3ལྷག་འདུག + + + Charging %1, %2 min until full + གློག་གསོག་བཞིན་ཡོད་%1 ད་དུང་སྐར་མ་%2དགོས། + + + Charging %1, %2 hr %3 min until full + གློག་གསོག་བཞིན་ཡོད་%1 ད་དུང་ཆུ་ཚོད་%2དང་སྐར་མ་%3དགོས། + + + Charged + ཁེངས་ཟིན། + + + Capacity %1 + གློག་ཚད་%1 + + + Charging %1 + གློག་གསོག་བཞིན་ཡོད་%1 + + + Capacity %1 ... + གློག་ཚད་%1 ... + + + Capacity %1, fully charged + གློག་ཚད་%1 ཁེངས་ཟིན། + + + + ShowDesktopPlugin + + Show Desktop + མངོན་སྟོན་ཅོག་ངོས། + + + Undock + བསྡད་པ་གཙང་སེལ། + + + + ShutdownPlugin + + Power + གློག་ཁུངས་དོ་དམ། + + + Shut down + ཁ་བརྒྱབ། + + + Suspend + སྒུག་སྡོད། + + + Hibernate + མལ་གསོ། + + + Lock + ཟྭ་རྒྱག + + + Log out + ཐོ་སུབ་པ། + + + Switch account + རྩིས་ཁྲ་བརྗེ་བ། + + + Power settings + གློག་ཁུངས་སྒིག་འགོད། + + + Reboot + བསྐྱར་སློང་། + + + + SoundApplet + + Device + སྒྲིག་ཆས། + + + + SoundItem + + Unmute + སྒྲ་ལྡན། + + + Mute + སྒྲ་མེད། + + + Sound settings + སྐད་གདངས་སྒྲིག་འགོད། + + + Volume %1 + མིག་སྔའི་སྐད་གདངས་%1 + + + + SoundPlugin + + Sound + སྒྲ། + + + + TrashPlugin + + Trash + སྙིགས་སྣོད། + + + Trash - %1 file + སྙིགས་སྣོད་ཀྱི་ཡིག་ཆ་%1 + + + Trash - %1 files + སྙིགས་སྣོད་ཀྱི་ཡིག་ཆ་%1 + + + + TrashWidget + + Open + ཁ་ཕྱེ་བ། + + + Empty + གསལ་ཐོ་གཙང་སེལ། + + + + TrayPlugin + + System Tray + རྒྱུད་ཁོངས་སྡེར་མ། + + + + WirelessList + + Wireless Network + སྐུད་མེད་དྲ་རྒྱ། + + + Wireless Network %1 + སྐུད་མེད་དྲ་རྒྱ་%1 + + + \ No newline at end of file diff --git a/translations/dde-dock_ca.ts b/translations/dde-dock_ca.ts index 6a3b35ff7..f5d4c2770 100644 --- a/translations/dde-dock_ca.ts +++ b/translations/dde-dock_ca.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Configuració del Bluetooth @@ -289,7 +285,7 @@ Connection failed - + Ha fallat la connexió. @@ -421,10 +417,6 @@ Device Dispositiu - - Application - Aplicació - SoundItem diff --git a/translations/dde-dock_cs.ts b/translations/dde-dock_cs.ts index 2db197df4..83855082e 100644 --- a/translations/dde-dock_cs.ts +++ b/translations/dde-dock_cs.ts @@ -3,7 +3,7 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - Zásuvný modul %1 není kompatibilní se systémem. + Přídavný modul %1 není slučitelný se systémem. @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Nastavení Bluetooth @@ -44,7 +40,7 @@ Connecting... - Připojování… + Připojuje se... Bluetooth @@ -111,7 +107,7 @@ Cancel - Storno + Zrušit Delete @@ -289,7 +285,7 @@ Connection failed - + Připojení se nezdařilo @@ -311,7 +307,7 @@ OnboardPlugin Onboard - Onboard + Na základní desce Settings @@ -421,10 +417,6 @@ Device Zařízení - - Application - Aplikace - SoundItem diff --git a/translations/dde-dock_da.ts b/translations/dde-dock_da.ts index 1b90ee78d..131edd9c4 100644 --- a/translations/dde-dock_da.ts +++ b/translations/dde-dock_da.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth-indstillinger @@ -421,10 +417,6 @@ Device Enhed - - Application - Program - SoundItem diff --git a/translations/dde-dock_de.ts b/translations/dde-dock_de.ts index 6dfa327cf..ade0e3495 100644 --- a/translations/dde-dock_de.ts +++ b/translations/dde-dock_de.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth-Einstellungen @@ -52,7 +48,7 @@ Turned off - + Ausgeschaltet @@ -289,7 +285,7 @@ Connection failed - + Verbindung fehlgeschlagen @@ -362,7 +358,7 @@ Capacity %1, fully charged - + Kapazität %1, voll aufgeladen @@ -421,10 +417,6 @@ Device Gerät - - Application - Anwendung - SoundItem @@ -442,7 +434,7 @@ Volume %1 - Lautstärke: %1 + Lautstärke %1 diff --git a/translations/dde-dock_en_AU.ts b/translations/dde-dock_en_AU.ts index b0cd7687b..1b1673d18 100644 --- a/translations/dde-dock_en_AU.ts +++ b/translations/dde-dock_en_AU.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth settings @@ -421,10 +417,6 @@ Device Device - - Application - Application - SoundItem diff --git a/translations/dde-dock_es.ts b/translations/dde-dock_es.ts index c70577292..f56411f9c 100644 --- a/translations/dde-dock_es.ts +++ b/translations/dde-dock_es.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Ajustes de Bluetooth @@ -421,10 +417,6 @@ Device Dispositivo - - Application - Aplicación - SoundItem diff --git a/translations/dde-dock_fa.ts b/translations/dde-dock_fa.ts index 72d4ccad0..e03fce3ef 100644 --- a/translations/dde-dock_fa.ts +++ b/translations/dde-dock_fa.ts @@ -6,6 +6,58 @@ افزونه %1 با سیستم سازگار نیست. + + AppDragWidget + + Remove + + + + + BluetoothApplet + + Bluetooth settings + تنظیمات بلوتوث + + + + BluetoothItem + + Turn off + خاموش کردن + + + Turn on + روشن کردن + + + Bluetooth settings + تنظیمات بلوتوث + + + %1 connected + + + + Connecting... + + + + Bluetooth + بلوتوث + + + Turned off + + + + + BluetoothPlugin + + Bluetooth + بلوتوث + + DBusAdaptors @@ -21,15 +73,15 @@ 12-hour time - + زمان 12-ساعته 24-hour time - + زمان 24-ساعته Time settings - + تنظیمات زمان @@ -93,7 +145,14 @@ - DockSettings + LauncherItem + + Launcher + لانچر + + + + MenuWorker Fashion Mode حالت فشن @@ -147,13 +206,6 @@ پلاگین ها - - LauncherItem - - Launcher - لانچر - - MultitaskingPlugin @@ -165,12 +217,91 @@ باز کردن از داک + + NetworkItem + + Disable wired connection + + + + Enable wired connection + + + + Disable wireless connection + + + + Enable wireless connection + + + + Disable network + غیر فعال کردن شبکه + + + Enable network + فعال کردن شبکه + + + Network settings + تنظیمات شبکه + + + Device disabled + دستگاه غیرفعال است + + + Wireless connection: %1 + + + + Wired connection: %1 + اتصال سیمی %1 + + + Not connected + متصل نیست + + + Connecting + در حال اتصال + + + Connected but no Internet access + متصل است اما دسترسی به اینترنت ندارد + + + Network cable unplugged + کابل شبکه وصل نشده است + + + Wireless Network + شبکه بیسیم + + + Wired Network + شبکه کابلی + + + Connection failed + + + NetworkPlugin Network شبکه + + Wired Network + شبکه کابلی + + + Wired Network %1 + شبکه سیمی %1 + OnboardPlugin @@ -286,10 +417,6 @@ Device دستگاه - - Application - برنامه - SoundItem @@ -303,7 +430,7 @@ Sound settings - + تنظیمات صدا Volume %1 @@ -350,32 +477,6 @@ سینی سیستم - - WiredItem - - Unknown - ناشناخته - - - Wired connection: %1 - اتصال سیمی %1 - - - - WirelessItem - - No Network - بدون شبکه - - - Connected but no Internet access - متصل است اما دسترسی به اینترنت ندارد - - - Wireless connection: %1 - - - WirelessList diff --git a/translations/dde-dock_fi.ts b/translations/dde-dock_fi.ts index 2feadf9c8..187c4e1e4 100644 --- a/translations/dde-dock_fi.ts +++ b/translations/dde-dock_fi.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth asetukset @@ -289,7 +285,7 @@ Connection failed - + Yhteys epäonnistui @@ -421,10 +417,6 @@ Device Laite - - Application - Sovellus - SoundItem diff --git a/translations/dde-dock_fr.ts b/translations/dde-dock_fr.ts index 8be641d43..c9df92bd9 100644 --- a/translations/dde-dock_fr.ts +++ b/translations/dde-dock_fr.ts @@ -3,7 +3,7 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - L'extension %1 n'est pas compatible avec le système + Le plugin %1 n'est pas compatible avec le système. @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Paramètres Bluetooth @@ -107,7 +103,7 @@ DialogManager Are you sure you want to empty %1 items? - Êtes-vous sûr de vouloir vider %1 éléments ? + Êtes-vous sûr de vouloir supprimer %1 éléments ? Cancel @@ -289,7 +285,7 @@ Connection failed - + La connexion a échoué @@ -330,11 +326,11 @@ Capacity %1, %2 min remaining - Capacité: %1, %2 minutes restantes + Capacité %1, %2 minutes restantes Capacity %1, %2 hr %3 min remaining - Capacité: %1, %2 heures et %3 minutes restantes + Capacité %1, %2 heures et %3 minutes restantes Charging %1, %2 min until full @@ -421,10 +417,6 @@ Device Périphérique - - Application - Applications - SoundItem diff --git a/translations/dde-dock_gl_ES.ts b/translations/dde-dock_gl_ES.ts index 6591407b0..5302f8f44 100644 --- a/translations/dde-dock_gl_ES.ts +++ b/translations/dde-dock_gl_ES.ts @@ -3,7 +3,7 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - O complemento% 1 non é compatible co sistema. + O complemento %1 non é compatible co sistema. @@ -15,13 +15,9 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings - Configuración de Bluetooth + Axustes do Bluetooth @@ -36,7 +32,7 @@ Bluetooth settings - Configuración de Bluetooth + Axustes do Bluetooth %1 connected @@ -52,7 +48,7 @@ Turned off - Apagado + Desactivado @@ -77,15 +73,15 @@ 12-hour time - 12 horas de tempo + formato 12 horas 24-hour time - 24 horas de tempo + formato 24 horas Time settings - Configuración do tempo + Axustes da hora @@ -107,7 +103,7 @@ DialogManager Are you sure you want to empty %1 items? - Está seguro que que quere vaciar %1 elementos? + Está certo/a de querer baleirar %1 elementos? Cancel @@ -225,11 +221,11 @@ NetworkItem Disable wired connection - Desactivar a conexión por cable + Desactivar a conexión con fíos Enable wired connection - Activa a conexión por fíos + Activa a conexión con fíos Disable wireless connection @@ -253,7 +249,7 @@ Device disabled - Despositivo desactivado + Dispositivo desactivado Wireless connection: %1 @@ -277,7 +273,7 @@ Network cable unplugged - Cable de rede desconectado + Cabo de rede desconectado Wireless Network @@ -330,19 +326,19 @@ Capacity %1, %2 min remaining - Capacidade% 1,% 2 minutos restantes + Capacidade %1, %2 minutos restantes Capacity %1, %2 hr %3 min remaining - Capacidade% 1,% 2 h% 3 minutos restantes + Capacidade %1,%2h %3m restantes Charging %1, %2 min until full - Cargando% 1,% 2 min ata o completo + Cargando %1, %2m até completar Charging %1, %2 hr %3 min until full - Cargando% 1,% 2 h% 3 min ata completar + Cargando %1, %2h %3m até completar Charged @@ -362,7 +358,7 @@ Capacity %1, fully charged - Capacidade% 1, totalmente cargada + Capacidade %1, totalmente cargada @@ -400,7 +396,7 @@ Log out - Pechar a sesión + Pechar sesión Switch account @@ -421,10 +417,6 @@ Device Dispositivo - - Application - Aplicación - SoundItem diff --git a/translations/dde-dock_hi_IN.ts b/translations/dde-dock_hi_IN.ts index 9f25fd1eb..54080fabf 100644 --- a/translations/dde-dock_hi_IN.ts +++ b/translations/dde-dock_hi_IN.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - ब्लूटूथ - Bluetooth settings ब्लूएटूथ सेवाएं @@ -421,10 +417,6 @@ Device डिवाइस - - Application - अनुप्रयोग - SoundItem diff --git a/translations/dde-dock_hr.ts b/translations/dde-dock_hr.ts index 4100c0b93..e891a4928 100644 --- a/translations/dde-dock_hr.ts +++ b/translations/dde-dock_hr.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth postavke @@ -421,10 +417,6 @@ Device Uređaj - - Application - Računalni program - SoundItem diff --git a/translations/dde-dock_hu.ts b/translations/dde-dock_hu.ts index da1f9dea3..7b0128d46 100644 --- a/translations/dde-dock_hu.ts +++ b/translations/dde-dock_hu.ts @@ -3,7 +3,7 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - %1 bővítmény nem kompatibilis a rendszerrel. + A %1 bővítmény nem kompatibilis a rendszerrel. @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth beállítások @@ -66,7 +62,7 @@ DBusAdaptors Add keyboard layout - Billentyűzet kiosztás megadása + Billentyűzetkiosztás megadása @@ -77,15 +73,15 @@ 12-hour time - 12 órás formátum + 12 órás időformátum 24-hour time - 24 órás formátum + 24 órás időformátum Time settings - Idő beállítások + Idő beállításai @@ -107,7 +103,7 @@ DialogManager Are you sure you want to empty %1 items? - Biztosan törölni akarsz %1 elemet? + Biztosan törölni akarja a %1 elemet? Cancel @@ -145,7 +141,7 @@ Unmount all - Minden külső partíció leválasztása + Összes lecsatolása @@ -159,7 +155,7 @@ MenuWorker Fashion Mode - Stílus mód + Stílusos mód Efficient Mode @@ -214,7 +210,7 @@ MultitaskingPlugin Multitasking View - Multitasking nézet + Többfeladatos nézet Undock @@ -233,11 +229,11 @@ Disable wireless connection - Vezeték-nélküli kapcsolat megszüntetése + Vezeték nélküli kapcsolat megszüntetése Enable wireless connection - Vezeték-nélküli kapcsolat engedélyezése + Vezeték nélküli kapcsolat engedélyezése Disable network @@ -257,7 +253,7 @@ Wireless connection: %1 - Vezeték-nélküli kapcsolat: %1 + Vezeték nélküli kapcsolat: %1 Wired connection: %1 @@ -273,7 +269,7 @@ Connected but no Internet access - Csatlakozva helyi hálózathoz + Csatlakoztatva, de nincs internet hozzáférés Network cable unplugged @@ -289,7 +285,7 @@ Connection failed - + A kapcsolódás sikertelen @@ -322,7 +318,7 @@ PowerPlugin Power - Kikapcsolás + Energiaellátás Power settings @@ -330,11 +326,11 @@ Capacity %1, %2 min remaining - Akkukapacitás %1, %2 perc van még hátra + Akkumulátor töltöttsége %1, %2 perc van még hátra a feltöltésig Capacity %1, %2 hr %3 min remaining - Akkukapacitás %1, %2 óra %3 perc van még hátra + Akkumulátor töltöttsége %1, %2 óra %3 perc van még hátra a feltöltésig Charging %1, %2 min until full @@ -350,7 +346,7 @@ Capacity %1 - Kapacitás %1 + Akkumulátor töltöttsége %1 Charging %1 @@ -358,11 +354,11 @@ Capacity %1 ... - Kapacitás %1... + Akkumulátor töltöttsége %1 ... Capacity %1, fully charged - Kapacitás %1, teljesen feltöltve + Akkumulátor töltöttsége %1, teljesen feltöltve @@ -380,7 +376,7 @@ ShutdownPlugin Power - Kikapcsolás + Energiaellátás Shut down @@ -388,7 +384,7 @@ Suspend - Felfüggesztés + Alvó állapot Hibernate @@ -421,10 +417,6 @@ Device Eszköz - - Application - Alkalmazás - SoundItem @@ -442,7 +434,7 @@ Volume %1 - Hangerő: %1% + Hangerő: %1 @@ -475,7 +467,7 @@ Empty - Üres + Ürítés @@ -493,7 +485,7 @@ Wireless Network %1 - Vezeték nélküli Hálózat %1 + Vezeték nélküli hálózat %1 \ No newline at end of file diff --git a/translations/dde-dock_it.ts b/translations/dde-dock_it.ts index e61b96621..6495d8838 100644 --- a/translations/dde-dock_it.ts +++ b/translations/dde-dock_it.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Impostazioni Bluetooth @@ -289,7 +285,7 @@ Connection failed - + Connessione fallita @@ -421,10 +417,6 @@ Device Dispositivo - - Application - Applicazioni - SoundItem diff --git a/translations/dde-dock_ja.ts b/translations/dde-dock_ja.ts index 34a1f39de..30b2324e9 100644 --- a/translations/dde-dock_ja.ts +++ b/translations/dde-dock_ja.ts @@ -6,6 +6,58 @@ プラグイン %1 はこのシステムと互換性がありません。 + + AppDragWidget + + Remove + + + + + BluetoothApplet + + Bluetooth settings + Bluetooth設定 + + + + BluetoothItem + + Turn off + オフにする + + + Turn on + オンにする + + + Bluetooth settings + Bluetooth設定 + + + %1 connected + %1が接続されました + + + Connecting... + 接続試行中... + + + Bluetooth + Bluetooth + + + Turned off + オフにしました + + + + BluetoothPlugin + + Bluetooth + Bluetooth + + DBusAdaptors @@ -21,15 +73,15 @@ 12-hour time - + 12時間表示 24-hour time - + 24時間表示 Time settings - + 時間設定 @@ -89,11 +141,18 @@ Unmount all - すべてアンマウント + すべてマウント解除 - DockSettings + LauncherItem + + Launcher + ランチャー + + + + MenuWorker Fashion Mode ファッションモード @@ -147,13 +206,6 @@ プラグイン - - LauncherItem - - Launcher - ランチャー - - MultitaskingPlugin @@ -162,7 +214,78 @@ Undock - ドックから削除 + ドックから外す + + + + NetworkItem + + Disable wired connection + 有線接続を無効にする + + + Enable wired connection + 有線接続を有効にする + + + Disable wireless connection + 無線接続を無効にする + + + Enable wireless connection + 無線接続を有効にする + + + Disable network + ネットワークを無効にする + + + Enable network + ネットワークを有効にする + + + Network settings + ネットワーク設定 + + + Device disabled + デバイスが無効 + + + Wireless connection: %1 + 無線接続: %1 + + + Wired connection: %1 + 有線接続: %1 + + + Not connected + 未接続 + + + Connecting + 接続試行中 + + + Connected but no Internet access + 接続済み、インターネットアクセスなし + + + Network cable unplugged + ネットワークケーブル未接続 + + + Wireless Network + 無線ネットワーク + + + Wired Network + 有線ネットワーク + + + Connection failed + @@ -171,6 +294,14 @@ Network ネットワーク + + Wired Network + 有線ネットワーク + + + Wired Network %1 + 有線ネットワーク %1 + OnboardPlugin @@ -195,11 +326,11 @@ Capacity %1, %2 min remaining - 残量 %1、残り %2 分 + バッテリー残量 %1、残り %2 分 Capacity %1, %2 hr %3 min remaining - 残量 %1、残り %2 時間 %3 分 + バッテリー残量 %1、残り %2 時間 %3 分 Charging %1, %2 min until full @@ -211,11 +342,11 @@ Charged - + 充電完了 Capacity %1 - + バッテリー残量 %1 Charging %1 @@ -223,11 +354,11 @@ Capacity %1 ... - + バッテリー残量 %1... Capacity %1, fully charged - + バッテリー残量 %1、フル充電済み @@ -238,7 +369,7 @@ Undock - ドックから削除 + ドックから外す @@ -286,16 +417,12 @@ Device デバイス - - Application - アプリケーション - SoundItem Unmute - 消音解除 + 消音を解除 Mute @@ -303,11 +430,11 @@ Sound settings - + サウンドの設定 Volume %1 - + 音量 %1 @@ -350,32 +477,6 @@ システムトレイ - - WiredItem - - Unknown - 不明 - - - Wired connection: %1 - 有線接続: %1 - - - - WirelessItem - - No Network - ネットワークなし - - - Connected but no Internet access - 接続済み、インターネットアクセスなし - - - Wireless connection: %1 - - - WirelessList diff --git a/translations/dde-dock_ko.ts b/translations/dde-dock_ko.ts index 40dedd9c1..6a7e3f201 100644 --- a/translations/dde-dock_ko.ts +++ b/translations/dde-dock_ko.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - 블루투스 - Bluetooth settings 블루투스 설정 @@ -421,10 +417,6 @@ Device 장치 - - Application - 응용프로그램 - SoundItem diff --git a/translations/dde-dock_lt.ts b/translations/dde-dock_lt.ts index a6e2161a5..7dee3fb13 100644 --- a/translations/dde-dock_lt.ts +++ b/translations/dde-dock_lt.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth nustatymai @@ -421,10 +417,6 @@ Device Įrenginys - - Application - Programa - SoundItem diff --git a/translations/dde-dock_ms.ts b/translations/dde-dock_ms.ts index d92824064..ef364edaf 100644 --- a/translations/dde-dock_ms.ts +++ b/translations/dde-dock_ms.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Tetapan Bluetooth @@ -40,11 +36,11 @@ %1 connected - + %1 bersambung Connecting... - + Menyambung... Bluetooth @@ -52,7 +48,7 @@ Turned off - + Dimatikan @@ -218,26 +214,26 @@ Undock - Nyahlabuh + Tanggal NetworkItem Disable wired connection - + Lumpuhkan sambungan berwayar Enable wired connection - + Benarkan sambungan berwayar Disable wireless connection - + Lumpuhkan sambungan tanpa wayar Enable wireless connection - + Benarkan sambungan tanpa wayar Disable network @@ -350,7 +346,7 @@ Capacity %1 - + Kapasiti %1 Charging %1 @@ -358,22 +354,22 @@ Capacity %1 ... - + Kapasiti %1 ... Capacity %1, fully charged - + Kapasiti %1, sepenuhnya dicas ShowDesktopPlugin Show Desktop - Tunjuk Desktop + Tunjuk Atas Meja Undock - Nyahlabuh + Tanggal @@ -421,10 +417,6 @@ Device Peranti - - Application - Aplikasi - SoundItem diff --git a/translations/dde-dock_nl.ts b/translations/dde-dock_nl.ts index 47ab5560c..aa3714247 100644 --- a/translations/dde-dock_nl.ts +++ b/translations/dde-dock_nl.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth-instellingen @@ -214,7 +210,7 @@ MultitaskingPlugin Multitasking View - Multitaskingoverzicht + Venster- en werkbladoverzicht Undock @@ -289,7 +285,7 @@ Connection failed - + Verbinding mislukt @@ -421,10 +417,6 @@ Device Apparaat - - Application - Programma - SoundItem diff --git a/translations/dde-dock_pl.ts b/translations/dde-dock_pl.ts index 2dc463f9c..32d496a64 100644 --- a/translations/dde-dock_pl.ts +++ b/translations/dde-dock_pl.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Ustawienia Bluetooth @@ -289,7 +285,7 @@ Connection failed - + Połączenie nieudane @@ -421,10 +417,6 @@ Device Urządzenie - - Application - Program - SoundItem diff --git a/translations/dde-dock_pt.ts b/translations/dde-dock_pt.ts index 518de8a22..fe6296e7c 100644 --- a/translations/dde-dock_pt.ts +++ b/translations/dde-dock_pt.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Definições bluetooth @@ -36,7 +32,7 @@ Bluetooth settings - Definições bluetooth + Definições Bluetooth %1 connected @@ -214,7 +210,7 @@ MultitaskingPlugin Multitasking View - Vista de tarefas + Vista de Tarefas Undock @@ -289,7 +285,7 @@ Connection failed - + Falha na ligação @@ -421,10 +417,6 @@ Device Dispositivo - - Application - Aplicação - SoundItem diff --git a/translations/dde-dock_pt_BR.ts b/translations/dde-dock_pt_BR.ts index f47b93b9c..b7c5229e6 100644 --- a/translations/dde-dock_pt_BR.ts +++ b/translations/dde-dock_pt_BR.ts @@ -15,13 +15,9 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings - Configurações de Bluetooth + Configurações do Bluetooth @@ -289,7 +285,7 @@ Connection failed - + A conexão falhou @@ -421,10 +417,6 @@ Device Dispositivo - - Application - Aplicativo - SoundItem diff --git a/translations/dde-dock_ro.ts b/translations/dde-dock_ro.ts index b8a46340e..c62dc3bba 100644 --- a/translations/dde-dock_ro.ts +++ b/translations/dde-dock_ro.ts @@ -15,36 +15,32 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings - + Setări Bluetooth BluetoothItem Turn off - + Oprește Turn on - + Pornește Bluetooth settings - + Setări Bluetooth %1 connected - + %1 conectat Connecting... - + Conectare... Bluetooth @@ -52,7 +48,7 @@ Turned off - + Oprit @@ -346,11 +342,11 @@ Charged - + Încărcat Capacity %1 - + Capactitate %1 Charging %1 @@ -358,11 +354,11 @@ Capacity %1 ... - + Capactitate %1 .... Capacity %1, fully charged - + Capacitate %1, complet încărcat @@ -421,10 +417,6 @@ Device Dispozitiv - - Application - Aplicație - SoundItem diff --git a/translations/dde-dock_ru.ts b/translations/dde-dock_ru.ts index 479d20883..989d84915 100644 --- a/translations/dde-dock_ru.ts +++ b/translations/dde-dock_ru.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Настройки Bluetooth @@ -421,10 +417,6 @@ Device Устройство - - Application - Приложение - SoundItem @@ -442,7 +434,7 @@ Volume %1 - Том %1 + Громкость %1 diff --git a/translations/dde-dock_si.ts b/translations/dde-dock_si.ts index 4bd9e6a90..38729ccb2 100644 --- a/translations/dde-dock_si.ts +++ b/translations/dde-dock_si.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - බ්ලූටූත් - Bluetooth settings බ්ලූටූත් සැකසුම් @@ -421,10 +417,6 @@ Device උපාංගය - - Application - යෙදවුම - SoundItem diff --git a/translations/dde-dock_sk.ts b/translations/dde-dock_sk.ts index 5f5fa234d..527019707 100644 --- a/translations/dde-dock_sk.ts +++ b/translations/dde-dock_sk.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings @@ -421,10 +417,6 @@ Device Zariadenie - - Application - Aplikácia - SoundItem diff --git a/translations/dde-dock_sl.ts b/translations/dde-dock_sl.ts index 366ce593e..fbdf262ec 100644 --- a/translations/dde-dock_sl.ts +++ b/translations/dde-dock_sl.ts @@ -3,33 +3,85 @@ AbstractPluginsController The plugin %1 is not compatible with the system. + Vtičnik %1 ni združljiv s sistemom. + + + + AppDragWidget + + Remove + + BluetoothApplet + + Bluetooth settings + Bluetooth nastavitve + + + + BluetoothItem + + Turn off + Izklopi + + + Turn on + Vklopi + + + Bluetooth settings + Bluetooth nastavitve + + + %1 connected + %1 je povezan + + + Connecting... + Povezovanje... + + + Bluetooth + Bluetooth + + + Turned off + Izklopljen + + + + BluetoothPlugin + + Bluetooth + Bluetooth + + DBusAdaptors Add keyboard layout - Dodaj razpored + Dodaj razpored tipk DatetimePlugin Datetime - Datumčas + Datum in čas - 12 Hour Time - 12-urni čas + 12-hour time + 12 urni čas - 24 Hour Time - 24-urni čas + 24-hour time + 24 urni čas - Time Settings - Nastavitev časa + Time settings + Nastavitve časa @@ -51,7 +103,7 @@ DialogManager Are you sure you want to empty %1 items? - + Želite počisiti %1 predmetov? Cancel @@ -89,11 +141,18 @@ Unmount all - Izvrzi vse + Odklopi vse - DockSettings + LauncherItem + + Launcher + Zaganjalnik + + + + MenuWorker Fashion Mode Modni način @@ -147,21 +206,85 @@ Vtičniki - - LauncherItem - - Launcher - Zaganjalnik - - MultitaskingPlugin Multitasking View - + Prikaz večopravilnosti Undock + Odveži + + + + NetworkItem + + Disable wired connection + Onemogoči žično povezavo + + + Enable wired connection + Omogoči žično povezavo + + + Disable wireless connection + Onemogoči brezžično povezavo + + + Enable wireless connection + Omogoči brezžično povezavo + + + Disable network + Onemogoči omrežje + + + Enable network + Omogoči omrežje + + + Network settings + Nastavitve omrežja + + + Device disabled + Naprava onemogočena + + + Wireless connection: %1 + Brezžična povezava: %1 + + + Wired connection: %1 + Žična povezava: %1 + + + Not connected + Brez povezave + + + Connecting + Povezovanje + + + Connected but no Internet access + Povezano, brez dostopa do spleta + + + Network cable unplugged + Omrežni kabel je izklopljen + + + Wireless Network + Brezžično omrežje + + + Wired Network + Žično omrežje + + + Connection failed @@ -171,12 +294,20 @@ Network Omrežje + + Wired Network + Žično omrežje + + + Wired Network %1 + Žično omrežje %1 + OnboardPlugin Onboard - + Na plošči Settings @@ -195,32 +326,40 @@ Capacity %1, %2 min remaining - + Zmogljivost %1 za %2 min Capacity %1, %2 hr %3 min remaining - - - - Charged %1 - Napolnjeno %1 + Zmogljivost %1 za %2 ur in %3 min Charging %1, %2 min until full - + Polnjenje %1 bo končano čez %2 min Charging %1, %2 hr %3 min until full - - - - Charging %1 .... - + Polnjenje %1 bo končano čez %2 ur in %3 min Charged Napolnjen + + Capacity %1 + Zmogljivost %1 + + + Charging %1 + Polnim %1 + + + Capacity %1 ... + Zmogljvost %1 .. + + + Capacity %1, fully charged + Zmogljivost %1 - polno + ShowDesktopPlugin @@ -230,7 +369,7 @@ Undock - + Odveži @@ -243,17 +382,13 @@ Shut down Zaustavitev sistema - - Restart - Vnovični zagon - Suspend - V način mirovanja + Mirovanje Hibernate - Mirovanje + Spanje Lock @@ -271,6 +406,10 @@ Power settings Nastavitve energijske porabe + + Reboot + Ponovni zagon + SoundApplet @@ -278,10 +417,6 @@ Device Naprava - - Application - Program - SoundItem @@ -294,12 +429,12 @@ Utišaj - Audio Settings - Zvočne nastavitve + Sound settings + Nastavitve zvoka - Current Volume %1 - Trenutna glasnost %1 + Volume %1 + Glasnost %1 @@ -342,32 +477,6 @@ Sistemski pladenj - - WiredItem - - Unknown - Neznano - - - Wired connection: %1 - Žična povezava: %1 - - - - WirelessItem - - No Network - Ni omrežij - - - Wireless Connection: %1 - Brezžična povezava: %1 - - - Connected but no Internet access - Povezano brez dostopa do interneta - - WirelessList diff --git a/translations/dde-dock_sq.ts b/translations/dde-dock_sq.ts index 3ea486d25..da091838d 100644 --- a/translations/dde-dock_sq.ts +++ b/translations/dde-dock_sq.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Rregullime Bluetooth-i @@ -163,11 +159,11 @@ Efficient Mode - Mënyrë Efikase + Mënyra Efikase Top - Sipër + Në Krye Bottom @@ -289,7 +285,7 @@ Connection failed - + Lidhja dështoi @@ -421,10 +417,6 @@ Device Pajisje - - Application - Aplikacion - SoundItem diff --git a/translations/dde-dock_sr.ts b/translations/dde-dock_sr.ts index 89c75fb3f..7fb75a3a9 100644 --- a/translations/dde-dock_sr.ts +++ b/translations/dde-dock_sr.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Блутут - Bluetooth settings Блутут подешавања @@ -289,7 +285,7 @@ Connection failed - + Неуспешно повезивање @@ -421,10 +417,6 @@ Device Уређај - - Application - Програм - SoundItem diff --git a/translations/dde-dock_tr.ts b/translations/dde-dock_tr.ts index 7dd100221..8b3830c60 100644 --- a/translations/dde-dock_tr.ts +++ b/translations/dde-dock_tr.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Bluetooth ayarları @@ -289,7 +285,7 @@ Connection failed - + Bağlantı başarısız @@ -421,10 +417,6 @@ Device Aygıt - - Application - Uygulama - SoundItem diff --git a/translations/dde-dock_ug.ts b/translations/dde-dock_ug.ts index b0efe334b..7541f79af 100644 --- a/translations/dde-dock_ug.ts +++ b/translations/dde-dock_ug.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - كۆكچىش - Bluetooth settings كۆكچىش تەڭشىكى @@ -289,7 +285,7 @@ Connection failed - + ئۇلىنىش مەغلۇپ بولدى @@ -421,10 +417,6 @@ Device ئۈسكۈنە - - Application - ئەپلەر - SoundItem diff --git a/translations/dde-dock_uk.ts b/translations/dde-dock_uk.ts index 661801f75..92e40cd9e 100644 --- a/translations/dde-dock_uk.ts +++ b/translations/dde-dock_uk.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Параметри Bluetooth @@ -289,7 +285,7 @@ Connection failed - + Не вдалося встановити з'єднання @@ -421,10 +417,6 @@ Device Пристрій - - Application - Програма - SoundItem diff --git a/translations/dde-dock_vi.ts b/translations/dde-dock_vi.ts index aacacd7ff..a34e34418 100644 --- a/translations/dde-dock_vi.ts +++ b/translations/dde-dock_vi.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - Bluetooth - Bluetooth settings Cài đặt Blurtooth @@ -421,10 +417,6 @@ Device Thiết bị - - Application - Ứng dụng - SoundItem diff --git a/translations/dde-dock_zh_CN.ts b/translations/dde-dock_zh_CN.ts index 210b0c587..d2ef5acb1 100644 --- a/translations/dde-dock_zh_CN.ts +++ b/translations/dde-dock_zh_CN.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - 蓝牙 - Bluetooth settings 蓝牙设置 @@ -28,11 +24,11 @@ BluetoothItem Turn off - 关闭蓝牙 + 关闭 Turn on - 开启蓝牙 + 开启 Bluetooth settings @@ -421,10 +417,6 @@ Device 设备 - - Application - 应用 - SoundItem diff --git a/translations/dde-dock_zh_HK.ts b/translations/dde-dock_zh_HK.ts index 9eefabdf6..c67c98581 100644 --- a/translations/dde-dock_zh_HK.ts +++ b/translations/dde-dock_zh_HK.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - 藍牙 - Bluetooth settings 藍牙設置 @@ -28,11 +24,11 @@ BluetoothItem Turn off - 關閉藍牙 + 關閉 Turn on - 開啟藍牙 + 開啟 Bluetooth settings @@ -141,7 +137,7 @@ Open - 開啟 + 打開 Unmount all @@ -400,7 +396,7 @@ Log out - 登出 + 註銷 Switch account @@ -421,10 +417,6 @@ Device 裝置 - - Application - 應用 - SoundItem @@ -471,7 +463,7 @@ TrashWidget Open - 開啟 + 打開 Empty diff --git a/translations/dde-dock_zh_TW.ts b/translations/dde-dock_zh_TW.ts index 159b32e62..62002c67d 100644 --- a/translations/dde-dock_zh_TW.ts +++ b/translations/dde-dock_zh_TW.ts @@ -15,10 +15,6 @@ BluetoothApplet - - Bluetooth - 藍牙 - Bluetooth settings 藍牙設定 @@ -28,11 +24,11 @@ BluetoothItem Turn off - 關閉藍牙 + 關閉 Turn on - 開啟藍牙 + 開啟 Bluetooth settings @@ -421,10 +417,6 @@ Device 裝置 - - Application - 應用程式 - SoundItem From 4c85face8ba00aae398dd1fae3a0b4b6727a7c3a Mon Sep 17 00:00:00 2001 From: yangyuyin Date: Wed, 6 Jan 2021 17:52:20 +0800 Subject: [PATCH 38/38] =?UTF-8?q?fix:=20=E5=85=B3=E9=97=AD=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E7=89=B9=E6=95=88=E6=A8=A1=E5=BC=8F=EF=BC=8C=E5=B7=B2?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=9A=84=E7=9A=84=E5=BA=94=E7=94=A8=E5=9C=A8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A0=8F=E4=B8=8Atooltip=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=A0=B9=E6=8D=AE=E6=96=87=E6=A1=88=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E8=87=AA=E9=80=82=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改自定义类PreviewContainer,tooltop窗口宽度根据应用名称进行自适应调整 Log: 关闭窗口特效模式,已打开的的应用在任务栏上tooltip窗口没有根据文案长度自适应 Bug: https://pms.uniontech.com/zentao/bug-view-59714.html Change-Id: Iaaed00e26cd6f4f0e9e5ea68b24443ab7c1b3d8c --- frame/item/components/previewcontainer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/frame/item/components/previewcontainer.cpp b/frame/item/components/previewcontainer.cpp index 2cc081586..d29f01126 100644 --- a/frame/item/components/previewcontainer.cpp +++ b/frame/item/components/previewcontainer.cpp @@ -140,7 +140,18 @@ void PreviewContainer::adjustSize() if (!composite) { const int h = SNAP_HEIGHT_WITHOUT_COMPOSITE * count + MARGIN * 2 + SPACING * (count - 1); - setFixedSize(SNAP_WIDTH, h); + + //根据appitem title 设置自适应宽度 + auto appSnapshot = static_cast(this->layout()->itemAt(0)->widget()); + auto font = appSnapshot->layout()->itemAt(0)->widget()->font(); + QFontMetrics fontMetrics(font); + const int fontSize = fontMetrics.boundingRect(appSnapshot->title()).width(); + //预留字体到边缘的间距,边缘距离10px,关闭按钮24px + if (fontSize < SNAP_WIDTH - 44) + setFixedSize(fontSize + 44, h); + else + setFixedSize(SNAP_WIDTH, h); + return; }