Logo Search packages:      
Sourcecode: edfbrowser version File versions  Download package

colordialog.cpp

/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2007, 2008, 2009 Teunis van Beelen
*
* teuniz@gmail.com
*
***************************************************************************
*
* 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 version 2 of the License.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
***************************************************************************
*
* This version of GPL is at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*
***************************************************************************
*/




#include "colordialog.h"



UI_ColorMenuDialog::UI_ColorMenuDialog(QWidget *viewcurvewidget, int *signalcolor, SpecialButton *coloredbutton)
{
  colormenu_dialog = new QDialog(viewcurvewidget);

  colormenu_dialog->setMinimumSize(QSize(105, 130));
  colormenu_dialog->setMaximumSize(QSize(105, 130));
  colormenu_dialog->setWindowTitle("Color");
  colormenu_dialog->setModal(TRUE);
  colormenu_dialog->setAttribute(Qt::WA_DeleteOnClose, TRUE);

  curvewidget = viewcurvewidget;

  color = signalcolor;
  parentbutton = coloredbutton;

  CloseButton = new QPushButton(colormenu_dialog);
  CloseButton->setGeometry(QRect(5, 105, 95, 20));
  CloseButton->setText("Close");

  ColorButton1 = new SpecialButton(colormenu_dialog);
  ColorButton1->setGeometry(QRect(5, 5, 20, 20));
  ColorButton1->setColor(Qt::black);

  ColorButton2 = new SpecialButton(colormenu_dialog);
  ColorButton2->setGeometry(QRect(30, 5, 20, 20));
  ColorButton2->setColor(Qt::red);

  ColorButton3 = new SpecialButton(colormenu_dialog);
  ColorButton3->setGeometry(QRect(55, 5, 20, 20));
  ColorButton3->setColor(Qt::darkRed);

  ColorButton4 = new SpecialButton(colormenu_dialog);
  ColorButton4->setGeometry(QRect(80, 5, 20, 20));
  ColorButton4->setColor(Qt::green);

  ColorButton5 = new SpecialButton(colormenu_dialog);
  ColorButton5->setGeometry(QRect(5, 30, 20, 20));
  ColorButton5->setColor(Qt::darkGreen);

  ColorButton6 = new SpecialButton(colormenu_dialog);
  ColorButton6->setGeometry(QRect(30, 30, 20, 20));
  ColorButton6->setColor(Qt::blue);

  ColorButton7 = new SpecialButton(colormenu_dialog);
  ColorButton7->setGeometry(QRect(55, 30, 20, 20));
  ColorButton7->setColor(Qt::darkBlue);

  ColorButton8 = new SpecialButton(colormenu_dialog);
  ColorButton8->setGeometry(QRect(80, 30, 20, 20));
  ColorButton8->setColor(Qt::cyan);

  ColorButton9 = new SpecialButton(colormenu_dialog);
  ColorButton9->setGeometry(QRect(5, 55, 20, 20));
  ColorButton9->setColor(Qt::darkCyan);

  ColorButton10 = new SpecialButton(colormenu_dialog);
  ColorButton10->setGeometry(QRect(30, 55, 20, 20));
  ColorButton10->setColor(Qt::magenta);

  ColorButton11 = new SpecialButton(colormenu_dialog);
  ColorButton11->setGeometry(QRect(55, 55, 20, 20));
  ColorButton11->setColor(Qt::darkMagenta);

  ColorButton12 = new SpecialButton(colormenu_dialog);
  ColorButton12->setGeometry(QRect(80, 55, 20, 20));
  ColorButton12->setColor(Qt::yellow);

  ColorButton13 = new SpecialButton(colormenu_dialog);
  ColorButton13->setGeometry(QRect(5, 80, 20, 20));
  ColorButton13->setColor(Qt::darkYellow);

  ColorButton14 = new SpecialButton(colormenu_dialog);
  ColorButton14->setGeometry(QRect(30, 80, 20, 20));
  ColorButton14->setColor(Qt::gray);

  ColorButton15 = new SpecialButton(colormenu_dialog);
  ColorButton15->setGeometry(QRect(55, 80, 20, 20));
  ColorButton15->setColor(Qt::darkGray);

  ColorButton16 = new SpecialButton(colormenu_dialog);
  ColorButton16->setGeometry(QRect(80, 80, 20, 20));
  ColorButton16->setColor(Qt::white);

  QObject::connect(CloseButton,   SIGNAL(clicked()), colormenu_dialog, SLOT(close()));
  QObject::connect(ColorButton1,  SIGNAL(clicked()), this,             SLOT(ColorButton1_pressed()));
  QObject::connect(ColorButton2,  SIGNAL(clicked()), this,             SLOT(ColorButton2_pressed()));
  QObject::connect(ColorButton3,  SIGNAL(clicked()), this,             SLOT(ColorButton3_pressed()));
  QObject::connect(ColorButton4,  SIGNAL(clicked()), this,             SLOT(ColorButton4_pressed()));
  QObject::connect(ColorButton5,  SIGNAL(clicked()), this,             SLOT(ColorButton5_pressed()));
  QObject::connect(ColorButton6,  SIGNAL(clicked()), this,             SLOT(ColorButton6_pressed()));
  QObject::connect(ColorButton7,  SIGNAL(clicked()), this,             SLOT(ColorButton7_pressed()));
  QObject::connect(ColorButton8,  SIGNAL(clicked()), this,             SLOT(ColorButton8_pressed()));
  QObject::connect(ColorButton9,  SIGNAL(clicked()), this,             SLOT(ColorButton9_pressed()));
  QObject::connect(ColorButton10, SIGNAL(clicked()), this,             SLOT(ColorButton10_pressed()));
  QObject::connect(ColorButton11, SIGNAL(clicked()), this,             SLOT(ColorButton11_pressed()));
  QObject::connect(ColorButton12, SIGNAL(clicked()), this,             SLOT(ColorButton12_pressed()));
  QObject::connect(ColorButton13, SIGNAL(clicked()), this,             SLOT(ColorButton13_pressed()));
  QObject::connect(ColorButton14, SIGNAL(clicked()), this,             SLOT(ColorButton14_pressed()));
  QObject::connect(ColorButton15, SIGNAL(clicked()), this,             SLOT(ColorButton15_pressed()));
  QObject::connect(ColorButton16, SIGNAL(clicked()), this,             SLOT(ColorButton16_pressed()));

  colormenu_dialog->exec();
}


void UI_ColorMenuDialog::ColorButton1_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::black);

  *color = Qt::black;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton2_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::red);

  *color = Qt::red;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton3_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkRed);

  *color = Qt::darkRed;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton4_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::green);

  *color = Qt::green;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton5_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkGreen);

  *color = Qt::darkGreen;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton6_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::blue);

  *color = Qt::blue;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton7_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkBlue);

  *color = Qt::darkBlue;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton8_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::cyan);

  *color = Qt::cyan;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton9_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkCyan);

  *color = Qt::darkCyan;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton10_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::magenta);

  *color = Qt::magenta;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton11_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkMagenta);

  *color = Qt::darkMagenta;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton12_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::yellow);

  *color = Qt::yellow;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton13_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkYellow);

  *color = Qt::darkYellow;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton14_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::gray);

  *color = Qt::gray;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton15_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::darkGray);

  *color = Qt::darkGray;

  curvewidget->update();
}


void UI_ColorMenuDialog::ColorButton16_pressed()
{
  if(parentbutton)  parentbutton->setColor(Qt::white);

  *color = Qt::white;

  curvewidget->update();
}









Generated by  Doxygen 1.6.0   Back to index