[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Adding more methods to KoShapeSavingContext
From:       Carlos Licea <carlos_licea () hotmail ! com>
Date:       2010-05-14 19:51:30
Message-ID: BLU0-SMTP83C0387DAD24FB4C591839F2FD0 () phx ! gbl
[Download RAW message or body]

On Viernes 14 Mayo 2010 11:41:16 Thorsten Zachmann escribió:
>On Friday 14 May 2010 17:49:42 Carlos Licea wrote:
>> Have a look at the code:
>> > QString KoShapeSavingContext::imageHref(QImage & image)
>> > {
>> > 
>> >     // TODO this can be optimized to recocnice images which have the
>> >     same content // Also this can use quite a lot of memeory as the
>> >     qimage are all kept until // the they are saved to the store in
>> >     memory QString href =
>> >     QString("Pictures/image%1.png").arg(++d->imageId);
>> >     d->images.insert(href, image);
>> >     return href;
>> > 
>> > }
>
>That is not the method used for saving the background in kopageapp. The
>method used is
>
>QString KoShapeSavingContext::imageHref(KoImageData * image)
Yes, I realized that, but I don't use KoImageData. I'll have a look whether I 
can change it fast enough. My priorities now are on other stuff.

>> I don't want to convert my image to PNG, I want to save it just as is.
>
>It is not converted when the other method is used.
>
>> >>     I propose the adding of a KoStore* store() method. That way we can
>> >
>> >void KoPAPageBase::saveOdfPageStyleData( KoGenStyle &style,
>> >KoPASavingContext &paContext )
>> >
>> >to see how e.g. the background is saved by kpresenter.
>> >
>> >Using a KoShapeBackground for loading and saving of the page background
>> >as it is done in kopageapp can also simplify the code you committed
>> >there.
>> 
>> Can't the sheet is not a shape. I'm actually painting the background of
>> the canvas.
>
>that is not really a reason to not do it. It is just an object and you can
>use it's paint method to paint the background. It would have the benefit
>that all the code for loading/saving/painting could be reused and make the
>code much simpler. It would also have the benefit that if you have the same
>background image on multiple sheets that the image is only saved ones and
>also only kept ones in memory.
>
I'm afraid I don't get your point. I don't see a KoImageBackground nor similar 
that I could use, also, as I said, I can't set a KoShapeBackround to the 
canvas, is just not a Shape, could you please clarify which classes and methods 
should I use; if you can, an outline would be appreciated too.

Perhaps are you suggesting that I create a KoImageBackground? if so, how can I 
use it on a non-shape object?

Sorry, I'm really confused by this suggestion.

>There is another reason why your proposed solution won't work and that is
>that it is not possible to write 2 files at the same time, and that is one
>of the reasons the design is as it is at the moment.
I understand. (As I understand it is that you can't write to a file if you have 
one open and writing to it with, say, KoXmlWriter. Please correct me if I got 
it wrong.)

Then returning the KoStore is, as you said, not a good idea.

Getting out of the background Image scope, though, I'll say that a way to add 
files is still desirable.

Adding a function addFile(name, mimetype, data) and addFile(name, data) (as a 
convenience function that would use KMime) would be a good thing™, don't you 
think?.

Or should we encourage the usage of dataCenters only, as pointed out by Casper?

Carlos Licea
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic