QTfrontend/util/namegen.cpp
changeset 6167 728cabee2c9f
parent 6160 863d3edf5690
child 6212 a5d95f32e17f
equal deleted inserted replaced
6166:701c5b8fac56 6167:728cabee2c9f
   123 QStringList HWNamegen::dictContents(const QString filename)
   123 QStringList HWNamegen::dictContents(const QString filename)
   124 {
   124 {
   125     QStringList list;
   125     QStringList list;
   126 
   126 
   127     // find .txt to load the names from
   127     // find .txt to load the names from
   128     QFile * file = HWDataManager::instance().findFileForRead(QString(
   128     QFile * file = new QFile(HWDataManager::instance().findFileForRead(QString(
   129                                                 "Names/%1.txt").arg(filename));
   129                                                 "Names/%1.txt").arg(filename)));
   130 
   130 
   131     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   131     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   132     {
   132     {
   133         QTextStream in(file);
   133         QTextStream in(file);
   134         while (!in.atEnd())
   134         while (!in.atEnd())
   152 QStringList HWNamegen::dictsForHat(const QString hatname)
   152 QStringList HWNamegen::dictsForHat(const QString hatname)
   153 {
   153 {
   154     QStringList list;
   154     QStringList list;
   155 
   155 
   156     // find .cfg to load the dicts from
   156     // find .cfg to load the dicts from
   157     QFile * file = HWDataManager::instance().findFileForRead(QString(
   157     QFile * file = new QFile(HWDataManager::instance().findFileForRead(QString(
   158                                                 "Names/%1.cfg").arg(hatname));
   158                                                 "Names/%1.cfg").arg(hatname)));
   159 
   159 
   160     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   160     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   161     {
   161     {
   162         QTextStream in(file);
   162         QTextStream in(file);
   163         while (!in.atEnd())
   163         while (!in.atEnd())
   181 bool HWNamegen::loadTypes()
   181 bool HWNamegen::loadTypes()
   182 {
   182 {
   183     typesAvailable = false;
   183     typesAvailable = false;
   184 
   184 
   185     // find .ini to load the names from
   185     // find .ini to load the names from
   186     QFile * file =
   186     QFile * file = new QFile(
   187           HWDataManager::instance().findFileForRead(QString("Names/types.ini"));
   187         HWDataManager::instance().findFileForRead(QString("Names/types.ini")));
   188 
   188 
   189 
   189 
   190     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   190     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   191     {
   191     {
   192 
   192