summaryrefslogtreecommitdiffstats
path: root/kplato/kptappointment.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kplato/kptappointment.cc')
-rw-r--r--kplato/kptappointment.cc120
1 files changed, 60 insertions, 60 deletions
diff --git a/kplato/kptappointment.cc b/kplato/kptappointment.cc
index 897ab390..f09b4bcc 100644
--- a/kplato/kptappointment.cc
+++ b/kplato/kptappointment.cc
@@ -77,10 +77,10 @@ Duration AppointmentInterval::effort(const DateTime &time, bool upto) const {
return (m_end - s) * m_load / 100;
}
-bool AppointmentInterval::loadXML(QDomElement &element) {
+bool AppointmentInterval::loadXML(TQDomElement &element) {
//kdDebug()<<k_funcinfo<<endl;
bool ok;
- QString s = element.attribute("start");
+ TQString s = element.attribute("start");
if (s != "")
m_start = DateTime::fromString(s);
s = element.attribute("end");
@@ -91,8 +91,8 @@ bool AppointmentInterval::loadXML(QDomElement &element) {
return m_start.isValid() && m_end.isValid();
}
-void AppointmentInterval::saveXML(QDomElement &element) const {
- QDomElement me = element.ownerDocument().createElement("interval");
+void AppointmentInterval::saveXML(TQDomElement &element) const {
+ TQDomElement me = element.ownerDocument().createElement("interval");
element.appendChild(me);
me.setAttribute("start", m_start.toString(Qt::ISODate));
@@ -155,12 +155,12 @@ AppointmentInterval AppointmentInterval::firstInterval(const AppointmentInterval
//////
-Appointment::UsedEffortItem::UsedEffortItem(QDate date, Duration effort, bool overtime) {
+Appointment::UsedEffortItem::UsedEffortItem(TQDate date, Duration effort, bool overtime) {
m_date = date;
m_effort = effort;
m_overtime = overtime;
}
-QDate Appointment::UsedEffortItem::date() {
+TQDate Appointment::UsedEffortItem::date() {
return m_date;
}
Duration Appointment::UsedEffortItem::effort() {
@@ -174,14 +174,14 @@ Appointment::UsedEffort::UsedEffort() {
setAutoDelete(true);
}
-void Appointment::UsedEffort::inSort(QDate date, Duration effort, bool overtime) {
+void Appointment::UsedEffort::inSort(TQDate date, Duration effort, bool overtime) {
UsedEffortItem *item = new UsedEffortItem(date, effort, overtime);
- QPtrList<UsedEffortItem>::inSort(item);
+ TQPtrList<UsedEffortItem>::inSort(item);
}
Duration Appointment::UsedEffort::usedEffort(bool includeOvertime) const {
Duration eff;
- QPtrListIterator<UsedEffortItem> it(*this);
+ TQPtrListIterator<UsedEffortItem> it(*this);
for (; it.current(); ++it) {
if (includeOvertime || !it.current()->isOvertime()) {
eff += it.current()->effort();
@@ -190,9 +190,9 @@ Duration Appointment::UsedEffort::usedEffort(bool includeOvertime) const {
return eff;
}
-Duration Appointment::UsedEffort::usedEffort(const QDate &date, bool includeOvertime) const {
+Duration Appointment::UsedEffort::usedEffort(const TQDate &date, bool includeOvertime) const {
Duration eff;
- QPtrListIterator<UsedEffortItem> it(*this);
+ TQPtrListIterator<UsedEffortItem> it(*this);
for (; it.current(); ++it) {
if ((includeOvertime || !it.current()->isOvertime()) &&
it.current()->date() == date) {
@@ -202,9 +202,9 @@ Duration Appointment::UsedEffort::usedEffort(const QDate &date, bool includeOver
return eff;
}
-Duration Appointment::UsedEffort::usedEffortTo(const QDate &date, bool includeOvertime) const {
+Duration Appointment::UsedEffort::usedEffortTo(const TQDate &date, bool includeOvertime) const {
Duration eff;
- QPtrListIterator<UsedEffortItem> it(*this);
+ TQPtrListIterator<UsedEffortItem> it(*this);
for (; it.current(); ++it) {
if ((includeOvertime || !it.current()->isOvertime()) &&
it.current()->date() <= date) {
@@ -219,9 +219,9 @@ Duration Appointment::UsedEffort::usedOvertime() const {
return item==0 ? Duration::zeroDuration : usedOvertime(item->date());
}
-Duration Appointment::UsedEffort::usedOvertime(const QDate &date) const {
+Duration Appointment::UsedEffort::usedOvertime(const TQDate &date) const {
Duration eff;
- QPtrListIterator<UsedEffortItem> it(*this);
+ TQPtrListIterator<UsedEffortItem> it(*this);
for (; it.current(); ++it) {
if (it.current()->isOvertime() && it.current()->date() == date) {
eff += it.current()->effort();
@@ -230,9 +230,9 @@ Duration Appointment::UsedEffort::usedOvertime(const QDate &date) const {
return eff;
}
-Duration Appointment::UsedEffort::usedOvertimeTo(const QDate &date) const {
+Duration Appointment::UsedEffort::usedOvertimeTo(const TQDate &date) const {
Duration eff;
- QPtrListIterator<UsedEffortItem> it(*this);
+ TQPtrListIterator<UsedEffortItem> it(*this);
for (; it.current(); ++it) {
if (it.current()->isOvertime() && it.current()->date() <= date) {
eff += it.current()->effort();
@@ -241,17 +241,17 @@ Duration Appointment::UsedEffort::usedOvertimeTo(const QDate &date) const {
return eff;
}
-bool Appointment::UsedEffort::load(QDomElement &element) {
- QString s;
- QDomNodeList list = element.childNodes();
+bool Appointment::UsedEffort::load(TQDomElement &element) {
+ TQString s;
+ TQDomNodeList list = element.childNodes();
for (unsigned int i=0; i<list.count(); ++i) {
if (list.item(i).isElement()) {
- QDomElement e = list.item(i).toElement();
+ TQDomElement e = list.item(i).toElement();
if (e.tagName() == "actual-effort") {
- QDate date;
+ TQDate date;
s = e.attribute("date");
if (s != "")
- date = QDate::fromString(s, Qt::ISODate);
+ date = TQDate::fromString(s, Qt::ISODate);
Duration eff = Duration::fromString(e.attribute("effort"));
bool ot = e.attribute("overtime", "0").toInt();
if (date.isValid()) {
@@ -265,11 +265,11 @@ bool Appointment::UsedEffort::load(QDomElement &element) {
return true;
}
-void Appointment::UsedEffort::save(QDomElement &element) const {
+void Appointment::UsedEffort::save(TQDomElement &element) const {
if (isEmpty()) return;
- QPtrListIterator<UsedEffortItem> it = *this;
+ TQPtrListIterator<UsedEffortItem> it = *this;
for (; it.current(); ++it) {
- QDomElement me = element.ownerDocument().createElement("actual-effort");
+ TQDomElement me = element.ownerDocument().createElement("actual-effort");
element.appendChild(me);
me.setAttribute("date",it.current()->date().toString(Qt::ISODate));
me.setAttribute("effort",it.current()->effort().toString());
@@ -277,9 +277,9 @@ void Appointment::UsedEffort::save(QDomElement &element) const {
}
}
-int Appointment::UsedEffort::compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2) {
- QDate d1 = static_cast<UsedEffortItem*>(item1)->date();
- QDate d2 = static_cast<UsedEffortItem*>(item2)->date();
+int Appointment::UsedEffort::compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2) {
+ TQDate d1 = static_cast<UsedEffortItem*>(item1)->date();
+ TQDate d2 = static_cast<UsedEffortItem*>(item2)->date();
if (d1 > d2) return 1;
if (d1 < d2) return -1;
return 0;
@@ -344,7 +344,7 @@ void Appointment::addInterval(const DateTime &start, const Duration &duration, d
double Appointment::maxLoad() const {
double v = 0.0;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
if (v < it.current()->load())
v = it.current()->load();
@@ -354,7 +354,7 @@ double Appointment::maxLoad() const {
DateTime Appointment::startTime() const {
DateTime t;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
if (!t.isValid() || t > it.current()->startTime())
t = it.current()->startTime();
@@ -364,7 +364,7 @@ DateTime Appointment::startTime() const {
DateTime Appointment::endTime() const {
DateTime t;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
if (!t.isValid() || t < it.current()->endTime())
t = it.current()->endTime();
@@ -382,9 +382,9 @@ bool Appointment::isBusy(const DateTime &/*start*/, const DateTime &/*end*/) {
return false;
}
-bool Appointment::loadXML(QDomElement &element, Project &project, Schedule &sch) {
+bool Appointment::loadXML(TQDomElement &element, Project &project, Schedule &sch) {
//kdDebug()<<k_funcinfo<<endl;
- QDictIterator<Node> it = project.nodeDict();
+ TQDictIterator<Node> it = project.nodeDict();
/* for (; it.current(); ++it) {
kdDebug()<<" Node="<<it.current()->name()<<" id="<<it.currentKey()<<endl;
}*/
@@ -408,10 +408,10 @@ bool Appointment::loadXML(QDomElement &element, Project &project, Schedule &sch)
return false;
}
//kdDebug()<<k_funcinfo<<"res="<<m_resource<<" node="<<m_node<<endl;
- QDomNodeList list = element.childNodes();
+ TQDomNodeList list = element.childNodes();
for (unsigned int i=0; i<list.count(); ++i) {
if (list.item(i).isElement()) {
- QDomElement e = list.item(i).toElement();
+ TQDomElement e = list.item(i).toElement();
if (e.tagName() == "interval") {
AppointmentInterval *a = new AppointmentInterval();
if (a->loadXML(e)) {
@@ -430,7 +430,7 @@ bool Appointment::loadXML(QDomElement &element, Project &project, Schedule &sch)
return true;
}
-void Appointment::saveXML(QDomElement &element) const {
+void Appointment::saveXML(TQDomElement &element) const {
if (m_intervals.isEmpty()) {
kdError()<<k_funcinfo<<"Incomplete appointment data: No intervals"<<endl;
}
@@ -443,12 +443,12 @@ void Appointment::saveXML(QDomElement &element) const {
return; // shouldn't happen
}
//kdDebug()<<k_funcinfo<<endl;
- QDomElement me = element.ownerDocument().createElement("appointment");
+ TQDomElement me = element.ownerDocument().createElement("appointment");
element.appendChild(me);
me.setAttribute("resource-id", m_resource->resource()->id());
me.setAttribute("task-id", m_node->node()->id());
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
it.current()->saveXML(me);
}
@@ -458,7 +458,7 @@ void Appointment::saveXML(QDomElement &element) const {
// Returns the total actual effort for this appointment
Duration Appointment::plannedEffort() const {
Duration d;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
d += it.current()->effort();
}
@@ -466,11 +466,11 @@ Duration Appointment::plannedEffort() const {
}
// Returns the planned effort on the date
-Duration Appointment::plannedEffort(const QDate &date) const {
+Duration Appointment::plannedEffort(const TQDate &date) const {
Duration d;
DateTime s(date);
DateTime e(date.addDays(1));
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
d += it.current()->effort(s, e);
}
@@ -478,10 +478,10 @@ Duration Appointment::plannedEffort(const QDate &date) const {
}
// Returns the planned effort upto and including the date
-Duration Appointment::plannedEffortTo(const QDate& date) const {
+Duration Appointment::plannedEffortTo(const TQDate& date) const {
Duration d;
DateTime e(date.addDays(1));
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
d += it.current()->effort(e, true);
}
@@ -490,7 +490,7 @@ Duration Appointment::plannedEffortTo(const QDate& date) const {
// Returns a list of efforts pr day for interval start, end inclusive
// The list only includes days with any planned effort
-EffortCostMap Appointment::plannedPrDay(const QDate& start, const QDate& end) const {
+EffortCostMap Appointment::plannedPrDay(const TQDate& start, const TQDate& end) const {
//kdDebug()<<k_funcinfo<<m_node->id()<<", "<<m_resource->id()<<endl;
EffortCostMap ec;
Duration eff;
@@ -506,14 +506,14 @@ EffortCostMap Appointment::plannedPrDay(const QDate& start, const QDate& end) co
if (dt.date() < st.date()) {
dt.setDate(st.date());
}
- ndt = dt.addDays(1);
+ ndt = TQDateTime(dt.addDays(1));
while (dt.date() <= e.date()) {
eff = it.current()->effort(dt, ndt);
ec.add(dt.date(), eff, eff.toDouble(Duration::Unit_h) * rate);
if (dt.date() < e.date() ) {
// loop trough the interval (it spans dates)
dt = ndt;
- ndt = ndt.addDays(1);
+ ndt = TQDateTime(ndt.addDays(1));
} else {
break;
}
@@ -529,12 +529,12 @@ Duration Appointment::actualEffort() const {
}
// Returns the actual effort on the date
-Duration Appointment::actualEffort(const QDate &date) const {
+Duration Appointment::actualEffort(const TQDate &date) const {
return m_actualEffort.usedEffort(date);
}
// Returns the actual effort upto and including date
-Duration Appointment::actualEffortTo(const QDate &date) const {
+Duration Appointment::actualEffortTo(const TQDate &date) const {
return m_actualEffort.usedEffortTo(date);
}
@@ -546,7 +546,7 @@ double Appointment::plannedCost() {
}
//Calculates the planned cost on date
-double Appointment::plannedCost(const QDate &date) {
+double Appointment::plannedCost(const TQDate &date) {
if (m_resource && m_resource->resource()) {
return plannedEffort(date).toDouble(Duration::Unit_h) * m_resource->resource()->normalRate(); //FIXME overtime
}
@@ -554,7 +554,7 @@ double Appointment::plannedCost(const QDate &date) {
}
//Calculates the planned cost upto and including date
-double Appointment::plannedCostTo(const QDate &date) {
+double Appointment::plannedCostTo(const TQDate &date) {
if (m_resource && m_resource->resource()) {
return plannedEffortTo(date).toDouble(Duration::Unit_h) * m_resource->resource()->normalRate(); //FIXME overtime
}
@@ -571,7 +571,7 @@ double Appointment::actualCost() {
}
// Calculates the actual cost on date
-double Appointment::actualCost(const QDate &date) {
+double Appointment::actualCost(const TQDate &date) {
if (m_resource && m_resource->resource()) {
return (m_actualEffort.usedEffort(date, false /*ex. overtime*/).toDouble(Duration::Unit_h)*m_resource->resource()->normalRate()) + (m_actualEffort.usedOvertime(date).toDouble(Duration::Unit_h)*m_resource->resource()->overtimeRate());
}
@@ -579,14 +579,14 @@ double Appointment::actualCost(const QDate &date) {
}
// Calculates the actual cost upto and including date
-double Appointment::actualCostTo(const QDate &date) {
+double Appointment::actualCostTo(const TQDate &date) {
if (m_resource && m_resource->resource()) {
return (m_actualEffort.usedEffortTo(date, false /*ex. overtime*/).toDouble(Duration::Unit_h)*m_resource->resource()->normalRate()) + (m_actualEffort.usedOvertimeTo(date).toDouble(Duration::Unit_h)*m_resource->resource()->overtimeRate());
}
return 0.0;
}
-void Appointment::addActualEffort(QDate date, Duration effort, bool overtime) {
+void Appointment::addActualEffort(TQDate date, Duration effort, bool overtime) {
m_actualEffort.inSort(date, effort, overtime);
}
@@ -615,7 +615,7 @@ void Appointment::detach() {
// Returns the effort from start to end
Duration Appointment::effort(const DateTime &start, const DateTime &end) const {
Duration d;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
d += it.current()->effort(start, end);
}
@@ -624,7 +624,7 @@ Duration Appointment::effort(const DateTime &start, const DateTime &end) const {
// Returns the effort from start for the duration
Duration Appointment::effort(const DateTime &start, const Duration &duration) const {
Duration d;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
d += it.current()->effort(start, start+duration);
}
@@ -633,7 +633,7 @@ Duration Appointment::effort(const DateTime &start, const Duration &duration) co
// Returns the effort upto time / from time
Duration Appointment::effortFrom(const DateTime &time) const {
Duration d;
- QPtrListIterator<AppointmentInterval> it = m_intervals;
+ TQPtrListIterator<AppointmentInterval> it = m_intervals;
for (; it.current(); ++it) {
d += it.current()->effort(time, false);
}
@@ -647,7 +647,7 @@ Appointment &Appointment::operator=(const Appointment &app) {
m_repeatCount = app.repeatCount();
m_intervals.clear();
- QPtrListIterator<AppointmentInterval> it = app.intervals();
+ TQPtrListIterator<AppointmentInterval> it = app.intervals();
for (; it.current(); ++it) {
addInterval(new AppointmentInterval(*(it.current())));
}
@@ -703,7 +703,7 @@ Appointment Appointment::operator+(const Appointment &app) {
}
#ifndef NDEBUG
-void Appointment::printDebug(QString indent)
+void Appointment::printDebug(TQString indent)
{
bool err = false;
if (m_node == 0) {
@@ -724,7 +724,7 @@ void Appointment::printDebug(QString indent)
return;
kdDebug()<<indent<<" + Appointment to schedule: "<<m_node->name()<<" ("<<m_node->type()<<")"<<" resource: "<<m_resource->resource()->name()<<endl;
indent += " ! ";
- QPtrListIterator<AppointmentInterval> it = intervals();
+ TQPtrListIterator<AppointmentInterval> it = intervals();
for (; it.current(); ++it) {
kdDebug()<<indent<<it.current()->startTime().toString()<<" - "<<it.current()->endTime().toString()<<" load="<<it.current()->load()<<endl;
}