2023-02-16 13:51:55 +08:00
|
|
|
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
|
|
|
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2022-11-28 13:54:13 +08:00
|
|
|
#ifndef BLUETOOTHMAINWIDGET_H
|
|
|
|
#define BLUETOOTHMAINWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class AdaptersManager;
|
|
|
|
class QLabel;
|
|
|
|
class Adapter;
|
|
|
|
|
|
|
|
class BluetoothMainWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit BluetoothMainWidget(AdaptersManager *adapterManager, QWidget *parent = nullptr);
|
|
|
|
~BluetoothMainWidget();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void requestExpand();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *watcher, QEvent *event) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void initUi();
|
|
|
|
void initConnection();
|
|
|
|
|
|
|
|
void updateExpandIcon();
|
|
|
|
|
|
|
|
bool isOpen() const;
|
|
|
|
QString bluetoothIcon(bool isOpen) const;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void onAdapterChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
AdaptersManager *m_adapterManager;
|
|
|
|
QWidget *m_iconWidget;
|
|
|
|
QLabel *m_nameLabel;
|
|
|
|
QLabel *m_stateLabel;
|
|
|
|
QLabel *m_expandLabel;
|
2023-01-14 16:41:35 +08:00
|
|
|
bool m_mouseEnter;
|
2022-11-28 13:54:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BLUETOOTHMAINWIDGET_H
|