#include "IDictionary.h" #include "DicRecord.h" #include "CardPack.h" IDictionary::~IDictionary() { foreach(DicRecord* record, records) delete record; } void IDictionary::addRecord(DicRecord* record) { records << record; notifyRecordsInserted(records.size() - 1, 1); } void IDictionary::addRecords(const QList& records) { this->records << records; notifyRecordsInserted(records.size() - records.size(), records.size()); } QString IDictionary::extendImagePaths(QString text) const { text = replaceImagePaths(text, "%", QFileInfo(filePath).path()); text = replaceImagePaths(text, "%%", getImagesPath()); return text; } QString IDictionary::getImagesPath() const { QString path = QFileInfo(filePath).path(); QString baseName = QFileInfo(filePath).completeBaseName(); return QDir(path).filePath(baseName); } QString IDictionary::replaceImagePaths(QString text, const QString& shortDir, const QString& replacingPath) { QRegExp imgRx(QString("(getTodayReviewedCardsNum(); return num; } int IDictionary::countTodaysNewCards() const { int num = 0; foreach(CardPack* pack, m_cardPacks) num += pack->getTodayNewCardsNum(); return num; }