diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-02-14 11:17:11 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-02-14 11:17:11 +0000 |
| commit | 5db018499bf3f5cfd82a9e5dbc11df016d1d1f01 (patch) | |
| tree | 4c3c70973b18ce65ac2340ee228a6b0e26a91df5 | |
| parent | 4e3ff2892f5401b09cf6875808f34bbbff05ae9b (diff) | |
| download | qmmp-5db018499bf3f5cfd82a9e5dbc11df016d1d1f01.tar.gz qmmp-5db018499bf3f5cfd82a9e5dbc11df016d1d1f01.tar.bz2 qmmp-5db018499bf3f5cfd82a9e5dbc11df016d1d1f01.zip | |
global hotkey support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@787 90c681e8-e032-0410-971d-27865f9a5e38
23 files changed, 1779 insertions, 1 deletions
@@ -66,3 +66,12 @@ Solid - KDE hardware library (c) 2006 Will Stephenosn <wstephenson@kde.org> Michaël Larouche <michael.larouche@kdemail.net> Jeff Mitchell <kde-dev@emailgoeshere.com> + +Psi - instant messaging application (C) 2003-2007 + + Justin Karneges <justin@affinix.com> + Kevin Smith <kismith@psi-im.org> + Remko Tronçon URL:http://el-tramo.be + Michail Pishchagin <mblsha@psi-im.org> + Maciej Niedzielski <machekku@psi-im.org> + Martin Hostettler <martin@psi-im.org> diff --git a/CMakeLists.txt b/CMakeLists.txt index 30ef2605e..3a8bc7c63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,7 @@ PRINT_SUMMARY ("Tray support ......................" USE_STATICON 1) PRINT_SUMMARY ("Notifier support .................." USE_NOTIFIER 1) PRINT_SUMMARY ("Lyrics support ...................." USE_LYRICS 1) PRINT_SUMMARY ("HAL support ......................." USE_HAL 1) +PRINT_SUMMARY ("Global hotkey support ............." USE_HOTKEY X11_FOUND) MESSAGE("") MESSAGE("File Dialogs:") diff --git a/src/plugins/General/CMakeLists.txt b/src/plugins/General/CMakeLists.txt index c79d34025..8b428c008 100644 --- a/src/plugins/General/CMakeLists.txt +++ b/src/plugins/General/CMakeLists.txt @@ -4,6 +4,7 @@ SET(USE_STATICON TRUE CACHE BOOL "enable/disable status icon plugin") SET(USE_NOTIFIER TRUE CACHE BOOL "enable/disable notifier plugin") SET(USE_LYRICS TRUE CACHE BOOL "enable/disable lyrics version") SET(USE_HAL TRUE CACHE BOOL "enable/disable hal plugin") +SET(USE_HOTKEY TRUE CACHE BOOL "enable/disable global hotkey plugin") IF(USE_MPRIS) add_subdirectory(mpris) @@ -28,3 +29,7 @@ ENDIF(USE_LYRICS) IF(USE_HAL) add_subdirectory(hal) ENDIF(USE_HAL) + +IF(USE_HOTKEY) +add_subdirectory(hotkey) +ENDIF(USE_HOTKEY) diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro index ce699c66b..e19fe4b5f 100644 --- a/src/plugins/General/General.pro +++ b/src/plugins/General/General.pro @@ -3,5 +3,6 @@ SUBDIRS += statusicon \ mpris \ notifier \ hal \ - lyrics + lyrics \ + hotkey TEMPLATE = subdirs diff --git a/src/plugins/General/hotkey/CMakeLists.txt b/src/plugins/General/hotkey/CMakeLists.txt new file mode 100644 index 000000000..786f978c1 --- /dev/null +++ b/src/plugins/General/hotkey/CMakeLists.txt @@ -0,0 +1,72 @@ +project(libhotkey) + +cmake_minimum_required(VERSION 2.4.7) +INCLUDE(FindX11) + +if(COMMAND cmake_policy) +cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) + +# qt plugin +ADD_DEFINITIONS( -Wall ) +ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(-DQT_PLUGIN) +ADD_DEFINITIONS(-DQT_NO_DEBUG) +ADD_DEFINITIONS(-DQT_SHARED) +ADD_DEFINITIONS(-DQT_THREAD) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +SET(QT_INCLUDES + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../ +) + +pkg_check_modules(X11 xf86miscproto x11) + +# libqmmpui & libqmmp +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmpui) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp) + +SET(libhotkey_SRCS + settingsdialog.cpp + hotkeyfactory.cpp + hotkeymanager.cpp + hotkeydialog.cpp +) + +SET(libhotkey_MOC_HDRS + settingsdialog.h + hotkeyfactory.h + hotkeymanager.h + hotkeydialog.h +) + +SET(libhotkey_RCCS + translations/translations.qrc +) + +QT4_ADD_RESOURCES(libhotkey_RCC_SRCS ${libhotkey_RCCS}) + +QT4_WRAP_CPP(libhotkey_MOC_SRCS ${libhotkey_MOC_HDRS}) + +# user interface + + +SET(libhotkey_UIS + settingsdialog.ui + hotkeydialog.ui +) + +QT4_WRAP_UI(libhotkey_UIS_H ${libhotkey_UIS}) +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +IF(X11_FOUND) +ADD_LIBRARY(hotkey SHARED ${libhotkey_SRCS} ${libhotkey_MOC_SRCS} ${libhotkey_UIS_H} ${libhotkey_RCC_SRCS}) +add_dependencies(hotkey qmmpui) +target_link_libraries(hotkey ${QT_LIBRARIES} -lqmmpui -lqmmp) +install(TARGETS hotkey DESTINATION ${LIB_DIR}/qmmp/General) +ENDIF(X11_FOUND) diff --git a/src/plugins/General/hotkey/hotkey.pro b/src/plugins/General/hotkey/hotkey.pro new file mode 100644 index 000000000..8d69f8c70 --- /dev/null +++ b/src/plugins/General/hotkey/hotkey.pro @@ -0,0 +1,43 @@ +include(../../plugins.pri) + +CONFIG += release \ +warn_on \ +plugin \ + lib + +TARGET = $$PLUGINS_PREFIX/General/hotkey +QMAKE_CLEAN = $$PLUGINS_PREFIX/General/libhotkey.so + +TEMPLATE = lib +QMAKE_LIBDIR += ../../../../lib + +TRANSLATIONS = translations/hotkey_plugin_cs.ts \ + translations/hotkey_plugin_de.ts \ + translations/hotkey_plugin_zh_CN.ts \ + translations/hotkey_plugin_zh_TW.ts \ + translations/hotkey_plugin_ru.ts \ + translations/hotkey_plugin_uk_UA.ts +RESOURCES = translations/translations.qrc + +isEmpty(LIB_DIR){ + LIB_DIR = /lib +} +target.path = $$LIB_DIR/qmmp/General +INSTALLS += target + +HEADERS += hotkeyfactory.h \ + hotkeymanager.h \ + settingsdialog.h \ + hotkeydialog.h + +SOURCES += hotkeyfactory.cpp \ + hotkeymanager.cpp \ + settingsdialog.cpp \ + hotkeydialog.cpp + +INCLUDEPATH += ../../../../src + +LIBS += -lqmmpui -lqmmp + +FORMS += settingsdialog.ui \ + hotkeydialog.ui diff --git a/src/plugins/General/hotkey/hotkeydialog.cpp b/src/plugins/General/hotkey/hotkeydialog.cpp new file mode 100644 index 000000000..abc6574fd --- /dev/null +++ b/src/plugins/General/hotkey/hotkeydialog.cpp @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QKeyEvent> +#include "hotkeymanager.h" +#include "hotkeydialog.h" + +HotkeyDialog::HotkeyDialog(quint32 key, quint32 mod, QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + m_key = key; + m_modifiers = mod; + ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers)); +} + +HotkeyDialog::~HotkeyDialog() +{ +} + +void HotkeyDialog::keyPressEvent (QKeyEvent *event) +{ + m_key = event->nativeVirtualKey (); + m_modifiers = event->nativeModifiers (); + foreach(long mask_mod, HotkeyManager::ignModifiersList()) + m_modifiers &= ~mask_mod; //remove ignoried modifiers (num lock, caps lock, etc) + ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers)); + QWidget::keyPressEvent(event); +} + +quint32 HotkeyDialog::nativeModifiers () const +{ + return m_modifiers; +} + +quint32 HotkeyDialog::nativeVirtualKey () const +{ + return m_key; +} + +void HotkeyDialog::accept() +{ + if (ui.keyLineEdit->text().isEmpty()) //clear key & modifiers + { + m_key = 0; + m_modifiers = 0; + } + QDialog::accept(); +} diff --git a/src/plugins/General/hotkey/hotkeydialog.h b/src/plugins/General/hotkey/hotkeydialog.h new file mode 100644 index 000000000..a0c96049a --- /dev/null +++ b/src/plugins/General/hotkey/hotkeydialog.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef HOTKEYDIALOG_H +#define HOTKEYDIALOG_H + +#include <QDialog> + +#include "ui_hotkeydialog.h" + +class QKeyEvent; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class HotkeyDialog : public QDialog +{ + Q_OBJECT +public: + HotkeyDialog(quint32 key, quint32 mod, QWidget *parent = 0); + + ~HotkeyDialog(); + + quint32 nativeModifiers () const; + quint32 nativeVirtualKey () const; + +public slots: + virtual void accept(); + +protected: + virtual void keyPressEvent (QKeyEvent *event); + +private: + Ui::HotkeyDialog ui; + quint32 m_key, m_modifiers; + +}; + +#endif diff --git a/src/plugins/General/hotkey/hotkeydialog.ui b/src/plugins/General/hotkey/hotkeydialog.ui new file mode 100644 index 000000000..fff3429bd --- /dev/null +++ b/src/plugins/General/hotkey/hotkeydialog.ui @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>HotkeyDialog</class> + <widget class="QDialog" name="HotkeyDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>310</width> + <height>89</height> + </rect> + </property> + <property name="windowTitle"> + <string>Modify Shortcut</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item row="0" column="0" colspan="3"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Press the key combination you want to assign</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QLineEdit" name="keyLineEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="clearButton"> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>106</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>HotkeyDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>212</x> + <y>70</y> + </hint> + <hint type="destinationlabel"> + <x>192</x> + <y>269</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>HotkeyDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>212</x> + <y>70</y> + </hint> + <hint type="destinationlabel"> + <x>246</x> + <y>214</y> + </hint> + </hints> + </connection> + <connection> + <sender>clearButton</sender> + <signal>clicked()</signal> + <receiver>keyLineEdit</receiver> + <slot>clear()</slot> + <hints> + <hint type="sourcelabel"> + <x>195</x> + <y>22</y> + </hint> + <hint type="destinationlabel"> + <x>113</x> + <y>25</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/plugins/General/hotkey/hotkeyfactory.cpp b/src/plugins/General/hotkey/hotkeyfactory.cpp new file mode 100644 index 000000000..afe694fe8 --- /dev/null +++ b/src/plugins/General/hotkey/hotkeyfactory.cpp @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QtGui> + +#include "settingsdialog.h" +#include "hotkeymanager.h" +#include "hotkeyfactory.h" + +const GeneralProperties HotkeyFactory::properties() const +{ + GeneralProperties properties; + properties.name = tr("Global Hotkey Plugin"); + properties.shortName = "hotkey"; + properties.hasAbout = TRUE; + properties.hasSettings = TRUE; + properties.visibilityControl = FALSE; + return properties; +} + +General *HotkeyFactory::create(QObject *parent) +{ + return new HotkeyManager(parent); +} + +QDialog *HotkeyFactory::createConfigDialog(QWidget *parent) +{ + return new SettingsDialog(parent); +} + +void HotkeyFactory::showAbout(QWidget *parent) +{ + QMessageBox::about (parent, tr("About Global Hotkey Plugin"), + tr("Qmmp Global Hotkey Plugin")+"\n"+ + tr("This plugin adds support for multimedia keys or global key combinations")+"\n"+ + tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>")); +} + +QTranslator *HotkeyFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = QLocale::system().name(); + translator->load(QString(":/hotkey_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN(HotkeyFactory) diff --git a/src/plugins/General/hotkey/hotkeyfactory.h b/src/plugins/General/hotkey/hotkeyfactory.h new file mode 100644 index 000000000..f1ca46d1f --- /dev/null +++ b/src/plugins/General/hotkey/hotkeyfactory.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef HOTKEYFACTORY_H +#define HOTKEYFACTORY_H + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +#include <QObject> +#include <QTranslator> + +#include <qmmpui/general.h> +#include <qmmpui/generalfactory.h> + +class HotkeyFactory : public QObject, public GeneralFactory +{ +Q_OBJECT +Q_INTERFACES(GeneralFactory); +public: + const GeneralProperties properties() const; + General *create(QObject *parent); + QDialog *createConfigDialog(QWidget *parent); + void showAbout(QWidget *parent); + QTranslator *createTranslator(QObject *parent); +}; + +#endif diff --git a/src/plugins/General/hotkey/hotkeymanager.cpp b/src/plugins/General/hotkey/hotkeymanager.cpp new file mode 100644 index 000000000..5a78c910a --- /dev/null +++ b/src/plugins/General/hotkey/hotkeymanager.cpp @@ -0,0 +1,266 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * Copyright (C) 2003-2007 by Justin Karneges and Michail Pishchagin * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QSettings> +#include <QX11Info> +#include <QEvent> +#include <QKeyEvent> +#include <QCoreApplication> +#include <QApplication> +#include <QDesktopWidget> +#define Visual XVisual +extern "C" +{ +#include <X11/X.h> +#include <X11/Xlib.h> +#include <X11/keysym.h> +#include <X11/XF86keysym.h> +} +#undef CursorShape +#undef Status +#undef Bool +#undef None +#undef KeyPress +#undef Visual + +#include <qmmp/qmmp.h> +#include <qmmp/soundcore.h> +#include <qmmpui/mediaplayer.h> +#include "hotkeymanager.h" + +quint32 Hotkey::defaultKey() +{ + return defaultKey(action); +} + +quint32 Hotkey::defaultKey(int act) +{ + //default key bindings + QMap<int, quint32> keyMap; + keyMap[PLAY] = XF86XK_AudioPlay; + keyMap[STOP] = XF86XK_AudioStop; + keyMap[PAUSE] = XF86XK_AudioPause; + keyMap[PLAY_PAUSE] = 0; + keyMap[NEXT] = XF86XK_AudioNext; + keyMap[PREVIOUS] = XF86XK_AudioPrev; + keyMap[SHOW_HIDE] = 0; + return keyMap[act]; +} + +HotkeyManager::HotkeyManager(QObject *parent) : General(parent) +{ + QCoreApplication::instance()->installEventFilter(this); + WId rootWindow = QX11Info::appRootWindow(); + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); //load settings + settings.beginGroup("Hotkey"); + for (int i = Hotkey::PLAY, j = 0; i <= Hotkey::SHOW_HIDE; ++i, ++j) + { + quint32 key = settings.value(QString("key_%1").arg(i), Hotkey::defaultKey(i)).toUInt(); + quint32 mod = settings.value(QString("modifiers_%1").arg(i), 0).toUInt(); + + if (key) + { + foreach(long mask_mod, ignModifiersList()) + { + Hotkey *hotkey = new Hotkey; + hotkey->action = i; + hotkey->key = key; + hotkey->code = XKeysymToKeycode(QX11Info::display(), hotkey->key); + XGrabKey(QX11Info::display(), hotkey->code, mod | mask_mod, rootWindow, False, + GrabModeAsync, GrabModeAsync); + hotkey->mod = mod | mask_mod; + m_grabbedKeys << hotkey; + } + } + } + settings.endGroup(); + XSync(QX11Info::display(), False); +// XSetErrorHandler(); +} + +HotkeyManager::~HotkeyManager() +{ + foreach(Hotkey *key, m_grabbedKeys) + XUngrabKey(QX11Info::display(), key->code, key->mod, QX11Info::appRootWindow()); + while (!m_grabbedKeys.isEmpty()) + delete m_grabbedKeys.takeFirst (); +} + +const QString HotkeyManager::getKeyString(quint32 key, quint32 modifiers) +{ + QString strModList[] = { "Control", "Shift", "Alt", "Mod2", "Mod3", "Super", "Mod5" }; + quint32 modList[] = { ControlMask, ShiftMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; + QString keyStr; + for (int j = 0; j < 7; j++) + { + if (modifiers & modList[j]) + keyStr.append(strModList[j] + "+"); + } + keyStr.append(XKeysymToString(key)); + return keyStr; +} + +bool HotkeyManager::eventFilter(QObject* o, QEvent* e) +{ + //receive events from active and root windows only + if (e->type() == QEvent::KeyPress && (o == qApp->desktop () || o == qApp->activeWindow ())) + { + QKeyEvent* k = static_cast<QKeyEvent*>(e); + quint32 key = k->nativeVirtualKey (); + quint32 mod = k->nativeModifiers (); + foreach(Hotkey *hotkey, m_grabbedKeys) + { + if (hotkey->key != key || hotkey->mod != mod) + continue; + qDebug("HotkeyManager: [%s] pressed", qPrintable(getKeyString(key, mod))); + + switch (hotkey->action) + { + case Hotkey::PLAY: + MediaPlayer::instance()->play(); + break; + case Hotkey::STOP: + MediaPlayer::instance()->stop(); + break; + case Hotkey::PAUSE: + SoundCore::instance()->pause(); + break; + case Hotkey::PLAY_PAUSE: + if (SoundCore::instance()->state() == Qmmp::Stopped) + MediaPlayer::instance()->play(); + else if (SoundCore::instance()->state() != Qmmp::FatalError) + SoundCore::instance()->pause(); + break; + case Hotkey::NEXT: + MediaPlayer::instance()->next(); + break; + case Hotkey::PREVIOUS: + MediaPlayer::instance()->previous(); + break; + case Hotkey::SHOW_HIDE: + toggleVisibility(); + } + qApp->processEvents(); + } + } + return QObject::eventFilter(o, e); +} +long HotkeyManager::m_alt_mask = 0; +long HotkeyManager::m_meta_mask = 0; +long HotkeyManager::m_super_mask = 0; +long HotkeyManager::m_hyper_mask = 0; +long HotkeyManager::m_numlock_mask = 0; +bool HotkeyManager::m_haveMods = FALSE; + +//copied from globalshortcutmanager_x11.cpp by Justin Karneges and Michail Pishchagin (Psi project) +void HotkeyManager::ensureModifiers() +{ + if (m_haveMods) + return; + + Display* appDpy = QX11Info::display(); + XModifierKeymap* map = XGetModifierMapping(appDpy); + if (map) + { + // XKeycodeToKeysym helper code adapeted from xmodmap + int min_keycode, max_keycode, keysyms_per_keycode = 1; + XDisplayKeycodes (appDpy, &min_keycode, &max_keycode); + XFree(XGetKeyboardMapping (appDpy, min_keycode, (max_keycode - min_keycode + 1), &keysyms_per_keycode)); + + int i, maskIndex = 0, mapIndex = 0; + for (maskIndex = 0; maskIndex < 8; maskIndex++) + { + for (i = 0; i < map->max_keypermod; i++) + { + if (map->modifiermap[mapIndex]) + { + KeySym sym; + int symIndex = 0; + do + { + sym = XKeycodeToKeysym(appDpy, map->modifiermap[mapIndex], symIndex); + symIndex++; + } + while ( !sym && symIndex < keysyms_per_keycode); + if (!m_alt_mask && (sym == XK_Alt_L || sym == XK_Alt_R)) + { + m_alt_mask = 1 << maskIndex; + } + if (!m_meta_mask && (sym == XK_Meta_L || sym == XK_Meta_R)) + { + m_meta_mask = 1 << maskIndex; + } + if (!m_super_mask && (sym == XK_Super_L || sym == XK_Super_R)) + { + m_super_mask = 1 << maskIndex; + } + if (!m_hyper_mask && (sym == XK_Hyper_L || sym == XK_Hyper_R)) + { + m_hyper_mask = 1 << maskIndex; + } + if (!m_numlock_mask && (sym == XK_Num_Lock)) + { + m_numlock_mask = 1 << maskIndex; + } + } + mapIndex++; + } + } + + XFreeModifiermap(map); + + // logic from qt source see gui/kernel/qkeymapper_x11.cpp + if (!m_meta_mask || m_meta_mask == m_alt_mask) + { + // no meta keys... s,meta,super, + m_meta_mask = m_super_mask; + if (!m_meta_mask || m_meta_mask == m_alt_mask) + { + // no super keys either? guess we'll use hyper then + m_meta_mask = m_hyper_mask; + } + } + } + else + { + // assume defaults + m_alt_mask = Mod1Mask; + m_meta_mask = Mod4Mask; + } + + m_haveMods = TRUE; +} + +QList<long> HotkeyManager::ignModifiersList() +{ + ensureModifiers(); + QList<long> ret; + if (m_numlock_mask) + { + ret << 0 << LockMask << m_numlock_mask << (LockMask | m_numlock_mask); + } + else + { + ret << 0 << LockMask; + } + return ret; +} diff --git a/src/plugins/General/hotkey/hotkeymanager.h b/src/plugins/General/hotkey/hotkeymanager.h new file mode 100644 index 000000000..0db01b79e --- /dev/null +++ b/src/plugins/General/hotkey/hotkeymanager.h @@ -0,0 +1,89 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef HOTKEYMANAGER_H +#define HOTKEYMANAGER_H + +#include <QString> +#include <QTableWidgetItem> +#include <QList> +#include <qmmpui/general.h> + +class QEvent; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ + +class Hotkey +{ +public: + enum Action + { + PLAY = QTableWidgetItem::UserType, + STOP, + PAUSE, + PLAY_PAUSE, + NEXT, + PREVIOUS, + SHOW_HIDE + }; + + Hotkey() + { + action = PLAY; + key = 0; + mod = 0; + code = 0; + } + + quint32 mod; + quint32 key; + int action; + int code; + quint32 defaultKey(); + static quint32 defaultKey(int act); +}; + +class HotkeyManager : public General +{ + Q_OBJECT +public: + HotkeyManager(QObject *parent = 0); + + ~HotkeyManager(); + + static const QString getKeyString(quint32 key, quint32 modifiers); + static QList<long> ignModifiersList(); + +protected: + virtual bool eventFilter(QObject* o, QEvent* e); + +private: + static void ensureModifiers(); + QList <Hotkey *> m_grabbedKeys; + static long m_alt_mask; + static long m_meta_mask; + static long m_super_mask; + static long m_hyper_mask; + static long m_numlock_mask; + static bool m_haveMods; +}; + +#endif diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp new file mode 100644 index 000000000..2aca48de7 --- /dev/null +++ b/src/plugins/General/hotkey/settingsdialog.cpp @@ -0,0 +1,116 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QSettings> +#include <QHeaderView> + +extern "C" +{ +#include <X11/keysym.h> +} + +#include <qmmp/qmmp.h> +#include "hotkeydialog.h" +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + ui.tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().height()); + ui.tableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed); + ui.tableWidget->verticalHeader()->hide(); + ui.tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + ui.tableWidget->setRowCount (7); + ui.tableWidget->setItem(0,0, new QTableWidgetItem(tr("Play"))); + ui.tableWidget->setItem(1,0, new QTableWidgetItem(tr("Stop"))); + ui.tableWidget->setItem(2,0, new QTableWidgetItem(tr("Pause"))); + ui.tableWidget->setItem(3,0, new QTableWidgetItem(tr("Play/Pause"))); + ui.tableWidget->setItem(4,0, new QTableWidgetItem(tr("Next"))); + ui.tableWidget->setItem(5,0, new QTableWidgetItem(tr("Previous"))); + ui.tableWidget->setItem(6,0, new QTableWidgetItem(tr("Show/Hide"))); + + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("Hotkey"); + for (int i = Hotkey::PLAY, j = 0; i <= Hotkey::SHOW_HIDE; ++i, ++j) + { + Hotkey *hotkey = new Hotkey; + hotkey->action = i; + hotkey->key = settings.value(QString("key_%1").arg(i), hotkey->defaultKey()).toUInt(); + hotkey->mod = settings.value(QString("modifiers_%1").arg(i), 0).toUInt(); + ui.tableWidget->setItem(j,1, new QTableWidgetItem(HotkeyManager::getKeyString(hotkey->key, + hotkey->mod), i)); + m_hotkeys << hotkey; + } + settings.endGroup(); +} + + +SettingsDialog::~SettingsDialog() +{ + while (!m_hotkeys.isEmpty()) + delete m_hotkeys.takeFirst (); + +} + +void SettingsDialog::accept() +{ + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("Hotkey"); + foreach(Hotkey *k, m_hotkeys) + { + settings.setValue(QString("key_%1").arg(k->action), k->key); + settings.setValue(QString("modifiers_%1").arg(k->action), k->mod); + } + settings.endGroup(); + QDialog::accept(); +} + +void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item) +{ + Hotkey *k = 0; + foreach(k, m_hotkeys) + { + if (k->action == item->type()) + break; + } + if (!k) + return; + + HotkeyDialog *dialog = new HotkeyDialog(k->key, k->mod, this); + if (item->type() >= QTableWidgetItem::UserType && + dialog->exec() == QDialog::Accepted) + { + item->setText(HotkeyManager::getKeyString(dialog->nativeVirtualKey (), dialog->nativeModifiers ())); + k->key = dialog->nativeVirtualKey (); + k->mod = dialog->nativeModifiers (); + } + delete dialog; +} + +void SettingsDialog::on_resetButton_clicked () +{ + for (int i = 0; i < m_hotkeys.size(); ++i) + { + m_hotkeys[i]->key = m_hotkeys[i]->defaultKey(); + m_hotkeys[i]->mod = 0; + ui.tableWidget->item(i, 1)->setText(HotkeyManager::getKeyString(m_hotkeys[i]->key, m_hotkeys[i]->mod)); + } +} diff --git a/src/plugins/General/hotkey/settingsdialog.h b/src/plugins/General/hotkey/settingsdialog.h new file mode 100644 index 000000000..45cb2987f --- /dev/null +++ b/src/plugins/General/hotkey/settingsdialog.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * Copyright (C) 2009 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include <QDialog> +#include "hotkeymanager.h" + +#include "ui_settingsdialog.h" + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class SettingsDialog : public QDialog +{ +Q_OBJECT +public: + SettingsDialog(QWidget *parent = 0); + + ~SettingsDialog(); + + +public slots: + virtual void accept(); + +private slots: + void on_tableWidget_itemDoubleClicked (QTableWidgetItem * item); + void on_resetButton_clicked(); + +private: + Ui::SettingsDialog ui; + QList <Hotkey*> m_hotkeys; +}; + +#endif diff --git a/src/plugins/General/hotkey/settingsdialog.ui b/src/plugins/General/hotkey/settingsdialog.ui new file mode 100644 index 000000000..fd4f1c633 --- /dev/null +++ b/src/plugins/General/hotkey/settingsdialog.ui @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SettingsDialog</class> + <widget class="QDialog" name="SettingsDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>318</width> + <height>299</height> + </rect> + </property> + <property name="windowTitle"> + <string>Global Hotkey Plugin Settings</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="3"> + <widget class="QTableWidget" name="tableWidget"> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="showGrid"> + <bool>true</bool> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="rowCount"> + <number>0</number> + </property> + <property name="columnCount"> + <number>2</number> + </property> + <column> + <property name="text"> + <string>Action</string> + </property> + </column> + <column> + <property name="text"> + <string>Shortcut</string> + </property> + </column> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="resetButton"> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>258</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>SettingsDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>334</x> + <y>227</y> + </hint> + <hint type="destinationlabel"> + <x>207</x> + <y>236</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>SettingsDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>382</x> + <y>229</y> + </hint> + <hint type="destinationlabel"> + <x>107</x> + <y>216</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/plugins/General/hotkey/translations/hotkey_plugin_cs.ts b/src/plugins/General/hotkey/translations/hotkey_plugin_cs.ts new file mode 100644 index 000000000..47e4b86d2 --- /dev/null +++ b/src/plugins/General/hotkey/translations/hotkey_plugin_cs.ts @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>HotkeyDialog</name> + <message> + <location filename="../hotkeydialog.ui" line="14"/> + <source>Modify Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="29"/> + <source>Press the key combination you want to assign</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="43"/> + <source>Clear</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HotkeyFactory</name> + <message> + <location filename="../hotkeyfactory.cpp" line="30"/> + <source>Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="50"/> + <source>About Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="51"/> + <source>Qmmp Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="52"/> + <source>This plugin adds support for multimedia keys or global key combinations</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.cpp" line="42"/> + <source>Play</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="43"/> + <source>Stop</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="44"/> + <source>Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="45"/> + <source>Play/Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="46"/> + <source>Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="47"/> + <source>Previous</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="48"/> + <source>Show/Hide</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="14"/> + <source>Global Hotkey Plugin Settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="42"/> + <source>Action</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="47"/> + <source>Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="55"/> + <source>Reset</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/hotkey/translations/hotkey_plugin_de.ts b/src/plugins/General/hotkey/translations/hotkey_plugin_de.ts new file mode 100644 index 000000000..47e4b86d2 --- /dev/null +++ b/src/plugins/General/hotkey/translations/hotkey_plugin_de.ts @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>HotkeyDialog</name> + <message> + <location filename="../hotkeydialog.ui" line="14"/> + <source>Modify Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="29"/> + <source>Press the key combination you want to assign</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="43"/> + <source>Clear</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HotkeyFactory</name> + <message> + <location filename="../hotkeyfactory.cpp" line="30"/> + <source>Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="50"/> + <source>About Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="51"/> + <source>Qmmp Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="52"/> + <source>This plugin adds support for multimedia keys or global key combinations</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.cpp" line="42"/> + <source>Play</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="43"/> + <source>Stop</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="44"/> + <source>Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="45"/> + <source>Play/Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="46"/> + <source>Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="47"/> + <source>Previous</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="48"/> + <source>Show/Hide</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="14"/> + <source>Global Hotkey Plugin Settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="42"/> + <source>Action</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="47"/> + <source>Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="55"/> + <source>Reset</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/hotkey/translations/hotkey_plugin_ru.ts b/src/plugins/General/hotkey/translations/hotkey_plugin_ru.ts new file mode 100644 index 000000000..dc62e6922 --- /dev/null +++ b/src/plugins/General/hotkey/translations/hotkey_plugin_ru.ts @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="ru_RU"> +<context> + <name>HotkeyDialog</name> + <message> + <location filename="../hotkeydialog.ui" line="14"/> + <source>Modify Shortcut</source> + <translation>Изменить сочетание клавиш</translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="29"/> + <source>Press the key combination you want to assign</source> + <translation>Нажмите клавиши, сочетания которых вы хотите использовать</translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="43"/> + <source>Clear</source> + <translation>Очистить</translation> + </message> +</context> +<context> + <name>HotkeyFactory</name> + <message> + <location filename="../hotkeyfactory.cpp" line="30"/> + <source>Global Hotkey Plugin</source> + <translation>Модуль глоб. клавиш</translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="50"/> + <source>About Global Hotkey Plugin</source> + <translation>О модуле глобальных клавиш</translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="51"/> + <source>Qmmp Global Hotkey Plugin</source> + <translation>Модуль глобальных клавиш для Qmmp</translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="52"/> + <source>This plugin adds support for multimedia keys or global key combinations</source> + <translation>Этот модуль добавляет поддержку медиа- или глобальных клавиш</translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation>Разработчик: Илья Котов <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.cpp" line="42"/> + <source>Play</source> + <translation>Воспроизвести</translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="43"/> + <source>Stop</source> + <translation>Остановить</translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="44"/> + <source>Pause</source> + <translation>Приостановить</translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="45"/> + <source>Play/Pause</source> + <translation>Воспроиз/приост</translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="46"/> + <source>Next</source> + <translation>Следующий фрагмент</translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="47"/> + <source>Previous</source> + <translation>Предыдущий фрагмент</translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="48"/> + <source>Show/Hide</source> + <translation>Показать/Скрыть</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="14"/> + <source>Global Hotkey Plugin Settings</source> + <translation>Настройки модуля глобальных клавиш</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="42"/> + <source>Action</source> + <translation>Действие</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="47"/> + <source>Shortcut</source> + <translation>Горячая клавиша</translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="55"/> + <source>Reset</source> + <translation>Сбросить</translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/hotkey/translations/hotkey_plugin_uk_UA.ts b/src/plugins/General/hotkey/translations/hotkey_plugin_uk_UA.ts new file mode 100644 index 000000000..47e4b86d2 --- /dev/null +++ b/src/plugins/General/hotkey/translations/hotkey_plugin_uk_UA.ts @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>HotkeyDialog</name> + <message> + <location filename="../hotkeydialog.ui" line="14"/> + <source>Modify Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="29"/> + <source>Press the key combination you want to assign</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="43"/> + <source>Clear</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HotkeyFactory</name> + <message> + <location filename="../hotkeyfactory.cpp" line="30"/> + <source>Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="50"/> + <source>About Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="51"/> + <source>Qmmp Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="52"/> + <source>This plugin adds support for multimedia keys or global key combinations</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.cpp" line="42"/> + <source>Play</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="43"/> + <source>Stop</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="44"/> + <source>Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="45"/> + <source>Play/Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="46"/> + <source>Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="47"/> + <source>Previous</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="48"/> + <source>Show/Hide</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="14"/> + <source>Global Hotkey Plugin Settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="42"/> + <source>Action</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="47"/> + <source>Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="55"/> + <source>Reset</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/hotkey/translations/hotkey_plugin_zh_CN.ts b/src/plugins/General/hotkey/translations/hotkey_plugin_zh_CN.ts new file mode 100644 index 000000000..47e4b86d2 --- /dev/null +++ b/src/plugins/General/hotkey/translations/hotkey_plugin_zh_CN.ts @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>HotkeyDialog</name> + <message> + <location filename="../hotkeydialog.ui" line="14"/> + <source>Modify Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="29"/> + <source>Press the key combination you want to assign</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="43"/> + <source>Clear</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HotkeyFactory</name> + <message> + <location filename="../hotkeyfactory.cpp" line="30"/> + <source>Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="50"/> + <source>About Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="51"/> + <source>Qmmp Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="52"/> + <source>This plugin adds support for multimedia keys or global key combinations</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.cpp" line="42"/> + <source>Play</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="43"/> + <source>Stop</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="44"/> + <source>Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="45"/> + <source>Play/Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="46"/> + <source>Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="47"/> + <source>Previous</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="48"/> + <source>Show/Hide</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="14"/> + <source>Global Hotkey Plugin Settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="42"/> + <source>Action</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="47"/> + <source>Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="55"/> + <source>Reset</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/hotkey/translations/hotkey_plugin_zh_TW.ts b/src/plugins/General/hotkey/translations/hotkey_plugin_zh_TW.ts new file mode 100644 index 000000000..47e4b86d2 --- /dev/null +++ b/src/plugins/General/hotkey/translations/hotkey_plugin_zh_TW.ts @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>HotkeyDialog</name> + <message> + <location filename="../hotkeydialog.ui" line="14"/> + <source>Modify Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="29"/> + <source>Press the key combination you want to assign</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeydialog.ui" line="43"/> + <source>Clear</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>HotkeyFactory</name> + <message> + <location filename="../hotkeyfactory.cpp" line="30"/> + <source>Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="50"/> + <source>About Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="51"/> + <source>Qmmp Global Hotkey Plugin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="52"/> + <source>This plugin adds support for multimedia keys or global key combinations</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../hotkeyfactory.cpp" line="53"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>SettingsDialog</name> + <message> + <location filename="../settingsdialog.cpp" line="42"/> + <source>Play</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="43"/> + <source>Stop</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="44"/> + <source>Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="45"/> + <source>Play/Pause</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="46"/> + <source>Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="47"/> + <source>Previous</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.cpp" line="48"/> + <source>Show/Hide</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="14"/> + <source>Global Hotkey Plugin Settings</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="42"/> + <source>Action</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="47"/> + <source>Shortcut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../settingsdialog.ui" line="55"/> + <source>Reset</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/src/plugins/General/hotkey/translations/translations.qrc b/src/plugins/General/hotkey/translations/translations.qrc new file mode 100644 index 000000000..9258014ff --- /dev/null +++ b/src/plugins/General/hotkey/translations/translations.qrc @@ -0,0 +1,11 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> + <qresource> + <file>hotkey_plugin_cs.qm</file> + <file>hotkey_plugin_de.qm</file> + <file>hotkey_plugin_zh_CN.qm</file> + <file>hotkey_plugin_zh_TW.qm</file> + <file>hotkey_plugin_ru.qm</file> + <file>hotkey_plugin_uk_UA.qm</file> + </qresource> +</RCC> |
