![]() Registered Member ![]()
|
I'm currently trying to (among other things) writing a "Modular* Development Environment" for KDE4
I currently have a very odd problem though. This is the file listing source in my MDE:
Problem is though is that this code (trimed a tad, all under the GPL) for reading through the descriptins of the files is getting it in the wrong order.
Could someone please explain what is happening? IF you have any critiques that would be good also but remember that this is _very_ pre-alpha code. *Think IDE-like use once your project is configured..
RyanMcCoskrie, proud to be a member of KDE forums since 2008-Dec.
|
![]() Administrator ![]()
|
Assuming it is just the read order it is having problems with, then I would recommend adding a new Entry that controls the order ( tied to an internal index )
If it is reading the URL from mwin.cpp then the name from file.h then it is probably related to the use of arrays. ( It would be best to use QList or QMap which handle things like this very well )
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Okay I have reworked the code, procrastinated, worked on other projects, come back, gave everyone some air and looked into what is going on.
There is something deeply wrong at work here but I can't put my finger on the underlying issue. Essentially only the first part of this config file can be read.
I put together a script that reads through it to try to isolate the problem. Once again I'm leaving out non-essentials.
and here is the output
Can somebody see why the first file description is working?
RyanMcCoskrie, proud to be a member of KDE forums since 2008-Dec.
|
![]() Administrator ![]()
|
Unfortunately I do not know why it is failing....
Try this C++ code though:
Last edited by bcooksley on Sun Apr 19, 2009 8:14 am, edited 1 time in total.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() KDE Developer ![]()
|
Question: why does the order matter in which you load the file metadata?
Remarks: - when reading a list, use the respective readEntry method, way better than reading a string and splitting yourself - when doing foreach on a QStringList which you don't want to alter, use "const QString&" as the type for the variable, otherwise you'll needlessly create a copy of the list (it detaches the shared private) - think about using KUrl as the type for the URL (roughly based on the original code)
Readability-wise MFile::setUrl() (and friends) might be better, i.e. more consistent with Qt's and KDE's use of lowercase methods for getters Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]