diff --git a/autoapp/UI/MainWindow.cpp b/autoapp/UI/MainWindow.cpp index 3c06ae9..d63e6e0 100644 --- a/autoapp/UI/MainWindow.cpp +++ b/autoapp/UI/MainWindow.cpp @@ -18,10 +18,6 @@ #include #include -#include -#include -#include -#include #include #include "autoapp/UI/MainWindow.hpp" @@ -89,75 +85,6 @@ namespace autoapp } } -void autoapp::ui::MainWindow::updateBtNowPlaying() -{ - QDBusInterface manager( - "org.bluez", - "/", - "org.freedesktop.DBus.ObjectManager", - QDBusConnection::systemBus()); - - if (!manager.isValid()) - { - qDebug() << "Failed to connect to BlueZ D-Bus"; - return; - } - - QDBusReply reply = manager.call("GetManagedObjects"); - - if (!reply.isValid()) - { - qDebug() << "D-Bus call failed:" << reply.error().message(); - return; - } - - QVariantMap allObjects = reply.value(); - - for (auto it = allObjects.begin(); it != allObjects.end(); ++it) - { - QString path = it.key(); - QVariantMap interfaces = it.value().toMap(); - - if (interfaces.contains("org.bluez.MediaPlayer1")) - { - qDebug() << "Found MediaPlayer at:" << path; - - QDBusInterface mediaPlayer( - "org.bluez", - path, - "org.freedesktop.DBus.Properties", - QDBusConnection::systemBus()); - - QDBusReply trackReply = mediaPlayer.call("Get", "org.bluez.MediaPlayer1", "Track"); - if (trackReply.isValid()) - { - QVariantMap track = trackReply.value().toMap(); - QString artist = track["Artist"].toString(); - QString title = track["Title"].toString(); - QString album = track["Album"].toString(); - - QString status = statusReply.value().toString(); - - qDebug() << "Now playing:" << artist << "-" << title << "from" << album; - qDebug() << "Status:" << status; - - if (status == "Playing") - { - //ui_->stackedWidget->setCurrentIndex(0); - //ui_->btSongName->setText(title); - //ui_->btArtistName->setText(artist); - //ui_->btAlbumName->setText(album); - } - else - { - //ui_->stackedWidget->setCurrentIndex(1); - } - } - break; - } - } -} - void autoapp::ui::MainWindow::connectWebSocket() { QUrl url(QStringLiteral("ws://127.0.0.1:5000")); // Change to your real server @@ -169,4 +96,4 @@ void autoapp::ui::MainWindow::handleIncomingMessage(const QString &message) { // Your custom message processing logic here qDebug() << "[Handler] Processing message:" << message; -} +} \ No newline at end of file diff --git a/autoapp/UI/mainwindow.ui b/autoapp/UI/mainwindow.ui index a89e95e..068b2f0 100644 --- a/autoapp/UI/mainwindow.ui +++ b/autoapp/UI/mainwindow.ui @@ -439,7 +439,7 @@ color: rgb(238, 238, 236); - Exit + 1. Exit false @@ -449,7 +449,7 @@ color: rgb(238, 238, 236); - Settings + 2. Settings false @@ -462,7 +462,7 @@ color: rgb(238, 238, 236); - Wireless connection + 3. Wireless connection false @@ -475,7 +475,7 @@ color: rgb(238, 238, 236); - Toggle cursor + 4. Toggle cursor false diff --git a/include/autoapp/UI/MainWindow.hpp b/include/autoapp/UI/MainWindow.hpp index 7c16f60..0f508e0 100644 --- a/include/autoapp/UI/MainWindow.hpp +++ b/include/autoapp/UI/MainWindow.hpp @@ -48,7 +48,6 @@ namespace autoapp private slots: void connectWebSocket(); void handleIncomingMessage(const QString &message); - void updateBtNowPlaying(); private: Ui::MainWindow *ui_;