~ubuntu-branches/debian/jessie/stellarium/jessie

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2009-03-13 20:07:22 UTC
  • mfrom: (1.1.8 upstream)
  • mto: (11.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20090313200722-gbgujsmzsa8a02ty
Import upstream version 0.10.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <QTranslator>
23
23
#include "StelMainGraphicsView.hpp"
24
24
#include "StelMainWindow.hpp"
25
 
#include "Translator.hpp"
 
25
#include "StelTranslator.hpp"
26
26
#include <QDebug>
27
27
#include <QGLFormat>
28
28
#include <QPlastiqueStyle>
 
29
#ifdef MACOSX
 
30
#include "StelMacosxDirs.hpp"
 
31
#endif
29
32
 
30
 
//! @class GettextTranslator
 
33
//! @class GettextStelTranslator
31
34
//! Provides i18n support through gettext.
32
 
class GettextTranslator : public QTranslator
 
35
class GettextStelTranslator : public QTranslator
33
36
{
34
37
public:
35
38
        virtual bool isEmpty() const { return false; }
44
47
// Main stellarium procedure
45
48
int main(int argc, char **argv)
46
49
{
47
 
        QApplication::setDesktopSettingsAware(false);
 
50
        QCoreApplication::setApplicationName("stellarium");
 
51
        QCoreApplication::setApplicationVersion(StelApp::getApplicationVersion());
 
52
        QCoreApplication::setOrganizationDomain("stellarium.org");
 
53
        QCoreApplication::setOrganizationName("stellarium");
 
54
        
 
55
        //QApplication::setDesktopSettingsAware(false);
48
56
        QApplication::setStyle(new QPlastiqueStyle());
49
 
        QApplication app(argc, argv);
50
 
        //app.setQuitOnLastWindowClosed(false);
51
 
        GettextTranslator trans;
 
57
        
 
58
        // With Qt 4.5, force the usage of the raster backend
 
59
        char** argv2 = (char**)malloc(sizeof(char*)*(argc+2));
 
60
        memcpy(argv2, argv, argc*sizeof(char*));
 
61
        char cmd1[] = "-graphicssystem";
 
62
        char cmd2[] = "raster";
 
63
        argv2[argc]=cmd1;
 
64
        argv2[argc+1]=cmd2;
 
65
        int argc2 = argc+2;
 
66
        QApplication app(argc2, argv2);
 
67
 
 
68
#ifdef MACOSX
 
69
        StelMacosxDirs::addApplicationPluginDirectory();
 
70
#endif
 
71
        GettextStelTranslator trans;
52
72
        app.installTranslator(&trans);
53
73
        if (!QGLFormat::hasOpenGL())
54
74
        {
55
 
                QMessageBox::information(0, "Stellarium", q_("This system does not support OpenGL."));
 
75
                QMessageBox::warning(0, "Stellarium", q_("This system does not support OpenGL."));
56
76
        }
57
77
        
 
78
        StelMainWindow* mainWin = new StelMainWindow(NULL);
58
79
        StelMainGraphicsView* view = new StelMainGraphicsView(NULL, argc, argv);
59
 
        StelMainWindow* mainWin = new StelMainWindow(NULL);
60
80
        mainWin->setCentralWidget(view);
61
81
        mainWin->init();
62
82
        app.exec();
63
83
        view->deinitGL();
64
84
        delete view;
65
85
        delete mainWin;
 
86
        free(argv2);
66
87
        return 0;
67
88
}