HP Forums

Full Version: WP-31S Qt Emulator Bug (Fixed)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I discovered a bug in the WP-31s Qt Emulator. If Edit/Preferences/Keyboard "Use H-shift click" is checked, and you have a number in the X register and click on the yellow part of the "f" shift key (not the black part) it corrupts the number in the X register. Many of the yellow parts of the keys were executing strange functions. There was a lot of code left over from the WP-34s associated with clicking on the green part of the key to automatically activate the hShifted functions. I corrected all of that remnant hShifted stuff and converted it to fShifted, so now you can click on the yellow part of the key to have direct access to the f shifted operations in the WP-31s Qt emulator.

Unzip this attached zip file into & change the current directory to the wp34s/branches/wp31s/QtGui directory and apply the patches with this command:

patch -p0 <FixShift-r3758-20150305.patch

This bug was originally reported in the "WP31s error recovery" thread, but it didn't belong there so I created a separate thread. Walter, Pauli, Marcus, Pascal, Johnathan, Bit, anyone who reviews WP-31s Qt emulator changes. Please try it out and let me know what you think. The patch applies changes to the following files in the wp34s/branches/wp31s/QtGui directory:

QtEmulatorAdapter.c
QtEmulatorAdapter.h
QtEmulator.cpp
QtEmulator.h
QtKeyboard.cpp
QtKeyboard.h
QtKeyCode.cpp
QtKeyCode.h
QtPreferencesDialog.cpp
QtPreferencesDialog.h
QtSkin.cpp
QtSkin.h

Thanks, Barry
I've given it a quick try and also glanced through the code (that's all I have time for right now). It looks good at first sight. I see that you've also fixed the shift lock feature. I'm glad there's one more person now who can contribute patches.

It'd be useful if old-style skins (with "hshift" instead of "fshift") were also accepted. Otherwise the emulator will fail to start if someone only updates the binary.
(03-05-2015 03:36 AM)Bit Wrote: [ -> ]I've given it a quick try and also glanced through the code (that's all I have time for right now). It looks good at first sight. I see that you've also fixed the shift lock feature. I'm glad there's one more person now who can contribute patches.

It'd be useful if old-style skins (with "hshift" instead of "fshift") were also accepted. Otherwise the emulator will fail to start if someone only updates the binary.
It was my first patch contribution to the wp34s/wp31s project, so I may not have thought of everything. That is a good idea about supporting old skin files. Thanks for all of your valuable time and much needed support.
To support the old skin files, you simply not rename the parameter. Dirty but efficient.
But normally, the build system, i.e. Makefile creates a distribution so the risk of someone changing just the binary is low.

On the other hand, the skins are compatible with the WP34s ones and this is a good thing I used recently in another context. So changing their format for the WP31s can be discussed.

I have no strong opinion on this and I did not know of the WP31s Qt emulator till very recently so do what you think is best.
(03-05-2015 06:40 AM)pascal_meheut Wrote: [ -> ]To support the old skin files, you simply not rename the parameter. Dirty but efficient.
Pascal, Bit: I restored my skin files back to the original "hshift" tag, and modified QtSkin.cpp to read the original
hshift tag rather then the fshift tag to preserve backward compatibility with the original wp31s skins and the WP-34s skins.
If you already patched your two skin files, you may have to "Manually" revert line 7 back to "hshift" in each file, but the new
patch won't alter the skins, or require altered skins going forward.

The zipped patch file in the first posting of this thread has been updated accordingly. Thanks for the suggestions,

Barry
Johnathan Cameron had an excellent suggestion that I encode the SVN revision and date into the zip file name.
The first posting of this thread now has a zip file with this encoding included.
(03-06-2015 01:02 AM)BarryMead Wrote: [ -> ]Jonathan Cameron had an excellent suggestion that I encode the SVN revision and date into the zip file name.
The first posting of this thread now has a zip file with this encoding included.

Nice!

-Jonathan
I took Barry's patches (FixShift-r3758-20150305.zip, in the first post), Applied them to the latest release (3758) and built an executable for 64-bit Linux. I built it on Ubuntu, but I think it should run on most reasonably current 64-bit linux systems. You can download it from here:

http://jmcameron.net/WP-31s/wp-31s-QtGui...-05.tar.gz

[EDIT 2015-03-07: New compiled versions of the QtGui emulator for various platforms with these patches should be available soon. When they are available, I will remove the link above.]

When you untar it, it will put the files in a directory 'wp-31s'. 'cd' into that directory and run the script WP-31s at the top level and it will bring up the QtGui emulator.

Please try it and post here to let us know if you find any problems with the shifted functions using Barry's nice fixes.

After I hear a couple people have tried it and it seems okay, I'll commit the changes to the sourceforge svn repo.

Thanks Barry!

-Jonathan

P.S. Yes, the version will be reported as 3759 because the local builds are always incremented by one in anticipation of being saved to the svn repo--which increments the release number.
Do you know that it would be easy to have the WP31s Qt emulators built for the 4 platforms and uploaded to sourceforce like the WP34s ones?

Do you want me to work on it?
Hi Pascal,

(03-06-2015 06:11 AM)pascal_meheut Wrote: [ -> ]Do you know that it would be easy to have the WP31s Qt emulators built for the 4 platforms and uploaded to sourceforce like the WP34s ones?

I did not realize it could be compiled for that many systems. All I've ever compiled QtEmulator for is Linux.

(03-06-2015 06:11 AM)pascal_meheut Wrote: [ -> ]Do you want me to work on it?

That sounds fine. I just thought this would make it easier for folks to test it before we commited the changes back to the WP-31s branch on sourceforge. I also included a script to make running it easier, without actually installing it.

When you have put executables on sourceforge, I encourage you to post a pointer here so folks know where to find it.

-Jonathan
(03-06-2015 07:28 AM)Jonathan Cameron Wrote: [ -> ]I did not realize it could be compiled for that many systems. All I've ever compiled QtEmulator for is Linux.

RTM ;-)

(03-06-2015 07:28 AM)Jonathan Cameron Wrote: [ -> ]That sounds fine. I just thought this would make it easier for folks to test it before we commited the changes back to the WP-31s branch on sourceforge. I also included a script to make running it easier, without actually installing it.

Normally, running it is simply clicking on it.

(03-06-2015 07:28 AM)Jonathan Cameron Wrote: [ -> ]When you have put executables on sourceforge, I encourage you to post a pointer here so folks know where to find it.

Will do. With some luck, this WE. This is a simple adaptation of the process I have in place for the WP34s.
(03-06-2015 06:11 AM)pascal_meheut Wrote: [ -> ]Do you know that it would be easy to have the WP31s Qt emulators built for the 4 platforms and uploaded to sourceforce like the WP34s ones?

Do you want me to work on it?
Now that the WP-31s has matured with the FixShift patch and Bit's "Better UNDO" patch, I think it is a very good idea to make the Qt emulator available in all 4 platforms as you have done with the WP-34s, Thanks Pascal

Attached is a zipped up copy of Bit's Better Undo patch relative to SVN revision 3758. Unzip and change the current directory to "wp34s/branches/wp31s/" then apply the patch with the following command:
patch -p0 <wp31s_better_undo_r3758_20150306.patch
(03-07-2015 03:04 AM)BarryMead Wrote: [ -> ]When I tried to apply Bit's Better UNDO patch with: patch -p1 <patchfile, it failed on several hunks. I had to examine the patch with the kde kompare utility, and manually edit the code to apply the patch, but it was worth the end result.
Tabs are converted to spaces in the forum, which may have been the cause of the problem. You could try the --ignore-whitespace option with the command line patch utility.
(03-07-2015 04:19 AM)Bit Wrote: [ -> ]
(03-07-2015 03:04 AM)BarryMead Wrote: [ -> ]When I tried to apply Bit's Better UNDO patch (as shown in the "WP-31s error recovery" thread) with: patch -p1 <patchfile, it failed on several hunks. I had to examine the patch with the kde kompare utility, and manually edit the code to apply the patch, but it was worth the end result.
Tabs are converted to spaces in the forum, which may have been the cause of the problem. You could try the --ignore-whitespace option with the command line patch utility.
Bit: I tried your --ignore-whitespace suggestion, by checking out a fresh copy of the SVN 3758 tree, and applying your original patch with: patch -p1 --ignore-whitespace <patchfile and it still failed, so using the kompare utility with an editor, I manually applied the patch, then created a new patch relative to SVN 3758 that does not complain with hunk failures. I also verified that that the patches (FixShift, or better_undo) can be applied in either order without causing patch errors. The better_undo zip file above contains this new corrected patch file. It should exactly match your "Even Better UNDO" changes. Feel free to verify that it does. Thanks again, Barry
You just need to apply it with patch -p0 in wp31s, not in QtGui. Done & commited.
Reference URL's