/***************************************************************************
 *   Copyright (C) 2004 by Armando Navarro-Vazquez                         *
 *   qoajnv@usc.es                                                         *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef QFREQWIDGET_H
#define QFREQWIDGET_H

#include <vector>

#include <QWidget>

#include "ui_qfreqwidgetbase.h"
#include "frequency.h"
#include "irspectrum.h"
#include "kryomolcore_export.h"
class IRSpectrum;
class fidarray;

/**
@author Armando Navarro-Vazquez
*/
class KRYOMOLCORE_EXPORT QFreqWidget : public QWidget,  public IRSpectrum, private Ui::QFreqWidgetBase
{
  Q_OBJECT
public:
    QFreqWidget(const QString& file, QWidget* parent=0);

    ~QFreqWidget();
    
    void InitTable();
    void SetFrequencies(std::vector<frequency>& v);
private:
    QFreqWidget(QWidget* parent=0,const char* name=0);
public slots:
    void OnShowSpectrum();
    void OnSetLimits(float,float);
    void OnDisableControls(bool);
signals:
    void showspectrum(bool);
    void data(fidarray*,float,float);
    void mode(int,int);
    void movie(bool);
    void distort(int);
    void reset();
    void Type(IRSpectrum::SpectrumType);
protected:
  QSize sizeHint() const { return QSize(350,400); }
private slots:
  void OnWriteJCampDX();
  void OnChangeLimits();
  void OnResetLimits();
  void OnScaling();
  void OnAnimate(int);
  void OnRecordMovie(bool b) { emit movie(b); }
  void OnSetLineWidth(double );
  void OnDistort(int);
  void OnResetDistortions();
  void OnSpectrumTypeChanged(int);
  void OnTableSelection(int );
private:
    bool m_bshowspectrum;
    std::vector<frequency> m_list;
    std::vector<int> m_distortframes;
    int m_activemode;

};

#endif
