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

List:       kde-commits
Subject:    KDE/kdeutils
From:       Michael Zanetti <mzanetti () kde ! org>
Date:       2011-02-06 14:32:45
Message-ID: 20110206143245.75947AC8D0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1219141 by mzanetti:

adds the possibility to generate keyboard keypresses using your remote control



 M  +5 -2      CMakeLists.txt  
 M  +9 -1      kremotecontrol/kcmremotecontrol/CMakeLists.txt  
 M  +7 -1      kremotecontrol/kcmremotecontrol/addaction.cpp  
 M  +27 -1     kremotecontrol/kcmremotecontrol/addaction.ui  
 M  +36 -0     kremotecontrol/kcmremotecontrol/editactioncontainer.cpp  
 M  +16 -28    kremotecontrol/kcmremotecontrol/editactioncontainer.ui  
 M  +6 -3      kremotecontrol/kcmremotecontrol/editdbusaction.ui  
 A             kremotecontrol/kcmremotecontrol/editkeypressaction.cpp   [License: GPL \
(v2+)]  A             kremotecontrol/kcmremotecontrol/editkeypressaction.h   \
[License: GPL (v2+)]  A             \
kremotecontrol/kcmremotecontrol/editkeypressaction.ui    M  +0 -1      \
kremotecontrol/kcmremotecontrol/kcmremotecontrol.cpp    M  +3 -1      \
kremotecontrol/libkremotecontrol/CMakeLists.txt    M  +38 -0     \
kremotecontrol/libkremotecontrol/action.cpp    M  +1 -1      \
kremotecontrol/libkremotecontrol/action.h    M  +0 -40     \
kremotecontrol/libkremotecontrol/dbusaction.cpp    M  +3 -0      \
kremotecontrol/libkremotecontrol/executionengine.cpp    A             \
kremotecontrol/libkremotecontrol/keypressaction.cpp   [License: GPL (v2+)]  A         \
kremotecontrol/libkremotecontrol/keypressaction.h   [License: GPL (v2+)]  A           \
kremotecontrol/libkremotecontrol/keypressactionexecutor.cpp   [License: GPL (v2+)]  A \
kremotecontrol/libkremotecontrol/keypressactionexecutor.h   [License: GPL (v2+)]  M  \
+4 -0      kremotecontrol/libkremotecontrol/remotelist.cpp  


--- trunk/KDE/kdeutils/CMakeLists.txt #1219140:1219141
@@ -33,11 +33,14 @@
     macro_optional_add_subdirectory( kcalc )
 endif( GMP_FOUND )
 if( UNIX )
+
     find_package( KDE4Workspace )
     macro_log_feature( KDE4Workspace_FOUND "KDE4Workspace" "KDE Workspace library, \
part of kdebase-workspace" "http://www.kde.org" FALSE "" "Required to build \
                kremotecontrol." )
-    if( KDE4Workspace_FOUND AND QT_QTXMLPATTERNS_FOUND )
+    macro_log_feature(X11_XTest_FOUND "libXtst" "X11 Testing Resource extension \
library" "http://xorg.freedesktop.org" FALSE "" "Required to build kremotecontrol.")  \
 +    if( KDE4Workspace_FOUND AND QT_QTXMLPATTERNS_FOUND AND X11_FOUND AND \
X11_XTest_FOUND)  macro_optional_add_subdirectory( kremotecontrol )
-    endif( KDE4Workspace_FOUND AND QT_QTXMLPATTERNS_FOUND )
+    endif( KDE4Workspace_FOUND AND QT_QTXMLPATTERNS_FOUND AND X11_FOUND AND \
X11_XTest_FOUND) +
     macro_optional_add_subdirectory( kdf )
     # K3Process
     macro_optional_add_subdirectory( kfloppy )
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/CMakeLists.txt \
#1219140:1219141 @@ -17,12 +17,20 @@
    editactioncontainer.cpp
    editdbusaction.cpp
    editprofileaction.cpp
+   editkeypressaction.cpp
    model.cpp
    modedialog.cpp
    selectprofile.cpp
    )
 
-kde4_add_ui_files(kcm_remotecontrol_PART_SRCS modedialog.ui addaction.ui \
editactioncontainer.ui editdbusaction.ui configurationwidget.ui ) \
+kde4_add_ui_files(kcm_remotecontrol_PART_SRCS +   modedialog.ui
+   addaction.ui
+   editactioncontainer.ui
+   editdbusaction.ui
+   editkeypressaction.ui
+   configurationwidget.ui
+)
 
 kde4_add_plugin(kcm_remotecontrol ${kcm_remotecontrol_PART_SRCS})
 
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/addaction.cpp #1219140:1219141
@@ -20,6 +20,7 @@
 #include "addaction.h"
 #include "dbusaction.h"
 #include "profileaction.h"
+#include "keypressaction.h"
 #include "editactioncontainer.h"
 
 #include <kdebug.h>
@@ -37,8 +38,10 @@
 
     if(ui.rbTemplate->isChecked()){
         return Action::ProfileAction;
+    } else if(ui.rbDBus->isChecked()){
+        return Action::DBusAction;
     } else {
-        return Action::DBusAction;
+        return Action::KeypressAction;
     }
 }
 
@@ -52,6 +55,9 @@
             case Action::DBusAction:
                 action = new DBusAction();
                 break;
+            case Action::KeypressAction:
+                action = new KeypressAction();
+                break;
         }
         if(action){
             EditActionContainer actionContainer(action, remote);
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/addaction.ui #1219140:1219141
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>510</width>
-    <height>259</height>
+    <height>293</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -95,8 +95,34 @@
      </property>
     </widget>
    </item>
+   <item row="8" column="0">
+    <widget class="QRadioButton" name="rbKeypressAction">
+     <property name="text">
+      <string>Create a keypress action</string>
+     </property>
+    </widget>
+   </item>
+   <item row="9" column="0">
+    <widget class="QGroupBox" name="groupBox_3">
+     <property name="title">
+      <string/>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_4">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>This type of action offers to generate keypress events. You can \
execute keyboard shortcuts or type whole sentences with just one button \
press.</string> +        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
   </layout>
  </widget>
+   </item>
+  </layout>
+ </widget>
  <resources/>
  <connections/>
 </ui>
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/editactioncontainer.cpp \
#1219140:1219141 @@ -20,11 +20,15 @@
 #include "editactioncontainer.h"
 #include "editdbusaction.h"
 #include "editprofileaction.h"
+#include "editkeypressaction.h"
 #include "dbusinterface.h"
 #include "executionengine.h"
 
 #include <kdebug.h>
 
+#include "keypressaction.h"
+
+
 EditActionContainer::EditActionContainer(Action *action, const QString &remote, \
QWidget* parent, Qt::WFlags flags): KDialog(parent, flags) {  m_action = action;
     m_remote = remote;
@@ -58,6 +62,13 @@
             }
             break;
             }
+        case Action::KeypressAction: {
+            KeypressAction *keypressAction = dynamic_cast<KeypressAction*>(action);
+            if(keypressAction){
+                m_innerWidget = new EditKeypressAction(keypressAction);
+            }
+            break;
+        }
         default:
           kDebug() << "Invalid action type. Not creating inner Widget";
     }
@@ -103,6 +114,15 @@
                 return;
             }
         }
+        case Action::KeypressAction:{
+            EditKeypressAction *keypressActionEditor = \
dynamic_cast<EditKeypressAction*>(m_innerWidget); +            \
if(keypressActionEditor){ +                bool complete = \
keypressActionEditor->checkForComplete(); +                enableButtonOk(complete);
+                enableButton(Try, complete);
+                return;
+            }
+        }
         default:
           kDebug() << "Invalid action type! Nothing to check for completeness!";
     }
@@ -125,6 +145,13 @@
                 }
                 break;
             }
+            case Action::KeypressAction:{
+                EditKeypressAction *keypressActionEditor = \
dynamic_cast<EditKeypressAction*>(m_innerWidget); +                \
if(keypressActionEditor){ +                    keypressActionEditor->applyChanges();
+                }
+                break;
+            }
             default:
               kDebug() << "Invalid action type! No changes made to action!";
         }
@@ -147,6 +174,15 @@
                 }
                 break;
             }
+            case Action::KeypressAction: {
+                EditKeypressAction *keypressActionEditor = \
dynamic_cast<EditKeypressAction*>(m_innerWidget); +                \
if(keypressActionEditor){ +                    KeypressAction action = \
keypressActionEditor->action(); +                    kDebug() << \
action.keySequenceList(); +                    \
ExecutionEngine::executeAction(&action); +                }
+                break;
+            }
             default:
               kDebug() << "Invalid action type! Not executing!";
         }
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/editactioncontainer.ui \
#1219140:1219141 @@ -6,34 +6,22 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
-    <height>488</height>
+    <width>479</width>
+    <height>323</height>
    </rect>
   </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>800</width>
-    <height>0</height>
-   </size>
-  </property>
   <property name="windowTitle">
    <string>Edit Action</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="2" column="0" colspan="3">
-    <widget class="QWidget" name="wActionWidget" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
+   <item row="0" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string comment="Button on the remote control">Button:</string>
      </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
     </widget>
    </item>
    <item row="0" column="1">
@@ -52,14 +40,14 @@
      </property>
     </spacer>
    </item>
-   <item row="0" column="0">
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string comment="Button on the remote control">Button:</string>
+   <item row="2" column="0" colspan="3">
+    <widget class="QWidget" name="wActionWidget" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
      </property>
-     <property name="alignment">
-      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-     </property>
     </widget>
    </item>
   </layout>
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/editdbusaction.ui \
#1219140:1219141 @@ -22,6 +22,12 @@
    </property>
    <item row="0" column="0" rowspan="2">
     <widget class="KTabWidget" name="tabWidget">
+     <property name="minimumSize">
+      <size>
+       <width>800</width>
+       <height>0</height>
+      </size>
+     </property>
      <property name="currentIndex">
       <number>0</number>
      </property>
@@ -52,9 +58,6 @@
          <attribute name="verticalHeaderVisible">
           <bool>false</bool>
          </attribute>
-         <attribute name="verticalHeaderVisible">
-          <bool>false</bool>
-         </attribute>
         </widget>
        </item>
        <item row="0" column="0">
--- trunk/KDE/kdeutils/kremotecontrol/kcmremotecontrol/kcmremotecontrol.cpp \
#1219140:1219141 @@ -425,7 +425,6 @@
     KConfig config(QLatin1String( "kremotecontrolrc" ));
     KConfigGroup globalGroup = KConfigGroup(&config, "Global");
     ui.cbTrayIcon->setChecked(globalGroup.readEntry("ShowTrayIcon", true));
-
 }
 
 void KCMRemoteControl::save() {
--- trunk/KDE/kdeutils/kremotecontrol/libkremotecontrol/CMakeLists.txt \
#1219140:1219141 @@ -23,12 +23,14 @@
    actionexecutor.cpp
    dbusactionexecutor.cpp
    dbusinterface.cpp
+   keypressaction.cpp
+   keypressactionexecutor.cpp
 )
 
 kde4_add_library(libkremotecontrol SHARED ${libkremotecontrol_LIB_SRCS})
 set_target_properties(libkremotecontrol PROPERTIES VERSION 1.0.0 SOVERSION 1)
 
-target_link_libraries(libkremotecontrol ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} \
${KDE4WORKSPACE_SOLIDCONTROL_LIBRARY} ${QT_QTXMLPATTERNS_LIBRARY} \
${QT_QTSCRIPT_LIBRARY}) +target_link_libraries(libkremotecontrol ${KDE4_KDEUI_LIBS} \
${KDE4_KIO_LIBS} ${KDE4WORKSPACE_SOLIDCONTROL_LIBRARY} ${QT_QTXMLPATTERNS_LIBRARY} \
${QT_QTSCRIPT_LIBRARY} -lX11 -lXtst)  
 
 install(TARGETS libkremotecontrol ${INSTALL_TARGETS_DEFAULT_ARGS})
--- trunk/KDE/kdeutils/kremotecontrol/libkremotecontrol/action.cpp #1219140:1219141
@@ -69,9 +69,47 @@
 void Action::saveToConfig(KConfigGroup& config) {
     config.writeEntry("Type", (int)m_type);
     config.writeEntry("Button", m_button);
+    switch(m_destination){
+        case Unique:
+            config.writeEntry("Destination", "Unique");
+            break;
+        case Top:
+            config.writeEntry("Destination", "Top");
+            break;
+        case Bottom:
+            config.writeEntry("Destination", "Bottom");
+            break;
+        case None:
+            config.writeEntry("Destination", "None");
+            break;
+        case All:
+        default:
+            config.writeEntry("Destination", "All");
+            break;
 }
+    config.writeEntry("Autostart", m_autostart);
+    config.writeEntry("Repeat", m_repeat);
+}
 
 void Action::loadFromConfig(const KConfigGroup &config) {
     m_type = (ActionType)config.readEntry("Type").toInt();
     m_button = config.readEntry("Button");
+    QString destination = config.readEntry("Destination");
+    if(destination == QLatin1String( "Unique" )){
+        m_destination = Unique;
 }
+    else if(destination == QLatin1String( "Top" )){
+        m_destination = Top;
+    }
+    else if(destination == QLatin1String( "Bottom" )){
+        m_destination = Bottom;
+    }
+    else if(destination == QLatin1String( "None" )){
+        m_destination = None;
+    }
+    else if(destination == QLatin1String( "All" )){
+        m_destination = All;
+    }
+    m_autostart = config.readEntry("Autostart", QVariant(false)).toBool();
+    m_repeat = config.readEntry("Repeat", QVariant(false)).toBool();
+}
--- trunk/KDE/kdeutils/kremotecontrol/libkremotecontrol/action.h #1219140:1219141
@@ -30,7 +30,7 @@
 class KREMOTECONTROL_EXPORT Action
 {  
     public:
-        enum ActionType {DBusAction, ProfileAction};
+        enum ActionType {DBusAction, ProfileAction, KeypressAction};
         enum ActionDestination {Unique, Top, Bottom, None, All};
       
         Action(ActionType type, const QString &button);
--- trunk/KDE/kdeutils/kremotecontrol/libkremotecontrol/dbusaction.cpp \
#1219140:1219141 @@ -71,29 +71,8 @@
         argumentGroup.writeEntry("Type", arg.value().typeName());
         i++;
     }
-    switch(m_destination){
-        case Unique:
-            config.writeEntry("Destination", "Unique");
-            break;
-        case Top:
-            config.writeEntry("Destination", "Top");
-            break;
-        case Bottom:
-            config.writeEntry("Destination", "Bottom");
-            break;
-        case None:
-            config.writeEntry("Destination", "None");
-            break;
-        case All:
-        default:
-            config.writeEntry("Destination", "All");
-            break;
     }
-    config.writeEntry("Autostart", m_autostart);
-    config.writeEntry("Repeat", m_repeat);
 
-}
-
 void DBusAction::loadFromConfig(const KConfigGroup& config) {
     Action::loadFromConfig(config);
     m_application = config.readEntry("Application");
@@ -111,27 +90,8 @@
         argList.append(arg);
     }
     m_function.setArgs(argList);
-    QString destination = config.readEntry("Destination");
-    if(destination == QLatin1String( "Unique" )){
-        m_destination = Unique;
     }
-    else if(destination == QLatin1String( "Top" )){
-        m_destination = Top;
-    }
-    else if(destination == QLatin1String( "Bottom" )){
-        m_destination = Bottom;
-    }
-    else if(destination == QLatin1String( "None" )){
-        m_destination = None;
-    }
-    else if(destination == QLatin1String( "All" )){
-        m_destination = All;
-    }
-    m_autostart = config.readEntry("Autostart", QVariant(false)).toBool();
-    m_repeat = config.readEntry("Repeat", QVariant(false)).toBool();
 
-}
-
 Action* DBusAction::clone() const {
     DBusAction *action = new DBusAction();
     action->setApplication(m_application);
--- trunk/KDE/kdeutils/kremotecontrol/libkremotecontrol/executionengine.cpp \
#1219140:1219141 @@ -19,6 +19,7 @@
 
 #include "executionengine.h"
 #include "dbusactionexecutor.h"
+#include "keypressactionexecutor.h"
 #include "kremotecontrol_export.h"
 
 #include <kglobal.h>
@@ -42,6 +43,8 @@
     executors.insert(Action::DBusAction, dbusExecutor);
     // ProfileActions are DBusActions with additional Information. They can be \
handled by the DBusExecutor  executors.insert(Action::ProfileAction, dbusExecutor);
+    KeypressActionExecutor *keypressActionExecutor = new KeypressActionExecutor();
+    executors.insert(Action::KeypressAction, keypressActionExecutor);
 }
 
 void KREMOTECONTROL_EXPORT ExecutionEngine::executeAction(Action* action) {
--- trunk/KDE/kdeutils/kremotecontrol/libkremotecontrol/remotelist.cpp \
#1219140:1219141 @@ -19,6 +19,7 @@
 
 #include "remotelist.h"
 #include "profileaction.h"
+#include "keypressaction.h"
 
 #include <kglobal.h>
 #include <kconfig.h>
@@ -104,6 +105,9 @@
                     case Action::ProfileAction:
                         action = new ProfileAction();
                         break;
+                    case Action::KeypressAction:
+                        action = new KeypressAction();
+                        break;
                 }
                 if(!action){
                     continue;


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

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