Subversion Repositories Code-Repo

Compare Revisions

No changes between revisions

Ignore whitespace Rev 362 → Rev 363

/Misc Projects/PcMarlinInterface/MainWindow.cpp
8,11 → 8,13
setCentralWidget(centralWidget);
 
// Misc button group
groupMacro = new QGroupBox("Other");
groupOther = new QGroupBox("Other");
btnMacro = new QPushButton("&Macros");
QHBoxLayout *macroLayout = new QHBoxLayout();
macroLayout->addWidget(btnMacro);
groupMacro->setLayout(macroLayout);
btnPaste = new QPushButton("&Paste");
QGridLayout *otherLayout = new QGridLayout();
otherLayout->addWidget(btnMacro, 0, 0);
otherLayout->addWidget(btnPaste, 1, 0);
groupOther->setLayout(otherLayout);
 
// Initialize serial widget
serialWidget = new SerialWidget();
46,13 → 48,20
connect(serialWidget, SIGNAL(Connected()), macroWidget, SLOT(EnableTransmit()));
connect(serialWidget, SIGNAL(Disconnected()), macroWidget, SLOT(DisableTransmit()));
 
// Initialize paste controller widget
pasteDockWidget = new QDockWidget("Paste Controller", this);
pasteWidget = new PasteController(pasteDockWidget);
pasteDockWidget->setWidget(pasteWidget);
pasteDockWidget->setFloating(true);
 
// Connect local widgets
connect(btnMacro, SIGNAL(clicked()), macroDockWidget->toggleViewAction(), SLOT(trigger()));
connect(btnPaste, SIGNAL(clicked()), pasteDockWidget->toggleViewAction(), SLOT(trigger()));
 
// Main layout
QGridLayout *mainLayout = new QGridLayout();
mainLayout->addWidget(groupSerialInit, 0, 0, 1, 1, Qt::AlignLeft);
mainLayout->addWidget(groupMacro, 0, 1, 1, 1, Qt::AlignLeft);
mainLayout->addWidget(groupOther, 0, 1, 1, 1, Qt::AlignLeft);
mainLayout->addWidget(groupSerialData, 1, 0, 1, 2);
mainLayout->setColumnStretch(0, 0);
mainLayout->setColumnStretch(1, 1);
/Misc Projects/PcMarlinInterface/MainWindow.h
5,6 → 5,7
#include "SerialWidget.h"
#include "MacroWidget.h"
#include "IOWidget.h"
#include "PasteController.h"
 
class MainWindow : public QMainWindow
{
34,12 → 35,18
IOWidget *ioWidget;
QGroupBox *groupSerialData;
 
QGroupBox *groupOther;
 
// Macro controller + UI
MacroWidget *macroWidget;
QDockWidget *macroDockWidget;
QGroupBox *groupMacro;
QPushButton *btnMacro;
 
// Paste controller + UI
PasteController *pasteWidget;
QDockWidget *pasteDockWidget;
QPushButton *btnPaste;
 
// Status bar
QLabel *labelSerialStatus;
 
/Misc Projects/PcMarlinInterface/PasteController.cpp
0,0 → 1,212
#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()
{
 
}
 
/Misc Projects/PcMarlinInterface/PasteController.h
0,0 → 1,82
#ifndef PASTECONTROLLER_H
#define PASTECONTROLLER_H
 
#include "GlobalDefines.h"
 
#define BTN_ICON_SIZE 32
 
class PasteController : public QWidget
{
Q_OBJECT
public:
PasteController(QWidget *parent = 0);
~PasteController();
 
signals:
void EnableControls(void);
void DisableControls(void);
 
public slots:
 
private:
QLabel *labelHelp;
 
QPushButton *btnEnableHotkeys;
QPushButton *btnInit;
QPushButton *btnHome;
 
QToolButton *btnForward;
QToolButton *btnBackward;
QToolButton *btnLeft;
QToolButton *btnRight;
QToolButton *btnUp;
QToolButton *btnDown;
QToolButton *btnExtrude;
 
QLabel *labelXPos;
QLineEdit *textXValue;
QLabel *labelYPos;
QLineEdit *textYValue;
QLabel *labelZPos;
QLineEdit *textZValue;
 
QLabel *labelXYSpeed;
QSlider *sliderXYSpeed;
QSpinBox *textXYSpeed;
 
QLabel *labelXYAmount;
QSlider *sliderXYAmount;
QSpinBox *textXYAmount;
 
QLabel *labelZSpeed;
QSlider *sliderZSpeed;
QSpinBox *textZSpeed;
 
QLabel *labelZAmount;
QSlider *sliderZAmount;
QSpinBox *textZAmount;
 
QLabel *labelRepeatDelay;
QSlider *sliderRepeatDelay;
QSpinBox *textRepeatDelay;
 
QLabel *labelEForwardSpeed;
QSlider *sliderEForwardSpeed;
QSpinBox *textEForwardSpeed;
 
QLabel *labelEBackwardSpeed;
QSlider *sliderEBackwardSpeed;
QSpinBox *textEBackwardSpeed;
 
QLabel *labelEForwardAmount;
QSlider *sliderEForwardAmount;
QSpinBox *textEForwardAmount;
 
QLabel *labelEBackwardAmount;
QSlider *sliderEBackwardAmount;
QSpinBox *textEBackwardAmount;
 
 
};
 
#endif // PASTECONTROLLER_H
/Misc Projects/PcMarlinInterface/PcMarlinInterface.pro
17,7 → 17,8
SerialHelper.cpp \
MacroWidget.cpp \
SerialWidget.cpp \
IOWidget.cpp
IOWidget.cpp \
PasteController.cpp
 
HEADERS += GlobalDefines.h \
MainWindow.h \
24,8 → 25,11
SerialHelper.h \
MacroWidget.h \
SerialWidget.h \
IOWidget.h
IOWidget.h \
PasteController.h
 
RESOURCES += Resources.qrc
 
RC_FILE = Icon.rc
 
FORMS +=
/Misc Projects/PcMarlinInterface/PcMarlinInterface.pro.user
1,10 → 1,10
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.3.0, 2015-03-04T03:06:04. -->
<!-- Written by QtCreator 3.3.0, 2015-03-05T14:44:31. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{4c29e835-aad4-4677-99d7-2a63e01ab69b}</value>
<value type="QByteArray">{22bd4f67-ea17-48ee-8299-171e5aa125c2}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
/Misc Projects/PcMarlinInterface/Resources/arrow_down.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/arrow_down.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources/arrow_left.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/arrow_left.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources/arrow_right.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/arrow_right.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources/arrow_up.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/arrow_up.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources/close.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/close.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources/download.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/download.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources/upload.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Misc Projects/PcMarlinInterface/Resources/upload.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Misc Projects/PcMarlinInterface/Resources.qrc
3,5 → 3,12
<file>Resources/Icon_16.bmp</file>
<file>Resources/Icon_32.bmp</file>
<file>Resources/Icon_64.bmp</file>
<file>Resources/arrow_down.png</file>
<file>Resources/arrow_up.png</file>
<file>Resources/arrow_left.png</file>
<file>Resources/arrow_right.png</file>
<file>Resources/close.png</file>
<file>Resources/download.png</file>
<file>Resources/upload.png</file>
</qresource>
</RCC>
/Misc Projects/PcMarlinInterface/SerialHelper.cpp
8,11 → 8,14
stopBits << "1 Bit" << "1.5 Bits" << "2 Bits";
parity << "None" << "Even" << "Odd" << "Space" << "Mark";
flowControl << "None" << "Hardware" << "Software";
 
serialPort = NULL;
}
 
SerialHelper::~SerialHelper()
{
serialPort->close();
if (serialPort != NULL && serialPort->isOpen())
serialPort->close();
delete serialPort;
}