Rev 364 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#include "PasteController.h"
PasteController::PasteController(QWidget *parent) : QWidget(parent)
{
QString helpString = "";
helpString.append("XY Control: Arrow Keys or H/J/K/L\n");
helpString.append("Z Control: PgUp/PgDown\n");
helpString.append("Extruder Control: Space");
labelHelp = new QLabel(helpString);
QVBoxLayout *helpLayout = new QVBoxLayout();
helpLayout->addWidget(labelHelp);
QGroupBox *helpBox = new QGroupBox("Hotkeys:");
helpBox->setLayout(helpLayout);
btnEnableHotkeys = new QPushButton("Enable Hotkeys");
btnInit = new QPushButton("Initialize Printer");
btnHome = new QPushButton("Home Printhead");
QVBoxLayout *miscBtnLayout = new QVBoxLayout();
miscBtnLayout->addWidget(btnEnableHotkeys);
miscBtnLayout->addWidget(btnInit);
miscBtnLayout->addWidget(btnHome);
QGroupBox *miscBtnBox = new QGroupBox("Preset Commands");
miscBtnBox->setLayout(miscBtnLayout);
miscBtnBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
// Icons from http://ikons.piotrkwiatkowski.co.uk/index.html
QIcon iconUp(":/External/Resources/arrow_up.png");
QIcon iconDown(":/External/Resources/arrow_down.png");
QIcon iconLeft(":/External/Resources/arrow_left.png");
QIcon iconRight(":/External/Resources/arrow_right.png");
QIcon iconAdd(":/External/Resources/upload.png");
QIcon iconRemove(":/External/Resources/download.png");
QIcon iconDelete(":/External/Resources/close.png");
btnForward = new QToolButton();
btnForward->setIcon(iconUp);
btnForward->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnForward->setAutoRaise(true);
btnBackward = new QToolButton();
btnBackward->setIcon(iconDown);
btnBackward->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnBackward->setAutoRaise(true);
btnLeft = new QToolButton();
btnLeft->setIcon(iconLeft);
btnLeft->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnLeft->setAutoRaise(true);
btnRight = new QToolButton();
btnRight->setIcon(iconRight);
btnRight->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnRight->setAutoRaise(true);
btnUp = new QToolButton();
btnUp->setIcon(iconAdd);
btnUp->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnUp->setAutoRaise(true);
btnDown = new QToolButton();
btnDown->setIcon(iconRemove);
btnDown->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnDown->setAutoRaise(true);
btnExtrude = new QToolButton();
btnExtrude->setIcon(iconDelete);
btnExtrude->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnExtrude->setAutoRaise(true);
QGridLayout *btnXYELayout = new QGridLayout();
btnXYELayout->addWidget(btnForward, 0, 1, 1, 1);
btnXYELayout->addWidget(btnLeft, 1, 0, 1, 1);
btnXYELayout->addWidget(btnExtrude, 1, 1, 1, 1);
btnXYELayout->addWidget(btnRight, 1, 2, 1, 1);
btnXYELayout->addWidget(btnBackward, 2, 1, 1, 1);
QVBoxLayout *btnZLayout = new QVBoxLayout();
btnZLayout->addWidget(btnUp);
btnZLayout->addWidget(btnDown);
QHBoxLayout *btnNavLayout = new QHBoxLayout();
btnNavLayout->addLayout(btnXYELayout);
btnNavLayout->addLayout(btnZLayout);
QGroupBox *controlBox = new QGroupBox("Manual Printer Control");
controlBox->setLayout(btnNavLayout);
controlBox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
labelXPos = new QLabel("X :");
labelXPos->setFont(QFont("", 14, 1));
labelYPos = new QLabel("Y :");
labelYPos->setFont(QFont("", 14, 1));
labelZPos = new QLabel("Z :");
labelZPos->setFont(QFont("", 14, 1));
textXValue = new QLineEdit();
textXValue->setReadOnly(true);
textXValue->setMaximumWidth(60);
textYValue = new QLineEdit();
textYValue->setReadOnly(true);
textYValue->setMaximumWidth(60);
textZValue = new QLineEdit();
textZValue->setReadOnly(true);
textZValue->setMaximumWidth(60);
QHBoxLayout *posValueLayout = new QHBoxLayout();
posValueLayout->addWidget(labelXPos);
posValueLayout->addWidget(textXValue);
posValueLayout->addWidget(labelYPos);
posValueLayout->addWidget(textYValue);
posValueLayout->addWidget(labelZPos);
posValueLayout->addWidget(textZValue);
QGroupBox *toolheadPosBox = new QGroupBox("Toolhead Position");
toolheadPosBox->setLayout(posValueLayout);
toolheadPosBox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
labelXYSpeed = new QLabel("XY Axis Speed:");
sliderXYSpeed = new QSlider(Qt::Horizontal);
textXYSpeed = new QSpinBox();
textXYSpeed->setMinimumWidth(60);
labelXYAmount = new QLabel("XY Axis Steps:");
sliderXYAmount = new QSlider(Qt::Horizontal);
textXYAmount = new QSpinBox();
textXYAmount->setMinimumWidth(60);
labelZSpeed = new QLabel("Z Axis Speed:");
sliderZSpeed = new QSlider(Qt::Horizontal);
textZSpeed = new QSpinBox();
textZSpeed->setMinimumWidth(60);
labelZAmount = new QLabel("Z Axis Steps:");
sliderZAmount = new QSlider(Qt::Horizontal);
textZAmount = new QSpinBox();
textZAmount->setMinimumWidth(60);
labelRepeatDelay = new QLabel("Repeat Delay:");
sliderRepeatDelay = new QSlider(Qt::Horizontal);
textRepeatDelay = new QSpinBox();
textRepeatDelay->setMinimumWidth(60);
QGridLayout *xyRepeatLayout = new QGridLayout();
xyRepeatLayout->addWidget(labelXYAmount, 0, 0);
xyRepeatLayout->addWidget(sliderXYAmount, 0, 1);
xyRepeatLayout->addWidget(textXYAmount, 0, 2);
xyRepeatLayout->addWidget(labelXYSpeed, 1, 0);
xyRepeatLayout->addWidget(sliderXYSpeed, 1, 1);
xyRepeatLayout->addWidget(textXYSpeed, 1, 2);
xyRepeatLayout->addWidget(labelZAmount, 2, 0);
xyRepeatLayout->addWidget(sliderZAmount, 2, 1);
xyRepeatLayout->addWidget(textZAmount, 2, 2);
xyRepeatLayout->addWidget(labelZSpeed, 3, 0);
xyRepeatLayout->addWidget(sliderZSpeed, 3, 1);
xyRepeatLayout->addWidget(textZSpeed, 3, 2);
xyRepeatLayout->addWidget(labelRepeatDelay, 4, 0);
xyRepeatLayout->addWidget(sliderRepeatDelay, 4, 1);
xyRepeatLayout->addWidget(textRepeatDelay, 4, 2);
QGroupBox *xyRepeatBox = new QGroupBox("Movement Settings");
xyRepeatBox->setLayout(xyRepeatLayout);
labelEForwardSpeed = new QLabel("Extrude Speed:");
sliderEForwardSpeed = new QSlider(Qt::Horizontal);
textEForwardSpeed = new QSpinBox();
textEForwardSpeed->setMinimumWidth(60);
labelEBackwardSpeed = new QLabel("Retract Speed:");
sliderEBackwardSpeed = new QSlider(Qt::Horizontal);
textEBackwardSpeed = new QSpinBox();
textEBackwardSpeed->setMinimumWidth(60);
labelEForwardAmount = new QLabel("Extrude Steps:");
sliderEForwardAmount = new QSlider(Qt::Horizontal);
textEForwardAmount = new QSpinBox();
textEForwardAmount->setMinimumWidth(60);
labelEBackwardAmount = new QLabel("Retract Steps:");
sliderEBackwardAmount = new QSlider(Qt::Horizontal);
textEBackwardAmount = new QSpinBox();
textEBackwardAmount->setMinimumWidth(60);
QGridLayout *extruderLayout = new QGridLayout();
extruderLayout->addWidget(labelEForwardAmount, 0, 0);
extruderLayout->addWidget(sliderEForwardAmount, 0, 1);
extruderLayout->addWidget(textEForwardAmount, 0, 2);
extruderLayout->addWidget(labelEForwardSpeed, 1, 0);
extruderLayout->addWidget(sliderEForwardSpeed, 1, 1);
extruderLayout->addWidget(textEForwardSpeed, 1, 2);
extruderLayout->addWidget(labelEBackwardAmount, 2, 0);
extruderLayout->addWidget(sliderEBackwardAmount, 2, 1);
extruderLayout->addWidget(textEBackwardAmount, 2, 2);
extruderLayout->addWidget(labelEBackwardSpeed, 4, 0);
extruderLayout->addWidget(sliderEBackwardSpeed, 4, 1);
extruderLayout->addWidget(textEBackwardSpeed, 4, 2);
QGroupBox *extruderBox = new QGroupBox("Extruder Settings");
extruderBox->setLayout(extruderLayout);
QVBoxLayout *column1Layout = new QVBoxLayout();
column1Layout->addWidget(controlBox, 0, Qt::AlignTop);
column1Layout->addWidget(miscBtnBox, 0, Qt::AlignTop);
column1Layout->addWidget(helpBox, 1, Qt::AlignTop);
QVBoxLayout *column2Layout = new QVBoxLayout();
column2Layout->addWidget(toolheadPosBox);
column2Layout->addWidget(xyRepeatBox);
column2Layout->addWidget(extruderBox);
QHBoxLayout *mainLayout = new QHBoxLayout();
mainLayout->addLayout(column1Layout);
mainLayout->addLayout(column2Layout);
setLayout(mainLayout);
setFixedSize(sizeHint());
}
PasteController::~PasteController()
{
}