HaikuArchives / Calendar

:calendar: A native Calendar application for Haiku.
MIT License
29 stars 20 forks source link

Add Agenda View #47

Closed BachToTheFuture closed 5 years ago

BachToTheFuture commented 6 years ago

Fixes #47 New features + changes:

BachToTheFuture commented 6 years ago

@pulkomandy @mmuman Could you review this GCI task?

owenca commented 6 years ago

I just found a bug. See below. See if you can track it down.

negative

BachToTheFuture commented 6 years ago

@owenca Negative time... interesting ๐Ÿ˜ฎ Maybe we're traveling backwards in time?

BachToTheFuture commented 6 years ago

@owenca Hmm. What were the starting and ending times for Sleep?

owenca commented 6 years ago

@bach5000 Starting: 23:00, Ending: 8:00 next day

BachToTheFuture commented 6 years ago

@owenca Hmm I have no problems. Shows Starts in 10hr, 2 min, 56 sec. Strange.

BachToTheFuture commented 6 years ago

screenshot2

owenca commented 6 years ago

With your new changes, it has the same bug.

one two

By the way, this is in VirtualBox running 32-bit Haiku.

BachToTheFuture commented 6 years ago

@owenca Might have to do with arch differences... I'm running on x64. Maybe that's why. I'll test it on 32 bit and see if I can recreate the bug.

owenca commented 6 years ago

I suspected that you were running on 64-bit and that it was an integer overflow bug. :)

BachToTheFuture commented 6 years ago

@owenca Perhaps :)

BachToTheFuture commented 6 years ago

@owenca I think I fixed it. I wasn't suppose to use the minus operator.

scottmc commented 5 years ago

Is this ready for merge or is there still a pending fix or two needed?

owenca commented 5 years ago

@bach5000 Can you address the coding style issue on line 221? See my comments above.

owenca commented 5 years ago

@bach5000 Thanks! @pulkomandy @mmuman Can you have a look at the PR before it's merged?

BachToTheFuture commented 5 years ago

@pulkomandy Flipped the event name and time position. This is what it looks like now:

screenshot2

I'm still confused about BString.ReplaceAll, though. Do you want me to use it to replace %remaining in Now, %remaining left with the time?

owenca commented 5 years ago

@bach5000 Do something like this:

BString timeLeft("Now, %remaining% left");
timeLeft.ReplaceAll("%remaining%", remaining);
timePeriod << timeLeft;

And similarly for other strings.

BachToTheFuture commented 5 years ago

@owenca That makes more sense now. Thanks for clarifying ๐Ÿ˜„

BachToTheFuture commented 5 years ago

@owenca @pulkomandy Patched the code according to the suggestions :)

BachToTheFuture commented 5 years ago

@pulkomandy @owenca @scottmc Done!

BachToTheFuture commented 5 years ago

@janus2 @pulkomandy Is there a function to get system color values? Currently all I could think of is simply put everything (event name and time) on B_LIGHTEN_1_TINT or set just the name's tint_color value to 0.5. This makes the font gray, and gray font is visible on both white and black backgrounds... but there's a problem when the background is gray :(

scottmc commented 5 years ago

Is this ready for merge?

janus2 commented 5 years ago

@bach5000 you can check the sum of the components like https://github.com/haiku/haiku/blob/abb59d7351c7ddb50c63c40430a82d94fa61917a/src/preferences/appearance/ColorWhichItem.cpp#L69

or you can use the function Brightness() present in the color struct

pulkomandy commented 5 years ago

You get the system colors using ui_color (or even better, use SetViewUIColor functions so it live updates when changed in preferences).

But here you need ui_color and then decide if it's "dark" or "light" to derive another color from it.

owenca commented 5 years ago

@bach5000 You can reference the code here to see what @pulkomandy is talking about.

janus2 commented 5 years ago

I think we should have a function like tint_color that keeps into account the luminance of the color. In the code there are different checks that can result in an inconsistent gui. This is more visible with replicants on the desktop, with the same background color some are white some black.

pulkomandy commented 5 years ago

In this specific case, maybe using the default color and an alpha of 50% or so would work, rather than tinting?

BachToTheFuture commented 5 years ago

@owenca I'm really curious... how are you finding all these perfect code snippets? Anyways, using @owenca's useful code snippet and @pulkomandy's alpha suggestion, perhaps I could do something like this?

rgb_color color;
color = ui_color(B_LIST_ITEM_TEXT_COLOR);
color.alpha = 0.5;
view->SetHighColor(color);
BachToTheFuture commented 5 years ago

@pulkomandy @owenca @janus2 Okay... seems like using alpha didn't work, so I decided to try something else. Were these what you guys wanted?

tint1 tint2

scottmc commented 5 years ago

You scheduled no time to sleep... Why are there the two black grey boxes next to November 2018 on the second image?

BachToTheFuture commented 5 years ago

@scottmc Those gray boxes are suppose to be navigation buttons for changing the month. I forgot to add the symbols on the buttons when I took the pictures.

janus2 commented 5 years ago

@bach5000 in my opinion for the event name you should use directly the B_LIST_ITEM_TEXT_COLOR/B_LIST_SELECTED_ITEM_TEXT_COLOR without any tint (in the screenshots "Sleep", "Testing", "Dinner"), and for the time interval ("12 AM - 12 AM") a lighter color if the B_LIST_ITEM_TEXT_COLOR/B_LIST_SELECTED_ITEM_TEXT_COLOR is dark and a darker color if is bright. A cut and paste of the snippets in previous comments should work.

BachToTheFuture commented 5 years ago

@janus2 So when event text (B_LIST_ITEM_TEXT_COLOR) is dark, then the time interval text should be lighter, and if event text is light, then the time interval should be lighter? Okay. I think I understand what you guys expected... I misunderstood in the beginning.

BachToTheFuture commented 5 years ago

@janus2 Is this what you expected?

janus2 commented 5 years ago

I cannot test the code now, but the logic looks correct to me.

owenca commented 5 years ago

@owenca I'm really curious... how are you finding all these perfect code snippets?

@bach5000 They are from my past commits. :) I learned from @humdingerb that you canโ€™t rely on the default color theme and just assume your design would work for every preference setting. That code snippet was the result of hours of digging and experimenting with all sorts of color combinations against various preference settings.

BachToTheFuture commented 5 years ago

@owenca Seems like you gained a lot of experience from GCI ๐Ÿ˜„ Thanks for helping, by the way :)

owenca commented 5 years ago

Just doing my job. This is what mentoring is about, right?

scottmc commented 5 years ago

This ready for merge now?