File indexing completed on 2024-07-21 06:28:21

0001 /*
0002     SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QDialog>
0010 
0011 #include <QFrame>
0012 #include <QHBoxLayout>
0013 #include <QLabel>
0014 #include <QVBoxLayout>
0015 #include <QMutex>
0016 
0017 #include <indiapi.h>
0018 #include <basedevice.h>
0019 
0020 class QTextEdit;
0021 class QTabWidget;
0022 class QSplitter;
0023 class GUIManager;
0024 class ClientManager;
0025 class INDI_G;
0026 
0027 /**
0028  * @class INDI_D
0029  * INDI_D represents an INDI GUI Device. INDI_D is the top level device container. It contains a collection of groups of properties.
0030  * Each group is represented as a separate tab within the GUI.
0031  *
0032  * @author Jasem Mutlaq
0033  */
0034 class INDI_D : public QWidget
0035 {
0036         Q_OBJECT
0037     public:
0038         INDI_D(QWidget *parent, INDI::BaseDevice baseDevice, ClientManager *in_cm);
0039 
0040 
0041         ClientManager *getClientManager() const
0042         {
0043             return m_ClientManager;
0044         }
0045 
0046         INDI_G *getGroup(const QString &groupName) const;
0047 
0048         INDI::BaseDevice getBaseDevice() const
0049         {
0050             return m_BaseDevice;
0051         }
0052 
0053         QList<INDI_G *> getGroups() const
0054         {
0055             return groupsList;
0056         }
0057 
0058         void clearMessageLog();
0059 
0060         const QString &name() const
0061         {
0062             return m_Name;
0063         }
0064 
0065     public slots:
0066         bool buildProperty(INDI::Property prop);
0067         bool updateProperty(INDI::Property prop);
0068         bool removeProperty(INDI::Property prop);
0069 
0070         bool updateSwitchGUI(INDI::Property prop);
0071         bool updateTextGUI(INDI::Property prop);
0072         bool updateNumberGUI(INDI::Property prop);
0073         bool updateLightGUI(INDI::Property prop);
0074         bool updateBLOBGUI(INDI::Property prop);
0075 
0076         void updateMessageLog(INDI::BaseDevice idv, int messageID);
0077 
0078     private:
0079         QString m_Name;
0080 
0081         // GUI
0082         QSplitter *deviceVBox { nullptr };
0083         QTabWidget *groupContainer { nullptr };
0084         QTextEdit *msgST_w { nullptr };
0085 
0086         // Managers
0087         INDI::BaseDevice m_BaseDevice;
0088         ClientManager *m_ClientManager { nullptr };
0089 
0090         QList<INDI_G *> groupsList;
0091 };