diff --git a/frame/controller/dockitemmanager.cpp b/frame/controller/dockitemmanager.cpp index f8bdd9f6b..825bc1c17 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 fa7943668..579554cc7 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; 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 e930ddeec..b9aa00855 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/item/components/previewcontainer.cpp b/frame/item/components/previewcontainer.cpp index 82f9810ec..e4d6166ed 100644 --- a/frame/item/components/previewcontainer.cpp +++ b/frame/item/components/previewcontainer.cpp @@ -143,7 +143,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; } 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; } - diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 086f1791d..935ab509a 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); } @@ -341,6 +342,9 @@ void MainPanelControl::insertItem(int index, DockItem *item) break; } resizeDockIcon(); + QTimer::singleShot(0, [ = ] { + updatePluginsLayout(); + }); } void MainPanelControl::removeItem(DockItem *item) @@ -401,6 +405,9 @@ void MainPanelControl::moveItem(DockItem *sourceItem, DockItem *targetItem) removeItem(sourceItem); // insert new position + if (sourceItem->isDragging()) { + m_dragIndex = idx; + } insertItem(idx, sourceItem); } @@ -509,8 +516,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); @@ -685,6 +694,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(); @@ -708,15 +736,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) @@ -848,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(); } @@ -1040,15 +1077,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)) { @@ -1057,18 +1085,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; } } } @@ -1079,18 +1098,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; } } } diff --git a/frame/panel/mainpanelcontrol.h b/frame/panel/mainpanelcontrol.h index 215528f8b..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); @@ -145,6 +146,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 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)); } diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 27e4e32bf..d5a0a93f0 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(); + } } } } @@ -741,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())); @@ -754,12 +765,14 @@ void MultiScreenWorker::onRequestNotifyWindowManager() // 除了"一直显示"模式,其他的都不要设置任务栏区域 if (m_hideMode != Dock::KeepShowing) { + lastRect = QRect(); 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; @@ -775,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; @@ -791,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); } @@ -943,7 +948,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); @@ -977,7 +982,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); @@ -990,6 +1002,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); @@ -1451,9 +1469,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); 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/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 0ac77a843..4dc1dd8b2 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); @@ -355,30 +356,21 @@ 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) 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 b8670b1de..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 @@ -45,21 +45,26 @@ 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()) { + setAccessibleName("BluetoothPluginItem"); m_applet->setVisible(false); - m_adapterPowered = m_applet->poweredInitState(); + 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() @@ -124,9 +129,6 @@ void BluetoothItem::invokeMenuItem(const QString menuId, const bool checked) void BluetoothItem::refreshIcon() { - if (!m_applet) - return; - QString stateString; QString iconString; @@ -160,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); @@ -223,4 +222,3 @@ void BluetoothItem::paintEvent(QPaintEvent *event) const QRectF &rfp = QRectF(m_iconPixmap.rect()); painter.drawPixmap(rf.center() - rfp.center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap); } - 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 0afd571fb..000000000 --- a/plugins/bluetooth/componments/adapteritem.cpp +++ /dev/null @@ -1,362 +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::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) - 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; - qSort(m_sortUnConnect); - 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; - qSort(m_sortConnected); - 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(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); - 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) -{ - if (m_sortConnected.size()) - qSort(m_sortConnected); - if (m_sortUnConnect.size()) - qSort(m_sortUnConnect); - - QList deviceItems; - deviceItems << m_sortConnected << m_sortUnConnect; - - // 在蓝牙关闭的时候,会出现不在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 8564f0d4d..000000000 --- a/plugins/bluetooth/componments/adapteritem.h +++ /dev/null @@ -1,89 +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 deviceRssiChanged(); - 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 2421d8e8f..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()); @@ -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); @@ -167,19 +171,23 @@ 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(); 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) { @@ -189,13 +197,17 @@ 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(); 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) { @@ -207,13 +219,17 @@ 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(); 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; } } 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 3523e7a33..000000000 --- a/plugins/bluetooth/componments/deviceitem.cpp +++ /dev/null @@ -1,194 +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()); -} - -bool DeviceItem::operator <(const DeviceItem &item) -{ - return this->device()->deviceTime() < item.device()->deviceTime(); -} - -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 6aec96973..000000000 --- a/plugins/bluetooth/componments/deviceitem.h +++ /dev/null @@ -1,98 +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); - bool operator <(const DeviceItem &item); - - 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 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" } diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index a3151664e..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,6 +85,10 @@ void DatetimeWidget::setShortDateFormat(int type) default: m_shortDateFormat = "yyyy-MM-dd"; break; } update(); + + if (isVisible()) { + emit requestUpdateGeometry(); + } } /** @@ -100,6 +103,10 @@ void DatetimeWidget::setShortTimeFormat(int type) default: m_shortTimeFormat = "hh:mm"; break; } update(); + + if (isVisible()) { + emit requestUpdateGeometry(); + } } QSize DatetimeWidget::curTimeSize() const @@ -135,7 +142,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 +157,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()); } } 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; 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