Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 347 → Rev 348

/Misc Projects/PcMarlinInterface/MacroController.cpp
6,8 → 6,8
 
btnExport = new QPushButton("&Export");
btnImport = new QPushButton("&Import");
btnIncreaseMacro = new QPushButton("&Add");
btnDecreaseMacro = new QPushButton("&Remove");
btnAddMacro = new QPushButton("&Add");
btnRemoveMacro = new QPushButton("&Remove");
 
mainLayout = new QGridLayout();
 
16,11 → 16,11
lastKnownFilePath = ".";
 
ioLayout = new QHBoxLayout();
ioLayout->addStretch();
ioLayout->addWidget(btnIncreaseMacro);
ioLayout->addWidget(btnDecreaseMacro);
ioLayout->addWidget(btnAddMacro);
ioLayout->addWidget(btnRemoveMacro);
ioLayout->addWidget(btnExport);
ioLayout->addWidget(btnImport);
ioLayout->addStretch();
mainLayout->addLayout(ioLayout, 0, 0, 1, 2);
 
for (int i = 0; i < MACRO_DEFAULT_COUNT; i++) {
28,16 → 28,12
}
 
setLayout(mainLayout);
this->resize(this->minimumSizeHint());
 
connect(btnIncreaseMacro, SIGNAL(clicked()), this, SLOT(Macro_AddEntry()));
connect(btnDecreaseMacro, SIGNAL(clicked()), this, SLOT(Macro_RemoveEntry()));
connect(btnAddMacro, SIGNAL(clicked()), this, SLOT(Macro_AddEntry()));
connect(btnRemoveMacro, SIGNAL(clicked()), this, SLOT(Macro_RemoveEntry()));
connect(btnExport, SIGNAL(clicked()), this, SLOT(Macro_WriteToFile()));
connect(btnImport, SIGNAL(clicked()), this, SLOT(Macro_ReadFromFile()));
connect(sigMapper, SIGNAL(mapped(QWidget*)), this, SLOT(Macro_InitTransmit(QWidget*)));
 
setWindowTitle("Macro Settings");
setWindowIcon(QIcon(":/External/Resources/Icon_16.bmp"));
}
 
MacroController::~MacroController()
45,6 → 41,11
 
}
 
QSize MacroController::sizeHint() const
{
return this->minimumSizeHint();
}
 
void MacroController::Macro_EnableTransmit()
{
connected = true;
106,10 → 107,12
 
QLayoutItem *item = mainLayout->itemAtPosition(1, 1);
int height = item->widget()->height() + mainLayout->verticalSpacing();
if (!this->isMaximized())
this->resize(this->width(), this->height() + height);
 
btnDecreaseMacro->setEnabled(true);
QDockWidget *parent = qobject_cast<QDockWidget*>(this->parent());
if (parent->isFloating())
parent->resize(parent->width(), parent->height() + height);
 
btnRemoveMacro->setEnabled(true);
}
 
void MacroController::Macro_RemoveEntry()
137,11 → 140,12
 
macroCount--;
 
if (!this->isMaximized())
this->resize(this->width(), this->height() - height);
QDockWidget *parent = qobject_cast<QDockWidget*>(this->parent());
if (parent->isFloating())
parent->resize(parent->width(), parent->height() - height);
 
if (macroCount == 1)
btnDecreaseMacro->setEnabled(false);
btnRemoveMacro->setEnabled(false);
}
 
void MacroController::Macro_WriteToFile()