fix:format code

This commit is contained in:
fpc_diesel 2020-05-14 19:57:49 +08:00
parent 364ceff32e
commit 3354169738
3 changed files with 11 additions and 12 deletions

View File

@ -61,6 +61,8 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
, m_appletName(new QLabel(this))
, m_centralWidget(new QWidget)
, m_centrealLayout(new QVBoxLayout)
, m_adapterLayout(new QVBoxLayout)
, m_menueLayout(new QHBoxLayout)
, m_openControlCenter(new MenueItem(this))
, m_adaptersManager(new AdaptersManager(this))
{
@ -79,20 +81,17 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
m_openControlCenter->setFixedHeight(ITEMHEIGHT);
m_openControlCenter->setVisible(false);
auto appletNameLayout = new QHBoxLayout;
QHBoxLayout *appletNameLayout = new QHBoxLayout;
appletNameLayout->setMargin(0);
appletNameLayout->setSpacing(0);
appletNameLayout->addSpacing(MARGIN);
appletNameLayout->addWidget(m_appletName);
appletNameLayout->addStretch();
m_menueLayout = new QHBoxLayout;
m_menueLayout->setMargin(0);
m_menueLayout->setSpacing(0);
m_menueLayout->addSpacing(MARGIN);
m_adapterLayout = new QVBoxLayout;
m_centrealLayout->setMargin(0);
m_centrealLayout->setSpacing(0);
m_centrealLayout->addLayout(appletNameLayout);

View File

@ -43,12 +43,12 @@ BluetoothItem::BluetoothItem(QWidget *parent)
: QWidget(parent)
, m_tipsLabel(new TipsWidget(this))
, m_applet(new BluetoothApplet(this))
, m_timer(new QTimer(this))
, m_refreshIconTimer(new QTimer(this))
{
m_applet->setVisible(false);
m_adapterPowered = m_applet->poweredInitState();
connect(m_timer, &QTimer::timeout, this, &BluetoothItem::refreshIcon);
m_refreshIconTimer->setInterval(100);
connect(m_refreshIconTimer, &QTimer::timeout, this, &BluetoothItem::refreshIcon);
connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) {
m_adapterPowered = powered;
refreshIcon();
@ -58,8 +58,8 @@ BluetoothItem::BluetoothItem(QWidget *parent)
refreshIcon();
});
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothItem::refreshIcon);
connect(m_applet, SIGNAL(noAdapter()), this, SIGNAL(noAdapter()));
connect(m_applet, SIGNAL(justHasAdapter()), this, SIGNAL(justHasAdapter()));
connect(m_applet,&BluetoothApplet::noAdapter,this,&BluetoothItem::noAdapter);
connect(m_applet,&BluetoothApplet::justHasAdapter,this,&BluetoothItem::justHasAdapter);
}
QWidget *BluetoothItem::tipsWidget()
@ -134,7 +134,7 @@ void BluetoothItem::refreshIcon()
stateString = "active";
break;
case Device::StateAvailable: {
m_timer->start();
m_refreshIconTimer->start();
stateString = "waiting";
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
const qreal ratio = devicePixelRatioF();
@ -155,7 +155,7 @@ void BluetoothItem::refreshIcon()
stateString = "disable";
}
m_timer->stop();
m_refreshIconTimer->stop();
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
const qreal ratio = devicePixelRatioF();

View File

@ -65,7 +65,7 @@ private:
Device::State m_devState;
bool m_adapterPowered;
QTimer *m_timer;
QTimer *m_refreshIconTimer;
};
#endif // BLUETOOTHITEM_H