File indexing completed on 2024-05-12 04:41:11

0001 /* AtCore KDE Libary for 3D Printers
0002     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003     SPDX-FileCopyrightText: 2018, 2020 Chris Rizzitello <rizzitello@kde.org>
0004     SPDX-FileCopyrightText: 2020 Tomaz Canabrava <tcanabrava@kde.org>
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QWidget>
0010 
0011 #include "atcorewidgets_export.h"
0012 
0013 class QComboBox;
0014 class QDoubleSpinBox;
0015 
0016 /**
0017  * @brief The MovementWidget class
0018  * This widget will provide Basic Movement Controls.
0019  */
0020 class ATCOREWIDGETS_EXPORT MovementWidget : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     /**
0025      * @brief Create a Movement Widget
0026      * @param parent: Parent of this widget.
0027      */
0028     explicit MovementWidget(QWidget *parent = nullptr);
0029     ~MovementWidget();
0030 
0031     /**
0032      * @brief Sets the visibility of Row of home buttons
0033      * @param visible: set False to hide the Home buttons [default = true]
0034      */
0035     void setHomeButtonsVisible(bool visible);
0036 
0037     /**
0038      * @brief Sets the visibility of button used to disable the motors
0039      * @param visible: set False to hide the Home button [default = true]
0040      */
0041     void setDisableMotorsButtonVisible(bool visible);
0042 
0043     /**
0044      * @brief Sets the absolute movement value for x,y,z axis.
0045      * @param xMax: Max distance the X Axis can travel in mm [default = 200]
0046      * @param yMax: Max distance the Y Axis can travel in mm [default = 200]
0047      * @param zMax: Max distance the Z Axis can travel in mm [default = 200]
0048      */
0049     void setAxisMax(int xMax, int yMax, int zMax);
0050     
0051     //TODO: This widget should have a AtCore *core; member and connect
0052     // things internally.
0053 signals:
0054     /**
0055      * @brief The Home All button was clicked.
0056      * This should be connected to AtCore::home()
0057      */
0058     void homeAllPressed();
0059 
0060     /**
0061      * @brief The Home X button was clicked.
0062      * This should be connected to AtCore::home(AtCore::X)
0063      */
0064     void homeXPressed();
0065 
0066     /**
0067      * @brief The Home Y button was clicked.
0068      * This should be connected to AtCore::home(AtCore::Y)
0069      */
0070     void homeYPressed();
0071 
0072     /**
0073      * @brief The Home Z button was clicked.
0074      * This should be connected to AtCore::home(AtCore::Z)
0075      */
0076     void homeZPressed();
0077 
0078     /**
0079      * @brief The Disable Motors button was clicked.
0080      * This should be connected to AtCore::disableMotors(0)
0081      */
0082     void disableMotorsPressed();
0083 
0084     /**
0085      * @brief An absoluteMove was requested
0086      * This should be connected to AtCore::move(axis,value)
0087      * @param axis: the axis to move
0088      * @param value: where to move
0089      */
0090     void absoluteMove(const QLatin1Char &axis, const double value);
0091 
0092     /**
0093      * @brief A relativeMove was requested from the AxisControl
0094      * This should connect to a function that does the following
0095      *  AtCore::setRelativePosition()
0096      *  AtCore::move(axis, value)
0097      *  AtCore::setAbsolutePosition()
0098      * @param axis: the axis to move.
0099      * @param value: the value to move it by.
0100      */
0101     void relativeMove(const QLatin1Char &axis, const double value);
0102 
0103     /**
0104      * @brief A Change of units was requested from the AxisControl
0105      * This should connect to a function that calls AtCore::setUnits
0106      * @param units: 0=Metric 1=Imperial
0107      */
0108     void unitsChanged(int units);
0109 
0110 private:
0111     // common code for constructors.
0112     void initialize();
0113 
0114     class MovementWidgetPrivate;
0115     MovementWidgetPrivate *d;
0116 };