From: mar77i Date: Sat, 27 Apr 2024 07:55:55 +0000 (+0200) Subject: rename bigintwidget to bigintmandelwidget X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=6900556cc7f183c1273d92bdc9e3c51ed8c72af3;p=bigintmandel rename bigintwidget to bigintmandelwidget --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 79d1f26..18b2d1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,8 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Concurrent) set(PROJECT_SOURCES main.cpp - bigintwidget.cpp - bigintwidget.h + bigintmandelwidget.cpp + bigintmandelwidget.h mandel.cpp mandel.h settingswidget.cpp diff --git a/bigintwidget.cpp b/bigintmandelwidget.cpp similarity index 89% rename from bigintwidget.cpp rename to bigintmandelwidget.cpp index d7342a7..328fbdb 100644 --- a/bigintwidget.cpp +++ b/bigintmandelwidget.cpp @@ -1,5 +1,5 @@ -// bigintwidget.cpp +// bigintmandelwidget.cpp #include #include @@ -8,9 +8,9 @@ #include #include -#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"); @@ -20,33 +20,33 @@ static inline QMenuBar *setup_menu_bar(BigintWidget *parent) { 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); @@ -112,7 +112,7 @@ static inline QMenuBar *setup_menu_bar(BigintWidget *parent) { button, &QPushButton::clicked, parent, - &BigintWidget::exec_settings_widget + &BigintMandelWidget::exec_settings_widget ); menu_bar->setCornerWidget(button); return menu_bar; @@ -129,7 +129,7 @@ static inline void start_calculation( ); } -BigintWidget::BigintWidget(QWidget *parent) +BigintMandelWidget::BigintMandelWidget(QWidget *parent) : QWidget(parent), fw(new QFutureWatcher(this)), settings(128, QSize(502, 334)), @@ -145,19 +145,19 @@ BigintWidget::BigintWidget(QWidget *parent) settings_widget, &QDialog::accepted, this, - &BigintWidget::settings_widget_accepted + &BigintMandelWidget::settings_widget_accepted ); connect( fw, &QFutureWatcher::resultReadyAt, this, - &BigintWidget::finished_cell + &BigintMandelWidget::finished_cell ); connect( fw, &QFutureWatcher::finished, this, - &BigintWidget::finished + &BigintMandelWidget::finished ); start_calculation(fw, settings.get_cells()); setLayout(new QVBoxLayout()); @@ -168,12 +168,12 @@ BigintWidget::BigintWidget(QWidget *parent) 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; @@ -181,7 +181,7 @@ void BigintWidget::finished_cell(int num) { update_img(); } -void BigintWidget::finished() { +void BigintMandelWidget::finished() { draw_progress = -1; settings_widget->set_finished(true); update_img(); @@ -214,7 +214,7 @@ static inline void finished_status(QStatusBar *status_bar) { 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; @@ -229,7 +229,7 @@ void BigintWidget::paintEvent(QPaintEvent *event) { } } -void BigintWidget::mousePressEvent(QMouseEvent *event) { +void BigintMandelWidget::mousePressEvent(QMouseEvent *event) { QSize size(settings.get_params().get_size()); QPoint pos(event->pos()); QWidget *w; @@ -247,7 +247,7 @@ void BigintWidget::mousePressEvent(QMouseEvent *event) { update_img(); } -void BigintWidget::update_img() { +void BigintMandelWidget::update_img() { img_dirty = true; update(); } @@ -279,7 +279,7 @@ static inline QString get_save_file_name( return *ss.string(); } -void BigintWidget::export_img() { +void BigintMandelWidget::export_img() { QString file_name = get_save_file_name( this, "Save image", @@ -292,12 +292,12 @@ void BigintWidget::export_img() { 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()); @@ -305,13 +305,13 @@ void BigintWidget::reset() { 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; @@ -333,7 +333,7 @@ void BigintWidget::load_data() { update_img(); } -void BigintWidget::save_data() { +void BigintMandelWidget::save_data() { QFile file; QByteArray qba; QString file_name = get_save_file_name( diff --git a/bigintwidget.h b/bigintmandelwidget.h similarity index 81% rename from bigintwidget.h rename to bigintmandelwidget.h index f6d45d2..cc2007f 100644 --- a/bigintwidget.h +++ b/bigintmandelwidget.h @@ -1,8 +1,8 @@ -// bigintwidget.h +// bigintmandelwidget.h -#ifndef BIGINTWIDGET_H -#define BIGINTWIDGET_H +#ifndef BIGINTMANDELWIDGET_H +#define BIGINTMANDELWIDGET_H #include #include @@ -14,7 +14,7 @@ #include "mandel.h" #include "settingswidget.h" -class BigintWidget : public QWidget { +class BigintMandelWidget : public QWidget { Q_OBJECT QFutureWatcher *fw; @@ -31,8 +31,8 @@ class BigintWidget : public QWidget { } public: - BigintWidget(QWidget *parent = nullptr); - ~BigintWidget(); + BigintMandelWidget(QWidget *parent = nullptr); + ~BigintMandelWidget(); void paintEvent(QPaintEvent *event); void mousePressEvent(QMouseEvent *event); void update_img(); @@ -51,4 +51,4 @@ public Q_SLOT: void save_data(); }; -#endif // BIGINTWIDGET_H +#endif // BIGINTMANDELWIDGET_H diff --git a/main.cpp b/main.cpp index 07cdecd..af96d8d 100644 --- a/main.cpp +++ b/main.cpp @@ -3,12 +3,11 @@ #include -#include "bigintwidget.h" +#include "bigintmandelwidget.h" -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { QApplication a(argc, argv); - BigintWidget w; + BigintMandelWidget w; w.show(); return a.exec(); }