zeal icon indicating copy to clipboard operation
zeal copied to clipboard

Complete TODO : Show more user friendly labels

Open nishanthkarthik opened this issue 6 years ago • 11 comments

This PR completes the task at https://github.com/zealdocs/zeal/blob/3bdb8ee0fd5b9062cdcba1d38aad2e09d2757bdd/src/libs/ui/docsetsdialog.cpp#L521

nishanthkarthik avatar Oct 02 '18 16:10 nishanthkarthik

Linux build failed because QDateTime::toSecsSinceEpoch() was added in Qt 5.8. I'll bump the requirement for 0.7.x.

trollixx avatar Oct 03 '18 02:10 trollixx

I'll try replacing it with a backwards compatible method later today

nishanthkarthik avatar Oct 03 '18 03:10 nishanthkarthik

No need, the plan is to switch to newer Qt in 0.7 anyway.

trollixx avatar Oct 03 '18 03:10 trollixx

@trollixx Done (I also fixed some clang tidy warnings). Please let me know if there's anything else :)

nishanthkarthik avatar Oct 15 '18 13:10 nishanthkarthik

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

trollixx avatar Oct 15 '18 13:10 trollixx

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.

nishanthkarthik avatar Oct 15 '18 13:10 nishanthkarthik

I see rightfully LGTM complains about always true conditions. Maybe rewrite the whole thing as a loop?

trollixx avatar Oct 16 '18 04:10 trollixx

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...

trollixx avatar Oct 20 '18 02:10 trollixx

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.

nishanthkarthik avatar Oct 24 '18 12:10 nishanthkarthik

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.

trollixx avatar Oct 27 '18 17:10 trollixx

Sure, let me update this PR with chrono

nishanthkarthik avatar Oct 27 '18 18:10 nishanthkarthik