~daggerstab/stellarium/add-remove-landscapes

« back to all changes in this revision

Viewing changes to src/core/modules/LandscapeMgr.hpp

  • Committer: Bogdan Marinov
  • Date: 2010-09-05 12:28:04 UTC
  • Revision ID: bogdan.marinov84@gmail.com-20100905122804-y935vv39g4k8vibd
merged the AddRemoveLandscapes plug-in into LandscapeMgr and ViewDialog; added some minor features and bug fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Stellarium
3
3
 * Copyright (C) 2006 Fabien Chereau
 
4
 * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
4
5
 *
5
6
 * This program is free software; you can redistribute it and/or
6
7
 * modify it under the terms of the GNU General Public License
174
175
        //! @param d the rotation angle in degrees as an offset from the originally loaded value.
175
176
        void setZRotation(float d);
176
177
 
 
178
        //! Install a landscape from a ZIP archive.
 
179
        //! Expected archive structure: the name of the topmost directory
 
180
        //! that contains a landscape.ini file is assumed to be
 
181
        //! the landscape ID and should be unique.
 
182
        //! This directory and all files in it will be installed, but its
 
183
        //! subdirectories will be skipped along with any other files or
 
184
        //! directories in the archive.
 
185
        //! @param pathToSourceArchive path to the source archive file.
 
186
        //! @param display If true, the landscape will be set to be the current
 
187
        //! landscape after installation.
 
188
        //! @param forAllUsers If true, this function will try to install the
 
189
        //! landscape in a way that meakes it is available to all users of this
 
190
        //! computer. May require running Stellarium as an administrator (root)
 
191
        //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
 
192
        //! @returns the installed landscape's identifier (the folder name), or
 
193
        //! an empty string on failure.
 
194
        QString installLandscapeFromArchive(QString pathToSourceArchive, bool display = false, bool forAllUsers = false);
 
195
 
 
196
        //! Install a landscape from a directory.
 
197
        //! Expected directory structure: the name of the directory that contains
 
198
        //! a landscape.ini file is assumed to be the landscape ID and should be
 
199
        //! unique.
 
200
        //! This directory and all files in it will be installed, but its
 
201
        //! subdirectories will be skipped along with any other files or
 
202
        //! directories in the archive.
 
203
        //! @param pathToSourceLandscapeIni path to a landscape.ini file. Its parent
 
204
        //! directory is assumed to be the landscape source directory.
 
205
        //! @param display If true, the landscape will be set to be the current
 
206
        //! landscape after installation.
 
207
        //! @param forAllUsers If true, this function will try to install the
 
208
        //! landscape in a way that meakes it is available to all users of this
 
209
        //! computer. May require running Stellarium as an administrator (root)
 
210
        //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
 
211
        //! @returns the installed landscape's identifier (the folder name), or
 
212
        //! an empty string on failure.
 
213
        //QString installLandscapeFromDirectory(QString pathToSourceLandscapeIni, bool display = false, bool forAllUsers = false);
 
214
 
 
215
        //! This function removes a landscape from the user data directory.
 
216
        //! It tries to recursively delete all files in the landscape directory
 
217
        //! and then remove it. If it encounters any file that can't be deleted
 
218
        //! it aborts the operation (previously deleted files are not restored).
 
219
        //! @param landscapeID an installed landscape's identifier (the folder name)
 
220
        bool removeLandscape(QString landscapeID);
 
221
 
 
222
        //! This function reads a landscape's name from its configuration file.
 
223
        //! @param landscapeID an installed landscape's identifier (the folder name)
 
224
        //! @returns an empty string if there is no such landscape or some other
 
225
        //! error occurs
 
226
        QString loadLandscapeName(QString landscapeID);
 
227
 
 
228
        //! This function calculates and returns a landscape's disc size in bytes.
 
229
        //! It adds up the sizes of all files in the landscape's folder. It assumes
 
230
        //! that there are no sub-directories. (There shouldn't be any anyway.)
 
231
        //! @param landscapeID an installed landscape's identifier (the folder name)
 
232
        quint64 loadLandscapeSize(QString landscapeID);
 
233
 
 
234
signals:
 
235
        //! Emitted when a landscape has been installed or un-installed.
 
236
        //! For example, it is used to update the list of landscapes in
 
237
        //! the Sky and viewing options window (the ViewDialog class)
 
238
        void landscapesChanged();
 
239
 
177
240
private:
178
241
        //! Get light pollution luminance level.
179
242
        float getAtmosphereLightPollutionLuminance() const;
188
251
        //! Return a map of landscape name to landscape ID (directory name).
189
252
        QMap<QString,QString> getNameToDirMap() const;
190
253
 
 
254
        //! Returns the path to an installed landscape's directory.
 
255
        //! It uses StelFileMgr to look for it in the possible directories.
 
256
        //! @param landscapeID an installed landscape's identifier (the folder name)
 
257
        //! @returns an empty string, if no such landscape was found.
 
258
        QString getLandscapePath(QString landscapeID);
 
259
 
191
260
        Atmosphere* atmosphere;                 // Atmosphere
192
261
        Cardinals* cardinalsPoints;             // Cardinals points
193
262
        Landscape* landscape;                   // The landscape i.e. the fog, the ground and "decor"