mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-16 15:19:58 +00:00
wayland support
This commit is contained in:
@ -21,17 +21,11 @@ import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
import "."
|
||||
|
||||
|
||||
Item {
|
||||
id: main
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds
|
||||
}
|
||||
|
||||
property bool debug: dpAdds.isDebugEnabled()
|
||||
property variant tooltipSettings: {
|
||||
@ -40,20 +34,113 @@ Item {
|
||||
"tooltipWidth": plasmoid.configuration.tooltipWidth
|
||||
}
|
||||
|
||||
signal needUpdate
|
||||
signal needTooltipUpdate
|
||||
signal sizeUpdate
|
||||
|
||||
signal needUpdate()
|
||||
signal needTooltipUpdate()
|
||||
signal sizeUpdate()
|
||||
|
||||
// init
|
||||
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
|
||||
Plasmoid.icon: "utilities-system-monitor"
|
||||
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||
onNeedUpdate: {
|
||||
if (debug)
|
||||
console.debug();
|
||||
|
||||
for (var i = 0; i < repeater.count; i++) {
|
||||
if (!repeater.itemAt(i)) {
|
||||
if (debug)
|
||||
console.info("Nothing to do here yet", i);
|
||||
|
||||
timer.start();
|
||||
return ;
|
||||
}
|
||||
repeater.itemAt(i).text = dpAdds.parsePattern(plasmoid.configuration.text, i);
|
||||
if (dpAdds.currentDesktop() === i) {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.currentFontColor;
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily;
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle === "italic";
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize;
|
||||
repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.currentFontWeight];
|
||||
repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.currentTextStyle];
|
||||
repeater.itemAt(i).styleColor = plasmoid.configuration.currentTextStyleColor;
|
||||
} else {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.fontColor;
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily;
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle === "italic";
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize;
|
||||
repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.fontWeight];
|
||||
repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.textStyle];
|
||||
repeater.itemAt(i).styleColor = plasmoid.configuration.textStyleColor;
|
||||
}
|
||||
repeater.itemAt(i).update();
|
||||
}
|
||||
sizeUpdate();
|
||||
needTooltipUpdate();
|
||||
}
|
||||
onNeedTooltipUpdate: {
|
||||
if (debug)
|
||||
console.debug();
|
||||
|
||||
for (var i = 0; i < repeater.count; i++) {
|
||||
repeater.itemAt(i).tooltip.text = dpAdds.toolTipImage(i);
|
||||
// resize text tooltip to content size
|
||||
// this hack does not work for images-based tooltips
|
||||
if (tooltipSettings.tooltipType === "names") {
|
||||
repeater.itemAt(i).tooltip.height = repeater.itemAt(i).tooltip.implicitHeight;
|
||||
repeater.itemAt(i).tooltip.width = repeater.itemAt(i).tooltip.implicitWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
onSizeUpdate: {
|
||||
if (debug)
|
||||
console.debug();
|
||||
|
||||
if (plasmoid.configuration.height === 0) {
|
||||
var newHeight = 0;
|
||||
for (var i = 0; i < repeater.count; i++) newHeight += repeater.itemAt(i).contentHeight
|
||||
Layout.minimumHeight = newHeight;
|
||||
Layout.maximumHeight = -1;
|
||||
} else {
|
||||
Layout.minimumHeight = plasmoid.configuration.height;
|
||||
Layout.maximumHeight = plasmoid.configuration.height;
|
||||
}
|
||||
if (plasmoid.configuration.width === 0) {
|
||||
var newWidth = 0;
|
||||
for (var i = 0; i < repeater.count; i++) newWidth += repeater.itemAt(i).contentWidth
|
||||
Layout.minimumWidth = newWidth;
|
||||
Layout.maximumWidth = -1;
|
||||
} else {
|
||||
Layout.minimumWidth = plasmoid.configuration.width;
|
||||
Layout.maximumWidth = plasmoid.configuration.width;
|
||||
}
|
||||
}
|
||||
Plasmoid.onUserConfiguringChanged: {
|
||||
if (plasmoid.userConfiguring)
|
||||
return ;
|
||||
|
||||
if (debug)
|
||||
console.debug();
|
||||
|
||||
dpAdds.setMark(plasmoid.configuration.mark);
|
||||
dpAdds.setToolTipData(tooltipSettings);
|
||||
needUpdate();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (debug)
|
||||
console.debug();
|
||||
|
||||
// init submodule
|
||||
Plasmoid.userConfiguringChanged(false);
|
||||
dpAdds.desktopChanged.connect(needUpdate);
|
||||
dpAdds.windowListChanged.connect(needTooltipUpdate);
|
||||
}
|
||||
|
||||
// backend
|
||||
DPAdds {
|
||||
id: dpAdds
|
||||
}
|
||||
|
||||
// ui
|
||||
GridLayout {
|
||||
@ -63,140 +150,56 @@ Item {
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
Layout.columnSpan: 0
|
||||
Layout.rowSpan: 0
|
||||
model: dpAdds.numberOfDesktops()
|
||||
|
||||
Text {
|
||||
id: text
|
||||
|
||||
property alias tooltip: tooltip
|
||||
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.NoWrap
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: dpAdds.parsePattern(plasmoid.configuration.text, index + 1)
|
||||
property alias tooltip: tooltip
|
||||
text: dpAdds.parsePattern(plasmoid.configuration.text, index)
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: dpAdds.setCurrentDesktop(index + 1)
|
||||
onClicked: dpAdds.setCurrentDesktop(index)
|
||||
onEntered: needTooltipUpdate()
|
||||
}
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
height: tooltip.height
|
||||
width: tooltip.width
|
||||
|
||||
mainItem: Text {
|
||||
id: tooltip
|
||||
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
|
||||
interval: 1000
|
||||
onTriggered: needUpdate()
|
||||
}
|
||||
|
||||
onNeedUpdate: {
|
||||
if (debug) console.debug()
|
||||
|
||||
for (var i=0; i<repeater.count; i++) {
|
||||
if (!repeater.itemAt(i)) {
|
||||
if (debug) console.info("Nothing to do here yet", i)
|
||||
timer.start()
|
||||
return
|
||||
}
|
||||
repeater.itemAt(i).text = dpAdds.parsePattern(plasmoid.configuration.text, i + 1)
|
||||
if (dpAdds.currentDesktop() == i + 1) {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.currentFontColor
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
|
||||
repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.currentFontWeight]
|
||||
repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.currentTextStyle]
|
||||
repeater.itemAt(i).styleColor = plasmoid.configuration.currentTextStyleColor
|
||||
} else {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.fontColor
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
|
||||
repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.fontWeight]
|
||||
repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.textStyle]
|
||||
repeater.itemAt(i).styleColor = plasmoid.configuration.textStyleColor
|
||||
}
|
||||
repeater.itemAt(i).update()
|
||||
}
|
||||
|
||||
sizeUpdate()
|
||||
needTooltipUpdate()
|
||||
}
|
||||
|
||||
onNeedTooltipUpdate: {
|
||||
if (debug) console.debug()
|
||||
|
||||
for (var i=0; i<repeater.count; i++) {
|
||||
repeater.itemAt(i).tooltip.text = dpAdds.toolTipImage(i + 1)
|
||||
// resize text tooltip to content size
|
||||
// this hack does not work for images-based tooltips
|
||||
if (tooltipSettings.tooltipType == "names") {
|
||||
repeater.itemAt(i).tooltip.height = repeater.itemAt(i).tooltip.implicitHeight
|
||||
repeater.itemAt(i).tooltip.width = repeater.itemAt(i).tooltip.implicitWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSizeUpdate: {
|
||||
if (debug) console.debug()
|
||||
|
||||
if (plasmoid.configuration.height == 0) {
|
||||
var newHeight = 0
|
||||
for (var i=0; i<repeater.count; i++)
|
||||
newHeight += repeater.itemAt(i).contentHeight
|
||||
Layout.minimumHeight = newHeight
|
||||
Layout.maximumHeight = -1
|
||||
} else {
|
||||
Layout.minimumHeight = plasmoid.configuration.height
|
||||
Layout.maximumHeight = plasmoid.configuration.height
|
||||
}
|
||||
if (plasmoid.configuration.width == 0) {
|
||||
var newWidth = 0
|
||||
for (var i=0; i<repeater.count; i++)
|
||||
newWidth += repeater.itemAt(i).contentWidth
|
||||
Layout.minimumWidth = newWidth
|
||||
Layout.maximumWidth = -1
|
||||
} else {
|
||||
Layout.minimumWidth = plasmoid.configuration.width
|
||||
Layout.maximumWidth = plasmoid.configuration.width
|
||||
}
|
||||
}
|
||||
|
||||
Plasmoid.onUserConfiguringChanged: {
|
||||
if (plasmoid.userConfiguring) return
|
||||
if (debug) console.debug()
|
||||
|
||||
dpAdds.setMark(plasmoid.configuration.mark)
|
||||
dpAdds.setToolTipData(tooltipSettings)
|
||||
|
||||
needUpdate()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.debug()
|
||||
|
||||
// init submodule
|
||||
Plasmoid.userConfiguringChanged(false)
|
||||
dpAdds.desktopChanged.connect(needUpdate)
|
||||
dpAdds.windowListChanged.connect(needTooltipUpdate)
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,10 @@
|
||||
#include <KNotifications/KNotification>
|
||||
#include <KWindowSystem/KWindowSystem>
|
||||
#include <KWindowSystem/KX11Extras>
|
||||
#include <taskmanager/virtualdesktopinfo.h>
|
||||
#include <taskmanager/waylandtasksmodel.h>
|
||||
#include <taskmanager/windowtasksmodel.h>
|
||||
#include <taskmanager/xwindowtasksmodel.h>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QGraphicsPixmapItem>
|
||||
@ -43,8 +47,10 @@ DPAdds::DPAdds(QObject *_parent)
|
||||
for (auto &metadata : AWDebug::getBuildData())
|
||||
qCDebug(LOG_DP) << metadata;
|
||||
|
||||
connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this,
|
||||
SIGNAL(desktopChanged()));
|
||||
m_vdi = new TaskManager::VirtualDesktopInfo(this);
|
||||
m_taskModel = new TaskManager::WindowTasksModel(this);
|
||||
|
||||
connect(m_vdi, SIGNAL(currentDesktopChanged()), this, SIGNAL(desktopChanged()));
|
||||
connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SIGNAL(windowListChanged()));
|
||||
connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SIGNAL(windowListChanged()));
|
||||
}
|
||||
@ -53,6 +59,9 @@ DPAdds::DPAdds(QObject *_parent)
|
||||
DPAdds::~DPAdds()
|
||||
{
|
||||
qCDebug(LOG_DP) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_vdi;
|
||||
delete m_taskModel;
|
||||
}
|
||||
|
||||
|
||||
@ -63,9 +72,11 @@ bool DPAdds::isDebugEnabled()
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::currentDesktop()
|
||||
int DPAdds::currentDesktop() const
|
||||
{
|
||||
return KX11Extras::currentDesktop();
|
||||
auto current = m_vdi->currentDesktop();
|
||||
auto decrement = KWindowSystem::isPlatformX11() ? 1 : 0;
|
||||
return m_vdi->position(current) - decrement;
|
||||
}
|
||||
|
||||
|
||||
@ -86,9 +97,9 @@ QStringList DPAdds::dictKeys(const bool _sorted, const QString &_regexp)
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::numberOfDesktops()
|
||||
int DPAdds::numberOfDesktops() const
|
||||
{
|
||||
return KX11Extras::numberOfDesktops();
|
||||
return m_vdi->numberOfDesktops();
|
||||
}
|
||||
|
||||
|
||||
@ -118,12 +129,16 @@ QString DPAdds::toolTipImage(const int _desktop) const
|
||||
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
auto screens = QGuiApplication::screens();
|
||||
auto desktop = std::accumulate(screens.cbegin(), screens.cend(), QRect(), [](QRect source, const QScreen *screen) {
|
||||
return source.united(screen->availableGeometry());
|
||||
});
|
||||
|
||||
// update
|
||||
auto width = static_cast<float>(info.desktop.width());
|
||||
auto height = static_cast<float>(info.desktop.height());
|
||||
auto width = static_cast<float>(desktop.width());
|
||||
auto height = static_cast<float>(desktop.height());
|
||||
float margin = 5.0f * width / 400.0f;
|
||||
toolTipView->resize(static_cast<int>(width + 2.0f * margin),
|
||||
static_cast<int>(height + 2.0f * margin));
|
||||
toolTipView->resize(static_cast<int>(width + 2.0f * margin), static_cast<int>(height + 2.0f * margin));
|
||||
toolTipScene->clear();
|
||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// borders
|
||||
@ -144,32 +159,27 @@ QString DPAdds::toolTipImage(const int _desktop) const
|
||||
auto bottom = static_cast<float>(rect.bottom());
|
||||
toolTipScene->addLine(left + margin, bottom + margin, left + margin, top + margin, pen);
|
||||
toolTipScene->addLine(left + margin, top + margin, right + margin, top + margin, pen);
|
||||
toolTipScene->addLine(right + margin, top + margin, right + margin, bottom + margin,
|
||||
pen);
|
||||
toolTipScene->addLine(right + margin, bottom + margin, left + margin, bottom + margin,
|
||||
pen);
|
||||
toolTipScene->addLine(right + margin, top + margin, right + margin, bottom + margin, pen);
|
||||
toolTipScene->addLine(right + margin, bottom + margin, left + margin, bottom + margin, pen);
|
||||
}
|
||||
} else if (m_tooltipType == "clean") {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
auto *screen = QGuiApplication::primaryScreen();
|
||||
std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(),
|
||||
[&toolTipScene, &screen](const WindowData &data) {
|
||||
QPixmap desktop = screen->grabWindow(data.id);
|
||||
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(),
|
||||
data.rect.top());
|
||||
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(), data.rect.top());
|
||||
});
|
||||
} else if (m_tooltipType == "windows") {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
auto *screen = QGuiApplication::primaryScreen();
|
||||
std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(),
|
||||
[&toolTipScene, &screen](const WindowData &data) {
|
||||
QPixmap desktop = screen->grabWindow(data.id);
|
||||
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(),
|
||||
data.rect.top());
|
||||
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(), data.rect.top());
|
||||
});
|
||||
std::for_each(info.windowsData.cbegin(), info.windowsData.cend(),
|
||||
[&toolTipScene, &screen](const WindowData &data) {
|
||||
QPixmap window = screen->grabWindow(data.id);
|
||||
toolTipScene->addPixmap(window)->setOffset(data.rect.left(),
|
||||
data.rect.top());
|
||||
toolTipScene->addPixmap(window)->setOffset(data.rect.left(), data.rect.top());
|
||||
});
|
||||
}
|
||||
|
||||
@ -233,13 +243,12 @@ QString DPAdds::valueByKey(const QString &_key, int _desktop) const
|
||||
|
||||
QString currentMark = currentDesktop() == _desktop ? m_mark : "";
|
||||
if (_key == "mark")
|
||||
return QString("%1")
|
||||
.arg(currentMark, m_mark.count(), QLatin1Char(' '))
|
||||
.replace(" ", " ");
|
||||
else if (_key == "name")
|
||||
return KX11Extras::desktopName(_desktop).replace(" ", " ");
|
||||
else if (_key == "number")
|
||||
return QString::number(_desktop);
|
||||
return QString("%1").arg(currentMark, m_mark.count(), QLatin1Char(' ')).replace(" ", " ");
|
||||
else if (_key == "name") {
|
||||
auto name = m_vdi->desktopNames().at(_desktop);
|
||||
return name.replace(" ", " ");
|
||||
} else if (_key == "number")
|
||||
return QString::number(_desktop + 1);
|
||||
else if (_key == "total")
|
||||
return QString::number(numberOfDesktops());
|
||||
else
|
||||
@ -262,8 +271,8 @@ QVariantMap DPAdds::getFont(const QVariantMap &_defaultFont)
|
||||
|
||||
QVariantMap fontMap;
|
||||
int ret = 0;
|
||||
CFont defaultCFont = CFont(_defaultFont["family"].toString(), _defaultFont["size"].toInt(), 400,
|
||||
false, _defaultFont["color"].toString());
|
||||
CFont defaultCFont = CFont(_defaultFont["family"].toString(), _defaultFont["size"].toInt(), 400, false,
|
||||
_defaultFont["color"].toString());
|
||||
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont, false, false, &ret);
|
||||
|
||||
fontMap["applied"] = ret;
|
||||
@ -291,35 +300,34 @@ void DPAdds::setCurrentDesktop(const int _desktop)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Desktop" << _desktop;
|
||||
|
||||
KX11Extras::setCurrentDesktop(_desktop);
|
||||
m_vdi->requestActivate(m_vdi->desktopIds().at(_desktop));
|
||||
}
|
||||
|
||||
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int _desktop)
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int _desktop) const
|
||||
{
|
||||
qCDebug(LOG_DP) << "Desktop" << _desktop;
|
||||
|
||||
auto desktop = m_vdi->desktopIds().at(_desktop);
|
||||
|
||||
DesktopWindowsInfo info;
|
||||
info.desktop = KX11Extras::workArea(_desktop);
|
||||
|
||||
for (auto &id : KX11Extras::windows()) {
|
||||
KWindowInfo winInfo = KWindowInfo(
|
||||
id, NET::Property::WMDesktop | NET::Property::WMGeometry | NET::Property::WMState
|
||||
| NET::Property::WMWindowType | NET::Property::WMVisibleName);
|
||||
if (!winInfo.isOnDesktop(_desktop))
|
||||
continue;
|
||||
for (auto i = 0; i < m_taskModel->rowCount(); i++) {
|
||||
auto model = m_taskModel->index(i, 0);
|
||||
WindowData data;
|
||||
data.id = id;
|
||||
data.name = winInfo.visibleName();
|
||||
data.rect = winInfo.geometry();
|
||||
if (winInfo.windowType(NET::WindowTypeMask::NormalMask) == NET::WindowType::Normal) {
|
||||
if (winInfo.isMinimized())
|
||||
|
||||
data.id = WId(0); // TODO
|
||||
data.name = model.data(TaskManager::AbstractTasksModel::AppName).toString();
|
||||
data.rect = model.data(TaskManager::AbstractTasksModel::Geometry).toRect();
|
||||
|
||||
auto desktops = model.data(TaskManager::AbstractTasksModel::VirtualDesktops).toList();
|
||||
if (desktops.isEmpty()) {
|
||||
// don't think it is possible to put desktop to desktop
|
||||
info.desktopsData.append(data);
|
||||
} else {
|
||||
auto isMinimized = model.data(TaskManager::AbstractTasksModel::IsMinimized).toBool();
|
||||
if (isMinimized || !desktops.contains(desktop))
|
||||
continue;
|
||||
info.windowsData.append(data);
|
||||
} else if (winInfo.windowType(NET::WindowTypeMask::DesktopMask)
|
||||
== NET::WindowType::Desktop) {
|
||||
info.desktopsData.append(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,11 @@
|
||||
#include <QRect>
|
||||
|
||||
|
||||
namespace TaskManager
|
||||
{
|
||||
class VirtualDesktopInfo;
|
||||
class WindowTasksModel;
|
||||
} // namespace TaskManager
|
||||
class DPAdds : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -35,7 +40,6 @@ class DPAdds : public QObject
|
||||
} WindowData;
|
||||
|
||||
typedef struct {
|
||||
QRect desktop;
|
||||
QList<WindowData> desktopsData;
|
||||
QList<WindowData> windowsData;
|
||||
} DesktopWindowsInfo;
|
||||
@ -44,9 +48,9 @@ public:
|
||||
explicit DPAdds(QObject *_parent = nullptr);
|
||||
~DPAdds() override;
|
||||
Q_INVOKABLE static bool isDebugEnabled();
|
||||
Q_INVOKABLE static int currentDesktop();
|
||||
Q_INVOKABLE [[nodiscard]] int currentDesktop() const;
|
||||
Q_INVOKABLE static QStringList dictKeys(bool _sorted = true, const QString &_regexp = "");
|
||||
Q_INVOKABLE static int numberOfDesktops();
|
||||
Q_INVOKABLE [[nodiscard]] int numberOfDesktops() const;
|
||||
Q_INVOKABLE [[nodiscard]] QString toolTipImage(int _desktop) const;
|
||||
Q_INVOKABLE [[nodiscard]] QString parsePattern(const QString &_pattern, int _desktop) const;
|
||||
// values
|
||||
@ -64,11 +68,13 @@ signals:
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString &_eventId, const QString &_message);
|
||||
Q_INVOKABLE static void setCurrentDesktop(int _desktop);
|
||||
Q_INVOKABLE void setCurrentDesktop(int _desktop);
|
||||
|
||||
private:
|
||||
static DesktopWindowsInfo getInfoByDesktop(int _desktop);
|
||||
[[nodiscard]] DesktopWindowsInfo getInfoByDesktop(int _desktop) const;
|
||||
// variables
|
||||
TaskManager::VirtualDesktopInfo *m_vdi = nullptr;
|
||||
TaskManager::WindowTasksModel *m_taskModel = nullptr;
|
||||
int m_tooltipWidth = 200;
|
||||
QString m_mark = "*";
|
||||
QString m_tooltipColor = "#000000";
|
||||
|
Reference in New Issue
Block a user