From 79874c14cfb0b61058b7ebdca81e89f8da016ce3 Mon Sep 17 00:00:00 2001 From: John Toman Date: Fri, 16 Apr 2010 00:18:56 +0000 Subject: [PATCH 1/2] Allows the user to close the get key dialog without it overwriting their current set button. git-svn-id: svn://svn.code.sf.net/p/qjoypad/code/trunk@129 c05e91a0-76c8-4ec0-b377-ef19ce7cc080 --- src/getkey.cpp | 6 +++++- src/getkey.h | 2 ++ src/keycode.cpp | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/getkey.cpp b/src/getkey.cpp index 3a561f6..d56ff5c 100644 --- a/src/getkey.cpp +++ b/src/getkey.cpp @@ -29,7 +29,6 @@ bool GetKey::x11Event( XEvent* e ) { //keep Qt from closing the dialog upon seeing Esc pressed. if (e->type == KeyPress) return true; - //On a key press, return the key and quit //Ctrl+X == [No Key] if (e->type == KeyRelease) { @@ -51,6 +50,11 @@ bool GetKey::x11Event( XEvent* e ) return false; } +void GetKey::closeEvent(QCloseEvent *e) { + e->ignore(); + done(-1); +} + void GetKey::paintEvent ( QPaintEvent * ) { //whenever we need to repaint, draw in our text. QPainter paint( this ); diff --git a/src/getkey.h b/src/getkey.h index 54edce4..cfa5b4b 100644 --- a/src/getkey.h +++ b/src/getkey.h @@ -2,6 +2,7 @@ #include #include #include +#include #include "constant.h" #include //The KeySym for "x" @@ -20,6 +21,7 @@ class GetKey : public QDialog { //to avoid focus issues, there is only the dialog widget, all the //rest is painted on. So, I need to know when to repaint. void paintEvent ( QPaintEvent * ); + void closeEvent (QCloseEvent *); private: //the dialog's message QString Text; diff --git a/src/keycode.cpp b/src/keycode.cpp index 0607c90..9dd88f6 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -89,7 +89,14 @@ KeyButton::KeyButton( QString name, int val, QWidget* parent, bool m, bool nowMo void KeyButton::onClick() { //when clicked, ask for a key! - value = GetKey( buttonname, mouse ).exec(); + int retValue = GetKey( buttonname, mouse ).exec(); + // -1 is a special value meaning that the window was simply + // closed so we can ignore this + if(retValue == -1) { + return; + } else { + value = retValue; + } //if the return value was a mouse click... if (value > MOUSE_OFFSET) { mouseClicked = true; From 70710ae32f2bfb381b941aac13976c116f829189 Mon Sep 17 00:00:00 2001 From: John Toman Date: Tue, 28 Dec 2010 03:25:16 +0000 Subject: [PATCH 2/2] Updates the README to address some licensing concerns git-svn-id: svn://svn.code.sf.net/p/qjoypad/code/trunk@130 c05e91a0-76c8-4ec0-b377-ef19ce7cc080 --- README.txt | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/README.txt b/README.txt index 823a8b3..3f0ea3f 100644 --- a/README.txt +++ b/README.txt @@ -904,17 +904,8 @@ Chapter 6. Credits Thank you for your interest and for your support, Mark. _________________________________________________________ -Chapter 7. This software is GPL! +Chapter 7. Licensing + + This software is licensed under the terms of the GNU GPLv2. + Please see LICENSE.txt for a full text of the license. - Check out LICENSE.txt or http://www.gnu.org/licenses/gpl.txt - for details! The bare bones of it is, this program is - distributed in open-source form so that others may share it - freely, learn from it, or modify it as they see fit. However, - under no circumstances can it be sold! - - This code was written entirely by Nathan Gaylinn (excepting - the code used for displaying a tray icon that is adapted from - the Psi source [http://psi.affinix.com/]) but is based on the - idea of xjoypad by Erich Kitzmüller. - - Yay for the power GPL gives to developers!