/***************************************************************************
 *   Copyright (C) 2004 by Armando Navarro Vázquez                         *
 *   armando@rmntec                                                        *
 *                                                                         *
 *   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.             *
 ***************************************************************************/

#include <kiconloader.h>

#include <qlayout.h>
#include <q3frame.h>
#include <qpushbutton.h>

#include "qirwidget.h"
#include "qjcdrawing.h"
//Added by qt3to4:
#include <Q3VBoxLayout>
#include <QPixmap>

QIRWidget::QIRWidget(QWidget* parent ) : QWidget(parent)
{

  setupUi(this);
  Q3VBoxLayout* vlay= new Q3VBoxLayout(_spectrumFrame);

  m_spectrum= new QJCDrawing(_spectrumFrame);
  vlay->addWidget(m_spectrum);

  InitButtons();

}

void QIRWidget::InitButtons()
{
   KIconLoader *loader = KIconLoader::global();
  _printButton->setIconSet(loader->loadIcon("printer",KIconLoader::Toolbar));
  _plusButton->setIconSet(loader->loadIcon("kryomol_plus",KIconLoader::Toolbar));
  _minusButton->setIconSet(loader->loadIcon("kryomol_minus",KIconLoader::Toolbar));
  _snapshotButton->setIconSet(loader->loadIcon("camera-photo",KIconLoader::Toolbar));
  _zoomButton->setIconSet(loader->loadIcon("page-zoom",KIconLoader::Toolbar));
  _fullButton->setIconSet(loader->loadIcon("zoom-original",KIconLoader::Toolbar));

  connect(_printButton,SIGNAL(clicked()),m_spectrum,SLOT(OnPrint()));
  connect(_plusButton,SIGNAL(clicked()),m_spectrum,SLOT(OnIncrease()));
  connect(_minusButton,SIGNAL(clicked()),m_spectrum,SLOT(OnDecrease()));
  connect(_snapshotButton,SIGNAL(clicked()),m_spectrum,SLOT(OnSnapshot()));
  connect(_zoomButton,SIGNAL(toggled(bool)),m_spectrum,SLOT(OnZoom(bool)));
  connect(_fullButton,SIGNAL(clicked()),m_spectrum,SLOT(ResetZoom()));
}

QIRWidget::~QIRWidget()
{}


