mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix:format code
This commit is contained in:
parent
364ceff32e
commit
3354169738
@ -61,6 +61,8 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
|
|||||||
, m_appletName(new QLabel(this))
|
, m_appletName(new QLabel(this))
|
||||||
, m_centralWidget(new QWidget)
|
, m_centralWidget(new QWidget)
|
||||||
, m_centrealLayout(new QVBoxLayout)
|
, m_centrealLayout(new QVBoxLayout)
|
||||||
|
, m_adapterLayout(new QVBoxLayout)
|
||||||
|
, m_menueLayout(new QHBoxLayout)
|
||||||
, m_openControlCenter(new MenueItem(this))
|
, m_openControlCenter(new MenueItem(this))
|
||||||
, m_adaptersManager(new AdaptersManager(this))
|
, m_adaptersManager(new AdaptersManager(this))
|
||||||
{
|
{
|
||||||
@ -79,20 +81,17 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
|
|||||||
m_openControlCenter->setFixedHeight(ITEMHEIGHT);
|
m_openControlCenter->setFixedHeight(ITEMHEIGHT);
|
||||||
m_openControlCenter->setVisible(false);
|
m_openControlCenter->setVisible(false);
|
||||||
|
|
||||||
auto appletNameLayout = new QHBoxLayout;
|
QHBoxLayout *appletNameLayout = new QHBoxLayout;
|
||||||
appletNameLayout->setMargin(0);
|
appletNameLayout->setMargin(0);
|
||||||
appletNameLayout->setSpacing(0);
|
appletNameLayout->setSpacing(0);
|
||||||
appletNameLayout->addSpacing(MARGIN);
|
appletNameLayout->addSpacing(MARGIN);
|
||||||
appletNameLayout->addWidget(m_appletName);
|
appletNameLayout->addWidget(m_appletName);
|
||||||
appletNameLayout->addStretch();
|
appletNameLayout->addStretch();
|
||||||
|
|
||||||
m_menueLayout = new QHBoxLayout;
|
|
||||||
m_menueLayout->setMargin(0);
|
m_menueLayout->setMargin(0);
|
||||||
m_menueLayout->setSpacing(0);
|
m_menueLayout->setSpacing(0);
|
||||||
m_menueLayout->addSpacing(MARGIN);
|
m_menueLayout->addSpacing(MARGIN);
|
||||||
|
|
||||||
m_adapterLayout = new QVBoxLayout;
|
|
||||||
|
|
||||||
m_centrealLayout->setMargin(0);
|
m_centrealLayout->setMargin(0);
|
||||||
m_centrealLayout->setSpacing(0);
|
m_centrealLayout->setSpacing(0);
|
||||||
m_centrealLayout->addLayout(appletNameLayout);
|
m_centrealLayout->addLayout(appletNameLayout);
|
||||||
|
@ -43,12 +43,12 @@ BluetoothItem::BluetoothItem(QWidget *parent)
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_tipsLabel(new TipsWidget(this))
|
, m_tipsLabel(new TipsWidget(this))
|
||||||
, m_applet(new BluetoothApplet(this))
|
, m_applet(new BluetoothApplet(this))
|
||||||
, m_timer(new QTimer(this))
|
, m_refreshIconTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
m_applet->setVisible(false);
|
m_applet->setVisible(false);
|
||||||
m_adapterPowered = m_applet->poweredInitState();
|
m_adapterPowered = m_applet->poweredInitState();
|
||||||
|
m_refreshIconTimer->setInterval(100);
|
||||||
connect(m_timer, &QTimer::timeout, this, &BluetoothItem::refreshIcon);
|
connect(m_refreshIconTimer, &QTimer::timeout, this, &BluetoothItem::refreshIcon);
|
||||||
connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) {
|
connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) {
|
||||||
m_adapterPowered = powered;
|
m_adapterPowered = powered;
|
||||||
refreshIcon();
|
refreshIcon();
|
||||||
@ -58,8 +58,8 @@ BluetoothItem::BluetoothItem(QWidget *parent)
|
|||||||
refreshIcon();
|
refreshIcon();
|
||||||
});
|
});
|
||||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothItem::refreshIcon);
|
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothItem::refreshIcon);
|
||||||
connect(m_applet, SIGNAL(noAdapter()), this, SIGNAL(noAdapter()));
|
connect(m_applet,&BluetoothApplet::noAdapter,this,&BluetoothItem::noAdapter);
|
||||||
connect(m_applet, SIGNAL(justHasAdapter()), this, SIGNAL(justHasAdapter()));
|
connect(m_applet,&BluetoothApplet::justHasAdapter,this,&BluetoothItem::justHasAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *BluetoothItem::tipsWidget()
|
QWidget *BluetoothItem::tipsWidget()
|
||||||
@ -134,7 +134,7 @@ void BluetoothItem::refreshIcon()
|
|||||||
stateString = "active";
|
stateString = "active";
|
||||||
break;
|
break;
|
||||||
case Device::StateAvailable: {
|
case Device::StateAvailable: {
|
||||||
m_timer->start();
|
m_refreshIconTimer->start();
|
||||||
stateString = "waiting";
|
stateString = "waiting";
|
||||||
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
|
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
|
||||||
const qreal ratio = devicePixelRatioF();
|
const qreal ratio = devicePixelRatioF();
|
||||||
@ -155,7 +155,7 @@ void BluetoothItem::refreshIcon()
|
|||||||
stateString = "disable";
|
stateString = "disable";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_timer->stop();
|
m_refreshIconTimer->stop();
|
||||||
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
|
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
|
||||||
|
|
||||||
const qreal ratio = devicePixelRatioF();
|
const qreal ratio = devicePixelRatioF();
|
||||||
|
@ -65,7 +65,7 @@ private:
|
|||||||
|
|
||||||
Device::State m_devState;
|
Device::State m_devState;
|
||||||
bool m_adapterPowered;
|
bool m_adapterPowered;
|
||||||
QTimer *m_timer;
|
QTimer *m_refreshIconTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BLUETOOTHITEM_H
|
#endif // BLUETOOTHITEM_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user