2017-08-28 08:17:35 +02:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
2017-08-28 10:07:22 +02:00
|
|
|
#include <QPainter>
|
2017-09-09 21:43:16 +02:00
|
|
|
#include <QColorDialog>
|
2017-08-28 08:17:35 +02:00
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
QMainWindow(parent),
|
|
|
|
ui(new Ui::MainWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-09-09 21:43:16 +02:00
|
|
|
UpdateUi();
|
2017-08-28 08:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
2017-08-28 10:07:22 +02:00
|
|
|
|
2017-09-09 21:43:16 +02:00
|
|
|
void MainWindow::UpdateUi()
|
|
|
|
{
|
|
|
|
this->ui->scaleInput->setValue(this->ui->renderArea->scale());
|
|
|
|
this->ui->intervalInput->setValue(this->ui->renderArea->intervalLenght());
|
|
|
|
this->ui->stepInput->setValue(this->ui->renderArea->stepCount());
|
|
|
|
}
|
|
|
|
|
2017-08-28 10:07:22 +02:00
|
|
|
void MainWindow::paintEvent(QPaintEvent* event)
|
|
|
|
{
|
|
|
|
QPainter painter{this};
|
|
|
|
painter.setBrush(QColor{26,25,25});
|
|
|
|
}
|
2017-08-28 11:07:50 +02:00
|
|
|
|
|
|
|
void MainWindow::on_btnAstroid_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Astroid);
|
|
|
|
this->ui->renderArea->repaint();
|
2017-09-09 21:43:16 +02:00
|
|
|
UpdateUi();
|
2017-08-28 11:07:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnCicloid_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Cycloid);
|
|
|
|
this->ui->renderArea->repaint();
|
2017-09-09 21:43:16 +02:00
|
|
|
UpdateUi();
|
2017-08-28 11:07:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnHuygens_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::HuygensCycloid);
|
|
|
|
this->ui->renderArea->repaint();
|
2017-09-09 21:43:16 +02:00
|
|
|
UpdateUi();
|
2017-08-28 11:07:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnHypo_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::HypoCycloid);
|
|
|
|
this->ui->renderArea->repaint();
|
2017-09-09 21:43:16 +02:00
|
|
|
UpdateUi();
|
2017-08-28 11:07:50 +02:00
|
|
|
}
|
2017-08-28 13:08:42 +02:00
|
|
|
|
|
|
|
void MainWindow::on_btnLine_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Line);
|
|
|
|
this->ui->renderArea->repaint();
|
2017-09-09 21:43:16 +02:00
|
|
|
UpdateUi();
|
2017-08-28 13:08:42 +02:00
|
|
|
}
|
2017-08-29 17:25:16 +02:00
|
|
|
|
2017-09-09 22:28:27 +02:00
|
|
|
void MainWindow::on_btnCircle_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Circle);
|
|
|
|
this->ui->renderArea->repaint();
|
|
|
|
UpdateUi();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnEllipse_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Ellipse);
|
|
|
|
this->ui->renderArea->repaint();
|
|
|
|
UpdateUi();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnFancy_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Fancy);
|
|
|
|
this->ui->renderArea->repaint();
|
|
|
|
UpdateUi();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnStarfish_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Starfish);
|
|
|
|
this->ui->renderArea->repaint();
|
|
|
|
UpdateUi();
|
|
|
|
}
|
|
|
|
|
2017-09-09 23:24:04 +02:00
|
|
|
void MainWindow::on_btnCloud_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Cloud1);
|
|
|
|
this->ui->renderArea->repaint();
|
|
|
|
UpdateUi();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnInverseCloud_clicked()
|
|
|
|
{
|
|
|
|
this->ui->renderArea->setShape(RenderArea::Cloud2);
|
|
|
|
this->ui->renderArea->repaint();
|
|
|
|
UpdateUi();
|
|
|
|
}
|
|
|
|
|
2017-09-09 21:43:16 +02:00
|
|
|
void MainWindow::on_intervalInput_valueChanged(double interval)
|
2017-08-29 17:25:16 +02:00
|
|
|
{
|
2017-09-09 21:43:16 +02:00
|
|
|
this->ui->renderArea->setInternalLenght(interval);
|
2017-08-29 17:25:16 +02:00
|
|
|
}
|
|
|
|
|
2017-09-09 21:43:16 +02:00
|
|
|
void MainWindow::on_scaleInput_valueChanged(double scale)
|
2017-08-29 17:25:16 +02:00
|
|
|
{
|
2017-09-09 21:43:16 +02:00
|
|
|
this->ui->renderArea->setScale(scale);
|
2017-08-29 17:25:16 +02:00
|
|
|
}
|
|
|
|
|
2017-09-09 21:43:16 +02:00
|
|
|
void MainWindow::on_stepInput_valueChanged(int count)
|
2017-08-29 17:25:16 +02:00
|
|
|
{
|
2017-09-09 21:43:16 +02:00
|
|
|
this->ui->renderArea->setStepCount(count);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_btnBackgroundColor_clicked()
|
|
|
|
{
|
|
|
|
auto color{QColorDialog::getColor(this->ui->renderArea->backgroundColor(),this,"Select Color")};
|
|
|
|
ui->renderArea->setBackgroundColor(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_btnLineColor_clicked()
|
|
|
|
{
|
|
|
|
auto color{QColorDialog::getColor(this->ui->renderArea->shapeColor(),this,"Select Color")};
|
|
|
|
ui->renderArea->setShapeColor(color);
|
2017-08-29 17:25:16 +02:00
|
|
|
}
|