Add enable wiimotedev shortcuts only when application is focused option

This commit is contained in:
Bartłomiej Burdukiewicz 2010-09-01 00:10:30 +00:00
parent 37f2a42a88
commit 87aea79df5
37 changed files with 13 additions and 105 deletions

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -654,9 +654,6 @@ msgstr "Descarregant el catàleg de Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Arrossegueu per canviar de posició" msgstr "Arrossegueu per canviar de posició"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Editar etiqueta \"%1\"..." msgstr "Editar etiqueta \"%1\"..."

View File

@ -643,9 +643,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Přemístit přetažením" msgstr "Přemístit přetažením"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Upravit tag\"%1\"..." msgstr "Upravit tag\"%1\"..."

View File

@ -643,9 +643,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Træk for at skifte position" msgstr "Træk for at skifte position"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Redigér mærke \"%1\"..." msgstr "Redigér mærke \"%1\"..."

View File

@ -653,9 +653,6 @@ msgstr "Magnatune-Katalog wird geladen"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Klicken und ziehen um die Position zu ändern" msgstr "Klicken und ziehen um die Position zu ändern"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "%1 bearbeiten" msgstr "%1 bearbeiten"

View File

@ -655,9 +655,6 @@ msgstr "Μεταφόρτωση καταλόγου του Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Σύρετε για μετακίνηση" msgstr "Σύρετε για μετακίνηση"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Τροποποίηση ετικέτας \"%1\"..." msgstr "Τροποποίηση ετικέτας \"%1\"..."

View File

@ -644,9 +644,6 @@ msgstr "Downloading Magnatune catalogue"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Drag to reposition" msgstr "Drag to reposition"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Edit tag \"%1\"..." msgstr "Edit tag \"%1\"..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Drag to reposition" msgstr "Drag to reposition"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Edit tag \"%1\"..." msgstr "Edit tag \"%1\"..."

View File

@ -655,9 +655,6 @@ msgstr "Descargando el catálogo de Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Arrastrar para reposicionar" msgstr "Arrastrar para reposicionar"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Editar etiqueta \"%1\"..." msgstr "Editar etiqueta \"%1\"..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -647,9 +647,6 @@ msgstr "Téléchargement du catalogue Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Déplacer pour repositionner" msgstr "Déplacer pour repositionner"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Modifer le tag « %1 »..." msgstr "Modifer le tag « %1 »..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Arraste para posicionar" msgstr "Arraste para posicionar"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Editar a tag \"%1\"..." msgstr "Editar a tag \"%1\"..."

View File

@ -651,9 +651,6 @@ msgstr "Magnatune katalógus letöltése"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Fogja meg az áthelyezéshez" msgstr "Fogja meg az áthelyezéshez"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "\"%1\" címke módosítása..." msgstr "\"%1\" címke módosítása..."

View File

@ -658,9 +658,6 @@ msgstr "Scaricamento catalogo Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Trascina per riposizionare" msgstr "Trascina per riposizionare"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Modifica tag \"%1\"..." msgstr "Modifica tag \"%1\"..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Dra for å endre posisjon" msgstr "Dra for å endre posisjon"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Endre merkelapp \"%1\"..." msgstr "Endre merkelapp \"%1\"..."

View File

@ -650,9 +650,6 @@ msgstr "Magnatune catalogus wordt gedownload"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Sleep om te verplaatsen" msgstr "Sleep om te verplaatsen"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Tag \"%1\" bewerken..." msgstr "Tag \"%1\" bewerken..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -648,9 +648,6 @@ msgstr "Pobieranie katalogu Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Przeciągnij aby zmienić pozycję" msgstr "Przeciągnij aby zmienić pozycję"
msgid "Edit action"
msgstr "Edytuj akcje"
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Edytuj znacznik \"%1\"..." msgstr "Edytuj znacznik \"%1\"..."
@ -1977,6 +1974,9 @@ msgstr "zatrzymaj"
msgid "track %1" msgid "track %1"
msgstr "utwór %1" msgstr "utwór %1"
#~ msgid "Edit action"
#~ msgstr "Edytuj akcje"
#~ msgid "Keep buttons for %1 second" #~ msgid "Keep buttons for %1 second"
#~ msgstr "Przytrzymaj klawisze przez %1 sekunde" #~ msgstr "Przytrzymaj klawisze przez %1 sekunde"

View File

@ -652,9 +652,6 @@ msgstr "Transferindo Catálogo Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Arraste para posicionar" msgstr "Arraste para posicionar"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Editar marca \"%1\"..." msgstr "Editar marca \"%1\"..."

View File

@ -647,9 +647,6 @@ msgstr "Baixando catálogo da Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Arraste para reposicionar" msgstr "Arraste para reposicionar"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Editar marcador \"%1\"..." msgstr "Editar marcador \"%1\"..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Trage pentru a repoziționa" msgstr "Trage pentru a repoziționa"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -649,9 +649,6 @@ msgstr "Скачать каталог Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Тащите для перемещения" msgstr "Тащите для перемещения"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Редактировать тег \"%1\"..." msgstr "Редактировать тег \"%1\"..."

View File

@ -651,9 +651,6 @@ msgstr "Sťahovanie Magnatune katalógu"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Pretiahnite na iné miesto" msgstr "Pretiahnite na iné miesto"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Upraviť tag \"%1\"..." msgstr "Upraviť tag \"%1\"..."

View File

@ -650,9 +650,6 @@ msgstr "Poteka prenos Magnatune kataloga"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Povlecite za spremembo položaja" msgstr "Povlecite za spremembo položaja"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Uredi značko \"%1\"" msgstr "Uredi značko \"%1\""

View File

@ -644,9 +644,6 @@ msgstr "Преузми Магнатјунов каталог"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Одвуците га где желите" msgstr "Одвуците га где желите"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Уреди ознаку \"%1\"..." msgstr "Уреди ознаку \"%1\"..."

View File

@ -646,9 +646,6 @@ msgstr "Hämtar katalog från Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Dra för att ändra position" msgstr "Dra för att ändra position"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Redigera tagg \"%1\"..." msgstr "Redigera tagg \"%1\"..."

View File

@ -642,9 +642,6 @@ msgstr "Magnatune kataloğu indiriliyor"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Yeniden konumlandırmak için sürükleyin" msgstr "Yeniden konumlandırmak için sürükleyin"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "\"%1\" etiketini düzenle..." msgstr "\"%1\" etiketini düzenle..."

View File

@ -632,9 +632,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -650,9 +650,6 @@ msgstr "Завантаження каталогу Magnatune"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "Перетягніть, щоб змінити розташування" msgstr "Перетягніть, щоб змінити розташування"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "Змінити позначку \"%1\"..." msgstr "Змінити позначку \"%1\"..."

View File

@ -642,9 +642,6 @@ msgstr ""
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "" msgstr ""
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -646,9 +646,6 @@ msgstr "下載 Magnatune目錄"
msgid "Drag to reposition" msgid "Drag to reposition"
msgstr "拖曳以重新定位" msgstr "拖曳以重新定位"
msgid "Edit action"
msgstr ""
#, qt-format #, qt-format
msgid "Edit tag \"%1\"..." msgid "Edit tag \"%1\"..."
msgstr "" msgstr ""

View File

@ -474,7 +474,7 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
#endif #endif
#ifdef ENABLE_WIIMOTEDEV #ifdef ENABLE_WIIMOTEDEV
wiimotedev_shortcuts_.reset(new WiimotedevShortcuts(player_)); wiimotedev_shortcuts_.reset(new WiimotedevShortcuts(this, player_));
#endif #endif
qDebug() << t.restart() << "tray"; qDebug() << t.restart() << "tray";

View File

@ -22,8 +22,9 @@
const char* WiimotedevShortcuts::kActionsGroup = "WiimotedevActions"; const char* WiimotedevShortcuts::kActionsGroup = "WiimotedevActions";
const char* WiimotedevShortcuts::kSettingsGroup = "WiimotedevSettings"; const char* WiimotedevShortcuts::kSettingsGroup = "WiimotedevSettings";
WiimotedevShortcuts::WiimotedevShortcuts(QObject* parent) WiimotedevShortcuts::WiimotedevShortcuts(QWidget* window, QObject* parent)
:QObject(parent), :QObject(parent),
main_window_(window),
player_(qobject_cast<Player*>(parent)), player_(qobject_cast<Player*>(parent)),
wiimotedev_active_(true), wiimotedev_active_(true),
wiimotedev_buttons_(0), wiimotedev_buttons_(0),
@ -85,6 +86,10 @@ void WiimotedevShortcuts::ReloadSettings() {
void WiimotedevShortcuts::DbusWiimoteGeneralButtons(uint id, qulonglong value) { void WiimotedevShortcuts::DbusWiimoteGeneralButtons(uint id, qulonglong value) {
if (id != wiimotedev_device_ || !wiimotedev_enable_ || !player_) return; if (id != wiimotedev_device_ || !wiimotedev_enable_ || !player_) return;
if (wiimotedev_focus_ && !main_window_->isActiveWindow())
return;
quint64 buttons = value & ~( quint64 buttons = value & ~(
WIIMOTE_TILT_MASK | WIIMOTE_TILT_MASK |
NUNCHUK_TILT_MASK | NUNCHUK_TILT_MASK |

View File

@ -17,6 +17,7 @@
#ifndef WIIMOTEDEV_SHORTCUTS_H #ifndef WIIMOTEDEV_SHORTCUTS_H
#define WIIMOTEDEV_SHORTCUTS_H #define WIIMOTEDEV_SHORTCUTS_H
#include <QWidget>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "dbus/wiimotedev.h" #include "dbus/wiimotedev.h"
@ -30,7 +31,7 @@ public:
static const char* kActionsGroup; static const char* kActionsGroup;
static const char* kSettingsGroup; static const char* kSettingsGroup;
WiimotedevShortcuts(QObject* parent = 0); WiimotedevShortcuts(QWidget* window, QObject* parent = 0);
enum Action { enum Action {
WiimotedevActive = 0, WiimotedevActive = 0,
@ -59,6 +60,7 @@ private slots:
void DbusWiimoteGeneralButtons(uint id, qulonglong value); void DbusWiimoteGeneralButtons(uint id, qulonglong value);
private: private:
QWidget* main_window_;
Player* player_; Player* player_;
bool wiimotedev_active_; bool wiimotedev_active_;