kostoskistefan / hoverclock-qt

A simple floating clock for Linux
GNU General Public License v3.0
21 stars 3 forks source link

Side by Side and Shadow #23

Open xSeekTruthx opened 1 year ago

xSeekTruthx commented 1 year ago

Love this clock, Mint mate 21 has been a pain configuring. I miss unity.

Option to display time and date side by side with a switch for which comes first.

A shadow option may be helpful as well.

Thank you.

kostoskistefan commented 1 year ago

Hey there! Thanks for opening an issue. I'm glad you found the clock useful.

I'm not exactly sure what you mean by "shadow options". Could you elaborate? Is it just an option that would add a drop shadow to the time/date text, or something else entirely?

As far as the side-by-side option goes, it is very much doable, but currently I'm researching and working on a complete rewrite of hoverclock, which doesn't use QT. I think it is a huge and heavy framework for creating a simple clock, plus I'm not particularly happy with the code in this version and I think it can be optimized.

I'll definitelly consider the side-by-side option for the new version of hoverclock.

xSeekTruthx commented 1 year ago

Very cool. Thanks for the reply. Yes, just a drop shadow option that allows it to be more visible over any type of background.

...just out of curiosity, is there a single file in-which I could edit the layout code manually to test side by side?

Thanks again!

kostoskistefan commented 1 year ago

When I first started developing hoverclock, I thought a stroke/outline might be better suited for enhancing the visibility over any type of background, but since then, I did try out (using GTK) to replace it with a shadow. Personally, I think it looks much better with a shadow, so I might even deprecate the current stroke feature and replace it with a shadow option. Thanks for the incentive!

You can most definitelly manually test the side by side functionality. You need to change 2 functions in a single file.

  1. Change the paintEvent function (hoverclock.cpp - Line 308). The painting of the time/date text happen on line 334 and 345.
  2. Change the resizeWindow function (hoverclock.cpp - Line 123). This function calculates the width and height of the window in which the clock resides. Since you need a side-by-side clock, you can set the window height to be equal to whichever font size is larger (either the time font or the date font, plus the "PAINT_OFFSET * 2" to add some padding if you want). From there, you need to recalculate the width of the window to fit both the time and date strings and that should be it.

It should be pretty simple to make the changes to fit your needs. Feel free to ask me for help if you get stuck!

xSeekTruthx commented 1 year ago

Thank you sir. You are a gentleman and a scholar. Cheers!

I'll paste a picture when I get back to my Mate system.

xSeekTruthx commented 1 year ago

When I first started developing hoverclock, I thought a stroke/outline might be better suited for enhancing the visibility over any type of background, but since then, I did try out (using GTK) to replace it with a shadow. Personally, I think it looks much better with a shadow, so I might even deprecate the current stroke feature and replace it with a shadow option. Thanks for the incentive!

You can most definitelly manually test the side by side functionality. You need to change 2 functions in a single file.

  1. Change the paintEvent function (hoverclock.cpp - Line 308). The painting of the time/date text happen on line 334 and 345.
  2. Change the resizeWindow function (hoverclock.cpp - Line 123). This function calculates the width and height of the window in which the clock resides. Since you need a side-by-side clock, you can set the window height to be equal to whichever font size is larger (either the time font or the date font, plus the "PAINT_OFFSET * 2" to add some padding if you want). From there, you need to recalculate the width of the window to fit both the time and date strings and that should be it.

It should be pretty simple to make the changes to fit your needs. Feel free to ask me for help if you get stuck!

For some reason I thought there might have been a single file to edit. But this requires compiling if I'm not mistaken? Recently tried on another project, and pc just didn't want to cooperate. I'll keep following. Appreciate the info though.

kostoskistefan commented 1 year ago

For some reason I thought there might have been a single file to edit. But this requires compiling if I'm not mistaken? Recently tried on another project, and pc just didn't want to cooperate. I'll keep following. Appreciate the info though.

Yes, that's correct! You will need to recompile the application to apply the changes you made in the code. You can follow the steps provided in the Building and deploying section of the README if you want to use docker (which is recommended) and not worry about build dependencies. Otherwise, if you have qmake and qt5 installed, you can use cd src/ && qmake hoverclock.pro and cd src/ && make to compile the project.

I'm still working on the completely new version of hoverclock, which is much lighter than this one, since it's written entirely in XCB, Cairo and Pango. When I finish with that, I'll update this repository and this issue.

xSeekTruthx commented 1 year ago

Appreciate the quick feedback... yes it was issues with q/qt. Cool to hear about your new version. Many thanks. Moving right along with my mint config.