diff --git a/src/core/machineinfo.h b/src/core/machineinfo.h index e47f764..15e5bce 100644 --- a/src/core/machineinfo.h +++ b/src/core/machineinfo.h @@ -1,164 +1,165 @@ /* AtCore Copyright (C) <2019> Authors: Chris Rizzitello This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #pragma once #include "atcore_export.h" #include #include #include #include class ATCORE_EXPORT MachineInfo : public QObject { Q_OBJECT + Q_PROPERTY(QStringList profileNames READ profileNames NOTIFY profilesChanged) public: /** * @brief KEYS enum Possible keys for the printer settings */ enum class KEY { NAME = 0, //!< Profile Name BAUDRATE, //!< Machine BAUD Rate FIRMWARE, //! &profile) const; /** * @brief Store a new profile, Must be used for new profiles or to override a profile. * @param profile: A complete machine profile or one that at very least has a profile Name and any other valid Key. * @sa storeKey() */ Q_INVOKABLE void storeProfile(const QVariantMap &profile) const; /** * @brief Store a key to an existing profile, Sending a key of Key::NAME will rename the profile * @param profileName: profile to write into * @param key: The key you will write to * @param value: The value you will store. * @return true if successful * @sa storeProfile() */ Q_INVOKABLE bool storeKey(const QString &profileName, const MachineInfo::KEY key, const QVariant &value) const; /** * @brief copyies a profile and optionally deletes the src profile * @param srcProfile: profiles Current Name * @param destProfile: profiles New Name * @param rmSrc: delete srcProfile (defalut false) * @return true if successful */ Q_INVOKABLE bool copyProfile(const QString &srcProfile, const QString &destProfile, bool rmSrc = false) const; /** * @brief Remove a full profile * @param profileName: name of the profile you want to remove. * @return true if successful. */ Q_INVOKABLE bool removeProfile(const QString &profileName) const; /** * @brief Get a list of all the profile names * @return QStringList containing the stored profile names. */ - Q_INVOKABLE QStringList profileNames() const; + QStringList profileNames() const; /** * @brief Translate a key enum to string * @param key: name of the key to be translated. * @return key string if successful. */ Q_INVOKABLE QString keyName(const MachineInfo::KEY key) const; signals: /** * @brief A profile has changed */ void profilesChanged() const; private: MachineInfo *operator = (MachineInfo &other) = delete; MachineInfo(const MachineInfo &other) = delete; explicit MachineInfo(QObject *parent = nullptr); ~MachineInfo() = default; /** * @brief used to hold MachineInfo::KEY name and defaultValues. */ struct keyInfo { QString name; //!< Key name used in the settings file QVariant defaultValue; //!< Defaut Value for the key }; /** * @brief Map of MachineInfo::KEY , KeyString and DefaultValue */ static const QMap decoderMap; /** * @brief m_settings our settings object. */ QSettings *m_settings = nullptr; };