summaryrefslogtreecommitdiffstats
path: root/kplato/kptduration.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kplato/kptduration.cc')
-rw-r--r--kplato/kptduration.cc54
1 files changed, 27 insertions, 27 deletions
diff --git a/kplato/kptduration.cc b/kplato/kptduration.cc
index 384ac754b..4da4aaffa 100644
--- a/kplato/kptduration.cc
+++ b/kplato/kptduration.cc
@@ -24,7 +24,7 @@
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
-#include <qregexp.h>
+#include <tqregexp.h>
namespace KPlato
{
@@ -42,13 +42,13 @@ Duration::Duration(const Duration &d) {
Duration::Duration(unsigned d, unsigned h, unsigned m, unsigned s, unsigned ms) {
m_ms = ms;
- m_ms += static_cast<Q_INT64>(s) * 1000; // cast to avoid potential overflow problem
- m_ms += static_cast<Q_INT64>(m) * 60 * 1000;
- m_ms += static_cast<Q_INT64>(h) * 60 * 60 * 1000;
- m_ms += static_cast<Q_INT64>(d) * 24 * 60 * 60 * 1000;
+ m_ms += static_cast<TQ_INT64>(s) * 1000; // cast to avoid potential overflow problem
+ m_ms += static_cast<TQ_INT64>(m) * 60 * 1000;
+ m_ms += static_cast<TQ_INT64>(h) * 60 * 60 * 1000;
+ m_ms += static_cast<TQ_INT64>(d) * 24 * 60 * 60 * 1000;
}
-Duration::Duration(Q_INT64 seconds) {
+Duration::Duration(TQ_INT64 seconds) {
m_ms = seconds * 1000;
}
@@ -59,8 +59,8 @@ void Duration::add(const Duration &delta) {
m_ms += delta.m_ms;
}
-void Duration::add(Q_INT64 delta) {
- Q_INT64 tmp = m_ms + delta;
+void Duration::add(TQ_INT64 delta) {
+ TQ_INT64 tmp = m_ms + delta;
if (tmp < 0) {
kdDebug()<<k_funcinfo<<"Underflow"<<(long int)delta<<" from "<<this->toString()<<endl;
m_ms = 0;
@@ -102,7 +102,7 @@ Duration Duration::operator/(int unit) const {
Duration Duration::operator*(const double value) const {
Duration dur(*this);
- dur.m_ms = QABS(m_ms * (Q_INT64)value);
+ dur.m_ms = TQABS(m_ms * (TQ_INT64)value);
return dur;
}
@@ -114,33 +114,33 @@ double Duration::operator/(const Duration &d) const {
return (double)(m_ms) / (double)(d.m_ms);
}
-QString Duration::toString(Format format) const {
- Q_INT64 ms;
+TQString Duration::toString(Format format) const {
+ TQ_INT64 ms;
double days;
unsigned hours;
unsigned minutes;
unsigned seconds;
double f;
- QString result;
+ TQString result;
switch (format) {
case Format_Hour:
ms = m_ms;
hours = ms / (1000 * 60 * 60);
- ms -= (Q_INT64)hours * (1000 * 60 * 60);
+ ms -= (TQ_INT64)hours * (1000 * 60 * 60);
minutes = ms / (1000 * 60);
- result = QString("%1h%2m").arg(hours).arg(minutes);
+ result = TQString("%1h%2m").tqarg(hours).tqarg(minutes);
break;
case Format_Day:
days = m_ms / (1000 * 60 * 60 * 24.0);
- result = QString("%1d").arg(QString::number(days, 'f', 4));
+ result = TQString("%1d").tqarg(TQString::number(days, 'f', 4));
break;
case Format_DayTime:
ms = m_ms;
days = m_ms / (1000 * 60 * 60 * 24);
- ms -= (Q_INT64)days * (1000 * 60 * 60 * 24);
+ ms -= (TQ_INT64)days * (1000 * 60 * 60 * 24);
hours = ms / (1000 * 60 * 60);
- ms -= (Q_INT64)hours * (1000 * 60 * 60);
+ ms -= (TQ_INT64)hours * (1000 * 60 * 60);
minutes = ms / (1000 * 60);
ms -= minutes * (1000 * 60);
seconds = ms / (1000);
@@ -154,9 +154,9 @@ QString Duration::toString(Format format) const {
case Format_i18nHour:
ms = m_ms;
hours = ms / (1000 * 60 * 60);
- ms -= (Q_INT64)hours * (1000 * 60 * 60);
+ ms -= (TQ_INT64)hours * (1000 * 60 * 60);
minutes = ms / (1000 * 60);
- result = i18n("<hours>h:<minutes>m", "%1h:%2m").arg(hours).arg(minutes);
+ result = i18n("<hours>h:<minutes>m", "%1h:%2m").tqarg(hours).tqarg(minutes);
break;
case Format_i18nDay:
result = KGlobal::locale()->formatNumber(toDouble(Unit_d), 2);
@@ -164,9 +164,9 @@ QString Duration::toString(Format format) const {
case Format_i18nDayTime:
ms = m_ms;
days = m_ms / (1000 * 60 * 60 * 24);
- ms -= (Q_INT64)days * (1000 * 60 * 60 * 24);
+ ms -= (TQ_INT64)days * (1000 * 60 * 60 * 24);
hours = ms / (1000 * 60 * 60);
- ms -= (Q_INT64)hours * (1000 * 60 * 60);
+ ms -= (TQ_INT64)hours * (1000 * 60 * 60);
minutes = ms / (1000 * 60);
ms -= minutes * (1000 * 60);
seconds = ms / (1000);
@@ -174,7 +174,7 @@ QString Duration::toString(Format format) const {
if (days == 0) {
result = toString(Format_i18nHour);
} else {
- result = i18n("<days>d <hours>h:<minutes>m", "%1d %2h:%3m").arg(days).arg(hours).arg(minutes);
+ result = i18n("<days>d <hours>h:<minutes>m", "%1d %2h:%3m").tqarg(days).tqarg(hours).tqarg(minutes);
}
break;
case Format_i18nHourFraction:
@@ -187,9 +187,9 @@ QString Duration::toString(Format format) const {
return result;
}
-Duration::Duration Duration::fromString(const QString &s, Format format, bool *ok) {
+Duration::Duration Duration::fromString(const TQString &s, Format format, bool *ok) {
if (ok) *ok = false;
- QRegExp matcher;
+ TQRegExp matcher;
Duration tmp;
switch (format) {
case Format_Hour: {
@@ -221,7 +221,7 @@ Duration::Duration Duration::fromString(const QString &s, Format format, bool *o
double f = KGlobal::locale()->readNumber(s, &res);
if (ok) *ok = res;
if (res) {
- return Duration((Q_INT64)(f*3600.0));
+ return Duration((TQ_INT64)(f*3600.0));
}
break;
}
@@ -233,8 +233,8 @@ Duration::Duration Duration::fromString(const QString &s, Format format, bool *o
}
void Duration::get(unsigned *days, unsigned *hours, unsigned *minutes, unsigned *seconds, unsigned *milliseconds) const {
- Q_INT64 ms;
- Q_INT64 tmp;
+ TQ_INT64 ms;
+ TQ_INT64 tmp;
ms = m_ms;
tmp = ms / (1000 * 60 * 60 * 24);