diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kplato/kptnode.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kplato/kptnode.cc')
-rw-r--r-- | kplato/kptnode.cc | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/kplato/kptnode.cc b/kplato/kptnode.cc index cab767f8..48135a71 100644 --- a/kplato/kptnode.cc +++ b/kplato/kptnode.cc @@ -25,8 +25,8 @@ #include "kptresource.h" #include "kptschedule.h" -#include <qptrlist.h> -#include <qdom.h> +#include <tqptrlist.h> +#include <tqdom.h> #include <klocale.h> #include <kdebug.h> @@ -34,19 +34,19 @@ namespace KPlato { -Node::Node(Node *parent) : m_nodes(), m_dependChildNodes(), m_dependParentNodes() { +Node::Node(Node *tqparent) : m_nodes(), m_dependChildNodes(), m_dependParentNodes() { //kdDebug()<<k_funcinfo<<"("<<this<<")"<<endl; - m_parent = parent; + m_parent = tqparent; init(); - m_id = QString(); // Not mapped + m_id = TQString(); // Not mapped } -Node::Node(Node &node, Node *parent) +Node::Node(Node &node, Node *tqparent) : m_nodes(), m_dependChildNodes(), m_dependParentNodes() { //kdDebug()<<k_funcinfo<<"("<<this<<")"<<endl; - m_parent = parent; + m_parent = tqparent; init(); m_name = node.name(); m_leader = node.leader(); @@ -96,7 +96,7 @@ void Node::init() { m_visitedForward = false; m_visitedBackward = false; - m_dateOnlyStartDate = m_dateOnlyEndDate = QDate::currentDate(); + m_dateOnlyStartDate = m_dateOnlyEndDate = TQDate::tqcurrentDate(); m_dateOnlyDuration.addDays(1); m_runningAccount = 0; @@ -113,13 +113,13 @@ Node *Node::projectNode() { if (m_parent) return m_parent->projectNode(); - kdError()<<k_funcinfo<<"Ooops, no parent and no project found"<<endl; + kdError()<<k_funcinfo<<"Ooops, no tqparent and no project found"<<endl; return 0; } void Node::delChildNode( Node *node, bool remove) { - //kdDebug()<<k_funcinfo<<"find="<<m_nodes.findRef(node)<<endl; - if ( m_nodes.findRef(node) != -1 ) { + //kdDebug()<<k_funcinfo<<"tqfind="<<m_nodes.tqfindRef(node)<<endl; + if ( m_nodes.tqfindRef(node) != -1 ) { if(remove) m_nodes.remove(); else @@ -149,7 +149,7 @@ void Node::insertChildNode( unsigned int index, Node *node) { void Node::addChildNode( Node *node, Node *after) { //kdDebug()<<k_funcinfo<<endl; - int index = m_nodes.findRef(after); + int index = m_nodes.tqfindRef(after); if (index == -1) { //kdDebug()<<k_funcinfo<<"append id="<<node->id()<<": "<<node->name()<<endl; m_nodes.append(node); @@ -163,14 +163,14 @@ void Node::addChildNode( Node *node, Node *after) { int Node::findChildNode( Node* node ) { - return m_nodes.findRef( node ); + return m_nodes.tqfindRef( node ); } const Node* Node::getChildNode(int number) const { - // Work around missing const at() method in QPtrList - const QPtrList<Node> &nodes = m_nodes; - return (const_cast<QPtrList<Node> &>(nodes)).at(number); + // Work around missing const at() method in TQPtrList + const TQPtrList<Node> &nodes = m_nodes; + return (const_cast<TQPtrList<Node> &>(nodes)).at(number); } Duration *Node::getDelay() { @@ -201,7 +201,7 @@ void Node::insertDependChildNode( unsigned int index, Node *node, Relation::Type } bool Node::addDependChildNode( Relation *relation) { - if(m_dependChildNodes.findRef(relation) != -1) + if(m_dependChildNodes.tqfindRef(relation) != -1) return false; m_dependChildNodes.append(relation); return true; @@ -209,7 +209,7 @@ bool Node::addDependChildNode( Relation *relation) { // These delDepend... methods look suspicious to me, can someone review? void Node::delDependChildNode( Node *node, bool remove) { - if ( m_nodes.findRef(node) != -1 ) { + if ( m_nodes.tqfindRef(node) != -1 ) { if(remove) m_dependChildNodes.remove(); else @@ -218,7 +218,7 @@ void Node::delDependChildNode( Node *node, bool remove) { } void Node::delDependChildNode( Relation *rel, bool remove) { - if ( m_dependChildNodes.findRef(rel) != -1 ) { + if ( m_dependChildNodes.tqfindRef(rel) != -1 ) { if(remove) m_dependChildNodes.remove(); else @@ -234,7 +234,7 @@ void Node::delDependChildNode( int number, bool remove) { } void Node::takeDependChildNode(Relation *rel) { - if (m_dependChildNodes.findRef(rel) != -1) { + if (m_dependChildNodes.tqfindRef(rel) != -1) { m_dependChildNodes.take(); } } @@ -260,7 +260,7 @@ void Node::insertDependParentNode( unsigned int index, Node *node, Relation::Typ } bool Node::addDependParentNode( Relation *relation) { - if(m_dependParentNodes.findRef(relation) != -1) + if(m_dependParentNodes.tqfindRef(relation) != -1) return false; m_dependParentNodes.append(relation); return true; @@ -268,7 +268,7 @@ bool Node::addDependParentNode( Relation *relation) { // These delDepend... methods look suspicious to me, can someone review? void Node::delDependParentNode( Node *node, bool remove) { - if ( m_nodes.findRef(node) != -1 ) { + if ( m_nodes.tqfindRef(node) != -1 ) { if(remove) m_dependParentNodes.remove(); else @@ -277,7 +277,7 @@ void Node::delDependParentNode( Node *node, bool remove) { } void Node::delDependParentNode( Relation *rel, bool remove) { - if ( m_dependParentNodes.findRef(rel) != -1 ) { + if ( m_dependParentNodes.tqfindRef(rel) != -1 ) { if(remove) m_dependParentNodes.remove(); else @@ -293,16 +293,16 @@ void Node::delDependParentNode( int number, bool remove) { } void Node::takeDependParentNode(Relation *rel) { - if (m_dependParentNodes.findRef(rel) != -1) { + if (m_dependParentNodes.tqfindRef(rel) != -1) { rel = m_dependParentNodes.take(); } } bool Node::isParentOf(Node *node) { - if (m_nodes.findRef(node) != -1) + if (m_nodes.tqfindRef(node) != -1) return true; - QPtrListIterator<Node> nit(childNodeIterator()); + TQPtrListIterator<Node> nit(childNodeIterator()); for ( ; nit.current(); ++nit ) { if (nit.current()->isParentOf(node)) return true; @@ -313,7 +313,7 @@ bool Node::isParentOf(Node *node) { Relation *Node::findParentRelation(Node *node) { for (int i=0; i<numDependParentNodes(); i++) { Relation *rel = getDependParentNode(i); - if (rel->parent() == node) + if (rel->tqparent() == node) return rel; } return (Relation *)0; @@ -339,9 +339,9 @@ bool Node::isDependChildOf(Node *node) { //kdDebug()<<k_funcinfo<<" '"<<m_name<<"' checking against '"<<node->name()<<"'"<<endl; for (int i=0; i<numDependParentNodes(); i++) { Relation *rel = getDependParentNode(i); - if (rel->parent() == node) + if (rel->tqparent() == node) return true; - if (rel->parent()->isDependChildOf(node)) + if (rel->tqparent()->isDependChildOf(node)) return true; } return false; @@ -367,35 +367,35 @@ Duration Node::duration(const DateTime &time, int use, bool backward) { } void Node::makeAppointments() { - QPtrListIterator<Node> nit(m_nodes); + TQPtrListIterator<Node> nit(m_nodes); for ( ; nit.current(); ++nit ) { nit.current()->makeAppointments(); } } void Node::calcResourceOverbooked() { - QPtrListIterator<Node> nit(m_nodes); + TQPtrListIterator<Node> nit(m_nodes); for ( ; nit.current(); ++nit ) { nit.current()->calcResourceOverbooked(); } } -QStringList Node::overbookedResources() const { - return m_currentSchedule ? m_currentSchedule->overbookedResources() : QStringList(); +TQStringList Node::overbookedResources() const { + return m_currentSchedule ? m_currentSchedule->overbookedResources() : TQStringList(); } -void Node::saveRelations(QDomElement &element) const { - QPtrListIterator<Relation> it(m_dependChildNodes); +void Node::saveRelations(TQDomElement &element) const { + TQPtrListIterator<Relation> it(m_dependChildNodes); for (; it.current(); ++it) { it.current()->save(element); } - QPtrListIterator<Node> nodes(m_nodes); + TQPtrListIterator<Node> nodes(m_nodes); for ( ; nodes.current(); ++nodes ) { nodes.current()->saveRelations(element); } } -void Node::setConstraint(QString &type) { +void Node::setConstraint(TQString &type) { // Do not i18n these, they are used in load() if (type == "ASAP") setConstraint(ASAP); @@ -415,24 +415,24 @@ void Node::setConstraint(QString &type) { setConstraint(ASAP); // default } -QString Node::constraintToString() const { +TQString Node::constraintToString() const { // Do not i18n these, they are used in save() if (m_constraint == ASAP) - return QString("ASAP"); + return TQString("ASAP"); else if (m_constraint == ALAP) - return QString("ALAP"); + return TQString("ALAP"); else if (m_constraint == StartNotEarlier) - return QString("StartNotEarlier"); + return TQString("StartNotEarlier"); else if (m_constraint == FinishNotLater) - return QString("FinishNotLater"); + return TQString("FinishNotLater"); else if (m_constraint == MustStartOn) - return QString("MustStartOn"); + return TQString("MustStartOn"); else if (m_constraint == MustFinishOn) - return QString("MustFinishOn"); + return TQString("MustFinishOn"); else if (m_constraint == FixedInterval) - return QString("FixedInterval"); + return TQString("FixedInterval"); - return QString(); + return TQString(); } void Node::propagateEarliestStart(DateTime &time) { @@ -440,7 +440,7 @@ void Node::propagateEarliestStart(DateTime &time) { return; m_currentSchedule->earliestStart = time; //kdDebug()<<k_funcinfo<<m_name<<": "<<m_currentSchedule->earliestStart.toString()<<endl; - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->propagateEarliestStart(time); } @@ -451,7 +451,7 @@ void Node::propagateLatestFinish(DateTime &time) { return; m_currentSchedule->latestFinish = time; //kdDebug()<<k_funcinfo<<m_name<<": "<<m_currentSchedule->latestFinish<<endl; - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->propagateLatestFinish(time); } @@ -462,7 +462,7 @@ void Node::moveEarliestStart(DateTime &time) { return; if (m_currentSchedule->earliestStart < time) m_currentSchedule->earliestStart = time; - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->moveEarliestStart(time); } @@ -473,14 +473,14 @@ void Node::moveLatestFinish(DateTime &time) { return; if (m_currentSchedule->latestFinish > time) m_currentSchedule->latestFinish = time; - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->moveLatestFinish(time); } } void Node::initiateCalculation(Schedule &sch) { - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->initiateCalculation(sch); } @@ -489,7 +489,7 @@ void Node::initiateCalculation(Schedule &sch) { void Node::resetVisited() { m_visitedForward = false; m_visitedBackward = false; - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->resetVisited(); } @@ -504,7 +504,7 @@ Node *Node::siblingBefore() { Node *Node::childBefore(Node *node) { //kdDebug()<<k_funcinfo<<endl; - int index = m_nodes.findRef(node); + int index = m_nodes.tqfindRef(node); if (index > 0){ return m_nodes.at(index-1); } @@ -521,7 +521,7 @@ Node *Node::siblingAfter() { Node *Node::childAfter(Node *node) { //kdDebug()<<k_funcinfo<<endl; - uint index = m_nodes.findRef(node); + uint index = m_nodes.tqfindRef(node); if (index < m_nodes.count()-1) { return m_nodes.at(index+1); } return 0; @@ -570,7 +570,7 @@ bool Node::isStartNode() const { return m_dependParentNodes.isEmpty(); } -bool Node::setId(QString id) { +bool Node::setId(TQString id) { //kdDebug()<<k_funcinfo<<id<<endl; if (id.isEmpty()) { kdError()<<k_funcinfo<<"id is empty"<<endl; @@ -589,7 +589,7 @@ bool Node::setId(QString id) { } if (findNode(id)) { kdError()<<k_funcinfo<<"id '"<<id<<"' is already used for different node: "<<findNode(id)->name()<<endl; - m_id = QString(); // hmmm + m_id = TQString(); // hmmm return false; } m_id = id; @@ -613,16 +613,16 @@ void Node::setEndTime(DateTime endTime) { m_dateOnlyEndDate = m_dateOnlyEndDate.addDays(-1); } -void Node::saveAppointments(QDomElement &element, long id) const { +void Node::saveAppointments(TQDomElement &element, long id) const { //kdDebug()<<k_funcinfo<<m_name<<" id="<<id<<endl; - QPtrListIterator<Node> it(m_nodes); + TQPtrListIterator<Node> it(m_nodes); for (; it.current(); ++it ) { it.current()->saveAppointments(element, id); } } -QPtrList<Appointment> Node::appointments() { - QPtrList<Appointment> lst; +TQPtrList<Appointment> Node::appointments() { + TQPtrList<Appointment> lst; if (m_currentSchedule) lst = m_currentSchedule->appointments(); return lst; @@ -652,7 +652,7 @@ bool Node::addAppointment(Appointment *appointment, Schedule &main) { void Node::addAppointment(ResourceSchedule *resource, DateTime &start, DateTime &end, double load) { Schedule *node = findSchedule(resource->id()); if (node == 0) { - node = createSchedule(resource->parent()); + node = createSchedule(resource->tqparent()); } node->addAppointment(resource, start, end, load); } @@ -668,25 +668,25 @@ void Node::takeSchedule(const Schedule *schedule) { void Node::addSchedule(Schedule *schedule) { if (schedule == 0) return; - m_schedules.replace(schedule->id(), schedule); + m_schedules.tqreplace(schedule->id(), schedule); } -Schedule *Node::createSchedule(QString name, Schedule::Type type, long id) { +Schedule *Node::createSchedule(TQString name, Schedule::Type type, long id) { //kdDebug()<<k_funcinfo<<name<<" type="<<type<<" id="<<(int)id<<endl; NodeSchedule *sch = new NodeSchedule(this, name, type, id); addSchedule(sch); return sch; } -Schedule *Node::createSchedule(Schedule *parent) { +Schedule *Node::createSchedule(Schedule *tqparent) { //kdDebug()<<k_funcinfo<<name<<" type="<<type<<" id="<<(int)id<<endl; - NodeSchedule *sch = new NodeSchedule(parent, this); + NodeSchedule *sch = new NodeSchedule(tqparent, this); addSchedule(sch); return sch; } -Schedule *Node::findSchedule(const QString name, const Schedule::Type type) const { - QIntDictIterator<Schedule> it = m_schedules; +Schedule *Node::findSchedule(const TQString name, const Schedule::Type type) const { + TQIntDictIterator<Schedule> it = m_schedules; for (; it.current(); ++it) { if (!it.current()->isDeleted() && it.current()->name() == name && it.current()->type() == type) @@ -697,7 +697,7 @@ Schedule *Node::findSchedule(const QString name, const Schedule::Type type) cons Schedule *Node::findSchedule(const Schedule::Type type) const { //kdDebug()<<k_funcinfo<<m_name<<" find type="<<type<<" nr="<<m_schedules.count()<<endl; - QIntDictIterator<Schedule> it = m_schedules; + TQIntDictIterator<Schedule> it = m_schedules; for (; it.current(); ++it) { if (!it.current()->isDeleted() && it.current()->type() == type) { return it.current(); @@ -720,7 +720,7 @@ void Node::setParentSchedule(Schedule *sch) { if (s) { s->setParent(sch); } - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->setParentSchedule(sch); } @@ -741,9 +741,9 @@ bool Node::calcCriticalPath(bool fromEnd) { m_currentSchedule->inCriticalPath = true; return true; } - QPtrListIterator<Relation> pit(m_dependParentNodes); + TQPtrListIterator<Relation> pit(m_dependParentNodes); for (; pit.current(); ++pit) { - if (pit.current()->parent()->calcCriticalPath(fromEnd)) { + if (pit.current()->tqparent()->calcCriticalPath(fromEnd)) { m_currentSchedule->inCriticalPath = true; } } @@ -755,11 +755,11 @@ int Node::level() { return n ? n->level() + 1 : 0; } -void Node::generateWBS(int count, WBSDefinition &def, QString wbs) { +void Node::generateWBS(int count, WBSDefinition &def, TQString wbs) { m_wbs = wbs + def.code(count, level()); //kdDebug()<<k_funcinfo<<m_name<<" wbs: "<<m_wbs<<endl; - QString w = wbs + def.wbs(count, level()); - QPtrListIterator<Node> it = m_nodes; + TQString w = wbs + def.wbs(count, level()); + TQPtrListIterator<Node> it = m_nodes; for (int i=0; it.current(); ++it) { it.current()->generateWBS(++i, def, w); } @@ -767,7 +767,7 @@ void Node::generateWBS(int count, WBSDefinition &def, QString wbs) { } void Node::setCurrentSchedule(long id) { - QPtrListIterator<Node> it = m_nodes; + TQPtrListIterator<Node> it = m_nodes; for (; it.current(); ++it) { it.current()->setCurrentSchedule(id); } @@ -860,7 +860,7 @@ Duration Effort::effort(int use) const { return m_expectedEffort; // default } -bool Effort::load(QDomElement &element) { +bool Effort::load(TQDomElement &element) { m_expectedEffort = Duration::fromString(element.attribute("expected")); m_optimisticEffort = Duration::fromString(element.attribute("optimistic")); m_pessimisticEffort = Duration::fromString(element.attribute("pessimistic")); @@ -869,8 +869,8 @@ bool Effort::load(QDomElement &element) { return true; } -void Effort::save(QDomElement &element) const { - QDomElement me = element.ownerDocument().createElement("effort"); +void Effort::save(TQDomElement &element) const { + TQDomElement me = element.ownerDocument().createElement("effort"); element.appendChild(me); me.setAttribute("expected", m_expectedEffort.toString()); me.setAttribute("optimistic", m_optimisticEffort.toString()); @@ -879,16 +879,16 @@ void Effort::save(QDomElement &element) const { me.setAttribute("risk", risktypeToString()); } -QString Effort::typeToString() const { +TQString Effort::typeToString() const { if (m_type == Type_Effort) - return QString("Effort"); + return TQString("Effort"); if (m_type == Type_FixedDuration) - return QString("Type_FixedDuration"); + return TQString("Type_FixedDuration"); - return QString(); + return TQString(); } -void Effort::setType(QString type) { +void Effort::setType(TQString type) { if (type == "Effort") setType(Type_Effort); else if (type == "Type_FixedDuration") @@ -897,18 +897,18 @@ void Effort::setType(QString type) { setType(Type_Effort); // default } -QString Effort::risktypeToString() const { +TQString Effort::risktypeToString() const { if (m_risktype == Risk_None) - return QString("None"); + return TQString("None"); if (m_risktype == Risk_Low) - return QString("Low"); + return TQString("Low"); if (m_risktype == Risk_High) - return QString("High"); + return TQString("High"); - return QString(); + return TQString(); } -void Effort::setRisktype(QString type) { +void Effort::setRisktype(TQString type) { if (type == "High") setRisktype(Risk_High); else if (type == "Low") @@ -942,10 +942,10 @@ int Effort::pessimisticRatio() const { // Debugging #ifndef NDEBUG -void Node::printDebug(bool children, QCString indent) { +void Node::printDebug(bool tqchildren, TQCString indent) { kdDebug()<<indent<<" Unique node identity="<<m_id<<endl; if (m_effort) m_effort->printDebug(indent); - QString s = " Constraint: " + constraintToString(); + TQString s = " Constraint: " + constraintToString(); if (m_constraint == MustStartOn || m_constraint == StartNotEarlier || m_constraint == FixedInterval) kdDebug()<<indent<<s<<" ("<<constraintStartTime().toString()<<")"<<endl; if (m_constraint == MustFinishOn || m_constraint == FinishNotLater || m_constraint == FixedInterval) @@ -956,23 +956,23 @@ void Node::printDebug(bool children, QCString indent) { } else { kdDebug()<<indent<<" Current schedule: None"<<endl; } - QIntDictIterator<Schedule> it = m_schedules; + TQIntDictIterator<Schedule> it = m_schedules; for (; it.current(); ++it) { it.current()->printDebug(indent+" "); } - kdDebug()<<indent<<" Parent: "<<(m_parent ? m_parent->name() : QString("None"))<<endl; + kdDebug()<<indent<<" Parent: "<<(m_parent ? m_parent->name() : TQString("None"))<<endl; kdDebug()<<indent<<" Level: "<<level()<<endl; kdDebug()<<indent<<" No of predecessors: "<<m_dependParentNodes.count()<<endl; - QPtrListIterator<Relation> pit(m_dependParentNodes); - //kdDebug()<<indent<<" Dependant parents="<<pit.count()<<endl; + TQPtrListIterator<Relation> pit(m_dependParentNodes); + //kdDebug()<<indent<<" Dependant tqparents="<<pit.count()<<endl; if (pit.count() > 0) { for ( ; pit.current(); ++pit ) { pit.current()->printDebug(indent); } } kdDebug()<<indent<<" No of successors: "<<m_dependChildNodes.count()<<endl; - QPtrListIterator<Relation> cit(m_dependChildNodes); - //kdDebug()<<indent<<" Dependant children="<<cit.count()<<endl; + TQPtrListIterator<Relation> cit(m_dependChildNodes); + //kdDebug()<<indent<<" Dependant tqchildren="<<cit.count()<<endl; if (cit.count() > 0) { for ( ; cit.current(); ++cit ) { cit.current()->printDebug(indent); @@ -981,8 +981,8 @@ void Node::printDebug(bool children, QCString indent) { //kdDebug()<<indent<<endl; indent += " "; - if (children) { - QPtrListIterator<Node> it(m_nodes); + if (tqchildren) { + TQPtrListIterator<Node> it(m_nodes); for ( ; it.current(); ++it ) { it.current()->printDebug(true,indent); } @@ -993,7 +993,7 @@ void Node::printDebug(bool children, QCString indent) { #ifndef NDEBUG -void Effort::printDebug(QCString indent) { +void Effort::printDebug(TQCString indent) { kdDebug()<<indent<<" Effort:"<<endl; indent += " "; kdDebug()<<indent<<" Expected: "<<m_expectedEffort.toString()<<endl; |