chore: 给bug修复对应的修改过的代码添加注释

给bug修复对应的修改过的代码添加注释,方便代码维护

Log: 给bug修复对应的修改过的代码添加注释
Change-Id: I8a7c582e348613fb3c5f150227cbe9f2a03ac8b9
This commit is contained in:
qiuchangxing 2021-05-19 17:41:06 +09:00
parent 03716ac9f8
commit 68d97efca6
11 changed files with 77 additions and 0 deletions

View File

@ -288,6 +288,7 @@ void AbstractPluginsController::initPlugin(PluginsItemInterface *interface)
}
}
//插件全部加载完成
if (loaded) {
emit pluginLoaderFinished();
}

View File

@ -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
{
QStyleOptionViewItem styleOption = option;
@ -83,8 +89,10 @@ void BluetoothDeviceItem::initActionList()
m_standarditem->setAccessibleText(m_device->alias());
m_standarditem->setActionList(Qt::RightEdge, {m_stateAction});
m_standarditem->setActionList(Qt::LeftEdge, {m_labelAction});
//设置蓝牙列表item背景为透明
m_standarditem->setBackground(Qt::transparent);
//蓝牙列表可用蓝牙设备信息文字显示高亮
m_labelAction->setTextColorRole(DPalette::BrightText);
m_labelAction->setText(m_device->alias());
updateDeviceState(m_device->state());
@ -195,9 +203,11 @@ void BluetoothAdapterItem::updateIconTheme(DGuiApplicationHelper::ColorType type
{
if (type == DGuiApplicationHelper::LightType) {
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh_dark.svg");
//浅色主题蓝牙界面控件分割线颜色
m_Separator->setColor(QColor(0, 0, 0, 0.1 * 255));
} else {
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh.svg");
//深色主题蓝牙界面控件分割线颜色
m_Separator->setColor(QColor(255, 255, 255, 0.1 * 255));
}
setItemHoverColor();
@ -280,6 +290,9 @@ void BluetoothAdapterItem::onDeviceNameUpdated(const Device *device)
}
}
/**
* @brief BluetoothAdapterItem::setItemHoverColor item选中颜色
*/
void BluetoothAdapterItem::setItemHoverColor()
{
QPalette hoverBackgroud = m_deviceListview->palette();
@ -318,6 +331,7 @@ void BluetoothAdapterItem::initUi()
m_deviceListview->setItemSpacing(1);
m_deviceListview->setItemSize(QSize(ItemWidth, DeviceItemHeight));
m_deviceListview->setBackgroundType(DStyledItemDelegate::ClipCornerBackground);
//设置蓝牙列表DListView背景为透明
QPalette backgroud;
backgroud.setColor(QPalette::Base, Qt::transparent);
m_deviceListview->setAutoFillBackground(true);

View File

@ -39,6 +39,10 @@
#include <DScrollArea>
#include <DListView>
/**
* @brief HorizontalSeperator::HorizontalSeperator 线,2
* @param parent
*/
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
: QWidget(parent),
m_color(0, 0, 0, 0.1*255)
@ -47,6 +51,10 @@ HorizontalSeperator::HorizontalSeperator(QWidget *parent)
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
}
/**
* @brief HorizontalSeperator::setColor 线
* @param color
*/
void HorizontalSeperator::setColor(const QColor color)
{
m_color = color;
@ -76,11 +84,15 @@ SettingLabel::SettingLabel(QString text, QWidget *parent)
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &SettingLabel::updateIconTheme);
}
/**
* @brief SettingLabel::updateIconTheme
*/
void SettingLabel::updateIconTheme()
{
QPalette backgroud;
QPalette textColor;
if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType){
//蓝牙设置,电脑用户名文字显示高亮
textColor.setColor(QPalette::WindowText, QPalette::BrightText);
} else {
textColor.setColor(QPalette::WindowText, Qt::white);
@ -192,6 +204,7 @@ void BluetoothApplet::onAdapterAdded(Adapter *adapter)
connect(adapterItem, &BluetoothAdapterItem::requestRefreshAdapter, m_adaptersManager, &AdaptersManager::adapterRefresh);
m_adapterItems.insert(adapter->id(), adapterItem);
//插入分割线
m_contentLayout->insertWidget(0, m_Separator, Qt::AlignTop | Qt::AlignVCenter);
m_contentLayout->insertWidget(0, adapterItem, Qt::AlignTop | Qt::AlignVCenter);
updateBluetoothPowerState();
@ -277,6 +290,9 @@ void BluetoothApplet::initConnect()
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme);
}
/**
* @brief BluetoothApplet::updateIconTheme
*/
void BluetoothApplet::updateIconTheme()
{
QPalette widgetBackgroud;

View File

@ -115,6 +115,10 @@ void DatetimeWidget::setShortTimeFormat(int type)
}
}
/**
* @brief DatetimeWidget::curTimeSize
* @return
*/
QSize DatetimeWidget::curTimeSize() const
{
const Dock::Position position = qApp->property(PROP_POSITION).value<Dock::Position>();
@ -172,6 +176,10 @@ QSize DatetimeWidget::sizeHint() const
return curTimeSize();
}
/**
* @brief DatetimeWidget::paintEvent
* @param e
*/
void DatetimeWidget::paintEvent(QPaintEvent *e)
{
Q_UNUSED(e);

View File

@ -54,6 +54,7 @@ AccessPointWidget::AccessPointWidget()
, m_stateButton(new StateButton(this))
, m_isEnter(false)
{
//设置wifi列表item背景色为透明
QPalette backgroud;
backgroud.setColor(QPalette::Background, Qt::transparent);
this->setAutoFillBackground(true);
@ -155,6 +156,10 @@ void AccessPointWidget::setActiveState(const NetworkDevice::DeviceStatus state)
m_stateButton->setVisible(isActive);
}
/**
* @brief AccessPointWidget::paintEvent wifi列表item背景色
* @param event
*/
void AccessPointWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);

View File

@ -23,6 +23,10 @@
#include <QPainter>
/**
* @brief HorizontalSeperator::HorizontalSeperator 线,2
* @param parent
*/
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
: QWidget(parent),
m_color(0, 0, 0, 0.1*255)

View File

@ -53,6 +53,7 @@ WirelessList::WirelessList(WirelessDevice *deviceIter, QWidget *parent)
{
setFixedHeight(ItemHeight);
//无线网络列表背景色设置为透明
QPalette backgroud;
backgroud.setColor(QPalette::Background, Qt::transparent);
this->setAutoFillBackground(true);

View File

@ -127,6 +127,7 @@ NetworkItem::NetworkItem(QWidget *parent)
centralLayout->setSpacing(0);
centralLayout->setMargin(0);
centralLayout->addWidget(m_wirelessControlPanel);
//添加网络界面控件分割线
centralLayout->addWidget(m_firstSeparator);
centralLayout->addLayout(m_wirelessLayout);
centralLayout->addWidget(m_secondSeparator);
@ -175,6 +176,9 @@ NetworkItem::NetworkItem(QWidget *parent)
m_wirelessScanTimer->setInterval(m_wirelessScanInterval);
}
/**
* @brief NetworkItem::setControlBackground
*/
void NetworkItem::setControlBackground()
{
QPalette backgroud;
@ -543,6 +547,7 @@ void NetworkItem::wirelessEnable(bool enable)
wirelessItem->itemApplet()->setVisible(enable);
}
}
//禁用无线网络时对应的分割线设置为不可见防止两分割线叠加增加分割线高度与下面分割线高度不一样
m_secondSeparator->setVisible(enable);
}
@ -1137,6 +1142,7 @@ void NetworkItem::updateView()
} else {
contentHeight += (itemCount - wiredDeviceCnt) * ItemHeight;
contentHeight += wiredDeviceCnt * ItemHeight;
//加上分割线占用的高度否则显示界面高度不够显示会造成无线网络列表item最后一项比其它项的高度小
centralWidget->setFixedHeight(contentHeight + SeparatorItemHeight * 3);
m_applet->setFixedHeight(constDisplayItemCnt * ItemHeight + SeparatorItemHeight * 3);
}

View File

@ -23,6 +23,10 @@
#include <QPainter>
/**
* @brief HorizontalSeparator::HorizontalSeparator 线,2
* @param parent
*/
HorizontalSeparator::HorizontalSeparator(QWidget *parent)
: QWidget(parent)
{

View File

@ -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
{
QStyleOptionViewItem styleOption = option;
@ -150,6 +156,9 @@ SoundApplet::SoundApplet(QWidget *parent)
initUi();
}
/**
* @brief SoundApplet::setControlBackground
*/
void SoundApplet::setControlBackground()
{
QPalette soundAppletBackgroud;
@ -170,6 +179,9 @@ void SoundApplet::setControlBackground()
m_listView->setPalette(listViewBackgroud);
}
/**
* @brief SoundApplet::setItemHoverColor item选中颜色
*/
void SoundApplet::setItemHoverColor()
{
QPalette hoverBackgroud = m_listView->palette();
@ -235,6 +247,7 @@ void SoundApplet::initUi()
volumeCtrlLayout->setSpacing(0);
volumeCtrlLayout->setMargin(0);
//音频界面添加第二个分割线
QVBoxLayout *volumeLineLayout = new QVBoxLayout;
volumeLineLayout->addLayout(volumeCtrlLayout);
volumeLineLayout->addWidget(m_secondSeparator);
@ -731,6 +744,7 @@ void SoundApplet::updateListHeight()
int margain = m_centralLayout->contentsMargins().top() + m_centralLayout->contentsMargins().bottom();
//整个界面高度 = 显示声音设备列表高度 + 设备信息高度 + 边距
int totalHeight = viewHeight + infoHeight + margain;
//加上分割线占用的高度否则显示界面高度不够显示会造成音频列表item最后一项比其它项的高度小
m_listView->setFixedHeight(viewHeight + SEPARATOR_HEIGHT);
setFixedHeight(totalHeight);
m_centralWidget->setFixedHeight(totalHeight + SEPARATOR_HEIGHT);

View File

@ -55,6 +55,10 @@ void TipsWidget::setTextList(const QStringList &textList)
update();
}
/**
* @brief TipsWidget::paintEvent
* @param event
*/
void TipsWidget::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);