CFEL - ASG Software Suite
2.5.0
CASS
|
the jocassview class More...
#include <jocassviewer.h>
Public Slots | |
void | openFile (QString filename=QString(), QString key=QString()) |
load data from a file More... | |
void | startViewer () |
start the viewer More... | |
void | refreshDisplayableItemsList () |
refresh the items on the displayable list More... | |
void | setDisplayedItem (QString itemName, bool state, bool simulateClickedSignal=true) |
check an item in the list More... | |
Public Member Functions | |
JoCASSViewer (QWidget *parent=0, Qt::WindowFlags flags=0) | |
constructor More... | |
~JoCASSViewer () | |
destructor More... | |
![]() | |
TabShape | |
ToolButtonStyle | |
QMainWindow (QWidget *parent=0, Qt::WindowFlags flags=0) | |
addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget) | |
addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget, Qt::Orientation orientation) | |
addToolBar (Qt::ToolBarArea area, QToolBar *toolbar) | |
addToolBar (QToolBar *toolbar) | |
addToolBar (const QString &title) | |
addToolBarBreak (Qt::ToolBarArea area=Qt::TopToolBarArea) | |
centralWidget () | |
contextMenuEvent (QContextMenuEvent *event) | |
DockWidgetArea QMainWindow::corner(Qt::Corner corner) | |
createPopupMenu () | |
DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget) | |
event (QEvent *event) | |
iconSizeChanged (const QSize &iconSize) | |
insertToolBar (QToolBar *before, QToolBar *toolbar) | |
insertToolBarBreak (QToolBar *before) | |
menuBar () | |
menuWidget () | |
removeDockWidget (QDockWidget *dockwidget) | |
removeToolBar (QToolBar *toolbar) | |
removeToolBarBreak (QToolBar *before) | |
restoreDockWidget (QDockWidget *dockwidget) | |
restoreState (const QByteArray &state, int version=0) | |
saveState (int version=0) | |
setCentralWidget (QWidget *widget) | |
setCorner (Qt::Corner corner, Qt::DockWidgetArea area) | |
setMenuBar (QMenuBar *menuBar) | |
setMenuWidget (QWidget *menuBar) | |
setStatusBar (QStatusBar *statusbar) | |
setTabPosition (Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition) | |
splitDockWidget (QDockWidget *first, QDockWidget *second, Qt::Orientation orientation) | |
statusBar () | |
TabPosition QMainWindow::tabPosition(Qt::DockWidgetArea area) | |
tabifiedDockWidgets (QDockWidget *dockwidget) | |
tabifyDockWidget (QDockWidget *first, QDockWidget *second) | |
ToolBarArea QMainWindow::toolBarArea(QToolBar *toolbar) | |
toolBarBreak (QToolBar *toolbar) | |
toolButtonStyleChanged (Qt::ToolButtonStyle toolButtonStyle) | |
data () | |
iterator_category | |
const_iterator () | |
const_iterator (const iterator &other) | |
key () | |
value () | |
operator!= (const const_iterator &other) | |
operator* () | |
operator+ (int j) | |
operator++ () | |
operator++ (int) | |
operator+= (int j) | |
operator- (int j) | |
operator-- () | |
operator-- (int) | |
operator-= (int j) | |
operator-& gt;() | |
operator== (const const_iterator &other) | |
data () | |
iterator_category | |
iterator () | |
key () | |
value () | |
operator!= (const iterator &other) | |
operator!= (const const_iterator &other) | |
operator* () | |
operator+ (int j) | |
operator++ () | |
operator++ (int) | |
operator+= (int j) | |
operator- (int j) | |
operator-- () | |
operator-- (int) | |
operator-= (int j) | |
operator-& gt;() | |
operator== (const iterator &other) | |
operator== (const const_iterator &other) | |
erase (const Key &key) | |
insert (const Key &key, const T &value, bool overwrite) | |
remove (iterator it) | |
replace (const Key &key, const T &value) | |
Protected Member Functions | |
void | moveEvent (QMoveEvent *event) |
receive move events to store the current position to the settings More... | |
void | resizeEvent (QResizeEvent *event) |
receive resize events to store the current size to the settings More... | |
Private Slots | |
void | autoSaveImages () const |
save the data displayed by all windows as png images More... | |
void | autoSave (bool onlyPNG=false) const |
save the data displayed by all windows in the possible files More... | |
void | saveFile (QString filename=QString(), QStringList keys=QStringList()) const |
save a data from specific viewer or all viewers to the given filename More... | |
void | about () |
display about this box More... | |
double | interval () const |
retrieve the rate as interval in ms More... | |
double | rate () const |
retrieve the user set rate in Hz More... | |
void | changeAutoUpdate () |
change the autoupdate based upon what the user set More... | |
void | updateViewers () |
update the contents within the viewers in the map More... | |
void | changeViewers (QListWidgetItem *item) |
react on when an item in the list has been checked More... | |
void | removeViewer (DataViewer *obj) |
remove the viewer from the container when it has been destroyed More... | |
QStringList | displayableItems () const |
retrieve a list with all items More... | |
QStringList | displayedItems () const |
retrieve a list with the selected items More... | |
void | print () |
react when print has been triggered More... | |
void | on_source_changed (QString newSource) |
react on when the source has been changed More... | |
void | changeServerAddress () const |
retrieve the server address More... | |
void | broadcastDarkcalCommand () const |
broadcast the darkcal command More... | |
void | broadcastGaincalCommand () const |
broadcast the gaincal command More... | |
void | sendCustomCommand () const |
send a custom command More... | |
void | clearHistogram () const |
send clear histograms More... | |
Private Member Functions | |
void | createViewerForType (QMap< QString, DataViewer * >::iterator view, cass::Result< float >::shared_pointer result) |
convenience function to create a viewer thats appropriate for a given type of data More... | |
Private Attributes | |
StatusLED * | _statusLED |
the status LED More... | |
QLineEdit * | _servername |
the servername input widget More... | |
QSpinBox * | _serverport |
the server port input widget More... | |
QDoubleSpinBox * | _rate |
the rate input More... | |
QAction * | _autoUpdate |
the auto update input More... | |
QToolBar * | _serverToolBar |
the toolbar with the server options More... | |
QMap< QString, DataViewer * > | _viewers |
the container for all opened viewers More... | |
QTimer | _updateTimer |
timer for the auto update function it is used as singleshot timer More... | |
bool | _updateInProgress |
flag to tell whether an update is in progess More... | |
the jocassview class
Definition at line 41 of file jocassviewer.h.
JoCASSViewer::JoCASSViewer | ( | QWidget * | parent = 0 , |
Qt::WindowFlags | flags = 0 |
||
) |
constructor
create a main window, initialize the privates and set up the connections
parent | the parent widget. Default is 0 |
flags | the flags |
set up the window
use the timer as single shot
initialize the server data source and add them to the manager
Definition at line 65 of file jocassviewer.cpp.
References _autoUpdate, _rate, _servername, _serverport, _serverToolBar, _statusLED, _updateTimer, about(), QMenu::addAction(), QToolBar::addAction(), QMenuBar::addMenu(), QMenu::addSeparator(), QToolBar::addSeparator(), jocassview::DataSourceManager::addSource(), QMainWindow::addToolBar(), QToolBar::addWidget(), autoSave(), autoSaveImages(), broadcastDarkcalCommand(), broadcastGaincalCommand(), changeAutoUpdate(), changeServerAddress(), changeViewers(), clearHistogram(), QIcon::fromTheme(), jocassview::DataSourceManager::instance(), QMainWindow::menuBar(), jocassview::StatusLED::off, on_source_changed(), openFile(), print(), refreshDisplayableItemsList(), saveFile(), sendCustomCommand(), QMainWindow::setCentralWidget(), jocassview::DataSourceManager::setMenu(), QSpinBox::setRange(), QDoubleSpinBox::setRange(), jocassview::StatusLED::setStatus(), size, QMainWindow::statusBar(), updateViewers(), and QSettings::value().
JoCASSViewer::~JoCASSViewer | ( | ) |
destructor
Definition at line 206 of file jocassviewer.cpp.
|
privateslot |
display about this box
Definition at line 351 of file jocassviewer.cpp.
References QMessageBox::about().
Referenced by JoCASSViewer().
|
privateslot |
save the data displayed by all windows in the possible files
generate the correct filenames and call saveFile() to save the data.
onlyPNG | flag that allows to only save png files fo the open viewer |
generate the general automatic filename
save all open windows data to a single container file, if not only png
save the individual viewers to their specific savable file types (exclude the container files type
if only png files should be saved, check if view can be saved as png remove all other options from the file list
Definition at line 243 of file jocassviewer.cpp.
References _viewers, QDateTime::currentDateTime(), QDir::currentPath(), displayedItems(), QStringList::filter(), jocassview::FileHandler::isContainerFile(), saveFile(), and cass::toString().
Referenced by autoSaveImages(), and JoCASSViewer().
|
privateslot |
save the data displayed by all windows as png images
call autoSave with parameter onlyPNG as true
Definition at line 238 of file jocassviewer.cpp.
References autoSave().
Referenced by JoCASSViewer().
|
privateslot |
broadcast the darkcal command
Definition at line 645 of file jocassviewer.cpp.
References jocassview::DataSourceManager::source().
Referenced by JoCASSViewer().
|
privateslot |
broadcast the gaincal command
Definition at line 652 of file jocassviewer.cpp.
References jocassview::DataSourceManager::source().
Referenced by JoCASSViewer().
|
privateslot |
change the autoupdate based upon what the user set
change the interval. If the autoupdate button is checked, start the timer. Otherwise just stop the timer.
Definition at line 367 of file jocassviewer.cpp.
References _autoUpdate, _updateTimer, interval(), rate(), QSettings::setValue(), QTimer::start(), and QTimer::stop().
Referenced by JoCASSViewer(), startViewer(), and updateViewers().
|
privateslot |
retrieve the server address
assemble the server string and port to a server address, save them in the ini file and return and emit serverChanged signal
Definition at line 632 of file jocassviewer.cpp.
References _servername, _serverport, QString::number(), QSettings::setValue(), and jocassview::DataSourceManager::source().
Referenced by JoCASSViewer().
|
privateslot |
react on when an item in the list has been checked
item | the item that has changed and by which the viewers will change |
if the container already has a viewer with the requested name, exit here
create an entry in the viewers container with a 0 pointer and initialize the viewer based upon the type of data using update_viewers();
if the key is on the list of viewers and the viewer has been created close it (which will delete the window, because all dataviewer windows have the delete on close flag set)
Definition at line 518 of file jocassviewer.cpp.
References _viewers, QListWidgetItem::isSelected(), QListWidgetItem::text(), and updateViewers().
Referenced by JoCASSViewer(), and setDisplayedItem().
|
privateslot |
send clear histograms
ask the user which processors histograms should be cleared and tell the server to clear the requested histogram
Definition at line 679 of file jocassviewer.cpp.
References displayableItems(), QInputDialog::getItem(), QMainWindow::key(), jocassview::DataSourceManager::source(), and QObject::tr().
Referenced by JoCASSViewer().
|
private |
convenience function to create a viewer thats appropriate for a given type of data
view | iterator to the item in the viewer list where the viewer needs to be created. |
hist | pointer to the histogram that hold the data |
Definition at line 695 of file jocassviewer.cpp.
References cass::Result< T >::dim(), QMap::key(), removeViewer(), and QMap::value().
Referenced by updateViewers().
|
privateslot |
retrieve a list with all items
Definition at line 583 of file jocassviewer.cpp.
References QMainWindow::centralWidget(), and QListWidget::item().
Referenced by clearHistogram(), openFile(), and sendCustomCommand().
|
privateslot |
retrieve a list with the selected items
Definition at line 592 of file jocassviewer.cpp.
References QMainWindow::centralWidget(), and QListWidget::selectedItems().
Referenced by autoSave(), print(), refreshDisplayableItemsList(), saveFile(), and updateViewers().
|
privateslot |
retrieve the rate as interval in ms
convert the rate in hz to an interval in ms (1000/rate()) and return it.
Definition at line 357 of file jocassviewer.cpp.
References rate().
Referenced by changeAutoUpdate().
|
protected |
receive move events to store the current position to the settings
event | the move event |
Definition at line 717 of file jocassviewer.cpp.
References QSettings::setValue().
|
privateslot |
react on when the source has been changed
hide the server toolbar when the source is not the server, show it otherwise Then refresh the list by calling refreshDisplayableItemsList()
newSource | the name of source that has been activated |
Definition at line 622 of file jocassviewer.cpp.
References _serverToolBar, and refreshDisplayableItemsList().
Referenced by JoCASSViewer().
load data from a file
filename | the file to load the data from |
key | the key of the datafield in case its an h5 file |
if no filename is given ask for a file
if the file doesn't exist exit here
add a source with the requested file and set the window title to the filename
in case the key is on the list of displayable items, display it
Definition at line 211 of file jocassviewer.cpp.
References jocassview::DataSourceManager::addSource(), QDir::currentPath(), displayableItems(), QFileInfo::exists(), QFileDialog::getOpenFileName(), QString::isEmpty(), and setDisplayedItem().
Referenced by JoCASSViewer(), and main().
|
privateslot |
react when print has been triggered
ask the user which window should be printed, and then call print for the requested window.
Definition at line 602 of file jocassviewer.cpp.
References _viewers, displayedItems(), QApplication::focusWidget(), QInputDialog::getItem(), QStringList::indexOf(), and QObject::tr().
Referenced by JoCASSViewer().
|
privateslot |
retrieve the user set rate in Hz
Definition at line 362 of file jocassviewer.cpp.
References _rate.
Referenced by changeAutoUpdate(), and interval().
|
slot |
refresh the items on the displayable list
retrieve the list of possible displayable items from the current source and set them in the list.
Definition at line 556 of file jocassviewer.cpp.
References QListWidget::addItems(), QMainWindow::centralWidget(), QListWidget::clear(), displayedItems(), jocassview::DataSource::resultNames(), setDisplayedItem(), QListWidget::sortItems(), and jocassview::DataSourceManager::source().
Referenced by JoCASSViewer(), main(), and on_source_changed().
|
privateslot |
remove the viewer from the container when it has been destroyed
obj | The viewer object that has been destroyed |
retrieve the window title from the dataviewer that is beeing destroyed (because its the key in the list of viewers) and remove the key from the list. Then set the entry in the list as not highlighted.
Definition at line 545 of file jocassviewer.cpp.
References _viewers, QMainWindow::key(), and setDisplayedItem().
Referenced by createViewerForType().
|
protected |
receive resize events to store the current size to the settings
event | the resize event |
Definition at line 729 of file jocassviewer.cpp.
References QSettings::setValue(), and QResizeEvent::size().
|
privateslot |
save a data from specific viewer or all viewers to the given filename
filename | The name of the file |
keys | The list of keys of the window whos contens should be written |
if not filename was given ask for one
if no keys are given, request at least one using the iteminput dialog The preselected item in the dialog should be the currently highlighted window or, in case of a container file, "all"
if the file is a container file, create the container first before adding data to it.
go through the list and tell the viewer to save the data Append the name of the viewer to the filaname in case this is not a container file and more that one file should be saved with data so that the files are not overwritten.
Definition at line 283 of file jocassviewer.cpp.
References _viewers, QString::contains(), jocassview::FileHandler::createContainer(), QDir::currentPath(), displayedItems(), QApplication::focusWidget(), QInputDialog::getItem(), QFileDialog::getSaveFileName(), QStringList::indexOf(), QString::insert(), jocassview::FileHandler::isContainerFile(), QString::isEmpty(), QString::lastIndexOf(), and QObject::tr().
Referenced by autoSave(), and JoCASSViewer().
|
privateslot |
send a custom command
ask to whom the command should be sent to and for the command to send and tell the server to send the command.
Definition at line 659 of file jocassviewer.cpp.
References displayableItems(), QInputDialog::getItem(), QInputDialog::getText(), QMainWindow::key(), jocassview::DataSourceManager::source(), and QObject::tr().
Referenced by JoCASSViewer().
|
slot |
check an item in the list
find the listwidget item by the itemname. In case there is no or more than one item with the requested name return without doing anything. Otherwise change the checked state of the item to the requested state and call the slot on_listitem_clicked() to ensure that it is the same behavious as if the user clicked the item in the gui.
itemName | the name of the item |
state | the state of the item |
simulateClickedSignal | if set to true emit the clicked signal |
Definition at line 571 of file jocassviewer.cpp.
References QMainWindow::centralWidget(), changeViewers(), QListWidget::findItems(), and QListWidgetItem::setSelected().
Referenced by main(), openFile(), refreshDisplayableItemsList(), removeViewer(), and updateViewers().
|
slot |
start the viewer
uses on_autoupdate_changed() to initalize the autoupdate parameters.
Definition at line 346 of file jocassviewer.cpp.
References changeAutoUpdate().
Referenced by main().
|
privateslot |
update the contents within the viewers in the map
if another process is still updating return here
get an iterator to go through the map and retrieve the first item where we get the id from. Then check whether all the other histograms should have the same id (if not then set the id to 0). Remember how big the container is for validating whether nothing has changed while the data was retrieved from the source.
check if current source is available, if remove the viewer from the list and quit updating
if the viewer hasn't been initalized, initialize it with new result from the current active source.
validate container consistency
validate result. If the viewer can't be initialzed, remove it from the list
Set the result to the data of the viewer and let the data now what source type it has been filled with
validate data
otherwise retrieve all the data containers from a viewer and update them with the latest data
validate source
validate result to update
validate container consistency
tell the viewer the data has changed
set the report to sucess or failure
remember which viewers are active
restart the updatetimer when requested and reset the in progress flag
Definition at line 380 of file jocassviewer.cpp.
References _statusLED, _updateInProgress, _viewers, jocassview::StatusLED::busy, changeAutoUpdate(), createViewerForType(), jocassview::DataSourceManager::currentSourceName(), QMainWindow::data(), displayedItems(), jocassview::StatusLED::fail, QString::fromStdString(), QMainWindow::key(), jocassview::StatusLED::ok, jocassview::DataSource::result(), setDisplayedItem(), jocassview::StatusLED::setStatus(), QSettings::setValue(), and jocassview::DataSourceManager::source().
Referenced by changeViewers(), and JoCASSViewer().
|
private |
the auto update input
Definition at line 258 of file jocassviewer.h.
Referenced by changeAutoUpdate(), and JoCASSViewer().
|
private |
the rate input
Definition at line 255 of file jocassviewer.h.
Referenced by JoCASSViewer(), and rate().
|
private |
the servername input widget
Definition at line 249 of file jocassviewer.h.
Referenced by changeServerAddress(), and JoCASSViewer().
|
private |
the server port input widget
Definition at line 252 of file jocassviewer.h.
Referenced by changeServerAddress(), and JoCASSViewer().
|
private |
the toolbar with the server options
Definition at line 261 of file jocassviewer.h.
Referenced by JoCASSViewer(), and on_source_changed().
|
private |
the status LED
Definition at line 246 of file jocassviewer.h.
Referenced by JoCASSViewer(), and updateViewers().
|
private |
flag to tell whether an update is in progess
Definition at line 270 of file jocassviewer.h.
Referenced by updateViewers().
|
private |
timer for the auto update function it is used as singleshot timer
Definition at line 267 of file jocassviewer.h.
Referenced by changeAutoUpdate(), and JoCASSViewer().
|
private |
the container for all opened viewers
Definition at line 264 of file jocassviewer.h.
Referenced by autoSave(), changeViewers(), print(), removeViewer(), saveFile(), and updateViewers().