Add timeout feature to WiimotedevShortcutGrabber

This commit is contained in:
Bartłomiej Burdukiewicz 2010-08-31 21:56:20 +00:00
parent 214d77bc0e
commit 118e159c1e
37 changed files with 330 additions and 17 deletions

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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"

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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"

View File

@ -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 "Διατήρηση των αρχικών αρχείων"

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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"

View File

@ -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 ""

View File

@ -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"

View File

@ -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 ""

View File

@ -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"

View File

@ -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"

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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"

View File

@ -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 ""

View File

@ -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"

View File

@ -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"

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 "Сохранить оригинальные файлы"

View File

@ -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"

View File

@ -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"

View File

@ -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 ""

View File

@ -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"

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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 "Зберегти оригінальні файли"

View File

@ -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 ""

View File

@ -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 ""

View File

@ -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;

View File

@ -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_;

View File

@ -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>