QTfrontend/main.cpp
changeset 5252 ded882439548
parent 5238 46ddaf14509d
child 5257 0bbdd47522b9
equal deleted inserted replaced
5251:f31d1073345e 5252:ded882439548
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
    19 #include <QApplication>
    19 #include "HWApplication.h"
       
    20 
    20 #include <QTranslator>
    21 #include <QTranslator>
    21 #include <QLocale>
    22 #include <QLocale>
    22 #include <QMessageBox>
    23 #include <QMessageBox>
    23 #include <QPlastiqueStyle>
    24 #include <QPlastiqueStyle>
    24 #include <QRegExp>
    25 #include <QRegExp>
    49         }
    50         }
    50     return true;
    51     return true;
    51 }
    52 }
    52 
    53 
    53 int main(int argc, char *argv[]) {
    54 int main(int argc, char *argv[]) {
    54     QApplication app(argc, argv);
    55     HWApplication app(argc, argv);
    55     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
    56     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
    56 
    57 
    57     QStringList arguments = app.arguments();
    58     QStringList arguments = app.arguments();
    58     QMap<QString, QString> parsedArgs;
    59     QMap<QString, QString> parsedArgs;
       
    60 #ifndef __APPLE__
       
    61 //HACK: it's difficult/rarely done to use command line args on macs anyways
       
    62 //      but why does this section of code make the app crash when opening a file?
    59     {
    63     {
    60         QList<QString>::iterator i = arguments.begin();
    64         QList<QString>::iterator i = arguments.begin();
    61         while(i != arguments.end()) {
    65         while(i != arguments.end()) {
    62             QString arg = *i;
    66             QString arg = *i;
    63 
    67 
    68             } else {
    72             } else {
    69               ++i;
    73               ++i;
    70             }
    74             }
    71         }
    75         }
    72     }
    76     }
       
    77 #endif
    73 
    78 
    74     if(parsedArgs.contains("data-dir")) {
    79     if(parsedArgs.contains("data-dir")) {
    75         QFileInfo f(parsedArgs["data-dir"]);
    80         QFileInfo f(parsedArgs["data-dir"]);
    76         if(!f.exists()) {
    81         if(!f.exists()) {
    77             qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath();
    82             qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath();
   453 #ifdef __APPLE__
   458 #ifdef __APPLE__
   454     // this creates the autoreleasepool that prevents leaking
   459     // this creates the autoreleasepool that prevents leaking
   455     CocoaInitializer initializer;
   460     CocoaInitializer initializer;
   456 #endif
   461 #endif
   457 
   462 
   458     HWForm *Form = new HWForm();
   463     app.form = new HWForm();
   459 
   464 
   460     Form->show();
   465     app.form->show();
   461     return app.exec();
   466     return app.exec();
   462 }
   467 }