refactor: removed unneeded files

This commit is contained in:
kossLAN 2024-05-19 22:08:27 -04:00
parent 9c2d276902
commit cb7708a683
5 changed files with 1 additions and 161 deletions

View file

@ -7,8 +7,7 @@ qt_add_dbus_adaptor(DBUS_INTERFACES
) )
set_source_files_properties(org.mpris.MediaPlayer2.Player.xml PROPERTIES set_source_files_properties(org.mpris.MediaPlayer2.Player.xml PROPERTIES
CLASSNAME DBusMprisPlayer CLASSNAME DBusMprisPlayer
#[[ INCLUDE dbus_item_types.hpp ]]
) )
qt_add_dbus_interface(DBUS_INTERFACES qt_add_dbus_interface(DBUS_INTERFACES
@ -30,7 +29,6 @@ qt_add_library(quickshell-service-mpris STATIC
watcher.cpp watcher.cpp
player.cpp player.cpp
#[[ dbus_item_types.cpp ]]
${DBUS_INTERFACES} ${DBUS_INTERFACES}
) )

View file

@ -1,121 +0,0 @@
#include "dbus_item_types.hpp"
#include <qdbusargument.h>
#include <qdbusextratypes.h>
#include <qdebug.h>
#include <qendian.h>
#include <qimage.h>
#include <qlogging.h>
#include <qmetatype.h>
#include <qsysinfo.h>
#include <qtypes.h>
QImage DBusMpIconPixmap::createImage() const {
// fix byte order if on a little endian machine
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
auto* newbuf = new quint32[this->data.size()];
const auto* oldbuf = reinterpret_cast<const quint32*>(this->data.data()); // NOLINT
for (uint i = 0; i < this->data.size() / sizeof(quint32); ++i) {
newbuf[i] = qFromBigEndian(oldbuf[i]); // NOLINT
}
return QImage(
reinterpret_cast<const uchar*>(newbuf), // NOLINT
this->width,
this->height,
QImage::Format_ARGB32,
[](void* ptr) { delete reinterpret_cast<quint32*>(ptr); }, // NOLINT
newbuf
);
} else {
return QImage(
reinterpret_cast<const uchar*>(this->data.data()), // NOLINT
this->width,
this->height,
QImage::Format_ARGB32
);
}
}
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusMpIconPixmap& pixmap) {
argument.beginStructure();
argument >> pixmap.width;
argument >> pixmap.height;
argument >> pixmap.data;
argument.endStructure();
return argument;
}
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusMpIconPixmap& pixmap) {
argument.beginStructure();
argument << pixmap.width;
argument << pixmap.height;
argument << pixmap.data;
argument.endStructure();
return argument;
}
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusMpIconPixmapList& pixmaps) {
argument.beginArray();
pixmaps.clear();
while (!argument.atEnd()) {
pixmaps.append(qdbus_cast<DBusMpIconPixmap>(argument));
}
argument.endArray();
return argument;
}
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusMpIconPixmapList& pixmaps) {
argument.beginArray(qMetaTypeId<DBusMpIconPixmap>());
for (const auto& pixmap: pixmaps) {
argument << pixmap;
}
argument.endArray();
return argument;
}
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusMpTooltip& tooltip) {
argument.beginStructure();
argument >> tooltip.icon;
argument >> tooltip.iconPixmaps;
argument >> tooltip.title;
argument >> tooltip.description;
argument.endStructure();
return argument;
}
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusMpTooltip& tooltip) {
argument.beginStructure();
argument << tooltip.icon;
argument << tooltip.iconPixmaps;
argument << tooltip.title;
argument << tooltip.description;
argument.endStructure();
return argument;
}
QDebug operator<<(QDebug debug, const DBusMpIconPixmap& pixmap) {
debug.nospace() << "DBusMpIconPixmap(width=" << pixmap.width << ", height=" << pixmap.height
<< ")";
return debug;
}
QDebug operator<<(QDebug debug, const DBusMpTooltip& tooltip) {
debug.nospace() << "DBusMpTooltip(title=" << tooltip.title
<< ", description=" << tooltip.description << ", icon=" << tooltip.icon
<< ", iconPixmaps=" << tooltip.iconPixmaps << ")";
return debug;
}
QDebug operator<<(QDebug debug, const QDBusObjectPath& path) {
debug.nospace() << "QDBusObjectPath(" << path.path() << ")";
return debug;
}

View file

@ -1,35 +0,0 @@
#pragma once
#include <qdbusargument.h>
#include <qdbusextratypes.h>
#include <qdebug.h>
#include <qlist.h>
struct DBusMpIconPixmap {
qint32 width = 0;
qint32 height = 0;
QByteArray data;
// valid only for the lifetime of the pixmap
[[nodiscard]] QImage createImage() const;
};
using DBusMpIconPixmapList = QList<DBusMpIconPixmap>;
struct DBusMpTooltip {
QString icon;
DBusMpIconPixmapList iconPixmaps;
QString title;
QString description;
};
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusMpIconPixmap& pixmap);
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusMpIconPixmap& pixmap);
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusMpIconPixmapList& pixmaps);
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusMpIconPixmapList& pixmaps);
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusMpTooltip& tooltip);
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusMpTooltip& tooltip);
QDebug operator<<(QDebug debug, const DBusMpIconPixmap& pixmap);
QDebug operator<<(QDebug debug, const DBusMpTooltip& tooltip);
QDebug operator<<(QDebug debug, const QDBusObjectPath& path);

View file

@ -11,7 +11,6 @@
#include <qtypes.h> #include <qtypes.h>
#include "../../dbus/properties.hpp" #include "../../dbus/properties.hpp"
#include "dbus_item_types.hpp"
#include "dbus_player.h" #include "dbus_player.h"
using namespace qs::dbus; using namespace qs::dbus;

View file

@ -8,7 +8,6 @@
#include "../../dbus/properties.hpp" #include "../../dbus/properties.hpp"
#include "dbus_player.h" #include "dbus_player.h"
#include "dbus_item_types.hpp"
Q_DECLARE_LOGGING_CATEGORY(logMprisPlayer); Q_DECLARE_LOGGING_CATEGORY(logMprisPlayer);