319 checkForDir(cfgdir->absolutePath() + "/Demos"); |
320 checkForDir(cfgdir->absolutePath() + "/Demos"); |
320 checkForDir(cfgdir->absolutePath() + "/Saves"); |
321 checkForDir(cfgdir->absolutePath() + "/Saves"); |
321 } |
322 } |
322 } |
323 } |
323 |
324 |
|
325 |
324 datadir->cd(bindir->absolutePath()); |
326 datadir->cd(bindir->absolutePath()); |
325 datadir->cd(*cDataDir); |
327 datadir->cd(*cDataDir); |
326 if(!datadir->cd("hedgewars/Data")) { |
328 if(!datadir->cd("hedgewars/Data")) { |
327 QMessageBox::critical(0, QMessageBox::tr("Error"), |
329 QMessageBox::critical(0, QMessageBox::tr("Error"), |
328 QMessageBox::tr("Failed to open data directory:\n%1\n" |
330 QMessageBox::tr("Failed to open data directory:\n%1\n" |
329 "Please check your installation"). |
331 "Please check your installation"). |
330 arg(datadir->absolutePath()+"/hedgewars/Data")); |
332 arg(datadir->absolutePath()+"/hedgewars/Data")); |
331 return 1; |
333 return 1; |
332 } |
334 } |
333 |
335 |
334 QTranslator Translator; |
336 /*Themes = new QStringList(); |
335 Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + QLocale::system().name()); |
|
336 app.installTranslator(&Translator); |
|
337 |
|
338 Themes = new QStringList(); |
|
339 QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg"); |
337 QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg"); |
340 if (themesfile.open(QIODevice::ReadOnly)) { |
338 if (themesfile.open(QIODevice::ReadOnly)) { |
341 QTextStream stream(&themesfile); |
339 QTextStream stream(&themesfile); |
342 QString str; |
340 QString str; |
343 while (!stream.atEnd()) |
341 while (!stream.atEnd()) |
345 Themes->append(stream.readLine()); |
343 Themes->append(stream.readLine()); |
346 } |
344 } |
347 themesfile.close(); |
345 themesfile.close(); |
348 } else { |
346 } else { |
349 QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK"); |
347 QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK"); |
350 } |
348 }*/ |
351 |
349 |
352 QDir tmpdir; |
350 QDir tmpdir; |
|
351 tmpdir.cd(datadir->absolutePath()); |
|
352 tmpdir.cd("Themes"); |
|
353 tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); |
|
354 Themes = new QStringList(tmpdir.entryList(QStringList("*"))); |
|
355 |
353 tmpdir.cd(datadir->absolutePath()); |
356 tmpdir.cd(datadir->absolutePath()); |
354 tmpdir.cd("Maps"); |
357 tmpdir.cd("Maps"); |
355 tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); |
358 tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); |
356 mapList = new QStringList(tmpdir.entryList(QStringList("*"))); |
359 mapList = new QStringList(tmpdir.entryList(QStringList("*"))); |
357 |
360 |
|
361 |
|
362 QTranslator Translator; |
|
363 { |
|
364 QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat); |
|
365 |
|
366 Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + settings.value("misc/locale", QLocale::system().name()).toString()); |
|
367 app.installTranslator(&Translator); |
|
368 } |
|
369 |
|
370 |
358 HWForm *Form = new HWForm(); |
371 HWForm *Form = new HWForm(); |
359 |
372 |
360 |
373 |
361 Form->show(); |
374 Form->show(); |
362 return app.exec(); |
375 return app.exec(); |