QTfrontend/main.cpp
changeset 8355 df0ea4323295
parent 8344 3d18f7f71d65
child 8363 0b4ac686fc44
child 8385 9e8924ff9813
equal deleted inserted replaced
8353:c23bd7ee9a5e 8355:df0ea4323295
    37 #include "DataManager.h"
    37 #include "DataManager.h"
    38 #include "FileEngine.h"
    38 #include "FileEngine.h"
    39 
    39 
    40 #ifdef _WIN32
    40 #ifdef _WIN32
    41 #include <Shlobj.h>
    41 #include <Shlobj.h>
    42 #endif
    42 #elif defined __APPLE__
    43 #ifdef __APPLE__
       
    44 #include "CocoaInitializer.h"
    43 #include "CocoaInitializer.h"
       
    44 #endif
       
    45 #ifndef _WIN32
       
    46 #include <signal.h>
    45 #endif
    47 #endif
    46 
    48 
    47 
    49 
    48 //Determines the day of easter in year
    50 //Determines the day of easter in year
    49 //from http://aa.usno.navy.mil/faq/docs/easter.php,adapted to C/C++
    51 //from http://aa.usno.navy.mil/faq/docs/easter.php,adapted to C/C++
    85     else if (calculateEaster(date.year()) == date)
    87     else if (calculateEaster(date.year()) == date)
    86         season = SEASON_EASTER;
    88         season = SEASON_EASTER;
    87     else
    89     else
    88         season = SEASON_NONE;
    90         season = SEASON_NONE;
    89 }
    91 }
       
    92 #ifndef _WIN32
       
    93 void terminateFrontend(int signal)
       
    94 {
       
    95     QCoreApplication::exit(0);
       
    96 }
       
    97 #endif
    90 
    98 
    91 bool checkForDir(const QString & dir)
    99 bool checkForDir(const QString & dir)
    92 {
   100 {
    93     QDir tmpdir(dir);
   101     QDir tmpdir(dir);
    94     if (!tmpdir.exists())
   102     if (!tmpdir.exists())
   132 {
   140 {
   133 #ifdef __APPLE__
   141 #ifdef __APPLE__
   134     // This creates the autoreleasepool that prevents leaking, and destroys it only on exit
   142     // This creates the autoreleasepool that prevents leaking, and destroys it only on exit
   135     cocoaInit = new CocoaInitializer();
   143     cocoaInit = new CocoaInitializer();
   136     atexit(releaseCocoaPool);
   144     atexit(releaseCocoaPool);
       
   145 #endif
       
   146 
       
   147 #ifndef _WIN32
       
   148     signal(SIGINT, &terminateFrontend);
   137 #endif
   149 #endif
   138 
   150 
   139     HWApplication app(argc, argv);
   151     HWApplication app(argc, argv);
   140 
   152 
   141     QLabel *splash = NULL;
   153     QLabel *splash = NULL;