AtCore 1.0.72
AtCore is a API to manage the serial connection between the computer and 3D Printers.
Loading...
Searching...
No Matches
machineinfo.h
Go to the documentation of this file.
1/* AtCore KDE Libary for 3D Printers
2 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
3 SPDX-FileCopyrightText: 2019 Chris Rizzitello <rizzitello@kde.org>
4 SPDX-FileCopyrightText: 2019 Lays Rodrigues <lays.rodrigues@kde.org>
5*/
6
7#pragma once
8#include "atcore_export.h"
9
10#include <QObject>
11#include <QQmlEngine>
12#include <QSettings>
13#include <QVariant>
15class ATCORE_EXPORT MachineInfo : public QObject
16{
17 Q_OBJECT
18 Q_PROPERTY(QStringList profileNames READ profileNames NOTIFY profilesChanged)
19public:
23 enum class KEY {
24 NAME = 0,
25 BAUDRATE,
26 FIRMWARE,
27 MAXBEDTEMP,
28 MAXEXTTEMP,
29 POSTPAUSE,
30 ISCARTESIAN,
31 XMAX,
32 YMAX,
33 ZMAX,
34 AUTOTEMPREPORT,
35 };
36 Q_ENUM(KEY)
37
38
42 static MachineInfo *instance();
43
47 QObject *qmlSingletonRegister(QQmlEngine *engine, QJSEngine *scriptEngine);
48
55 Q_INVOKABLE QVariantMap readProfile(const QString &profileName) const;
56
64 Q_INVOKABLE QVariant readKey(const QString &profileName, const MachineInfo::KEY key) const;
65
71 void storeProfile(const QMap<MachineInfo::KEY, QVariant> &profile) const;
72
78 Q_INVOKABLE void storeProfile(const QVariantMap &profile) const;
79
88 Q_INVOKABLE bool storeKey(const QString &profileName, const MachineInfo::KEY key, const QVariant &value) const;
89
97 Q_INVOKABLE bool copyProfile(const QString &srcProfile, const QString &destProfile, bool rmSrc = false) const;
103 Q_INVOKABLE bool removeProfile(const QString &profileName) const;
104
109 QStringList profileNames() const;
110
116 Q_INVOKABLE QString keyName(const MachineInfo::KEY key) const;
117
118signals:
122 void profilesChanged() const;
123
124private:
126 MachineInfo(const MachineInfo &other) = delete;
127 explicit MachineInfo(QObject *parent = nullptr);
128 ~MachineInfo() = default;
129
133 struct keyInfo {
134 QString name;
135 QVariant defaultValue;
136 };
140 static const QMap<MachineInfo::KEY, MachineInfo::keyInfo> decoderMap;
141
146 QSettings *m_settings = nullptr;
147};
Definition machineinfo.h:16
~MachineInfo()=default
MachineInfo * operator=(MachineInfo &other)=delete
void profilesChanged() const
A profile has changed.
KEY
KEYS enum Possible keys for the printer settings.
Definition machineinfo.h:23
MachineInfo(const MachineInfo &other)=delete
used to hold MachineInfo::KEY name and defaultValues.
Definition machineinfo.h:133
QString name
Key name used in the settings file.
Definition machineinfo.h:134
QVariant defaultValue
Defaut Value for the key.
Definition machineinfo.h:135