KPhotoAlbum on Windows?

Johannes Zarl-Zierl johannes at zarl-zierl.at
Sun Dec 15 23:30:10 GMT 2024


Hi Teemu,

Glad to hear that you are coming along quite far.

Am Sonntag, 15. Dezember 2024, 18:32:12 CET schrieb Teemu:
> 1) DB/FastDir.cpp
> 
> Include <dirent.h> not available on Windows.
> Managed to compile this by adding a replacement include from here:
> https://github.com/tronkko/dirent

Quite possibly this could be solved by using MinGW on Windows. AFAIK MinGW 
also support all of the other POSIX headers that you encountered.


> 2) DB/ImageScout.cpp
> 
> Include <unistd.h> not available on Windows.
> Commented out the include, compiled without errors. Not used?

unistd.h provides the read() and close() functions which are used in this file. 
I don't know why this worked for you, maybe there's some support for these 
functions on Windows? The official Windows API for this should be ReadFile and 
CloseHandle, if I'm correct.

> 3) DB/OptimizedFileList.cpp
> 
> includes <unistd.h>,<dirent.h> again.
> Commented out <uninstd.h>, used aforementioned dirent.h code.

As above, probably solved by using MinGW.


> 4) HTMLGenerator/Generator.cpp
> 
> Include <sys/wait.h> not available on Windows.
> Commented out, compiled fine, wasn't really used?

Yes, fixed now.

> 5) Utilities/FastJpeg.cpp
> 
> include <unistd.h> not available on Windows.
> Changed this to <io.h>, compiles. Maybe <stdio.h> would work as well?

Same as with ImageScout; read() and close() is used.

> 6) Viewer/ViewerWidget.cpp
> 
> Couldn't get the <QDBusConnection> and <QDBusMessage> working, it
> wouldn't find includes.
> But, after I checked what QDBus was used for in inhibitScreenSaver(), I
> commented that code out and removed those includes.
> I'm not sure if there is a DBus compatible implementation, and
> "org.freedesktop.ScreenSaver" probably isn't listening on Windows in any
> case...

I noticed that QDbus is not explicitly linked against in CMakeLists.txt. I've 
fixed that now, which should mean that the headers are found on Windows also.


> 7) lib/kpabase/FileUtil.cpp
> 
> <uninstd.h> not available.
> Also linking Works a bit differently in Windows - maybe utilize Qt's
> built-in linking function? Didn't investigate further, how these are
> used in export.cpp
> For now, commented out include and the hardlink/symlink functions
> contents to get it to compile.

This definitely needs some proper looking into, but at first glance it seems one 
can safely disable these operations on Windows in the UI.

> 8) CMakeLists.txt
> 
> There was an issue with the linking process, as .lib files were not
> created at all. Solved by adding "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
> ON)" to CMakeLists.txt.
> Not sure if this is the best way to handle this issue, but at least
> Digikam uses this as well.

If it works for Digikam, it's probably ok for us, too. It's not like we ship 
any library for outside consumers.

> 9) Kphotoalbum blueprint at
> https://github.com/KDE/craft-blueprints-kde/tree/master/extragear/kphotoalbu
> m
> 
> Needs some finetuning - need to remove kipi-plugins, adding the
> mandatory dependencies from Qt-side and exiv2

I'm sure they are open for a merge request. I'm not sure if they take pull 
requests on Github, but here's the same repository on KDE Gitlab:
https://invent.kde.org/packaging/craft-blueprints-kde

> 10) lib/kpathumbnails/CMakelists.txt
> 
> Commented the testcase adding out, as the linking failed due to
> unresolved external symbol. (See error below related to ThumbnailCache)

Maybe that's solved now in git master by the commit I mentioned in point 6?

https://invent.kde.org/graphics/kphotoalbum/-/commit/
fbac159dd8a39cfabf2827362fe968a61ef7999f

> 11) After all that trial and error, I'm at the last step, linking
> executable bin\kphotoalbum.exe
> 
> With, this, I have these linking errors still, trying to solve but not
> having much success:
[...] 
> I have narrowed down that SettingsData-related error.
> It only appears when the connect-function is used to with those values
> declared in Q_SIGNALS in SettingsData.h.
> E.g. in GridResizeSlider.cpp, having these rows causes the error:
> 
> 	connect(settings, 
&Settings::SettingsData::actualThumbnailSizeChanged,
> this, &GridResizeSlider::setValue);
> 	connect(settings, &Settings::SettingsData::thumbnailSizeChanged, 
this,
> &GridResizeSlider::setMaximum);
> 
> And if I comment those out, then the error disappears. I haven't found
> any solution for this.
> Any pointers?

My immediate hope would be for this to be fixed by the explicit linking of Qt 
libraries mentioned above.
Other than that, is this only related to the viewSortTypeChanged() and 
matchTypeChanged() signals? If so, this may be related to them using custom 
enum types. Maybe there's some additional work needed to register them on 
Windows with the QMetaObject system.

> As a summary - after looking at Digikam's CMakeLists.txt, I see that
> there are a lot of directives related to Win/Linux differences.
> As I have very little experience in development on Windows, I doubt that
> I would be able to support an official release, even if I would get "my
> copy" working. But an interesting exercise this has been, nonetheless.

Ok, then we don't get official platform support out of this. No worries. If 
Windows support doesn't impede development for the other platforms, I'm ok 
with having experimental Windows support for you and a few other brave souls 
who dare try ;-)

Cheers,
  Johannes





More information about the KPhotoAlbum mailing list