add seekbar

This commit is contained in:
2026-02-02 01:57:25 +01:00
parent c742ca6d18
commit 9404321249
8 changed files with 217 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
#include <functional>
#include <string>
#include <map>
#include <sys/types.h>
#include <vector>
#include "glibmm/variant.h"
@@ -13,6 +14,7 @@ struct MprisPlayer2Message {
std::string title;
std::string artist;
std::string artwork_url;
uint32_t length_ms;
std::function<void()> play_pause;
std::function<void()> next;

View File

@@ -7,8 +7,7 @@
class MprisController {
public:
MprisController();
static std::shared_ptr<MprisController> getInstance();
void toggle_play();
void next_song();
@@ -17,6 +16,8 @@ class MprisController {
sigc::signal<void(const MprisPlayer2Message &)> &signal_mpris_updated();
private:
MprisController();
Glib::RefPtr<Gio::DBus::Connection> m_connection;
Glib::RefPtr<Gio::DBus::Proxy> m_proxy;
sigc::signal<void(const MprisPlayer2Message &)> mprisUpdatedSignal;

View File

@@ -1,12 +1,46 @@
#pragma once
#include <memory>
#include "components/popover.hpp"
#include "gtkmm/box.h"
#include "gtkmm/label.h"
#include "gtkmm/overlay.h"
#include "gtkmm/picture.h"
#include "gtkmm/scale.h"
#include "gtkmm/scrolledwindow.h"
#include "services/dbus/mpris.hpp"
class ControlCenter : public Popover {
public:
ControlCenter(std::string icon, std::string name);
private:
std::shared_ptr<MprisController> mprisController = MprisController::getInstance();
Gtk::Box container;
Gtk::Box spotifyContainer;
// image as background, artist, title
Gtk::Overlay topContainer;
Gtk::Picture backgroundImage;
Gtk::Box infoContainer;
Gtk::Label artistLabel;
Gtk::Label titleLabel;
//
Gtk::Box seekBarContainer;
Gtk::Label currentTimeLabel;
Gtk::Scale seekBar;
Gtk::Label totalTimeLabel;
// playback controls
Gtk::Box bottomContainer;
Gtk::Button previousButton;
Gtk::Button playPauseButton;
Gtk::Button nextButton;
Gtk::ScrolledWindow imageWrapper;
void onSpotifyMprisUpdated(const MprisPlayer2Message &message);
};