QTfrontend/main.cpp.in
changeset 321 1148eeb0557e
parent 277 04a613bab65c
child 400 450ff6326084
equal deleted inserted replaced
320:1ee7f087195a 321:1148eeb0557e
    20 #include <QTranslator>
    20 #include <QTranslator>
    21 #include <QLocale>
    21 #include <QLocale>
    22 #include <QMessageBox>
    22 #include <QMessageBox>
    23 #include <QFileInfo>
    23 #include <QFileInfo>
    24 #include <QDateTime>
    24 #include <QDateTime>
       
    25 #include <QTextStream>
    25 #include "hwform.h"
    26 #include "hwform.h"
    26 #include "hwconsts.h"
    27 #include "hwconsts.h"
    27 
    28 
    28 QDir * bindir;
    29 QDir * bindir;
    29 QDir * cfgdir;
    30 QDir * cfgdir;
    30 QDir * datadir;
    31 QDir * datadir;
       
    32 QStringList * Themes;
    31 
    33 
    32 bool checkForDir(const QString & dir)
    34 bool checkForDir(const QString & dir)
    33 {
    35 {
    34 	QDir tmpdir;
    36 	QDir tmpdir;
    35 	if (!tmpdir.exists(dir))
    37 	if (!tmpdir.exists(dir))
    78 					"Please check your installation").
    80 					"Please check your installation").
    79 					arg(datadir->absolutePath()+"/hedgewars/Data"));
    81 					arg(datadir->absolutePath()+"/hedgewars/Data"));
    80 		return 1;
    82 		return 1;
    81 	}
    83 	}
    82 
    84 
       
    85 	Themes = new QStringList();
       
    86 	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
       
    87 	if (themesfile.open(QIODevice::ReadOnly)) {
       
    88 		QTextStream stream(&themesfile);
       
    89 		QString str;
       
    90 		while (!stream.atEnd())
       
    91 		{
       
    92 			Themes->append(stream.readLine());
       
    93 		}
       
    94 		themesfile.close();
       
    95 	} else {
       
    96 		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
       
    97 	}
       
    98 
    83 	HWForm *Form = new HWForm();
    99 	HWForm *Form = new HWForm();
    84 	Form->show();
   100 	Form->show();
    85 	return app.exec();
   101 	return app.exec();
    86 }
   102 }