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
|
|
|
|
|
2009-02-28 23:52:17 +01:00
|
|
|
#include <QGraphicsProxyWidget>
|
|
|
|
|
2008-11-04 03:39:56 +01:00
|
|
|
#include <kactioncollection.h>
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-04-09 07:57:57 +02:00
|
|
|
#include "plasma/animator.h"
|
2009-04-01 01:51:52 +02:00
|
|
|
#include "plasma/private/dataengineconsumer_p.h"
|
|
|
|
|
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
|
|
|
|
{
|
2009-04-09 08:07:33 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
public:
|
|
|
|
AppletOverlayWidget(QGraphicsWidget *parent);
|
2009-02-04 12:39:22 +01:00
|
|
|
void destroy();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-03-05 14:05:12 +01:00
|
|
|
qreal opacity;
|
|
|
|
|
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:
|
2009-04-09 07:57:57 +02:00
|
|
|
void overlayAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation);
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
2009-04-01 01:51:52 +02:00
|
|
|
class AppletPrivate : public DataEngineConsumer
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet);
|
|
|
|
~AppletPrivate();
|
|
|
|
|
2009-04-26 02:43:20 +02:00
|
|
|
void init(const QString &packagePath = QString());
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
// 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
|
|
|
|
*/
|
2009-02-18 14:55:18 +01:00
|
|
|
void setIsContainment(bool isContainment, bool forceUpdate = false);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
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();
|
2009-03-06 19:21:59 +01:00
|
|
|
void createMessageOverlay(bool usePopup = true);
|
2008-11-06 16:52:13 +01:00
|
|
|
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-02-24 03:32:48 +01:00
|
|
|
KConfigDialog *generateGenericConfigDialog();
|
2009-01-20 03:11:01 +01:00
|
|
|
QString configDialogId() const;
|
|
|
|
QString configWindowTitle() const;
|
2009-05-03 22:22:14 +02:00
|
|
|
void updateShortcuts();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-05-03 22:22:14 +02:00
|
|
|
static KActionCollection* defaultActions(QObject *parent);
|
2009-05-01 20:03:13 +02:00
|
|
|
static QSet<QString> knownCategories();
|
|
|
|
|
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;
|
2009-05-18 13:15:00 +02:00
|
|
|
static QSet<QString> s_customCategories;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
//TODO: examine the usage of memory here; there's a pretty large
|
|
|
|
// number of members at this point.
|
|
|
|
uint appletId;
|
|
|
|
Applet *q;
|
|
|
|
|
2009-06-10 20:28:17 +02:00
|
|
|
// applet attributes
|
2008-11-04 00:08:39 +01:00
|
|
|
Applet::BackgroundHints backgroundHints;
|
2009-06-10 20:28:17 +02:00
|
|
|
Plasma::AspectRatioMode aspectRatioMode;
|
|
|
|
ImmutabilityType immutability;
|
|
|
|
|
|
|
|
// applet info we keep around in case its needed
|
2008-11-04 00:08:39 +01:00
|
|
|
KPluginInfo appletDescription;
|
2009-06-10 20:28:17 +02:00
|
|
|
QVariantList args;
|
|
|
|
|
|
|
|
// bookkeeping
|
|
|
|
Extender *extender;
|
2008-12-11 04:10:36 +01:00
|
|
|
QSet<QGraphicsItem*> registeredAsDragHandle;
|
2008-11-04 00:08:39 +01:00
|
|
|
Plasma::FrameSvg *background;
|
2009-06-10 20:28:17 +02:00
|
|
|
KConfigGroup *mainConfig;
|
|
|
|
Plasma::Constraints pendingConstraints;
|
|
|
|
|
|
|
|
// overlays and messages
|
|
|
|
AppletOverlayWidget *messageOverlay;
|
|
|
|
QGraphicsProxyWidget *messageOverlayProxy;
|
|
|
|
Plasma::BusyWidget *busyWidget;
|
|
|
|
|
|
|
|
// sripting and package stuff
|
2008-11-04 00:08:39 +01:00
|
|
|
AppletScript *script;
|
|
|
|
Package *package;
|
|
|
|
ConfigLoader *configLoader;
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// actions stuff; put activationAction into actions?
|
2009-05-03 22:22:14 +02:00
|
|
|
KActionCollection *actions;
|
2008-11-04 00:08:39 +01:00
|
|
|
KAction *activationAction;
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// configuration
|
2008-11-15 22:23:56 +01:00
|
|
|
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// timerEvent bookkeeping
|
2008-11-04 00:08:39 +01:00
|
|
|
int constraintsTimerId;
|
|
|
|
int modificationsTimerId;
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// a great green field of booleans :)
|
2008-11-04 00:08:39 +01:00
|
|
|
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
|