Thursday, October 11, 2012

IsItPrime 2.0.0 Progress Report

Today has been quite a productive day with the "new" IsItPrime.

The interface itself has changed, obviously, as I am now using the Qt API in hopes of soon (eventually) developing a fully cross-platform app that will run natively in any (or at least most) OS environment(s).

Thus far, it's actually a weird hybrid of the Windows API and Qt, meaning it will still only compile and run on Windows, since it uses Windows libraries and headers. That will change, though.

Today, and within the last few days, I have implemented and tested several features:
  • Tweeting
  • Screenshots
  • SPAT testing
  • The Instructions/Help dialog box
  • The website list/contact info dialog box
SPAT testing was easy enough. I do, however, have to change the entire threading protocol behind the testing since I am no longer passing in a handle to a window, but rather a pointer to an instance of the user interface within a specific instance of a class (phew that's a lot).

That means instead of using the CRT's _beginthread() or the Windows API's CreateThread(), I am using the QThread class. This certainly has its benefits, such as the fact that it's the only method that would work with the current layout of my source files...

Not that that's a problem. Qt has made a very good impression on me as it seems the learning curve is quite manageable. Instead of being variable-based with strong typing, it's class- and pointer-based. It reminds me of Java quite a bit, and that's totally fine.

In fact, if anything, it looks like I'm going to end up writing less code! That's mainly because I don't have to put in several hundred lines just to create the GUI, as that's all done through the automagic QtCreator program, which is integrated with VS2010 (or at least, it is in the way in which I've installed stuff, anyway).

There is the small issue of character encoding...QString is meant to be cross-platform, so it's something like utf-16, which is neither here nor there in terms of wide-character Unicode or multi-byte utf-8. That means it has built-in functions to convert it to, say, a byte array whose data can be reinterpreted as a const char*, which then needs converted to a wide-character string...blah, I'm gonna write a helper function for that!

The screenshot function works perfectly, as I mentioned earlier. It was actually considerably more straightforward than the Windows API's equivalent(s) - that is, I didn't have to use any ATL or MFC classes or even touch GDI+ (thank goodness). Trying to use GDI+ left a bad taste in my mouth last time, since even after following direct instructions on MSDN and other official documentation, it still didn't work/crashed.

But in any case, we're beyond that now. Here is a sample screenshot of a SPAT test in the "new" IsItPrime.

No, that giant LCD number has no code associated with it...yet. Working on it!

No comments:

Post a Comment