summaryrefslogtreecommitdiff
path: root/raveos-calamares-module/desktopselect/DesktopBackend.h
blob: 4ceb6cb9a0621b1fcd978eb553fc8f6721bd62dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <QObject>
#include <QStringList>
#include <QVariantList>

class DesktopBackend : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QVariantList desktops READ desktops NOTIFY desktopsChanged)
    Q_PROPERTY(int selectedIndex READ selectedIndex NOTIFY selectedIndexChanged)

public:
    explicit DesktopBackend(QObject* parent = nullptr);

    QVariantList desktops() const { return m_desktops; }
    int selectedIndex() const { return m_selectedIndex; }

    void setDesktops(const QVariantList& desktops);
    QStringList selectedPackages() const;

    Q_INVOKABLE void selectDesktop(int index);

signals:
    void desktopsChanged();
    void selectedIndexChanged();
    void selectionMade();

private:
    QVariantList m_desktops;
    int m_selectedIndex = -1;
};