mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
refactor(plugins): use tipswidget replace stylesheet
Change-Id: Id71d26002e7eddf8bb0b1f524a0ff8553f1136b0
This commit is contained in:
parent
8dadd96397
commit
9085bfbdc8
Notes:
gerrit
2018-07-06 09:27:16 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: 张丁元 <lxz@ilxz.me> Submitted-by: 张丁元 <lxz@ilxz.me> Submitted-at: Fri, 06 Jul 2018 09:27:15 +0800 Reviewed-on: https://cr.deepin.io/36379 Project: dde/dde-dock Branch: refs/heads/master
@ -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)
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "dockitem.h"
|
||||
#include "components/previewcontainer.h"
|
||||
#include "dbus/dbusclientmanager.h"
|
||||
#include "item/tipswidget.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsItem>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define LAUNCHERITEM_H
|
||||
|
||||
#include "dockitem.h"
|
||||
#include "tipswidget.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
class LauncherItem : public DockItem
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "datetimewidget.h"
|
||||
#include "../../widgets/tipswidget.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
@ -62,7 +63,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QPointer<DatetimeWidget> m_centralWidget;
|
||||
QPointer<QLabel> m_dateTipsLabel;
|
||||
QPointer<TipsWidget> m_dateTipsLabel;
|
||||
|
||||
QTimer *m_refershTimer;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "devicecontrolwidget.h"
|
||||
#include "horizontalseperator.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <DHiDPIHelper>
|
||||
#include <QTimer>
|
||||
@ -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;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <dswitchbutton.h>
|
||||
|
||||
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;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "constants.h"
|
||||
#include "wireditem.h"
|
||||
#include "util/imageutil.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
@ -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<void (NetworkDevice::*)(NetworkDevice::DeviceStatus) const>(&NetworkDevice::statusChanged), this, &WiredItem::deviceStateChanged);
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <WiredDevice>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "wirelessitem.h"
|
||||
#include "util/imageutil.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
@ -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<void (NetworkDevice::*) (const QString &statStr) const>(&NetworkDevice::statusChanged), m_refershTimer, static_cast<void (QTimer::*) ()>(&QTimer::start));
|
||||
connect(static_cast<WirelessDevice *>(m_device), &WirelessDevice::activeApInfoChanged, m_refershTimer, static_cast<void (QTimer::*) ()>(&QTimer::start));
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <WirelessDevice>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "pluginwidget.h"
|
||||
#include "powerstatuswidget.h"
|
||||
#include "dbus/dbuspower.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
@ -68,7 +69,7 @@ private:
|
||||
QSettings m_settings;
|
||||
PluginWidget *m_shutdownWidget;
|
||||
PowerStatusWidget *m_powerStatusWidget;
|
||||
QLabel *m_tipsLabel;
|
||||
TipsWidget *m_tipsLabel;
|
||||
|
||||
DBusPower *m_powerInter;
|
||||
};
|
||||
|
@ -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)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "soundapplet.h"
|
||||
#include "sinkinputwidget.h"
|
||||
#include "componments/horizontalseparator.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QIcon>
|
||||
@ -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);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <QApplication>
|
||||
#include <DApplication>
|
||||
#include <DDBusSender>
|
||||
#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);
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
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;
|
||||
|
@ -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)
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QWidget>
|
||||
#include <QX11Info>
|
||||
|
||||
#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
|
||||
|
@ -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 <QLabel>
|
||||
|
||||
class FashionTrayItem;
|
||||
class TipsWidget;
|
||||
class SystemTrayPlugin : public QObject, PluginsItemInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -74,7 +75,7 @@ private:
|
||||
QMap<QString, AbstractTrayWidget *> m_trayList;
|
||||
|
||||
TrayApplet *m_trayApplet;
|
||||
QLabel *m_tipsLabel;
|
||||
TipsWidget *m_tipsLabel;
|
||||
|
||||
QSettings *m_containerSettings;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "tipswidget.h"
|
||||
#include "trayapplet.h"
|
||||
#include "abstracttraywidget.h"
|
||||
|
||||
TrayApplet::TrayApplet(QWidget *parent)
|
@ -19,8 +19,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TIPSWIDGET_H
|
||||
#define TIPSWIDGET_H
|
||||
#ifndef TRAYAPPLET_H
|
||||
#define TRAYAPPLET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QBoxLayout>
|
||||
@ -40,4 +40,4 @@ private:
|
||||
QBoxLayout *m_mainLayout;
|
||||
};
|
||||
|
||||
#endif // TIPSWIDGET_H
|
||||
#endif // TRAYAPPLET_H
|
Loading…
x
Reference in New Issue
Block a user