Jump to content

Plasma/libplasma2/API Review: Difference between revisions

From KDE Community Wiki
Notmart (talk | contribs)
Notmart (talk | contribs)
No edit summary
Line 1: Line 1:
= Applet =
= Applet =
== QProperties ==
All Q_PROPERTY and Q_INVOKABLE will be removed from Applet, that is no more directly exposed in QML.


== Contstructors ==
== Bookkeeping ==
Probably not all of them are still required:
=== Keep ===
* explicit Applet(QObject *parent = 0, const QString &serviceId = QString(), uint appletId = 0);
       uint id() const;
* explicit Applet(const KPluginInfo &info, QObject *parent = 0, uint appletId = 0);
       virtual FormFactor formFactor() const;   -> not virtual
* explicit Applet(QObject *parent, const QString &serviceId, uint appletId, const QVariantList &args);
       virtual Location location() const;    -> not virtual
* protected Applet(QObject *parent, const QVariantList &args);
       void setImmutability(const ImmutabilityType immutable);
* private Applet(const QString &packagePath, uint appletId, const QVariantList &args);
       ImmutabilityType immutability() const;
       SIGNAL void immutabilityChanged(Plasma::ImmutabilityType immutable);
       bool hasFailedToLaunch() const;
       void setFailedToLaunch(bool failed, const QString &reason = QString()); -> '''TODO''': show why the thing failed in the UI
       bool destroyed() const;
       virtual void destroy();
       ItemStatus status() const; → unslotify
       void setStatus(const ItemStatus stat);
       SIGNAL void newStatus(Plasma::ItemStatus status); -> TODO: change name to statusChanged
=== Remove ===
       Plasma::AspectRatioMode aspectRatioMode() const;
       void setAspectRatioMode(Plasma::AspectRatioMode);


== Methods ==
==Configuration==
===To be removed===
We should have a single configuration object binded to qml (either created by autogenerated qml, a model or a property hash)
        KConfigGroup config() const;
        KConfigGroup globalConfig() const;
        ConfigLoader *configScheme() const;
Topic: can this be made flexible enough to replace config read/write?
Topic: will need a global version (for globalConfig())
Topic: should we use QML for config, if so: how?
        virtual void save(KConfigGroup &group) const;
        virtual void restore(KConfigGroup &group);
        virtual void configChanged(); -> to signal
        virtual void saveState(KConfigGroup &config) const;
        SIGNAL void configNeedsSaving();
        bool hasConfigurationInterface() const;
        void setHasConfigurationInterface(bool hasInterface);
        void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
        bool configurationRequired() const;
        virtual void showConfigurationInterface();
=== Completely UI-specific, remove or move to scriptengine ===
        void showConfigurationInterface(QWidget *widget);
        virtual void createConfigurationInterface(KConfigDialog *parent);
        bool isUserConfiguring() const
        Private class AppletConfigDialog is part of this


Those two in some qml binding:
== Utils ==
* QPoint popupPosition(const QSize &s) const;
=== Keep ===
* QPoint popupPosition(const QSize &s, Qt::AlignmentFlag alignment) const;
        Package package() const;
 
        void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
Needs to see what constraints are still valid and what not (probably just sizeconstraint invalid now)
        void flushPendingConstraintsEvents();
* void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
        virtual void constraintsEvent(Plasma::Constraints constraints);
 
=== Remove ===
Completely obsolete:
        DataEngine *dataEngine(const QString &name) const;
* QFont font() const;
        QPoint popupPosition(const QSize &s) const; -> Dialog in bindings
* bool shouldConserveResources() const;
        QPoint popupPosition(const QSize &s, Qt::AlignmentFlag alignment) const;
* void showMessage(const QIcon &icon, const QString &message, const Plasma::MessageButtons buttons); (messagebox qml components)
 
Are those still applicable/necessary?
* bool destroyed() const;
* bool hasAuthorization(const QString &constraint) const;
* Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;  since dataengine has an independent qml binding, is this still needed?
 
=== In PluginLoader? ===
* static KPluginInfo::List listAppletInfo(const QString &category = QString(), const QString &parentApp = QString());
 
* static KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype);
 
* static KPluginInfo::List listAppletInfoForUrl(const QUrl &url);
 
* static QStringList listCategories(const QString &parentApp = QString(), bool visibleOnly = true);
 
* void setCustomCategories(const QStringList &categories);
 
* QStringList customCategories();
 
* static Applet *loadPlasmoid(const QString &path, uint appletId = 0, const QVariantList &args = QVariantList());
 
* static QString category(const KPluginInfo &applet);
 
* static QString category(const QString &appletName);
 
 
 
== Signals ==
 
* void releaseVisualFocus();
* void appletTransformedByUser();
* void appletTransformedItself();
* void messageButtonPressed(const Plasma::MessageButton button);
 
== Slots ==
 
* void destroy(); (is used to do an animation before deleting, animations are not managed here anymore tough)
* virtual void showConfigurationInterface();
* void showConfigurationInterface(QWidget *widget);  probably still valid, but not qwidget based
* bool hasFocus() const;
* void setFocus(Qt::FocusReason);


= Containment =
= Containment =

Revision as of 14:38, 11 February 2013

Applet

QProperties

All Q_PROPERTY and Q_INVOKABLE will be removed from Applet, that is no more directly exposed in QML.

Bookkeeping

Keep

       uint id() const;
       virtual FormFactor formFactor() const;   -> not virtual
       virtual Location location() const;    -> not virtual
       void setImmutability(const ImmutabilityType immutable);
       ImmutabilityType immutability() const;
       SIGNAL void immutabilityChanged(Plasma::ImmutabilityType immutable);
       bool hasFailedToLaunch() const;
       void setFailedToLaunch(bool failed, const QString &reason = QString()); -> TODO: show why the thing failed in the UI
       bool destroyed() const;
       virtual void destroy();
       ItemStatus status() const; → unslotify
       void setStatus(const ItemStatus stat);
       SIGNAL void newStatus(Plasma::ItemStatus status); -> TODO: change name to statusChanged

Remove

       Plasma::AspectRatioMode aspectRatioMode() const;
       void setAspectRatioMode(Plasma::AspectRatioMode);

Configuration

We should have a single configuration object binded to qml (either created by autogenerated qml, a model or a property hash)

       KConfigGroup config() const;
       KConfigGroup globalConfig() const;
       ConfigLoader *configScheme() const;

Topic: can this be made flexible enough to replace config read/write? Topic: will need a global version (for globalConfig()) Topic: should we use QML for config, if so: how?

       virtual void save(KConfigGroup &group) const;
       virtual void restore(KConfigGroup &group);
       virtual void configChanged(); -> to signal
       virtual void saveState(KConfigGroup &config) const;
       SIGNAL void configNeedsSaving();
       bool hasConfigurationInterface() const;
       void setHasConfigurationInterface(bool hasInterface);
       void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
       bool configurationRequired() const;
       virtual void showConfigurationInterface();

Completely UI-specific, remove or move to scriptengine

       void showConfigurationInterface(QWidget *widget);
       virtual void createConfigurationInterface(KConfigDialog *parent);
       bool isUserConfiguring() const
       Private class AppletConfigDialog is part of this

Utils

Keep

       Package package() const;
       void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
       void flushPendingConstraintsEvents();
       virtual void constraintsEvent(Plasma::Constraints constraints);

Remove

       DataEngine *dataEngine(const QString &name) const;
       QPoint popupPosition(const QSize &s) const; -> Dialog in bindings
       QPoint popupPosition(const QSize &s, Qt::AlignmentFlag alignment) const;

Containment

Constructors

All still needed?

  • explicit Containment(QObject *parent = 0, const QString &serviceId = QString(), uint containmentId = 0)
  • Containment(QObject *parent, const QVariantList &args);
  • private Containment(const QString &packagePath, uint appletId, const QVariantList &args);

Methods

  • Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(), const QRectF &geometry = QRectF(-1, -1, -1, -1)); Remove Geometry? not possible anymore
  • void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1)); Remove pos? (not possible anymore)
  • void setScreen(int screen, int desktop = -1); Drop desktop? (that means dropping the per-virtual desktop views feature, it can be "emulated" with activities and would make things dramatically simpler)
  • int desktop() const;
  • int lastDesktop() const;
  • void showContextMenu(const QPointF &containmentPos, const QPoint &screenPos);
  • virtual void showDropZone(const QPoint pos);
  • void contextMenuEvent(QContextMenuEvent *event);
  • void keyPressEvent(QKeyEvent *event);
  • void wheelEvent(QWheelEvent *event);

In PluginLoader?

  • static KPluginInfo::List listContainments(const QString &category = QString(), const QString &parentApp = QString());
  • static KPluginInfo::List listContainmentsOfType(const QString &type, const QString &category = QString(), const QString &parentApp = QString());
  • static QStringList listContainmentTypes();
  • static KPluginInfo::List listContainmentsForMimeType(const QString &mimeType);

Signals

  • void toolBoxToggled();
  • void toolBoxVisibilityChanged(bool);
  • void showAddWidgetsInterface(const QPointF &pos); (cannot have a position, maybe not needed at all)

Corona

Methods

  • Containment *containmentForScreen(int screen, int desktop = -1) const; Remove desktop?
  • Containment *containmentForScreen(int screen, int desktop, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs = QVariantList()); Remove desktop?

Still necassary?

  • void setAppletMimeType(const QString &mimetype);
  • QString appletMimeType();
  • void setDialogManager(AbstractDialogManager *manager); DialogManager was fow main windows of config uis. If all config is going to be qml, this could go (alternative is that we do an AbstractDialogManager that is a declarative view: possible as well).
  • AbstractDialogManager *dialogManager();
  • QString preferredToolBoxPlugin(const Containment::Type type) const; Toolboxes, instead of plugin may come from the only corona QML package.

void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin);

  • void setDefaultContainmentPlugin(const QString &name); Default containment plugin also told in the one Corona QML package?
  • void requestConfigSync(); Ugly api: are requestConfigSync and requireConfigSync still required both?
  • void requireConfigSync();

Signals

  • void releaseVisualFocus();