VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
LevelInfo.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LEVELINFO_H
18 #define LEVELINFO_H
19 
20 #include <QObject>
21 #include <QString>
22 
23 class Environment;
24 
31 class LevelInfo : public QObject {
32  Q_OBJECT
33 
37  Q_PROPERTY(QString name READ getName WRITE setName NOTIFY nameChanged)
41  Q_PROPERTY(QString fileName READ getFileName WRITE setFileName NOTIFY fileNameChanged)
45  Q_PROPERTY(bool tutorial READ isTutorial WRITE setTutorial NOTIFY tutorialChanged)
56 
57 public:
62  explicit LevelInfo(QObject* parent = nullptr);
63 
67  const QString& getName() const { return mName; }
72  void setName(const QString& value);
76  const QString& getFileName() const { return mFileName; }
81  void setFileName(const QString& value);
85  bool isTutorial() const { return mTutorial; }
90  void setTutorial(bool value);
94  const QString& getScreenshotFileName() const { return mScreenshotFileName; }
99  void setScreenshotFileName(const QString& value);
103  Environment* getEnvironment() const;
104 
105 signals:
109  void nameChanged();
113  void fileNameChanged();
117  void tutorialChanged();
122 
123 private:
124  QString mName;
125  QString mFileName;
126  bool mTutorial = false;
127  QString mScreenshotFileName;
128  mutable Environment* mEnvironment = nullptr;
129 };
130 Q_DECLARE_METATYPE(LevelInfo*)
131 
132 #endif // LEVELINFO_H
void tutorialChanged()
Emitted when tutorial changes.
void nameChanged()
Emitted when name changes.
void fileNameChanged()
Emitted when fileName changes.
bool tutorial
Whether or not the Level is a tutorial level.
Definition: LevelInfo.h:45
const QString & getName() const
Returns name.
Definition: LevelInfo.h:67
void setTutorial(bool value)
Sets tutorial.
Metadata for a Level.
Definition: LevelInfo.h:31
Environment * getEnvironment() const
Returns environment.
QString name
Human-readable name of the Level.
Definition: LevelInfo.h:37
Environment environment
Environment to which this LevelInfo belongs, or null if defined out of the context of an Environment...
Definition: LevelInfo.h:55
void screenshotFileNameChanged()
Emitted when screenshotFileName changes.
void setName(const QString &value)
Sets name.
bool isTutorial() const
Returns tutorial.
Definition: LevelInfo.h:85
const QString & getFileName() const
Returns fileName.
Definition: LevelInfo.h:76
QString screenshotFileName
Name of image asset file for the Level screenshot / thumbnail.
Definition: LevelInfo.h:50
void setScreenshotFileName(const QString &value)
Sets screenshotFileName.
void setFileName(const QString &value)
Sets fileName.
const QString & getScreenshotFileName() const
Returns screenshotFileName.
Definition: LevelInfo.h:94
Grouping of related LevelInfos together into an logical, ordered list.
Definition: Environment.h:37
QObject * parent() const
QString fileName
Name of QML level file to be used for loading the Level.
Definition: LevelInfo.h:41