Mandelbrot, continued (and plasma bug reports)

Benoit Jacob jacob.benoit.1 at gmail.com
Wed Apr 8 21:18:13 CEST 2009


Hi,

Long email but if you're in a hurry skip down to where I put stars (********).

2009/4/8 Aaron J. Seigo <aseigo at kde.org>:
> On Wednesday 08 April 2009, Benoit Jacob wrote:
>> Could you please tell me how to do that cleanly, or add such a method
>> in the Wallpaper class?
>
> is would just go into Plasma::Wallpaper, but it feels "dirty"; the Wallpaper
> shouldn't care.

That makes sense. But the typical situation is that:

1. User moves the view with the main Mandelbrot instance
2. User opens Desktop Settings dialog.
3. The embedded Mandelbrot instance reads the config from disk.
4. User changes some colors, closes the dialog.
5. The embedded Mandelbrot instance saves the config to disk.
6. The main Mandelbrot instance rereads the config from disk.

Now the problem is that at step 3, the config that is being read is
outdated, because the viewpoint was modified by the main Mandelbrot
instance. So at step 5, that outdated config is written to disk, and
the main Mandelbrot instance loads it at step 6. The result is that
the modifications made to the viewpoint are lost.

(**************)
Ideally, the main Mandelbrot instance should save its config before
the Desktop Settings embedded instance reads the config. Is that
possible? Any signal that I could catch here? That would indeed remove
the need for isMainInstance() and would also fix the little problem
that the embedded instance shows the old viewpoint.

>
>> The reason why I need it, is that the 2 instances modify different
>> settings: the main instance controls the viewpoint while the other
>> instance controls other parameters. So in the save() method I need to
>> know which instance it is.
>
> hm... when the Wallpaper is restore()d, doesn't it read in the viewpoint?

It does. But it had saved it just before: when clicking OK in the
Desktop Settings, I found that the main instance automatically does
save(), then the Desktop Settings instance does save(), then the main
instance does init(). Since the Desktop Settings instance avoids
overwriting the viewpoint, the main instance's viewpoint is preserved.

> so
> when loaded in the configuration dialog, it should have that setting available
> to it. does the viewpoint change when painting on a different sized
> boundingRect()?

No, the viewpoint is independent from that.

>> 3) In Desktop Settings dialog, the mandelbrot preview is misplaced
>> slightly to the top-left, so there are black bands on the bottom and
>> right.
>
> does your code assume that boundingRect starts at (0, 0)?

Aha, that could well explain it. I'll see how other wallpapers do.

Cheers,
Benoit


More information about the Plasma-devel mailing list