mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
chore: 给bug修复对应的修改过的代码添加注释
给bug修复对应的修改过的代码添加注释,方便代码维护 Log: 给bug修复对应的修改过的代码添加注释 Change-Id: I8a7c582e348613fb3c5f150227cbe9f2a03ac8b9
This commit is contained in:
parent
03716ac9f8
commit
68d97efca6
@ -288,6 +288,7 @@ void AbstractPluginsController::initPlugin(PluginsItemInterface *interface)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//插件全部加载完成
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
emit pluginLoaderFinished();
|
emit pluginLoaderFinished();
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,12 @@ ItemDelegate::ItemDelegate(QAbstractItemView *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ItemDelegate::paint 绘制鼠标移动到蓝牙列表某条item上的选中效果
|
||||||
|
* @param painter
|
||||||
|
* @param option
|
||||||
|
* @param index
|
||||||
|
*/
|
||||||
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItem styleOption = option;
|
QStyleOptionViewItem styleOption = option;
|
||||||
@ -83,8 +89,10 @@ void BluetoothDeviceItem::initActionList()
|
|||||||
m_standarditem->setAccessibleText(m_device->alias());
|
m_standarditem->setAccessibleText(m_device->alias());
|
||||||
m_standarditem->setActionList(Qt::RightEdge, {m_stateAction});
|
m_standarditem->setActionList(Qt::RightEdge, {m_stateAction});
|
||||||
m_standarditem->setActionList(Qt::LeftEdge, {m_labelAction});
|
m_standarditem->setActionList(Qt::LeftEdge, {m_labelAction});
|
||||||
|
//设置蓝牙列表item背景为透明
|
||||||
m_standarditem->setBackground(Qt::transparent);
|
m_standarditem->setBackground(Qt::transparent);
|
||||||
|
|
||||||
|
//蓝牙列表可用蓝牙设备信息文字显示高亮
|
||||||
m_labelAction->setTextColorRole(DPalette::BrightText);
|
m_labelAction->setTextColorRole(DPalette::BrightText);
|
||||||
m_labelAction->setText(m_device->alias());
|
m_labelAction->setText(m_device->alias());
|
||||||
updateDeviceState(m_device->state());
|
updateDeviceState(m_device->state());
|
||||||
@ -195,9 +203,11 @@ void BluetoothAdapterItem::updateIconTheme(DGuiApplicationHelper::ColorType type
|
|||||||
{
|
{
|
||||||
if (type == DGuiApplicationHelper::LightType) {
|
if (type == DGuiApplicationHelper::LightType) {
|
||||||
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh_dark.svg");
|
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh_dark.svg");
|
||||||
|
//浅色主题蓝牙界面控件分割线颜色
|
||||||
m_Separator->setColor(QColor(0, 0, 0, 0.1 * 255));
|
m_Separator->setColor(QColor(0, 0, 0, 0.1 * 255));
|
||||||
} else {
|
} else {
|
||||||
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh.svg");
|
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh.svg");
|
||||||
|
//深色主题蓝牙界面控件分割线颜色
|
||||||
m_Separator->setColor(QColor(255, 255, 255, 0.1 * 255));
|
m_Separator->setColor(QColor(255, 255, 255, 0.1 * 255));
|
||||||
}
|
}
|
||||||
setItemHoverColor();
|
setItemHoverColor();
|
||||||
@ -280,6 +290,9 @@ void BluetoothAdapterItem::onDeviceNameUpdated(const Device *device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BluetoothAdapterItem::setItemHoverColor 通过代理方式根据当前主题设置蓝牙列表文字颜色和item选中颜色
|
||||||
|
*/
|
||||||
void BluetoothAdapterItem::setItemHoverColor()
|
void BluetoothAdapterItem::setItemHoverColor()
|
||||||
{
|
{
|
||||||
QPalette hoverBackgroud = m_deviceListview->palette();
|
QPalette hoverBackgroud = m_deviceListview->palette();
|
||||||
@ -318,6 +331,7 @@ void BluetoothAdapterItem::initUi()
|
|||||||
m_deviceListview->setItemSpacing(1);
|
m_deviceListview->setItemSpacing(1);
|
||||||
m_deviceListview->setItemSize(QSize(ItemWidth, DeviceItemHeight));
|
m_deviceListview->setItemSize(QSize(ItemWidth, DeviceItemHeight));
|
||||||
m_deviceListview->setBackgroundType(DStyledItemDelegate::ClipCornerBackground);
|
m_deviceListview->setBackgroundType(DStyledItemDelegate::ClipCornerBackground);
|
||||||
|
//设置蓝牙列表DListView背景为透明
|
||||||
QPalette backgroud;
|
QPalette backgroud;
|
||||||
backgroud.setColor(QPalette::Base, Qt::transparent);
|
backgroud.setColor(QPalette::Base, Qt::transparent);
|
||||||
m_deviceListview->setAutoFillBackground(true);
|
m_deviceListview->setAutoFillBackground(true);
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
#include <DScrollArea>
|
#include <DScrollArea>
|
||||||
#include <DListView>
|
#include <DListView>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HorizontalSeperator::HorizontalSeperator 蓝牙界面控件分割线,高度值初始化为2个像素
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_color(0, 0, 0, 0.1*255)
|
m_color(0, 0, 0, 0.1*255)
|
||||||
@ -47,6 +51,10 @@ HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
|||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HorizontalSeperator::setColor 蓝牙界面控件分割线背景颜色设置
|
||||||
|
* @param color 颜色值
|
||||||
|
*/
|
||||||
void HorizontalSeperator::setColor(const QColor color)
|
void HorizontalSeperator::setColor(const QColor color)
|
||||||
{
|
{
|
||||||
m_color = color;
|
m_color = color;
|
||||||
@ -76,11 +84,15 @@ SettingLabel::SettingLabel(QString text, QWidget *parent)
|
|||||||
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &SettingLabel::updateIconTheme);
|
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &SettingLabel::updateIconTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SettingLabel::updateIconTheme 根据主题的深浅设置字体的颜色,控件的背景颜色
|
||||||
|
*/
|
||||||
void SettingLabel::updateIconTheme()
|
void SettingLabel::updateIconTheme()
|
||||||
{
|
{
|
||||||
QPalette backgroud;
|
QPalette backgroud;
|
||||||
QPalette textColor;
|
QPalette textColor;
|
||||||
if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType){
|
if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType){
|
||||||
|
//蓝牙设置,电脑用户名文字显示高亮
|
||||||
textColor.setColor(QPalette::WindowText, QPalette::BrightText);
|
textColor.setColor(QPalette::WindowText, QPalette::BrightText);
|
||||||
} else {
|
} else {
|
||||||
textColor.setColor(QPalette::WindowText, Qt::white);
|
textColor.setColor(QPalette::WindowText, Qt::white);
|
||||||
@ -192,6 +204,7 @@ void BluetoothApplet::onAdapterAdded(Adapter *adapter)
|
|||||||
connect(adapterItem, &BluetoothAdapterItem::requestRefreshAdapter, m_adaptersManager, &AdaptersManager::adapterRefresh);
|
connect(adapterItem, &BluetoothAdapterItem::requestRefreshAdapter, m_adaptersManager, &AdaptersManager::adapterRefresh);
|
||||||
|
|
||||||
m_adapterItems.insert(adapter->id(), adapterItem);
|
m_adapterItems.insert(adapter->id(), adapterItem);
|
||||||
|
//插入分割线
|
||||||
m_contentLayout->insertWidget(0, m_Separator, Qt::AlignTop | Qt::AlignVCenter);
|
m_contentLayout->insertWidget(0, m_Separator, Qt::AlignTop | Qt::AlignVCenter);
|
||||||
m_contentLayout->insertWidget(0, adapterItem, Qt::AlignTop | Qt::AlignVCenter);
|
m_contentLayout->insertWidget(0, adapterItem, Qt::AlignTop | Qt::AlignVCenter);
|
||||||
updateBluetoothPowerState();
|
updateBluetoothPowerState();
|
||||||
@ -277,6 +290,9 @@ void BluetoothApplet::initConnect()
|
|||||||
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme);
|
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BluetoothApplet::updateIconTheme 根据主题颜色设置蓝牙界面控件背景色
|
||||||
|
*/
|
||||||
void BluetoothApplet::updateIconTheme()
|
void BluetoothApplet::updateIconTheme()
|
||||||
{
|
{
|
||||||
QPalette widgetBackgroud;
|
QPalette widgetBackgroud;
|
||||||
|
@ -115,6 +115,10 @@ void DatetimeWidget::setShortTimeFormat(int type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DatetimeWidget::curTimeSize 调整时间日期字体大小
|
||||||
|
* @return 返回时间和日期绘制的区域大小
|
||||||
|
*/
|
||||||
QSize DatetimeWidget::curTimeSize() const
|
QSize DatetimeWidget::curTimeSize() const
|
||||||
{
|
{
|
||||||
const Dock::Position position = qApp->property(PROP_POSITION).value<Dock::Position>();
|
const Dock::Position position = qApp->property(PROP_POSITION).value<Dock::Position>();
|
||||||
@ -172,6 +176,10 @@ QSize DatetimeWidget::sizeHint() const
|
|||||||
return curTimeSize();
|
return curTimeSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DatetimeWidget::paintEvent 绘制任务栏时间日期
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
void DatetimeWidget::paintEvent(QPaintEvent *e)
|
void DatetimeWidget::paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
Q_UNUSED(e);
|
Q_UNUSED(e);
|
||||||
|
@ -54,6 +54,7 @@ AccessPointWidget::AccessPointWidget()
|
|||||||
, m_stateButton(new StateButton(this))
|
, m_stateButton(new StateButton(this))
|
||||||
, m_isEnter(false)
|
, m_isEnter(false)
|
||||||
{
|
{
|
||||||
|
//设置wifi列表item背景色为透明
|
||||||
QPalette backgroud;
|
QPalette backgroud;
|
||||||
backgroud.setColor(QPalette::Background, Qt::transparent);
|
backgroud.setColor(QPalette::Background, Qt::transparent);
|
||||||
this->setAutoFillBackground(true);
|
this->setAutoFillBackground(true);
|
||||||
@ -155,6 +156,10 @@ void AccessPointWidget::setActiveState(const NetworkDevice::DeviceStatus state)
|
|||||||
m_stateButton->setVisible(isActive);
|
m_stateButton->setVisible(isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AccessPointWidget::paintEvent 根据主题颜色绘制wifi列表item背景色
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
void AccessPointWidget::paintEvent(QPaintEvent *event)
|
void AccessPointWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HorizontalSeperator::HorizontalSeperator 网络界面控件分割线,高度值初始化为2个像素
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_color(0, 0, 0, 0.1*255)
|
m_color(0, 0, 0, 0.1*255)
|
||||||
|
@ -53,6 +53,7 @@ WirelessList::WirelessList(WirelessDevice *deviceIter, QWidget *parent)
|
|||||||
{
|
{
|
||||||
setFixedHeight(ItemHeight);
|
setFixedHeight(ItemHeight);
|
||||||
|
|
||||||
|
//无线网络列表背景色设置为透明
|
||||||
QPalette backgroud;
|
QPalette backgroud;
|
||||||
backgroud.setColor(QPalette::Background, Qt::transparent);
|
backgroud.setColor(QPalette::Background, Qt::transparent);
|
||||||
this->setAutoFillBackground(true);
|
this->setAutoFillBackground(true);
|
||||||
|
@ -127,6 +127,7 @@ NetworkItem::NetworkItem(QWidget *parent)
|
|||||||
centralLayout->setSpacing(0);
|
centralLayout->setSpacing(0);
|
||||||
centralLayout->setMargin(0);
|
centralLayout->setMargin(0);
|
||||||
centralLayout->addWidget(m_wirelessControlPanel);
|
centralLayout->addWidget(m_wirelessControlPanel);
|
||||||
|
//添加网络界面控件分割线
|
||||||
centralLayout->addWidget(m_firstSeparator);
|
centralLayout->addWidget(m_firstSeparator);
|
||||||
centralLayout->addLayout(m_wirelessLayout);
|
centralLayout->addLayout(m_wirelessLayout);
|
||||||
centralLayout->addWidget(m_secondSeparator);
|
centralLayout->addWidget(m_secondSeparator);
|
||||||
@ -175,6 +176,9 @@ NetworkItem::NetworkItem(QWidget *parent)
|
|||||||
m_wirelessScanTimer->setInterval(m_wirelessScanInterval);
|
m_wirelessScanTimer->setInterval(m_wirelessScanInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief NetworkItem::setControlBackground 设置网络界面控件背景颜色
|
||||||
|
*/
|
||||||
void NetworkItem::setControlBackground()
|
void NetworkItem::setControlBackground()
|
||||||
{
|
{
|
||||||
QPalette backgroud;
|
QPalette backgroud;
|
||||||
@ -543,6 +547,7 @@ void NetworkItem::wirelessEnable(bool enable)
|
|||||||
wirelessItem->itemApplet()->setVisible(enable);
|
wirelessItem->itemApplet()->setVisible(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//禁用无线网络时对应的分割线设置为不可见防止两分割线叠加增加分割线高度与下面分割线高度不一样
|
||||||
m_secondSeparator->setVisible(enable);
|
m_secondSeparator->setVisible(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,6 +1142,7 @@ void NetworkItem::updateView()
|
|||||||
} else {
|
} else {
|
||||||
contentHeight += (itemCount - wiredDeviceCnt) * ItemHeight;
|
contentHeight += (itemCount - wiredDeviceCnt) * ItemHeight;
|
||||||
contentHeight += wiredDeviceCnt * ItemHeight;
|
contentHeight += wiredDeviceCnt * ItemHeight;
|
||||||
|
//加上分割线占用的高度,否则显示界面高度不够显示,会造成无线网络列表item最后一项比其它项的高度小
|
||||||
centralWidget->setFixedHeight(contentHeight + SeparatorItemHeight * 3);
|
centralWidget->setFixedHeight(contentHeight + SeparatorItemHeight * 3);
|
||||||
m_applet->setFixedHeight(constDisplayItemCnt * ItemHeight + SeparatorItemHeight * 3);
|
m_applet->setFixedHeight(constDisplayItemCnt * ItemHeight + SeparatorItemHeight * 3);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HorizontalSeparator::HorizontalSeparator 声音界面控件分割线,高度值初始化为2个像素
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
HorizontalSeparator::HorizontalSeparator(QWidget *parent)
|
HorizontalSeparator::HorizontalSeparator(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,12 @@ ItemDelegate::ItemDelegate(QAbstractItemView *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ItemDelegate::paint 绘制鼠标移动到音频列表某条item上的选中效果
|
||||||
|
* @param painter
|
||||||
|
* @param option
|
||||||
|
* @param index
|
||||||
|
*/
|
||||||
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItem styleOption = option;
|
QStyleOptionViewItem styleOption = option;
|
||||||
@ -150,6 +156,9 @@ SoundApplet::SoundApplet(QWidget *parent)
|
|||||||
initUi();
|
initUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SoundApplet::setControlBackground 设置音频界面控件背景颜色
|
||||||
|
*/
|
||||||
void SoundApplet::setControlBackground()
|
void SoundApplet::setControlBackground()
|
||||||
{
|
{
|
||||||
QPalette soundAppletBackgroud;
|
QPalette soundAppletBackgroud;
|
||||||
@ -170,6 +179,9 @@ void SoundApplet::setControlBackground()
|
|||||||
m_listView->setPalette(listViewBackgroud);
|
m_listView->setPalette(listViewBackgroud);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SoundApplet::setItemHoverColor 通过代理方式根据当前主题设置音频列表文字颜色和item选中颜色
|
||||||
|
*/
|
||||||
void SoundApplet::setItemHoverColor()
|
void SoundApplet::setItemHoverColor()
|
||||||
{
|
{
|
||||||
QPalette hoverBackgroud = m_listView->palette();
|
QPalette hoverBackgroud = m_listView->palette();
|
||||||
@ -235,6 +247,7 @@ void SoundApplet::initUi()
|
|||||||
volumeCtrlLayout->setSpacing(0);
|
volumeCtrlLayout->setSpacing(0);
|
||||||
volumeCtrlLayout->setMargin(0);
|
volumeCtrlLayout->setMargin(0);
|
||||||
|
|
||||||
|
//音频界面添加第二个分割线
|
||||||
QVBoxLayout *volumeLineLayout = new QVBoxLayout;
|
QVBoxLayout *volumeLineLayout = new QVBoxLayout;
|
||||||
volumeLineLayout->addLayout(volumeCtrlLayout);
|
volumeLineLayout->addLayout(volumeCtrlLayout);
|
||||||
volumeLineLayout->addWidget(m_secondSeparator);
|
volumeLineLayout->addWidget(m_secondSeparator);
|
||||||
@ -731,6 +744,7 @@ void SoundApplet::updateListHeight()
|
|||||||
int margain = m_centralLayout->contentsMargins().top() + m_centralLayout->contentsMargins().bottom();
|
int margain = m_centralLayout->contentsMargins().top() + m_centralLayout->contentsMargins().bottom();
|
||||||
//整个界面高度 = 显示声音设备列表高度 + 设备信息高度 + 边距
|
//整个界面高度 = 显示声音设备列表高度 + 设备信息高度 + 边距
|
||||||
int totalHeight = viewHeight + infoHeight + margain;
|
int totalHeight = viewHeight + infoHeight + margain;
|
||||||
|
//加上分割线占用的高度,否则显示界面高度不够显示,会造成音频列表item最后一项比其它项的高度小
|
||||||
m_listView->setFixedHeight(viewHeight + SEPARATOR_HEIGHT);
|
m_listView->setFixedHeight(viewHeight + SEPARATOR_HEIGHT);
|
||||||
setFixedHeight(totalHeight);
|
setFixedHeight(totalHeight);
|
||||||
m_centralWidget->setFixedHeight(totalHeight + SEPARATOR_HEIGHT);
|
m_centralWidget->setFixedHeight(totalHeight + SEPARATOR_HEIGHT);
|
||||||
|
@ -55,6 +55,10 @@ void TipsWidget::setTextList(const QStringList &textList)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TipsWidget::paintEvent 任务栏插件提示信息绘制
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
void TipsWidget::paintEvent(QPaintEvent *event)
|
void TipsWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QFrame::paintEvent(event);
|
QFrame::paintEvent(event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user