added most of the remaining commands.
authorIonutz Borcoman <iborco@gmail.com>
Sun, 6 Mar 2011 09:49:30 +0000 (11:49 +0200)
committerIonutz Borcoman <iborco@gmail.com>
Thu, 10 Mar 2011 08:10:13 +0000 (10:10 +0200)
src/mainwindow.cpp
src/mainwindow.h
src/mainwindow.ui
src/xbmc.cpp
src/xbmc.h

index 698fdf3..6d352f8 100644 (file)
@@ -95,10 +95,65 @@ void MainWindow::on_actionSetup_triggered()
 
 void MainWindow::on_rightBtn_clicked()
 {
-    m_xbmc->actionMoveRight();
+    m_xbmc->actionRight();
 }
 
 void MainWindow::on_leftBtn_clicked()
 {
-    m_xbmc->actionMoveLeft();
+    m_xbmc->actionLeft();
+}
+
+void MainWindow::on_upBtn_clicked()
+{
+    m_xbmc->actionUp();
+}
+
+void MainWindow::on_downBtn_clicked()
+{
+    m_xbmc->actionDown();
+}
+
+void MainWindow::on_playBtn_clicked()
+{
+    m_xbmc->actionPlay();
+}
+
+void MainWindow::on_muteBtn_clicked()
+{
+    m_xbmc->actionMute();
+}
+
+void MainWindow::on_parentDirBtn_clicked()
+{
+    m_xbmc->actionParentDir();
+}
+
+void MainWindow::on_volumeUpBtn_clicked()
+{
+    m_xbmc->actionVolumeUp();
+}
+
+void MainWindow::on_volumeDownBtn_clicked()
+{
+    m_xbmc->actionVolumeDown();
+}
+
+void MainWindow::on_nextSubtitleBtn_clicked()
+{
+    m_xbmc->actionNextSubtitle();
+}
+
+void MainWindow::on_nextLanguageBtn_clicked()
+{
+    m_xbmc->actionNextLanguage();
+}
+
+void MainWindow::on_selectButton_clicked()
+{
+    m_xbmc->actionSelect();
+}
+
+void MainWindow::on_stopBtn_clicked()
+{
+    m_xbmc->actionStop();
 }
index 678e1cd..73f7106 100644 (file)
@@ -38,6 +38,20 @@ private slots:
 
     void on_rightBtn_clicked();
     void on_leftBtn_clicked();
+    void on_upBtn_clicked();
+    void on_downBtn_clicked();
+    void on_parentDirBtn_clicked();
+    void on_selectButton_clicked();
+
+    void on_playBtn_clicked();
+    void on_stopBtn_clicked();
+
+    void on_muteBtn_clicked();
+    void on_volumeUpBtn_clicked();
+    void on_volumeDownBtn_clicked();
+
+    void on_nextSubtitleBtn_clicked();
+    void on_nextLanguageBtn_clicked();
 
 private:
     Ui::MainWindow *m_ui;
index 97cd748..91447d0 100644 (file)
@@ -23,6 +23,9 @@
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>down</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
@@ -36,6 +39,9 @@
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>right</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
@@ -49,6 +55,9 @@
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>left</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
@@ -62,6 +71,9 @@
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>up</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>pause</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
    </widget>
-   <widget class="QToolButton" name="increaseAudioBtn">
+   <widget class="QToolButton" name="volumeUpBtn">
     <property name="geometry">
      <rect>
       <x>152</x>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>volume up</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
    </widget>
-   <widget class="QToolButton" name="decreaseAudioBtn">
+   <widget class="QToolButton" name="volumeDownBtn">
     <property name="geometry">
      <rect>
       <x>152</x>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>volume down</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>mute</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>next subtitle</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>next language</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
     <property name="geometry">
      <rect>
       <x>150</x>
-      <y>270</y>
+      <y>280</y>
       <width>26</width>
       <height>25</height>
      </rect>
     </property>
+    <property name="toolTip">
+     <string>parent dir</string>
+    </property>
+    <property name="text">
+     <string>...</string>
+    </property>
+   </widget>
+   <widget class="QToolButton" name="stopBtn">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>280</y>
+      <width>26</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="toolTip">
+     <string>stop</string>
+    </property>
+    <property name="text">
+     <string>...</string>
+    </property>
+   </widget>
+   <widget class="QToolButton" name="selectButton">
+    <property name="geometry">
+     <rect>
+      <x>80</x>
+      <y>280</y>
+      <width>26</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="toolTip">
+     <string>select</string>
+    </property>
     <property name="text">
      <string>...</string>
     </property>
index f2e9252..75e568d 100644 (file)
 #define ACTION_HIGHLIGHT_ITEM           8
 #define ACTION_PARENT_DIR               9
 
+#define ACTION_VOLUME_UP                88
+#define ACTION_VOLUME_DOWN              89
+#define ACTION_MUTE                     91
+
+#define ACTION_PAUSE                    12
+#define ACTION_STOP                     13
+#define ACTION_NEXT_ITEM                14
+#define ACTION_PREV_ITEM                15
+#define ACTION_FORWARD                  16 // Can be used to specify specific action in a window, Playback control is handled in ACTION_PLAYER_*
+#define ACTION_REWIND                   17 // Can be used to specify specific action in a window, Playback control is handled in ACTION_PLAYER_*
+
 Xbmc::Xbmc(QObject *parent) : QObject(parent)
 {
     m_manager = new QNetworkAccessManager(this);
@@ -39,6 +50,21 @@ Xbmc::~Xbmc()
     delete m_manager;
 }
 
+void Xbmc::commandActionFinished()
+{
+    QNetworkReply* reply = qobject_cast<QNetworkReply *>(sender());
+    if (reply) {
+        if (reply->error() == QNetworkReply::NoError) {
+            QTextStream stream(reply);
+            QString msg = stream.readAll();
+            qDebug("Xbmc::commandActionFinished: %s", qPrintable(msg));
+        } else {
+            notify::notify(reply->errorString());
+        }
+        reply->deleteLater();
+    }
+}
+
 void Xbmc::do_command_action(int action)
 {
     QSettings settings;
@@ -54,37 +80,71 @@ void Xbmc::do_command_action(int action)
     connect(reply, SIGNAL(finished()), this, SLOT(commandActionFinished()));
 }
 
-void Xbmc::actionMoveRight()
+void Xbmc::actionRight()
 {
     do_command_action(ACTION_MOVE_RIGHT);
+    do_command_action(ACTION_STEP_FORWARD);
 }
 
-void Xbmc::actionMoveLeft()
+void Xbmc::actionLeft()
 {
     do_command_action(ACTION_MOVE_LEFT);
+    do_command_action(ACTION_STEP_BACK);
 }
 
-void Xbmc::actionMoveUp()
+void Xbmc::actionUp()
 {
     do_command_action(ACTION_MOVE_UP);
+    do_command_action(ACTION_BIG_STEP_FORWARD);
 }
 
-void Xbmc::actionMoveDown()
+void Xbmc::actionDown()
 {
     do_command_action(ACTION_MOVE_DOWN);
+    do_command_action(ACTION_BIG_STEP_BACK);
 }
 
-void Xbmc::commandActionFinished()
+void Xbmc::actionMute()
 {
-    QNetworkReply* reply = qobject_cast<QNetworkReply *>(sender());
-    if (reply) {
-        if (reply->error() == QNetworkReply::NoError) {
-            QTextStream stream(reply);
-            QString msg = stream.readAll();
-            qDebug("Xbmc::commandActionFinished: %s", qPrintable(msg));
-        } else {
-            notify::notify(reply->errorString());
-        }
-        reply->deleteLater();
-    }
+    do_command_action(ACTION_MUTE);
+}
+
+void Xbmc::actionVolumeUp()
+{
+    do_command_action(ACTION_VOLUME_UP);
+}
+
+void Xbmc::actionVolumeDown()
+{
+    do_command_action(ACTION_VOLUME_DOWN);
+}
+
+void Xbmc::actionNextSubtitle()
+{
+    do_command_action(ACTION_NEXT_SUBTITLE);
+}
+
+void Xbmc::actionNextLanguage()
+{
+    do_command_action(ACTION_AUDIO_NEXT_LANGUAGE);
+}
+
+void Xbmc::actionPlay()
+{
+    do_command_action(ACTION_PLAYER_PLAY);
+}
+
+void Xbmc::actionParentDir()
+{
+    do_command_action(ACTION_PARENT_DIR);
+}
+
+void Xbmc::actionSelect()
+{
+    do_command_action(ACTION_SELECT_ITEM);
+}
+
+void Xbmc::actionStop()
+{
+    do_command_action(ACTION_STOP);
 }
index 5bcfeff..ec7a066 100644 (file)
@@ -11,10 +11,25 @@ public:
     Xbmc(QObject* parent = 0);
     ~Xbmc();
 
-    void actionMoveRight();
-    void actionMoveLeft();
-    void actionMoveUp();
-    void actionMoveDown();
+    void actionRight();
+    void actionLeft();
+    void actionUp();
+    void actionDown();
+
+    void actionMute();
+    void actionVolumeUp();
+    void actionVolumeDown();
+
+    void actionNextSubtitle();
+    void actionNextLanguage();
+
+    void actionPlay();
+    void actionStop();
+
+    void actionParentDir();
+
+    void actionSelect();
+    void actionEnter();
 
 private slots:
     void commandActionFinished();