Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLUtil.h 00003 ------------------- 00004 begin : Sun Jan 27 2002 00005 copyright : (C) 2002-2005 by InfoSiAL S.L., 00006 Eloy Orduña González, Andrés Otón Urbano 00007 email : mail@infosial.com 00008 ***************************************************************************/ 00009 /*************************************************************************** 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; version 2 of the License. * 00013 ***************************************************************************/ 00014 /*************************************************************************** 00015 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00016 bajo los términos de la Licencia Pública General de GNU en su 00017 versión 2, publicada por la Free Software Foundation. 00018 ***************************************************************************/ 00019 00020 #ifndef FLUTIL_H 00021 #define FLUTIL_H 00022 00023 #include <qapplication.h> 00024 #include <qvariant.h> 00025 #include <qdict.h> 00026 00027 class QDomDocument; 00028 class QProgressDialog; 00029 class QDate; 00030 class FLSqlCursor; 00031 class FLSqlQuery; 00032 00044 class FLUtil 00045 { 00046 00047 public: 00048 00058 static Q_ULLONG partInteger(double n); 00059 00069 static Q_ULLONG partDecimal(double n); 00070 00076 static QString unidades(long n); 00077 00084 static QCString utf8(const QString &s); 00085 00091 static QString centenamillar(long n); 00092 00098 static QString decenas(long n); 00099 00105 static QString centenas(long n); 00106 00112 static QString unidadesmillar(long n); 00113 00119 static QString decenasmillar(long n); 00120 00131 static QString enLetra(long n); 00132 00145 static QString enLetraMoneda(double n, const QString &m); 00146 00158 static QString enLetraMonedaEuro(double n); 00159 00166 static QChar letraDni(long n); 00167 00175 static QStringList nombreCampos(const QString &tabla); 00176 00195 static QChar calcularDC(const QString &n); 00196 00204 static QString dateDMAtoAMD(const QString &f); 00205 00213 static QString dateAMDtoDMA(const QString &f); 00214 00224 static QString formatoMiles(const QString &s); 00225 00236 static QString translate(const QString &contexto, const QString &s) { 00237 return qApp->translate(contexto, s); 00238 } 00239 00248 static bool numCreditCard(const QString &num); 00249 00266 static QVariant nextCounter(const QString &name, FLSqlCursor *cursor_); 00267 00283 static QString nextSequence(int nivel, const QString &secuencia, const QString &ultimo); 00284 00296 static bool isFLDefFile(const QString &head); 00297 00305 static QDate addDays(const QDate &d, int nd); 00306 00314 static QDate addMonths(const QDate &d, int nm); 00315 00323 static QDate addYears(const QDate &d, int ny); 00324 00332 static int daysTo(const QDate &d1, const QDate &d2); 00333 00343 static QString buildNumber(const QVariant &v, char tipo, int partDecimal); 00344 00354 static QVariant readSettingEntry(const QString &key, const QString &def = QString::null, bool *ok = 0); 00355 00364 static bool writeSettingEntry(const QString &key, const QString &value); 00365 00373 static QVariant readDBSettingEntry(const QString &key); 00374 00383 static bool writeDBSettingEntry(const QString &key, const QString &value); 00384 00394 static QString roundFieldValue(const QVariant &n, const QString &table, const QString &field); 00395 00407 static QVariant sqlSelect(const QString &f, const QString &s, const QString &w, 00408 const QString &tL = QString::null, 00409 int *size = 0, const QString &connName = "default"); 00410 00415 static QVariant quickSqlSelect(const QString &f, const QString &s, const QString &w, 00416 const QString &connName = "default"); 00417 00427 static bool sqlInsert(const QString &t, const QString &fL, const QString &vL, const QString &connName = "default"); 00428 00439 static bool sqlUpdate(const QString &t, const QString &fL, const QString &vL, const QString &w, const QString &connName = "default"); 00440 00449 static bool sqlDelete(const QString &t, const QString &w, const QString &connName = "default"); 00450 00455 static bool quickSqlDelete(const QString &t, const QString &w, const QString &connName = "default"); 00456 00463 static void createProgressDialog(const QString &l, int tS, const QString &id = "default"); 00464 00468 static void destroyProgressDialog(const QString &id = "default"); 00469 00475 static void setProgress(int p, const QString &id = "default"); 00476 00482 static void setLabelText(const QString &l, const QString &id = "default"); 00483 00489 static void setTotalSteps(int tS, const QString &id = "default"); 00490 00501 static bool domDocumentSetContent(QDomDocument &doc, const QString &content); 00502 00509 static QString sha1(const QString &str); 00510 static QString usha1(uchar *data, uint len); 00511 00517 static QImage snapShotUI(const QString &n); 00518 00525 static void saveSnapShotUI(const QString &n, const QString &pathFile); 00526 00533 static QVariant::Type flDecodeType(int fltype); 00534 00541 static void saveIconFile(const QString &data, const QString &pathFile); 00542 00548 static QString getIdioma(); 00549 00555 static QString getOS(); 00556 00563 static QString serialLettertoNumber(const QString &letter); 00564 00570 static QString serialNumbertoLetter(int number); 00571 00597 static QStringList findFiles(const QStringList &paths, const QString &filter = "*", 00598 bool breakOnFirstMatch = false); 00599 00603 static bool execSql(const QString &sql, const QString &connName = "default"); 00604 00605 private: 00606 00610 static QDict<QProgressDialog> dictProgressD_; 00611 00615 static const char *vecUnidades[]; 00616 00620 static const char *vecDecenas[]; 00621 00625 static const char *vecCentenas[]; 00626 }; 00627 00628 #endif