dlgdatafile.h 3.59 KB
Newer Older
Alexander Steffens's avatar
Alexander Steffens committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
#ifndef DLGDATAFILE_H
#define DLGDATAFILE_H

#include <QDialog>
#include <QFile>
#include <QMutex>
#include <QTextCursor>
#include <QTimer>
#include <QThread>
#include <QProgressBar>
#include <QObject>
#include "tabclkrst.h"

namespace Ui {
class dlgdatafile;
}


class dlgdatafile;


#define DDF_SEEKBACK            10
#define DDF_SEEKAFTER           4
//#define DDF_BLOCKSIZE           65536
#define DDF_BLOCKSIZE           65536*2
#define DDF_DUMPBLOCKSIZE       512

#define MODE_READ               1
#define MODE_STOP               2

#define DDF_ANZLASTLINES        15

#define FLG_WHBK            0
#define FLG_WHBK_B          1
#define FLG_REWH            2
#define FLG_WHRE            3
#define FLG_BLYE            4
#define FLG_YEBK            5


class UUpdater : public QThread
{
    Q_OBJECT

public:
    explicit    UUpdater(QObject *parent, Ui::dlgdatafile *ui, QMutex *mutex);
    quint32     _ErrorsFound;
    quint32     _TmpFifoFull;
    quint32     _PciFifoFull;
    quint32     _CoincOfl;
    quint32     _ErrorXXYY;
    quint32     _ErrorTimediff;
    quint32     _TimeStamps[CC_MAX_COMMANDS];

signals:
    void    Update();

private:
    void run();
    QMutex  *_Mutex;
    dlgdatafile     *_Parent;
    Ui::dlgdatafile *_ParentUi;
};






class dlgdatafile : public QDialog
{
    Q_OBJECT

public:
    explicit dlgdatafile(QWidget *parent, QString filename);
    ~dlgdatafile();
    QLabel      *_Stamps[CC_MAX_COMMANDS];

private slots:
    void OpenDataFile();
    void CloseDataFile();
    bool ReadDataFileErrors();
    quint32 ShowData(quint32 start, quint32 end, quint32 ErrorLine);
    void on_More_clicked();

    void on_ReadUntilError_clicked();
    void closeEvent(QCloseEvent *event);

    void on_coinc_g0_editingFinished();
    void on_coinc_g1_editingFinished();
    void on_coinc_clen_editingFinished();
    void on_coinc_ch_devi_editingFinished();
    void on_coinc_ch_repe_editingFinished();
    void on_coincMark_stateChanged(int arg1);
    void on_coincOnlyXY_stateChanged(int arg1);
    void on_coincSingle_stateChanged(int arg1);
    void on_coincEna_stateChanged(int arg1);


private:
    Ui::dlgdatafile *ui;
    QString     _FileName;
    QString     _FileNameInfo;
    QFile       _DataFile;
    QFile       _DataFileInfo;
    bool        _Error;
    quint32     _Line;
    quint32     _LastErrorLine;
    quint8      _Values;
    quint8      _Unit1;
    quint8      _Unit2;
    quint8      _Channel1;
    quint8      _Channel2;
    quint32     _Time1;
    quint32     _Time2;
    quint32     _DaqFifoFulls;
    quint64     _DataValues;
    quint32     _Intervall;

    quint64     _LastPos;
    QString     _Serial;

    quint32     _Coinc_g0;
    quint32     _Coinc_g1;
    quint32     _Coinc_clen;
    quint32     _Coinc_Ch_devi;
    quint32     _Coinc_Ch_repe;

    bool        _Coinc_Ena;
    bool        _Coinc_Single;
    bool        _Coinc_OnlyXY;
    bool        _Coinc_Mark;


    QTextCursor     *_Cursor;
    QTextCharFormat *_Format;
    quint32         data[DDF_BLOCKSIZE];

    QList<QString>  _ErrorTypeTxt;
    QList<QString>  _FunctionNames;


    QTimer      *_timer;
    UUpdater    *_Updater;
    QMutex      _Mutex;

    void        LineNo(quint32 line, bool grobvh, quint32 data);
    void        TxtWhBk(QString txt);
    void        TxtWhBk_B(QString txt);
    void        TxtReWh(QString txt);
    void        TxtWhRe(QString txt);
    void        TxtBlYe(QString txt);
    void        TxtYeBk(QString txt);

};

#endif // DLGDATAFILE_H