PageRenderTime 20ms CodeModel.GetById 1ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/vp_plugins/print_acpu/mytypes.h

http://cupsfilter.googlecode.com/
C++ Header | 487 lines | 310 code | 60 blank | 117 comment | 0 complexity | 902e9821ae3c5f9ffb2aae99c344f374 MD5 | raw file
  1#ifndef MY_TYPES_H
  2#define MY_TYPES_H
  3
  4#include <QtCore/QMetaType>
  5#include <QtCore/QMap>
  6#include <QtGui/QPixmap>
  7
  8
  9namespace VPrn{
 10
 11#define MY_DEBUG
 12#define POINT_TO_CM(cm) ((cm)/28.3465058)
 13#define POINT_TO_MM(mm) ((mm)/2.83465058)     ////////////  0.352777778
 14#define POINT_TO_DM(dm) ((dm)/283.465058)
 15#define POINT_TO_INCH(inch) ((inch)/72.0)
 16
 17#define MM_TO_POINT(mm) ((mm)*2.83465058)
 18#define CM_TO_POINT(cm) ((cm)*28.3465058)     /////// 28.346456693
 19#define DM_TO_POINT(dm) ((dm)*283.465058)
 20#define INCH_TO_POINT(inch) ((inch)*72.0)
 21
 22    typedef qint64 PACKET_SIZE ; // ???????????? ?????? ??????
 23#define MESSAGE_SIZE (PACKET_SIZE - qint64 ); // ???????????? ?????? ?????????
 24
 25    typedef QMap <int,QPixmap> PixmapList;
 26    typedef QMap <int,QString> PixmapDescList;
 27
 28    static const int ObjectName = 0;
 29    static const int ObjectData = 1;
 30    static const int format = 13;
 31
 32    static const char PARTSEPARATOR = ':';
 33    static const char MESSAGESEPARATOR = '|';
 34
 35    struct Printers {
 36        QString name;       //??? ???????? (??? ????????????)
 37        QString ip;         //IP ????? ??????? ??? ???????? ???????
 38        QString p_qqueue;   //??? ??????? ?????? (??? ???????? ? CUPS)
 39    };
 40
 41    typedef QList<Printers> PrinterList;
 42
 43    enum EventLogMessageId{
 44        //ErrorMessages
 45        eId_EmptyMessage      = 0,
 46        eId_AppsError         = 10,    // ????????? ?????? ??????????
 47        eId_FileNotFound      = 1000,
 48        eId_RecivedPacketSize = 2000,
 49        eId_SocketErrorDesc   = 2001,
 50        eId_CanNotBindPort    = 2003,
 51        eId_CanNotReadConfig  = 2004,
 52        eId_BrokenConfigFile  = 2005,
 53        eId_ServiceNotStarted = 2006,
 54        eId_NetworkError      = 2007,
 55        eId_SQL_CoreNotInited = 2008,
 56        //Information Messages        
 57        eId_ServiceStarted    = 4000,
 58        eId_ServiceStoped     = 4001,
 59        eId_ServicePaused     = 4002,
 60        eId_ServiceResume     = 4003,
 61        eId_SQL_CoreInited    = 4004,
 62        // DebugMessages
 63        eId_DebugInfo = 7000
 64                    };
 65
 66    enum EventLogType{
 67        Success = 0, Error, Warning, Information
 68              };
 69
 70    enum EventLogCategory{
 71        eCatId_Empty       = 0x0,
 72        eCatId_Error       = 0x1,
 73        eCatId_Information = 0x2,
 74        eCatId_DebugInfo   = 0x3
 75                         };
 76    enum pSizeColumnOrder{
 77        pSize_id     = 0, /// ID
 78        pSize_page   = 1, /// ?????? ?????
 79        pSize_code   = 2, /// ???
 80        pSize_width  = 3, /// ?????? (??)
 81        pSize_height = 4  /// ?????? (??)
 82                   };
 83
 84    enum metaInfoOrder{
 85        metaInfo_name,    /// ??? ???????
 86        metaInfo_fname,   /// file_name ???????
 87        metaInfo_desc,    /// ???????? ???????;
 88        metaInfo_orient,  /// ?????????? (???????/?????????)
 89        metaInfo_ctime,   /// ????? ????????
 90        metaInfo_mtime,   /// ????? ?????????
 91        metaInfo_author,  /// ?????
 92        metaInfo_mtop,    /// ?????? ?????? (??)
 93        metaInfo_mbottom, /// ?????? ????? (??)
 94        metaInfo_mleft,   /// ?????? ????? (??)
 95        metaInfo_mright,  /// ?????? ?????? (??)
 96        metaInfo_p_width, /// ?????? ???????? (??)
 97        metaInfo_p_height /// ?????? ???????? (??)
 98    };
 99
100    enum DocCardOrder{
101        cards_ID              = 0,  /// ID
102        cards_DOC_NAME        = 1,  /// ??? ?????????
103        cards_STAMP           = 2,  /// ????????? ???? ???????????
104        cards_MB_NUMBER       = 3,  /// ????? ??
105        cards_PUNKT           = 4,  /// ?????
106        cards_PAGE_COUNT      = 5,  /// ????? ???????
107        cards_COPY_COUNT      = 6,  /// ????? ???
108        cards_CURRENT_COPY    = 7,  /// ??????? ???
109        cards_SELECT_ALL_COPY = 8,  /// ??????? ????? ???? ???
110        cards_TEMPLATE_NAME   = 9,  /// ??? ????? ???????
111        cards_EXECUTOR        = 10, /// ???????????
112        cards_PRINTMAN        = 11, /// ?????????
113        cards_PHONE           = 12, /// ???????
114        cards_INV_NUMBER      = 13, /// ???.?????
115        cards_PRINT_DATE      = 14, /// ???? ??????
116        cards_RECIVER_1       = 15, /// ??????????_1
117        cards_RECIVER_2       = 16, /// ??????????_2
118        cards_RECIVER_3       = 17, /// ??????????_3
119        cards_RECIVER_4       = 18, /// ??????????_4
120        cards_RECIVER_5       = 19, /// ??????????_5
121        cards_STATUS          = 20  /// ??????_?????????
122                            };
123
124
125
126    enum tInfoColumnOrder{
127        tInfo_id     = 0,  ///ID
128        tInfo_name   = 1,  ///??? ???????
129        tInfo_desc   = 2,  ///???????? ???????;
130        tInfo_pageID = 3,  ///?????? ?? ??????? ??????? ???????
131        tInfo_angle  = 4,  ///??????? (????.)
132        tInfo_ctime  = 5,  ///????? ????????
133        tInfo_mtime  = 6,  ///????? ?????????
134        tInfo_author = 7, ///?????
135        tInfo_mtop   = 8, ///?????? ?????? (??)
136        tInfo_mbottom = 9,///?????? ????? (??)
137        tInfo_mleft   = 10,///?????? ????? (??)
138        tInfo_mright  = 11, ///?????? ?????? (??)
139        tInfo_p_width = 12,
140        tInfo_p_height= 13
141                    };
142
143    enum pageDetailColumnOrder{
144        PD_id         = 0,  /// ID
145        PD_p_number   = 1,  /// ?????????? ????? ? ???????
146        PD_p_name     = 2,   /// ??? ????????
147        PD_p_visible  = 3   /// ????? ???????? ??/??? 1/0
148                    };
149
150    enum elemColumnOrder{
151        elem_id    = 0,  ///ID
152        elem_text  = 1,  ///????? ???????????? ?? ?????? ? ?? ????????
153        elem_tag   = 2,  ///??? ? ??????? ???????? ?????????
154        elem_pos_x = 3,  ///??????? ???????? ?? ????? ?
155        elem_pos_y = 4,  ///??????? ???????? ?? ????? ?
156        elem_color = 5,  ///???? ??????
157        elem_font  = 6,  ///?????
158        elem_angle = 7,  ///???? ???????? ????????????? ?????
159        elem_border= 8,  /// ??????? ??????? ????????, ??/???
160        elem_img_data = 9, /// ???? ?????? ???????? ?? ??? ????? ????????? ?????? ? ???? ???????? ??????
161        elem_img_scaled =10, /// ??????? ????????
162        elem_always_view = 11, /// ?????? ???????????? ??/???
163        elem_p_number    = 12,  /// ?????????? ????? ???????? 0-7 ?? ??????? ????? ???????
164        elem_text_img    = 13  /// ??? ???????? ????? ??? ????????(1/0)
165                       };
166
167    enum AppErrorType {
168        NoError,
169        FileNotFound,
170        FileIOError,
171        UnknownError,
172        SqlDriverNotLoad,
173        NotConnectedToDB,
174        DBOpeningError,
175        SQLQueryError,
176        SQLCommonError,
177        InternalAppError,
178        AuthCommonError,
179        NetworkError,
180        PluginsNotLoad,
181        SocketError,
182        ConfigError,
183        notDefainedMode,
184        appNotStarted,
185        TemplateNotLoad
186    };
187
188    enum pageNumbers {
189        FirstPage        = 1,
190        FirstPageN2      = 2,
191        FirstPageN3      = 3,
192        FirstPageN4      = 4,
193        FirstPageN5      = 5,
194        SecondPage       = 6,
195        ThirdPage        = 7,
196        FourthPage       = 8,
197    };
198
199    enum trayIcons {
200        InfoType,
201        WarnType,
202        CritType
203    };
204
205    enum trayStatus {
206        gk_Started,
207        gk_UserAuthorized,
208        gk_UserLogin,
209        gk_DoPrintJob,
210        gk_DoReportJob,
211        gk_WarningState,
212        gk_ErrorState
213    };
214
215    enum MyCheckPoints{
216        /// ?????????? "???????" ????? ??????? glob_
217        //glob_Init,
218        glob_Error,
219        /// ?????????  "???????" ????? ??????? loc_  ???????? ? QLocalSocket/QLocalServer
220        loc_CantStartListen,      /// ?? ???? ????????? ????????? ??????, ???? ?????
221        loc_Connected,            /// ?????????? ? ?????????? ???????
222        loc_Disconnected,         /// ??????????? ?? ?????????? ???????
223        loc_ServerNotFound,       /// ????????? ?????? ?? ??????
224        loc_ServerStart,          /// ????????? ?????? ???????
225        loc_LocalServerReady,     /// ????????? ?????? ????? ? ?????? (???? ??? ? ??????)
226        loc_LocalServerNeedMandat,/// ????????? ?????? ????? ? ??????,(???? ??? ?? ??? ???????)
227        loc_NewClientStarted,     /// ? ?????????? ??????? ??????????? ????? ??????
228        loc_MessageRecive,        /// ????????? ????????? ? ????????? ????? (? ??????? ??? ? ???????)
229        loc_NeedShutdown,         /// ?????????? ????????? ??????, ???????? ??????
230        /// ???????    "???????" ????? ??????? net_ ???????? ? QTcpSocket/QTcpServer
231        net_HostNotFound,         /// ????????? ?????? ?? ??????
232        net_Connected,            /// ???????? ? ????????? ????????
233        net_Disconnected,         /// ????????? ?? ?????????? ???????
234        net_CommonError           /// ?????? ????
235    };
236
237    enum Jobs{ /// ??????? (??????)
238        job_ConvertPs2Pdf,        /// ?????? ??????????????? ps ? pdf
239        job_CalcPageCount,        /// ?????? ???????? ??????? ? pdf ?????
240        job_SplitPageFirst,       /// ????????? ????????? ?? ?????? ???.
241        job_SplitPageOther,       /// ????????? ????????? ?? ??????????? ???.
242        job_MergePdf,             /// ??????????? ???? pdf ? ????
243        job_PrintFile,            /// ?????? ????????? ?? ???????
244        job_ConvertToPng,         /// ?????????????? ? png ????????? ?????
245        job_CatPages              /// ??????????? ???? pdf ?????? ? ????
246    };
247
248    enum MessageType {
249        ///?????????? ????????? (??? ????????/?????? ? ??????? ???????)
250        Que_RegisterGlobal     = 10,    /// ?????? ?? ??????????? ??????? ? ????
251        Ans_RegisterGlobal     = 1010,  /// ?????? ???????????????
252
253        Que_AUTHOR_USER        = 100,   /// ?????? ?? ??????????? ???????????? ? ??????? ? ????
254        Ans_PRINT_ALLOWED      = 1100,  /// ?????? ?????????
255        Ans_PRINT_DENIED       = 1101,  /// ?????? ?????????
256        Ans_PRINTER_NOT_FOUND  = 1102,  /// ??????? ?? ??????
257
258        /**
259          * @short  ?????? ?????? ?? ?? ??????:
260          * ? ???? ??????? ?????? ????????? ?????????:
261          * @param u_name;       ????? ????????????  \
262                                                      ->?????????? ??? ??????????? ?? ????
263          * @param u_mandat;     ?????? ???????????? /
264          * @param begin_period; ?????? ???????
265          * @param end_period;   ????? ???????
266          * @param printer;      ???????, ?????????? ??? ???
267          */
268        Que_GET_MB_LISTS       = 200,
269        /**
270          * @short  ????? ?????? ??????, ? ??????? (???? ? ??????? time_t)
271          * ????;:;??;:;?????_???.;:;????????_?????????;:;????? ???????;:;??????
272          */
273        Ans_MB_LIST           = 1200,
274
275
276        Que_SEC_LEVEL          = 300,   ///?????? ? ?????? ?? ????????? ?????? ??????? ???????????
277        Ans_STAMP_LIST         = 1300,  /// ?????? ???????? ??????? ???????????
278
279        Que_GET_PRINTER_LIST   = 400,   /// ?????? ?????? ?????????
280        Ans_PRINTER_LIST       = 1400,  /// ????? ?????? ?????????
281        Ans_PRINTER_LIST_EMPTY = 1401,  /// ?????? ????????? ???? !
282
283        /**
284          * @short  ?????? ???? ?? ? ???? ????????:  ???????? ?? ? ??????? ???
285          *  ? ???? ????????? ??????????? sql ?????? ? ???? ??????
286          */
287        Que_IS_MB_EXIST           = 500,
288        Ans_MB_NOT_EXIST          = 1500, /// ???????? ? ???? ?? ??? ???????????????
289        /**
290          *@short ???????? ? ?? ???????????????, ??????? ??? ????, ????????
291          * ?????????????? ???????? ?? ?????????? ????????? ?????
292          */
293        Ans_MB_EXIST_AND_BRAK     = 1505,
294        /**
295          *@short ???????? ? ?? ???????????????, ??????? ??? ??????????, ????????
296          * ?????????????? ???????? ?? ?????????? ????????? ?????
297          */
298        Ans_MB_EXIST_AND_NOT_BRAK = 1510,
299
300        /**
301          * @short ??????????? ????????? ? ?? ?????
302          *  ? ???? ????????? ??????????? sql ?????? ? ???? ??????
303          */
304        Que_RegisterDocInBase     = 570,
305        Ans_RegisterDocInBase     = 1570, /// ??????????? ? ?? ????? ?????????
306
307        /**
308          * @short ?????? ???????? ????????? ? ?? ?????
309          * @param qint8 field_id  ?????????? ????? ????
310          * @param ???????? ????
311          */
312        Que_SaveDocCardToBase     = 580,
313
314        Que_MANDAT_LIST        = 600,
315        Ans_MANDAT_LIST        = 1600,  /// ?????? ???????? ? ??????? ??????? ???????????
316        Ans_MANDAT_LIST_EMPTY  = 1601,  /// ? ??????? ???????????? ??? ?? ?????? ??????
317
318        /**
319          * @short ?????? ?????????? ????? ?? ??????? ??????
320          *  ? ???? ????????? ??????????? QUIN64
321          */
322        Ans_GetFreeSpace       = 1700,
323        Que_NotFreeSpace       = 1710,
324        Que_AllocFreeSpace     = 1720,
325
326        /// ????????? ????????? (??? ?????? ? ???? ????????)
327        Que_Register           = 5010,  /// ?????? ?? ???????????
328        Ans_Register           = 5015,  /// ????? ? ???????????
329
330        Que_ServerStatus       = 5020,  /// ?????? ? ??????? ??? ?????????
331        Ans_SrvStatusNotReady  = 5025,  /// ????? ???????.?? ????? ? ?????? ??????????? ? ???? ?????????
332        Ans_SrvStatusPartReady = 5026,  /// ????? ???????.????? ? ?????? (???? login ????????????,??? ???????, ???? ????? ? ???????)
333        Ans_SrvStatusFullReady = 5027,  /// ????? ???????.????? ? ?????? (???? auth ?????? ????????????, ???? ????? ? ???????)
334
335        Que_Convert2Pdf        = 5050,  /// ?????? ?? ?????????????? ?????????? ps ????? ? pdf
336        Ans_Convert2PdfFinish  = 5051,  /// ????? ????????? ?????????????? ??????? ?? ???? ???????
337        Ans_PageCounting       = 5052,  /// ?????? ????? ??????? ? ?????????PageCounting
338        Ans_PageSplittedFirst  = 5053,  /// ????????? ????????? ?? ?????? ???????? ?????????
339        Ans_PageSplittedOther  = 5054,  /// ????????? ????????? ?? ??????????? ???????? ?????????
340
341        /**
342          * @short  ?????? ?? ???????????? ????????? ????.? ???? ???????:
343          *   ?????? ????????? ? ??????? tmpl_sql_plugin
344          * @li ?????? ???? ? ?????????? ????????????? ???????
345          * @li ????? ?????? ?? ????? ?????,
346          */
347        Que_CreateFormatedFullDoc  = 5100, /// ?????? ????????
348        Que_CreateFormatedPartDoc  = 5110, /// ?????? ??? ?????
349        /// @short ?????? ???????? ??? ??????, ? ???? ????????? ???????, ????? ??????
350        Que_CreateFormatedFullDocAndPrint = 5200,  /// ????????? ?????? ? ???? ? ??????
351
352        /// @short Ans_TemplateNotFound  - ?????? ?? ?????? ??? ?????????, ? ???? ????????? ???????????
353        Ans_TemplateNotFound   = 5101,
354        /// @short Ans_SourceDocNotFound - ???????? ???????? ?? ?????? ??? ?? ??????? ???????, ? ???? ????????? ???????????
355        Ans_SourceDocNotFound  = 5102,
356
357        /// @short Ans_CreateFormatedDoc - ?? ???????? ??????? ??????? ??????
358        Ans_CreateFormatedDoc  = 5103,
359
360        /** @short Ans_ConvertFormatedDocToPng - ???????? ??????? ????????????? ? png,
361          * ? ???? ?????????:
362            * @li ???-?? ??????
363            * @li ?????? ????? ? ?????? ??????????? ???.
364          */
365        Ans_ConvertFormatedDocToPng  = 5104,
366
367        /**
368          * @short ?????? ???????? ?????????,???? ????????? ??? ???????? ? ????? ?? ?????? ??????
369          * ? ???? ????????? ?????? ????????? ????????????? ???????
370          */
371        Que_PrintCurrentFormatedDoc = 5210,
372        Ans_PrintFormatedDoc        = 5201,  /// ???????? ??????????, ????? ?? ??????
373        Ans_PrintFormatedDoc_Error  = 5202,  /// ???????? ?? ??????????, ????? ?? ?????? ??????????? ? ????
374
375        /** @short  ?????? ?? ???????? ???????? ? ????????? ?? ??????????????,
376          * ? ???? ???????, QStringList ?????????? ?????? ??????? ??????? ???? ?????????
377          */
378        Que_GiveMeTemplatesList     = 5300,
379        /** @short ????? ???????? QStandardItemModel ??????????????? ? QByteArray
380          * ? ??????? ?????? @sa @class TemplatesInfo
381          */
382        Ans_GiveMeTemplatesList     = 5310,
383
384        /**
385          *@brief ?????? ?? ?????????? ???????? ??????, ? ???? ?????????,
386          * ???????? ????? ?? ? ????? ??????????, ??? ??????? ?? ??? ????
387          */
388        Que_UserDemands2Restart      = 5500,
389
390        /*
391         * @short Que_PrintThisFile ?????? ????? ?? ????????? ????????????? ???????
392         * @param (QString) JobID (????????? ??? ??????? ???. ?????????)
393         * @param (QString) ??? ???????? (??????? ?????? ?? CUPS)
394         * @param (qint8)   copy_number  ????? ????? 1-100
395         * @param (QString) user_name    ??? ????????????
396         * @param (QString) job_title    ??? ???????
397         * @param (qint64) array_size   ?????? ?? ??????? ??????
398         * @param (QByteArray) ???? ??? ?????? ? ??????? QByteArray (??????)
399        */
400        Que_PrintThisFile            = 6000,
401        Ans_PrintThisFileSuccess     = 6010,
402        Ans_PrintThisFileFailure     = 6020,
403
404        /*
405         * @short Que_ReciveFile ???????? ????? ?????? ??? ?????????? ??????
406         * @param QString      ?????????? ????????????? ????????????? ?????
407         * @param qint32       ?????? ?? ??????? ????? (max qint32) byte
408         * @param QByteArray   ???? ??? ?????? ? ??????? QByteArray (??????)
409         */
410        Que_ReciveFile               = 6030,
411        Ans_ReciveFileSuccess        = 6031,
412        Ans_ReciveFileFailure        = 6032,
413
414
415        /**
416          * @short Que_CheckFileSize ?????? ? ???????? ??????, ????? ?? ?? ??????? ????
417          * @param (qint64) array_size   ?????? ?? ??????? ??????
418          */
419        Que_CheckFileSize            = 6060,
420        Ans_CheckFileSizeSuccess     = 6065, // ????? ?????
421        Ans_CheckFileSizeFailure     = 6070, // ????? ??? ?? ?????
422
423        /*
424         * @short ??????/????? ???????????? ?????? ???????? ??? ????????? ??? ????????/????
425         * @param (QString) ???????? ?????????
426         * @param (QString) ??????? ?? ??????? ????????? ????????
427         * @param (QString) ?? ????? ?????????
428         * @param (qint8)   ????? ??????????
429         * ----------------------------------------------------------
430         *
431         */
432        Que_UserNeedMarkCopies       = 6100,
433        Ans_UserNeedMarkCopies       = 6110,
434        /// ?????? ???????????? ?? ????????? ???????
435        Que_UserNeedFlipPages        = 6150,
436        /// ?????? ???????????? ??????? ??? ????? ????????? ???????? ?????????
437        /// ???????? ???????? ??? ?????? ????????
438        Que_UserNeedCheckLastPage    = 6170,
439        /// ?????????????? ????????? ?????? ?????? i-?? ???. ?????????
440        Que_BeginPrintCopies         = 6200,
441
442        ///????????? ?????????
443        GoodBay          = 7000,        /// GateKeeper ????????? ?????? ? ??? ????
444        Err_Message      = 7001,        /// ????????? ?? ??????.??????????? ? ???? ?????????
445        NoMsgType        = 0
446                       };
447
448    enum {
449        Page_Intro     = 0,
450        Page_Select    = 1,          
451        Page_PrintData = 2,
452        Page_CheckData = 3,
453        Page_Preview   = 4,
454        Page_Finish    = 5,
455        Page_SetBrak   = 6
456                     };
457
458    /**
459     * @brief  ?????? ????????????? ??? ??????
460     * @li  FullPreviewMode  ???????? ???? ??????? ???? ???.
461     * @li  PartPreviewMode ???????? ?????? ???????? ??????? (1-? ???????) ??????? ???.
462     * @li  PrintWithoutPreviewMode  ?????? ??? ?????????
463     */
464    enum PreviewMode{
465        pre_FullMode       = 0,
466        pre_PartMode       = 1,
467        pre_ClearPrintMode = 2
468                         };
469
470
471}
472
473Q_DECLARE_METATYPE(VPrn::AppErrorType);
474Q_DECLARE_METATYPE(VPrn::PreviewMode);
475Q_DECLARE_METATYPE(VPrn::Jobs);
476Q_DECLARE_METATYPE(VPrn::MyCheckPoints);
477Q_DECLARE_METATYPE(VPrn::DocCardOrder);
478Q_DECLARE_METATYPE(VPrn::MessageType);
479Q_DECLARE_METATYPE(VPrn::trayIcons);
480Q_DECLARE_METATYPE(VPrn::trayStatus);
481Q_DECLARE_METATYPE(VPrn::pSizeColumnOrder);
482Q_DECLARE_METATYPE(VPrn::tInfoColumnOrder);
483Q_DECLARE_METATYPE(VPrn::elemColumnOrder);
484Q_DECLARE_METATYPE(VPrn::pageDetailColumnOrder);
485Q_DECLARE_METATYPE(VPrn::pageNumbers);
486#endif
487