• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

indielement.h

Go to the documentation of this file.
00001 /*  INDI Element
00002     Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
00003 
00004     This application is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008     
00009     2004-01-15  INDI element is the most basic unit of the INDI KStars client.
00010  */
00011 
00012 #ifndef INDIELEMENT_H
00013 #define INDIELEMENT_H
00014 
00015 #include <kdialogbase.h>
00016 #include <unistd.h>
00017 #include <qstring.h>
00018 #include <qptrlist.h>
00019 
00020 #include "indi/lilxml.h"
00021 
00022 #define INDIVERSION 1.5 /* we support this or less */
00023 
00024 /* GUI layout */
00025 #define PROPERTY_LABEL_WIDTH    80
00026 #define ELEMENT_LABEL_WIDTH 175
00027 #define ELEMENT_READ_WIDTH  175
00028 #define ELEMENT_WRITE_WIDTH 175
00029 #define ELEMENT_FULL_WIDTH  340
00030 #define MIN_SET_WIDTH       50
00031 #define MAX_SET_WIDTH       110
00032 #define MAXINDINAME     32
00033 #define MED_INDI_FONT       2
00034 #define MAX_LABEL_LENGTH    20
00035 
00036 // Pulse tracking
00037 #define INDI_PULSE_TRACKING   15000
00038 
00039 /* decoded elements.
00040  * lights use PState, TB's use the alternate binary names.
00041  */
00042 typedef enum {PS_IDLE = 0, PS_OK, PS_BUSY, PS_ALERT, PS_N} PState;
00043 #define PS_OFF  PS_IDLE     /* alternate name */
00044 #define PS_ON   PS_OK       /* alternate name */
00045 typedef enum {PP_RW = 0, PP_WO, PP_RO} PPerm;
00046 typedef enum {PG_NONE = 0, PG_TEXT, PG_NUMERIC, PG_BUTTONS,
00047   PG_RADIO, PG_MENU, PG_LIGHTS, PG_BLOB} PGui;
00048 
00049 /* INDI std properties */
00050 /* N.B. Need to modify corresponding entry in indidevice.cpp when changed */    
00051 enum stdProperties { CONNECTION, DEVICE_PORT, TIME, SDTIME, GEOGRAPHIC_COORD,   /* General */
00052                      EQUATORIAL_COORD, EQUATORIAL_EOD_COORD, HORIZONTAL_COORD,  /* Telescope */
00053                      ABORT_MOTION, ON_COORD_SET, SOLAR_SYSTEM, MOVEMENT, PARK,  /* Telescope */
00054                      CCD_EXPOSE_DURATION, CCD_TEMPERATURE, CCD_FRAME,           /* CCD */
00055                      CCD_FRAME_TYPE, CCD_BINNING, CCD_INFO, CCDPREVIEW_STREAM,  /* CCD */
00056                      CCDPREVIEW_CTRL,                       /* CCD */
00057                      VIDEO_STREAM,                      /* Video */
00058              FOCUS_SPEED, FOCUS_MOTION, FOCUS_TIMER,            /* Focuser */
00059                      FILTER_SLOT};                      /* Filter */
00060              
00061 /* Devices families that we explicity support (i.e. with std properties) */
00062 enum deviceFamily { KSTARS_TELESCOPE, KSTARS_CCD, KSTARS_FILTER, KSTARS_VIDEO, KSTARS_FOCUSER, KSTARS_DOME, KSTARS_GPS };
00063 
00064 #define MAXSCSTEPS  1000    /* max number of steps in a scale */
00065 #define MAXRADIO    4   /* max numbere of buttons in a property */
00066 
00067 /* Forward decleration */
00068 class KLed;
00069 class KLineEdit;
00070 class KDoubleSpinBox;
00071 class KPushButton;
00072 class KCheckBox;
00073 class KSqueezedTextLabel;
00074 
00075 class QLabel;
00076 class QHBoxLayout;
00077 class QVBoxLayout;
00078 class QSpacerItem;
00079 class QCheckBox;
00080 class QSlider;
00081 
00082 class INDI_P;
00083 
00084 /* Useful XML functions */
00085 XMLAtt *   findAtt     (XMLEle *ep  , const char *name , char errmsg[]);
00086 XMLEle *   findEle     (XMLEle *ep  , INDI_P *pp, const char *child, char errmsg[]);
00087 
00088 /* INDI Element */
00089 class INDI_E : public QObject
00090 {
00091  Q_OBJECT
00092  public:
00093   INDI_E(INDI_P *parentProperty, QString inName, QString inLabel);
00094   ~INDI_E();
00095     QString name;           /*  name */
00096     QString label;          /* label is the name by default, unless specefied */
00097     PState state;           /* control on/off t/f etc */
00098     INDI_P *pp;             /* parent property */
00099 
00100     QHBoxLayout    *EHBox;          /* Horizontal layout */
00101     
00102     /* GUI widgets, only malloced when needed */
00103     KSqueezedTextLabel *label_w;    // label
00104     KLineEdit      *read_w;     // read field
00105     KLineEdit      *write_w;        // write field
00106     KLed       *led_w;      // light led
00107     KDoubleSpinBox *spin_w;     // spinbox
00108     QSlider    *slider_w;       // Slider
00109     KPushButton    *push_w;     // push button
00110     KPushButton    *browse_w;       // browse button
00111     QCheckBox      *check_w;        // check box
00112     QSpacerItem    *hSpacer;        // Horizontal spacer
00113     
00114     double min, max, step;      // params for scale
00115     double value;           // current value
00116     double targetValue;         // target value
00117     QString text;           // current text
00118     QString format;         // number format, if applicable
00119     
00120    int buildTextGUI    (QString initText);
00121    int buildNumberGUI  (double initValue);
00122    int buildLightGUI();
00123    int buildBLOBGUI();
00124    void drawLt();
00125    
00126    void initNumberValues(double newMin, double newMax, double newStep, char * newFormat);
00127    void updateValue(double newValue);
00128    void setMin (double inMin);
00129    void setMax (double inMax);
00130    
00131    void setupElementLabel();
00132    void setupElementRead(int length);
00133    void setupElementWrite(int length);
00134    void setupElementScale(int length);
00135    void setupBrowseButton();
00136    
00137    public slots:
00138    void spinChanged(double value);
00139    void sliderChanged(int value);
00140    void browseBlob();
00141 
00142 };
00143 
00144 #endif

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal