Tuesday, 23 June 2015

GSoC 2015 Week #4 with Amarok

So the fourth week is over and the mid term evaluations are upon us and I have to say, I didn't even realize how quickly the last four weeks have gone by :)

I had to take the third week off but it didn't affect my project much as I had started working before 25 May.
So some of the major changes to the code-base that I have made over the last few days are as follows:
  • I added KF5::KCMUtils and KF5NewStuff components.
  • Most of the KDialog code has been moved to QDialog which included changes like replacement of setButtons with QDialogButtonBox. Although KDialog is deprecated and this conversion seems unnecessary at this stage of porting, I encountered dependencies on classes in KF5 that now inherits from QDialog instead of KDialog. Due to this some KDialog code in Amarok had to be ported now rather than later.
  • I made a few classes in Amarok to inherit from KPageDialog instead of KDialog to let us use the buttonBox() function in the former which is pretty useful.
  • I removed the definition of slotButtonClicked() slot in deviceconfiguredialog.cpp as there were not any signals connecting to it. The rest of the slotButtonClicked() calls were replaced with QDialog::accept() or QDialog::reject().
  • I discovered a function QDir::toNativeSeparators which is really useful. On moving from KUrl to QUrl, I had to replace the calls to KUrl::addPath(const QString& txt) with u.setPath(u.path() + '/' + txt) [Copied straight from the docs ;)]. Now you can see that we have a '/' in setPath which may or may not be the native separator of the platform. So here the static function QDir::toNativeSeparators comes into use and it will make the separators appropriate (if needed) for the underlying operating system.

Cheers !!!

Monday, 8 June 2015

GSoC 2015 Week #2 with Amarok

The second week of GSoC coding period has come to an end.

In case you haven't read my previous blog posts then I should start by saying that I am working on porting Amarok to Qt5/KF5 as part of the GSoC 2015 program under Mark Kretschmann (markey) and Myriam Schweingruber (mamarok).

So this week some of the changes that I made are as follows:
  • Changed KIcon to QIcon. If anyone is using the porting script in kde-dev-scripts for this, then be careful that the script doesn't affect the return types of the functions which previously returned an instance of KIcon. This means that if the return type of a function is KIcon then you have to change it to QIcon by yourself. Not a major inconvenience, if you ask me.
  • Added include directory of phonon (I added PHONON_INCLUDES instead of PHONON_INCLUDE_DIR) to the cmake path in which header files are searched. Adding this wasn't important before but now with Phonon4Qt5 it is important. More information can be found here.
  • I will be moving amarok to KF5::Plasma after it has been ported to use the other KF5 components because I think that porting the rest of the code demands more attention.
  • I have marked some code with "#TODO KF5" so that the work there wont be forgotten and especially to mark temporary solutions.

Though KDialog is in KDELibs4Support but the classes that previously inherited from this have changed their base class. As the usage of functions(of KDialog) from these inherited classes cause errors now so I am currently porting from KDialog to QDialog. I have to review (many)changes made by the porting script for which I have to understand their API first. So I believe this is going to take some time.

I will be pushing the commits that concern the above changes soon.


P.S Happy Birthday Mamarok!

Monday, 1 June 2015

GSoC 2015 Week #1 with Amarok

Well it has been a week since the GSoC coding period started.
I have pushed commits to the personal repository here. A KDE community page was created by Myriam Schweingruber which can be found here and it consists of the details about the porting of Amarok. I will also be making changes to that page over time.

The major changes that I introduced in the Amarok code-base till now are as follows:

  • I have changed the CMake files and I have added ECM (with a minimum version of 1.7.0) in it. The KF5 libraries have been remodelled into a set of independent modules enabling the developers to use only the specific parts which they need and avoid pulling unwanted dependencies. For this reason, for now I have added a few key components of KF5 and Qt5 for the cmake to find. I will be adding more components as and when required. I have added the list of the new dependencies here.
  • A major development included a change in MySQLAmarok.cmake module. As feature_summary has been used with FATAL_ON_MISSING_REQUIRED_PACKAGES, MySQLAmarok was turning out to be missing as MYSQLAMAROK_FOUND wasn't yet defined. So I have defined MYSQLAMAROK_FOUND as TRUE when both mysql and its embedded libraries have been found. More details on this have been given in the commit and in the cmake module itself.
  • The porting scripts in kde-dev-scripts have been a lot of help to me (kudos to Laurent Montel, Kevin Funk, David Faure and all other contributors). I have used them and they really eased the conversion of KUrl to QUrl and in many many more changes (like the next one).
  • The icons have been renamed according to the new pattern and the ecm_install_icons calls have been changed similarly which previously created a lot of warnings.
    CMake version was increased to 2.8.12 as it's the minimum required to use FindKF5.cmake.
  • To port to CMAKE_AUTOMOC, the moc include files were no longer needed(except a few places) and they have been removed as they too created a lot of warnings.
  • QT_NO_URL_CAST_FROM_STRING has been added to make the changes from QUrl from QString explicit.
I will be adding the definitions to disable depreciation warnings in upcoming commits.

One of the major problems that I have faced this week was in porting to KF5::ThreadWeaver. The documentation of the new API was surprisingly lacking in very important details. I faced problems in usage of the QObjectDecorator class where some signals have been moved into. I have thought of two solutions for this which lets the files compile and which I am planning to test in future. For this I spent some time on learning about the fine details of the working of signals and slots systems.

It has been a very nice first week and I have learnt the details of quite a few things like the above said signals and slots system and I also spent some time to learn about the cmake's AUTOMOC system too.

Cheers !!!