2023-09-26 15:33:08 +03:00
|
|
|
/* This file is part of the KDE project
|
|
|
|
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License version 2, as published by the Free Software Foundation.
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
You should have received a copy of the GNU Library General Public License
|
|
|
|
along with this library; see the file COPYING.LIB. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
#ifndef PAGER_H
|
|
|
|
#define PAGER_H
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
#include <QMutex>
|
|
|
|
#include <QAction>
|
2023-10-03 08:02:59 +03:00
|
|
|
#include <QComboBox>
|
2023-09-26 23:25:26 +03:00
|
|
|
#include <QSpacerItem>
|
2023-09-26 15:33:08 +03:00
|
|
|
#include <QGraphicsLinearLayout>
|
2023-09-26 21:47:42 +03:00
|
|
|
#include <QGraphicsSceneWheelEvent>
|
2023-09-26 23:25:26 +03:00
|
|
|
#include <KConfigDialog>
|
2023-09-27 17:55:58 +03:00
|
|
|
#include <KCModuleProxy>
|
2023-09-26 15:33:08 +03:00
|
|
|
#include <Plasma/Applet>
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
class PagerSvg;
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
class PagerApplet : public Plasma::Applet
|
2014-11-13 19:30:51 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-09-26 15:33:08 +03:00
|
|
|
public:
|
2023-10-03 08:02:59 +03:00
|
|
|
enum PagerMode {
|
|
|
|
ShowNumber = 0,
|
|
|
|
ShowName = 1
|
|
|
|
};
|
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
PagerApplet(QObject *parent, const QVariantList &args);
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
// Plasma::Applet reimplementations
|
|
|
|
void init() final;
|
|
|
|
void createConfigurationInterface(KConfigDialog *parent) final;
|
|
|
|
QList<QAction*> contextualActions() final;
|
2023-09-26 21:47:42 +03:00
|
|
|
// QGraphicsWidget reimplementations
|
|
|
|
void wheelEvent(QGraphicsSceneWheelEvent *event) final;
|
2023-09-26 22:29:06 +03:00
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) final;
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
private Q_SLOTS:
|
|
|
|
void slotUpdateLayout();
|
|
|
|
void slotAddDesktop();
|
|
|
|
void slotRemoveDesktop();
|
2023-09-26 23:25:26 +03:00
|
|
|
void slotConfigAccepted();
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
protected:
|
|
|
|
// Plasma::Applet reimplementation
|
|
|
|
void constraintsEvent(Plasma::Constraints constraints) final;
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
private:
|
2023-10-05 06:35:55 +03:00
|
|
|
void updatePolicyAndPagers();
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
QMutex m_mutex;
|
|
|
|
QGraphicsLinearLayout* m_layout;
|
|
|
|
QList<PagerSvg*> m_pagersvgs;
|
|
|
|
QAction* m_adddesktopaction;
|
|
|
|
QAction* m_removedesktopaction;
|
|
|
|
QList<QAction*> m_actions;
|
2023-10-03 08:02:59 +03:00
|
|
|
PagerApplet::PagerMode m_pagermode;
|
|
|
|
QComboBox* m_pagermodebox;
|
2023-09-26 23:25:26 +03:00
|
|
|
QSpacerItem* m_spacer;
|
2023-09-27 17:55:58 +03:00
|
|
|
KCModuleProxy* m_kcmdesktopproxy;
|
2023-09-26 15:33:08 +03:00
|
|
|
};
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
K_EXPORT_PLASMA_APPLET(pager, PagerApplet)
|
2014-11-13 19:30:51 +02:00
|
|
|
|
2023-09-26 15:33:08 +03:00
|
|
|
#endif // PAGER_H
|