Skip to content

Commit

Permalink
About: Manage Simulation in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien Proriol committed Jul 22, 2015
1 parent 1df6572 commit a327925
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions carmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,15 @@ void CarManager::importFromFuelpad(QString filename, QString name)
db.close();
}

bool CarManager::is_debug() const
{
#ifdef QT_NO_DEBUG
return false;
#else
return true;
#endif
}

QString CarManager::getEnv(QString name)
{
qDebug() << "Find environment value for" << name << ": " << getenv(name.toStdString().c_str());
Expand Down
2 changes: 2 additions & 0 deletions carmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CarManager : public QObject

Q_PROPERTY(QStringList cars READ cars NOTIFY carsChanged())
Q_PROPERTY(Car *car READ car NOTIFY carChanged())
Q_PROPERTY(bool is_debug READ is_debug CONSTANT)

private:
QStringList _cars;
Expand Down Expand Up @@ -61,5 +62,6 @@ public slots:
void createCar(QString name);
void importFromMyCar( QString filename, QString name);
void importFromFuelpad( QString filenme, QString name);
bool is_debug() const;
};
#endif // CARMANAGER_H
6 changes: 4 additions & 2 deletions qml/pages/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ Page {
anchors.fill: parent

// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
/*
PullDownMenu {
enabled: manager.is_debug
visible: manager.is_debug

MenuItem {
text: qsTr("Simulation")
onClicked: {
manager.car.simulation()
}
}
}
*/


// Tell SilicaFlickable the height of its content.
contentHeight: column.height
Expand Down

0 comments on commit a327925

Please sign in to comment.