Skip to content

Commit 1669284

Browse files
committed
Add LibraryInfo class
1 parent d6013f8 commit 1669284

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

src/app/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ qt_add_executable(${APP_TARGET}
66
app.h
77
appmenubar.cpp
88
appmenubar.h
9+
libraryinfo.cpp
10+
libraryinfo.h
911
)
1012

1113
qt_add_qml_module(${APP_TARGET}

src/app/libraryinfo.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
#include <scratchcpp/scratchconfiguration.h>
4+
#include <scratchcpp-render/scratchcpp-render.h>
5+
6+
#include "libraryinfo.h"
7+
8+
using namespace scratchcpp;
9+
10+
LibraryInfo::LibraryInfo(QObject *parent) :
11+
QObject(parent)
12+
{
13+
}
14+
15+
QString LibraryInfo::libscratchcppVersion() const
16+
{
17+
return QString::fromStdString(libscratchcpp::ScratchConfiguration::version());
18+
}
19+
20+
QString LibraryInfo::scratchcppRenderVersion() const
21+
{
22+
return QString::fromStdString(scratchcpprender::version());
23+
}

src/app/libraryinfo.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
#pragma once
4+
5+
#include <QQmlEngine>
6+
7+
namespace scratchcpp
8+
{
9+
10+
class LibraryInfo : public QObject
11+
{
12+
Q_OBJECT
13+
QML_ELEMENT
14+
QML_SINGLETON
15+
public:
16+
explicit LibraryInfo(QObject *parent = nullptr);
17+
18+
Q_INVOKABLE QString libscratchcppVersion() const;
19+
Q_INVOKABLE QString scratchcppRenderVersion() const;
20+
};
21+
22+
} // namespace scratchcpp

0 commit comments

Comments
 (0)