Added icon
[urpo] / src / printjob.h
1 /**************************************************************************
2
3     URPO
4
5     Unix Remote Printing Operation
6     Copyright (c) Arto Hyvättinen 2010
7
8     This file is part of URPO.
9
10     URPO is free software: you can redistribute it and/or modify
11     it under the terms of the GNU General Public License as published by
12     the Free Software Foundation, either version 3 of the License, or
13     (at your option) any later version.
14
15     URPO is distributed in the hope that it will be useful,
16     but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18     GNU General Public License for more details.
19
20
21 **************************************************************************/
22
23 #ifndef PRINTJOB_H
24 #define PRINTJOB_H
25
26 #include <urpojob.h>
27
28
29 /*! File printing job'
30
31   @author Arto Hyvättinen
32   @date 2010-06-17
33   @version 0.1
34
35  Job for printing files.
36  First, connect finished()-signal (called when ready)
37  Then, printFile()
38
39  @note start() is not for use!
40
41   */
42 class PrintJob : public UrpoJob
43 {
44     Q_OBJECT
45 public:
46     explicit PrintJob(UrpoConnection* connection);
47     ~PrintJob();
48
49 signals:
50
51 public slots:
52     /*! When file has copied (internal use only) */
53     void copyReady(bool success);
54     /*! When files has printed (internal use only) */
55     void printReady(bool success);
56     /*! When file has deleted (internal use only) */
57     void deleteReady(bool success);
58
59     /*! Print sigle file
60
61       @arg path Path to file
62       @arg printOptions cups print options for lp command
63
64       When finished, emit finished() signal
65
66       */
67     void printFile(const QString& path, const QString& printOptions);
68
69     /*! Do not use, thows execption!
70
71       This function exits only because of bad class planning.
72       @note Do NOT use!
73
74     @throw std::logic_error Thow error becouse this function is not for use!*/
75     void startJob();
76     /*! Cancel printing job */
77     void cancelJob();
78
79 private:
80     inline void freeProcess();
81
82 private:
83     UrpoProcess* currentProcess_;
84     QString pathToPrint_;
85     QString printOptions_;
86
87
88 };
89
90 #endif // PRINTJOB_H