# HG changeset patch # User unc0rr # Date 1164458718 0 # Node ID 7cb230cd2b1de3a112b0501940841c40d1e7f21b # Parent 94bd2577ebbb2a5540403ed9d5d4223126f8a927 Don't configure main.cpp, just hwconsts.h diff -r 94bd2577ebbb -r 7cb230cd2b1d QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Sat Nov 25 11:56:37 2006 +0000 +++ b/QTfrontend/CMakeLists.txt Sat Nov 25 12:45:18 2006 +0000 @@ -16,8 +16,6 @@ endif(DEFINED DATA_INSTALL_DIR) endif(WIN32 AND NOT UNIX) -configure_file(${hedgewars_SOURCE_DIR}/QTfrontend/main.cpp.in - ${hedgewars_SOURCE_DIR}/QTfrontend/main.cpp) configure_file(${hedgewars_SOURCE_DIR}/QTfrontend/hwconsts.h.in ${hedgewars_SOURCE_DIR}/QTfrontend/hwconsts.h) diff -r 94bd2577ebbb -r 7cb230cd2b1d QTfrontend/hwconsts.h.in --- a/QTfrontend/hwconsts.h.in Sat Nov 25 11:56:37 2006 +0000 +++ b/QTfrontend/hwconsts.h.in Sat Nov 25 12:45:18 2006 +0000 @@ -30,3 +30,4 @@ extern QDir * bindir; const QString cProtoVer("${HEDGEWARS_PROTO_VER}"); +const QString cBinDir("${HEDGEWARS_BINDIR}"); diff -r 94bd2577ebbb -r 7cb230cd2b1d QTfrontend/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/main.cpp Sat Nov 25 12:45:18 2006 +0000 @@ -0,0 +1,86 @@ +/* + * Hedgewars, a worms-like game + * Copyright (c) 2005, 2006 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include "hwform.h" +#include "hwconsts.h" + +QDir * bindir; +QDir * cfgdir; +QDir * datadir; + +bool checkForDir(const QString & dir) +{ + QDir tmpdir; + if (!tmpdir.exists(dir)) + if (!tmpdir.mkdir(dir)) + { + QMessageBox::critical(0, + QObject::tr("Error"), + QObject::tr("Cannot create directory %1").arg(dir), + QObject::tr("OK")); + return false; + } + return true; +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDateTime now = QDateTime::currentDateTime(); + QDateTime zero; + srand(now.secsTo(zero)); + + Q_INIT_RESOURCE(hedgewars); + + QTranslator Translator; + Translator.load(":/translations/hedgewars_" + QLocale::system().name()); + app.installTranslator(&Translator); + + QDir mydir(cBinDir); + mydir.cd("bin"); + + bindir = new QDir(cBinDir); + cfgdir = new QDir(); + + cfgdir->setPath(cfgdir->homePath()); + if (checkForDir(cfgdir->absolutePath() + "/.hedgewars")) + { + checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos"); + } + cfgdir->cd(".hedgewars"); + + datadir = new QDir("${HEDGEWARS_DATADIR}"); + if(!datadir->cd("hedgewars/Data")) { + QMessageBox::critical(0, QMessageBox::tr("Error"), + QMessageBox::tr("Failed to open data directory:\n%1\n" + "Please check your installation"). + arg(datadir->absolutePath()+"/hedgewars/Data")); + return 1; + } + + HWForm *Form = new HWForm(); + Form->show(); + return app.exec(); +} diff -r 94bd2577ebbb -r 7cb230cd2b1d QTfrontend/main.cpp.in --- a/QTfrontend/main.cpp.in Sat Nov 25 11:56:37 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Hedgewars, a worms-like game - * Copyright (c) 2005, 2006 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include "hwform.h" -#include "hwconsts.h" - -QDir * bindir; -QDir * cfgdir; -QDir * datadir; - -bool checkForDir(const QString & dir) -{ - QDir tmpdir; - if (!tmpdir.exists(dir)) - if (!tmpdir.mkdir(dir)) - { - QMessageBox::critical(0, - QObject::tr("Error"), - QObject::tr("Cannot create directory %1").arg(dir), - QObject::tr("OK")); - return false; - } - return true; -} - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QDateTime now = QDateTime::currentDateTime(); - QDateTime zero; - srand(now.secsTo(zero)); - - Q_INIT_RESOURCE(hedgewars); - - QTranslator Translator; - Translator.load(":/translations/hedgewars_" + QLocale::system().name()); - app.installTranslator(&Translator); - - QDir mydir("${HEDGEWARS_BINDIR}"); - mydir.cd("bin"); - - bindir = new QDir(mydir); - cfgdir = new QDir(); - - cfgdir->setPath(cfgdir->homePath()); - if (checkForDir(cfgdir->absolutePath() + "/.hedgewars")) - { - checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos"); - } - cfgdir->cd(".hedgewars"); - - datadir = new QDir("${HEDGEWARS_DATADIR}"); - if(!datadir->cd("hedgewars/Data")) { - QMessageBox::critical(0, QMessageBox::tr("Error"), - QMessageBox::tr("Failed to open data directory:\n%1\n" - "Please check your installation"). - arg(datadir->absolutePath()+"/hedgewars/Data")); - return 1; - } - - HWForm *Form = new HWForm(); - Form->show(); - return app.exec(); -}