00001
00004 #ifndef BPS_H
00005 #define BPS_H
00006
00007 #include "bpscore_global.h"
00008 #include <QVariant>
00009 #include <QDateTime>
00010 #include <QModelIndex>
00011
00012 #define ASCII_NUL char(0) ///< null
00013 #define ASCII_SOH char(1) ///< start of heading
00014 #define ASCII_STX char(2) ///< start of text
00015 #define ASCII_ETX char(3) ///< end of text
00016 #define ASCII_EOT char(4) ///< end of transmission
00017 #define ASCII_ENQ char(5) ///< inquiry
00018 #define ASCII_ACK char(6) ///< acknowledge
00019 #define ASCII_BEL char(7) ///< bell
00020 #define ASCII_BS char(8) ///< backspace
00021 #define ASCII_HT char(9) ///< horizontal tab
00022 #define ASCII_LF char(10) ///< line feed (new line)
00023 #define ASCII_VT char(11) ///< vertical tab
00024 #define ASCII_FF char(12) ///< form feed (new page)
00025 #define ASCII_CR char(13) ///< carriage return
00026 #define ASCII_SO char(14) ///< shift out
00027 #define ASCII_SI char(15) ///< shift in
00028 #define ASCII_DLE char(16) ///< data link escape
00029 #define ASCII_DC1 char(17) ///< device control 1
00030 #define ASCII_DC2 char(18) ///< device control 2
00031 #define ASCII_DC3 char(19) ///< device control 3
00032 #define ASCII_DC4 char(20) ///< device control 4
00033 #define ASCII_NAK char(21) ///< negative acknowledge
00034 #define ASCII_SYN char(22) ///< synchronous idle
00035 #define ASCII_ETB char(23) ///< end of transmission block
00036 #define ASCII_CAN char(24) ///< cancel
00037 #define ASCII_EM char(25) ///< end of medium
00038 #define ASCII_SUB char(26) ///< substitute
00039 #define ASCII_ESC char(27) ///< escape
00040 #define ASCII_FS char(28) ///< file separator
00041 #define ASCII_GS char(29) ///< group separator
00042 #define ASCII_RS char(30) ///< record separator
00043 #define ASCII_US char(31) ///< unit separator
00044
00045 class BpsDatastore;
00046
00051 #define bps Bps::instance()
00052
00056 class BPSCORE_EXPORT Bps : public QObject
00057 {
00058 Q_OBJECT
00059 BPS_PRIVATE(Bps)
00060
00061 private:
00063 Bps(QObject* aParent = 0);
00064 Bps(const Bps& aBps);
00065 Bps& operator=(const Bps& aBps);
00066 virtual ~Bps();
00068
00069 public:
00073 static Bps* instance();
00074
00078 enum ItemDataRole {
00083 RoleSort = Qt::UserRole+100000,
00084
00089 RoleFractionDigits = Qt::UserRole+100001
00090 };
00091
00095 enum Access {
00096 AccessNone = 0,
00097 AccessReadOnly = 1,
00098 AccessReadWrite = 2
00099 };
00100
00104 enum HorizontalAlignment {
00105 AlignLeft = 0,
00106 AlignCenter = 1,
00107 AlignRight = 2
00108 };
00109
00113 enum VerticalAlignment {
00114 AlignTop = 0,
00115 AlignMiddle = 1,
00116 AlignBottom = 2
00117 };
00118
00122 enum Alignment {
00123 AlignTopLeft = 0,
00124 AlignTopCenter = 1,
00125 AlignTopRight = 2,
00126 AlignMiddleLeft = 3,
00127 AlignMiddleCenter = 4,
00128 AlignMiddleRight = 5,
00129 AlignBottomLeft = 6,
00130 AlignBottomCenter = 7,
00131 AlignBottomRight = 8
00132 };
00133
00137 enum Direction {
00138 DirectionEast = 0,
00139 DirectionSouth = 1,
00140 DirectionWest = 2,
00141 DirectionNorth = 3
00142 };
00143
00147 enum Rotation {
00148 Rotation0 = 0,
00149 Rotation90 = 1,
00150 Rotation180 = 2,
00151 Rotation270 = 3
00152 };
00153
00163 enum Barcode {
00164
00165 BarcodeEAN13 = 0,
00166 BarcodeEAN8 = 1,
00167 BarcodeUPCA = 2,
00168 BarcodeUPCE0 = 3,
00169 BarcodeUPCE1 = 4,
00170 BarcodeSUPPL2 = 5,
00171 BarcodeSUPPL5 = 6,
00172
00173
00174 Barcode39 = 7,
00175 Barcode39C = 8,
00176 Barcode39E = 9,
00177 Barcode39EC = 10,
00178
00179
00180 Barcode2of5 = 11,
00181 Barcode2of5C = 12,
00182
00183
00184 Barcode128 = 13,
00185 Barcode128S = 14,
00186 Barcode128R = 15,
00187 BarcodeEAN128 = 16,
00188 BarcodeEAN128S = 17,
00189
00190
00191 BarcodeRSS14 = 18,
00192 BarcodeRSS14S = 19,
00193 BarcodeRSS14SO = 20,
00194 BarcodeRSSLIM = 21
00195 };
00196
00200 void clearCache();
00201
00208 void sleep(int aSeconds) const;
00209
00216 void msleep(int aMilliseconds) const;
00217
00222 void usleep(int aMicroseconds) const;
00223
00229 void wait(int aSeconds) const;
00230
00236 void mwait(int aMilliseconds) const;
00237
00244 int encryptPin(int aUserid, int aPin) const;
00245
00252 int decryptPin(int aUserid, int aPin) const;
00253
00260 QString personalFolder() const;
00261
00295 QString directory(const QString& aName = QString()) const;
00296
00305 QString loadStyleSheet(const QString& aFilename) const;
00306
00310 int screenResolution() const;
00311
00315 qreal mm2dot() const;
00316
00320 qreal dot2mm() const;
00321
00328 qreal round(qreal aValue, int aDigits = 3) const;
00329
00347 QString toString(double aValue, int aFractionalDigits = 3) const;
00348
00359 bool isStrictlyEqual(const QVariant& aFirst, const QVariant& aSecond) const;
00360
00368 bool isEqual(const QVariant& aFirst, const QVariant& aSecond) const;
00369
00378 QString nodeName() const;
00379
00387 QString computerName() const;
00388
00396 QString terminalName() const;
00397
00403 QString userName() const;
00404
00410 QString printerShareName(const QString& aPrinterName) const;
00411
00422 bool printFile(const QString& aPrinterName, const QString& aDocName, const QString& aFileName) const;
00423
00435 QString createTempFile(const QString& aTemplate = QString()) const;
00436
00440 QStringList accessTexts() const;
00441
00445 QStringList alignmentTexts() const;
00446
00450 QStringList barcodeTexts() const;
00451
00455 QStringList directionTexts() const;
00456
00463 QString userStatusPath() const;
00464
00469 void setUserStatusPath(const QString& aPath);
00470
00474 QBrush invalidInputBackgroundBrush() const;
00475
00476
00483 static int modelIndexLevel(const QModelIndex& aIndex);
00484
00499 static bool treeModelIndexLessThan(const QModelIndex& aFirst, const QModelIndex& aSecond);
00500
00515 static bool treeModelIndexGreaterThan(const QModelIndex& aFirst, const QModelIndex& aSecond);
00516
00523 static QModelIndexList topIndexes(const QModelIndexList& aIndexes);
00524
00531 static QModelIndexList bottomIndexes(const QModelIndexList& aIndexes);
00532
00538 void emitTableChanged(const QString& aTable);
00539
00545 void emitMasterTableChanged(const QString& aTable);
00546
00567 QDateTime makeDateTime(const QString& aDateTime);
00568
00569
00580 QVariant validatorValue(BpsDatastore* aDatastore, const QString& aTable, const QString& aKey, const QVariant& aDefValue = QVariant());
00581
00590 QString trimMultilineText(BpsDatastore* aDatastore, const QString& aTable, const QString& aColumn, const QString& aText);
00591
00604 bool isElevated();
00605
00612 QMap<QString,QString> lowerKeyStringMap(const QMap<QString,QString>& aStringMap);
00613
00620 QMap<QString,QString> lowerKeyStringMap(const QVariantMap& aVariantMap);
00621
00628 QMap<QString,QString> toStringMap(const QVariantMap& aVariantMap);
00629
00636 QVariantMap toVariantMap(const QMap<QString,QString>& aStringMap);
00637
00652 QString stripTimeFormat(const QString& aDateTimeFormat);
00653
00654 signals:
00655
00659 void tableChanged(const QString& aTable);
00660
00664 void masterTableChanged(const QString& aTable);
00665 };
00666
00667 #endif // BPS_H