historywindow moved to mainwindow. Started to get rid of Q3PtrList finally
10 void API::initCommand()
17 void API::parseInput (const QString &s)
25 re.setPattern ("(.*)\\s");
33 re.setPattern ("\\((.*)\\)");
43 while (pos<s.length())
53 if (s.at(pos)==',' && !inquote)
57 s=s.right(s.length()-pos-1);
68 QString API::command()
73 QStringList API::parameters()
80 return paramList.count();
84 QString API::errorMessage()
89 case NoError: l="No Error";
90 case Warning: l="Warning";
91 case Aborted: l="Aborted";
93 return QString ("Error Level: %1\n Command: %2\nDescription: %3")
94 .arg(l).arg(com).arg(errDescription);
97 QString API::errorDescription()
99 return errDescription;
102 ErrorLevel API::errorLevel()
107 void API::setError(ErrorLevel level, const QString &description)
109 errDescription=description;
113 void API::resetError ()
121 bool API::checkParamCount (QList <int> plist)
125 for (int i=0; i<plist.count();i++)
127 if (checkParamCount (plist[i]))
132 expList.append(QString().setNum(plist[i]));
134 expected=expList.join(",");
135 errDescription=QString("Wrong number of parameters: Expected %1, but found %2").arg(expected).arg(paramList.count());
139 bool API::checkParamCount (const int &expected)
141 if (paramList.count()!=expected)
144 errDescription=QString("Wrong number of parameters: Expected %1, but found %2").arg(expected).arg(paramList.count());
150 bool API::checkParamIsInt(const int &index)
153 if (index > paramList.count())
156 errDescription=QString("Parameter index %1 is outside of parameter list").arg(index);
160 paramList[index].toInt (&ok, 10);
164 errDescription=QString("Parameter %1 is not an integer").arg(index);
171 int API::parInt (bool &ok,const uint &index)
173 if (checkParamIsInt (index))
174 return paramList[index].toInt (&ok, 10);
179 QString API::parString (bool &ok,const int &index)
181 // return the string at index, this could be also stored in
184 QRegExp re("\"(.*)\"");
185 int pos=re.search (paramList[index]);
194 bool API::parBool (bool &ok,const int &index)
196 // return the bool at index, this could be also stored in
200 QString p=paramList[index];
201 if (p=="true" || p=="1")
203 else if (p=="false" || p=="0")
209 QColor API::parColor(bool &ok,const int &index)
211 // return the QColor at index
213 return QColor (paramList[index]);