mirror of
https://invent.kde.org/plasma/plasma-desktop.git
synced 2026-11-03 14:49:44 -09:00
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the techbase wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://community.kde.org/Frameworks/GitOldHistory If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo kde-workspace, frameworks branch, at commit 049113e719dd2fc4446d054fa1a3aada330094f0
168 lines
5.6 KiB
C++
168 lines
5.6 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2007 by Daniel Laidig <d.laidig@gmx.de> *
|
|
* Copyright (C) 2012 by Luís Gabriel Lima <lampih@gmail.com> *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* This program 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 General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU General Public License *
|
|
* along with this program; if not, write to the *
|
|
* Free Software Foundation, Inc., *
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
***************************************************************************/
|
|
|
|
#ifndef PAGER_H
|
|
#define PAGER_H
|
|
|
|
#include <QGraphicsSceneHoverEvent>
|
|
#include <QList>
|
|
|
|
#include <Plasma/Applet>
|
|
|
|
#include "model.h"
|
|
#include <config-X11.h>
|
|
|
|
class QDesktopWidget;
|
|
|
|
class KColorScheme;
|
|
class KWindowInfo;
|
|
class KCModuleProxy;
|
|
|
|
namespace Plasma
|
|
{
|
|
class FrameSvg;
|
|
}
|
|
|
|
class Pager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(QObject* model READ model CONSTANT)
|
|
Q_PROPERTY(int currentDesktop READ currentDesktop NOTIFY currentDesktopChanged)
|
|
Q_PROPERTY(bool showWindowIcons READ showWindowIcons WRITE setShowWindowIcons NOTIFY showWindowIconsChanged)
|
|
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
|
|
Q_PROPERTY(QSizeF size READ size WRITE setSize NOTIFY sizeChanged)
|
|
Q_PROPERTY(QSize preferredSize READ preferredSize NOTIFY preferredSizeChanged)
|
|
Q_PROPERTY(Pager::CurrentDesktopSelected currentDesktopSelected READ currentDesktopSelected WRITE setCurrentDesktopSelected NOTIFY currentDesktopSelectedChanged)
|
|
Q_PROPERTY(Pager::DisplayedText displayedText READ displayedText WRITE setDisplayedText NOTIFY displayedTextChanged)
|
|
|
|
public:
|
|
enum CurrentDesktopSelected {
|
|
DoNothing = 0,
|
|
ShowDesktop,
|
|
ShowDashboard
|
|
};
|
|
Q_ENUMS(CurrentDesktopSelected)
|
|
|
|
enum DisplayedText {
|
|
Number = 0,
|
|
Name,
|
|
None
|
|
};
|
|
Q_ENUMS(DisplayedText)
|
|
|
|
Pager(QObject *parent = 0);
|
|
~Pager();
|
|
|
|
//void constraintsEvent(Plasma::Constraints);
|
|
virtual QList<QAction*> contextualActions();
|
|
|
|
QObject *model() const { return m_pagerModel; }
|
|
|
|
int currentDesktop() const { return m_currentDesktop; }
|
|
void setCurrentDesktop(int desktop);
|
|
|
|
bool showWindowIcons() const { return m_showWindowIcons; }
|
|
void setShowWindowIcons(bool show);
|
|
|
|
Qt::Orientation orientation() const;
|
|
void setOrientation(Qt::Orientation orientation);
|
|
|
|
QSizeF size() const;
|
|
void setSize(const QSizeF &size);
|
|
|
|
QSize preferredSize() const;
|
|
|
|
CurrentDesktopSelected currentDesktopSelected() const;
|
|
void setCurrentDesktopSelected(CurrentDesktopSelected cur);
|
|
|
|
DisplayedText displayedText() const;
|
|
void setDisplayedText(DisplayedText disp);
|
|
|
|
Q_INVOKABLE void moveWindow(int, double, double, int, int);
|
|
Q_INVOKABLE void changeDesktop(int desktopId);
|
|
|
|
Q_SIGNALS:
|
|
void currentDesktopChanged();
|
|
void showWindowIconsChanged();
|
|
void orientationChanged();
|
|
void sizeChanged();
|
|
void preferredSizeChanged();
|
|
void currentDesktopSelectedChanged();
|
|
void displayedTextChanged();
|
|
|
|
public Q_SLOTS:
|
|
void recalculateGridSizes(int rows);
|
|
void updateSizes();
|
|
void recalculateWindowRects();
|
|
|
|
protected Q_SLOTS:
|
|
void currentDesktopChanged(int desktop);
|
|
void currentActivityChanged(const QString &activity);
|
|
void desktopsSizeChanged();
|
|
void numberOfDesktopsChanged(int num);
|
|
void desktopNamesChanged();
|
|
void windowChanged(WId id, const unsigned long *dirty);
|
|
void startTimer();
|
|
void startTimerFast();
|
|
#if HAVE_X11
|
|
void slotAddDesktop();
|
|
void slotRemoveDesktop();
|
|
#endif
|
|
|
|
protected:
|
|
void createMenu();
|
|
QRect fixViewportPosition( const QRect& r );
|
|
|
|
private:
|
|
|
|
PagerModel *m_pagerModel;
|
|
|
|
QTimer* m_timer;
|
|
|
|
|
|
DisplayedText m_displayedText;
|
|
CurrentDesktopSelected m_currentDesktopSelected;
|
|
int m_rows;
|
|
int m_columns;
|
|
int m_desktopCount;
|
|
int m_currentDesktop;
|
|
QString m_currentActivity;
|
|
qreal m_widthScaleFactor;
|
|
qreal m_heightScaleFactor;
|
|
QSizeF m_size;
|
|
QSize m_preferredSize;
|
|
Qt::Orientation m_orientation;
|
|
|
|
//list of info about animations for each desktop
|
|
QList<QAction*> m_actions;
|
|
QAction *m_addDesktopAction;
|
|
QAction *m_removeDesktopAction;
|
|
|
|
bool m_showWindowIcons : 1;
|
|
bool m_desktopDown : 1;
|
|
bool m_validSizes : 1;
|
|
|
|
QDesktopWidget *m_desktopWidget;
|
|
#if HAVE_X11
|
|
bool m_isX11;
|
|
#endif
|
|
};
|
|
|
|
#endif
|