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

List:       kde-commits
Subject:    extragear/multimedia/kmplayer
From:       Koos Vriezen <koos.vriezen () gmail ! com>
Date:       2010-01-07 22:44:08
Message-ID: 1262904248.193056.6776.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1071399 by vriezen:

Support for accesskey as timing trigger

Conflicts with some of the accelerators and one has to click on the view
area first (for now of course)

 M  +13 -0     src/kmplayer_smil.cpp  
 M  +1 -0      src/kmplayer_smil.h  
 M  +21 -1     src/kmplayerpartbase.cpp  
 M  +7 -1      src/kmplayerplaylist.h  
 M  +1 -0      src/kmplayersource.h  
 M  +3 -3      src/playlistview.cpp  
 M  +10 -0     src/viewarea.cpp  
 M  +1 -0      src/viewarea.h  
 M  +3 -3      tests/excl_timings.smil  


--- trunk/extragear/multimedia/kmplayer/src/kmplayer_smil.cpp #1071398:1071399
@@ -364,6 +364,19 @@
                         dur = Runtime::DurStateChanged;
                     }
                 }
+            } else if (*q && !strncmp (q, "accesskey", 9)) {
+                int op = vl.indexOf ('(', 9);
+                if (op > -1) {
+                    int cp = vl.indexOf (')', op + 1);
+                    if (cp > -1) {
+                        QString ch = vl.mid (op + 1, cp - op - 1);
+                        if (!ch.isEmpty ()) {
+                            payload = new KeyLoad (ch[0].unicode ());
+                            dur = Runtime::DurAccessKey;
+                            target = n->document ();
+                        }
+                    }
+                }
             } else
                 kWarning () << "setDuration no match " << cval;
             if (!target &&
--- trunk/extragear/multimedia/kmplayer/src/kmplayer_smil.h #1071398:1071399
@@ -104,6 +104,7 @@
         DurEnd = (int) MsgEventStopped,
         DurMedia = (int)MsgMediaFinished,
         DurStateChanged = (int)MsgStateChanged,
+        DurAccessKey = (int)MsgAccessKey,
         DurTransition,
         DurLastDuration
     };
--- trunk/extragear/multimedia/kmplayer/src/kmplayerpartbase.cpp #1071398:1071399
@@ -877,6 +877,15 @@
         return;
     }
 
+    case MsgAccessKey:
+        for (Connection *c = m_KeyListeners.first(); c; c = m_KeyListeners.next ())
+            if (c->payload && c->connecter) {
+                KeyLoad *load = (KeyLoad *) c->payload;
+                if (load->key == (int) (long) data)
+                    post (c->connecter, new Posting (this, MsgAccessKey));
+            }
+        return;
+
     default:
         break;
     }
@@ -897,13 +906,24 @@
     }
 
     case RoleReceivers:
-        if (MsgSurfaceUpdate == (MessageType) (long) data) {
+
+        switch ((MessageType) (long) data) {
+
+        case MsgAccessKey:
+            return &m_KeyListeners;
+
+        case MsgSurfaceUpdate: {
             PartBase *p = m_source->player ();
             if (p->view ())
                 return p->viewWidget ()->viewArea ()->updaters ();
         }
         // fall through
 
+        default:
+            break;
+        }
+        // fall through
+
     default:
         break;
     }
--- trunk/extragear/multimedia/kmplayer/src/kmplayerplaylist.h #1071398:1071399
@@ -256,6 +256,7 @@
     MsgEventStopped,
     MsgMediaFinished,
     MsgStateChanged,
+    MsgAccessKey,
     // the above messages are ordered like SMIL timing events
     MsgMediaPrefetch,
     MsgMediaReady,
@@ -326,6 +327,11 @@
     virtual ~VirtualVoid () {}
 };
 
+struct KeyLoad : public VirtualVoid {
+    KeyLoad (int ch) : key (ch) {}
+    int key;
+};
+
 struct Connection {
     NodePtrW connectee; // the one that will, when ever, trigger the event
     NodePtrW connecter; // the one that will, when ever, receive the event
@@ -373,7 +379,7 @@
     Connection *link_next;
 public:
     ConnectionList ();
-    ~ConnectionList ();
+    ~ConnectionList () KMPLAYER_EXPORT;
 
     Connection *first () {
         link_next = link_first ? link_first->next : NULL;
--- trunk/extragear/multimedia/kmplayer/src/kmplayersource.h #1071398:1071399
@@ -166,6 +166,7 @@
     void *role (RoleType msg, void *data=NULL);
 protected:
     Source *m_source;
+    ConnectionList m_KeyListeners;
 };
 
 } // namespace
--- trunk/extragear/multimedia/kmplayer/src/playlistview.cpp #1071398:1071399
@@ -250,9 +250,9 @@
         bool select, bool open) {
     // TODO, if root is same as rootitems->node and treeversion is the same
     // and show all nodes is unchanged then only update the cells
-    QWidget * w = focusWidget ();
-    if (w && w != this)
-        w->clearFocus ();
+    //QWidget * w = focusWidget ();
+    //if (w && w != this)
+    //    w->clearFocus ();
     //setSelected (firstChild (), true);
     RootPlayListItem * ritem = static_cast <RootPlayListItem *> (firstChild ());
     RootPlayListItem * before = 0L;
--- trunk/extragear/multimedia/kmplayer/src/viewarea.cpp #1071398:1071399
@@ -1817,6 +1817,7 @@
     setAcceptDrops (true);
     //new KAction (i18n ("Fullscreen"), KShortcut (Qt::Key_F), this, SLOT \
(accelActivated ()), m_collection, "view_fullscreen_toggle");  setMouseTracking \
(true); +    setFocusPolicy (Qt::ClickFocus);
     kapp->installX11EventFilter (this);
 }
 
@@ -1883,6 +1884,15 @@
     m_view->controlPanel()->fullscreenAction->trigger ();
 }
 
+KDE_NO_EXPORT void ViewArea::keyPressEvent (QKeyEvent *e) {
+    if (surface->node) {
+        QString txt = e->text ();
+        if (!txt.isEmpty ())
+            surface->node->document ()->message (MsgAccessKey,
+                    (void *)(long) txt[0].unicode ());
+    }
+}
+
 KDE_NO_EXPORT void ViewArea::mousePressEvent (QMouseEvent * e) {
     if (surface->node) {
         MouseVisitor visitor (this, MsgEventClicked,
--- trunk/extragear/multimedia/kmplayer/src/viewarea.h #1071398:1071399
@@ -66,6 +66,7 @@
     void scale (int);
 protected:
     void showEvent (QShowEvent *);
+    void keyPressEvent (QKeyEvent *);
     void mouseMoveEvent (QMouseEvent *);
     void mousePressEvent (QMouseEvent *);
     void mouseDoubleClickEvent (QMouseEvent *);
--- trunk/extragear/multimedia/kmplayer/tests/excl_timings.smil #1071398:1071399
@@ -102,13 +102,13 @@
                begin="but_pause.activateEvent" end="but_play.activateEvent"/>
       <excl dur="indefinite">
         <animateMotion targetElement="reg_img" from="5,5" to="140,5"
-                       begin="but1.activateEvent" dur="2" fill="freeze"
+                       begin="but1.activateEvent;accesskey(h)" dur="2" fill="freeze"
                        calcMode="spline" keySplines="0 .75 .25 1"/>
         <animateMotion targetElement="reg_img" from="5,5" to="5,180"
-                       begin="reg_but2.activateEvent" dur="2" fill="freeze"
+                       begin="reg_but2.activateEvent;accesskey(v)" dur="2" \
fill="freeze"  calcMode="spline" keySplines="0.75 0 1 0.25"/>
         <animateMotion targetElement="reg_img" from="5,5" to="140,180"
-                       begin="reg_but3.activateEvent" dur="2" fill="freeze"
+                       begin="reg_but3.activateEvent;accesskey(d)" dur="2" \
fill="freeze"  calcMode="spline" keySplines=".5 0 .5 1"/>
       </excl>
     </par>


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

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