#ifndef LOADREF_H #define LOADREF_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "constants.h" class LoadRefPulse : public QMainWindow { Q_OBJECT public: LoadRefPulse( int c, ProcParams* pp, QWidget* parentCP, QWidget* parent ); // Default constructor. ~LoadRefPulse(); // Default destructor. int getSize(); // Return the size of the accepted reference pulse. float** getValues(); // Return a pointer to the values in the reference pulse. double getFreq(); // Return the frequency of the selected set. double getWidth(); // Return the width of the selected set. void showCorrectSets(); // Show the sets and pulses for the frequency and pulse width in the radar parameters. public slots: void acceptSet(); // Accept the selected pulse and exit the window. void discardPulse(); // Clear the new pulse fields and disable the fields. void createPulse(); // Enable the new pulse fields. void savePulse(); // Save the new information to file and to the internal storage. void deleteCurPulse(); // Delete the currently selected reference pulse. void setDisplayedPulse( int index ); // Display the information for the selected pulse. void changeChannelPulse( int index ); // Display the information for the channel's selected pulse. void changeChannelWidthFreq(); // Display the pulses with the selected pulse width. void loadValues(); // Load values for the new reference pulse from a file. void createSet(); // Enable the elements to create a new set. void discardSet(); // Clear and disable the elements to create a new set. void saveSet(); // Save the new set. void deleteSet(); // Delete the current set. void changeSet(); // Display the information for the selected set. signals: void writeMsg( QString text, int type ); // Write a message to a log. void setChange(); // Change the reference waveforms in the set for processing. protected: void closeEvent( QCloseEvent* event ); // Event when the window closes. private: enum { ACCEPT = 0, SAVE = 1 }; void loadFile(); // Load in the saved reference pulses from the config file. void writeToFile(); // Write the given reference pulse to the config file. void copyValues(); // Copy the values from the accepted reference pulse to an array. bool checkSizeValues( int ch, int type ); // Check that there are the correct number of values for the given size. bool isFloat( std::string str ); // Check if the given string is a float. bool checkLength(); // Check that the number of values in the pulse matches the frequency. QString basePulseValues(); // Determine the default base reference waveform values and return them in a QString. QString basePulseZeros(); // Determine the base waveform with all 0's. int basePulseLength(); // Determine the default base reference waveform number of values and return it. ProcParams* pParams; // Pointer to class of parameter values. QComboBox* setSelect; // Select the set of pulses for the channels. QLabel* setSelectLabel; // Label for setSelect. QComboBox* chanSelect; // Select the channel to pick a pulse for. QLabel* chanSelectLabel; // Label for chanSelect. QComboBox* widthSelect; // Select the pulse width. QLabel* widthSelectLabel; // Label for widthSelect. QComboBox* freqSelect; // Selec the pulse frequency. QLabel* freqSelectLabel; // Label for freqSelect. QComboBox* pulseSelect; // Combo box containing the available options to choose. QLabel* pulseSelectLabel; // Label for pulseSelect. QLineEdit* newPulseName; // Name of the new reference pulse. QLabel* newPulseNameLabel; // Label for newPulseName. QLineEdit* newPulseWidth; // Width of the new reference pulse. QLabel* newPulseWidthLabel; // Label for newPulseWidth; QLineEdit* newPulseLength; // Length of the new reference pulse. QLabel* newPulseLengthLabel; // Label for newPulseLength. QLineEdit* newPulseFreq; // Display the frequency for the new reference pulse. QLabel* newPulseFreqLabel; // Label for newPulseFreq. QLineEdit* newSetName; // Display the name of the new set. QLabel* newSetNameLabel; // Label for newSetName. QLineEdit* newSetFreq; // Display the frequency of the new set. QLabel* newSetFreqLabel; // Label for newSetFreq. QLineEdit* newSetWidth; // Display the width of the new set. QLabel* newSetWidthLabel; // Label for newSetWidth. QFile* configFile; // Pointer to the config file. QPushButton* createNewPulse; // Button to create a new reference pulse. QPushButton* saveNewPulse; // Button to save the new reference pulse. QPushButton* discardNewPulse; // Button to clear the new reference pulse fields and disable the fields. QPushButton* acceptCurPulse; // Button to accept the currently accepted reference pulse. QPushButton* deletePulse; // Button to delete the currently selected reference pulse. QPushButton* loadFromFile; // Button to load in size and values from a binary file. QPushButton* createNewSet; // Button to create a new pulse set. QPushButton* discardNewSet; // Button to discard a new pulse set. QPushButton* saveNewSet; // Button to save a new set. QPushButton* deleteCurrSet; // Button to delete a set. QString newPulseValues; // Holds the values for the new pulse. QWidget* par; // Pointer to the parent window. int channels; // Number of channels. float** curValues; // Pointer to the double array of values for the accepted reference pulse for each channel. int size; // Array for size of the current reference pulse. double width; // Currently selected set width. double frequency; // Currently selected set frequency. bool finishedLoading; // Keep track of if we have finished loading. bool clearingBoxes; // Make sure that some operations do not take place when just clearing combo boxes. QMap< QString, QString > pLengths; // Reference pulse lengths. QMap< QString, QString > pValues; // Reference pulse values. QMap< QString, QString > pFreqs; // Reference pulse frequencies. QMap< QString, QString > pWidths; // Reference pulse widths. QMap< QString, QString > sFreqs; // Set frequencies. QMap< QString, QString* > sValues; // Set values. QMap< QString, QString > sWidths; // Set widths. QMap< QString, int > freqs; // Each frequency. QMap< QString, int > widths; // Each width. }; #endif // LOADREF_H