So, I've been dabbling with a little Qt programming.
I wanted to develop a program that would let me do an easy search & replace for objects in ArmA2 map files. Naturally, while I could potentially write a CLI program, it would be much easier for me (& others who might use it) to have a GUI interface. As I thought writing a windows app would be in the too hard basket, I decided to try out the Qt GUI toolkit.
Not only that, but I installed the NetBeans IDE to do the programming in. The old DevCPP that I've been using for years is still very good (and I've written quite a few CLI C/C++ programs with it), but NetBeans promised to make Qt programming a lot easier.
Shame it didn't make installing all the required software & packages easier... I was rather disappointed, upon downloading the tools I needed, to see that I was promised an almost single-click installation experience - except on Windows.
This is a problem, because ArmA2 is a Windows-only game, so naturally I wanted to do the development in Windows. Not that it really matters all that much where I edit the map files from, but being able to fire up some of the official Windows-only editing tools to check stuff is pretty important.
Needless to say, I did eventually get everything working. I even got the proverbial "Hello World" application to compile & run.
Then I upgraded Qt from version 4.5 to 4.6, and broke everything again. :-(
Took me several hours to fix that problem, which probably says more about my lack of computing knowledge than anything else!
So, I started to code up my app. Quickly figured out how to use the Qt Creator to lay out the application window, with various buttons, checkboxes, and the like. Even figured out how to assign signals & slots to those things that needed them.
I had a moment of feeling pretty chuffed when I got the "exit" button to close the application. :-D
Now I've got the file dialogs working. You can select the input file, and the output file name. It'll even pay attention to those little "read only" & "allow overwrite" checkboxes I put in there.
Then it was time to do the hard part - actually read in the map file.
Well, with the Qt Reference Guide open on the second monitor, it wasn't all that hard. Except for the bit where I couldn't get it to read a float - it kept giving me doubles... turns out that was a compound problem. I was using the reference docs for Qt 4.5, not 4.6, and there's a change between those versions that means a QDataStream defaults to reading double-precision floats, not single.
Fixed that, and had another moment of feeling rather chuffed when I read in the file header (containing 7 or 8 different variables of five different types), wrote it out again to the output file, and compared the two in a hex-editor and found they were byte-for-byte identical for the header. :-)
As I said to the missus earlier - that's 72 bytes down, only 90 million to go! :-D