#ifndef MODLIST #define MODLIST #include "ui_ModListBase.h" #include #include "BocEditor_Impl.h" class QString; class QPoint; class Q3ListViewItem; class QTime; class MainPanel; class STControlEngine; class STRodCrate; class STPixModuleGroup; //class BocEditor_Impl; namespace PixLib{ class PixModule; class PixModuleGroup; class PixConfDBInterface; class PixController; class PixBoc; } namespace SctPixelRod{ class VmeInterface; } using namespace PixLib; using namespace SctPixelRod; class ModListItem : public Q3ListViewItem{ friend class ModList; public: enum ContentType { tnone, tcrate, tgroup, tROD, tBOC, tmodule, tUSB, tTPLL, tDCS, tDCSC }; // ModListItem is a crate ModListItem(STControlEngine &engine_in, Q3ListView *parent, const char *name); ModListItem(STControlEngine &engine_in, Q3ListViewItem *parent, ContentType type_in, int id_in); ModListItem(STControlEngine &engine_in, Q3ListView *parent, STRodCrate *crate); // ModListItem(QListViewItem *parent, PixModule *mod, const char *name); /* ModListItem(STControlEngine &engine_in, QListViewItem *parent, STPixModuleGroup *grp=0); */ /* ModListItem(STControlEngine &engine_in, QListViewItem *parent, PixController *ctrl=0); */ /* ModListItem(STControlEngine &engine_in, QListViewItem *parent, PixBoc *boc=0); */ /* PixBoc *getPixBoc(){return m_boc;}; */ /* PixModule *getModule(){return m_mod;}; */ /* STPixModuleGroup *getGroup() {return m_grp;}; */ STRodCrate *getCrate(); int crateId(){return m_crateId;}; int grpId(){return m_grpId;}; int modId(){return m_modId;}; ContentType getType() /*{return m_type;}*/; ~ModListItem(); /** Write property of bool enabled. */ virtual void setEnabled( const bool& _newVal ); /** Read property of bool enabled. */ virtual const bool& isEnabled(); /** Toggles the enable flag */ virtual void toggleEnable(); /** returns group/ROD-level parent (null if no such parent) **/ ModListItem* parentGroup(); /** returns crate-level parent (null if no such parent) **/ ModListItem* parentCrate(); protected: /** type of referenced object */ ContentType m_type; /* PixModule *m_mod; */ /* STPixModuleGroup *m_grp; */ /* PixController *m_rod; */ /* PixBoc *m_boc; */ /* STRodCrate *m_crate; */ int m_crateId, m_grpId, m_modId; bool m_enabled; STControlEngine &m_engine; }; class ModList : public QWidget, public Ui::ModListBase { Q_OBJECT friend class MainPanel; friend class ModListItem; enum MLmode{DAQList=0, DCSList}; public: ModList( STControlEngine &engine_in, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel, MLmode mode=DAQList); ~ModList(); ModListItem* loadModuleGroup(PixConfDBInterface *DB, VmeInterface *vme); void deleteModuleGroup(ModListItem *); /** Return the currently selected Module as given by currentItem() */ virtual ModListItem * currentModule() const; /** Return the currently selected USB item as given by currentItem() */ ModListItem * currentUSB() const; /** Return the currently selected ROD as given by currentItem() */ ModListItem * currentROD() const; /** Return the currently selected BOC as given by currentItem() */ ModListItem * currentBOC() const; /** Return the currently selected Group as given by currentItem(), or its parent Group */ virtual ModListItem * currentGroup() const; /** Return the currently selected crate as given by currentItem() */ virtual ModListItem * currentCrate() const; std::vector* getBocEditors(){return &m_boceditors;}; protected: void emitStatusChanged(){emit statusChanged();}; public slots: void editModule(Q3ListViewItem *item); void editModule(Q3ListViewItem *in_item, bool doubleClick); void rightClick(Q3ListViewItem *item, const QPoint &, int col); void toggleEnable(Q3ListViewItem *item); /** Update the ListView */ void updateView(); void updateViewDAQ(); void updateViewDCS(); void updateBocEditors(); /** update the status of items in the ListView */ void changeStatus(); void allOff(){allSwitch(false);}; void allOn(){allSwitch(true);}; void allSwitch(bool on); void editClosed(); void saveFromEdit(int); void setBusy(){m_scanBusy=true;}; void setIdle(){m_scanBusy=false;}; signals: // emitted after updating the module list void listUpdated(Q3ListViewItem*); /** emitted after changing the status of items in the ListView */ void statusChanged(); private: STControlEngine &m_engine; std::vector m_boceditors; // QListViewItem *m_crate; bool m_waitForGeoView; // needed to inhibit changes while the other viewer is reading from this MLmode m_mode; bool m_cfgEditOpen; STRodCrate *m_edtCrate; ModListItem *m_edtItem; bool m_scanBusy; QTime *m_lastDcsRead; }; #endif // MODLIST