return lang;
}
+QString dataDir;
+
+#include <stdlib.h>
+
+void initDataDir()
+{
+ QSettings set;
+ if(set.contains("datadir"))
+ dataDir=set.value("datadir").toString();
+ else{
+#ifdef Q_OS_WIN32
+ dataDir=getenv("APPDATA");
+#else
+ dataDir=getenv("HOME");
+#endif
+ if(dataDir=="")
+ qFatal("Cannot determine application data directory.");
+ dataDir+="/.magicSmoke";
+ set.setValue("datadir",dataDir);
+ }
+}
+
int main(int argc,char**argv)
{
//create global app
mstrans.load("smoke_"+lang);
app.installTranslator(&mstrans);
+ //try to find data dir
+ initDataDir();
+
//check/generate host settings
if(!QSettings().contains("hostkey")){
MKeyGen mkg;
//
//
+#ifndef MAGICSMOKE_MAIN_H
+#define MAGICSMOKE_MAIN_H
+
QString choseLanguage(bool warn=true);
+extern QString dataDir;
+
+#endif