make bluetooth service singleton

This commit is contained in:
2025-12-23 19:57:52 +01:00
parent 8613024f8d
commit a06c96f648
14 changed files with 148 additions and 65 deletions

View File

@@ -1,14 +1,11 @@
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include "components/popover.hpp"
#include "gtkmm/button.h"
class BluetoothWidget : public Popover {
class BluetoothWidget : public Gtk::Box {
public:
BluetoothWidget(std::string icon, std::string title);
BluetoothWidget();
void setPowerState(bool state);
void setIsDiscovering(bool state);
@@ -17,19 +14,16 @@ class BluetoothWidget : public Popover {
sigc::signal<void()> onIsDiscoveringButtonClickedSignal;
void update();
private:
bool isPowered = false;
bool isPowered = false;
bool isDiscovering = false;
Gtk::Box container;
Gtk::Box statusArea;
Gtk::Box *deviceList = nullptr;
Gtk::Button *scanButton = nullptr;
Gtk::Box *deviceList = nullptr;
Gtk::Button *scanButton = nullptr;
Gtk::Button *powerButton = nullptr;
void onPowerButtonClicked();
void onScanButtonClicked();

View File

@@ -0,0 +1,17 @@
#pragma once
#include "components/popover.hpp"
#include "services/bluetooth.hpp"
#include "widgets/bluetooth.hpp"
#include "gtkmm/box.h"
class ControlCenter : public Popover {
public:
ControlCenter(std::string icon, std::string name);
private:
Gtk::Box container;
BluetoothWidget *bluetoothWidget = nullptr;
BluetoothService *bluetoothService = BluetoothService::getInstance();
};