2008-11-04 00:08:39 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2005 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org>
|
|
|
|
* Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, 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 Library 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 PLASMA_APPLET_P_H
|
|
|
|
#define PLASMA_APPLET_P_H
|
|
|
|
|
2008-11-04 03:39:56 +01:00
|
|
|
#include <kactioncollection.h>
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2008-11-15 22:23:56 +01:00
|
|
|
class KKeySequenceWidget;
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class FrameSvg;
|
|
|
|
class AppletScript;
|
|
|
|
class Wallpaper;
|
2008-11-04 19:22:55 +01:00
|
|
|
class BusyWidget;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
class AppletOverlayWidget : public QGraphicsWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AppletOverlayWidget(QGraphicsWidget *parent);
|
2009-02-04 12:39:22 +01:00
|
|
|
void destroy();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
2009-02-04 12:39:22 +01:00
|
|
|
|
|
|
|
protected Q_SLOTS:
|
|
|
|
void overlayAnimationComplete();
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class AppletPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet);
|
|
|
|
~AppletPrivate();
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
|
|
|
// put all setup routines for script here. at this point we can assume that
|
|
|
|
// package exists and that we have a script engin
|
|
|
|
void setupScriptSupport();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether or not this Applet is acting as a Containment
|
|
|
|
*/
|
|
|
|
void setIsContainment(bool isContainment);
|
|
|
|
|
|
|
|
QString globalName() const;
|
|
|
|
QString instanceName();
|
|
|
|
void scheduleConstraintsUpdate(Plasma::Constraints c);
|
2008-12-15 18:41:37 +01:00
|
|
|
void scheduleModificationNotification();
|
2008-11-04 00:08:39 +01:00
|
|
|
KConfigGroup *mainConfigGroup();
|
|
|
|
QString visibleFailureText(const QString &reason);
|
|
|
|
void checkImmutability();
|
|
|
|
void themeChanged();
|
|
|
|
void resetConfigurationObject();
|
|
|
|
void appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim);
|
|
|
|
void selectItemToDestroy();
|
|
|
|
void updateRect(const QRectF &rect);
|
|
|
|
void setFocus();
|
|
|
|
void cleanUpAndDelete();
|
2008-11-06 16:52:13 +01:00
|
|
|
void createMessageOverlay();
|
|
|
|
void destroyMessageOverlay();
|
2008-11-15 22:23:56 +01:00
|
|
|
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
2008-11-21 04:43:45 +01:00
|
|
|
void clearShortcutEditorPtr();
|
2009-01-05 19:08:14 +01:00
|
|
|
void configDialogFinished();
|
2009-01-20 03:11:01 +01:00
|
|
|
void generateGenericConfigDialog();
|
|
|
|
QString configDialogId() const;
|
|
|
|
QString configWindowTitle() const;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
static uint s_maxAppletId;
|
2009-01-23 19:07:20 +01:00
|
|
|
static int s_maxZValue;
|
|
|
|
static int s_minZValue;
|
2008-11-04 00:08:39 +01:00
|
|
|
static PackageStructure::Ptr packageStructure;
|
|
|
|
|
|
|
|
//TODO: examine the usage of memory here; there's a pretty large
|
|
|
|
// number of members at this point.
|
|
|
|
uint appletId;
|
|
|
|
Applet *q;
|
|
|
|
|
|
|
|
Extender *extender;
|
|
|
|
Applet::BackgroundHints backgroundHints;
|
|
|
|
KPluginInfo appletDescription;
|
2008-11-06 16:52:13 +01:00
|
|
|
AppletOverlayWidget *messageOverlay;
|
2008-11-04 19:22:55 +01:00
|
|
|
Plasma::BusyWidget *busyWidget;
|
2008-12-11 04:10:36 +01:00
|
|
|
QSet<QGraphicsItem*> registeredAsDragHandle;
|
2008-11-04 00:08:39 +01:00
|
|
|
QStringList loadedEngines;
|
|
|
|
Plasma::FrameSvg *background;
|
|
|
|
AppletScript *script;
|
2009-02-08 16:24:56 +01:00
|
|
|
QVariantList args;
|
2008-11-04 00:08:39 +01:00
|
|
|
Package *package;
|
|
|
|
ConfigLoader *configLoader;
|
|
|
|
KConfigGroup *mainConfig;
|
|
|
|
Plasma::Constraints pendingConstraints;
|
|
|
|
Plasma::AspectRatioMode aspectRatioMode;
|
|
|
|
ImmutabilityType immutability;
|
|
|
|
KActionCollection actions;
|
|
|
|
KAction *activationAction;
|
2008-11-15 22:23:56 +01:00
|
|
|
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
2008-11-04 00:08:39 +01:00
|
|
|
int constraintsTimerId;
|
|
|
|
int modificationsTimerId;
|
|
|
|
bool hasConfigurationInterface : 1;
|
|
|
|
bool failed : 1;
|
|
|
|
bool isContainment : 1;
|
|
|
|
bool square : 1;
|
|
|
|
bool transient : 1;
|
2008-11-06 16:52:13 +01:00
|
|
|
bool needsConfig : 1;
|
2008-11-14 05:34:52 +01:00
|
|
|
bool started : 1;
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif
|