13 #ifndef MAGICSMOKE_MISC_H
14 #define MAGICSMOKE_MISC_H
18 #include <QStringList>
22 #include <MOServerFormat>
25 #ifndef MSIFACE_EXPORT
26 #define MSIFACE_EXPORT Q_DECL_IMPORT
104 DECLARE_SHARED_DPTR(d);
122 virtual void setWeekDays(
const QStringList&l=QStringList());
124 virtual void setShortWeekDays(
const QStringList&l=QStringList());
127 virtual void setMonths(
const QStringList&l=QStringList());
129 virtual void setShortMonths(
const QStringList&l=QStringList());
136 virtual void setMoneyFormat(QString currency=QString(),
int digitsCents=2,
bool symbolBehind=
true);
149 virtual void setNumberFormat(QChar decimal=QChar(),QChar thousandDiv=QChar(),
int digitsDiv=-1);
152 virtual void setAP(QString am=
"--",QString pm=
"--");
156 virtual void setTimeZone(QString olsonname);
159 virtual void setDateTimeFormat(QString dateformat=QString(),QString timeformat=QString(),QString datetimeformat=QString());
162 virtual QString timeZone()
const;
165 virtual void setNonLocalized();
170 virtual QString formatDate(
const QDate&date,QString format=QString())
const;
174 virtual QString formatDate(qint64 date,QString format=QString())
const;
178 virtual QString formatDate(
const TimeStamp& date,QString format=QString())
const;
183 virtual QString formatTime(
const QTime&time,QString format=QString())
const;
187 virtual QString formatTime(qint64 time,QString format=QString())
const;
191 virtual QString formatTime(
const TimeStamp& time,QString format=QString())
const;
196 virtual QString formatDateTime(
const QDateTime&time,QString format=QString())
const;
200 virtual QString formatDateTime(qint64 time,QString format=QString())
const;
204 virtual QString formatDateTime(
const TimeStamp&time,QString format=QString())
const;
208 virtual QString formatNumber(qint64)
const;
217 virtual QString formatNumber(
double num,uint decimals=4)
const;
222 ShowCurrencySymbol=2,
224 DefaultFormat=UseThousand|ShowCurrencySymbol
226 Q_DECLARE_FLAGS(MoneyFlags,MoneyFlag);
231 virtual QString formatMoney(qint64 num,MoneyFlags flags=DefaultFormat)
const;
235 virtual QString formatMoney(qint64 num,
bool usethousand)
const;
238 virtual qint64 scanInt(QString)
const;
241 virtual qint64 scanMoney(QString)
const;
244 virtual double scanFloat(QString)
const;
247 QStringList weekDayNames()
const;
249 QStringList shortWeekDayNames()
const;
252 QStringList monthNames()
const;
254 QStringList shortMonthNames()
const;
257 QString currency()
const;
260 QChar decimalDot()
const;
263 QString thousandSeparator()
const;
266 int thousandDigits()
const;
269 int moneyDecimals()
const;
272 QString amText()
const;
274 QString pmText()
const;
277 QString moneyNegativeSign()
const;
279 QString moneyPositiveSign()
const;
284 QRegExp moneyRegExp(
bool allownegative=
false,
bool allowcurrency=
false)
const;
287 QString dateFormat()
const;
290 QString timeFormat()
const;
293 QString dateTimeFormat()
const;
QString MSIFACE_EXPORT currentDir()
returns the current directory (the one last used in a file dialog)
Definition: misc.cpp:724
QRegExp MSIFACE_EXPORT priceRegExp(bool localize=true)
return a (localized) regular expression that validates prices
Definition: misc.cpp:87
#define MSIFACE_EXPORT
Definition: misc.h:26
QString MSIFACE_EXPORT xmlize(QString str, QString newline="\n")
converts special XML characters into harmless &-codes, so the text can be included ...
Definition: misc.cpp:43
Q_DECLARE_OPERATORS_FOR_FLAGS(MLocalFormat::MoneyFlags)
QString MSIFACE_EXPORT cent2str(qint64 cent, bool localize=true)
converts a cent value into a (localized) string
Definition: misc.cpp:73
qint64 MSIFACE_EXPORT str2cent(QString s, bool fromlocal=true)
converts a (localized) string back into a cent value (must not contain spaces or extra dots) ...
Definition: misc.cpp:80
QString MSIFACE_EXPORT unix2dateTime(qint64, bool localize=true)
converts a unix timestamp into a date-time-string
Definition: misc.cpp:108
QString MSIFACE_EXPORT unix2date(qint64, bool localize=true)
converts a unix timestamp into a date
Definition: misc.cpp:94
QString MSIFACE_EXPORT unix2time(qint64, bool localize=true)
converts a unix timestamp into a time (ommitting the date)
Definition: misc.cpp:101
QString MSIFACE_EXPORT htmlize(QString str)
converts special HTML characters into harmless &-codes, so the text can be included ...
Definition: misc.cpp:27
void MSIFACE_EXPORT setCurrentDir(QString)
sets a new current directory (transparently handles files and directories)
Definition: misc.cpp:729