Sometimes they come back: Danbooru Client ported to KF5 and C++
Some of you may remember a semi-complex application I wrote back in the days, namely Danbooru Client. Written in PyKDE4, it provided a semi-decent interface to Danbooru-style boards. It mostly worked and received little maintenance (also because I didn’t have that much time for maintenance).
In the mean time, I started learning some C++. No, it’s not that I don’t like Python (in fact I do, I use it a lot in my day job), but I wanted to gain at least some basic skills to be able to contribute directly to KDE software.
And so a port of Danbooru Client to C++ began. I took the opportunity also to learn some model/view programming (still baffling at times, but I’m getting ebtter) and then I even tried to implement a custom thumbnail view for posts (I managed more or less, with a lot of blood and tears).
Then the KDE Frameworks 5 and Qt 5 arrived on the scene…
Enter KDE Frameworks 5
I thought, “why not port it to KF5? It’s not like I’m making much progress anyway…”. Thanks to Laurent’s handy scripts, porting was more or less easy. When it came to look at the thumbnail view, I got goose bumps: I never liked the code that much….
It was in that occasion that I discovered QML for desktop applications. It has still a lot of limitations compared to QWidgets, but for my purposes it fit the bill pretty much. In about 3 hours’ worth of work I was able to get a basic thumbnail view working, interfacing with my C++ model.
Fast forward to today. The application has almost reached an alpha state and it more or less works. Without further ado, a screenshot!
What works, and what doesn’t?
The basic functionality is there:
-
Listing, viewing, and saving posts;
-
Listing and downloading pools;
-
Tag blacklists;
-
Password saving with KWallet;
-
Searching by tags.
In addition, Danbooru Client has gained ”infinite scrolling”: no need to open multiple tabs! Scroll to the bottom and it’ll load automatically the next batch of posts.
There is also stuff that is missing and / or broken:
-
Batch downloads (not sure how to manage this one with QML…)
-
Tag display (only a matter of time)
-
Loading consecutive batches doesn’t work if they don’t fill up the window
-
Tagging (I need to see if the Baloo API is suited for this)
How do I try this out?
In my opinion it’s not even alpha code, but if you insist…. ;)
You will need KDE Frameworks 5.7 minimum (because I needed to get a couple of features in for KDeclarative to make this work) and Qt 5.4(I didn’t test with earlier versions) plus the latest Extra-CMake-Modules.
You can then clone the code from:
https://git.dennogumi.org/kde/danbooru-client.git
(sorry, I don’t feel comfortable in hosting my code on GitHub - although if you want to mirror it there, feel free)
After cloning, do the CMake dance:
mkdir build
cd build
# Replace this with a custom prefix if you don't want to install system-wided
cmake -DCMAKE_INSTALL_PREFIX=$(qtpaths --install-prefix)
make
make install # as root or through "sudo"
For those who want to keep dependencies at minimum, here are the frameworks Danbooru Client depends on:
-
KIconThemes
-
KCoreAddons
-
KGuiAddons
-
KTextWidgets
-
KXmlGui
-
KConfigWidgets
-
KIO (I can’t live without this!)
-
KWallet
-
KDeclarative (needed for the QML view)
-
KDELibs4Support (I plan to remove this soon)
I’ve found a bug! What do I do?
Nothing. ;) I told you it was pre-alpha code, didn’t I? More seriously, it’s too early to even report bugs. Check back in a few weeks, and see if it’s fixed.
Luca Beltrame KDE · LINUX
C++ danbooru client KDE KF5