Changeset View
Standalone View
core/fileprinter.h
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 30 | public: | |||
---|---|---|---|---|---|
43 | * | 43 | * | ||
44 | * If system side, then the file will contain all the pages in the document, and | 44 | * If system side, then the file will contain all the pages in the document, and | ||
45 | * the print system will print the users selected print range from out of the file. | 45 | * the print system will print the users selected print range from out of the file. | ||
46 | * | 46 | * | ||
47 | * Note system side only works in CUPS, not LPR. | 47 | * Note system side only works in CUPS, not LPR. | ||
48 | */ | 48 | */ | ||
49 | enum PageSelectPolicy { ApplicationSelectsPages, SystemSelectsPages }; | 49 | enum PageSelectPolicy { ApplicationSelectsPages, SystemSelectsPages }; | ||
50 | 50 | | |||
51 | /** Whether to apply scaling when printing. | ||||
52 | * | ||||
53 | * 'None' indicates that no scaling should be applied. | ||||
54 | * 'FitToPrintArea' indicates that the document should be scaled to the | ||||
55 | * area that is available for printing. Whether or not this includes the printer's | ||||
56 | * hardware margins depends on the value of 'QPrinter::fullPage()' for the given printer. | ||||
57 | * | ||||
58 | * @since 1.7 | ||||
aacid: if this is going to be flags, it should be like this
enum ScaleMode {
None = 0… | |||||
aacid: the since will need to be 1.8 (and all the other 1.7 you added) | |||||
59 | */ | ||||
60 | enum ScaleMode { | ||||
61 | None = 0, | ||||
Make this no Scale or something similar since otherwise FilePrinter::None seems like you're saying "none printer" aacid: Make this no Scale or something similar since otherwise
FilePrinter::None seems like you're… | |||||
62 | FitToPrintArea = 1 | ||||
63 | }; | ||||
64 | | ||||
51 | /** Print a file using the settings in QPrinter | 65 | /** Print a file using the settings in QPrinter | ||
52 | * | 66 | * | ||
53 | * Only supports CUPS and LPR on *NIX. Page Range only supported in CUPS. | 67 | * Only supports CUPS and LPR on *NIX. Page Range only supported in CUPS. | ||
54 | * Most settings unsupported by LPR, some settings unsupported by CUPS. | 68 | * Most settings unsupported by LPR, some settings unsupported by CUPS. | ||
55 | * | 69 | * | ||
56 | * The documentOrientation parameter was added in version 0.14. | 70 | * The documentOrientation parameter was added in version 0.14. | ||
57 | * | 71 | * | ||
58 | * @param printer the print settings to use | 72 | * @param printer the print settings to use | ||
59 | * @param file the file to print | 73 | * @param file the file to print | ||
60 | * @param documentOrientation the orientation stored in the document itself | 74 | * @param documentOrientation the orientation stored in the document itself | ||
75 | * @param scaleMode scale mode to use | ||||
61 | * @param fileDeletePolicy if the application or system deletes the file | 76 | * @param fileDeletePolicy if the application or system deletes the file | ||
62 | * @param pageSelectPolicy if the application or system selects the pages to print | 77 | * @param pageSelectPolicy if the application or system selects the pages to print | ||
63 | * @param pageRange page range to print if SystemSelectsPages and user chooses Selection in Print Dialog | 78 | * @param pageRange page range to print if SystemSelectsPages and user chooses Selection in Print Dialog | ||
64 | * | 79 | * | ||
65 | * @returns Returns exit code: | 80 | * @returns Returns exit code: | ||
66 | * -9 if lpr not found | 81 | * -9 if lpr not found | ||
67 | * -8 if empty file name | 82 | * -8 if empty file name | ||
68 | * -7 if unable to find file | 83 | * -7 if unable to find file | ||
69 | * -6 if invalid printer state | 84 | * -6 if invalid printer state | ||
70 | * -5 if print to file copy failed | 85 | * -5 if print to file copy failed | ||
71 | * -2 if the KProcess could not be started | 86 | * -2 if the KProcess could not be started | ||
72 | * -1 if the KProcess crashed | 87 | * -1 if the KProcess crashed | ||
73 | * otherwise the KProcess exit code | 88 | * otherwise the KProcess exit code | ||
74 | * | 89 | * | ||
75 | * @since 0.14 (KDE 4.8) | 90 | * @since 1.7 | ||
76 | */ | 91 | */ | ||
92 | static int printFile( QPrinter &printer, const QString file, | ||||
93 | QPrinter::Orientation documentOrientation, | ||||
94 | ScaleMode scaleMode, | ||||
95 | FileDeletePolicy fileDeletePolicy = FilePrinter::ApplicationDeletesFiles, | ||||
96 | PageSelectPolicy pageSelectPolicy = FilePrinter::ApplicationSelectsPages, | ||||
97 | const QString &pageRange = QString() ); | ||||
77 | 98 | | |||
99 | /** Print a file using the settings in QPrinter | ||||
100 | * | ||||
101 | * Same as 'printFile()' with 7 parameters, but always using a 'scaleMode' of | ||||
102 | * 'FitToPrintArea'. | ||||
103 | * | ||||
104 | * @since 0.14 (KDE 4.8) | ||||
105 | */ | ||||
78 | static int printFile( QPrinter &printer, const QString file, | 106 | static int printFile( QPrinter &printer, const QString file, | ||
79 | QPrinter::Orientation documentOrientation, | 107 | QPrinter::Orientation documentOrientation, | ||
80 | FileDeletePolicy fileDeletePolicy = FilePrinter::ApplicationDeletesFiles, | 108 | FileDeletePolicy fileDeletePolicy = FilePrinter::ApplicationDeletesFiles, | ||
81 | PageSelectPolicy pageSelectPolicy = FilePrinter::ApplicationSelectsPages, | 109 | PageSelectPolicy pageSelectPolicy = FilePrinter::ApplicationSelectsPages, | ||
82 | const QString &pageRange = QString() ); | 110 | const QString &pageRange = QString() ); | ||
this is not binary compatible, we try not to break the binary compatibility of the okular public classes. Add another method (without the default values) and make this one call the new one. Same for all the functions you're adding new parameters to. Or you can try to convince me that maintainting binary compatibilty is not needed :D aacid: this is not binary compatible, we try not to break the binary compatibility of the okular… | |||||
I don't really feel up to the task of convincing you. :D Otherwise, I don't mind adding the suggested extra methods. Will those extra methods then stay there forever or can the methods then be "merged" again once another ABI-incompatible change is done? Just out of curiosity: Do you know of specific applications/third-party generators,... that use libokularcore? michaelweghorn: I don't really feel up to the task of convincing you. :D
The only point I can come up with is… | |||||
I'm almost sure that doesn't break binary compatibility since it's a template and thus the code would end up on the app side and not the library side, but i didn't want to lose sleep making sure. Once we break ABI we could merge them back, if people realize :D calligra has a few generators for odt, odp using calligra libs. aacid: I'm almost sure that doesn't break binary compatibility since it's a template and thus the code… | |||||
83 | 111 | | |||
84 | /** Return the list of pages selected by the user in the Print Dialog | 112 | /** Return the list of pages selected by the user in the Print Dialog | ||
85 | * | 113 | * | ||
86 | * @param printer the print settings to use | 114 | * @param printer the print settings to use | ||
87 | * @param lastPage the last page number, needed if AllPages option is selected | 115 | * @param lastPage the last page number, needed if AllPages option is selected | ||
88 | * @param currentPage the current page number, needed if CurrentPage option is selected | 116 | * @param currentPage the current page number, needed if CurrentPage option is selected | ||
89 | * @param selectedPageList list of pages to use if Selection option is selected | 117 | * @param selectedPageList list of pages to use if Selection option is selected | ||
90 | * @returns Returns list of pages to print | 118 | * @returns Returns list of pages to print | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 178 | protected: | |||
151 | 179 | | |||
152 | bool detectCupsService(); | 180 | bool detectCupsService(); | ||
153 | bool detectCupsConfig(); | 181 | bool detectCupsConfig(); | ||
154 | 182 | | |||
155 | int doPrintFiles( QPrinter &printer, const QStringList fileList, | 183 | int doPrintFiles( QPrinter &printer, const QStringList fileList, | ||
156 | FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, | 184 | FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, | ||
157 | const QString &pageRange, | 185 | const QString &pageRange, | ||
158 | QPrinter::Orientation documentOrientation ); | 186 | QPrinter::Orientation documentOrientation ); | ||
187 | // TODO merge with function above when a BIC change happens somehwere else | ||||
188 | /// @since 1.7 | ||||
189 | int doPrintFiles( QPrinter &printer, const QStringList fileList, | ||||
190 | FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, | ||||
191 | const QString &pageRange, | ||||
192 | QPrinter::Orientation documentOrientation, ScaleMode scaleMode ); | ||||
159 | 193 | | |||
160 | QStringList printArguments( QPrinter &printer, | 194 | QStringList printArguments( QPrinter &printer, | ||
161 | FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, | 195 | FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, | ||
162 | bool useCupsOptions, const QString &pageRange, const QString &version, | 196 | bool useCupsOptions, const QString &pageRange, const QString &version, | ||
163 | QPrinter::Orientation documentOrientation ); | 197 | QPrinter::Orientation documentOrientation ); | ||
198 | // TODO merge with function above when a BIC change happens somehwere else | ||||
199 | /// @since 1.7 | ||||
200 | QStringList printArguments( QPrinter &printer, | ||||
201 | FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, | ||||
202 | bool useCupsOptions, const QString &pageRange, const QString &version, | ||||
203 | QPrinter::Orientation documentOrientation, ScaleMode scaleMode ); | ||||
164 | 204 | | |||
165 | QStringList destination( QPrinter &printer, const QString &version ); | 205 | QStringList destination( QPrinter &printer, const QString &version ); | ||
166 | QStringList copies( QPrinter &printer, const QString &version ); | 206 | QStringList copies( QPrinter &printer, const QString &version ); | ||
167 | QStringList jobname( QPrinter &printer, const QString &version ); | 207 | QStringList jobname( QPrinter &printer, const QString &version ); | ||
168 | QStringList deleteFile( QPrinter &printer, FileDeletePolicy fileDeletePolicy, | 208 | QStringList deleteFile( QPrinter &printer, FileDeletePolicy fileDeletePolicy, | ||
169 | const QString &version ); | 209 | const QString &version ); | ||
170 | QStringList pages( QPrinter &printer, PageSelectPolicy pageSelectPolicy, | 210 | QStringList pages( QPrinter &printer, PageSelectPolicy pageSelectPolicy, | ||
171 | const QString &pageRange, bool useCupsOptions, const QString &version ); | 211 | const QString &pageRange, bool useCupsOptions, const QString &version ); | ||
172 | 212 | | |||
173 | QStringList cupsOptions( QPrinter &printer, QPrinter::Orientation documentOrientation ); | 213 | QStringList cupsOptions( QPrinter &printer, QPrinter::Orientation documentOrientation ); | ||
214 | // TODO merge with function above when a BIC change happens somehwere else | ||||
215 | /// @since 1.7 | ||||
216 | QStringList cupsOptions( QPrinter &printer, QPrinter::Orientation documentOrientation, ScaleMode scaleMode ); | ||||
174 | QStringList optionMedia( QPrinter &printer ); | 217 | QStringList optionMedia( QPrinter &printer ); | ||
175 | QString mediaPageSize( QPrinter &printer ); | 218 | QString mediaPageSize( QPrinter &printer ); | ||
176 | QString mediaPaperSource( QPrinter &printer ); | 219 | QString mediaPaperSource( QPrinter &printer ); | ||
177 | QStringList optionOrientation( QPrinter &printer, QPrinter::Orientation documentOrientation ); | 220 | QStringList optionOrientation( QPrinter &printer, QPrinter::Orientation documentOrientation ); | ||
178 | QStringList optionDoubleSidedPrinting( QPrinter &printer ); | 221 | QStringList optionDoubleSidedPrinting( QPrinter &printer ); | ||
179 | QStringList optionPageOrder( QPrinter &printer ); | 222 | QStringList optionPageOrder( QPrinter &printer ); | ||
180 | QStringList optionCollateCopies( QPrinter &printer ); | 223 | QStringList optionCollateCopies( QPrinter &printer ); | ||
181 | QStringList optionPageMargins( QPrinter &printer ); | 224 | QStringList optionPageMargins( QPrinter &printer ); | ||
225 | // TODO merge with function above when a BIC change happens somehwere else | ||||
226 | /// @since 1.7 | ||||
227 | QStringList optionPageMargins( QPrinter &printer, ScaleMode scaleMode ); | ||||
182 | QStringList optionCupsProperties( QPrinter &printer ); | 228 | QStringList optionCupsProperties( QPrinter &printer ); | ||
183 | }; | 229 | }; | ||
184 | 230 | | |||
185 | } | 231 | } | ||
186 | 232 | | |||
187 | #endif // FILEPRINTER_H | 233 | #endif // FILEPRINTER_H |
if this is going to be flags, it should be like this
enum ScaleMode {
None = 0,
FitToPrintArea = 1
};
so the next flags can be 2, 4, 8, etc, meaning you can use binary or and binary and on them and it'll all work