zeal
zeal copied to clipboard
Complete TODO : Show more user friendly labels
This PR completes the task at https://github.com/zealdocs/zeal/blob/3bdb8ee0fd5b9062cdcba1d38aad2e09d2757bdd/src/libs/ui/docsetsdialog.cpp#L521
Linux build failed because QDateTime::toSecsSinceEpoch()
was added in Qt 5.8. I'll bump the requirement for 0.7.x.
I'll try replacing it with a backwards compatible method later today
No need, the plan is to switch to newer Qt in 0.7 anyway.
@trollixx Done (I also fixed some clang tidy warnings). Please let me know if there's anything else :)
This pull request introduces 3 alerts when merging 7d4e43c198cf01b30bde9e02c8c99fea4b82d11b into d9bb3c590120d06dd506afe3dd3a531063bf72b5 - view on LGTM.com
new alerts:
- 3 for Comparison result is always the same
Comment posted by LGTM.com
Hey, on the three LGTM warnings of comparing with known value at compile time, how do I transform this snippet to a compile time branch?
const int X = 3;
int a = 0;
if (m && ++a < X)
f();
if (n && ++a<X)
g();
Here, the increment occurs only if m
or n
is true
. If not, this has to go to the next branch until a = X
. I am not sure how to optimize this out in compile time as we have no idea if first condition is true or not until runtime.
I think this is a false alert since we depend on the boolean expression short-circuiting to increment the counter.
I see rightfully LGTM complains about always true conditions. Maybe rewrite the whole thing as a loop?
I am still thinking on how to implement this in a cleaner way. The current proposal is a bit too heavy for the task it accomplishes. Perhaps, worth checking if we can use std::chrono
for the duration manipulations...
Hey @trollixx
std::chrono::duration
looks like a viable alternative on the computation part where we split seconds to multiple duration units. It doesn't look like there is a way in this lib to print it in human readable format.
If you tell me which part of my snippet seems heavy, I can try replacing the same with chrono
equivalent.
Right, we still need to print generate the text ourselves, but I think std::chrono
should be used for manipulating the duration. That should reduce the amount of code required as well.
Sure, let me update this PR with chrono