shift-shell/containments/homescreens/folio/applicationlistmodel.h
Devin Lin 2d2b7407a6 startupfeedback: Change to be window based and controlled by a model
This makes the startup feedback more robust, by having instances be controlled by a model which can listen to window changes. Being window based also allows for the close button and gestures to work properly with it, since it will show up in the task switcher as well.

Fixes:
* https://invent.kde.org/plasma/plasma-mobile/-/issues/357
* https://invent.kde.org/plasma/plasma-mobile/-/issues/338
* https://invent.kde.org/plasma/plasma-mobile/-/issues/335 (dark themes now tint the background color)
* https://invent.kde.org/plasma/plasma-mobile/-/issues/330
* https://invent.kde.org/plasma/plasma-mobile/-/issues/30
2024-07-13 16:30:07 +00:00

55 lines
1.3 KiB
C++

// SPDX-FileCopyrightText: 2014 Antonis Tsiapaliokas <antonis.tsiapaliokas@kde.org>
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QAbstractListModel>
#include <QList>
#include <QObject>
#include <QQuickItem>
#include <QSet>
#include "foliodelegate.h"
#include "homescreen.h"
class HomeScreen;
class FolioDelegate;
/**
* @short The base application list, used directly by the app drawer.
*/
class ApplicationListModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Roles {
DelegateRole = Qt::UserRole + 1,
NameRole,
};
ApplicationListModel(HomeScreen *parent = nullptr);
~ApplicationListModel() override;
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
void load();
public Q_SLOTS:
void sycocaDbChanged();
protected:
HomeScreen *m_homeScreen{nullptr};
QList<FolioDelegate *> m_delegates;
};
class ApplicationListSearchModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
ApplicationListSearchModel(HomeScreen *parent = nullptr, ApplicationListModel *model = nullptr);
};