WorkTracker v1.2.3 Released (Now with Linux Support)

My little work-tracking tool has received some love recently and is now available in a more bug-free version. But not only that, I have made a foray into a foreign world and now support compilation on Linux and, to put the icing on the cake, even provide a deb package for Debian based distributions.

The latest version can be grabbed from GitHub.

But let’s start with the boring stuff, namely the list of bug fixes, improvements and new features. For bug fixes there are only two things to mention:

  • Newly entered task descriptions wouldn’t show up in the suggestions until the application was restarted.
  • The “Show Summary” feature has been improved. Sometimes the button was disabled for no apparent reason, but now this happens only on application startup when there’s no day to show a summary for or when choosing task descriptions. The summary can also be closed now.

That’s it. There are no new features in the application to speak of.

Under the hood, however, a lot has changed. I have updated the project structure to better reflect the internal hierarchy. That meant moving files around and adapting the project files and include paths. In the course of this undertaking, I also added project files for Visual Studio. I was using Microsoft’s compiler anyway, although with Qt Creator, but I prefer the MSVC debugging environment so this move made sense. For this to work you need either a full version of MSVC or the new Community Edition (which supports extensions, very much unlike the Express Editions) and the Qt Visual Studio AddIn (that installs itself as an extension to Visual Studio).

In addition to some updates to the model (once again) I tried to better separate the business logic and ui logic. Previously, the controllers basically handled everything, even opening dialogs. In hindsight some of my choices went too far and this release is the first to scale some of it back. For future versions this should make it easier to replace the current Qt-widget based user interface with one that is created with QtQuick.

Using QtQuick is probably the next step. I hope in doing so I get a few improvements for free. One is better and easier implementation for animations and the second more pressing issue is better support for high density displays. Using WorkTracker on my Surface Pro 3 looks a little bit ugly. It’s not broken and can be used without problems, but the proportions are wrong. From what I have read so far, QtQuick interfaces fare better in this regard than Qt-widget based ones.

Now to something new but not a feature: Linux support. First a screenshot to prove it.

As can be seen, the distribution of choice is Linux Mint. At the time of writing the latest version is 17.1 which ships with Qt 5.2 and GCC 4.8.2. As is the case with the Windows binaries, I only publish 64-bit versions. I’m in no position to host a PPA for this so it has to be installed manually.

Porting the application was very simple, thanks to the Qt framework. Since I don’t have any OS specific dependencies all I needed to do is to get the code compiled. GCC seems to be a little bit stricter when it comes to handling STL includes. It looks as if the Microsoft compiler automatically searches or includes STL headers where GCC does not. In one source file I needed to add #include which was not necessary before. Another problem surfaced when compiling a template helper method that fetched the first item from a container based on a predicate.

Here’s the original code with the invocation how it compiled with MSVC 2013.

template
inline typename Container::value_type
firstOrDefault(const Container& container,
               std::function func)
{
    for (const auto& item : container) {
        if (func(item)) {
            return item;
        }
    }
    return Container::value_type();
}

return firstOrDefault(times(), [](const WorkTime& time) {
return time.stop().isNull();
});

In order to get this to compile with GCC a few changes had to be made.

template
inline typename Container::value_type
firstOrDefault(const Container& container,
               std::function func)
{
    for (const auto& item : container) {
        if (func(item)) {
            return item;
        }
    }
    return typename Container::value_type();
}

return firstOrDefault<QList>(times(), [](const WorkTime& time) {
return time.stop().isNull();
});

Notice the additional typename when returning a default object from firstOrDefault() and that the container type has to be explicitly specified in the call to the function.

I’m no expert on templates so I can’t really tell who is right in this case. My initial idea was that the Microsoft compiler in its most recent patch state sports a more complete type deduction system than the rather old GCC. Both have been released only a few days apart at the end of 2013 (GCCMSVC) but I am current when it comes to updates of Visual Studio. It could also be that MSVC ignores a few rules that could explain the behavior. I don’t know. In any case, the latter solution works on both compilers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s