#include "refPulse.h" /* Function: RefPulse * Params In * bool* channels: Pointer showing which channels were checked by the user. * int plotType: Determines whether the A-Scope will show a Sum, or each channel. * QWidget* parent: Pointer to the parent object. * MatrixData* data: Pointer to the data container. * Return * N/A * Purpose * Default constructor. Creates a copy of the variable that shows which channels are checked. * Sets the name of the window, the status bar text, and creates a new APlot object, * which is the object that shows the A-Scope plots. Finally, connect the action windowClosed * with the function deleteAWindow from the parent, which is a QuickLook object. */ RefPulse::RefPulse( PlotOptions* p, QWidget* parent, MatrixData* data ):QMainWindow( parent ) { plot = p; d = data; // Set the title window and menu. setWindowTitle( "Reference Pulse Window" ); createButtons(); // Create the layout, add the plot widget and menu. QVBoxLayout* mainLayout = new QVBoxLayout; refPulsePlot = new Ref( plot, this, data ); mainLayout->addWidget( buttonBox ); mainLayout->addWidget( refPulsePlot ); // Set the layout and status bar message of the window. setCentralWidget( new QWidget() ); centralWidget()->setLayout( mainLayout ); statusText = "A-Scope Status Bar Message Test"; statusBar()->showMessage( statusText ); connect( this, SIGNAL( windowClosed( QObject* ) ), parent, SLOT( deleteRWindow( QObject* ) ) ); connect( this, SIGNAL( updateWin( PlotOptions* ) ), parent, SLOT( updateWinOptions( PlotOptions* ) ) ); } /* Function: redraw * Params In * N/A * Return * N/A * Purpose * Tell the APlot object to redraw itself. This is used to update the window * when new information has arrived, so that the data will be displayed. */ void RefPulse::redraw() { refPulsePlot->redraw(); } /* Function: closeEvent * Params In * QCloseEvent* event: pointer to the event. * Return * N/A * Purpose * Redefines the closeEvent function. Used to setup a chain of calls * so that the vector of RefPulse* instances can be cleaned up whenever * an instance is closed. Emits a signal, which is setup in the constructor * to connect to a function in the parent object. */ void RefPulse::closeEvent( QCloseEvent* event ) { emit windowClosed( this ); } /* Function: createMenus * Params In * N/A * Return * N/A * Purpose * Create the menu for the window. As of now, only contains the 'Update' * button. */ void RefPulse::createButtons() { buttonBox = new QGroupBox( tr( "Update Window Parameters" ) ); QHBoxLayout *layout = new QHBoxLayout; // Create the update button, then add connections for the event // when it is clicked. buttons[0] = new QPushButton( tr( "Update" ) ); layout->addWidget( buttons[0] ); connect( buttons[0], SIGNAL( clicked() ), this, SLOT( updateWindow() ) ); buttonBox->setLayout( layout ); } /* Function: updateWindow * Params In * N/A * Return * N/A * Purpose * Emits the updateWin signal, which tells the parent that * the newest option values need to be copied into the supplied * PlotOptions structure. Then resets the curves that should * be displayed, based on the new option values. */ void RefPulse::updateWindow() { emit updateWin( plot ); resetCurves(); //PlotOptions* segFault; //std::cout << segFault->dataScale << std::endl; } /* Function: resetCurves * Params In * N/A * Return * N/A * Purpose * Calls reset() in the Ref child, which sets only the selected curves to be displayed. */ void RefPulse::resetCurves() { refPulsePlot->reset(); }