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

List:       kde-core-devel
Subject:    Re: New KDE printing system
From:       Michael Goffioul <goffioul () imec ! be>
Date:       2001-02-28 16:06:38
[Download RAW message or body]

> I would love to be able to write
>
> KPrinter *printer = new KPrinter;
> <do stuff>
> delete printer;

I'm afraid then that you have to overload the "new" operator or the
KPrinter class. The real job is done in subclasses, so the "new"
operator should not return a KPrinter object, but a KCupsPrinter,
KLpdPrinter, ... according to the user settings.

I agree that the current code is not 100% compatible with Qt (means
you cannot only change Q to K). The way to go then could be the
following:
    - keep the current KPrinter interface similar to QPrinter
    - instead of subclassing KPrinter, use a KPrinterImpl object as
        a member of KPrinter to do all the print work.
    - make the factory responsible for the creation and deletion of
        this KPrinterImpl object (which means you can retrieve settings
        from previous calls).
    - subclass the KPrinterImpl class to implement printing system
        specific jobs.

With this mechanism, I think you can get an API which is 100%
compatible with the QPrinter usage.

I'm currently working on an extension of kdeprint to provide a
generic printing management tool. This will lead to a big rewrite of the
current kdeprint code. The above structure also implies large changes in
current kdeprint code, so maybe it's better to do everything at the same
time.
The current kdeprint code is a "first try" and apparently can be greatly
improved (just after one day on the CVS, I have to rewrite almost
everything...). If anybody is interested in helping...

Michael.

--
------------------------------------------------------------------
Michael Goffioul                IMEC-DESICS-MIRA
e-mail: goffioul@imec.be        (Mixed-Signal and RF Applications)
Tel:    +32/16/28-8510          Kapeldreef, 75
Fax:    +32/16/28-1515          3001 HEVERLEE, BELGIUM
------------------------------------------------------------------

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

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