#include "keduvocdocument.h"
#include <QFileInfo>
-//Added by qt3to4:
-#include <Q3ValueList>
+#include <QList>
#include <QTextStream>
#include <QtAlgorithms>
void KEduVocDocument::removeEntry(int index)
{
if (index >= 0 && index < (int)m_vocabulary.size() )
- m_vocabulary.erase(m_vocabulary.at(index));
+ m_vocabulary.removeAt( index );
}
if (index < (int)m_identifiers.size() && index >= 1 )
{
m_identifiers.takeAt(index);
- Q3ValueList<KEduVocExpression>::iterator it;
- for (it = m_vocabulary.begin(); it != m_vocabulary.end(); ++it)
- (*it).removeTranslation(index);
+ foreach( KEduVocExpression exp, m_vocabulary )
+ exp.removeTranslation(index);
}
}
void KEduVocDocument::resetEntry(int index, int lesson)
{
- Q3ValueList<KEduVocExpression>::iterator it;
if (index < 0)
{
- for (it = m_vocabulary.begin(); it != m_vocabulary.end(); ++it)
- for (int i = 0; i <= (*it).numTranslations(); i++)
+ foreach( KEduVocExpression exp, m_vocabulary )
+ {
+ for (int i = 0; i <= exp.numTranslations(); i++)
{
- if (lesson == 0 || lesson == (*it).lesson())
+ if (lesson == 0 || lesson == exp.lesson())
{
- (*it).setGrade(i, KV_NORM_GRADE, false);
- (*it).setGrade(i, KV_NORM_GRADE, true);
- (*it).setQueryCount(i, 0, true);
- (*it).setQueryCount(i, 0, false);
- (*it).setBadCount(i, 0, true);
- (*it).setBadCount(i, 0, false);
+ exp.setGrade(i, KV_NORM_GRADE, false);
+ exp.setGrade(i, KV_NORM_GRADE, true);
+ exp.setQueryCount(i, 0, true);
+ exp.setQueryCount(i, 0, false);
+ exp.setBadCount(i, 0, true);
+ exp.setBadCount(i, 0, false);
QDateTime dt;
dt.setTime_t(0);
- (*it).setQueryDate(i, dt, true);
- (*it).setQueryDate(i, dt, false);
+ exp.setQueryDate(i, dt, true);
+ exp.setQueryDate(i, dt, false);
}
}
- //for_each (m_vocabulary.begin(), m_vocabulary.end(), resetAll(lesson) );
+ }
}
else
{
- for (it = m_vocabulary.begin(); it != m_vocabulary.end(); ++it)
- if (lesson == 0 || lesson == (*it).lesson())
+ foreach( KEduVocExpression exp, m_vocabulary )
+ if (lesson == 0 || lesson == exp.lesson())
{
- (*it).setGrade(index, KV_NORM_GRADE, false);
- (*it).setGrade(index, KV_NORM_GRADE, true);
- (*it).setQueryCount(index, 0, true);
- (*it).setQueryCount(index, 0, false);
- (*it).setBadCount(index, 0, true);
- (*it).setBadCount(index, 0, false);
+ exp.setGrade(index, KV_NORM_GRADE, false);
+ exp.setGrade(index, KV_NORM_GRADE, true);
+ exp.setQueryCount(index, 0, true);
+ exp.setQueryCount(index, 0, false);
+ exp.setBadCount(index, 0, true);
+ exp.setBadCount(index, 0, false);
QDateTime dt;
dt.setTime_t(0);
- (*it).setQueryDate(index, dt, true);
- (*it).setQueryDate(index, dt, false);
+ exp.setQueryDate(index, dt, true);
+ exp.setQueryDate(index, dt, false);
}
- //for_each (m_vocabulary.begin(), m_vocabulary.end(), resetOne(index, lesson) );
}
}
}
-Q3ValueList<int> KEduVocDocument::lessonsInQuery() const
+QList<int> KEduVocDocument::lessonsInQuery() const
{
- Q3ValueList<int> iqvec;
+ QList<int> iqvec;
for (unsigned i = 0; i < m_lessonsInQuery.size(); i++)
if (m_lessonsInQuery[i]) {
iqvec.push_back(i+1); // Offset <no lesson>
}
-void KEduVocDocument::setLessonsInQuery(Q3ValueList<int> lesson_iq)
+void KEduVocDocument::setLessonsInQuery(QList<int> lesson_iq)
{
m_lessonsInQuery.clear();
for (unsigned i = 0; i < m_lessonDescriptions.size(); i++)
m_lessonsInQuery.push_back(false);
- for (unsigned i = 0; i < lesson_iq.size(); i++)
- if (lesson_iq[i] <= (int) m_lessonsInQuery.size() ) {
+ foreach( int i, lesson_iq )
+ if (lesson_iq[i] <= (int) m_lessonsInQuery.size() )
+ {
m_lessonsInQuery[lesson_iq[i]-1] = true; // Offset <no lesson>
// cout << "setliq: " << lesson_iq[i] << " " << i << endl;
}
KEduVocExpression *exp;
};
-typedef Q3ValueList<ExpRef> ExpRefList;
+typedef QList<ExpRef> ExpRefList;
int KEduVocDocument::cleanUp()
{
int count = 0;
KEduVocExpression *kve1, *kve2;
ExpRefList shadow;
- Q3ValueList<int> to_delete;
+ QList<int> to_delete;
for (int i = 0; i < (int) m_vocabulary.size(); i++)
shadow.push_back (ExpRef (entry(i), i));
#define VCB_SEPARATOR "__"
-#include <qobject.h>
-#include <qfont.h>
-//Added by qt3to4:
-#include <Q3ValueList>
+#include <QObject>
+#include <QFont>
+#include <QList>
#include <QTextStream>
#include <kurl.h>
#include "keduvocexpression.h"
-class QTextStream;
class QStringList;
class KEduVocMultipleChoice;
class LeitnerSystem;
* @param index index of entry
*/
inline void insertEntry(KEduVocExpression *expression, int index)
- { m_vocabulary.insert(m_vocabulary.at(index), *expression); m_dirty = true; }
+ { m_vocabulary.insert(index, *expression); m_dirty = true; }
/** removes an expression from the document
*
QString lessonDescription(int index) const;
/** returns lessons in current query */
- Q3ValueList<int> lessonsInQuery() const;
+ QList<int> lessonsInQuery() const;
/** sets lessons in current query */
- void setLessonsInQuery(Q3ValueList<int>);
+ void setLessonsInQuery(QList<int>);
inline QStringList lessonDescriptions() const { return m_lessonDescriptions; }
private:
bool m_dirty;
KURL m_url;
- Q3ValueList<bool> m_sortIdentifier;
+ QList<bool> m_sortIdentifier;
bool m_sortLesson;
bool m_unknownAttribute;
bool m_unknownElement;
int m_cols;
int m_lines;
int m_currentLesson;
- Q3ValueList<int> m_extraSizeHints;
- Q3ValueList<int> m_sizeHints;
+ QList<int> m_extraSizeHints;
+ QList<int> m_sizeHints;
QFont* m_font;
QString m_generator;
QString m_queryorg;
QString m_querytrans;
- Q3ValueList<KEduVocExpression> m_vocabulary;
- Q3ValueList<bool> m_lessonsInQuery;
+ QList<KEduVocExpression> m_vocabulary;
+ QList<bool> m_lessonsInQuery;
QStringList m_lessonDescriptions;
QStringList m_typeDescriptions;
QStringList m_tenseDescriptions;
QString m_remark;
QString m_version;
- Q3ValueList<KEduVocArticle> m_articles;
- Q3ValueList<KEduVocConjugation> m_conjugations;
+ QList<KEduVocArticle> m_articles;
+ QList<KEduVocConjugation> m_conjugations;
LeitnerSystem* m_leitnerSystem;
- bool m_activeLeitnerSystem;
+ bool m_activeLeitnerSystem;
};