From 118e159c1e22bfbf71c93a02b911ce68a328eea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Burdukiewicz?= <dev.strikeu@gmail.com>
Date: Tue, 31 Aug 2010 21:56:20 +0000
Subject: [PATCH] Add timeout feature to WiimotedevShortcutGrabber

---
 src/translations/ar.po               |  8 ++++++
 src/translations/bg.po               |  8 ++++++
 src/translations/ca.po               |  8 ++++++
 src/translations/cs.po               |  8 ++++++
 src/translations/da.po               |  8 ++++++
 src/translations/de.po               |  8 ++++++
 src/translations/el.po               |  8 ++++++
 src/translations/en_CA.po            |  8 ++++++
 src/translations/en_GB.po            |  8 ++++++
 src/translations/es.po               |  8 ++++++
 src/translations/fi.po               |  8 ++++++
 src/translations/fr.po               |  8 ++++++
 src/translations/gl.po               |  8 ++++++
 src/translations/hu.po               |  8 ++++++
 src/translations/it.po               |  8 ++++++
 src/translations/kk.po               |  8 ++++++
 src/translations/lt.po               |  8 ++++++
 src/translations/nb.po               |  8 ++++++
 src/translations/nl.po               |  8 ++++++
 src/translations/oc.po               |  8 ++++++
 src/translations/pl.po               |  8 ++++++
 src/translations/pt.po               |  8 ++++++
 src/translations/pt_BR.po            |  8 ++++++
 src/translations/ro.po               |  8 ++++++
 src/translations/ru.po               |  8 ++++++
 src/translations/sk.po               |  8 ++++++
 src/translations/sl.po               |  8 ++++++
 src/translations/sr.po               |  8 ++++++
 src/translations/sv.po               |  8 ++++++
 src/translations/tr.po               |  8 ++++++
 src/translations/translations.pot    |  8 ++++++
 src/translations/uk.po               |  8 ++++++
 src/translations/zh_CN.po            |  8 ++++++
 src/translations/zh_TW.po            |  8 ++++++
 src/ui/wiimotedevshortcutgrabber.cpp | 41 ++++++++++++++++++++++------
 src/ui/wiimotedevshortcutgrabber.h   |  6 +++-
 src/ui/wiimotedevshortcutgrabber.ui  | 28 ++++++++++++++-----
 37 files changed, 330 insertions(+), 17 deletions(-)

diff --git a/src/translations/ar.po b/src/translations/ar.po
index 3063229e9..3768a3c0a 100644
--- a/src/translations/ar.po
+++ b/src/translations/ar.po
@@ -934,6 +934,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/bg.po b/src/translations/bg.po
index 7f39f050c..e466b9285 100644
--- a/src/translations/bg.po
+++ b/src/translations/bg.po
@@ -934,6 +934,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/ca.po b/src/translations/ca.po
index f9431d0df..b03200f21 100644
--- a/src/translations/ca.po
+++ b/src/translations/ca.po
@@ -953,6 +953,14 @@ msgstr "Sessió no vàlida"
 msgid "Jump to the currently playing track"
 msgstr "Salta a la pista que s'esta reproduint"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Manté els fitxers originals"
 
diff --git a/src/translations/cs.po b/src/translations/cs.po
index 08b63bcf1..31c288581 100644
--- a/src/translations/cs.po
+++ b/src/translations/cs.po
@@ -938,6 +938,14 @@ msgstr "Neplatný klíč relace"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/da.po b/src/translations/da.po
index cc05eee36..508931986 100644
--- a/src/translations/da.po
+++ b/src/translations/da.po
@@ -939,6 +939,14 @@ msgstr "Ugyldig sessionsnøgle"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/de.po b/src/translations/de.po
index 645e8e7a0..8ab90a918 100644
--- a/src/translations/de.po
+++ b/src/translations/de.po
@@ -952,6 +952,14 @@ msgstr "Ungültiger Sitzungsschlüssel"
 msgid "Jump to the currently playing track"
 msgstr "Zum aktuellen Stück springen"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Originale behalten"
 
diff --git a/src/translations/el.po b/src/translations/el.po
index 6ba77235c..27fdee210 100644
--- a/src/translations/el.po
+++ b/src/translations/el.po
@@ -954,6 +954,14 @@ msgstr "Εσφαλμένο κλειδί συνεδρίας"
 msgid "Jump to the currently playing track"
 msgstr "Μετάβαση στο τρέχον κομμάτι που παίζει"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Διατήρηση των αρχικών αρχείων"
 
diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po
index 27d00e7ea..1c5cf8de3 100644
--- a/src/translations/en_CA.po
+++ b/src/translations/en_CA.po
@@ -938,6 +938,14 @@ msgstr "Invalid session key"
 msgid "Jump to the currently playing track"
 msgstr "Jump to the currently playing track"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po
index 93198e3c1..9f8a49d23 100644
--- a/src/translations/en_GB.po
+++ b/src/translations/en_GB.po
@@ -936,6 +936,14 @@ msgstr "Invalid session key"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/es.po b/src/translations/es.po
index 474695858..c92de75b8 100644
--- a/src/translations/es.po
+++ b/src/translations/es.po
@@ -955,6 +955,14 @@ msgstr "Clave de sesión inválida"
 msgid "Jump to the currently playing track"
 msgstr "Ir a la pista actualmente reproduciéndose"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Mantener los archivos originales"
 
diff --git a/src/translations/fi.po b/src/translations/fi.po
index f8df3bccf..0e23c4572 100644
--- a/src/translations/fi.po
+++ b/src/translations/fi.po
@@ -935,6 +935,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/fr.po b/src/translations/fr.po
index 59c422fb6..c53c78fdf 100644
--- a/src/translations/fr.po
+++ b/src/translations/fr.po
@@ -944,6 +944,14 @@ msgstr "Clé de session invalide"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Conserver les fichiers originaux"
 
diff --git a/src/translations/gl.po b/src/translations/gl.po
index 807be238f..56c275304 100644
--- a/src/translations/gl.po
+++ b/src/translations/gl.po
@@ -935,6 +935,14 @@ msgstr "Chave de sesón non válida"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/hu.po b/src/translations/hu.po
index 772766c48..b5f5adfe7 100644
--- a/src/translations/hu.po
+++ b/src/translations/hu.po
@@ -948,6 +948,14 @@ msgstr "Érvénytelen munkafolyamat kulcs"
 msgid "Jump to the currently playing track"
 msgstr "Ugrás a most lejátszott számra"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Eredeti fájlok megőrzése"
 
diff --git a/src/translations/it.po b/src/translations/it.po
index ad93d5c4c..13ba1b4d4 100644
--- a/src/translations/it.po
+++ b/src/translations/it.po
@@ -959,6 +959,14 @@ msgstr "Chiave di sessione non valida"
 msgid "Jump to the currently playing track"
 msgstr "Salta alla traccia in riproduzione"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Mantieni i file originali"
 
diff --git a/src/translations/kk.po b/src/translations/kk.po
index 715217418..2c1bdf07b 100644
--- a/src/translations/kk.po
+++ b/src/translations/kk.po
@@ -936,6 +936,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/lt.po b/src/translations/lt.po
index 3b6ca3d56..558be9182 100644
--- a/src/translations/lt.po
+++ b/src/translations/lt.po
@@ -934,6 +934,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/nb.po b/src/translations/nb.po
index 290debda6..5f9431e7c 100644
--- a/src/translations/nb.po
+++ b/src/translations/nb.po
@@ -937,6 +937,14 @@ msgstr "Ugyldig sesjonsnøkkel"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/nl.po b/src/translations/nl.po
index e887710d8..28d66fc84 100644
--- a/src/translations/nl.po
+++ b/src/translations/nl.po
@@ -950,6 +950,14 @@ msgstr "Ongeldige sessiesleutel"
 msgid "Jump to the currently playing track"
 msgstr "Spring naar de nu spelende track"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Behoud de originele bestanden"
 
diff --git a/src/translations/oc.po b/src/translations/oc.po
index d2bb67720..0bc0bb0d7 100644
--- a/src/translations/oc.po
+++ b/src/translations/oc.po
@@ -934,6 +934,14 @@ msgstr "Clau de sesilha invalida"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/pl.po b/src/translations/pl.po
index fb916a36f..b31e42ec8 100644
--- a/src/translations/pl.po
+++ b/src/translations/pl.po
@@ -941,6 +941,14 @@ msgstr "Zły klucz sesji"
 msgid "Jump to the currently playing track"
 msgstr "Przeskocz do teraz odtwarzanej ścieżki"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr "Przytrzymaj klawisze przez %1 sekunde"
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr "Przytrzymaj klawisze przez %1 sekundy"
+
 msgid "Keep the original files"
 msgstr "Zachowaj oryginalne pliki"
 
diff --git a/src/translations/pt.po b/src/translations/pt.po
index 98d27458a..d8ba23f3a 100644
--- a/src/translations/pt.po
+++ b/src/translations/pt.po
@@ -948,6 +948,14 @@ msgstr "Chave de sessão inválida"
 msgid "Jump to the currently playing track"
 msgstr "Ir para a faixa de reprodução actual"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Manter os ficheiros originais"
 
diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po
index ba33ba5be..9379828f8 100644
--- a/src/translations/pt_BR.po
+++ b/src/translations/pt_BR.po
@@ -942,6 +942,14 @@ msgstr "chave de sessão inválida"
 msgid "Jump to the currently playing track"
 msgstr "Pular para a faixa em execução"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/ro.po b/src/translations/ro.po
index 08f525590..8e9923e3f 100644
--- a/src/translations/ro.po
+++ b/src/translations/ro.po
@@ -935,6 +935,14 @@ msgstr "Cheie de sesiune invalidă"
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/ru.po b/src/translations/ru.po
index 38edc2d9e..b756c4cac 100644
--- a/src/translations/ru.po
+++ b/src/translations/ru.po
@@ -945,6 +945,14 @@ msgstr "Неправильный ключ сессии"
 msgid "Jump to the currently playing track"
 msgstr "Перейти к текущей композиции"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Сохранить оригинальные файлы"
 
diff --git a/src/translations/sk.po b/src/translations/sk.po
index e1c94ffd4..b8994d37e 100644
--- a/src/translations/sk.po
+++ b/src/translations/sk.po
@@ -948,6 +948,14 @@ msgstr "nefunkčný kľúč sedenia"
 msgid "Jump to the currently playing track"
 msgstr "Skočiť na práve prehrávanú skladbu"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Nechať pôvodné súbory"
 
diff --git a/src/translations/sl.po b/src/translations/sl.po
index 9c367c9e1..37898e8de 100644
--- a/src/translations/sl.po
+++ b/src/translations/sl.po
@@ -948,6 +948,14 @@ msgstr "Neveljavni ključ seje"
 msgid "Jump to the currently playing track"
 msgstr "Skoči na skladbo, ki se trenutno predvaja"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Ohrani izvorne datoteke"
 
diff --git a/src/translations/sr.po b/src/translations/sr.po
index 84c62bdf4..a46ddb942 100644
--- a/src/translations/sr.po
+++ b/src/translations/sr.po
@@ -938,6 +938,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr "Скочи на нумеру која се тренутно пушта"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/sv.po b/src/translations/sv.po
index 557a38007..ff5a02ef9 100644
--- a/src/translations/sv.po
+++ b/src/translations/sv.po
@@ -943,6 +943,14 @@ msgstr "Felaktig sessionsnyckel"
 msgid "Jump to the currently playing track"
 msgstr "Hoppa till det spår som spelas för tillfället"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Behåll originalfilerna"
 
diff --git a/src/translations/tr.po b/src/translations/tr.po
index ae9c39b83..b980b1611 100644
--- a/src/translations/tr.po
+++ b/src/translations/tr.po
@@ -936,6 +936,14 @@ msgstr "Geçersiz oturum anahtarı"
 msgid "Jump to the currently playing track"
 msgstr "Şu anda çalınan parçaya atla"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/translations.pot b/src/translations/translations.pot
index a4d32ddfb..1602e43e5 100644
--- a/src/translations/translations.pot
+++ b/src/translations/translations.pot
@@ -924,6 +924,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/uk.po b/src/translations/uk.po
index 7e217acee..b3f4483ba 100644
--- a/src/translations/uk.po
+++ b/src/translations/uk.po
@@ -947,6 +947,14 @@ msgstr "Неправильний ключ сеансу"
 msgid "Jump to the currently playing track"
 msgstr "Перейти до відтворюваної доріжки"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr "Зберегти оригінальні файли"
 
diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po
index 770a58c43..3a31bda1f 100644
--- a/src/translations/zh_CN.po
+++ b/src/translations/zh_CN.po
@@ -934,6 +934,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr ""
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po
index 3007b37ce..172992ee0 100644
--- a/src/translations/zh_TW.po
+++ b/src/translations/zh_TW.po
@@ -939,6 +939,14 @@ msgstr ""
 msgid "Jump to the currently playing track"
 msgstr "跳轉到目前播放的歌曲"
 
+#, qt-format
+msgid "Keep buttons for %1 second"
+msgstr ""
+
+#, qt-format
+msgid "Keep buttons for %1 seconds"
+msgstr ""
+
 msgid "Keep the original files"
 msgstr ""
 
diff --git a/src/ui/wiimotedevshortcutgrabber.cpp b/src/ui/wiimotedevshortcutgrabber.cpp
index 514183ea0..883edbb00 100644
--- a/src/ui/wiimotedevshortcutgrabber.cpp
+++ b/src/ui/wiimotedevshortcutgrabber.cpp
@@ -16,18 +16,17 @@
 
 #include "ui/wiimotedevshortcutgrabber.h"
 #include "ui_wiimotedevshortcutgrabber.h"
-
 #include "wiimotedev/consts.h"
 
 WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, QWidget *parent)
-  : QDialog(parent),
-    pref_action_(action),
-    ui_(new Ui_WiimotedevShortcutGrabber),
-    config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
-    wiimotedev_device_(1),
-    wiimotedev_buttons_(0),
-    remember_wiimote_shifts_(0),
-    remember_nunchuk_shifts_(0)
+ :QDialog(parent),
+  pref_action_(action),
+  ui_(new Ui_WiimotedevShortcutGrabber),
+  config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
+  wiimotedev_device_(1),
+  wiimotedev_buttons_(0),
+  remember_wiimote_shifts_(0),
+  remember_nunchuk_shifts_(0)
 {
   ui_->setupUi(this);
 
@@ -50,16 +49,35 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, QWidget *pa
     ui_->comboBox->addItem(name);
 
   ui_->comboBox->setCurrentIndex(pref_action_);
+  ui_->keep_label->setVisible(false);
 
   connect(ui_->remember_shifts, SIGNAL(clicked(bool)), this, SLOT(RememberSwingChecked(bool)));
+  connect(ui_->buttonBox, SIGNAL(rejected()),  this, SLOT(close()));
+  connect(&line_, SIGNAL(frameChanged(int)), this, SLOT(Timeout(int)));
+
+  line_.setFrameRange(4, 0);
+  line_.setEasingCurve(QEasingCurve::Linear);
+  line_.setDuration(line_.startFrame()*1000);
 }
 
 WiimotedevShortcutGrabber::~WiimotedevShortcutGrabber() {
   delete ui_;
 }
 
+void WiimotedevShortcutGrabber::Timeout(int secs) {
+  if (secs == 0)
+    close();
+
+  if (secs == 1)
+    ui_->keep_label->setText(QString(tr("Keep buttons for %1 second")).arg(QString::number(secs))); else
+    ui_->keep_label->setText(QString(tr("Keep buttons for %1 seconds")).arg(QString::number(secs)));
+}
+
 void WiimotedevShortcutGrabber::RememberSwingChecked(bool checked) {
   quint64 buttons = wiimotedev_buttons_;
+  line_.stop();
+  ui_->keep_label->setVisible(false);
+
 
   if (checked) {
     buttons |=  remember_wiimote_shifts_ | remember_nunchuk_shifts_;
@@ -92,6 +110,11 @@ void WiimotedevShortcutGrabber::DbusWiimoteGeneralButtons(uint id, qulonglong va
   remember_wiimote_shifts_ = buttons & WIIMOTE_SHIFT_MASK;
   remember_nunchuk_shifts_ = buttons & NUNCHUK_SHIFT_MASK;
 
+  line_.stop();
+  if (buttons) line_.start();
+
+  ui_->keep_label->setVisible(buttons);
+  ui_->keep_label->setText(QString(tr("Keep buttons for %1 seconds")).arg(QString::number(line_.startFrame())));
   ui_->combo->setText(config_->GetReadableWiiremoteSequence(buttons));
 
   wiimotedev_buttons_ = buttons;
diff --git a/src/ui/wiimotedevshortcutgrabber.h b/src/ui/wiimotedevshortcutgrabber.h
index 7b83ad868..6a111a941 100644
--- a/src/ui/wiimotedevshortcutgrabber.h
+++ b/src/ui/wiimotedevshortcutgrabber.h
@@ -18,9 +18,10 @@
 #define WIIMOTEDEVSHORTCUTGRABBER_H
 
 #include <QDialog>
+#include <QTimeLine>
+
 #include <boost/scoped_ptr.hpp>
 #include "dbus/wiimotedev.h"
-
 #include "ui/wiimotedevshortcutsconfig.h"
 
 class Ui_WiimotedevShortcutGrabber;
@@ -36,8 +37,11 @@ public:
 private slots:
   void DbusWiimoteGeneralButtons(uint id, qulonglong value);
   void RememberSwingChecked(bool checked);
+  void Timeout(int);
 
 private:
+  QTimeLine line_;
+
   quint32 pref_action_;
 
   Ui_WiimotedevShortcutGrabber* ui_;
diff --git a/src/ui/wiimotedevshortcutgrabber.ui b/src/ui/wiimotedevshortcutgrabber.ui
index e374d8a15..ced460002 100644
--- a/src/ui/wiimotedevshortcutgrabber.ui
+++ b/src/ui/wiimotedevshortcutgrabber.ui
@@ -87,14 +87,28 @@
     </widget>
    </item>
    <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <property name="bottomMargin">
+      <number>0</number>
      </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel</set>
-     </property>
-    </widget>
+     <item>
+      <widget class="QLabel" name="keep_label">
+       <property name="text">
+        <string>Keep buttons for %1 seconds</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="standardButtons">
+        <set>QDialogButtonBox::Cancel</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>