This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Debugging dolphin.

Tags: None
(comma "," separated)
yacwroy
Registered Member
Posts
16
Karma
0

Debugging dolphin.

Tue Jun 16, 2009 5:56 pm
I had a bit of trouble building dolphin from source (see the thread in this subforum), but I got to where I can run dolphin.

I'm trying to debug the GUI window for dolphin, so I can step through where it sorts filenames and displays icons.
I'm having a bit of trouble getting the correct process into the debugger (gdb). I'm new to debugging multiple-process applications.

I have loaded /kde/bin/dolphin from gdb and stepped through it, but I can't get the debugger to debug dolphin's GUI process.
On the fork() at:
/kdelibs/kdeui/kernel/kuniqueapplication.cpp:199:"int fork_result = fork();"
I have followed both the parent and child processes (using the gdb command "set follow-fork-mode child" or ".... parent").
Stepping over line 227:"::write(fd[1], &result, 1);" on the child process makes visible a Dolphin GUI window that is fully responsive. It is this GUI window's process that I'm actually trying to debug.
I'm guessing that the GUI is somehow event-based which could make things difficult.
Is this possible? with gdb?

I'm using gdb as my KDbg always crashes on:
/kdelibs/kdeui/kernel/kuniqueapplication.cpp:147:"bool forceNewProcess ..."

Thanks for all help.



As a side query:
How much would it likely cost to get some developer who knows precisely what they're doing to add simple things like: lexicographic sort order, smaller minimum icons (the two I'm currently after).
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: Debugging dolphin.

Wed Jun 17, 2009 6:43 am
You need to run Dolphin with the --no-fork parameter to prevent it forking itself.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
yacwroy
Registered Member
Posts
16
Karma
0

RE: Debugging dolphin.

Fri Jun 19, 2009 2:34 am
bcooksley wrote:You need to run Dolphin with the --no-fork parameter to prevent it forking itself.

Thanks.
Man, how did I miss that. I even looked for it in --help and it's right there.

Anyway, it's working (somewhat - I still have to find some of the Qt source files / packages for gdb to reference).

Will post an update once I make my alterations, if not before then :)
User avatar
GeneralZod
KDE Developer
Posts
77
Karma
1
OS

RE: Debugging dolphin.

Fri Jun 19, 2009 9:20 am
yacwroy wrote:As a side query:
How much would it likely cost to get some developer who knows precisely what they're doing to add simple things like: lexicographic sort order, smaller minimum icons (the two I'm currently after).


Sorting order is (I believe) handled in DolphinSortFilterProxyModel::subSortLessThan, which currently (as you can see) just delegates to the standard KDirSortFilterProxyModel.

As for minimum icon size: do you mean the minimum size of the icon as set by the slider? Maybe something to do with here, then.

If you need help with Dolphin code, you can send an e-mail to kfm-devel :)


ssj-gz.blogspot.com: KDE4Daily, Konqueror4 Restoration
yacwroy
Registered Member
Posts
16
Karma
0

Re: Debugging dolphin.

Mon Jul 27, 2009 11:40 am
Just thought I'd update this.

I had a few free hours and thought I'd finally fix these issues up for myself.

I made some hacks to get the functionality I wanted, to the files recommended here (thanks).
Unfortunately I didn't feel like learning how to add menu items for the sorting method, or how to change the slider into a more appropriate type to allow for 100s of allowed values. I don't really have that kind of time to burn.

For anyone else that wants this functionality, I'll provide my alterations.
Note, they're very crude.

1) For greater control and smaller minimum size icons:
kde/src/kdebase/apps/dolphin/src/zoomlevelinfo.cpp
Code: Select all
int ZoomLevelInfo::iconSizeForZoomLevel(int level) {
  return level + 1;
}

int ZoomLevelInfo::zoomLevelForIconSize(const QSize& size) {
  return size.height() - 1;
}

Replace the above functions with my versions.
Slider can now select any integer size between 1 and 255.

2) For lexicographic sort:
In kds/src/kdelibs/kfile/kdirsortfilterproxymodel
Add the function below.
Code: Select all
bool basicCompare(const QString &a, const QString &b)
{
    const QChar* currA = a.unicode(); // iterator over a
    const QChar* currB = b.unicode(); // iterator over b

    if (currA == currB) {
        return false;
    }

    while (!currA->isNull() && !currB->isNull()) {
        ushort uA = currA->unicode();
        ushort uB = currB->unicode();

        if (uA == QChar::ObjectReplacementCharacter) {
            return true;
        }

        if (uB == QChar::ObjectReplacementCharacter) {
            return false;
        }

        if (uA == QChar::ReplacementCharacter) {
            return true;
        }

        if (uB == QChar::ReplacementCharacter) {
            return false;
        }

        if(uA != uB) {
            return (uA < uB);
        }

        currA++;
        currB++;
    }

    return currA->isNull();
}


In: bool KDirSortFilterProxyModel::subSortLessThan(const QModelIndex& left, const QModelIndex& right) const
Replace case KDirModel::Name: { ... } with:
Code: Select all
case KDirModel::Name: {
   return basicCompare(leftFileItem.name(), rightFileItem.name());
        // <SPH>: return KStringHandler::naturalCompare(leftFileItem.name(), rightFileItem.name(), sortCaseSensitivity()) < 0;
    }


Any decent programmer should be able to write these functions themselves - I'm just posting them here to demonstrate that these are locations where modifications can give the desired result.


To any of the devs that read this, I would suggest that a reduction in the minimum icon scale would take virtually no time and cause no harm, but be useful to anyone like me who wants to fit more items on screen.

Modifying the selection behavior in a hack-free manner would be more difficult. My own opinion is that this would still be worth the effort as I found piles (at a guess, 20-ish) requests for this on nautilus, dolphin and elsewhere when just looking to see how it was done. Couple this with the fact that this functionality previously existed and has since been removed (albeit from KDE not dolphin), and it's a pretty good argument for adding it back in, IMHO.

You're doing a good job with Dolphin though, it's still the best one out IMO, and I recently checked all of em.

Oh yea, Kate-style unlimited splits would be cool, too :)



Anyway, thanks for all who helped out.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]