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

« back to all changes in this revision

Viewing changes to src/QtScriptMgr.hpp

  • 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:
1
 
/*
2
 
 * Stellarium
3
 
 * Copyright (C) 2007 Fabien Chereau
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License
7
 
 * as published by the Free Software Foundation; either version 2
8
 
 * of the License, or (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 */
19
 
 
20
 
#ifndef _QTSCRIPTMGR_HPP_
21
 
#define _QTSCRIPTMGR_HPP_
22
 
 
23
 
#include <QObject>
24
 
#include <QtScript>
25
 
#include "vecmath.h"
26
 
 
27
 
        
28
 
//! Provide script API for Stellarium global functions
29
 
class StelMainScriptAPI : public QObject
30
 
{
31
 
        Q_OBJECT
32
 
        Q_PROPERTY(double JDay READ getJDay WRITE setJDay)
33
 
        Q_PROPERTY(double timeSpeed READ getTimeSpeed WRITE setTimeSpeed)
34
 
                                        
35
 
public:
36
 
        StelMainScriptAPI(QObject *parent = 0);
37
 
        ~StelMainScriptAPI();
38
 
        
39
 
// Theses functions will be available in scripts
40
 
public slots:
41
 
        //! Set the current date in Julian Day
42
 
        //! @param JD the Julian Date
43
 
        void setJDay(double JD);
44
 
        //! Get the current date in Julian Day
45
 
        //! @return the Julian Date
46
 
        double getJDay(void) const;
47
 
                
48
 
        //! Set time speed in JDay/sec
49
 
        //! @param ts time speed in JDay/sec
50
 
        void setTimeSpeed(double ts);
51
 
        //! Get time speed in JDay/sec
52
 
        //! @return time speed in JDay/sec
53
 
        double getTimeSpeed(void) const;
54
 
};
55
 
                
56
 
//! Manage scripting in Stellarium
57
 
class QtScriptMgr : public QObject
58
 
{
59
 
Q_OBJECT
60
 
                
61
 
public:
62
 
    QtScriptMgr(QObject *parent = 0);
63
 
    ~QtScriptMgr();
64
 
        
65
 
        void test();
66
 
        
67
 
private:
68
 
        QScriptEngine engine;
69
 
};
70
 
 
71
 
#endif // _QTSCRIPTMGR_HPP_