PageRenderTime 67ms CodeModel.GetById 22ms app.highlight 38ms RepoModel.GetById 1ms app.codeStats 0ms

/vp_plugins/global/mytypes.h

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