diff --git a/frame/CMakeLists.txt b/frame/CMakeLists.txt index 349240696..f4bd8183f 100644 --- a/frame/CMakeLists.txt +++ b/frame/CMakeLists.txt @@ -5,7 +5,7 @@ set(BIN_NAME dde-dock) configure_file(environments.h.in environments.h @ONLY) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../widgets/*.h" "../widgets/*.cpp") # Find the library find_package(PkgConfig REQUIRED) diff --git a/frame/item/appitem.h b/frame/item/appitem.h index 47c6d78d8..acbb44594 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -25,7 +25,7 @@ #include "dockitem.h" #include "components/previewcontainer.h" #include "dbus/dbusclientmanager.h" -#include "item/tipswidget.h" +#include "../widgets/tipswidget.h" #include #include diff --git a/frame/item/launcheritem.h b/frame/item/launcheritem.h index 33518d588..d31719a33 100644 --- a/frame/item/launcheritem.h +++ b/frame/item/launcheritem.h @@ -23,7 +23,7 @@ #define LAUNCHERITEM_H #include "dockitem.h" -#include "tipswidget.h" +#include "../widgets/tipswidget.h" class LauncherItem : public DockItem { diff --git a/plugins/datetime/CMakeLists.txt b/plugins/datetime/CMakeLists.txt index d537b9b2b..83faf795f 100644 --- a/plugins/datetime/CMakeLists.txt +++ b/plugins/datetime/CMakeLists.txt @@ -4,7 +4,7 @@ set(PLUGIN_NAME "datetime") project(${PLUGIN_NAME}) # Sources files -file(GLOB SRCS "*.h" "*.cpp") +file(GLOB SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/datetime/datetimeplugin.cpp b/plugins/datetime/datetimeplugin.cpp index e1ef4c0cf..5bd589b6f 100644 --- a/plugins/datetime/datetimeplugin.cpp +++ b/plugins/datetime/datetimeplugin.cpp @@ -28,14 +28,12 @@ DatetimePlugin::DatetimePlugin(QObject *parent) : QObject(parent), - m_dateTipsLabel(new QLabel), + m_dateTipsLabel(new TipsWidget), m_refershTimer(new QTimer(this)), m_settings("deepin", "dde-dock-datetime") { m_dateTipsLabel->setObjectName("datetime"); - m_dateTipsLabel->setStyleSheet("color:white;" - "padding:0px 3px;"); m_refershTimer->setInterval(1000); m_refershTimer->start(); diff --git a/plugins/datetime/datetimeplugin.h b/plugins/datetime/datetimeplugin.h index 80d1b7426..d355b5118 100644 --- a/plugins/datetime/datetimeplugin.h +++ b/plugins/datetime/datetimeplugin.h @@ -24,6 +24,7 @@ #include "pluginsiteminterface.h" #include "datetimewidget.h" +#include "../../widgets/tipswidget.h" #include #include @@ -62,7 +63,7 @@ private slots: private: QPointer m_centralWidget; - QPointer m_dateTipsLabel; + QPointer m_dateTipsLabel; QTimer *m_refershTimer; diff --git a/plugins/network/CMakeLists.txt b/plugins/network/CMakeLists.txt index 84bec3f00..9cae2c00d 100644 --- a/plugins/network/CMakeLists.txt +++ b/plugins/network/CMakeLists.txt @@ -4,7 +4,7 @@ set(PLUGIN_NAME "network") project(${PLUGIN_NAME}) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/network/item/applet/devicecontrolwidget.cpp b/plugins/network/item/applet/devicecontrolwidget.cpp index 813079c28..4d36559d7 100644 --- a/plugins/network/item/applet/devicecontrolwidget.cpp +++ b/plugins/network/item/applet/devicecontrolwidget.cpp @@ -21,6 +21,7 @@ #include "devicecontrolwidget.h" #include "horizontalseperator.h" +#include "../widgets/tipswidget.h" #include #include @@ -33,9 +34,8 @@ DWIDGET_USE_NAMESPACE DeviceControlWidget::DeviceControlWidget(QWidget *parent) : QWidget(parent) { - m_deviceName = new QLabel; + m_deviceName = new TipsWidget; m_deviceName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - m_deviceName->setStyleSheet("color:white;"); m_switchBtn = new DSwitchButton; diff --git a/plugins/network/item/applet/devicecontrolwidget.h b/plugins/network/item/applet/devicecontrolwidget.h index 6c5bb11ac..d70612c40 100644 --- a/plugins/network/item/applet/devicecontrolwidget.h +++ b/plugins/network/item/applet/devicecontrolwidget.h @@ -30,7 +30,7 @@ #include DWIDGET_USE_NAMESPACE - +class TipsWidget; class DeviceControlWidget : public QWidget { Q_OBJECT @@ -53,7 +53,7 @@ private slots: void refreshNetwork(); private: - QLabel *m_deviceName; + TipsWidget *m_deviceName; Dtk::Widget::DSwitchButton *m_switchBtn; // HorizontalSeperator *m_seperator; DLoadingIndicator *m_loadingIndicator; diff --git a/plugins/network/item/wireditem.cpp b/plugins/network/item/wireditem.cpp index 0d9050702..6fe30c878 100644 --- a/plugins/network/item/wireditem.cpp +++ b/plugins/network/item/wireditem.cpp @@ -23,6 +23,7 @@ #include "constants.h" #include "wireditem.h" #include "util/imageutil.h" +#include "../widgets/tipswidget.h" #include #include @@ -34,7 +35,7 @@ using namespace dde::network; WiredItem::WiredItem(WiredDevice *device) : DeviceItem(device), - m_itemTips(new QLabel(this)), + m_itemTips(new TipsWidget(this)), m_delayTimer(new QTimer(this)) { // QIcon::setThemeName("deepin"); @@ -44,8 +45,6 @@ WiredItem::WiredItem(WiredDevice *device) m_itemTips->setObjectName("wired-" + m_device->path()); m_itemTips->setVisible(false); - m_itemTips->setStyleSheet("color:white;" - "padding:0px 3px;"); connect(m_delayTimer, &QTimer::timeout, this, &WiredItem::reloadIcon); connect(m_device, static_cast(&NetworkDevice::statusChanged), this, &WiredItem::deviceStateChanged); diff --git a/plugins/network/item/wireditem.h b/plugins/network/item/wireditem.h index 0999b03cc..372c0434e 100644 --- a/plugins/network/item/wireditem.h +++ b/plugins/network/item/wireditem.h @@ -30,6 +30,7 @@ #include +class TipsWidget; class WiredItem : public DeviceItem { Q_OBJECT @@ -53,7 +54,7 @@ private slots: private: QPixmap m_icon; - QLabel *m_itemTips; + TipsWidget *m_itemTips; QTimer *m_delayTimer; }; diff --git a/plugins/network/item/wirelessitem.cpp b/plugins/network/item/wirelessitem.cpp index 1bea33aca..33960e013 100644 --- a/plugins/network/item/wirelessitem.cpp +++ b/plugins/network/item/wirelessitem.cpp @@ -21,6 +21,7 @@ #include "wirelessitem.h" #include "util/imageutil.h" +#include "../widgets/tipswidget.h" #include #include @@ -34,7 +35,7 @@ WirelessItem::WirelessItem(WirelessDevice *device) m_refershTimer(new QTimer(this)), m_wirelessApplet(new QWidget), - m_wirelessPopup(new QLabel), + m_wirelessPopup(new TipsWidget), m_APList(nullptr) { m_refershTimer->setSingleShot(false); @@ -43,8 +44,6 @@ WirelessItem::WirelessItem(WirelessDevice *device) m_wirelessApplet->setVisible(false); m_wirelessPopup->setObjectName("wireless-" + m_device->path()); m_wirelessPopup->setVisible(false); - m_wirelessPopup->setStyleSheet("color:white;" - "padding: 0px 3px;"); connect(m_device, static_cast(&NetworkDevice::statusChanged), m_refershTimer, static_cast(&QTimer::start)); connect(static_cast(m_device), &WirelessDevice::activeApInfoChanged, m_refershTimer, static_cast(&QTimer::start)); diff --git a/plugins/network/item/wirelessitem.h b/plugins/network/item/wirelessitem.h index 7cca9d7ee..1047153cd 100644 --- a/plugins/network/item/wirelessitem.h +++ b/plugins/network/item/wirelessitem.h @@ -32,6 +32,7 @@ #include +class TipsWidget; class WirelessItem : public DeviceItem { Q_OBJECT @@ -77,7 +78,7 @@ private: QTimer *m_refershTimer; QWidget *m_wirelessApplet; - QLabel *m_wirelessPopup; + TipsWidget *m_wirelessPopup; WirelessList *m_APList; }; diff --git a/plugins/shutdown/CMakeLists.txt b/plugins/shutdown/CMakeLists.txt index 06b7063bd..67a4d4304 100644 --- a/plugins/shutdown/CMakeLists.txt +++ b/plugins/shutdown/CMakeLists.txt @@ -4,7 +4,7 @@ set(PLUGIN_NAME "shutdown") project(${PLUGIN_NAME}) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/shutdown/shutdownplugin.cpp b/plugins/shutdown/shutdownplugin.cpp index 9941a6964..a0e48b198 100644 --- a/plugins/shutdown/shutdownplugin.cpp +++ b/plugins/shutdown/shutdownplugin.cpp @@ -33,15 +33,12 @@ ShutdownPlugin::ShutdownPlugin(QObject *parent) m_settings("deepin", "dde-dock-power"), m_shutdownWidget(new PluginWidget), m_powerStatusWidget(new PowerStatusWidget), - m_tipsLabel(new QLabel), + m_tipsLabel(new TipsWidget), m_powerInter(new DBusPower(this)) { m_tipsLabel->setVisible(false); m_tipsLabel->setObjectName("power"); - m_tipsLabel->setAlignment(Qt::AlignCenter); - m_tipsLabel->setStyleSheet("color:white;" - "padding: 0px 3px;"); connect(m_powerInter, &DBusPower::BatteryPercentageChanged, this, &ShutdownPlugin::updateBatteryVisible); connect(m_shutdownWidget, &PluginWidget::requestContextMenu, this, &ShutdownPlugin::requestContextMenu); diff --git a/plugins/shutdown/shutdownplugin.h b/plugins/shutdown/shutdownplugin.h index 8d804d784..328620331 100644 --- a/plugins/shutdown/shutdownplugin.h +++ b/plugins/shutdown/shutdownplugin.h @@ -26,6 +26,7 @@ #include "pluginwidget.h" #include "powerstatuswidget.h" #include "dbus/dbuspower.h" +#include "../widgets/tipswidget.h" #include @@ -68,7 +69,7 @@ private: QSettings m_settings; PluginWidget *m_shutdownWidget; PowerStatusWidget *m_powerStatusWidget; - QLabel *m_tipsLabel; + TipsWidget *m_tipsLabel; DBusPower *m_powerInter; }; diff --git a/plugins/sound/CMakeLists.txt b/plugins/sound/CMakeLists.txt index 019d75db1..46ffd0322 100644 --- a/plugins/sound/CMakeLists.txt +++ b/plugins/sound/CMakeLists.txt @@ -4,7 +4,7 @@ set(PLUGIN_NAME "sound") project(${PLUGIN_NAME}) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index fefba8c00..1069d950c 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -22,6 +22,7 @@ #include "soundapplet.h" #include "sinkinputwidget.h" #include "componments/horizontalseparator.h" +#include "../widgets/tipswidget.h" #include #include @@ -50,9 +51,8 @@ SoundApplet::SoundApplet(QWidget *parent) m_volumeBtn->setAccessibleName("volume-button"); m_volumeSlider->setAccessibleName("volume-slider"); - QLabel *deviceLabel = new QLabel; + TipsWidget *deviceLabel = new TipsWidget; deviceLabel->setText(tr("Device")); - deviceLabel->setStyleSheet("color:white;"); QHBoxLayout *deviceLineLayout = new QHBoxLayout; deviceLineLayout->addWidget(deviceLabel); @@ -69,9 +69,8 @@ SoundApplet::SoundApplet(QWidget *parent) volumeCtrlLayout->setSpacing(0); volumeCtrlLayout->setMargin(0); - QLabel *appLabel = new QLabel; + TipsWidget *appLabel = new TipsWidget; appLabel->setText(tr("Application")); - appLabel->setStyleSheet("color:white;"); QHBoxLayout *appLineHLayout = new QHBoxLayout; appLineHLayout->addWidget(appLabel); diff --git a/plugins/sound/sounditem.cpp b/plugins/sound/sounditem.cpp index f45885d10..2ba114565 100644 --- a/plugins/sound/sounditem.cpp +++ b/plugins/sound/sounditem.cpp @@ -28,6 +28,7 @@ #include #include #include +#include "../widgets/tipswidget.h" // menu actions #define MUTE "mute" @@ -38,18 +39,12 @@ DWIDGET_USE_NAMESPACE SoundItem::SoundItem(QWidget *parent) : QWidget(parent), - m_tipsLabel(new QLabel(this)), + m_tipsLabel(new TipsWidget(this)), m_applet(new SoundApplet(this)), m_sinkInter(nullptr) { -// QIcon::setThemeName("deepin"); - m_tipsLabel->setObjectName("sound"); m_tipsLabel->setVisible(false); - // m_tipsLabel->setFixedWidth(145); - m_tipsLabel->setAlignment(Qt::AlignCenter); - m_tipsLabel->setStyleSheet("color:white;" - "padding: 0 3px;"); m_applet->setVisible(false); diff --git a/plugins/sound/sounditem.h b/plugins/sound/sounditem.h index 38d134fea..2b9454758 100644 --- a/plugins/sound/sounditem.h +++ b/plugins/sound/sounditem.h @@ -27,6 +27,7 @@ #include +class TipsWidget; class SoundItem : public QWidget { Q_OBJECT @@ -56,7 +57,7 @@ private slots: void sinkChanged(DBusSink *sink); private: - QLabel *m_tipsLabel; + TipsWidget *m_tipsLabel; SoundApplet *m_applet; DBusSink *m_sinkInter; QPixmap m_iconPixmap; diff --git a/plugins/system-tray/CMakeLists.txt b/plugins/system-tray/CMakeLists.txt index 75c504c07..16e22ff45 100644 --- a/plugins/system-tray/CMakeLists.txt +++ b/plugins/system-tray/CMakeLists.txt @@ -4,7 +4,7 @@ set(PLUGIN_NAME "system-tray") project(${PLUGIN_NAME}) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/system-tray/systemtrayplugin.cpp b/plugins/system-tray/systemtrayplugin.cpp index d5247af36..a243acd45 100644 --- a/plugins/system-tray/systemtrayplugin.cpp +++ b/plugins/system-tray/systemtrayplugin.cpp @@ -27,6 +27,7 @@ #include #include +#include "../widgets/tipswidget.h" #include "xcb/xcb_icccm.h" #define FASHION_MODE_ITEM "fashion-mode-item" @@ -35,7 +36,7 @@ SystemTrayPlugin::SystemTrayPlugin(QObject *parent) : QObject(parent), m_trayInter(new DBusTrayManager(this)), m_trayApplet(new TrayApplet), - m_tipsLabel(new QLabel), + m_tipsLabel(new TipsWidget), m_containerSettings(new QSettings("deepin", "dde-dock-tray")) { @@ -45,8 +46,6 @@ SystemTrayPlugin::SystemTrayPlugin(QObject *parent) m_tipsLabel->setObjectName("sys-tray"); m_tipsLabel->setText(tr("System Tray")); m_tipsLabel->setVisible(false); - m_tipsLabel->setStyleSheet("color:white;" - "padding: 0 3px;"); } const QString SystemTrayPlugin::pluginName() const diff --git a/plugins/system-tray/systemtrayplugin.h b/plugins/system-tray/systemtrayplugin.h index 01231a1ec..e3d04a865 100644 --- a/plugins/system-tray/systemtrayplugin.h +++ b/plugins/system-tray/systemtrayplugin.h @@ -23,7 +23,7 @@ #define SYSTEMTRAYPLUGIN_H #include "pluginsiteminterface.h" -#include "tipswidget.h" +#include "trayapplet.h" #include "dbus/dbustraymanager.h" #include "xwindowtraywidget.h" @@ -33,6 +33,7 @@ #include class FashionTrayItem; +class TipsWidget; class SystemTrayPlugin : public QObject, PluginsItemInterface { Q_OBJECT @@ -74,7 +75,7 @@ private: QMap m_trayList; TrayApplet *m_trayApplet; - QLabel *m_tipsLabel; + TipsWidget *m_tipsLabel; QSettings *m_containerSettings; }; diff --git a/plugins/system-tray/tipswidget.cpp b/plugins/system-tray/trayapplet.cpp similarity index 98% rename from plugins/system-tray/tipswidget.cpp rename to plugins/system-tray/trayapplet.cpp index d383a209b..3a5c9aa61 100644 --- a/plugins/system-tray/tipswidget.cpp +++ b/plugins/system-tray/trayapplet.cpp @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -#include "tipswidget.h" +#include "trayapplet.h" #include "abstracttraywidget.h" TrayApplet::TrayApplet(QWidget *parent) diff --git a/plugins/system-tray/tipswidget.h b/plugins/system-tray/trayapplet.h similarity index 94% rename from plugins/system-tray/tipswidget.h rename to plugins/system-tray/trayapplet.h index 25781d48f..caf3924c1 100644 --- a/plugins/system-tray/tipswidget.h +++ b/plugins/system-tray/trayapplet.h @@ -19,8 +19,8 @@ * along with this program. If not, see . */ -#ifndef TIPSWIDGET_H -#define TIPSWIDGET_H +#ifndef TRAYAPPLET_H +#define TRAYAPPLET_H #include #include @@ -40,4 +40,4 @@ private: QBoxLayout *m_mainLayout; }; -#endif // TIPSWIDGET_H +#endif // TRAYAPPLET_H diff --git a/frame/item/tipswidget.cpp b/widgets/tipswidget.cpp similarity index 100% rename from frame/item/tipswidget.cpp rename to widgets/tipswidget.cpp diff --git a/frame/item/tipswidget.h b/widgets/tipswidget.h similarity index 100% rename from frame/item/tipswidget.h rename to widgets/tipswidget.h