diff --git a/CMakeLists.txt b/CMakeLists.txt index 41a5105..7b77fc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,17 +8,15 @@ set(QJOYPAD_PATCH 0) find_package(Qt4 REQUIRED) -set(WITH_LIBUDEV ON CACHE PATH "Use libudev for automatically updating joypad devices.") +option(WITH_LIBUDEV "Use libudev for automatically updating joypad devices." ON) if(WITH_LIBUDEV) find_package(PkgConfig REQUIRED) pkg_check_modules(LIBUDEV libudev) - if(LIBUDEV_FOUND) - message(STATUS "libudev found") - else() - message(ERROR "libudev not found. If you don't want to compile with libudev support use -DWITH_LIBUDEV=OFF") + if(NOT(LIBUDEV_FOUND)) + message(FATAL_ERROR "libudev not found. If you don't want to compile with libudev support use -DWITH_LIBUDEV=OFF") endif() link_directories(${LIBUDEV_LIBRARY_DIRS}) @@ -27,7 +25,10 @@ endif() set(DEVICE_DIR "/dev/input" CACHE PATH "Set the path where QJoyPad will look for your joystick devices. If your devices are /dev/js0, /dev/js1, etc., this should be just \"/dev\". By default, this is /dev/input.") -set(PLAIN_KEYS OFF CACHE BOOL "Force QJoyPad to use standard XWindows keynames without filtering them for appearance. This will make displays less attractive and readable, but will save processor power and ensure that you see the right names for keys you press.") +option(PLAIN_KEYS "Force QJoyPad to use standard XWindows keynames without filtering them for appearance. This will make displays less attractive and readable, but will save processor power and ensure that you see the right names for keys you press." OFF) + +option(UPDATE_TRANSLATIONS "Update source translation locale/*.ts +files (WARNING: make clean will delete the source .ts files! Danger!)") message(STATUS "Using device directory: ${DEVICE_DIR}") @@ -49,10 +50,22 @@ add_definitions(${QT_DEFINITIONS}) # for config.h include_directories("${PROJECT_BINARY_DIR}/src") +file(GLOB qjoypad_TRANS_SOURCES translations/qjoypad_*.ts) + +if(UPDATE_TRANSLATIONS) + file(GLOB_RECURSE qjoypad_TRANS_FILES *.cpp *.h) + qt4_create_translation(qjoypad_TRANS ${qjoypad_TRANS_SOURCES} ${qjoypad_TRANS_FILES}) +else() + qt4_add_translation(qjoypad_TRANS ${qjoypad_TRANS_SOURCES}) +endif() + add_subdirectory(icons) add_subdirectory(src) +add_custom_target(translations_target DEPENDS ${qjoypad_TRANS}) + install(PROGRAMS qjoypad.desktop DESTINATION "share/applications") +install(FILES ${qjoypad_TRANS} DESTINATION "share/qjoypad/translations") # uninstall target configure_file( diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51bbfb1..2c441e4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,8 +40,8 @@ set(qjoypad_QOBJECT_HEADERS layout.h quickset.h) -QT4_WRAP_CPP(qjoypad_HEADERS_MOC ${qjoypad_QOBJECT_HEADERS}) -add_executable(qjoypad ${qjoypad_SOURCES} ${qjoypad_HEADERS_MOC}) +qt4_wrap_cpp(qjoypad_HEADERS_MOC ${qjoypad_QOBJECT_HEADERS}) +add_executable(qjoypad ${qjoypad_SOURCES} ${qjoypad_HEADERS_MOC}) # ${qjoypad_TRANS}) target_link_libraries(qjoypad ${QT_LIBRARIES} Xtst X11 ${LIBUDEV_LIBRARIES}) install(TARGETS qjoypad RUNTIME DESTINATION "bin") diff --git a/src/axis.cpp b/src/axis.cpp index 0e053cf..c81311e 100644 --- a/src/axis.cpp +++ b/src/axis.cpp @@ -266,6 +266,10 @@ bool Axis::isDefault() { (nuseMouse == false) ; } +QString Axis::getName() { + return tr("Axis %1").arg(index+1); +} + bool Axis::inDeadZone( int val ) { int value; if (throttle == 0) diff --git a/src/axis.h b/src/axis.h index 80d2d00..2abcf8e 100644 --- a/src/axis.h +++ b/src/axis.h @@ -43,7 +43,7 @@ class Axis : public QObject { void toDefault(); //True iff currently at defaults bool isDefault(); - QString getName() { return tr("Axis %1").arg(index+1);} + QString getName(); //true iff the given value is in the dead zone for this axis. bool inDeadZone( int val ); //a descriptive string used as a label for the button representing this axis diff --git a/src/button.cpp b/src/button.cpp index 85c203e..18b5e64 100644 --- a/src/button.cpp +++ b/src/button.cpp @@ -123,6 +123,10 @@ bool Button::isDefault() { (keycode == 0); } +QString Button::getName() { + return tr("Button %1").arg(index+1); +} + QString Button::status() { if (useMouse) { return tr("%1 : Mouse %2").arg(getName()).arg(keycode); diff --git a/src/button.h b/src/button.h index d1248be..4d74029 100644 --- a/src/button.h +++ b/src/button.h @@ -29,7 +29,7 @@ class Button : public QObject { //True iff is currently using default settings bool isDefault(); //returns a string representation of this button. - QString getName() { return tr("Button %1").arg(index+1); } + QString getName(); //a descriptive string used as a label for the button representing this axis QString status(); //set the key code for this axis. Used by quickset. diff --git a/src/error.h b/src/error.h index 2b4e03f..41b4347 100644 --- a/src/error.h +++ b/src/error.h @@ -12,11 +12,13 @@ inline void errorBox(const QString &type, const QString &message, QWidget *paren message, QMessageBox::Ok, Qt::NoButton); } +inline void debug_mesg(const char *fmt, ...) __attribute__((format(printf,1,2))); + #ifdef _DEBUG inline void debug_mesg(const char *fmt, ...) { va_list ap; - va_start(ap, NULL); - vprintf(fmt, ap); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); va_end(ap); } #else diff --git a/src/flash.cpp b/src/flash.cpp index 6e8eab1..9b468b7 100644 --- a/src/flash.cpp +++ b/src/flash.cpp @@ -4,7 +4,7 @@ //Modified here (and in .h) to not have default arguments for 2 and 3. //This caused an error with a development version of g++ on a Mandrake system //in Sweden. -FlashButton::FlashButton( QString text, QString name, QWidget* parent ) +FlashButton::FlashButton(const QString &text, const QString &name, QWidget* parent ) : QPushButton( text, parent ) { this->setObjectName(name); diff --git a/src/flash.h b/src/flash.h index 8c1eba2..116a6cc 100644 --- a/src/flash.h +++ b/src/flash.h @@ -16,7 +16,7 @@ class FlashButton : public QPushButton { Q_OBJECT public: - FlashButton(QString text, QString name = "" , QWidget* parent = 0); + FlashButton(const QString& text, const QString& name = "" , QWidget* parent = 0); public slots: //make the button turn blue if it was gray, or visa versa. void flash(); diff --git a/src/joypad.cpp b/src/joypad.cpp index 7d6aacb..77999b9 100644 --- a/src/joypad.cpp +++ b/src/joypad.cpp @@ -101,6 +101,18 @@ void JoyPad::open(int dev) { debug_mesg("done resetting to dev\n"); } +const QString &JoyPad::getDeviceId() const { + return deviceId; +} + +QString JoyPad::getName() const { + return tr("Joystick %1 (%2)").arg(index+1).arg(deviceId); +} + +int JoyPad::getIndex() const { + return index; +} + void JoyPad::toDefault() { //to reset the whole, reset all the parts. foreach (Axis *axis, axes) { diff --git a/src/joypad.h b/src/joypad.h index cfc464d..d0b8fe8 100644 --- a/src/joypad.h +++ b/src/joypad.h @@ -41,9 +41,9 @@ class JoyPad : public QObject { bool isDefault(); //read the dimensions on the real joystick and use them void open( int dev ); - const QString& getDeviceId() const { return deviceId; } - QString getName() const { return tr("Joystick %1 (%2)").arg(index+1).arg(deviceId); } - int getIndex() const { return index; } + const QString& getDeviceId() const; + QString getName() const; + int getIndex() const; private: diff --git a/src/main.cpp b/src/main.cpp index 40f4e52..5935bc8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,8 +62,8 @@ int main( int argc, char **argv ) //if there is no new directory and we can't make it, complain if (!dir.exists() && !dir.mkdir(settingsDir)) { - errorBox(app.tr("Couldn't create the QJoyPad save directory"), - app.tr("Couldn't create the QJoyPad save directory: %s").arg(settingsDir)); + errorBox(app.translate("main","Couldn't create the QJoyPad save directory"), + app.translate("main","Couldn't create the QJoyPad save directory: %s").arg(settingsDir)); return 1; } @@ -94,7 +94,7 @@ int main( int argc, char **argv ) switch (c) { case 'h': - printf("%s", qPrintable(app.tr("%1\n" + printf("%s", qPrintable(app.translate("main","%1\n" "Usage: %2 [--device=\"/device/path\"] [--notray|--force-tray] [\"layout name\"]\n" "\n" "Options:\n" @@ -102,7 +102,7 @@ int main( int argc, char **argv ) " -d, --device=PATH Look for joystick devices in PATH. This should\n" " be something like \"/dev/input\" if your game\n" " devices are in /dev/input/js0, /dev/input/js1, etc.\n" - " -t, --force-tray Forece to use a system tray icon.\n" + " -t, --force-tray Force to use a system tray icon.\n" " -T, --notray Do not use a system tray icon. This is useful for\n" " window managers that don't support this feature.\n" " -u, --update Force a running instance of QJoyPad to update its\n" @@ -117,8 +117,8 @@ int main( int argc, char **argv ) devdir = optarg; } else { - errorBox(app.tr("Not a directory"), - app.tr("Path is not a directory: %1").arg(optarg)); + errorBox(app.translate("main","Not a directory"), + app.translate("main","Path is not a directory: %1").arg(optarg)); return 1; } break; @@ -137,7 +137,7 @@ int main( int argc, char **argv ) break; case '?': - fprintf(stderr, "%s", qPrintable(app.tr( + fprintf(stderr, "%s", qPrintable(app.translate("main", "Illeagal argument.\n" "See `%1 --help` for more information\n").arg(argc > 0 ? argv[0] : "qjoypad"))); return 1; @@ -148,7 +148,7 @@ int main( int argc, char **argv ) layout = argv[optind ++]; if (optind < argc) { - fprintf(stderr, "%s", qPrintable(app.tr( + fprintf(stderr, "%s", qPrintable(app.translate("main", "Too many arguments.\n" "See `%1 --help` for more information\n").arg(argc > 0 ? argv[0] : "qjoypad"))); return 1; @@ -190,8 +190,8 @@ int main( int argc, char **argv ) //however, if we are setting the layout or updating the device //list, this is not an error and we shouldn't make one! if (layout.isEmpty() && !update) - errorBox(app.tr("Instance Error"), - app.tr("There is already a running instance of QJoyPad; please close\nthe old instance before starting a new one.")); + errorBox(app.translate("main","Instance Error"), + app.translate("main","There is already a running instance of QJoyPad; please close\nthe old instance before starting a new one.")); else { //if one of these is the case, send the approrpriate signal! if (update) { @@ -219,8 +219,8 @@ int main( int argc, char **argv ) sleep(1); sleepCounter++; if (sleepCounter > 20) { - errorBox(app.tr("System tray isn't loading"), - app.tr("Waited more than 20 seconds for the system tray to load. Giving up.")); + errorBox(app.translate("main","System tray isn't loading"), + app.translate("main","Waited more than 20 seconds for the system tray to load. Giving up.")); return 1; } } diff --git a/translations/qjoypad_de.ts b/translations/qjoypad_de.ts new file mode 100644 index 0000000..191df36 --- /dev/null +++ b/translations/qjoypad_de.ts @@ -0,0 +1,555 @@ + + + + + Axis + + + Axis %1 + Achse %1 + + + + KEYBOARD/MOUSE + TASTATUR/MAUS + + + + + MOUSE + MAUS + + + + KEYBOARD + TASTATUR + + + + THROTTLE + Drossel + + + + AxisEdit + + + &Gradient + &Verlauf + + + + Keyboard/Mouse Button + Tastatur-/Maus-Taste + + + + Mouse (Vert.) + Maus (Vert.) + + + + Mouse (Vert. Rev.) + Maus (Vert. Inv.) + + + + Mouse (Hor.) + Maus (Hor.) + + + + Mouse (Hor. Rev.) + Maus (Hor. Inv.) + + + + Linear + Linear + + + + Quadratic + Quadratisch + + + + Cubic + Cubisch + + + + Quadratic Extreme + Quadratisches Extrem + + + + Power Function + Potenzfunktion + + + + &Mouse Speed + &Mausgeschwindigkeit + + + + &Sensitivity + &Sensibilität + + + + Neg. Throttle + Neg. Drossel + + + + No Throttle + Keine Drossel + + + + Pos. Throttle + Pos. Drossel + + + + Button + + + Button %1 + Taste %1 + + + + %1 : Mouse %2 + %1: Maus %2 + + + + %1 : %2 + %1: %2 + + + + ButtonEdit + + + Set %1 + Setze %1 + + + + &Sticky + &Klebrig + + + + &Rapid Fire + Schnellfeue&r + + + + FloatingIcon + + + %1 Floating Icon + %1 Schwebendes Symbol + + + + GetKey + + + Choose a key + Wähle eine Taste + + + + Choose a new key or mouse button for %1 + Whähle eine neue Taste oder einen neuen Mausknopf für %1 + + + + Choose a new key for %1 + Wähle eine neue Taste für %1 + + + + +(Ctrl-X for no key) + +(Ctrl-X für keine Taste) + + + + JoyPad + + + Joystick %1 (%2) + Joystick %1 (%2) + + + + + + + + Layout file error + Belegungsdatei-Fehler + + + + + Expected ':', found '%1'. + ';' erwartet, '%1' vorgefunden. + + + + Error reading Button %1 + Fehler beim Lesen der Taste %1 + + + + Error reading Axis %1 + Fehler beim Lesen der Achse %1 + + + + Error while reading layout. Unrecognized word: %1 + Fehler beim Lesen der Belegung. Unbekanntes Wort: %1 + + + + JoyPadWidget + + + Clear + Löschen + + + + Quick Set + Schnell Setzen + + + + KeyButton + + + + Mouse %1 + Maus %1 + + + + LayoutEdit + + + &Add + &Hinzufügen + + + + &Remove + &Entfernen + + + + &Save + &Speichern + + + + Re&vert + &Zurücksetzen + + + + &Close Dialog + &Fenster Schließen + + + + &Quit + &Beenden + + + + [NO LAYOUT] + [KEINE BELEGUNG] + + + + LayoutManager + + + Update &Joystick Devices + &Joysticks Aktualisieren + + + + Update &Layout List + Be&legungsliste Aktualisieren + + + + &Quit + &Beenden + + + + UDev Error + UDev Fehler + + + + Error creating UDev monitor. QJoyPad will still work, but it won't automatically update the joypad device list. + Fehler beim Erzeugen des UDev Monitors. QJoypad wird dennoch funktionieren, aber es wird nicht automatisch die Joypad-Liste aktualisieren. + + + + + + + Load error + Lade-Fehler + + + + Error reading joystick definition. Unexpected token "%1". Expected a positive number. + Fehler beim Lesen der Joystick-Definition. Unerwartets Token "%1". Eine positive Zahl wurde erwartet. + + + + Error reading joystick definition. Unexpected character "%1". Expected '{'. + Fehler beim Lesen der Joystick-Definition. Unerwartets Zeichen "%1". '{' wurde erwartet. + + + + Error reading definition for joystick %1. + Fehler beim Lesen der Definition von Joystick %1. + + + + Error reading joystick definition. Unexpected token "%1". Expected "Joystick". + Fehler beim Lesen der Joystick-Definition. Unerwartetes Token "%1". "Joystick" wurde erwertet. + + + + + Save error + Fehler beim Speichern + + + + Could not open file %1, layout not saved. + Konnte Datei %1 nicht öffnen, Belegung wurde nicht gespeichert. + + + + %1 - Name new layout + %1 - Benenne die neue Belegung + + + + Enter a name for the new layout: + Name der neuen Belegung eingeben: + + + + That name's already taken! + Dieser Name ist bereits belegt! + + + + %1 - Delete layout? + %1 - Belegung löschen? + + + + Remove layout %1 permanently from your hard drive? + Belegung %1 permanent von ihrer Festplatte löschen? + + + + Delete + Entfernen + + + + Cancel + Abbrechen + + + + Remove error + Fehler beim Entfernen + + + + Could not remove file %1 + Konnte Datei %1 nicht entfernen + + + + No joystick devices available + Keine Joysticks verfügbar + + + + No joystick devices are currently available to configure. +Please plug in a gaming device and select +"Update Joystick Devices" from the popup menu. + Zur Zeit sind keine Joysticks zur Konfiguration verfügbar. +Bitte schließen Sie ein entsprechendes Gerät an und +wählen Sie "Joysticks Aktualisieren" im Popup-Menü. + + + + Joysticks: (none) + Joystocks: (keine) + + + + Joysticks: %1 + Joysticks: %1 + + + + [NO LAYOUT] + [KEINE BELEGUNG] + + + + QuickSet + + + Set %1 + Setze %1 + + + + Press any button or axis and +you will be prompted for a key. + Drücken sie eine belibige Taste oder Achse und +Sie werden nach einer Taste gefragt werden. + + + + Done + Fertig + + + + %1, positive + %1, positiv + + + + %1, negative + %1, negativ + + + + main + + + Couldn't create the QJoyPad save directory + Konnte das QJoyPad Seicher-Verzeichnis nicht anlegen + + + + Couldn't create the QJoyPad save directory: %s + Konnte das QJoyPad Seicher-Verzeichnis nicht anlegen: %s + + + + %1 +Usage: %2 [--device="/device/path"] [--notray|--force-tray] ["layout name"] + +Options: + -h, --help Print this help message. + -d, --device=PATH Look for joystick devices in PATH. This should + be something like "/dev/input" if your game + devices are in /dev/input/js0, /dev/input/js1, etc. + -t, --force-tray Force to use a system tray icon. + -T, --notray Do not use a system tray icon. This is useful for + window managers that don't support this feature. + -u, --update Force a running instance of QJoyPad to update its + list of devices and layouts. + "layout name" Load the given layout in an already running + instance of QJoyPad, or start QJoyPad using the + given layout. + + %1 +Verwendung: %2 [--device="/Geräte/Pfad"] [--notray|--force-tray] ["Belegungsname"] + +Optionen: + -h, --help Gibt diesen Hilfetext aus. + -d, --device=PFAD In PFAD nach Joystick-Geräten suchen. Dies sollte + "/dev/input" sein wenn Ihre Joysticks + /dev/input/js0, /dev/input/js1 etc. sind. + -t, --force-tray Verwendung der Systemablage erzwingen. + -T, --notray Systemablage nicht verwenden. Nützlich für + Fenstermanager die keine Systemablage unterstützen. + -u, --update Zwinge eine laufende Instanz von QJoyPad die + Geräte- und Belegungslisten zu aktualisieren. + "Belegungsname" Lade die angegebenen Belegung in einer bereits laufenden + Instanz von QJoyPad oder starte QJoyPad mit der gegebenen + Belegung. + + + + + + Not a directory + Kein Verzeichnis + + + + Path is not a directory: %1 + Pfad ist kein Verzeichnis: %1 + + + + Illeagal argument. +See `%1 --help` for more information + + Ungülltiges Argument. +Siehe `%1 --help` für mehr Information + + + + + Too many arguments. +See `%1 --help` for more information + + Zu viele Argumente. +Siehe `%1 --help` für mehr Information + + + + + Instance Error + Instanzierungs-Fehler + + + + There is already a running instance of QJoyPad; please close +the old instance before starting a new one. + Es löuft bereits eine Instanz von QJoyPad; bitte schließen +sie die alte Instanz bevor sie eine neue öffnen. + + + + System tray isn't loading + Systemablage startet nicht + + + + Waited more than 20 seconds for the system tray to load. Giving up. + Es wurde mehr als 20 Sekunden auf die Systemablage gewartet. Gebe auf. + + +