Skip to content

Commit

Permalink
release 0.8.4 remove all network-related code (welcome webpage and an…
Browse files Browse the repository at this point in the history
…alytics), UI refactoring, put quicktools in left toolbar
  • Loading branch information
JamesMcCrae committed Dec 9, 2024
1 parent 91788a7 commit d02a3d9
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 266 deletions.
2 changes: 1 addition & 1 deletion FlatFab.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
#-------------------------------------------------

QT += core gui opengl widgets network webenginewidgets
QT += core gui opengl widgets

TARGET = FlatFab
TEMPLATE = app
Expand Down
45 changes: 7 additions & 38 deletions include/mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QUrl>
#include <QWebEngineView>
#include <QtGui>

#include "glwidget.h"
Expand All @@ -18,13 +13,14 @@ class MainWindow : public QMainWindow
MainWindow();
~MainWindow();

void ShowWelcomeMessageBox();

protected:
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);

private slots:

void ShowAppWidgets();
void UpdateWindowTitle();

void NewPlaneSketch();
Expand Down Expand Up @@ -76,11 +72,7 @@ private slots:
void ToggleStabilityTest();
void ToggleShowTNBFrames();
void ToggleShowShadow();
void ToggleShowTemplates();

void SetMultisampling0();
void SetMultisampling4();
void SetMultisampling16();
void ToggleShowTemplates();

void GenerateBranchingSetRoot();
void GenerateBranching();
Expand All @@ -102,11 +94,7 @@ private slots:
void TogglePhysicsSection();
void TogglePhysicsSectionMoment();
void PhysicsAddExternalMass();
void PhysicsRemoveExternalMasses();

void closeDialog();

// New UI features
void PhysicsRemoveExternalMasses();

void openEditWidget();
void openGenerateWidget();
Expand All @@ -122,13 +110,8 @@ private slots:
void createActions();
void createMenus();

void ShowWelcomePage();
void SendTrackRequest();

void SetMultisampling(const int i);

virtual void resizeEvent(QResizeEvent *event);
virtual void moveEvent(QMoveEvent *event);
void createSideBar();
void createQuickTools();

QMenu *fileMenu;
QAction *newPlaneSketchAct;
Expand Down Expand Up @@ -211,26 +194,12 @@ private slots:
QAction *removeExternalWeightsAct;

GLWidget glWidget;
QDockWidget *dockWidget;

QWidget *bottomWidget;
QDockWidget *bottomDockWidget;

QWebEngineView *webView;

// New UI features

void createSideBar();
QToolBar *mainToolBar;
QAction *openDock[5];
QDockWidget *docks[5];

void createQuickToolBar();
QToolBar *quickToolBar;
QDockWidget *toolWidget;
QDockWidget *docks[5];

QString window_title;
QTimer window_title_timer;
};

#endif // MAINWINDOW_H
22 changes: 9 additions & 13 deletions src/glutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,31 +1031,27 @@ void GLutils::DrawSemiRingLineStrip(const QVector3D &p1, const QVector3D &p2,
glPopMatrix();
}

// An efficient algorith for drawing an arc avoiding trig functions
// This is from the website: http://slabode.exofire.net/circle_draw.shtml
// An efficient algorithm for drawing an arc avoiding trig functions
// http://slabode.exofire.net/circle_draw.shtml
// The author has released it to the public

void GLutils::DrawArc(float cx, float cy, float cz, float innerR, float outerR,
float start_angle, float arc_angle, int num_segments)
{
float theta =
arc_angle /
float(num_segments -
1); // theta is now calculated from the arc angle instead, the -
// 1 bit comes from the fact that the arc is open

// theta is now calculated from the arc angle instead, the
// -1 bit comes from the fact that the arc is open
float theta = arc_angle / float(num_segments - 1);
float tangetial_factor = tanf(theta);

float radial_factor = cosf(theta);

float x = cosf(start_angle); // we now start at the start angle
// we now start at the start angle
float x = cosf(start_angle);
float y = sinf(start_angle);

glBegin(GL_TRIANGLE_STRIP); // since the arc is not a closed curve, this is
// a strip now
// since the arc is not a closed curve, this is a strip now
glBegin(GL_TRIANGLE_STRIP);
for (int ii = 0; ii < num_segments; ii++) {
glVertex3f(innerR * x + cx, innerR * y + cy, cz);

glVertex3f(outerR * x + cx, outerR * y + cy, cz);

float tx = -y;
Expand Down
22 changes: 2 additions & 20 deletions src/glwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,31 @@ GLWidget::GLWidget()
setAutoFillBackground(false);
setFocusPolicy(Qt::ClickFocus);

open_filename = "untitled";
grid_size = 10;

max_undo_sections = 1000;
undo_index = -1;

x_symmetry = false;
y_symmetry = false;
z_symmetry = false;

do_local_symmetry = true;
clip_to_ground_plane = true;
do_cycles_test = false;
do_connected_test = false;
do_stability_test = false;
do_physics_test = false;

pen_mode = false;

do_show_tnb_frames = false;
do_show_shadow = true;
do_show_templates = true;

do_magnetic_cuts = false;
magnet_strength = 1.0f;

deadzone_radius = 0.4f;

template_image_tex = 0;
template_pos = QVector2D(0, 0);
template_rotation = 0.0f;
template_scale = 5.0f;
template_flipx = false;

generate_grid_sizex = 2.0f;
generate_grid_sizey = 2.0f;
generate_grid_staplesize = 0.25f;
Expand All @@ -63,12 +55,9 @@ GLWidget::GLWidget()
generate_radial_params[i] = 1.0f;
}
generate_surfacefacets_teeth = false;

metres_per_unit = 0.0254; // 0.01 means that each unit is 1cm, 0.0254 that
// means each unit is 1 inch

quality_samples = 15;

slab_thickness = 0.125f; // this is for 1/8" acrylic
calibration_factor = 1.0f;
physics_new_weight_mass = 1.0f; // in kg
Expand All @@ -79,26 +68,19 @@ GLWidget::GLWidget()
physics.SetMaximumStress(physics_max_stress);

template_cut_snap_distance_3d = 0.5f;

section_error_tolerance = 0.015f;
section_error_tolerance_template = 0.005f;

animate_until = QDateTime::currentDateTime();

cam_animate_duration = 800.0f;
cam_animate_angle = 80.0f;
cam_lookat_distance = 100.0f;

state = STATE_NONE;
last_op = OP_NONE;

update_sections_disp_list = false;
sections_disp_list = 0;

ClearAll();

default_lookat = QVector3D(0, grid_size / 3, 0);

ClearAll();
ResetCamera();

animate_timer.setSingleShot(false);
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "mainwindow.h"
#include <QApplication>
#include <QWebEngineSettings>

int main(int argc, char *argv[])
{
Expand Down Expand Up @@ -62,6 +61,7 @@ int main(int argc, char *argv[])

MainWindow w;
w.show();
w.ShowWelcomeMessageBox();

return a.exec();
}
Loading

0 comments on commit d02a3d9

Please sign in to comment.