Index: /trunk/FACT++/gui/FactGui.h
===================================================================
--- /trunk/FACT++/gui/FactGui.h	(revision 10517)
+++ /trunk/FACT++/gui/FactGui.h	(revision 10518)
@@ -5,8 +5,10 @@
 
 #include <iomanip>
+#include <valarray>
 
 #include <boost/bind.hpp>
 
-#include <QtGui/QStandardItemModel>
+#include <QTimer>
+#include <QStandardItemModel>
 
 #include "CheckBoxDelegate.h"
@@ -15,6 +17,289 @@
 #include "src/HeadersFTM.h"
 #include "src/DimNetwork.h"
+#include "src/tools.h"
+
+#include "TROOT.h"
+#include "TSystem.h"
+#include "TGraph.h"
+#include "TH1.h"
+#include "TStyle.h"
+#include "TMarker.h"
+#include "TColor.h"
 
 using namespace std;
+    class Camera : public TObject
+    {
+        typedef pair<double,double> Position;
+        typedef vector<Position> Positions;
+        Positions fGeom;
+
+    void CreatePalette()
+        {
+            /*
+        double ss[5] = {0., 0.10, 0.45, 0.75, 1.00};
+        double rr[5] = {0., 0.35, 0.85, 1.00, 1.00};
+        double gg[5] = {0., 0.10, 0.20, 0.73, 1.00};
+        double bb[5] = {0., 0.03, 0.06, 0.00, 1.00};
+              */
+        double ss[5] = {0., 0.25, 0.50, 0.75, 1.00};
+        double rr[5] = {0., 0.00, 0.00, 1.00, 1.00};
+        double gg[5] = {0., 0.00, 1.00, 0.00, 1.00};
+        double bb[5] = {0., 1.00, 0.00, 0.00, 1.00};
+
+        const Int_t nn = 1438;
+
+        Int_t idx = TColor::CreateGradientColorTable(5, ss, rr, gg, bb, nn);
+        for (int i=0; i<nn; i++)
+            fPalette.push_back(idx++);
+    }
+
+    void CreateGeometry()
+    {
+        const double gsSin60 = sqrt(3.)/2;  
+
+        const int rings = 23;
+
+        //  add the first pixel to the list
+
+        fGeom.push_back(make_pair(0, -0.5));
+
+        for (int ring=1; ring<=rings; ring++)
+        {
+            for (int s=0; s<6; s++)
+            {
+                for (int i=1; i<=ring; i++)
+                {
+                    double xx, yy;
+                    switch (s)
+                    {
+                    case 0: // Direction South East
+                        xx = (ring+i)*0.5;
+                        yy = (-ring+i)*gsSin60;
+                        break;
+
+                    case 1: // Direction North East
+                        xx = ring-i*0.5;
+                        yy = i*gsSin60;
+                        break;
+
+                    case 2: // Direction North
+                        xx = ring*0.5-i;
+                        yy = ring*gsSin60;
+                        break;
+
+                    case 3: // Direction North West
+                        xx = -(ring+i)*0.5;
+                        yy = (ring-i)*gsSin60;
+                        break;
+
+                    case 4: // Direction South West
+                        xx = 0.5*i-ring;
+                        yy = -i*gsSin60;
+                        break;
+
+                    case 5: // Direction South
+                        xx = i-ring*0.5;
+                        yy = -ring*gsSin60;
+                        break;
+                    }
+
+                    if (xx*xx + yy*yy - xx > 395.75)
+                        continue;
+
+                    fGeom.push_back(make_pair(yy, xx-0.5));
+                }
+            }
+        }
+    }
+
+    valarray<double> fData;
+    map<int, bool>   fBold;
+    map<int, bool>   fEnable;
+
+    int fWhite;
+
+public:
+    Camera() : fData(0., 1438), fWhite(-1)
+    {
+        CreatePalette();
+        CreateGeometry();
+
+        for (int i=0; i<1438; i++)
+            fData[i] = i;
+    }
+
+    void Reset() { fBold.clear(); }
+
+    void SetBold(int idx) { fBold[idx]=true; }
+    void SetWhite(int idx) { fWhite=idx; }
+    void SetEnable(int idx, bool b) { fEnable[idx]=b; }
+    void Toggle(int idx) { fEnable[idx]=!fEnable[idx]; }
+
+    const char *GetName() const { return "Camera"; }
+
+    vector<Int_t> fPalette;
+
+    void Paint(const Position &p)
+    {
+        static const Double_t fgCos60 = 0.5;        // TMath::Cos(60/TMath::RadToDeg());
+        static const Double_t fgSin60 = sqrt(3.)/2; // TMath::Sin(60/TMath::RadToDeg());
+
+        static const Double_t fgDy[6] = { fgCos60,   0.,         -fgCos60,   -fgCos60,    0.,           fgCos60   };
+        static const Double_t fgDx[6] = { fgSin60/3, fgSin60*2/3, fgSin60/3, -fgSin60/3, -fgSin60*2/3, -fgSin60/3 };
+
+        //
+        //  calculate the positions of the pixel corners
+        //
+        Double_t x[7], y[7];
+        for (Int_t i=0; i<7; i++)
+        {
+            x[i] = p.first  + fgDx[i%6];
+            y[i] = p.second + fgDy[i%6];
+        }
+
+        gPad->PaintFillArea(6, x, y);
+        gPad->PaintPolyLine(7, x, y);
+
+    }
+
+    void Paint(Option_t *)
+    {
+        gStyle->SetPalette(fPalette.size(), fPalette.data());
+
+
+        const double r   = double(gPad->GetWw())/gPad->GetWh();
+        const double max = 20.5; // 20.5 rings in x and y
+
+        if (r>1)
+            gPad->Range(-r*max, -max, r*max, max);
+        else
+            gPad->Range(-max, -max/r, max, max/r);
+
+
+        const double min   = fData.min();
+        const double scale = fData.max()-fData.min();
+
+        TAttFill fill(0, 1001);
+        TAttLine line;
+
+        int cnt=0;
+        for (Positions::iterator p=fGeom.begin(); p!=fGeom.end(); p++, cnt++)
+        {
+            if (fBold[cnt])
+                continue;
+
+
+            const int col = (fData[cnt]-min)/scale*(fPalette.size()-1);
+
+            if (fEnable[cnt])
+                fill.SetFillColor(gStyle->GetColorPalette(col));
+            else
+                fill.SetFillColor(kWhite);
+
+            fill.Modify();
+
+            Paint(*p);
+        }
+
+        line.SetLineWidth(2);
+        line.Modify();
+
+        cnt = 0;
+        for (Positions::iterator p=fGeom.begin(); p!=fGeom.end(); p++, cnt++)
+        {
+            if (!fBold[cnt])
+                continue;
+
+            const int col = (fData[cnt]-min)/scale*(fPalette.size()-1);
+
+            if (fEnable[cnt])
+                fill.SetFillColor(gStyle->GetColorPalette(col));
+            else
+                fill.SetFillColor(kWhite);
+            fill.Modify();
+
+            Paint(*p);
+        }
+
+        TMarker m(0,0,kStar);
+        m.DrawMarker(0, 0);
+
+        if (fWhite<0)
+            return;
+
+        const Position &p = fGeom[fWhite];
+
+        line.SetLineColor(kWhite);
+        line.Modify();
+
+        const int col = (fData[fWhite]-min)/scale*(fPalette.size()-1);
+
+        if (fEnable[fWhite])
+            fill.SetFillColor(gStyle->GetColorPalette(col));
+        else
+            fill.SetFillColor(kWhite);
+        fill.Modify();
+
+        Paint(p);
+    }
+
+    int GetIdx(float px, float py) const
+    {
+        static const double sqrt3 = sqrt(3);
+
+        int idx = 0;
+        for (Positions::const_iterator p=fGeom.begin(); p!=fGeom.end(); p++, idx++)
+        {
+            const Double_t dy = py - p->second;
+            if (fabs(dy)>0.5)
+                continue;
+
+            const Double_t dx = px - p->first;
+
+            if  (TMath::Abs(dy + dx*sqrt3) > 1)
+                continue;
+
+            if  (TMath::Abs(dy - dx*sqrt3) > 1)
+                continue;
+
+            return idx;
+        }
+        return -1;
+    }
+
+    char* GetObjectInfo(Int_t px, Int_t py) const
+    {
+        static stringstream stream;
+        static string       str;
+
+        const float x = gPad->PadtoX(gPad->AbsPixeltoX(px));
+        const float y = gPad->PadtoY(gPad->AbsPixeltoY(py));
+
+        const int idx = GetIdx(x, y);
+
+        stream.seekp(0);
+        if (idx>=0)
+            stream << "Pixel=" << idx << "   Data=" << fData[idx] << '\0';
+
+        str = stream.str();
+        return const_cast<char*>(str.c_str());
+    }
+
+    Int_t DistancetoPrimitive(Int_t px, Int_t py)
+    {
+        const float x = gPad->PadtoX(gPad->AbsPixeltoX(px));
+        const float y = gPad->PadtoY(gPad->AbsPixeltoY(py));
+
+        return GetIdx(x, y)>=0 ? 0 : 99999;
+    }
+
+    void SetData(const valarray<double> &data)
+    {
+        fData = data;
+    }
+
+
+    };
+
 
 class FactGui : public MainWindow, public DimNetwork
@@ -33,8 +318,22 @@
     };
 
-    DimInfo fDimDNS;
+    DimStampedInfo fDimDNS;
+
+    DimStampedInfo fDimLoggerStats;
+    DimStampedInfo fDimLoggerFilenameNight;
+    DimStampedInfo fDimLoggerFilenameRun;
+    DimStampedInfo fDimLoggerNumSubs;
+
+    DimStampedInfo fDimFtmPassport;
+    DimStampedInfo fDimFtmTriggerCounter;
+    DimStampedInfo fDimFtmError;
+    DimStampedInfo fDimFtmFtuList;
+    DimStampedInfo fDimFtmStaticData;
+    DimStampedInfo fDimFtmDynamicData;
+
+    vector<DimInfo*> fDim;
     map<string, DimInfo*> fServices;
 
-    // ======================================================================
+    // ===================== Services and Commands ==========================
 
     QStandardItem *AddServiceItem(const std::string &server, const std::string &service, bool iscmd)
@@ -112,4 +411,66 @@
         desc->setSelectable(false);
         item->setChild(0, 0, desc);
+    }
+
+    void AddServer(const std::string &s)
+    {
+        DimNetwork::AddServer(s);
+
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleAddServer, this, s)));
+    }
+
+    void RemoveServer(const std::string &s)
+    {
+        UnsubscribeServer(s);
+
+        DimNetwork::RemoveServer(s);
+
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleRemoveServer, this, s)));
+    }
+
+    void RemoveAllServers()
+    {
+        UnsubscribeAllServers();
+
+        vector<string> v = GetServerList();
+        for (vector<string>::iterator i=v.begin(); i<v.end(); i++)
+            QApplication::postEvent(this,
+                                    new FunctionEvent(boost::bind(&FactGui::handleStateOffline, this, *i)));
+
+        DimNetwork::RemoveAllServers();
+
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleRemoveAllServers, this)));
+    }
+
+    void AddService(const std::string &server, const std::string &service, const std::string &fmt, bool iscmd)
+    {
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleAddService, this, server, service, fmt, iscmd)));
+    }
+
+    void RemoveService(const std::string &server, const std::string &service, bool iscmd)
+    {
+        if (fServices.find(server+'/'+service)!=fServices.end())
+            UnsubscribeService(server+'/'+service);
+
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleRemoveService, this, server, service, iscmd)));
+    }
+
+    void RemoveAllServices(const std::string &server)
+    {
+        UnsubscribeServer(server);
+
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleRemoveAllServices, this, server)));
+    }
+
+    void AddDescription(const std::string &server, const std::string &service, const vector<Description> &vec)
+    {
+        QApplication::postEvent(this,
+           new FunctionEvent(boost::bind(&FactGui::handleAddDescription, this, server, service, vec)));
     }
 
@@ -194,4 +555,493 @@
     }
 
+    // ======================================================================
+
+    void SubscribeService(const string &service)
+    {
+        if (fServices.find(service)!=fServices.end())
+        {
+            cout << "ERROR - We are already subscribed to " << service << endl;
+            return;
+        }
+
+        fServices[service] = new DimStampedInfo(service.c_str(), (void*)NULL, 0, this);
+    }
+
+    void UnsubscribeService(const string &service)
+    {
+        const map<string,DimInfo*>::iterator i=fServices.find(service);
+
+        if (i==fServices.end())
+        {
+            cout << "ERROR - We are not subscribed to " << service << endl;
+            return;
+        }
+
+        delete i->second;
+
+        fServices.erase(i);
+    }
+
+    void UnsubscribeServer(const string &server)
+    {
+        for (map<string,DimInfo*>::iterator i=fServices.begin();
+             i!=fServices.end(); i++)
+            if (i->first.substr(0, server.length()+1)==server+'/')
+            {
+                delete i->second;
+                fServices.erase(i);
+            }
+    }
+
+    void UnsubscribeAllServers()
+    {
+        for (map<string,DimInfo*>::iterator i=fServices.begin();
+             i!=fServices.end(); i++)
+            delete i->second;
+
+        fServices.clear();
+    }
+
+    // ======================================================================
+
+    struct DimData
+    {
+        Time time;
+        int  qos;
+        string name;
+        string format;
+        vector<char> data;
+
+        DimInfo *info;  // this is ONLY for a fast check of the type of the DimData!!
+
+        DimData(DimInfo *inf) :
+            time(inf->getTimestamp(), inf->getTimestampMillisecs()*1000),
+            qos(inf->getQuality()),
+            name(inf->getName()),
+            format(inf->getFormat()),
+            data(inf->getString(), inf->getString()+inf->getSize()),
+            info(inf)
+        {
+        }
+
+        template<typename T>
+                T get() const { return *reinterpret_cast<const T*>(data.data()); }
+
+            vector<char> vec(int b) const { return vector<char>(data.begin()+b, data.end()); }
+            string str(unsigned int b) const { return b>=data.size()?string():string(data.data()+b, data.size()-b); }
+            const char *c_str() const { return (char*)data.data(); }
+
+            vector<boost::any> any() const
+            {
+                const Converter conv(format);
+                conv.Print();
+                return conv.GetAny(data.data(), data.size());
+            }
+            int size() const { return data.size(); }
+            const void *ptr() const { return data.data(); }
+    };
+
+    // ======================= DNS ==========================================
+
+    void handleDimDNS(int version)
+    {
+        ostringstream str;
+        str << "V" << version/100 << 'r' << version%100;
+
+        if (version==0)
+            fStatusDNSLed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
+        else
+            fStatusDNSLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+        fStatusDNSLabel->setText(version==0?"Offline":str.str().c_str());
+        fStatusDNSLabel->setToolTip(version==0?"No connection to DIM DNS.":"Connection to DIM DNS established.");
+    }
+
+
+    // ======================= Logger =======================================
+
+    void handleLoggerStats(const DimData &d)
+    {
+        const bool connected = d.size()!=0;
+
+        fLoggerET->setEnabled(connected);
+        fLoggerRate->setEnabled(connected);
+        fLoggerWritten->setEnabled(connected);
+        fLoggerFreeSpace->setEnabled(connected);
+        fLoggerSpaceLeft->setEnabled(connected);
+
+        if (!connected)
+            return;
+
+        const vector<boost::any> any = d.any();
+
+        const size_t rate    = boost::any_cast<int>(any[2]);
+        const size_t space   = boost::any_cast<long long>(any[1]);
+        const size_t written = boost::any_cast<long long>(any[0]);
+
+        fLoggerFreeSpace->setSuffix(" MB");
+        fLoggerFreeSpace->setDecimals(0);
+        fLoggerFreeSpace->setValue(space*1e-6);
+
+        if (space>   1000000)  // > 1GB
+        {
+            fLoggerFreeSpace->setSuffix(" GB");
+            fLoggerFreeSpace->setDecimals(2);
+            fLoggerFreeSpace->setValue(space*1e-9);
+        }
+        if (space>=  3000000)  // >= 3GB
+        {
+            fLoggerFreeSpace->setSuffix(" GB");
+            fLoggerFreeSpace->setDecimals(1);
+            fLoggerFreeSpace->setValue(space*1e-9);
+        }
+        if (space>=100000000)  // >= 100GB
+        {
+            fLoggerFreeSpace->setSuffix(" GB");
+            fLoggerFreeSpace->setDecimals(0);
+            fLoggerFreeSpace->setValue(space*1e-9);
+        }
+
+        fLoggerET->setTime(QTime().addSecs(rate>0?space/rate:0));
+        fLoggerRate->setValue(rate*1e-3); // kB/s
+        fLoggerWritten->setValue(written*1e-6);
+
+        fLoggerRate->setSuffix(" kB/s");
+        fLoggerRate->setDecimals(2);
+        fLoggerRate->setValue(rate*1e-3);
+        if (rate>   2000)  // > 2kB/s
+        {
+            fLoggerRate->setSuffix(" kB/s");
+            fLoggerRate->setDecimals(1);
+            fLoggerRate->setValue(rate*1e-3);
+        }
+        if (rate>=100000)  // >100kB/s
+        {
+            fLoggerRate->setSuffix(" kB/s");
+            fLoggerRate->setDecimals(0);
+            fLoggerRate->setValue(rate*1e-3);
+        }
+        if (rate>=1000000)  // >100kB/s
+        {
+            fLoggerRate->setSuffix(" MB/s");
+            fLoggerRate->setDecimals(2);
+            fLoggerRate->setValue(rate*1e-6);
+        }
+        if (rate>=10000000)  // >1MB/s
+        {
+            fLoggerRate->setSuffix(" MB/s");
+            fLoggerRate->setDecimals(1);
+            fLoggerRate->setValue(rate*1e-6);
+        }
+        if (rate>=100000000)  // >10MB/s
+        {
+            fLoggerRate->setSuffix(" MB/s");
+            fLoggerRate->setDecimals(0);
+            fLoggerRate->setValue(rate*1e-6);
+        }
+
+        if (space/10000000>static_cast<size_t>(fLoggerSpaceLeft->maximum()))
+            fLoggerSpaceLeft->setValue(fLoggerSpaceLeft->maximum());  // MB
+        else
+            fLoggerSpaceLeft->setValue(space/10000000);  // MB
+    }
+
+    void handleLoggerFilenameNight(const DimData &d)
+    {
+        const bool connected = d.size()!=0;
+
+        fLoggerFilenameNight->setEnabled(connected);
+        if (connected)
+            fLoggerFilenameNight->setText(d.c_str());
+
+        if (d.qos&1)
+            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        else
+            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+        if (d.qos&2)
+            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        else
+            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+        if (d.qos&4)
+            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        else
+            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+    }
+
+    void handleLoggerFilenameRun(const DimData &d)
+    {
+        const bool connected = d.size()!=0;
+
+        fLoggerFilenameRun->setEnabled(connected);
+        if (connected)
+            fLoggerFilenameRun->setText(d.c_str());
+
+        if (d.qos&1)
+            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        else
+            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+        if (d.qos&2)
+            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        else
+            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+        if (d.qos&4)
+            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        else
+            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+    }
+
+    void handleLoggerNumSubs(const DimData &d)
+    {
+        const bool connected = d.size()!=0;
+
+        fLoggerSubscriptions->setEnabled(connected);
+        fLoggerOpenFiles->setEnabled(connected);
+        if (!connected)
+            return;
+
+        const vector<boost::any> any = d.any();
+
+        fLoggerSubscriptions->setValue(boost::any_cast<int>(any[0]));
+        fLoggerOpenFiles->setValue(boost::any_cast<int>(any[1]));
+    }
+
+    // ===================== FTM ============================================
+
+    void handleFtmTriggerCounter(const DimData &d)
+    {
+        if (d.size()==0)
+            return;
+
+        if (d.size()!=sizeof(FTM::DimTriggerCounter))
+        {
+            cout << "Size mismatch: " << d.size() << " " << sizeof(FTM::DimTriggerCounter) << endl;
+            return;
+        }
+
+        const FTM::DimTriggerCounter &sdata = *reinterpret_cast<const FTM::DimTriggerCounter*>(d.ptr());
+
+        fFtmTime->setText(QString::number(sdata.fTimeStamp));
+        fTriggerCounter->setText(QString::number(sdata.fTriggerCounter));
+    }
+
+    void handleFtmDynamicData(const DimData &d)
+    {
+        if (d.size()==0)
+            return;
+
+        if (d.size()!=sizeof(FTM::DimDynamicData))
+        {
+            cout << "Size mismatch: " << d.size() << " " << sizeof(FTM::DimDynamicData) << endl;
+            return;
+        }
+
+        const FTM::DimDynamicData &sdata = *reinterpret_cast<const FTM::DimDynamicData*>(d.ptr());
+
+        fFtmTime->setText(QString::number(sdata.fTimeStamp));
+        fOnTime->setText(QString::number(sdata.fOnTimeCounter));
+
+        fFtmTemp0->setValue(sdata.fTempSensor[0]*0.1);
+        fFtmTemp1->setValue(sdata.fTempSensor[1]*0.1);
+        fFtmTemp2->setValue(sdata.fTempSensor[2]*0.1);
+        fFtmTemp3->setValue(sdata.fTempSensor[3]*0.1);
+
+
+        // ----------------------------------------------
+
+        TCanvas *c = fFtmTempCanv->GetCanvas();
+
+        static int cntr = 0;
+        double_t tm = cntr++;//Time().RootTime();
+
+        TH1 *h = (TH1*)c->FindObject("MyFrame");
+        h->FindBin(tm);
+
+        fGraphFtmTemp[0].SetPoint(fGraphFtmTemp[0].GetN(), tm, sdata.fTempSensor[0]*0.1);
+        fGraphFtmTemp[1].SetPoint(fGraphFtmTemp[1].GetN(), tm, sdata.fTempSensor[1]*0.1);
+        fGraphFtmTemp[2].SetPoint(fGraphFtmTemp[2].GetN(), tm, sdata.fTempSensor[2]*0.1);
+        fGraphFtmTemp[3].SetPoint(fGraphFtmTemp[3].GetN(), tm, sdata.fTempSensor[3]*0.1);
+
+        c->Modified();
+        c->Update();
+
+        // ----------------------------------------------
+
+        valarray<double> dat(0., 1438);
+
+        for (int i=0; i<1438; i++)
+            dat[i] = sdata.fRatePatch[fPatch[i]];
+
+        c = fRatesCanv->GetCanvas();
+        Camera *cam = (Camera*)c->FindObject("Camera");
+
+        cam->SetData(dat);
+
+        c->Modified();
+        c->Update();
+    }
+
+    FTM::DimStaticData fFtmStaticData;
+
+    void handleFtmStaticData(const DimData &d)
+    {
+        if (d.size()==0)
+            return;
+
+        if (d.size()!=sizeof(FTM::DimStaticData))
+        {
+            cout << "Size mismatch: " << d.size() << " " << sizeof(FTM::DimStaticData) << endl;
+            return;
+        }
+
+        const FTM::DimStaticData &sdata = *reinterpret_cast<const FTM::DimStaticData*>(d.ptr());
+
+        fTriggerInterval->setValue(sdata.fTriggerInterval);
+        fPhysicsCoincidence->setValue(sdata.fCoincidencePhysics);
+        fCalibCoincidence->setValue(sdata.fCoincidenceCalib);
+        fPhysicsWindow->setValue(sdata.fWindowPhysics);
+        fCalibWindow->setValue(sdata.fWindowCalib);
+
+        fTriggerDelay->setValue(sdata.fDelayTrigger);
+        fTimeMarkerDelay->setValue(sdata.fDelayTimeMarker);
+        fDeadTime->setValue(sdata.fDeadTime);
+
+        fClockCondR0->setValue(sdata.fClockConditioner[0]);
+        fClockCondR1->setValue(sdata.fClockConditioner[1]);
+        fClockCondR8->setValue(sdata.fClockConditioner[2]);
+        fClockCondR9->setValue(sdata.fClockConditioner[3]);
+        fClockCondR11->setValue(sdata.fClockConditioner[4]);
+        fClockCondR13->setValue(sdata.fClockConditioner[5]);
+        fClockCondR14->setValue(sdata.fClockConditioner[6]);
+        fClockCondR15->setValue(sdata.fClockConditioner[7]);
+
+        fTriggerSeqPed->setValue(sdata.fTriggerSeqPed);
+        fTriggerSeqLP1->setValue(sdata.fTriggerSeqLP1);
+        fTriggerSeqLP2->setValue(sdata.fTriggerSeqLP2);
+
+        fEnableTrigger->setChecked(sdata.HasTrigger());
+        fEnableLP1->setChecked(sdata.HasLP1());
+        fEnableLP2->setChecked(sdata.HasLP2());
+        fEnableVeto->setChecked(sdata.HasVeto());
+        fEnablePedestal->setChecked(sdata.HasPedestal());
+        fEnableExt1->setChecked(sdata.HasExt1());
+        fEnableExt2->setChecked(sdata.HasExt2());
+        fEnableTimeMarker->setChecked(sdata.HasTimeMarker());
+
+        cout << hex << sdata.fActiveFTU << dec << endl;
+
+        for (int i=0; i<64; i++)
+            std::cout << (sdata.fActiveFTU&(1<<i) ? 1 : 0);
+        std::cout << std::endl;
+
+        for (int i=0; i<40; i++)
+            if (!sdata.IsActive(i))
+                fFtuLED[i]->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+            else
+                fFtuLED[i]->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+        Camera *cam = (Camera*)fRatesCanv->GetCanvas()->FindObject("Camera");
+        for (int i=0; i<1438; i++)
+            cam->SetEnable(i, sdata.IsEnabled(i));
+
+        const int patch1 = fThresholdIdx->value();
+        fThresholdVal->setValue(sdata.fThreshold[patch1<0?0:patch1]);
+
+        fPrescalingVal->setValue(sdata.fPrescaling[0]);
+
+        fFtmStaticData = sdata;
+    }
+
+    void handleFtmPassport(const DimData &d)
+    {
+        if (d.size()==0)
+            return;
+
+        if (d.size()!=sizeof(FTM::DimPassport))
+        {
+            cout << "Size mismatch: " << d.size() << " " << sizeof(FTM::DimPassport) << endl;
+            return;
+        }
+
+        const FTM::DimPassport &sdata = *reinterpret_cast<const FTM::DimPassport*>(d.ptr());
+
+        stringstream str1, str2;
+        str1 << hex << "0x" << setfill('0') << setw(16) << sdata.fBoardId;
+        str2 << sdata.fFirmwareId;
+
+        fFtmBoardId->setText(str1.str().c_str());
+        fFtmFirmwareId->setText(str2.str().c_str());
+    }
+
+    void handleFtmFtuList(const DimData &d)
+    {
+        if (d.size()==0)
+            return;
+
+        if (d.size()!=sizeof(FTM::DimFtuList))
+        {
+            cout << "Size mismatch: " << d.size() << " " << sizeof(FTM::DimFtuList) << endl;
+            return;
+        }
+
+        const FTM::DimFtuList &sdata = *reinterpret_cast<const FTM::DimFtuList*>(d.ptr());
+
+        stringstream str;
+        str << "<table width='100%'>" << setfill('0');
+        str << "<tr><th>Num</th><th></th><th>Addr</th><th></th><th>DNA</th></tr>";
+        for (int i=0; i<40; i++)
+        {
+            str << "<tr>";
+            str << "<td align='center'>"   << dec << i << hex << "</td>";
+            str << "<td align='center'>:</td>";
+            str << "<td align='center'>0x" << setw(2)  << (int)sdata.fAddr[i] << "</td>";
+            str << "<td align='center'>:</td>";
+            str << "<td align='center'>0x" << setw(16) << sdata.fDNA[i] << "</td>";
+            str << "</tr>";
+        }
+        str << "</table>";
+
+        fFtuDNA->setText(str.str().c_str());
+
+        fFtuAnswersTotal->setValue(sdata.fNumBoards);
+        fFtuAnswersCrate0->setValue(sdata.fNumBoardsCrate[0]);
+        fFtuAnswersCrate1->setValue(sdata.fNumBoardsCrate[1]);
+        fFtuAnswersCrate2->setValue(sdata.fNumBoardsCrate[2]);
+        fFtuAnswersCrate3->setValue(sdata.fNumBoardsCrate[3]);
+
+        cout << "FtuList received: fActiveFTU not handled yet." << endl;
+
+        for (int i=0; i<40; i++)
+        {
+            if (sdata.IsActive(i))
+            {
+                if (sdata.fPing[i]>0)
+                    fFtuLED[i]->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
+                else
+                    fFtuLED[i]->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+                //if (sdata.fCRC[i]>0)
+                //    fFtuLED[i]->setIcon(QIcon(":/Resources/icons/warning 1.png"));
+            }
+            else
+                fFtuLED[i]->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        }
+    }
+
+    void handleFtmError(const DimData &d)
+    {
+        if (d.size()==0)
+            return;
+        const Converter conv(d.format);
+        cout << "Error:" << endl;
+        cout << conv.GetString(&d.data[0], d.size()) << endl;
+    }
+
+    // ====================== MessageImp ====================================
+
+    bool fChatOnline;
+
     void handleStateChanged(const Time &/*time*/, const std::string &server,
                             const State &s)
@@ -202,4 +1052,6 @@
             fStatusFTMLabel->setText(s.name.c_str());
             fStatusFTMLabel->setToolTip(s.comment.c_str());
+
+            bool enable = false;
 
             if (s.index<FTM::kDisconnected) // No Dim connection
@@ -207,6 +1059,13 @@
             if (s.index==FTM::kDisconnected) // Dim connection / FTM disconnected
                 fStatusFTMLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
-            if (s.index==FTM::kConnected) // Dim connection / FTM connected
+            if (s.index==FTM::kConnected || s.index==FTM::kIdle) // Dim connection / FTM connected
+            {
                 fStatusFTMLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+                enable = true;
+            }
+
+            fTriggerWidget->setEnabled(enable);
+            fFtuWidget->setEnabled(enable);
+            fRatesWidget->setEnabled(enable);
         }
 
@@ -229,12 +1088,20 @@
             fStatusLoggerLabel->setToolTip(s.comment.c_str());
 
-            if (s.index<-1) // Error
+            bool enable = true;
+
+            if (s.index<=30)   // Ready/Waiting
+                fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
+            if (s.index<-1)     // Offline
+            {
                 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+                enable = false;
+            }
             if (s.index>=0x100) // Error
                 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
-            if (s.index<=30)   // Waiting
-                fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
             if (s.index==40)   // Logging
                 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+
+            cout << "enable " << s.index << " " << enable << endl;
+            fLoggerWidget->setEnabled(enable);
         }
 
@@ -243,5 +1110,7 @@
             fStatusChatLabel->setText(s.name.c_str());
 
-            if (s.index==FTM::kConnected) // Dim connection / FTM connected
+            fChatOnline = s.index;
+
+            if (fChatOnline) // Dim connection / FTM connected
                 fStatusChatLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
             else
@@ -253,4 +1122,10 @@
     {
         handleStateChanged(Time(), server, State(-2, "Offline", "No connection via DIM."));
+    }
+
+    void on_fTabWidget_currentChanged(int which)
+    {
+        if (fTabWidget->tabText(which)=="Chat")
+            fTabWidget->setTabIcon(which, QIcon());
     }
 
@@ -265,4 +1140,19 @@
             out << text.substr(6);
             fChatText->append(out.str().c_str());
+
+            if (fTabWidget->tabText(fTabWidget->currentIndex())=="Chat")
+                return;
+
+            static int num = 0;
+            if (num++<2)
+                return;
+
+            for (int i=0; i<fTabWidget->count(); i++)
+                if (fTabWidget->tabText(i)=="Chat")
+                {
+                    fTabWidget->setTabIcon(i, QIcon(":/Resources/icons/warning 3.png"));
+                    break;
+                }
+
             return;
         }
@@ -289,88 +1179,4 @@
     }
 
-    void handleDimService(const string &txt)
-    {
-        fDimSvcText->append(txt.c_str());
-    }
-
-    void handleDimDNS(int version)
-    {
-        ostringstream str;
-        str << "DIM V" << version/100 << 'r' << version%100;
-
-        if (version==0)
-            fStatusDNSLed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
-        else
-            fStatusDNSLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-
-        fStatusDNSLabel->setText(version==0?"Offline":str.str().c_str());
-        fStatusDNSLabel->setToolTip(version==0?"No connection to DIM DNS.":"Connection to DIM DNS established.");
-    }
-
-    // ======================================================================
-
-    void AddServer(const std::string &s)
-    {
-        DimNetwork::AddServer(s);
-
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleAddServer, this, s)));
-    }
-
-    void RemoveServer(const std::string &s)
-    {
-        UnsubscribeServer(s);
-
-        DimNetwork::RemoveServer(s);
-
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleRemoveServer, this, s)));
-    }
-
-    void RemoveAllServers()
-    {
-        UnsubscribeAllServers();
-
-        vector<string> v = GetServerList();
-        for (vector<string>::iterator i=v.begin(); i<v.end(); i++)
-            QApplication::postEvent(this,
-                                    new FunctionEvent(boost::bind(&FactGui::handleStateOffline, this, *i)));
-
-        DimNetwork::RemoveAllServers();
-
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleRemoveAllServers, this)));
-    }
-
-    void AddService(const std::string &server, const std::string &service, const std::string &fmt, bool iscmd)
-    {
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleAddService, this, server, service, fmt, iscmd)));
-    }
-
-    void RemoveService(const std::string &server, const std::string &service, bool iscmd)
-    {
-        if (fServices.find(server+'/'+service)!=fServices.end())
-            UnsubscribeService(server+'/'+service);
-
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleRemoveService, this, server, service, iscmd)));
-    }
-
-    void RemoveAllServices(const std::string &server)
-    {
-        UnsubscribeServer(server);
-
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleRemoveAllServices, this, server)));
-    }
-
-    void AddDescription(const std::string &server, const std::string &service, const vector<Description> &vec)
-    {
-        QApplication::postEvent(this,
-           new FunctionEvent(boost::bind(&FactGui::handleAddDescription, this, server, service, vec)));
-    }
-
-
     void IndicateStateChange(const Time &time, const std::string &server)
     {
@@ -389,21 +1195,66 @@
     }
 
-    void infoHandler(DimInfo &info)
-    {
-        const string fmt = string("DIS_DNS/SERVER_INFO")==info.getName() ? "C" : info.getFormat();
+    // ====================== Dim infoHandler================================
+
+    void handleDimInfo(const DimData &d)
+    {
+        if (d.info==&fDimDNS)
+            return handleDimDNS(d.get<unsigned int>());
+
+        cout << "HandleDimInfo " << d.name << endl;
+
+        if (d.info==&fDimLoggerStats)
+            return handleLoggerStats(d);
+
+        if (d.info==&fDimLoggerFilenameNight)
+            return handleLoggerFilenameNight(d);
+
+        if (d.info==&fDimLoggerNumSubs)
+            return handleLoggerNumSubs(d);
+
+        if (d.info==&fDimLoggerFilenameRun)
+            return handleLoggerFilenameRun(d);
+
+        if (d.info==&fDimFtmTriggerCounter)
+            return handleFtmTriggerCounter(d);
+
+        if (d.info==&fDimFtmDynamicData)
+            return handleFtmDynamicData(d);
+
+        if (d.info==&fDimFtmPassport)
+            return handleFtmPassport(d);
+
+        if (d.info==&fDimFtmFtuList)
+            return handleFtmFtuList(d);
+
+        if (d.info==&fDimFtmStaticData)
+            return handleFtmStaticData(d);
+
+        if (d.info==&fDimFtmError)
+            return handleFtmError(d);
+    }
+
+    void handleDimService(const string &txt)
+    {
+        fDimSvcText->append(txt.c_str());
+    }
+
+
+    void infoHandlerService(DimInfo &info)
+    {
+        const string fmt = string(info.getFormat()).empty() ? "C" : info.getFormat();
 
         stringstream dummy;
         const Converter conv(dummy, fmt, false);
 
-        const Time tm(info.getTimestamp(), info.getTimestampMillisecs());
+        const Time tm(info.getTimestamp(), info.getTimestampMillisecs()*1000);
 
         stringstream out;
-        out << Time::fmt("%H:%M:%S.%f") << tm << "   <B>" << info.getName() << "</B> - ";
-
-        bool iserr = false;
+        out << "<font size'-1' color='navy'>[" << Time::fmt("%H:%M:%S.%f") << tm << "]</font>   <B>" << info.getName() << "</B> - ";
+
+        bool iserr = true;
         if (!conv)
         {
             out << "Compilation of format string '" << fmt << "' failed!";
-            iserr = true;
         }
         else
@@ -413,9 +1264,9 @@
                 const string dat = conv.GetString(info.getData(), info.getSize());
                 out << dat;
+                iserr = false;
             }
             catch (const runtime_error &e)
             {
                 out << "Conversion to string failed!<pre>" << e.what() << "</pre>";
-                iserr = true;
             }
         }
@@ -426,9 +1277,6 @@
         int bg = hash<string>()(string(info.getName()));
 
-        int r = bg&0x1f0000;
-        int g = bg&0x001f00;
-        int b = bg&0x00001f;
-
-        bg = ~(b|g|r)&0xffffff;
+        // allow only light colors
+        bg = ~(bg&0x1f1f1f)&0xffffff;
 
         if (iserr)
@@ -447,8 +1295,11 @@
     void infoHandler()
     {
-        if (getInfo()==&fDimDNS)
+        // Initialize the time-stamp (what a weird workaround...)
+        getInfo()->getTimestamp();
+
+        if (std::find(fDim.begin(), fDim.end(), getInfo())!=fDim.end())
         {
             QApplication::postEvent(this,
-                                    new FunctionEvent(boost::bind(&FactGui::handleDimDNS, this, getInfo()->getInt())));
+                                    new FunctionEvent(boost::bind(&FactGui::handleDimInfo, this, DimData(getInfo()))));
             return;
         }
@@ -457,5 +1308,5 @@
             if (i->second==getInfo())
             {
-                infoHandler(*i->second);
+                infoHandlerService(*i->second);
                 return;
             }
@@ -464,52 +1315,4 @@
     }
 
-    // ======================================================================
-
-
-    void SubscribeService(const string &service)
-    {
-        if (fServices.find(service)!=fServices.end())
-        {
-            cout << "ERROR - We are already subscribed to " << service << endl;
-            return;
-        }
-
-        fServices[service] = new DimStampedInfo(service.c_str(), (void*)NULL, 0, this);
-    }
-
-    void UnsubscribeService(const string &service)
-    {
-        const map<string,DimInfo*>::iterator i=fServices.find(service);
-
-        if (i==fServices.end())
-        {
-            cout << "ERROR - We are not subscribed to " << service << endl;
-            return;
-        }
-
-        delete i->second;
-
-        fServices.erase(i);
-    }
-
-    void UnsubscribeServer(const string &server)
-    {
-        for (map<string,DimInfo*>::iterator i=fServices.begin();
-             i!=fServices.end(); i++)
-            if (i->first.substr(0, server.length()+1)==server+'/')
-            {
-                delete i->second;
-                fServices.erase(i);
-            }
-    }
-
-    void UnsubscribeAllServers()
-    {
-        for (map<string,DimInfo*>::iterator i=fServices.begin();
-             i!=fServices.end(); i++)
-            delete i->second;
-
-        fServices.clear();
-    }
 
     // ======================================================================
@@ -541,5 +1344,5 @@
     }
 
-    void on_fDimCmdSend_clicked(bool)
+    void on_fDimCmdSend_clicked()
     {
         const QString server    = fDimCmdServers->currentIndex().data().toString();
@@ -565,10 +1368,259 @@
         }
     }
+    void ChoosePatch(Camera &cam, int idx)
+    {
+        cam.Reset();
+
+        fThresholdIdx->setValue(idx);
+        fThresholdVal->setValue(fFtmStaticData.fThreshold[idx<0?0:idx]);
+
+        if (idx<0)
+            return;
+
+        for (unsigned int i=0; i<fPatch.size(); i++)
+            if (fPatch[i]==idx)
+                cam.SetBold(i);
+    }
+
+    void ChoosePixel(Camera &cam, int idx)
+    {
+        cam.SetWhite(idx);
+        ChoosePatch(cam, fPatch[idx]);
+    }
+
+    void slot_RootEventProcessed(TObject *obj, unsigned int evt, TCanvas *)
+    {
+        // kMousePressEvent       // TCanvas processed QEvent mousePressEvent
+        // kMouseMoveEvent        // TCanvas processed QEvent mouseMoveEvent
+        // kMouseReleaseEvent     // TCanvas processed QEvent mouseReleaseEvent
+        // kMouseDoubleClickEvent // TCanvas processed QEvent mouseDoubleClickEvent
+        // kKeyPressEvent         // TCanvas processed QEvent keyPressEvent
+        // kEnterEvent            // TCanvas processed QEvent enterEvent
+        // kLeaveEvent            // TCanvas processed QEvent leaveEvent
+
+        if (dynamic_cast<TCanvas*>(obj))
+            return;
+
+        TQtWidget *tipped = static_cast<TQtWidget*>(sender());
+
+        if (evt==11/*kMouseReleaseEvent*/)
+        {
+            if (dynamic_cast<Camera*>(obj))
+            {
+                const float xx = gPad->PadtoX(gPad->AbsPixeltoX(tipped->GetEventX()));
+                const float yy = gPad->PadtoY(gPad->AbsPixeltoY(tipped->GetEventY()));
+
+                Camera *cam = static_cast<Camera*>(obj);
+                const int idx = cam->GetIdx(xx, yy);
+
+                ChoosePixel(*cam, idx);
+            }
+            return;
+        }
+
+        if (evt==61/*kMouseDoubleClickEvent*/)
+        {
+            if (dynamic_cast<Camera*>(obj))
+            {
+                const float xx = gPad->PadtoX(gPad->AbsPixeltoX(tipped->GetEventX()));
+                const float yy = gPad->PadtoY(gPad->AbsPixeltoY(tipped->GetEventY()));
+
+                Camera *cam = static_cast<Camera*>(obj);
+                const int idx = cam->GetIdx(xx, yy);
+
+                cam->Toggle(idx);
+            }
+            return;
+        }
+
+        // Find the object which will get picked by the GetObjectInfo
+        // due to buffer overflows in many root-versions
+        // in TH1 and TProfile we have to work around and implement
+        // our own GetObjectInfo which make everything a bit more
+        // complicated.
+#if ROOT_VERSION_CODE > ROOT_VERSION(5,22,00)
+        const char *objectInfo =
+            obj->GetObjectInfo(tipped->GetEventX(),tipped->GetEventY());
+#else
+        const char *objectInfo = dynamic_cast<TH1*>(obj) ?
+            "" : obj->GetObjectInfo(tipped->GetEventX(),tipped->GetEventY());
+#endif
+
+        QString tipText;
+        tipText += obj->GetName();
+        tipText += " [";
+        tipText += obj->ClassName();
+        tipText += "]: ";
+        tipText += objectInfo;
+
+        if (dynamic_cast<Camera*>(obj))
+        {
+            const float xx = gPad->PadtoX(gPad->AbsPixeltoX(tipped->GetEventX()));
+            const float yy = gPad->PadtoY(gPad->AbsPixeltoY(tipped->GetEventY()));
+
+            Camera *cam = static_cast<Camera*>(obj);
+            int idx = fPatch[cam->GetIdx(xx, yy)];
+
+            tipText+="  Patch=";
+            tipText+=QString::number(idx);
+        }
+
+
+        fStatusBar->showMessage(tipText, 3000);
+
+        gSystem->ProcessEvents();
+        //QWhatsThis::display(tipText)
+    }
+
+    void slot_RootUpdate()
+    {
+        gSystem->ProcessEvents();
+        QTimer::singleShot(100, this, SLOT(slot_RootUpdate()));
+    }
+    void on_fThresholdIdx_valueChanged(int idx)
+    {
+        Camera *cam = (Camera*)fRatesCanv->GetCanvas()->FindObject("Camera");
+        ChoosePatch(*cam, idx);
+    }
+
+    TGraph fGraphFtmTemp[4];
+
+    map<int, int> fPatch;
 
 public:
-    FactGui() : fDimDNS("DIS_DNS/VERSION_NUMBER", 1, int(0), this)
+    FactGui() :
+        fDimDNS("DIS_DNS/VERSION_NUMBER", 1, int(0), this),
+
+        fDimLoggerStats        ("DATA_LOGGER/STATS", (void*)NULL, 0, this),
+        fDimLoggerFilenameNight("DATA_LOGGER/FILENAME_NIGHT", const_cast<char*>(""), 0, this),
+        fDimLoggerFilenameRun  ("DATA_LOGGER/FILENAME_RUN",   const_cast<char*>(""), 0, this),
+        fDimLoggerNumSubs      ("DATA_LOGGER/NUM_SUBS",       const_cast<char*>(""), 0, this),
+
+        fDimFtmPassport      ("FTM_CONTROL/PASSPORT",        (void*)NULL, 0, this),
+        fDimFtmTriggerCounter("FTM_CONTROL/TRIGGER_COUNTER", (void*)NULL, 0, this),
+        fDimFtmError         ("FTM_CONTROL/ERROR",           (void*)NULL, 0, this),
+        fDimFtmFtuList       ("FTM_CONTROL/FTU_LIST",        (void*)NULL, 0, this),
+        fDimFtmStaticData    ("FTM_CONTROL/STATIC_DATA",     (void*)NULL, 0, this),
+        fDimFtmDynamicData   ("FTM_CONTROL/DYNAMIC_DATA",    (void*)NULL, 0, this)
+
+
     {
         DimClient::sendCommand("CHAT/MSG", "GUI online.");
         // + MessageDimRX
+
+        fDim.push_back(&fDimFtmDynamicData);
+        fDim.push_back(&fDimFtmTriggerCounter);
+        fDim.push_back(&fDimFtmStaticData);
+        fDim.push_back(&fDimFtmFtuList);
+        fDim.push_back(&fDimFtmPassport);
+        fDim.push_back(&fDimFtmError);
+        fDim.push_back(&fDimLoggerStats);
+        fDim.push_back(&fDimLoggerFilenameNight);
+        fDim.push_back(&fDimLoggerFilenameRun);
+        fDim.push_back(&fDimLoggerNumSubs);
+        fDim.push_back(&fDimDNS);
+
+        fTriggerWidget->setEnabled(false);
+        fFtuWidget->setEnabled(false);
+        fRatesWidget->setEnabled(false);
+        fLoggerWidget->setEnabled(false);
+
+        // --------------------------------------------------------------------------
+
+        ifstream fin("fact-trigger-all.txt");
+
+        int l = 0;
+
+        string buf;
+        while (getline(fin, buf, '\n'))
+        {
+            buf = Tools::Trim(buf);
+            if (buf[0]=='#')
+                continue;
+
+            stringstream str(buf);
+            for (int i=0; i<9; i++)
+            {
+                int n;
+                str >> n;
+
+                fPatch[n] = l;
+            }
+            l++;
+        }
+
+        // --------------------------------------------------------------------------
+
+        TCanvas *c = fFtmTempCanv->GetCanvas();
+        c->SetBit(TCanvas::kNoContextMenu);
+        c->SetBorderMode(0);
+        c->SetFrameBorderMode(0);
+        c->SetFillColor(kWhite);
+        c->SetRightMargin(0.03);
+        c->SetTopMargin(0.03);
+        c->cd();
+
+        TH1F h("MyFrame", "", 1000, 0, 1);//Time().RootTime()-1./24/60/60, Time().RootTime());
+        h.SetDirectory(0);
+        h.SetBit(TH1::kCanRebin);
+        h.SetStats(kFALSE);
+        h.SetMinimum(-20);
+        h.SetMaximum(100);
+        h.SetXTitle("Time");
+        h.SetYTitle("Temperature / °C");
+        h.GetXaxis()->CenterTitle();
+        h.GetYaxis()->CenterTitle();
+//        h.GetXaxis()->SetTitleSize(1.2);
+//        h.GetYaxis()->SetTitleSize(1.2);
+        h.DrawCopy();
+
+        fGraphFtmTemp[0].SetMarkerStyle(kFullDotSmall);
+        fGraphFtmTemp[1].SetMarkerStyle(kFullDotSmall);
+        fGraphFtmTemp[2].SetMarkerStyle(kFullDotSmall);
+        fGraphFtmTemp[3].SetMarkerStyle(kFullDotSmall);
+
+        fGraphFtmTemp[1].SetLineColor(kBlue);
+        fGraphFtmTemp[2].SetLineColor(kRed);
+        fGraphFtmTemp[3].SetLineColor(kGreen);
+
+        fGraphFtmTemp[1].SetMarkerColor(kBlue);
+        fGraphFtmTemp[2].SetMarkerColor(kRed);
+        fGraphFtmTemp[3].SetMarkerColor(kGreen);
+
+        fGraphFtmTemp[0].Draw("LP");
+        fGraphFtmTemp[1].Draw("LP");
+        fGraphFtmTemp[2].Draw("LP");
+        fGraphFtmTemp[3].Draw("LP");
+
+        // --------------------------------------------------------------------------
+
+        c = fRatesCanv->GetCanvas();
+        c->SetBit(TCanvas::kNoContextMenu);
+        c->SetBorderMode(0);
+        c->SetFrameBorderMode(0);
+        c->SetFillColor(kWhite);
+        c->cd();
+
+        Camera *cam = new Camera;
+        cam->SetBit(kCanDelete);
+        cam->Draw();
+
+        ChoosePixel(*cam, 1);
+
+        QTimer::singleShot(100, this, SLOT(slot_RootUpdate()));
+
+        //widget->setMouseTracking(true);
+        //widget->EnableSignalEvents(kMouseMoveEvent);
+
+        fFtmTempCanv->setMouseTracking(true);
+        fFtmTempCanv->EnableSignalEvents(kMouseMoveEvent);
+
+        fRatesCanv->setMouseTracking(true);
+        fRatesCanv->EnableSignalEvents(kMouseMoveEvent|kMouseReleaseEvent|kMouseDoubleClickEvent);
+
+        connect(fRatesCanv,   SIGNAL(     RootEventProcessed(TObject *, unsigned int, TCanvas *)),
+                this,         SLOT  (slot_RootEventProcessed(TObject *, unsigned int, TCanvas *)));
+        connect(fFtmTempCanv, SIGNAL(     RootEventProcessed(TObject *, unsigned int, TCanvas *)),
+                this,         SLOT  (slot_RootEventProcessed(TObject *, unsigned int, TCanvas *)));
     }
     ~FactGui()
Index: /trunk/FACT++/gui/MainWindow.cc
===================================================================
--- /trunk/FACT++/gui/MainWindow.cc	(revision 10517)
+++ /trunk/FACT++/gui/MainWindow.cc	(revision 10518)
@@ -1,3 +1,5 @@
 #include "MainWindow.h"
+
+#include <iostream>
 
 #include "dic.hxx"
@@ -27,21 +29,76 @@
     fDimSvcDescription->setItemDelegate(new HtmlDelegate);
 
-    fStatusBar->showMessage("FACT++");
+    fStatusBar->showMessage(PACKAGE_STRING"   |   "PACKAGE_URL"   |   report bugs to <"PACKAGE_BUGREPORT">");
+
+    fFtuLED[0] = fFtuLEDPrototype;
+
+    for (int i=1; i<40; i++)
+    {
+        QPushButton *b = new QPushButton(static_cast<QWidget*>(fFtuLEDPrototype->parent()));
+
+        b->setEnabled(fFtuLEDPrototype->isEnabled());
+        b->setSizePolicy(fFtuLEDPrototype->sizePolicy());
+        b->setMaximumSize(fFtuLEDPrototype->maximumSize());
+        b->setIcon(fFtuLEDPrototype->icon());
+        b->setIconSize(fFtuLEDPrototype->iconSize());
+        b->setCheckable(fFtuLEDPrototype->isCheckable());
+        b->setFlat(fFtuLEDPrototype->isFlat());
+
+        fFtuLedLayout->addWidget(b, i/10+1, i%10+1, 1, 1);
+
+        fFtuLED[i] = b;
+    }
+
+    for (int i=0; i<40; i++)
+    {
+        fFtuLED[i]->setObjectName(QString::fromUtf8("fFtuLED")+QString::number(i));
+        QObject::connect(fFtuLED[i], SIGNAL(clicked()), this, SLOT(slot_fFtuLED_clicked()));
+    }
+}
+
+void MainWindow::SelectTab(const QString &name)
+{
+    for (int i=0; i<fTabWidget->count(); i++)
+        if (fTabWidget->tabText(i)==name)
+        {
+            fTabWidget->setCurrentIndex(i);
+            break;
+        }
+}
+
+void MainWindow::on_fShutdown_clicked()
+{
+    DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
 }
 
 
+void MainWindow::on_fShutdownAll_clicked()
+{
+    DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
+    DimClient::sendCommand("DIS_DNS/EXIT",         1);
+}
+
 void MainWindow::on_fTabWidget_tabCloseRequested(int which)
 {
-    QWidget *w = fTabWidget->widget(which);
+    // To get the correct size we have to switch to this tab
+    // An alternative would be to take the size of the current tab
+    fTabWidget->setCurrentIndex(which);
+
+    QWidget *w = fTabWidget->currentWidget(); //fTabWidget->widget(which);
     if (!w)
+    {
+        cout << "Weird... the tab requested to be closed doesn't exist!" << endl;
         return;
+    }
 
     QDockWidget *d = w->findChild<QDockWidget*>();
     if (!d)
+    {
+        cout << "Sorry, tab requested to be closed contains no QDockWidget!" << endl;
         return;
+    }
 
-    DockWindow *mw = new DockWindow(d, fTabWidget->tabText(which));
+    new DockWindow(d, fTabWidget->tabText(which));
     fTabWidget->removeTab(which);
-    mw->show();
 
     if (fTabWidget->count()==1)
@@ -50,26 +107,29 @@
 
 
-void MainWindow::on_fChatSend_clicked(bool)
+void MainWindow::on_fChatSend_clicked()
 {
-    DimClient::sendCommand("CHAT/MSG", fChatMessage->displayText().toStdString().c_str());
-    fChatMessage->clear();
+    if (DimClient::sendCommand("CHAT/MSG", fChatMessage->displayText().toStdString().c_str()))
+        fChatMessage->clear();
 }
 
-
-void MainWindow::on_fShutdown_clicked(bool)
+void MainWindow::on_fStatusLoggerLed_clicked()
 {
-    DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
+    SelectTab("Logger");
 }
 
-
-void MainWindow::on_fShutdownAll_clicked(bool)
+void MainWindow::on_fStatusChatLed_clicked()
 {
-    DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
-    DimClient::sendCommand("DIS_DNS/EXIT",         1);
+    SelectTab("Chat");
 }
 
+void MainWindow::on_fStatusFTMLed_clicked()
+{
+    SelectTab("Trigger");
+}
 
-void MainWindow::on_fStatusFTMEnable_stateChanged(int/* state*/)
+void MainWindow::slot_fFtuLED_clicked()
 {
-
+    for (int i=0; i<40; i++)
+        if (sender()==fFtuLED[i])
+            cout << "--------------> clicked #" << i << endl;
 }
Index: /trunk/FACT++/gui/MainWindow.h
===================================================================
--- /trunk/FACT++/gui/MainWindow.h	(revision 10517)
+++ /trunk/FACT++/gui/MainWindow.h	(revision 10518)
@@ -4,5 +4,8 @@
 #include "design.h"
 
-#include <QtGui/QMainWindow>
+#include <QMainWindow>
+
+class TObject;
+class TCanvas;
 
 class MainWindow : public QMainWindow, protected Ui::MainWindow
@@ -10,16 +13,83 @@
     Q_OBJECT;
 
+    void SelectTab(const QString &name);
+
+protected:
+    QPushButton *fFtuLED[40];
+
 public:
     MainWindow(QWidget *p=0);
 
 private slots:
+    // System status
+    void on_fShutdown_clicked();
+    void on_fShutdownAll_clicked();
+
+    // Status LEDs signals
+    void on_fStatusFTMLed_clicked();
+    void on_fStatusLoggerLed_clicked();
+    void on_fStatusChatLed_clicked();
+    //void on_fStatusFTMEnable_stateChanged(int state);
+
+    // Tab Widget
+    void on_fTabWidget_tabCloseRequested(int which);
+    virtual void on_fTabWidget_currentChanged(int) { }
+
+    // Tab: FTM
+    void on_fEnablePedestal_clicked(bool) { }
+    void on_fEnableLP1_clicked(bool) { }
+    void on_fEnableLP2_clicked(bool) { }
+    void on_fEnableTrigger_clicked(bool) { }
+    void on_fEnableExt1_clicked(bool) { }
+    void on_fEnableExt2_clicked(bool) { }
+    void on_fEnableTimeMarker_clicked(bool) { }
+    void on_fEnableVeto_clicked(bool) { }
+
+    void on_fTriggerSeqPed_valueChanged(int) { }
+    void on_fTriggerSeqLP1_valueChanged(int) { }
+    void on_fTriggerSeqLP2_valueChanged(int) { }
+
+    void on_fTriggerInterval_valueChanged(int) { }
+
+    void on_fPhysicsCoincidence_valueChanged(int) { }
+    void on_fCalibCoincidence_valueChanged(int) { }
+
+    void on_fPhysicsWindow_valueChanged(int) { }
+    void on_fCalibWindow_valueChanged(int) { }
+
+    void on_fTriggerDelay_valueChanged(int) { }
+    void on_fTimeMarkerDelay_valueChanged(int) { }
+    void on_fDeadTime_valueChanged(int) { }
+
+    void on_fClockCondR0_valueChanged(int) { }
+    void on_fClockCondR1_valueChanged(int) { }
+    void on_fClockCondR8_valueChanged(int) { }
+    void on_fClockCondR9_valueChanged(int) { }
+    void on_fClockCondR11_valueChanged(int) { }
+    void on_fClockCondR13_valueChanged(int) { }
+    void on_fClockCondR14_valueChanged(int) { }
+    void on_fClockCondR15_valueChanged(int) { }
+
+    void on_fPrescalingVal_valueChanged(int) { }
+
+    // Tab: FTUs
+    void slot_fFtuLED_clicked();
+
+    // Tab: Rates
+    void on_fThresholdVal_valueChanged(int v) { fThresholdVolt->setValue(2500./4095*v); }
+    virtual void on_fThresholdIdx_valueChanged(int) { }
+
+    // Tab: Chat
+    void on_fChatSend_clicked();
+
+    // Tab: Commands
     /// Needs access to DimNetwork thus it is implemented in the derived class
-    virtual void on_fDimCmdSend_clicked(bool) { }
+    virtual void on_fDimCmdSend_clicked() { }
 
-    void on_fTabWidget_tabCloseRequested(int which);
-    void on_fChatSend_clicked(bool);
-    void on_fShutdown_clicked(bool);
-    void on_fShutdownAll_clicked(bool);
-    void on_fStatusFTMEnable_stateChanged(int state);
+    // Main menu
+    //    void on_fMenuLogSaveAs_triggered(bool)
+
+    virtual void slot_RootEventProcessed(TObject *, unsigned int, TCanvas *) { }
+    virtual void slot_RootUpdate() { }
 };
 
Index: /trunk/FACT++/gui/design.ui
===================================================================
--- /trunk/FACT++/gui/design.ui	(revision 10517)
+++ /trunk/FACT++/gui/design.ui	(revision 10518)
@@ -33,5 +33,5 @@
     </sizepolicy>
    </property>
-   <layout class="QGridLayout" name="gridLayout" rowstretch="0" columnminimumwidth="0">
+   <layout class="QGridLayout" name="gridLayout" rowstretch="0">
     <property name="sizeConstraint">
      <enum>QLayout::SetDefaultConstraint</enum>
@@ -39,4 +39,7 @@
     <item row="0" column="0">
      <widget class="QTabWidget" name="fTabWidget">
+      <property name="enabled">
+       <bool>true</bool>
+      </property>
       <property name="sizePolicy">
        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -49,5 +52,5 @@
       </property>
       <property name="currentIndex">
-       <number>2</number>
+       <number>1</number>
       </property>
       <property name="documentMode">
@@ -60,11 +63,1926 @@
        <bool>true</bool>
       </property>
-      <widget class="QWidget" name="fDimSvcTab">
+      <widget class="QWidget" name="fTriggerTab">
        <attribute name="title">
-        <string>Services</string>
+        <string>Trigger</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_3">
+       <layout class="QGridLayout" name="gridLayout_16">
         <item row="0" column="0">
-         <widget class="QDockWidget" name="fDimSvcDock">
+         <widget class="QDockWidget" name="fTriggerDock">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="features">
+           <set>QDockWidget::NoDockWidgetFeatures</set>
+          </property>
+          <property name="allowedAreas">
+           <set>Qt::AllDockWidgetAreas</set>
+          </property>
+          <property name="windowTitle">
+           <string>Trigegr settings</string>
+          </property>
+          <widget class="QWidget" name="fTriggerWidget">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <layout class="QGridLayout" name="gridLayout_21" rowstretch="0,1,1" columnstretch="1,1,1">
+            <item row="0" column="1">
+             <layout class="QGridLayout" name="gridLayout_26">
+              <property name="topMargin">
+               <number>0</number>
+              </property>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_35">
+                <property name="text">
+                 <string>FTM Firmware ID</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_37">
+                <property name="text">
+                 <string>FTM Board ID</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QLineEdit" name="fFtmFirmwareId">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLineEdit" name="fFtmBoardId">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+            <item row="2" column="2">
+             <widget class="QGroupBox" name="groupBox_3">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Clock conditioner</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_18">
+               <item row="3" column="1">
+                <widget class="QSpinBox" name="fClockCondR0">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="2">
+                <widget class="QSpinBox" name="fClockCondR1">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="3">
+                <widget class="QSpinBox" name="fClockCondR8">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="4">
+                <widget class="QSpinBox" name="fClockCondR9">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="4" column="1">
+                <widget class="QSpinBox" name="fClockCondR11">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="4" column="2">
+                <widget class="QSpinBox" name="fClockCondR13">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="4" column="3">
+                <widget class="QSpinBox" name="fClockCondR14">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="4" column="4">
+                <widget class="QSpinBox" name="fClockCondR15">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="buttonSymbols">
+                  <enum>QAbstractSpinBox::UpDownArrows</enum>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="maximum">
+                  <number>65535</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="2">
+                <widget class="QLabel" name="label_11">
+                 <property name="text">
+                  <string>R1</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="1">
+                <widget class="QLabel" name="label_16">
+                 <property name="text">
+                  <string>R0</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="3">
+                <widget class="QLabel" name="label_17">
+                 <property name="text">
+                  <string>R8</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="4">
+                <widget class="QLabel" name="label_18">
+                 <property name="text">
+                  <string>R9</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="1">
+                <widget class="QLabel" name="label_19">
+                 <property name="text">
+                  <string>R11</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="2">
+                <widget class="QLabel" name="label_20">
+                 <property name="text">
+                  <string>R13</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="3">
+                <widget class="QLabel" name="label_21">
+                 <property name="text">
+                  <string>R14</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="4">
+                <widget class="QLabel" name="label_22">
+                 <property name="text">
+                  <string>R15</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="0" column="0" colspan="6">
+                <widget class="Line" name="line_10">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="6" column="2">
+                <spacer name="verticalSpacer_12">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="1" column="2">
+                <spacer name="verticalSpacer_13">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="3" column="0">
+                <spacer name="horizontalSpacer_25">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="3" column="5">
+                <spacer name="horizontalSpacer_26">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QGroupBox" name="groupBox_5">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Trigger setup</string>
+              </property>
+              <property name="flat">
+               <bool>false</bool>
+              </property>
+              <property name="checkable">
+               <bool>false</bool>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_23">
+               <item row="2" column="2">
+                <layout class="QHBoxLayout" name="horizontalLayout_10">
+                 <property name="topMargin">
+                  <number>0</number>
+                 </property>
+                 <item>
+                  <spacer name="horizontalSpacer_18">
+                   <property name="orientation">
+                    <enum>Qt::Horizontal</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>40</width>
+                     <height>20</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                 <item>
+                  <widget class="QLabel" name="label_31">
+                   <property name="text">
+                    <string>Interval</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QSpinBox" name="fTriggerInterval">
+                   <property name="accelerated">
+                    <bool>true</bool>
+                   </property>
+                   <property name="suffix">
+                    <string> ms</string>
+                   </property>
+                   <property name="minimum">
+                    <number>1</number>
+                   </property>
+                   <property name="maximum">
+                    <number>1023</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <spacer name="horizontalSpacer_17">
+                   <property name="orientation">
+                    <enum>Qt::Horizontal</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>40</width>
+                     <height>20</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                </layout>
+               </item>
+               <item row="6" column="0" colspan="4">
+                <widget class="Line" name="line_5">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="0" column="0" colspan="4">
+                <widget class="Line" name="line_6">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="2">
+                <spacer name="verticalSpacer_8">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="15" column="2">
+                <spacer name="verticalSpacer_9">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="8" column="0">
+                <spacer name="horizontalSpacer_23">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="8" column="3">
+                <spacer name="horizontalSpacer_24">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="11" column="0" colspan="4">
+                <widget class="Line" name="line_11">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="13" column="2">
+                <layout class="QGridLayout" name="gridLayout_30">
+                 <property name="topMargin">
+                  <number>0</number>
+                 </property>
+                 <item row="1" column="0">
+                  <widget class="QCheckBox" name="fEnableTrigger">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="text">
+                    <string/>
+                   </property>
+                   <property name="checked">
+                    <bool>false</bool>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="1">
+                  <widget class="QCheckBox" name="fEnableExt1">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="text">
+                    <string/>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="2">
+                  <widget class="QCheckBox" name="fEnableExt2">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="text">
+                    <string/>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="3">
+                  <widget class="QCheckBox" name="fEnableTimeMarker">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="text">
+                    <string/>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="5">
+                  <widget class="QCheckBox" name="fEnableVeto">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="maximumSize">
+                    <size>
+                     <width>16777215</width>
+                     <height>16777215</height>
+                    </size>
+                   </property>
+                   <property name="baseSize">
+                    <size>
+                     <width>0</width>
+                     <height>0</height>
+                    </size>
+                   </property>
+                   <property name="text">
+                    <string/>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="0">
+                  <widget class="QLabel" name="label_23">
+                   <property name="text">
+                    <string>Trg</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="1">
+                  <widget class="QLabel" name="label_29">
+                   <property name="text">
+                    <string>Ext1</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="2">
+                  <widget class="QLabel" name="label_30">
+                   <property name="text">
+                    <string>Ext2</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="3">
+                  <widget class="QLabel" name="label_28">
+                   <property name="text">
+                    <string>TIM</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="4">
+                  <spacer name="horizontalSpacer_30">
+                   <property name="orientation">
+                    <enum>Qt::Horizontal</enum>
+                   </property>
+                   <property name="sizeType">
+                    <enum>QSizePolicy::Fixed</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>10</width>
+                     <height>0</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                 <item row="0" column="5">
+                  <widget class="QLabel" name="label_27">
+                   <property name="text">
+                    <string>Veto</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignHCenter|Qt::AlignTop</set>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </item>
+               <item row="7" column="2">
+                <spacer name="verticalSpacer_10">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>40</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="8" column="2">
+                <layout class="QGridLayout" name="gridLayout_24">
+                 <item row="2" column="0">
+                  <widget class="QLabel" name="label_34">
+                   <property name="text">
+                    <string>Pedestal</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="0">
+                  <widget class="QSpinBox" name="fTriggerSeqPed">
+                   <property name="enabled">
+                    <bool>false</bool>
+                   </property>
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="maximum">
+                    <number>31</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="2">
+                  <widget class="QLabel" name="label_32">
+                   <property name="text">
+                    <string>:</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="3">
+                  <widget class="QSpinBox" name="fTriggerSeqLP1">
+                   <property name="enabled">
+                    <bool>false</bool>
+                   </property>
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="maximum">
+                    <number>31</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="5">
+                  <widget class="QSpinBox" name="fTriggerSeqLP2">
+                   <property name="enabled">
+                    <bool>false</bool>
+                   </property>
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="maximum">
+                    <number>31</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="4">
+                  <widget class="QLabel" name="label_33">
+                   <property name="text">
+                    <string>:</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="2" column="5">
+                  <widget class="QLabel" name="label_38">
+                   <property name="text">
+                    <string>LP2</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="2" column="3">
+                  <widget class="QLabel" name="label_36">
+                   <property name="text">
+                    <string>LP1</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="3" column="0">
+                  <layout class="QHBoxLayout" name="horizontalLayout_15">
+                   <property name="rightMargin">
+                    <number>0</number>
+                   </property>
+                   <item>
+                    <widget class="QCheckBox" name="fEnablePedestal">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="text">
+                      <string/>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </item>
+                 <item row="3" column="3">
+                  <layout class="QHBoxLayout" name="horizontalLayout_12">
+                   <property name="rightMargin">
+                    <number>0</number>
+                   </property>
+                   <item>
+                    <widget class="QCheckBox" name="fEnableLP1">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="text">
+                      <string/>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </item>
+                 <item row="3" column="5">
+                  <layout class="QHBoxLayout" name="horizontalLayout_13">
+                   <property name="rightMargin">
+                    <number>0</number>
+                   </property>
+                   <item>
+                    <widget class="QCheckBox" name="fEnableLP2">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="text">
+                      <string/>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </item>
+                </layout>
+               </item>
+               <item row="10" column="2">
+                <spacer name="verticalSpacer_11">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeType">
+                  <enum>QSizePolicy::Fixed</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>5</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="12" column="2">
+                <spacer name="verticalSpacer_17">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeType">
+                  <enum>QSizePolicy::Fixed</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>5</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="14" column="2">
+                <spacer name="verticalSpacer_18">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>40</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="3" column="2">
+                <spacer name="verticalSpacer_7">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>40</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="1" column="1">
+             <widget class="QGroupBox" name="groupBox">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Trigger Majority Logic</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_15">
+               <item row="2" column="1">
+                <widget class="QLabel" name="label_8">
+                 <property name="text">
+                  <string>Physics</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="2">
+                <widget class="QSpinBox" name="fPhysicsCoincidence">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="suffix">
+                  <string> / 40</string>
+                 </property>
+                 <property name="minimum">
+                  <number>1</number>
+                 </property>
+                 <property name="maximum">
+                  <number>40</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="2">
+                <widget class="QSpinBox" name="fCalibCoincidence">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="suffix">
+                  <string> / 40</string>
+                 </property>
+                 <property name="minimum">
+                  <number>1</number>
+                 </property>
+                 <property name="maximum">
+                  <number>40</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="3">
+                <widget class="SpinBox4ns" name="fPhysicsWindow">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="accelerated">
+                  <bool>false</bool>
+                 </property>
+                 <property name="correctionMode">
+                  <enum>QAbstractSpinBox::CorrectToPreviousValue</enum>
+                 </property>
+                 <property name="suffix">
+                  <string> ns</string>
+                 </property>
+                 <property name="minimum">
+                  <number>8</number>
+                 </property>
+                 <property name="maximum">
+                  <number>68</number>
+                 </property>
+                 <property name="singleStep">
+                  <number>4</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="3">
+                <widget class="SpinBox4ns" name="fCalibWindow">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="suffix">
+                  <string> ns</string>
+                 </property>
+                 <property name="minimum">
+                  <number>8</number>
+                 </property>
+                 <property name="maximum">
+                  <number>68</number>
+                 </property>
+                 <property name="singleStep">
+                  <number>4</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="5" column="1">
+                <widget class="QLabel" name="label_13">
+                 <property name="text">
+                  <string>Calibration</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="2">
+                <widget class="QLabel" name="label_9">
+                 <property name="text">
+                  <string>Coincidence</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="3">
+                <widget class="QLabel" name="label_10">
+                 <property name="text">
+                  <string>Window</string>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="0" column="0" colspan="5">
+                <widget class="Line" name="line_8">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="1">
+                <spacer name="verticalSpacer_14">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="6" column="1">
+                <spacer name="verticalSpacer_15">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="2" column="0">
+                <spacer name="horizontalSpacer_21">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="2" column="4">
+                <spacer name="horizontalSpacer_22">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="2" column="0">
+             <widget class="QGroupBox" name="groupBox_6">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Light pulser settings</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="2">
+             <widget class="QGroupBox" name="groupBox_2">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Trigger timing</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_17">
+               <item row="2" column="1">
+                <widget class="QLabel" name="label_12">
+                 <property name="text">
+                  <string>Trigger signal delay</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="1">
+                <widget class="QLabel" name="label_14">
+                 <property name="text">
+                  <string>Time marker delay</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="4" column="1">
+                <widget class="QLabel" name="label_15">
+                 <property name="text">
+                  <string>Dead time</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="2">
+                <widget class="SpinBox4ns" name="fTriggerDelay">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="suffix">
+                  <string> ns</string>
+                 </property>
+                 <property name="prefix">
+                  <string/>
+                 </property>
+                 <property name="minimum">
+                  <number>8</number>
+                 </property>
+                 <property name="maximum">
+                  <number>4100</number>
+                 </property>
+                 <property name="singleStep">
+                  <number>4</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="2">
+                <widget class="SpinBox4ns" name="fTimeMarkerDelay">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="suffix">
+                  <string> ns</string>
+                 </property>
+                 <property name="minimum">
+                  <number>8</number>
+                 </property>
+                 <property name="maximum">
+                  <number>4100</number>
+                 </property>
+                 <property name="singleStep">
+                  <number>4</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="4" column="2">
+                <widget class="SpinBox4ns" name="fDeadTime">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="accelerated">
+                  <bool>true</bool>
+                 </property>
+                 <property name="suffix">
+                  <string> ns</string>
+                 </property>
+                 <property name="minimum">
+                  <number>8</number>
+                 </property>
+                 <property name="maximum">
+                  <number>262148</number>
+                 </property>
+                 <property name="singleStep">
+                  <number>4</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="0" column="0" colspan="4">
+                <widget class="Line" name="line_9">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="2">
+                <spacer name="verticalSpacer_2">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="5" column="1">
+                <spacer name="verticalSpacer_5">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="2" column="3">
+                <spacer name="horizontalSpacer_19">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="2" column="0">
+                <spacer name="horizontalSpacer_20">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="2" column="1">
+             <widget class="QGroupBox" name="groupBox_4">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Rate settings</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_22">
+               <item row="0" column="0" colspan="9">
+                <widget class="Line" name="line_7">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="4">
+                <spacer name="verticalSpacer_6">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>40</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="2" column="4">
+                <widget class="QSpinBox" name="fPrescalingVal">
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                 <property name="minimum">
+                  <number>1</number>
+                 </property>
+                 <property name="maximum">
+                  <number>256</number>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="4">
+                <spacer name="verticalSpacer_22">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>40</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item row="2" column="3">
+                <widget class="QLabel" name="label_56">
+                 <property name="text">
+                  <string>Prescaling</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="5">
+                <widget class="QLabel" name="label_57">
+                 <property name="text">
+                  <string>· 0.5 Hz</string>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="fFtuTab">
+       <attribute name="title">
+        <string>FTUs</string>
+       </attribute>
+       <layout class="QGridLayout" name="gridLayout_28">
+        <item row="0" column="1">
+         <widget class="QDockWidget" name="fFtuDock">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="features">
+           <set>QDockWidget::NoDockWidgetFeatures</set>
+          </property>
+          <property name="allowedAreas">
+           <set>Qt::AllDockWidgetAreas</set>
+          </property>
+          <property name="windowTitle">
+           <string>FTU overview</string>
+          </property>
+          <widget class="QWidget" name="fFtuWidget">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <layout class="QGridLayout" name="gridLayout_25" rowstretch="0,0,0,0,0" columnstretch="1,0">
+            <item row="0" column="1" rowspan="5">
+             <widget class="QGroupBox" name="groupBox_8">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Temperatures</string>
+              </property>
+              <layout class="QVBoxLayout" name="verticalLayout_4">
+               <item>
+                <layout class="QHBoxLayout" name="horizontalLayout_14">
+                 <property name="topMargin">
+                  <number>0</number>
+                 </property>
+                 <item>
+                  <widget class="QDoubleSpinBox" name="fFtmTemp0">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="suffix">
+                    <string>°C</string>
+                   </property>
+                   <property name="decimals">
+                    <number>1</number>
+                   </property>
+                   <property name="minimum">
+                    <double>-20.000000000000000</double>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QDoubleSpinBox" name="fFtmTemp1">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="suffix">
+                    <string>°C</string>
+                   </property>
+                   <property name="decimals">
+                    <number>1</number>
+                   </property>
+                   <property name="minimum">
+                    <double>-20.000000000000000</double>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QDoubleSpinBox" name="fFtmTemp2">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="suffix">
+                    <string>°C</string>
+                   </property>
+                   <property name="decimals">
+                    <number>1</number>
+                   </property>
+                   <property name="minimum">
+                    <double>-20.000000000000000</double>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QDoubleSpinBox" name="fFtmTemp3">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="suffix">
+                    <string>°C</string>
+                   </property>
+                   <property name="decimals">
+                    <number>1</number>
+                   </property>
+                   <property name="minimum">
+                    <double>-20.000000000000000</double>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </item>
+               <item>
+                <widget class="QFrame" name="frame_2">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="frameShape">
+                  <enum>QFrame::StyledPanel</enum>
+                 </property>
+                 <property name="frameShadow">
+                  <enum>QFrame::Sunken</enum>
+                 </property>
+                 <layout class="QGridLayout" name="gridLayout_29">
+                  <property name="margin">
+                   <number>3</number>
+                  </property>
+                  <item row="0" column="0">
+                   <widget class="TQtWidget" name="fFtmTempCanv" native="true">
+                    <property name="sizePolicy">
+                     <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                      <horstretch>0</horstretch>
+                      <verstretch>0</verstretch>
+                     </sizepolicy>
+                    </property>
+                   </widget>
+                  </item>
+                 </layout>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="0" column="0">
+             <widget class="QGroupBox" name="groupBox_10">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="title">
+               <string>Counter</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_33">
+               <item row="1" column="0">
+                <widget class="QLabel" name="label_39">
+                 <property name="text">
+                  <string>Time</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="0">
+                <widget class="QLabel" name="label_41">
+                 <property name="text">
+                  <string>On time</string>
+                 </property>
+                </widget>
+               </item>
+               <item row="1" column="1">
+                <widget class="QLineEdit" name="fFtmTime">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="2" column="1">
+                <widget class="QLineEdit" name="fOnTime">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="1">
+                <widget class="QLineEdit" name="fTriggerCounter">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="alignment">
+                  <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="0">
+                <widget class="QLabel" name="label_40">
+                 <property name="text">
+                  <string>Trigger counter</string>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="2" column="0">
+             <widget class="QGroupBox" name="groupBox_7">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="minimumSize">
+               <size>
+                <width>359</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="title">
+               <string>FTU DNAs</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_13">
+               <item row="0" column="0">
+                <widget class="QTextEdit" name="fFtuDNA">
+                 <property name="readOnly">
+                  <bool>true</bool>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QGroupBox" name="groupBox_9">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="minimumSize">
+               <size>
+                <width>359</width>
+                <height>176</height>
+               </size>
+              </property>
+              <property name="title">
+               <string>FTU Enable</string>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_32">
+               <item row="0" column="0">
+                <layout class="QGridLayout" name="fFtuLedLayout" rowstretch="0,0,0,0,0" columnstretch="0,0,0,0,0,0,0,0,0,0,0,0">
+                 <property name="margin">
+                  <number>4</number>
+                 </property>
+                 <item row="1" column="1">
+                  <widget class="QPushButton" name="fFtuLEDPrototype">
+                   <property name="enabled">
+                    <bool>true</bool>
+                   </property>
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="maximumSize">
+                    <size>
+                     <width>18</width>
+                     <height>16777215</height>
+                    </size>
+                   </property>
+                   <property name="text">
+                    <string/>
+                   </property>
+                   <property name="icon">
+                    <iconset resource="design.qrc">
+                     <normaloff>:/Resources/icons/gray circle 1.png</normaloff>:/Resources/icons/gray circle 1.png</iconset>
+                   </property>
+                   <property name="iconSize">
+                    <size>
+                     <width>16</width>
+                     <height>16</height>
+                    </size>
+                   </property>
+                   <property name="checkable">
+                    <bool>false</bool>
+                   </property>
+                   <property name="flat">
+                    <bool>true</bool>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="0">
+                  <widget class="QLabel" name="label_42">
+                   <property name="text">
+                    <string>Crate#0</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="2" column="0">
+                  <widget class="QLabel" name="label_43">
+                   <property name="text">
+                    <string>Crate #1</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="3" column="0">
+                  <widget class="QLabel" name="label_44">
+                   <property name="text">
+                    <string>Crate#2</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="0">
+                  <widget class="QLabel" name="label_45">
+                   <property name="text">
+                    <string>Crate #3</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="1">
+                  <widget class="QLabel" name="label_46">
+                   <property name="text">
+                    <string>1</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="2">
+                  <widget class="QLabel" name="label_47">
+                   <property name="text">
+                    <string>2</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="3">
+                  <widget class="QLabel" name="label_48">
+                   <property name="text">
+                    <string>3</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="4">
+                  <widget class="QLabel" name="label_49">
+                   <property name="text">
+                    <string>4</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="5">
+                  <widget class="QLabel" name="label_50">
+                   <property name="text">
+                    <string>5</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="6">
+                  <widget class="QLabel" name="label_51">
+                   <property name="text">
+                    <string>6</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="7">
+                  <widget class="QLabel" name="label_52">
+                   <property name="text">
+                    <string>7</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="8">
+                  <widget class="QLabel" name="label_53">
+                   <property name="text">
+                    <string>8</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="9">
+                  <widget class="QLabel" name="label_54">
+                   <property name="text">
+                    <string>9</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="10">
+                  <widget class="QLabel" name="label_55">
+                   <property name="text">
+                    <string>10</string>
+                   </property>
+                   <property name="alignment">
+                    <set>Qt::AlignCenter</set>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="11">
+                  <widget class="QSpinBox" name="fFtuAnswersCrate0">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="maximum">
+                    <number>10</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="2" column="11">
+                  <widget class="QSpinBox" name="fFtuAnswersCrate1">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="maximum">
+                    <number>10</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="3" column="11">
+                  <widget class="QSpinBox" name="fFtuAnswersCrate2">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="maximum">
+                    <number>10</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="11">
+                  <widget class="QSpinBox" name="fFtuAnswersCrate3">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="maximum">
+                    <number>10</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="11">
+                  <widget class="QSpinBox" name="fFtuAnswersTotal">
+                   <property name="alignment">
+                    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                   </property>
+                   <property name="readOnly">
+                    <bool>true</bool>
+                   </property>
+                   <property name="buttonSymbols">
+                    <enum>QAbstractSpinBox::NoButtons</enum>
+                   </property>
+                   <property name="maximum">
+                    <number>40</number>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </item>
+              </layout>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="fRatesTab">
+       <attribute name="title">
+        <string>Rates</string>
+       </attribute>
+       <layout class="QGridLayout" name="gridLayout_12">
+        <item row="0" column="0">
+         <widget class="QDockWidget" name="fRatesDock">
           <property name="sizePolicy">
            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -80,7 +1998,7 @@
           </property>
           <property name="windowTitle">
-           <string>Dim service overview</string>
+           <string>Dim command overview</string>
           </property>
-          <widget class="QWidget" name="fDimSvcWidget">
+          <widget class="QWidget" name="fRatesWidget">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -89,175 +2007,151 @@
             </sizepolicy>
            </property>
-           <layout class="QGridLayout" name="gridLayout_10" rowstretch="0,0,4,0,3">
-            <item row="2" column="0">
-             <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="3,5,8">
-              <property name="topMargin">
+           <layout class="QGridLayout" name="gridLayout_6">
+            <item row="0" column="0">
+             <widget class="QFrame" name="frame_4">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="minimumSize">
+               <size>
+                <width>500</width>
+                <height>500</height>
+               </size>
+              </property>
+              <property name="frameShape">
+               <enum>QFrame::StyledPanel</enum>
+              </property>
+              <property name="frameShadow">
+               <enum>QFrame::Sunken</enum>
+              </property>
+              <layout class="QGridLayout" name="gridLayout_31">
+               <property name="margin">
+                <number>3</number>
+               </property>
+               <item row="0" column="0">
+                <widget class="TQtWidget" name="fRatesCanv" native="true"/>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item row="0" column="1">
+             <layout class="QVBoxLayout" name="verticalLayout_5">
+              <property name="rightMargin">
                <number>0</number>
               </property>
               <item>
-               <widget class="QListView" name="fDimSvcServers">
+               <widget class="QLabel" name="label_25">
+                <property name="text">
+                 <string>Patch</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QSpinBox" name="fThresholdIdx">
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>false</bool>
+                </property>
+                <property name="specialValueText">
+                 <string>all</string>
+                </property>
+                <property name="minimum">
+                 <number>-1</number>
+                </property>
+                <property name="maximum">
+                 <number>1438</number>
+                </property>
+                <property name="value">
+                 <number>0</number>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <spacer name="verticalSpacer_20">
+                <property name="orientation">
+                 <enum>Qt::Vertical</enum>
+                </property>
+                <property name="sizeType">
+                 <enum>QSizePolicy::Fixed</enum>
+                </property>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>20</width>
+                  <height>5</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item>
+               <widget class="QLabel" name="label_24">
+                <property name="text">
+                 <string>Threshold</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QSpinBox" name="fThresholdVal">
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="maximum">
+                 <number>4095</number>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QDoubleSpinBox" name="fThresholdVolt">
                 <property name="sizePolicy">
-                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                   <horstretch>0</horstretch>
                   <verstretch>0</verstretch>
                  </sizepolicy>
                 </property>
-                <property name="editTriggers">
-                 <set>QAbstractItemView::NoEditTriggers</set>
-                </property>
-                <property name="showDropIndicator" stdset="0">
-                 <bool>false</bool>
-                </property>
-                <property name="alternatingRowColors">
+                <property name="minimumSize">
+                 <size>
+                  <width>100</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
                  <bool>true</bool>
                 </property>
-                <property name="movement">
-                 <enum>QListView::Static</enum>
-                </property>
-                <property name="resizeMode">
-                 <enum>QListView::Fixed</enum>
-                </property>
-                <property name="selectionRectVisible">
-                 <bool>true</bool>
+                <property name="buttonSymbols">
+                 <enum>QAbstractSpinBox::NoButtons</enum>
+                </property>
+                <property name="suffix">
+                 <string> mV</string>
+                </property>
+                <property name="decimals">
+                 <number>1</number>
+                </property>
+                <property name="maximum">
+                 <double>2500.000000000000000</double>
+                </property>
+                <property name="value">
+                 <double>0.000000000000000</double>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QListView" name="fDimSvcServices">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-                  <horstretch>0</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-                <property name="editTriggers">
-                 <set>QAbstractItemView::NoEditTriggers</set>
-                </property>
-                <property name="showDropIndicator" stdset="0">
-                 <bool>false</bool>
-                </property>
-                <property name="alternatingRowColors">
-                 <bool>true</bool>
-                </property>
-                <property name="movement">
-                 <enum>QListView::Static</enum>
-                </property>
-                <property name="resizeMode">
-                 <enum>QListView::Fixed</enum>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QListView" name="fDimSvcDescription">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-                  <horstretch>0</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-                <property name="editTriggers">
-                 <set>QAbstractItemView::NoEditTriggers</set>
-                </property>
-                <property name="showDropIndicator" stdset="0">
-                 <bool>false</bool>
-                </property>
-                <property name="selectionMode">
-                 <enum>QAbstractItemView::NoSelection</enum>
-                </property>
-                <property name="movement">
-                 <enum>QListView::Static</enum>
-                </property>
-                <property name="isWrapping" stdset="0">
-                 <bool>false</bool>
-                </property>
-                <property name="resizeMode">
-                 <enum>QListView::Fixed</enum>
-                </property>
-               </widget>
-              </item>
-             </layout>
-            </item>
-            <item row="4" column="0">
-             <widget class="QTextEdit" name="fDimSvcText">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-                <horstretch>0</horstretch>
-                <verstretch>1</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="maximumSize">
-               <size>
-                <width>16777215</width>
-                <height>16777215</height>
-               </size>
-              </property>
-              <property name="textInteractionFlags">
-               <set>Qt::TextSelectableByMouse</set>
-              </property>
-             </widget>
-            </item>
-            <item row="3" column="0">
-             <layout class="QHBoxLayout" name="horizontalLayout_8">
-              <property name="bottomMargin">
-               <number>0</number>
-              </property>
-              <item>
-               <spacer name="horizontalSpacer_9">
+               <spacer name="verticalSpacer_19">
                 <property name="orientation">
-                 <enum>Qt::Horizontal</enum>
-                </property>
-                <property name="sizeHint" stdset="0">
-                 <size>
-                  <width>40</width>
-                  <height>20</height>
-                 </size>
-                </property>
-               </spacer>
-              </item>
-              <item>
-               <widget class="QPushButton" name="pushButton">
-                <property name="toolTip">
-                 <string>Clear contents of the service message window.</string>
-                </property>
-                <property name="text">
-                 <string>Clear</string>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <spacer name="horizontalSpacer_10">
-                <property name="orientation">
-                 <enum>Qt::Horizontal</enum>
-                </property>
-                <property name="sizeType">
-                 <enum>QSizePolicy::Fixed</enum>
+                 <enum>Qt::Vertical</enum>
                 </property>
                 <property name="sizeHint" stdset="0">
                  <size>
                   <width>20</width>
-                  <height>20</height>
+                  <height>40</height>
                  </size>
                 </property>
                </spacer>
-              </item>
-              <item>
-               <widget class="QPushButton" name="pushButton_2">
-                <property name="toolTip">
-                 <string>Increase size of the service message window.</string>
-                </property>
-                <property name="text">
-                 <string>+</string>
-                </property>
-               </widget>
-              </item>
-              <item>
-               <widget class="QPushButton" name="pushButton_3">
-                <property name="toolTip">
-                 <string>Decrease size of the service message window.</string>
-                </property>
-                <property name="text">
-                 <string>-</string>
-                </property>
-               </widget>
               </item>
              </layout>
@@ -270,4 +2164,7 @@
       </widget>
       <widget class="QWidget" name="fLoggerTab">
+       <property name="enabled">
+        <bool>true</bool>
+       </property>
        <attribute name="title">
         <string>Logger</string>
@@ -276,4 +2173,7 @@
         <item row="1" column="2">
          <widget class="QDockWidget" name="fLoggerDock">
+          <property name="enabled">
+           <bool>true</bool>
+          </property>
           <property name="sizePolicy">
            <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@@ -292,4 +2192,7 @@
           </property>
           <widget class="QWidget" name="fLoggerWidget">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
            <property name="sizePolicy">
             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -299,5 +2202,5 @@
            </property>
            <layout class="QGridLayout" name="gridLayout_19">
-            <item row="5" column="1">
+            <item row="6" column="0">
              <widget class="QLabel" name="label_4">
               <property name="text">
@@ -306,13 +2209,13 @@
              </widget>
             </item>
-            <item row="4" column="1">
+            <item row="5" column="0">
              <widget class="QLabel" name="label_5">
               <property name="text">
-               <string>Daily file</string>
+               <string>Night file</string>
               </property>
              </widget>
             </item>
-            <item row="4" column="2">
-             <widget class="QLineEdit" name="fLoggerFilenameDay">
+            <item row="5" column="1">
+             <widget class="QLineEdit" name="fLoggerFilenameNight">
               <property name="enabled">
                <bool>true</bool>
@@ -323,5 +2226,5 @@
              </widget>
             </item>
-            <item row="5" column="2">
+            <item row="6" column="1">
              <widget class="QLineEdit" name="fLoggerFilenameRun">
               <property name="enabled">
@@ -333,5 +2236,5 @@
              </widget>
             </item>
-            <item row="5" column="4">
+            <item row="6" column="2">
              <spacer name="horizontalSpacer_14">
               <property name="orientation">
@@ -349,60 +2252,19 @@
              </spacer>
             </item>
-            <item row="6" column="2">
-             <widget class="QDoubleSpinBox" name="doubleSpinBox">
-              <property name="enabled">
-               <bool>true</bool>
-              </property>
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="font">
-               <font>
-                <weight>50</weight>
-                <bold>false</bold>
-               </font>
-              </property>
-              <property name="frame">
-               <bool>true</bool>
-              </property>
-              <property name="alignment">
-               <set>Qt::AlignCenter</set>
-              </property>
-              <property name="readOnly">
-               <bool>true</bool>
-              </property>
-              <property name="buttonSymbols">
-               <enum>QAbstractSpinBox::NoButtons</enum>
-              </property>
-              <property name="keyboardTracking">
-               <bool>true</bool>
-              </property>
-              <property name="suffix">
-               <string> Hz</string>
-              </property>
-              <property name="value">
-               <double>99.989999999999995</double>
-              </property>
-             </widget>
-            </item>
-            <item row="6" column="1">
-             <widget class="QLabel" name="label_7">
-              <property name="text">
-               <string>Rate</string>
-              </property>
-             </widget>
-            </item>
-            <item row="4" column="5" rowspan="3">
+            <item row="4" column="3" rowspan="7">
              <layout class="QHBoxLayout" name="horizontalLayout_9">
               <item>
-               <widget class="QProgressBar" name="progressBar">
+               <widget class="QProgressBar" name="fLoggerSpaceLeft">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
                 <property name="contextMenuPolicy">
                  <enum>Qt::DefaultContextMenu</enum>
                 </property>
+                <property name="maximum">
+                 <number>1000</number>
+                </property>
                 <property name="value">
-                 <number>24</number>
+                 <number>0</number>
                 </property>
                 <property name="alignment">
@@ -428,5 +2290,5 @@
              </layout>
             </item>
-            <item row="7" column="5">
+            <item row="12" column="3">
              <widget class="QLabel" name="label">
               <property name="sizePolicy">
@@ -437,5 +2299,5 @@
               </property>
               <property name="text">
-               <string>Min</string>
+               <string>Empty</string>
               </property>
               <property name="alignment">
@@ -444,8 +2306,46 @@
              </widget>
             </item>
-            <item row="2" column="5">
-             <widget class="QTimeEdit" name="timeEdit">
+            <item row="15" column="3">
+             <spacer name="verticalSpacer_4">
+              <property name="orientation">
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType">
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>20</width>
+                <height>40</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item row="2" column="3">
+             <widget class="QDoubleSpinBox" name="fLoggerFreeSpace">
+              <property name="toolTip">
+               <string>Remaining free disk space</string>
+              </property>
+              <property name="alignment">
+               <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+              </property>
+              <property name="readOnly">
+               <bool>true</bool>
+              </property>
+              <property name="buttonSymbols">
+               <enum>QAbstractSpinBox::NoButtons</enum>
+              </property>
+              <property name="prefix">
+               <string/>
+              </property>
+              <property name="suffix">
+               <string> GB</string>
+              </property>
+             </widget>
+            </item>
+            <item row="14" column="3">
+             <widget class="QTimeEdit" name="fLoggerET">
               <property name="sizePolicy">
-               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+               <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
                 <horstretch>0</horstretch>
                 <verstretch>0</verstretch>
@@ -461,6 +2361,9 @@
                </font>
               </property>
+              <property name="toolTip">
+               <string>Estimated time until disk is filled with the current writing speed.</string>
+              </property>
               <property name="alignment">
-               <set>Qt::AlignCenter</set>
+               <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
               </property>
               <property name="readOnly">
@@ -471,8 +2374,8 @@
               </property>
               <property name="currentSection">
-               <enum>QDateTimeEdit::NoSection</enum>
+               <enum>QDateTimeEdit::HourSection</enum>
               </property>
               <property name="displayFormat">
-               <string>    HH:mm</string>
+               <string>hh:mm:ss</string>
               </property>
               <property name="calendarPopup">
@@ -491,5 +2394,209 @@
              </widget>
             </item>
-            <item row="3" column="5">
+            <item row="7" column="1" rowspan="2">
+             <layout class="QGridLayout" name="gridLayout_14">
+              <item row="1" column="0">
+               <widget class="QDoubleSpinBox" name="fLoggerWritten">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="toolTip">
+                 <string>Number of bytes written since startup of data logger.</string>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+                <property name="buttonSymbols">
+                 <enum>QAbstractSpinBox::NoButtons</enum>
+                </property>
+                <property name="suffix">
+                 <string> MB</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QDoubleSpinBox" name="fLoggerRate">
+                <property name="enabled">
+                 <bool>true</bool>
+                </property>
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="font">
+                 <font>
+                  <weight>50</weight>
+                  <bold>false</bold>
+                 </font>
+                </property>
+                <property name="toolTip">
+                 <string>Current writing speed</string>
+                </property>
+                <property name="frame">
+                 <bool>true</bool>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+                <property name="buttonSymbols">
+                 <enum>QAbstractSpinBox::NoButtons</enum>
+                </property>
+                <property name="keyboardTracking">
+                 <bool>true</bool>
+                </property>
+                <property name="suffix">
+                 <string> kB/s</string>
+                </property>
+                <property name="maximum">
+                 <double>99999.000000000000000</double>
+                </property>
+                <property name="value">
+                 <double>0.000000000000000</double>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <spacer name="horizontalSpacer_11">
+                <property name="orientation">
+                 <enum>Qt::Horizontal</enum>
+                </property>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>40</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+             </layout>
+            </item>
+            <item row="8" column="0">
+             <widget class="QLabel" name="label_7">
+              <property name="text">
+               <string>Rate</string>
+              </property>
+             </widget>
+            </item>
+            <item row="7" column="0">
+             <widget class="QLabel" name="label_6">
+              <property name="text">
+               <string>Written</string>
+              </property>
+             </widget>
+            </item>
+            <item row="4" column="0" colspan="2">
+             <layout class="QHBoxLayout" name="horizontalLayout_11">
+              <property name="topMargin">
+               <number>0</number>
+              </property>
+              <item>
+               <widget class="QLabel" name="label_26">
+                <property name="text">
+                 <string>Open files / subscriptions</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QSpinBox" name="fLoggerOpenFiles">
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+                <property name="buttonSymbols">
+                 <enum>QAbstractSpinBox::NoButtons</enum>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QLabel" name="label_58">
+                <property name="text">
+                 <string>/</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QSpinBox" name="fLoggerSubscriptions">
+                <property name="alignment">
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+                </property>
+                <property name="readOnly">
+                 <bool>true</bool>
+                </property>
+                <property name="buttonSymbols">
+                 <enum>QAbstractSpinBox::NoButtons</enum>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <spacer name="horizontalSpacer_12">
+                <property name="orientation">
+                 <enum>Qt::Horizontal</enum>
+                </property>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>40</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item>
+               <widget class="QPushButton" name="fLoggerLedLog">
+                <property name="text">
+                 <string>log</string>
+                </property>
+                <property name="icon">
+                 <iconset resource="design.qrc">
+                  <normaloff>:/Resources/icons/gray circle 1.png</normaloff>:/Resources/icons/gray circle 1.png</iconset>
+                </property>
+                <property name="flat">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="fLoggerLedRep">
+                <property name="text">
+                 <string>rep</string>
+                </property>
+                <property name="icon">
+                 <iconset resource="design.qrc">
+                  <normaloff>:/Resources/icons/gray circle 1.png</normaloff>:/Resources/icons/gray circle 1.png</iconset>
+                </property>
+                <property name="flat">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="fLoggerLedFits">
+                <property name="text">
+                 <string>fits</string>
+                </property>
+                <property name="icon">
+                 <iconset resource="design.qrc">
+                  <normaloff>:/Resources/icons/gray circle 1.png</normaloff>:/Resources/icons/gray circle 1.png</iconset>
+                </property>
+                <property name="flat">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+            <item row="3" column="3">
              <widget class="QLabel" name="label_3">
               <property name="sizePolicy">
@@ -500,147 +2607,9 @@
               </property>
               <property name="text">
-               <string>Max</string>
+               <string>&gt;=1GB</string>
               </property>
               <property name="alignment">
                <set>Qt::AlignBottom|Qt::AlignHCenter</set>
               </property>
-             </widget>
-            </item>
-            <item row="5" column="0">
-             <spacer name="horizontalSpacer_11">
-              <property name="orientation">
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>40</width>
-                <height>20</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-            <item row="5" column="6">
-             <spacer name="horizontalSpacer_12">
-              <property name="orientation">
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>40</width>
-                <height>20</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-            <item row="1" column="5">
-             <spacer name="verticalSpacer">
-              <property name="orientation">
-               <enum>Qt::Vertical</enum>
-              </property>
-              <property name="sizeType">
-               <enum>QSizePolicy::Expanding</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>20</width>
-                <height>40</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-            <item row="9" column="5">
-             <spacer name="verticalSpacer_4">
-              <property name="orientation">
-               <enum>Qt::Vertical</enum>
-              </property>
-              <property name="sizeType">
-               <enum>QSizePolicy::Expanding</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>20</width>
-                <height>40</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-            <item row="8" column="5">
-             <widget class="QDoubleSpinBox" name="doubleSpinBox_2">
-              <property name="alignment">
-               <set>Qt::AlignCenter</set>
-              </property>
-              <property name="readOnly">
-               <bool>true</bool>
-              </property>
-              <property name="buttonSymbols">
-               <enum>QAbstractSpinBox::NoButtons</enum>
-              </property>
-              <property name="prefix">
-               <string/>
-              </property>
-              <property name="suffix">
-               <string> GB</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </widget>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="tab">
-       <attribute name="title">
-        <string>Page</string>
-       </attribute>
-       <layout class="QGridLayout" name="gridLayout_12">
-        <item row="0" column="0">
-         <widget class="QDockWidget" name="fDimCmdDock_2">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="features">
-           <set>QDockWidget::NoDockWidgetFeatures</set>
-          </property>
-          <property name="allowedAreas">
-           <set>Qt::AllDockWidgetAreas</set>
-          </property>
-          <property name="windowTitle">
-           <string>Dim command overview</string>
-          </property>
-          <widget class="QWidget" name="fDimCmdWidget_2">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <layout class="QGridLayout" name="gridLayout_6">
-            <item row="0" column="0">
-             <widget class="QFrame" name="frame">
-              <property name="frameShape">
-               <enum>QFrame::StyledPanel</enum>
-              </property>
-              <property name="frameShadow">
-               <enum>QFrame::Sunken</enum>
-              </property>
-              <layout class="QGridLayout" name="gridLayout_13">
-               <property name="margin">
-                <number>0</number>
-               </property>
-               <item row="0" column="0">
-                <widget class="TQtWidget" name="widget" native="true">
-                 <property name="enabled">
-                  <bool>true</bool>
-                 </property>
-                 <property name="mouseTracking">
-                  <bool>false</bool>
-                 </property>
-                </widget>
-               </item>
-              </layout>
              </widget>
             </item>
@@ -774,4 +2743,7 @@
                  <enum>QListView::Fixed</enum>
                 </property>
+                <property name="wordWrap">
+                 <bool>true</bool>
+                </property>
                </widget>
               </item>
@@ -791,5 +2763,9 @@
               </item>
               <item>
-               <widget class="QLineEdit" name="fDimCmdLineEdit"/>
+               <widget class="QLineEdit" name="fDimCmdLineEdit">
+                <property name="toolTip">
+                 <string>Arguments to be sent with the command (0x will be interpreted as hex value, a leading 0 as octal)</string>
+                </property>
+               </widget>
               </item>
               <item>
@@ -797,4 +2773,213 @@
                 <property name="text">
                  <string>Send</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </widget>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="fDimSvcTab">
+       <attribute name="title">
+        <string>Services</string>
+       </attribute>
+       <layout class="QGridLayout" name="gridLayout_3">
+        <item row="0" column="0">
+         <widget class="QDockWidget" name="fDimSvcDock">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="features">
+           <set>QDockWidget::NoDockWidgetFeatures</set>
+          </property>
+          <property name="allowedAreas">
+           <set>Qt::AllDockWidgetAreas</set>
+          </property>
+          <property name="windowTitle">
+           <string>Dim service overview</string>
+          </property>
+          <widget class="QWidget" name="fDimSvcWidget">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <layout class="QGridLayout" name="gridLayout_10" rowstretch="0,0,4,0,3">
+            <item row="2" column="0">
+             <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="3,5,8">
+              <property name="topMargin">
+               <number>0</number>
+              </property>
+              <item>
+               <widget class="QListView" name="fDimSvcServers">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="editTriggers">
+                 <set>QAbstractItemView::NoEditTriggers</set>
+                </property>
+                <property name="showDropIndicator" stdset="0">
+                 <bool>false</bool>
+                </property>
+                <property name="alternatingRowColors">
+                 <bool>true</bool>
+                </property>
+                <property name="movement">
+                 <enum>QListView::Static</enum>
+                </property>
+                <property name="resizeMode">
+                 <enum>QListView::Fixed</enum>
+                </property>
+                <property name="selectionRectVisible">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QListView" name="fDimSvcServices">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="editTriggers">
+                 <set>QAbstractItemView::NoEditTriggers</set>
+                </property>
+                <property name="showDropIndicator" stdset="0">
+                 <bool>false</bool>
+                </property>
+                <property name="alternatingRowColors">
+                 <bool>true</bool>
+                </property>
+                <property name="movement">
+                 <enum>QListView::Static</enum>
+                </property>
+                <property name="resizeMode">
+                 <enum>QListView::Fixed</enum>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QListView" name="fDimSvcDescription">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="editTriggers">
+                 <set>QAbstractItemView::NoEditTriggers</set>
+                </property>
+                <property name="showDropIndicator" stdset="0">
+                 <bool>false</bool>
+                </property>
+                <property name="selectionMode">
+                 <enum>QAbstractItemView::NoSelection</enum>
+                </property>
+                <property name="movement">
+                 <enum>QListView::Static</enum>
+                </property>
+                <property name="isWrapping" stdset="0">
+                 <bool>false</bool>
+                </property>
+                <property name="resizeMode">
+                 <enum>QListView::Fixed</enum>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+            <item row="4" column="0">
+             <widget class="QTextEdit" name="fDimSvcText">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                <horstretch>0</horstretch>
+                <verstretch>1</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>16777215</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="textInteractionFlags">
+               <set>Qt::TextSelectableByMouse</set>
+              </property>
+             </widget>
+            </item>
+            <item row="3" column="0">
+             <layout class="QHBoxLayout" name="horizontalLayout_8">
+              <property name="bottomMargin">
+               <number>0</number>
+              </property>
+              <item>
+               <spacer name="horizontalSpacer_9">
+                <property name="orientation">
+                 <enum>Qt::Horizontal</enum>
+                </property>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>40</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton">
+                <property name="toolTip">
+                 <string>Clear contents of the service message window.</string>
+                </property>
+                <property name="text">
+                 <string>Clear</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <spacer name="horizontalSpacer_10">
+                <property name="orientation">
+                 <enum>Qt::Horizontal</enum>
+                </property>
+                <property name="sizeType">
+                 <enum>QSizePolicy::Fixed</enum>
+                </property>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>20</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_2">
+                <property name="toolTip">
+                 <string>Increase size of the service message window.</string>
+                </property>
+                <property name="text">
+                 <string>+</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_3">
+                <property name="toolTip">
+                 <string>Decrease size of the service message window.</string>
+                </property>
+                <property name="text">
+                 <string>-</string>
                 </property>
                </widget>
@@ -1072,5 +3257,5 @@
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;FIXME: Notice when new message arrived.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
               </property>
               <property name="textInteractionFlags">
@@ -1319,5 +3504,5 @@
    </property>
    <property name="windowTitle">
-    <string>Network status</string>
+    <string>System status</string>
    </property>
    <attribute name="dockWidgetArea">
@@ -1427,4 +3612,7 @@
        <item row="3" column="2">
         <widget class="QCheckBox" name="fStatusFTMEnable">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -1494,4 +3682,7 @@
        <item row="4" column="2">
         <widget class="QCheckBox" name="fStatusFADEnable">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -1561,4 +3752,7 @@
        <item row="5" column="2">
         <widget class="QCheckBox" name="fStatusLoggerEnable">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -1819,4 +4013,9 @@
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>SpinBox4ns</class>
+   <extends>QSpinBox</extends>
+   <header>SpinBox4ns.h</header>
+  </customwidget>
  </customwidgets>
  <resources>
@@ -1832,5 +4031,5 @@
     <hint type="sourcelabel">
      <x>918</x>
-     <y>667</y>
+     <y>647</y>
     </hint>
     <hint type="destinationlabel">
@@ -1864,5 +4063,5 @@
     <hint type="sourcelabel">
      <x>979</x>
-     <y>667</y>
+     <y>647</y>
     </hint>
     <hint type="destinationlabel">
@@ -1880,5 +4079,5 @@
     <hint type="sourcelabel">
      <x>1014</x>
-     <y>667</y>
+     <y>647</y>
     </hint>
     <hint type="destinationlabel">
@@ -1928,9 +4127,9 @@
     <hint type="sourcelabel">
      <x>946</x>
-     <y>590</y>
+     <y>570</y>
     </hint>
     <hint type="destinationlabel">
      <x>1003</x>
-     <y>591</y>
+     <y>571</y>
     </hint>
    </hints>
@@ -2024,9 +4223,9 @@
     <hint type="sourcelabel">
      <x>946</x>
-     <y>590</y>
+     <y>570</y>
     </hint>
     <hint type="destinationlabel">
      <x>1003</x>
-     <y>591</y>
+     <y>571</y>
     </hint>
    </hints>
@@ -2136,9 +4335,9 @@
     <hint type="sourcelabel">
      <x>907</x>
-     <y>382</y>
+     <y>371</y>
     </hint>
     <hint type="destinationlabel">
      <x>1004</x>
-     <y>592</y>
+     <y>572</y>
     </hint>
    </hints>
@@ -2152,9 +4351,9 @@
     <hint type="sourcelabel">
      <x>968</x>
-     <y>382</y>
+     <y>371</y>
     </hint>
     <hint type="destinationlabel">
      <x>1004</x>
-     <y>592</y>
+     <y>572</y>
     </hint>
    </hints>
@@ -2168,9 +4367,57 @@
     <hint type="sourcelabel">
      <x>1003</x>
-     <y>382</y>
+     <y>371</y>
     </hint>
     <hint type="destinationlabel">
      <x>1004</x>
-     <y>592</y>
+     <y>572</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fEnableLP1</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>fTriggerSeqLP1</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>386</x>
+     <y>263</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>400</x>
+     <y>291</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fEnableLP2</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>fTriggerSeqLP2</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>450</x>
+     <y>263</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>464</x>
+     <y>291</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fEnablePedestal</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>fTriggerSeqPed</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>322</x>
+     <y>263</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>336</x>
+     <y>291</y>
     </hint>
    </hints>
Index: /trunk/FACT++/gui/fact.cc
===================================================================
--- /trunk/FACT++/gui/fact.cc	(revision 10517)
+++ /trunk/FACT++/gui/fact.cc	(revision 10518)
@@ -1,9 +1,148 @@
 #include "FactGui.h"
 
-int main(int argc, char *argv[])
+#include "src/Configuration.h"
+
+/*
+ Extract usage clause(s) [if any] for SYNOPSIS.
+ Translators: "Usage" and "or" here are patterns (regular expressions) which
+ are used to match the usage synopsis in program output.  An example from cp
+ (GNU coreutils) which contains both strings:
+  Usage: cp [OPTION]... [-T] SOURCE DEST
+    or:  cp [OPTION]... SOURCE... DIRECTORY
+    or:  cp [OPTION]... -t DIRECTORY SOURCE...
+ */
+void PrintUsage()
 {
-    setenv("DIM_DNS_NODE", "localhost", 0);
+    cout << "\n"
+        "The console connects to all available Dim Servers and allows to "
+        "easily access all of their commands.\n"
+        "\n"
+        "Usage: test3 [-c type] [OPTIONS]\n"
+        "  or:  test3 [OPTIONS]\n"
+        "\n"
+        "Options:\n"
+        "The following describes the available commandline options. "
+        "For further details on how command line option are parsed "
+        "and in which order which configuration sources are accessed "
+        "please refer to the class reference of the Configuration class.";
+    cout << endl;
 
-    QApplication app(argc, argv);
+}
+
+void PrintHelp()
+{
+    cout << "\n"
+        "The default is that the program is started without user interaction. "
+        "All actions are supposed to arrive as DimCommands. Using the -c "
+        "option, a local shell can be initialized. With h or help a short "
+        "help message about the usuage can be brought to the screen."
+        << endl;
+
+    /*
+     cout << "bla bla bla" << endl << endl;
+     cout << endl;
+     cout << "Environment:" << endl;
+     cout << "environment" << endl;
+     cout << endl;
+     cout << "Examples:" << endl;
+     cout << "test exam" << endl;
+     cout << endl;
+     cout << "Files:" << endl;
+     cout << "files" << endl;
+     cout << endl;
+     */
+}
+
+/*
+ The first line of the --version information is assumed to be in one
+ of the following formats:
+
+   <version>
+   <program> <version>
+   {GNU,Free} <program> <version>
+   <program> ({GNU,Free} <package>) <version>
+   <program> - {GNU,Free} <package> <version>
+
+ and separated from any copyright/author details by a blank line.
+
+ Handle multi-line bug reporting sections of the form:
+
+   Report <program> bugs to <addr>
+   GNU <package> home page: <url>
+   ...
+*/
+void PrintVersion(const char *name)
+{
+    cout <<
+        name << " - "PACKAGE_STRING"\n"
+        "\n"
+        "Written by Thomas Bretz et al.\n"
+        "\n"
+        "Report bugs to <"PACKAGE_BUGREPORT">\n"
+        "Home page: "PACKAGE_URL"\n"
+        "\n"
+        "Copyright (C) 2011 by the FACT Collaboration.\n"
+        "This is free software; see the source for copying conditions.\n"
+        << endl;
+}
+
+
+void SetupConfiguration(Configuration &conf)
+{
+    po::options_description config("Program options");
+    config.add_options()
+        ("dns",       var<string>("localhost"),  "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)")
+        ;
+
+    conf.AddEnv("dns", "DIM_DNS_NODE");
+
+    conf.AddOptions(config);
+}
+
+int main(int argc, const char* argv[])
+{
+    Configuration conf(argv[0]);
+    conf.SetPrintUsage(PrintUsage);
+    SetupConfiguration(conf);
+
+    po::variables_map vm;
+    try
+    {
+        vm = conf.Parse(argc, argv);
+    }
+    catch (std::exception &e)
+    {
+#if BOOST_VERSION > 104000
+        po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+        if (MO)
+            cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+        else
+#endif
+            cout << "Error: " << e.what() << endl;
+        cout << endl;
+
+        return -1;
+    }
+
+    if (conf.HasPrint())
+        return -1;
+
+    if (conf.HasVersion())
+    {
+        PrintVersion(argv[0]);
+        return -1;
+    }
+
+    if (conf.HasHelp())
+    {
+        PrintHelp();
+        return -1;
+    }
+
+    // To allow overwriting of DIM_DNS_NODE set 0 to 1
+    setenv("DIM_DNS_NODE", conf.Get<string>("dns").c_str(), 1);
+
+
+    QApplication app(argc, const_cast<char**>(argv));
 
     FactGui gui;
