-// bigintwidget.cpp
+// bigintmandelwidget.cpp
#include <QFileDialog>
#include <QLayout>
#include <QPushButton>
#include <QtConcurrent/QtConcurrent>
-#include "bigintwidget.h"
+#include "bigintmandelwidget.h"
-static inline QMenuBar *setup_menu_bar(BigintWidget *parent) {
+static inline QMenuBar *setup_menu_bar(BigintMandelWidget *parent) {
QMenuBar *menu_bar = new QMenuBar(parent);
QMenu *menu = new QMenu("&File", parent);
QPushButton *button = new QPushButton("Settings");
menu->addAction("&Reset"),
&QAction::triggered,
parent,
- &BigintWidget::reset
+ &BigintMandelWidget::reset
);
QObject::connect(
menu->addAction("&Load"),
&QAction::triggered,
parent,
- &BigintWidget::load_data
+ &BigintMandelWidget::load_data
);
QObject::connect(
menu->addAction("&Save"),
&QAction::triggered,
parent,
- &BigintWidget::save_data
+ &BigintMandelWidget::save_data
);
menu->addSeparator();
QObject::connect(
menu->addAction("&Export"),
&QAction::triggered,
parent,
- &BigintWidget::export_img
+ &BigintMandelWidget::export_img
);
menu->addSeparator();
QObject::connect(
menu->addAction("E&xit"),
&QAction::triggered,
parent,
- &BigintWidget::close
+ &BigintMandelWidget::close
);
menu_bar->addMenu(menu);
menu = new QMenu("&Zoom factor", parent);
button,
&QPushButton::clicked,
parent,
- &BigintWidget::exec_settings_widget
+ &BigintMandelWidget::exec_settings_widget
);
menu_bar->setCornerWidget(button);
return menu_bar;
);
}
-BigintWidget::BigintWidget(QWidget *parent)
+BigintMandelWidget::BigintMandelWidget(QWidget *parent)
: QWidget(parent),
fw(new QFutureWatcher<MandelResultCell>(this)),
settings(128, QSize(502, 334)),
settings_widget,
&QDialog::accepted,
this,
- &BigintWidget::settings_widget_accepted
+ &BigintMandelWidget::settings_widget_accepted
);
connect(
fw,
&QFutureWatcher<MandelResultCell>::resultReadyAt,
this,
- &BigintWidget::finished_cell
+ &BigintMandelWidget::finished_cell
);
connect(
fw,
&QFutureWatcher<MandelResultCell>::finished,
this,
- &BigintWidget::finished
+ &BigintMandelWidget::finished
);
start_calculation(fw, settings.get_cells());
setLayout(new QVBoxLayout());
img_label->resize(settings.get_params().get_size());
}
-BigintWidget::~BigintWidget() {
+BigintMandelWidget::~BigintMandelWidget() {
fw->cancel();
fw->waitForFinished();
}
-void BigintWidget::finished_cell(int num) {
+void BigintMandelWidget::finished_cell(int num) {
int y = num / settings.get_params().get_size().width();
if (y > draw_progress)
draw_progress = y;
update_img();
}
-void BigintWidget::finished() {
+void BigintMandelWidget::finished() {
draw_progress = -1;
settings_widget->set_finished(true);
update_img();
status_bar->showMessage("Click the rendering to zoom.");
}
-void BigintWidget::paintEvent(QPaintEvent *event) {
+void BigintMandelWidget::paintEvent(QPaintEvent *event) {
static int prev_num_threads = -1;
if (!img_dirty)
return;
}
}
-void BigintWidget::mousePressEvent(QMouseEvent *event) {
+void BigintMandelWidget::mousePressEvent(QMouseEvent *event) {
QSize size(settings.get_params().get_size());
QPoint pos(event->pos());
QWidget *w;
update_img();
}
-void BigintWidget::update_img() {
+void BigintMandelWidget::update_img() {
img_dirty = true;
update();
}
return *ss.string();
}
-void BigintWidget::export_img() {
+void BigintMandelWidget::export_img() {
QString file_name = get_save_file_name(
this,
"Save image",
settings.save_img(file_name);
}
-void BigintWidget::exec_settings_widget() {
+void BigintMandelWidget::exec_settings_widget() {
settings_widget->update_fields(settings.get_params(), fw->isFinished());
settings_widget->exec();
}
-void BigintWidget::reset() {
+void BigintMandelWidget::reset() {
fw->cancel();
fw->waitForFinished();
settings.reset(128, get_ideal_size());
update_img();
}
-void BigintWidget::settings_widget_accepted() {
+void BigintMandelWidget::settings_widget_accepted() {
settings.set_max_iter(settings_widget->get_max_iter().toULongLong());
start_calculation(fw, settings.get_cells());
update_img();
}
-void BigintWidget::load_data() {
+void BigintMandelWidget::load_data() {
QFile file;
QJsonObject json;
QByteArray qba;
update_img();
}
-void BigintWidget::save_data() {
+void BigintMandelWidget::save_data() {
QFile file;
QByteArray qba;
QString file_name = get_save_file_name(