Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 363 → Rev 364

/Misc Projects/PcMarlinInterface/MainWindow.cpp
11,10 → 11,7
groupOther = new QGroupBox("Other");
btnMacro = new QPushButton("&Macros");
btnPaste = new QPushButton("&Paste");
QGridLayout *otherLayout = new QGridLayout();
otherLayout->addWidget(btnMacro, 0, 0);
otherLayout->addWidget(btnPaste, 1, 0);
groupOther->setLayout(otherLayout);
ToggleGroupLayout(false);
 
// Initialize serial widget
serialWidget = new SerialWidget();
33,8 → 30,7
serialDataLayout->addWidget(ioWidget);
groupSerialData->setLayout(serialDataLayout);
connect(serialWidget, SIGNAL(ReceivedByte(QByteArray)), ioWidget, SLOT(ProcessReceivedByte(QByteArray)));
connect(serialWidget, SIGNAL(Connected()), ioWidget, SLOT(EnableTransmit()));
connect(serialWidget, SIGNAL(Disconnected()), ioWidget, SLOT(DisableTransmit()));
connect(serialWidget, SIGNAL(Connected(bool)), ioWidget, SLOT(EnableTransmit(bool)));
connect(ioWidget, SIGNAL(TransmitByteArray(QByteArray)), serialWidget, SIGNAL(TransmitByteArray(QByteArray)));
 
// Initialize macro widget
45,8 → 41,7
macroDockWidget->hide();
addDockWidget(Qt::RightDockWidgetArea, macroDockWidget);
connect(macroWidget, SIGNAL(TransmitText(QByteArray)), ioWidget, SLOT(PreprocessTransmit(QByteArray)));
connect(serialWidget, SIGNAL(Connected()), macroWidget, SLOT(EnableTransmit()));
connect(serialWidget, SIGNAL(Disconnected()), macroWidget, SLOT(DisableTransmit()));
connect(serialWidget, SIGNAL(Connected(bool)), macroWidget, SLOT(EnableTransmit(bool)));
 
// Initialize paste controller widget
pasteDockWidget = new QDockWidget("Paste Controller", this);
53,6 → 48,9
pasteWidget = new PasteController(pasteDockWidget);
pasteDockWidget->setWidget(pasteWidget);
pasteDockWidget->setFloating(true);
pasteDockWidget->hide();
connect(serialWidget, SIGNAL(Connected(bool)), pasteWidget, SLOT(EnableTransmit(bool)));
connect(pasteWidget, SIGNAL(TransmitData(QByteArray)), ioWidget, SLOT(PreprocessTransmit(QByteArray)));
 
// Connect local widgets
connect(btnMacro, SIGNAL(clicked()), macroDockWidget->toggleViewAction(), SLOT(trigger()));
66,6 → 64,7
mainLayout->setColumnStretch(0, 0);
mainLayout->setColumnStretch(1, 1);
centralWidget->setLayout(mainLayout);
connect(serialWidget, SIGNAL(Connected(bool)), this, SLOT(ToggleGroupLayout(bool)));
 
setWindowTitle("Marlin Controller");
setWindowIcon(QIcon(":/External/Resources/Icon_16.bmp"));
88,3 → 87,20
{
labelSerialStatus->setText(string);
}
 
void MainWindow::ToggleGroupLayout(bool toggle)
{
QGridLayout *layout = qobject_cast<QGridLayout*>(groupOther->layout());
if (layout == NULL) layout = new QGridLayout();
layout->removeWidget(btnMacro);
layout->removeWidget(btnPaste);
if (toggle) {
layout->addWidget(btnMacro, 0, 0);
layout->addWidget(btnPaste, 0, 1);
} else {
layout->addWidget(btnMacro, 0, 0);
layout->addWidget(btnPaste, 1, 0);
}
groupOther->setLayout(layout);
groupOther->repaint();
}