CFEL - ASG Software Suite  2.5.0
CASS
zero_d_viewer.cpp
Go to the documentation of this file.
1 // Copyright (C) 2013 Lutz Foucar
2 
3 /**
4  * @file zero_d_viewer.cpp contains viewer for 0d data
5  *
6  * @author Lutz Foucar
7  */
8 
9 #include <QtCore/QSettings>
10 
11 #if QT_VERSION >= 0x050000
12 #include <QtWidgets/QLabel>
13 #include <QtWidgets/QMessageBox>
14 #include <QtWidgets/QBoxLayout>
15 #else
16 #include <QtGui/QLabel>
17 #include <QtGui/QMessageBox>
18 #include <QtGui/QBoxLayout>
19 #endif
20 
21 #include <QtGui/QFont>
22 
23 #include "zero_d_viewer.h"
24 
25 #include "zero_d_viewer_data.h"
26 #include "file_handler.h"
27 
28 using namespace jocassview;
29 using namespace cass;
30 
32  : DataViewer(title,parent)
33 {
34  QSettings settings;
35  settings.beginGroup(windowTitle());
36 
37  // set the label to display the value as central widget
38  _value = new QLabel(tr("Number"));
39  _value->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
40  QFont font(_value->font());
41  font.setPointSize(20);
42  _value->setFont(font);
44 
45  // generate the data that will handle the display//
47 
48  // Set the size and position of the window
49  resize(settings.value("WindowSize",size()).toSize());
50  move(settings.value("WindowPosition",pos()).toPoint());
51 
52  settings.endGroup();
53 }
54 
56 {
57 
58 }
59 
61 {
62  QList<Data*> dlist;
63  dlist.append(_data);
64  return dlist;
65 }
66 
68 {
69  return QString("0DViewer");
70 }
71 
72 void ZeroDViewer::print()const
73 {
74  QMessageBox::critical(0,tr("ZeroDViewer"),tr("Error: Can't print 0D data"));
75 }
76 
77 void ZeroDViewer::saveData(const QString &filename)
78 {
79  if (data().isEmpty())
80  return;
81  FileHandler::saveData(filename,data().front()->result());
82 }
83 
85 {
86  QStringList list;
87  list << "h5";
88  return list;
89 }
setPointSize(int pointSize)
base class for viewers
Definition: data_viewer.h:37
static void saveData(const QString &filename, result_t::shared_pointer data)
save data to a given file
things written only at end of run H5Dump ProcessorSummary size
ZeroDViewerData * _data
pointer to the 0d data wrapper
Definition: zero_d_viewer.h:76
void saveData(const QString &filename)
overlaod saving
contains the wrapper of the data for the 0d viewer
append(const T &value)
contains a file handler
setCentralWidget(QWidget *widget)
fluorescence front
virtual QStringList dataFileSuffixes() const
suffixes for the data of this viewer
QString type() const
retrieve the type of the data viewer
QLabel * _value
the label that displays the value
Definition: zero_d_viewer.h:73
virtual void print() const
overload printing
value(const QString &key, const QVariant &defaultValue=QVariant()
contains the viewer for 0d data
ZeroDViewer(QString title, QWidget *parent=0)
constructor
wrapper for the 0d data
critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
QList< Data * > data()
retrieve the displayed data
beginGroup(const QString &prefix)
virtual ~ZeroDViewer()
destructor