Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanwong committed Sep 8, 2017
1 parent 2a70f4e commit 86aff4c
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 70 deletions.
2 changes: 1 addition & 1 deletion constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static const int X_BORDER = 40;
static const int Y_BORDER = 40;
static const int DISH_DIAMETER = 100;

static const QString VERSION = "1.0.0";
static const QString VERSION = "1.1.0";

static const QString PORTAL_LINK = "http://portal.se3d.com";
static const QString VISIT_LINK = "https://www.se3d.com/";
Expand Down
1 change: 1 addition & 0 deletions customtemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CustomTemplate::CustomTemplate(QWidget *parent) : QWidget(parent)

void CustomTemplate::mouseDoubleClickEvent(QMouseEvent *)
{
//signal to switch to custom tab
emit switchTabs(0);
}

6 changes: 4 additions & 2 deletions gcg-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ SOURCES += \
pagetwo.cpp \
link.cpp \
templateitem.cpp \
customtemplate.cpp
customtemplate.cpp \
pagethree.cpp

HEADERS += \
wizard.h \
Expand All @@ -39,7 +40,8 @@ HEADERS += \
constants.h \
link.h \
templateitem.h \
customtemplate.h
customtemplate.h \
pagethree.h

FORMS += \
mainwindow.ui
Expand Down
2 changes: 1 addition & 1 deletion gcg-gui.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.3.1, 2017-09-06T18:31:39. -->
<!-- Written by QtCreator 4.3.1, 2017-09-07T15:05:32. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
2 changes: 2 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
Wizard wizardWindow;

//set dock icon
app.setWindowIcon(QIcon(":/Resources/se3d-circle-logo.svg"));

//window adjustments
wizardWindow.setWindowFlags(Qt::FramelessWindowHint);
wizardWindow.setMinimumWidth(700);

//round the window
QPainterPath path;
path.addRoundedRect(wizardWindow.rect(), 5, 5);
Expand Down
64 changes: 50 additions & 14 deletions pageone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@

PageOne::PageOne(QWidget *parent) : QWidget(parent)
{
//create widget to hold tabs
tabWidget = new QTabWidget(this);

//build each tab
customTab(tabWidget);
templateTab(tabWidget);

//set opening screen to templates
tabWidget->setCurrentIndex(1);

//adjust default tab styling
tabWidget->setStyleSheet("QTabWidget::pane {border: 0;}");
tabWidget->tabBar()->setStyleSheet("QTabBar::tab:selected{ color:#ffffff}");

Expand All @@ -39,6 +44,7 @@ void PageOne::customTab(QTabWidget *tabWidget)
widthEdit->setMinimumWidth(42);
positionEdit->setMinimumWidth(42);

//set properties for each form
heightEdit->setRange(1, 8);
widthEdit->setRange(1, 8);
positionEdit->setRange(1, 4);
Expand All @@ -51,9 +57,10 @@ void PageOne::customTab(QTabWidget *tabWidget)
amountEdit->setValue(25);
amountEdit->setDisabled(true);


//builds the print selection row (petri vs well plate)
buildPrintSelection();

//add each part of the form
QFormLayout *formLayout = new QFormLayout;

formLayout->addRow("&Name:", nameEdit);
Expand All @@ -65,7 +72,7 @@ void PageOne::customTab(QTabWidget *tabWidget)
formLayout->addRow("&Position:", positionEdit);
formLayout->addRow("&Extrusion Amount (μl):", amountEdit);


//add custom tab to the main tab widget
QWidget *customWindow = new QWidget;
customWindow->setLayout(formLayout);
tabWidget->addTab(customWindow, "Custom");
Expand All @@ -77,14 +84,19 @@ void PageOne::customTab(QTabWidget *tabWidget)

void PageOne::buildPrintSelection()
{
//build and group component selections
groupBox = new QGroupBox;
petriRadio = new QRadioButton(tr("Petri Dish"));
wellPlateRadio = new QRadioButton(tr("Well Plate"));

//set so that only one button may be selected
petriRadio->setAutoExclusive(true);
wellPlateRadio->setAutoExclusive(true);
petriRadio->setChecked(true); //default selected

//default selection
petriRadio->setChecked(true);

//add buttons to layout
QHBoxLayout *groupBoxLayout = new QHBoxLayout;
groupBoxLayout->addWidget(petriRadio);
groupBoxLayout->addWidget(wellPlateRadio);
Expand All @@ -93,7 +105,7 @@ void PageOne::buildPrintSelection()
groupBox->setStyleSheet("border: 0");
groupBoxLayout->setContentsMargins(0, 0, 0, 0);


//connect buttons to appropriate slots
QObject::connect(wellPlateRadio, SIGNAL(clicked(bool)), this, SLOT(onWellPlateRadioClicked()));
QObject::connect(petriRadio, SIGNAL(clicked(bool)), this, SLOT(onPetriRadioClicked()));
}
Expand All @@ -107,30 +119,32 @@ void PageOne::templateTab(QTabWidget *tabWidget)
{
//encapsulating widget to house the layouts
QFrame *templateWindow = new QFrame;
//encapsulating horizontal widget to house first few

//encapsulating horizontal widget to house each level of templates
QHBoxLayout *firstRowLayout = new QHBoxLayout;
QHBoxLayout *secondRowLayout = new QHBoxLayout;

//paths to be changed once icons are finalized
buildCustomTemplate(firstRowLayout, "Custom" , "/Users/brendanwong/Desktop/custom-template.png");
buildTemplateItem(firstRowLayout, "Row Print" , "/Users/brendanwong/Desktop/template-1.png", SLOT(onRowTemplateClicked()));
buildTemplateItem(firstRowLayout, "3x3 CaCl2" , "/Users/brendanwong/Desktop/template-2.png", SLOT(templateTwo()));

QHBoxLayout *secondRowLayout = new QHBoxLayout;
buildTemplateItem(secondRowLayout, "Fill Well Plate" , "/Users/brendanwong/Desktop/template-3.png", SLOT(fillWell()));
buildTemplateItem(secondRowLayout, "Template 4" , "/Users/brendanwong/Desktop/template-4.png", SLOT(templateTwo()));
buildTemplateItem(secondRowLayout, "Template 5" , "/Users/brendanwong/Desktop/template-5.png", SLOT(templateTwo()));

//put together each row
QVBoxLayout *vlayout = new QVBoxLayout;

vlayout->addLayout(firstRowLayout);
vlayout->addLayout(secondRowLayout);

firstRowLayout->setContentsMargins(0,0,0,0);
secondRowLayout->setContentsMargins(0,0,0,0);


//ensure consistent spacing
firstRowLayout->setContentsMargins(0, 0, 0, 0);
secondRowLayout->setContentsMargins(0, 0, 0, 0);

//set layout and add template tab to main tab widget
templateWindow->setLayout(vlayout);

tabWidget->addTab(templateWindow, "Templates");

}
Expand All @@ -141,22 +155,27 @@ void PageOne::templateTab(QTabWidget *tabWidget)

void PageOne::buildCustomTemplate(QHBoxLayout *hlayout, QString title, QString iconPath)
{
//builds the custom template
CustomTemplate *item = new CustomTemplate;

QVBoxLayout *vlayout = new QVBoxLayout;

//create template icon
QLabel *iconLabel = new QLabel;
QPixmap icon(iconPath);
icon.setDevicePixelRatio(devicePixelRatio());
iconLabel->setPixmap(icon);

//set title of label
QLabel *label = new QLabel(title);
label->setAlignment(Qt::AlignCenter);

//put components together
vlayout->addWidget(iconLabel);
vlayout->addWidget(label);
item->setLayout(vlayout);

//add functionality
QObject::connect(item, SIGNAL(switchTabs(int)), tabWidget, SLOT(setCurrentIndex(int)));

hlayout->addWidget(item);
Expand All @@ -168,22 +187,27 @@ void PageOne::buildCustomTemplate(QHBoxLayout *hlayout, QString title, QString i

void PageOne::buildTemplateItem(QHBoxLayout *hlayout, QString title, QString iconPath, const char *slot)
{
//builds a template item
TemplateItem *item = new TemplateItem;

QVBoxLayout *vlayout = new QVBoxLayout;

//create template icon
QLabel *iconLabel = new QLabel;
QPixmap icon(iconPath);
icon.setDevicePixelRatio(devicePixelRatio());
iconLabel->setPixmap(icon);

//set label title
QLabel *label = new QLabel(title);
label->setAlignment(Qt::AlignCenter);

//puts components together
vlayout->addWidget(iconLabel);
vlayout->addWidget(label);
item->setLayout(vlayout);

//adds functionality, switching the tab and changing appropriate settings
QObject::connect(item, SIGNAL(rowPrint()), this, slot);
QObject::connect(item, SIGNAL(switchTabs(int)), tabWidget, SLOT(setCurrentIndex(int)));

Expand All @@ -196,22 +220,26 @@ void PageOne::buildTemplateItem(QHBoxLayout *hlayout, QString title, QString ico






void PageOne::onWellPlateRadioClicked()
{
//shows warning message only once
if (firstMessage == true)
{
QMessageBox warningMessage;
warningMessage.setText("Note: This will only print accurately to the Greiner 650161 well plate.");
warningMessage.exec();
firstMessage = false;
}

//new max value for well plate
widthEdit->setRange(1, 12);
widthEdit->update();

//disabling position since not needed for well plate prints
positionEdit->setDisabled(true);
positionEdit->update();

//enabling variable extrusion amount
amountEdit->setEnabled(true);
amountEdit->update();

Expand All @@ -224,10 +252,15 @@ void PageOne::onWellPlateRadioClicked()

void PageOne::onPetriRadioClicked()
{
//new max value for petri dish
widthEdit->setRange(1, 8);
widthEdit->update();

//enabling position for petri dish prints
positionEdit->setEnabled(true);
positionEdit->update();

//disabling extrusion variability
amountEdit->setDisabled(true);
amountEdit->update();
}
Expand All @@ -236,6 +269,7 @@ void PageOne::onPetriRadioClicked()

void PageOne::onRowTemplateClicked()
{
//slot for row print settings
wellPlateRadio->click();
widthEdit->setValue(12);
heightEdit->setValue(1);
Expand All @@ -244,6 +278,7 @@ void PageOne::onRowTemplateClicked()

void PageOne::templateTwo()
{
//slot for 3x3 CaCl2 prints
petriRadio->click();
widthEdit->setValue(3);
heightEdit->setValue(3);
Expand All @@ -253,6 +288,7 @@ void PageOne::templateTwo()

void PageOne::fillWell()
{
//slot to fill entire well plate
wellPlateRadio->click();
widthEdit->setValue(12);
heightEdit->setValue(8);
Expand Down
23 changes: 23 additions & 0 deletions pagethree.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "pagethree.h"

#include <QLineEdit>
#include <QDateEdit>
#include <QSpinBox>

PageThree::PageThree(QWidget *parent) : QWidget(parent)
{
QWidget *widget = new QWidget(this);
buildTemplateEdit(widget);

}

void PageThree::buildTemplateEdit(QWidget *widget)
{
QLineEdit *nameEdit = new QLineEdit;
QDateEdit *dateEdit = new QDateEdit;
QSpinBox *heightEdit = new QSpinBox;
QSpinBox *widthEdit = new QSpinBox;
QSpinBox *positionEdit = new QSpinBox;


}
14 changes: 14 additions & 0 deletions pagethree.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef PAGETHREE_H
#define PAGETHREE_H

#include <QWidget>

class PageThree : public QWidget
{
public:
PageThree(QWidget *parent = 0);

void buildTemplateEdit(QWidget *widget);
};

#endif // PAGETHREE_H
Loading

0 comments on commit 86aff4c

Please sign in to comment.