123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- #include "dialog.h"
- #include "ui_dialog.h"
- #include "grid.cpp"
-
- #include <QtGui>
- #include <QtCore>
- #include <QWidget>
- #include <QGridLayout>
-
- /// \fn Dialog::Dialog(QWidget *parent)
- /// \~English
- /// \brief The constructor sets the undo and redo to disable so it cant be pressed
- /// also sets the connections between the buttons and their respective signals.
- /// \~Spanish
- /// \brief El constructor ajusta el boton de deshacer (undo) y rehacer (redo) para que no
- /// puedan ser apretados, tambien ajusta las conecciones entre los botones y sus senales.
- Dialog::Dialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::Dialog)
- {
- ui->setupUi(this);
- ui->undoButton->setDisabled(true);
- ui->redoButton->setDisabled(true);
-
- connect(ui->mainGrid, SIGNAL(canUndo(bool)), this, SLOT(setUndo(bool)));
- connect(ui->mainGrid, SIGNAL(canRedo(bool)), this, SLOT(setRedo(bool)));
- }
-
- /// \fn void Dialog::setUndo(bool can)
- /// \~English
- /// \brief Enables the undo button
- /// \~Spanish
- /// \brief Permite utilizar el boton de deshacer (undo)
- void Dialog::setUndo(bool can){
- if (can == true) ui->undoButton->setDisabled(false);
- else ui->undoButton->setDisabled(true);
- }
-
- /// \fn void Dialog::setRedo(bool can)
- /// \~English
- /// \brief Enables the redo button
- /// \~Spanish
- /// \brief Permite utilizar el boton de (rehacer)
- void Dialog::setRedo(bool can){
- if (can == true) ui->redoButton->setDisabled(false);
- else ui->redoButton->setDisabled(true);
- }
-
- /// \fn Dialog::~Dialog()
- /// \~English
- /// \brief Destructor
- /// \~Spanish
- /// \brief Destructor
- Dialog::~Dialog()
- {
- delete ui;
- }
-
- /// \fn void Dialog::on_frontcolorComboBox_activated(const QString &color)
- /// \~English
- /// \brief Sets the color of the brush
- /// \param color color of the brush
- /// \~Spanish
- /// \brief Ajusta el color de la brocha
- /// \param color color de la brocha
- void Dialog::on_frontcolorComboBox_activated(const QString &color)
- {
- ui->mainGrid->setFront(color);
- }
-
-
- /// \fn void Dialog::on_backgroundComboBox_activated(const QString &color)
- /// \~English
- /// \brief Sets the color of the background
- /// \param color color del background
- /// \~Spanish
- /// \brief Ajusta el color del fondo
- /// \param color color del fondo
- void Dialog::on_backgroundComboBox_activated(const QString &color)
- {
- ui->mainGrid->setBack(color);
- ui->mainGrid->repaint();
- }
-
- /// \fn void Dialog::on_lapizButton_clicked()
- /// \~English
- /// \brief Sets the tool to dot
- /// \~Spanish
- /// \brief Ajusta la herramienta a usar la punta
- void Dialog::on_lapizButton_clicked()
- {
- ui->mainGrid->setTool("dot");
- }
-
- /// \fn void Dialog::on_cleargridButton_clicked()
- /// \~English
- /// \brief Clears the grid. Erase the grid
- /// \~Spanish
- /// \brief Limpia la cuadricula Borra la cuadricula.
- void Dialog::on_cleargridButton_clicked()
- {
- ui->mainGrid->clear();
- ui->mainGrid->repaint();
- }
-
- /// \fn void Dialog::on_rowmajorfillButton_clicked()
- /// \~English
- /// \brief Sets the tool to Row fill
- /// \~Spanish
- /// \brief Ajusta la herramienta a llenar fila
- void Dialog::on_rowmajorfillButton_clicked()
- {
- ui->mainGrid->setTool("row");
- }
-
- /// \fn void Dialog::on_colmajorfillButton_clicked()
- /// \~English
- /// \brief Sets the tool to Column fill
- /// \~Spanish
- /// \brief Ajusta la herramienta a llenar columna
- void Dialog::on_colmajorfillButton_clicked()
- {
- ui->mainGrid->setTool("column");
- }
-
- /// \fn void Dialog::on_diagonalleftButton_clicked()
- /// \~English
- /// \brief Sets the tool to Diagonal Left fill
- /// \~Spanish
- /// \brief Ajusta la herrramienta a llenar en diagonal a la izquierda
- void Dialog::on_diagonalleftButton_clicked()
- {
- ui->mainGrid->setTool("diagonal left");
- }
-
- /// \fn void Dialog::on_diagonalrightButton_clicked()
- /// \~English
- /// \brief Sets the tool to Diagonal Right fill
- /// \~Spanish
- /// \brief Ajusta la herrramienta a llenar en diagonal a la derecha
- void Dialog::on_diagonalrightButton_clicked()
- {
- ui->mainGrid->setTool("diagonal right");
- }
-
- /// \fn void Dialog::on_drawsquareButton_clicked()
- /// \~English
- /// \brief Sets the tool to paint Squares
- /// \~Spanish
- /// \brief Ajusta la herramiento a pintar cuadrados
- void Dialog::on_drawsquareButton_clicked()
- {
- ui->mainGrid->setTool("square");
- }
-
- /// \fn void Dialog::on_drawtriangleButton_clicked()
- /// \~English
- /// \brief Sets the tool to paint Triangles
- /// \~Spanish
- /// \brief Ajusta la herramiento a pintar triangulos
- void Dialog::on_drawtriangleButton_clicked()
- {
- ui->mainGrid->setTool("triangle");
- }
-
- /// \fn void Dialog::on_drawcircleButton_clicked()
- /// \~English
- /// \brief Sets the tool to paint Circles
- /// \~Spanish
- /// \brief Ajusta la herramiento a pintar circulos
- void Dialog::on_drawcircleButton_clicked()
- {
- ui->mainGrid->setTool("circle");
- }
-
- /// \fn void Dialog::on_speedHorizontalSlider_valueChanged(int value)
- /// \~English
- /// \brief Sets the tool point size
- /// \param value point size
- /// \~Spanish
- /// \brief Ajusta el tamano de la punta de la herramienta
- /// \param value tamano de la punta
- void Dialog::on_speedHorizontalSlider_valueChanged(int value)
- {
- ui->mainGrid->setToolSize(value);
- ui->lblSize->setText(QString::number(value));
- }
-
- /// \fn void Dialog::on_undoButton_clicked()
- /// \~English
- /// \brief Undo the previous grid modification
- /// \~Spanish
- /// \brief Deshace la modificacion previa de la cuadricula
- void Dialog::on_undoButton_clicked()
- {
- ui->mainGrid->undo();
- }
-
- /// \fn void Dialog::on_redoButton_clicked()
- /// \~English
- /// \brief Redo the previous grid modification
- /// \~Spanish
- /// \brief Rehace la modificacion previa de la cuadricula
- void Dialog::on_redoButton_clicked()
- {
- ui->mainGrid->redo();
- }
-
- void Dialog::on_floodButton_clicked()
- {
- ui->mainGrid->setTool("flood");
- }
|