maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   N900 clock replacement [continued] (https://talk.maemo.org/showthread.php?t=81582)

artpra 2012-02-01 17:31

Re: N900 clock replacement [continued]
 
I`m stress testing (as before) "edition" with seconds and with script wrapper. It`s not the newest version (from tommorow) but one build older.
I don`t know how and I can`t reproduce it but I have managed to run two instances of clock at the same time. Take a look:
http://img708.imageshack.us/img708/2...2020112591.png
I touched the clock icon from main menu (applications view, not desktop) and somehow, instead of taking me directly to the already opened clock in the background, second instance appeared.

ade 2012-02-01 17:56

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by artpra (Post 1159049)
I`m stress testing (as before) "edition" with seconds and with script wrapper. It`s not the newest version (from tommorow) but one build older.
I don`t know how and I can`t reproduce it but I have managed to run two instances of clock at the same time. Take a look:
http://img708.imageshack.us/img708/2...2020112591.png
I touched the clock icon from main menu (applications view, not desktop) and somehow, instead of taking me directly to the already opened clock in the background, second instance appeared.

You didn't start a clock from the command prompt first? Then it will initiate a new instance.

artpra 2012-02-01 18:11

Re: N900 clock replacement [continued]
 
No, both of them were launched from menu, by touching its icon.
Somehow at the second time system was not aware, that clock is already running and started second one.

ade 2012-02-01 22:33

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by ivgalvez (Post 1158936)
Is there any 'assert' in the code? It won't be expanded in release and maybe some code after the assertion is executed because it's not correctly guarded. It could apply to any other code dependant on the debug flags.

There are some assert statements, but looking at them I do not have the feeling they are related to the issue. The behavior is fairly random crashing after a while when not wrapped by anything. Sounds more like some memory conflict only exposed when running "standalone".
The code link is available at the first page, so you can be your own judge about it.

nicolai 2012-02-01 22:53

Re: N900 clock replacement [continued]
 
Hi ade,

I think I found the reason why the application crashes.
For me, this only happens when the applications starts
by the clockicon, or the statusmenu clock button. But
not when starting the app from the commandline.
So, what makes the difference? Applications started from
the app-icon are started by a dbus-call. And according to
this
(Maemo: Hildonizing application UI)

Quote:

The application must be registered as a D-Bus service so that it will not be killed automatically by the system.
You have to use osso_initialize or register yourself
for the dbus top_application call.
Here is a nice example.
(Qt application for Maemo with DBus support)

ade 2012-02-01 23:18

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by nicolai (Post 1159210)
Hi ade,

I think I found the reason why the application crashes.
For me, this only happens when the applications starts
by the clockicon, or the statusmenu clock button. But
not when starting the app from the commandline.
So, what makes the difference? Applications started from
the app-icon are started by a dbus-call. And according to
this
(Maemo: Hildonizing application UI)



You have to use osso_initialize or register yourself
for the dbus top_application call.
Here is a nice example.
(Qt application for Maemo with DBus support)

Well, in the past it also crashed from the command prompt. But in more recent versions I got the feeling it was gone. Till I put directly in /usr/bin/, started it from the status menu and experienced crashes again. So that is more or less is in line with your statement.

We should definitely look further into this and hope we are on the right track. Thanks for your research.

Edit:
This also confirms it:

Just after start:
Code:

user      4256  4255  0 00:33 ?        00:00:00 /bin/sh /usr/bin/worldclock
user      4259  4256  4 00:33 ?        00:00:03 /usr/bin/worldclock.exe

A while later:
Code:

user      4259    1  3 00:33 ?        00:00:05 /usr/bin/worldclock.exe
The parent sh has been killed now, but leaving its child workclock.exe itself alive. That is why the sh wrapping helps.

ade 2012-02-01 23:56

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by artpra (Post 1159069)
No, both of them were launched from menu, by touching its icon.
Somehow at the second time system was not aware, that clock is already running and started second one.

The occurences in the previous post most likely explain this. As soon as a parent is gone, a new clock can be started.

artpra 2012-02-02 07:02

Re: N900 clock replacement [continued]
 
Another (minor) problem with trash text in banner - polish characters are displayed wrongly:
http://img10.imageshack.us/img10/929...2020122062.jpg
There should be "ł".

AapoRantalainen 2012-02-02 11:47

Re: N900 clock replacement [continued]
 
Hi, I added code for prevent system killing clock-application. I think this also prevents multiple instances running (if not started from terminal).
https://gitorious.org/~aaporantalain...45253f7bfc66b6

I also made commented block how to achieve: User has clock already running and clicks clock in the panel -> pop-up existing clock. Code is not in use, because I have done it only for clutter, and didn't know how to do it with QT.
https://gitorious.org/~aaporantalain...b44db844975b87

(If QT's MainWindow is same than Window, it will be straightforward).

I'm just testing packaging with extras-devel (extras-devel doesn't relate CSSU any how).

AapoRantalainen 2012-02-02 12:26

Re: N900 clock replacement [continued]
 
[EDIT]
Worldclock is not anymore on extras-devel
[/EDIT]

Worldclock is now in extras-devel (under user/system), installing it will remove clock-ui (and removing clock-ui will remove mp-fremantle-pr).

install
Code:

apt-get install worldclock
Rolling back:
Code:

apt-get install clock-ui
I have tested installing and uninstalling (works).

-
If you have clock already running and click clock on the Application menu, it will show existing clock.
But if you have clock running and click clock on top-panel, it doesn't show clock (not start another either).

--
Packaging files are committed:
https://gitorious.org/~aaporantalain...4c0f2436368e31

There are missing 'clean', because I do not know proper way to do that with qmake.

And now I see mistake: service file is two times with identical content. File with shorter name is installed to the correct place and name is changed to the longer version.

toxaris 2012-02-02 12:36

Re: N900 clock replacement [continued]
 
Nice, will it work if I have CSSU-T installed?

AapoRantalainen 2012-02-02 12:55

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by toxaris (Post 1159395)
Nice, will it work if I have CSSU-T installed?

I think so. Test.

Seems to me that clock-ui is not critical part of the system, so messing with it will not cause harm (just reinstall it). But I haven't yet tested booting without /usr/bin/worldclock file.

freemangordon 2012-02-02 13:13

Re: N900 clock replacement [continued]
 
And why you put that in extras-devel? Yesterday we agreed in IRC that as soon as it is packaged it will be put in CSSU repo. And you were told to not put it in extras-devel because it will bring problems with integration into CSSU. What is the big idea?

ed_boner 2012-02-02 14:04

Re: N900 clock replacement [continued]
 
finally we had a version standard, without the seconds in one position and not in the other..finally centered...and now this extra-devel release, with the potential of not having to come to this thread every date due to the multiple updates...and everything is messed up again..what a step back..disapointed..really hope its a step back to soon have two steps in font...

AapoRantalainen 2012-02-02 17:16

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by freemangordon (Post 1159413)
And why you put that in extras-devel? Yesterday we agreed in IRC that as soon as it is packaged it will be put in CSSU repo. And you were told to not put it in extras-devel because it will bring problems with integration into CSSU. What is the big idea?

I didn't understand extras-devel will cause problems with CSSU. This was most easiest way for me to test packaging outside of my tuned environment. I have asked removal from the extras-devel.

ade 2012-02-02 18:49

Re: N900 clock replacement [continued]
 
I think it would be best if the replacement clock would stay here just a little longer to still fix a few bugs.
Then I hope the code can go to the CSSU git in the desired way, where guys like Freemangordon can "clean up the mess" as he said it :D
@AapoRantalainen
Your packaging effort will be of good use then.

So what I still hope to do:
- fix snooze/inactive one time alert.
- I have to read the info from Nicolai and AapoRantalainen about how to address the prevention of killing the clock (and act on it if needed)

Looking at the discussion on IRC yesterday I could be we have to keep the background for CSSU acceptance. But I will leave that part wisely to them if possible :)

@artpra
I fixed your banner translation issue in the latest download.
Something else I noticed while having my N900 in Polish settings: the days for repeating alarms where separated by two comma's (every day ended with a comma in advance). Is that correct, is it my phone, or should it be changed?

Estel 2012-02-02 18:56

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by ade (Post 1159588)
Looking at the discussion on IRC yesterday I could be we have to keep the background for CSSU acceptance. But I will leave that part wisely to them if possible :)

Agree with You. i just hope that they plan to do so *only* after fixing redraw issue - increased CPU usage on redraw is a no-go for me, not to mention, that it conflicts with seconds in landscape. By the way, keeping background in landscape should also require adding additional one to portrait :P

Quote:

Originally Posted by ade (Post 1159588)
Something else I noticed while having my N900 in Polish settings: the days for repeating alarms where separated by two comma's (every day ended with a comma in advance). Is that correct, is it my phone, or should it be changed?

Confirming - there are two commas, and it's *not* correct. Thanks for spotting that - I use Polish settings everyday, and haven't noticed it (well, i don't use repeating alarms...)

/Estel

nicolai 2012-02-02 19:33

Re: N900 clock replacement [continued]
 
Can someone explain, what is the exact issue with seconds
and/or landscape mode.

Nicolai

Estel 2012-02-02 19:41

Re: N900 clock replacement [continued]
 
@nicolai
worldclock replacement got some issue, that dates from times when CepiPerez wrote it originally - when using background image (i.e, only in landscape, as portrait doesn't have background image yet), every change (minute, hour, or second changing) cause ineffective - CPU intensive - "redraw", or how it's properly called. So, when having worldclock opened, every minute CPU is waked up to 10% usage, for a while, and there is ~0.5 second delay, before new minute is displayed in worldclock. Of course, same apply to situation, where both minute and hour change.

Now, it may sound like "not big deal" when we talk about it once per minute (yet, it's still an issue, that isn't present in stock wordlclock). Ho ever, if we enable nice little feature of showing seconds with worldclock opened, such "redraw" happen every second, keeping CPU on (unacceptable) 10% usage.

100% working - yet not ideal - workaround for it, is to disable background image - without it, the "redraw" doesn't happen, and CPU overhead isn't present. Of course, "proper" fix would require to eliminate this "redraw" problem for worldclock with background. Yet, as it's just purely visual, feature-less thing (background image), I'm sure it can be just deleted, unless someone will introduce proper fix.

I'm sure ade will be able to explain it using more proper "coder" language, yet i hope it's understandable enough now.

/Estel

ade 2012-02-02 19:42

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by nicolai (Post 1159620)
Can someone explain, what is the exact issue with seconds
and/or landscape mode.

Nicolai

I can :)
- Some people want seconds in the clock, some don't
- Drawing seconds in landscape takes about 10% cpu when there is a background image
- There is no background image in potrait mode

Estel 2012-02-02 19:42

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by ade (Post 1159625)
I can :)
- Some people want seconds in the clock, some don't

Who doesn't want it? Remember, we're talking about worldclock opened, *not* clock in status area/status menu.

AapoRantalainen 2012-02-02 21:12

Re: N900 clock replacement [continued]
 
How often this is called?

mainwindow.cpp:108

Code:

void MainWindow::paintEvent(QPaintEvent*)
{
    QPainter painter(this);
    painter.drawImage(this->rect(), QImage("/etc/hildon/theme/backgrounds/clock.png"));
}

Put println, enable seconds. Is it called every second then?

How it is defined that there aren't background image in portrait mode? (I qmaemo5rotator.cpp, but doesn't understand)

nicolai 2012-02-02 21:15

Re: N900 clock replacement [continued]
 
Hi ade,

remove the paintEvent method all together and put this
in your mainwindow constructor:
Code:

    this->setAutoFillBackground(true);

    QPalette pal2(palette());
    pal2.setBrush(QPalette::Window, QPixmap("/etc/hildon/theme/backgrounds/clock.png"));
    this->setPalette(pal2);


ade 2012-02-02 21:44

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by nicolai (Post 1159663)
Hi ade,

remove the paintEvent method all together and put this
in your mainwindow constructor:
Code:

    this->setAutoFillBackground(true);

    QPalette pal2(palette());
    pal2.setBrush(QPalette::Window, QPixmap("/etc/hildon/theme/backgrounds/clock.png"));
    this->setPalette(pal2);


cpu usage about 0.6% instead of 10%.

Why do you make it look so easy :)

ed_boner 2012-02-03 01:40

Re: N900 clock replacement [continued]
 
@nicolai...finally..someone who cares for the final thing in an coherent user point of view..someone who cares to embrace problems and is a geniouis solving them..thank you very much nicolai..dont konw if your solution works but iam finally seing this going the right way...wish other developpers were so comitted open minded and eficient as you.

freemangordon 2012-02-03 05:58

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by ade (Post 1159689)
cpu usage about 0.6% instead of 10%.

Why do you make it look so easy :)

Cleaning up the mess :P

ade 2012-02-03 08:07

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by ed_boner (Post 1159745)
@nicolai...finally..someone who cares for the final thing in an coherent user point of view..someone who cares to embrace problems and is a geniouis solving them..thank you very much nicolai..dont konw if your solution works but iam finally seing this going the right way...wish other developpers were so comitted open minded and eficient as you.

Yes, couldn't agree more. Maybe we should just put all those non committed, narrow minded, inefficient developers in a (internet-free) jail so they can no longer be a threat to our community. Just as a precaution of course.

artpra 2012-02-03 08:23

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by ade (Post 1159588)
Something else I noticed while having my N900 in Polish settings: the days for repeating alarms where separated by two comma's (every day ended with a comma in advance). Is that correct, is it my phone, or should it be changed?

I was just about to report about this issue. I see them too and as Estel stated, it shouldn`t look like this.
Also confirming, that banner is now corrected.

ade 2012-02-03 10:06

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by artpra (Post 1159840)
I was just about to report about this issue. I see them too and as Estel stated, it shouldn`t look like this.
Also confirming, that banner is now corrected.

Just noticed it is not an issue of the replacement clock, but polish abbreviated days are returned ending with a comma. Looking at the judgement of polish persons like you and Estel, I will try to remove any trailing comma to end up with a single comma.

don_falcone 2012-02-03 10:29

Re: N900 clock replacement [continued]
 
This absolutely needs polishing! :D (pun intended)

AapoRantalainen 2012-02-03 12:37

Re: N900 clock replacement [continued]
 
Raising existing clock when clicked on top-panel, or in application-menu. Works.

function:
https://gitorious.org/~aaporantalain...ain.cpp#line13

activated:
https://gitorious.org/~aaporantalain...ain.cpp#line57

ade 2012-02-03 23:23

Re: N900 clock replacement [continued]
 
Great to have some help from Nicolai and AapoRantalainen now.

We go back to one version: background in landscape, seconds added in clock, and non repeating alarm inactivated (after alarm execution).

Changes/fixes:

ade

1. Made the generated alarm cookies in line with the stock clock.
One change that may be noticable in certain situations:
Before, the "snooze" and "stop" button texts where put literally in the alarm queue, using the current language.
If the device language was changed, the texts on the buttons would remain the same.
Now the button texts are translated as the alarms goes off, like the stock clock.
[ developers: FYI, attr_data.sval must have the value "osso-clock" in the queue, else the translations will not work ]

2. Replaced double commas in polish by a single one.

3. Landscape background in combination with seconds in clock (thanks to Nicolai for the code)
The CPU usage drop now allows for this.

AapoRantalainen
1. Raising existing clock when clicked on top-panel, or in application-menu

2. added code for prevent system killing clock-application (thanks to Nicolai for the info)



Because we don't need the shellscript anymore, please remove /usr/bin/worldclock.exe by hand if you have installed the replacement clock before.

Still leaves the issue open from the snooze as (mentioned on the first page). Could not fix that right now. I will look at that further tomorrow, as I also will update git then.


Installation instructions as always on the first page.

Estel 2012-02-04 15:14

Re: N900 clock replacement [continued]
 
Thanks ade.

I've tried to test everything that I could, and I haven't found any bugs - only one minor cosmetic glitch:

http://lorienart.pl/cover/clock.png

It isn't supposed to look this way with default Maemo theme, yep?

Of course, it's really *minor* thing. IMO, it's ready for CSSU-T.

/Estel

ade 2012-02-04 15:28

Re: N900 clock replacement [continued]
 
Quote:

Originally Posted by Estel (Post 1160440)
Thanks ade.

I've tried to test everything that I could, and I haven't found any bugs - only one minor cosmetic glitch:

http://lorienart.pl/cover/clock.png

It isn't supposed to look this way with default Maemo theme, yep?

Of course, it's really *minor* thing. IMO, it's ready for CSSU-T.

/Estel

Call me stupid, but that is the glitch? Wrong icons you mean?

Still have to fix the snooze issue and if do not get bug report for a while, towards quality control :)

Edit:
If it is the icons your are referring to:
replacement clock uses:
/opt/usr/share/icons/hicolor/164x164/hildon
stock clock uses:
/opt/usr/share/icons/<theme>/164x164/hildon/

If I judge it on the fly....

Estel 2012-02-04 15:45

Re: N900 clock replacement [continued]
 
Wrong placement of the icons - Their should overlap with background positions, so background thing create "glow" effect. See comparison:

Original worldclock:
http://lorienart.pl/cover/clock2.png

Worldclock replacement:
http://lorienart.pl/cover/clock.png

Seriously, it's very minor, cosmetic glitch, so I *almost* feel ashamed reporting it :p

/Estel

// Edit

If it's going to end in CSSU, for sake of completion, maybe worldclock should come with replacement background image for default theme, where background position would be adjusted? Of course, if adjusting position of icons themselves in program-side is too hopeless/hard work.

All after all, ade, You may feel that Your work (with important help from Nicolai and Aapo) is almost complete, if people report such things ;)

ade 2012-02-04 15:52

Re: N900 clock replacement [continued]
 
Now I get it :D

If it not too much work I can see if I can adjust it.
Can you attach that wallpaper? I am afraid I do not have that (anymore).

Estel 2012-02-04 15:58

Re: N900 clock replacement [continued]
 
Sure, here it is:
http://lorienart.pl/cover/clock_background.png

/Estel

ade 2012-02-04 19:57

Re: N900 clock replacement [continued]
 
Estel,
The icons should now be at the exact same location as the original clock.
I did not have the icons, but my own icons do center over the blue objects in the background.

Edit: also removed the brackets around GMT under the worldclock button. Don't know why they have been there.

niqbal 2012-02-05 06:49

Re: N900 clock replacement [continued]
 
I have been following this thread from last week or so. Brilliant work by all involved in it. Stock clock interface is replaced

ed_boner 2012-02-05 09:03

Re: N900 clock replacement [continued]
 
now you ve cracked it..everithing looks propper and the rotation is superfast..well done..tks


All times are GMT. The time now is 21:27.

vBulletin® Version 3.8.8