[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin/scripting2] scripting: adsasdf2
From:       David Edmundson <null () kde ! org>
Date:       2018-07-31 21:37:19
Message-ID: E1fkcKV-0001yG-1z () code ! kde ! org
[Download RAW message or body]

Git commit ae8ef696c34269c46830a9d27e01df741d346329 by David Edmundson.
Committed on 31/07/2018 at 20:28.
Pushed by davidedmundson into branch 'scripting2'.

adsasdf2

M  +5    -22   scripting/scriptedeffect.cpp
M  +11   -10   scripting/scriptedeffect.h

https://commits.kde.org/kwin/ae8ef696c34269c46830a9d27e01df741d346329

diff --git a/scripting/scriptedeffect.cpp b/scripting/scriptedeffect.cpp
index efd15a993..c6db01203 100644
--- a/scripting/scriptedeffect.cpp
+++ b/scripting/scriptedeffect.cpp
@@ -195,7 +195,7 @@ bool ScriptedEffect::init(const QString &effectName, const \
                QString &pathToScript
     m_engine->globalObject().setProperty(QStringLiteral("effects"), effectsObject);
 
     //desktopChanged is overloaded, which is problematic
-    //old code exposed the signal also with parameters. QJSEngine does not so we \
have to shim it +    //old code exposed the signal also with parameters. QJSEngine \
                does not so we have to fake it
     effectsObject.setProperty("desktopChanged(int,int)", \
                effectsObject.property("desktopChangedCompat"));
     effectsObject.setProperty("desktopChanged", \
effectsObject.property("desktopChangedCompat"));  
@@ -222,8 +222,8 @@ bool ScriptedEffect::init(const QString &effectName, const \
                QString &pathToScript
     engine()->globalObject().setProperty("registerTouchScreenEdge", \
                selfWrapper.property("registerTouchScreenEdge"));
     engine()->globalObject().setProperty("unregisterTouchScreenEdge", \
selfWrapper.property("unregisterTouchScreenEdge"));  
-    engine()->globalObject().setProperty("animate", \
                selfWrapper.property("animateGlobal"));
-    engine()->globalObject().setProperty("set", selfWrapper.property("setGlobal"));
+    engine()->globalObject().setProperty("animate", \
selfWrapper.property("animate")); +    engine()->globalObject().setProperty("set", \
                selfWrapper.property("set"));
     engine()->globalObject().setProperty("retarget", \
                selfWrapper.property("retarget"));
     engine()->globalObject().setProperty("cancel", selfWrapper.property("cancel"));
 
@@ -233,8 +233,6 @@ bool ScriptedEffect::init(const QString &effectName, const \
QString &pathToScript  
     if (ret.isError()) {
         qDebug() <<" HERE! " << ret.property("lineNumber").toInt() << \
                ret.toString();
-
-        //        signalHandlerException(ret);
         return false;
     }
     scriptFile.close();
@@ -274,21 +272,6 @@ void ScriptedEffect::animationEnded(KWin::EffectWindow *w, \
Attribute a, uint met  emit animationEnded(w, 0);
 }
 
-//TODO port to QQmlEngine::warnings
-//void ScriptedEffect::signalHandlerException(const QJSValue &value)
-//{
-//    if (value.isError()) {
-//        qCDebug(KWIN_SCRIPTING) << "KWin Effect script encountered an error at \
                [Line " << m_engine->uncaughtExceptionLineNumber() << "]";
-//        qCDebug(KWIN_SCRIPTING) << "Message: " << value.toString();
-
-//        QJSValueIterator iter(value);
-//        while (iter.hasNext()) {
-//            iter.next();
-//            qCDebug(KWIN_SCRIPTING) << " " << iter.name() << ": " << \
                iter.value().toString();
-//        }
-//    }
-//}
-
 quint64 ScriptedEffect::animate(KWin::EffectWindow* w, \
KWin::AnimationEffect::Attribute a, int ms, const QJSValue &to, const QJSValue &from, \
uint metaData, QEasingCurve::Type curve, int delay)  {
     QEasingCurve qec;
@@ -323,12 +306,12 @@ bool ScriptedEffect::retarget(QList<quint64> animationIds, \
const QJSValue &newTa  return true;
 }
 
-QJSValue ScriptedEffect::animateGlobal(const QJSValue &args)
+QJSValue ScriptedEffect::animate(const QJSValue &args)
 {
     return startAnimation(args, false);
 }
 
-QJSValue ScriptedEffect::setGlobal(const QJSValue &object)
+QJSValue ScriptedEffect::set(const QJSValue &object)
 {
     return startAnimation(object, true);
 }
diff --git a/scripting/scriptedeffect.h b/scripting/scriptedeffect.h
index f5a3dfa45..1a98f502f 100644
--- a/scripting/scriptedeffect.h
+++ b/scripting/scriptedeffect.h
@@ -58,19 +58,22 @@ public:
     enum EasingCurve {
         GaussianCurve = 128
     };
+    static ScriptedEffect *create(const QString &effectName, const QString \
&pathToScript, int chainPosition); +    static ScriptedEffect *create(const \
KPluginMetaData &effect); +    ~ScriptedEffect() override;
+    static bool supported();
+
     const QString &scriptFile() const {
         return m_scriptFile;
     }
-    virtual void reconfigure(ReconfigureFlags flags);
+
+    void reconfigure(ReconfigureFlags flags) override;
+
     int requestedEffectChainPosition() const override {
         return m_chainPosition;
     }
     QString activeConfig() const;
     void setActiveConfig(const QString &name);
-    static ScriptedEffect *create(const QString &effectName, const QString \
                &pathToScript, int chainPosition);
-    static ScriptedEffect *create(const KPluginMetaData &effect);
-    static bool supported();
-    virtual ~ScriptedEffect();
     /**
      * Whether another effect has grabbed the @p w with the given @p grabRole.
      * @param w The window to check
@@ -107,7 +110,10 @@ public:
     }
 public Q_SLOTS:
     quint64 animate(KWin::EffectWindow *w, Attribute a, int ms, const QJSValue &to, \
const QJSValue &from = QJSValue(), uint metaData = 0, QEasingCurve::Type curve = \
QEasingCurve::Linear, int delay = 0); +    QJSValue animate(const QJSValue &object);
+
     quint64 set(KWin::EffectWindow *w, Attribute a, int ms, const QJSValue &to, \
const QJSValue &from = QJSValue(), uint metaData = 0, QEasingCurve::Type curve = \
QEasingCurve::Linear, int delay = 0); +    QJSValue set(const QJSValue &object);
 
     bool retarget(quint64 animationId, const QJSValue &newTarget, int \
                newRemainingTime = -1);
     bool retarget(QList<quint64> animationIds, const QJSValue &newTarget, int \
newRemainingTime = -1); @@ -115,11 +121,6 @@ public Q_SLOTS:
     bool cancel(quint64 animationId);
     bool cancel(QList<quint64> animationIds);
 
-    //takes a big object blob of data, returns an array of
-    //or throws an error
-    QJSValue animateGlobal(const QJSValue &object);
-    QJSValue setGlobal(const QJSValue &object);
-
     bool borderActivated(ElectricBorder border) override;
 
 Q_SIGNALS:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic