We have code

All going well, my code for adding Current Page and Page Set selection (aka Odd/Even pages) to Qt should now be up on gitorious for all to see and try out.  For those of you not wanting the hassle of compiling, here's a screenie:

Qt Odd Even Pages

The Gitorious branch is at http://qt.gitorious.org/~odysseus/qt/odysseus-clone/commits/current-odd-even.  I still have a few bits of polish to add, like disabling Page Set if Current Page is selected, and the initialisation is something I'm not 100% happy with, but it's mostly there and working.  I've been testing the last couple of days witout a real printer, but it should still be OK. I also haven't tested it compiles under Windows or OSX, so I'd be grateful to someone did :-)

So what does it do?

  • If you're on X11 / LPR and running an app that hasn't been modified, then you see nothing new.
  • If you're on X11 / CUPS and running an app that hasn't been modified, then you see the Page Set combo and CUPS takes care of the odd/even page selection.
  • If you're on X11 with CUPS or LPR and running an app that has been modified, then you see the Current Page (if set by the app) and the Page Set and the app takes care of the odd/even page selection.
  • If you are on OSX or Windows then you see nothing new (as yet).  Good news on that front is I have just seen a commit that moves Qt to using the Win2k print dialog instead of the Win98 print dialog, which should make adding these new features way easier. I still need help here though!

So how to modify an app?  Easy.  To enable the Current Page, just call QPrinter::setCurrentPage() with whatever your current page number is before you exec the print dialog.  To enable Page Set fully, just call QPrinter::setPageSelectionMode(QPrinter::AdvancedPageSelection) before you exec the print dialog, then make sure you either use the new QPrinter::pageList() method to get a list of the pages to render (the easy way) or use QPrinter::pageSet() to figure it out yourself (the hard way).

For reference, the newly added QPrinter public api is:

			enum PrintRange { AllPages, Selection, PageRange, CurrentPage }; // Just added CurrentPage
	enum PageSelectionMode { SimplePageSelection, AdvancedPageSelection };
	enum PageSet { PageSetAllPages, PageSetOddPages, PageSetEvenPages };
	void setPageSet(PageSet);
	PageSet pageSet() const;
	void setCurrentPage(int);
	int currentPage() const;
	void setPageSelectionMode(PageSelectionMode);
	PageSelectionMode pageSelectionMode() const;
	QList<int> pageList() const;
	

 

So, have a look, have a play, and let me know when you find my bugs :-)

[EDIT: Just a reminder this is a change to Qt so depends on the Trolls accepting it, but I'm hoping it makes it into Qt4.6 which will be out before KDE 4.4 so that's the up side]

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thank

Thank you!!!!!!!!!!!!!!!!!!!
Gracias!!!!!!!!!!!
:_D :_D :_D :_D

Awesome!

Thank you so much for working on this! I have been following the planned features pages on techbase since 4.0, but I knew that you had little time, so I did not get my hopes up too much. :P I am really glad that you are devoting your time and energy to this. It is highly appreciated. :)

 

mutlu

Patience...

This is a Qt feature, so you will have to wait for Qt to accept it, hopefully for Qt4.6, but at least that is sooner than KDE 4.4.

Printing various page ranges?

Hey!
This is really nice, but how about printing various page ranges (e.x. "1-4, 6-25, 26, 27")? I bump on this issue couple of days ago and this is irritating regresion from KDE 3.x times.

That's next

That's next on the feature list, it won't take too much work as the foundations have been laid by this change with implementing AdvancedPageSelection mode and the pageList method.  My big problem is getting a regex to validate the input ranges :-) Oh, and I have to get Qt to accept the changes first...

regex

maybe :
\\d+(-\\d+)?(\\, \\d+(-\\d+)?)*

(not tested)

If in

If in system-config-printer-kde I have told it to use LPR, that's still tunneled through CUPS, right? So I should get this?

Hmmmm

Not sure on that one really, but I suspect not, sorry.

Clarification

I don't think it will work for unmodified apps, but it will for all modified apps.  If KDE 4.4 depends on Qt 4.6 then we can modify all apps to support it anyway.

I still have a few bits of

I still have a few bits of polish to add, like disabling Page Set if Current Page is selected, and the initialisation is something I'm not 100% happy with, but it's mostly there and working.
iphone Book App

duplex printing for non-duplex printers

hi!
apart from ranges, i would be very glad if you add duplex printing for non-duplex printers (like my laserjet p1005). the idea is very simple - print odd pages in reverse order, grab the pile, turn it on 180* and then put it back on the tray, finally printing the even pages in increasing (normal) order. of course, it depends on the printer, but it would be nice to provide such (scripting?) capability/filter.

what about printing pages

what about printing pages 3,8,10,20-30 ? I would love a text-field where I could simply enter the pages and ranges that I want printed, instead these to field with up and down arrows..

Hey, guys. I'm looking for

Hey, guys. I'm looking for any information about xxx vids. Please let me know what ideas d'u have about this stuff.

Comrade.

Re

In the difficult way to the academic grade students must buy thesis report about this good post from the custom thesis service or professional custom dissertation service.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
By submitting this form, you accept the Mollom privacy policy.