Logged-In As
ACCOUNT
Not Logged In
Hedgewars: Embed system info Copyleft Games Group
Status: Closed Time to complete: 24 hrs Mentors: koda, Andrey Korotaev, Xeli, Sheepy Tags: google, qt, c++, hedgewars

hedgewars
c++
qt
google

Remember to join our IRC channel when working on this task! We are on #hedgewars at freenode.net. If you are new to IRC, read this tutorial from a past GCI participant.

Your task

Our feedback mechanism is rather crude and doesn't show anything besides an empty box. Fill it with a few system parameters, like Operating System, processor type, ram etc, so that the users doesn't have to type it in. Use only crossplatform API (such as those provided by Qt - QtGlobal and QSysInfo) because this needs to work everywhere.

Fun fact, our feedback page was designed by a GCI student in 2011.

Deliverable

A working patch, that applies cleanly to our source tree. This patch should be in the form of a pull from clone, hg export or unified diff format (in order of preference) implementing the functionality required.

Uploaded Work
File name/URL File size Date submitted
cset.diff 4.6 KB December 03 2012 17:40 UTC
cset2.diff 6.3 KB December 04 2012 17:38 UTC
cset3.diff 1.1 KB December 04 2012 17:42 UTC
cset4.diff 6.7 KB December 05 2012 20:41 UTC
Comments
Martin Bede on December 2 2012 18:00 UTC Task Claimed

I would like to work on this task.

koda on December 2 2012 23:36 UTC Task Assigned

This task has been assigned to Martin Bede. You have 24 hours to complete this task, good luck!

Martin Bede on December 3 2012 17:40 UTC Ready for review

The work on this task is ready to be reviewed.

Martin Bede on December 3 2012 17:44 UTC Platform specific code

Please note that I can't test Windows and Mac OS specific codes.

Melange on December 3 2012 23:36 UTC No more Work can be submitted

Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.

koda on December 3 2012 23:41 UTC Deadline extended

The deadline of the task has been extended with 1 days and 0 hours.

koda on December 3 2012 23:41 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

koda on December 3 2012 23:43 UTC needs more work

You exactly grasped the concept I had in mind.


I tested your code on OSX and fixed the problematic parts: http://dl.dropbox.com/u/24468/osinfo_mac.txt please use it for your future submissions.


The only information missing is the the architecture type, eg. the name and model of the processor. Could you please add that?

koda on December 4 2012 10:14 UTC needs more work

Also you need to add this macro for windows before including <windows.h>


    #define WINVER 0x0500


Please add the following includes for OSX


     #include <sys/types.h>
#include <sys/sysctl.h>

Finally please move the system headers from pagefeedback.h to pagefeedback.cpp

koda on December 4 2012 10:14 UTC Deadline extended

The deadline of the task has been extended with 0 days and 12 hours.

Martin Bede on December 4 2012 17:42 UTC Ready for review

The work on this task is ready to be reviewed.

Martin Bede on December 4 2012 17:48 UTC Updated work summary

I've added the fixes you uploaded here and moved the headers.


I couldn't find a perfect method to determine how many bits a processor has at runtime, but the current one should work fine and it can be determined from the processor brand string.

Martin Bede on December 4 2012 17:50 UTC Two changesets

I forgot to add a file the first time so there are two changesets. (cset2.diff, cset3.diff) I hope it's not a problem.

Melange on December 5 2012 16:40 UTC No more Work can be submitted

Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.

koda on December 5 2012 17:20 UTC Deadline extended

The deadline of the task has been extended with 1 days and 0 hours.

koda on December 5 2012 17:43 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

koda on December 5 2012 17:43 UTC needs more work

 


Hi, there is a problem with the windows section now.


 


If you can, please don't include external .h in the sources; secondly the cpuid that you used is Windows-API only - we need to be compatible with gcc first of all!


 


Can you revise your cpuid call with  the correct _get_cpuid(level, a, b, c, d) or mingw equivalent code?

Martin Bede on December 5 2012 18:30 UTC Can I just use asm?

Is it okay to replace __cpuid with the asm in the CPUID.h file? I don't see why it wouldn't work on Windows. It would also make things much simpler so there would be no need for a separate file.

Martin Bede on December 5 2012 20:45 UTC Removed CPUID.h

I removed CPUID.h, and inline asm is used to get the processor string, even on Windows.

Martin Bede on December 5 2012 20:45 UTC Ready for review

The work on this task is ready to be reviewed.

koda on December 5 2012 22:49 UTC Task Closed

Congratulations, this task has been completed successfully.

Sheepy on December 5 2012 23:10 UTC Can't compile.

compiling issues



  • pagefeedback.cpp:160:5: error: ‘CPUID’ was not declared in this scope

  • pagefeedback.cpp:162:5: error: ‘uint32_t’ was not declared in this scope


first one is an artifact from earlier versions I guess. second one I could fix by including


misc



  • you only display the mem sizes in MB on mac osx, in other OS it's in Bytes

  • minor: you conclude that X11 -> Linux. hedgewars also runs on BSD afaik though.


cosmetics
you have a lot of trailing whitespaces on many lines, you can use


 sed -i 's/  *$//' filename.cpp


to accomplish that. (backup the file first, just in case)

Sheepy on December 5 2012 23:14 UTC oops I was too slow

oh well. congrats on finishing the task :)
thank you for your work!

koda on December 5 2012 23:47 UTC patch

Don't worry I took care of (most?) problems, and here is your commit in our codebase: http://code.google.com/p/hedgewars/source/detail?r=ebaec8186e4aea30e7d63d30e7afa037b2e83bf4&name=default  


Hope to see you soon on IRC!

Martin Bede on December 6 2012 16:34 UTC Thanks

Thanks for fixing my work. Different time-zones make communication a lot harder. :)