deine mum

This commit is contained in:
2025-12-30 21:55:11 +01:00
parent 9b5db719cb
commit 2d5b492da8
7 changed files with 55 additions and 20 deletions

View File

@@ -2,8 +2,43 @@
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include "components/base/button.hpp"
class BluetoothEntry : Gtk::Box {
public:
BluetoothEntry(std::string name, std::string address) {
this->set_orientation(Gtk::Orientation::VERTICAL);
this->add_css_class("bluetooth-entry-box");
auto nameLabel = Gtk::make_managed<Gtk::Label>(name);
nameLabel->set_halign(Gtk::Align::START);
nameLabel->add_css_class("bluetooth-entry-name");
this->append(*nameLabel);
auto addressLabel = Gtk::make_managed<Gtk::Label>(address);
addressLabel->set_halign(Gtk::Align::START);
addressLabel->add_css_class("bluetooth-entry-address");
this->append(*addressLabel);
this->add_css_class("bluetooth-entry");
auto connectButton = Gtk::make_managed<Button>("Connect");
connectButton->set_halign(Gtk::Align::END);
connectButton->set_tooltip_text("Connect to Device");
connectButton->onClickedSignal.connect([this, address]() {
this->connect_clicked.emit(address);
});
this->append(*connectButton);
}
sigc::signal<void(std::string)> connect_clicked;
};
class BluetoothWidget : public Gtk::Box {
public:
BluetoothWidget();
@@ -21,7 +56,8 @@ class BluetoothWidget : public Gtk::Box {
bool isDiscovering = false;
Gtk::Box statusArea;
Gtk::Box *deviceList = nullptr;
std::map<std::string, BluetoothEntry *> deviceEntries;
Gtk::Box devicesArea;
Button *scanButton = nullptr;
Button *powerButton = nullptr;