Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions fixtureeditor/fixtureeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ void QLCFixtureEditor::closeEvent(QCloseEvent *e)
}
}

bool QLCFixtureEditor::checkManufacturerModel()
bool QLCFixtureEditor::checkFixtureDefinition()
{
/* Check that the fixture has a manufacturer and a model for
unique identification */
/* Check that the fixture has a manufacturer, a model and at least one
mode for unique identification and loading */
if (m_fixtureDef->manufacturer().length() == 0)
{
QMessageBox::warning(this,
Expand All @@ -250,13 +250,23 @@ bool QLCFixtureEditor::checkManufacturerModel()
m_modelEdit->setFocus();
return false;
}
else if (m_fixtureDef->modes().isEmpty() == true)
{
QMessageBox::warning(this,
tr("Missing important information"),
tr("Missing fixture mode.\n"
"Unable to save fixture."));
m_tab->setCurrentWidget(Modes);
m_addModeButton->setFocus();
return false;
}

return true;
}

bool QLCFixtureEditor::save()
{
if (checkManufacturerModel() == false)
if (checkFixtureDefinition() == false)
return false;

if (m_fileName.simplified().isEmpty() == true)
Expand Down Expand Up @@ -284,8 +294,8 @@ bool QLCFixtureEditor::save()

bool QLCFixtureEditor::saveAs()
{
/* Bail out if there is no manufacturer or model */
if (checkManufacturerModel() == false)
/* Bail out if the fixture definition is incomplete */
if (checkFixtureDefinition() == false)
return false;

/* Create a file save dialog */
Expand Down
2 changes: 1 addition & 1 deletion fixtureeditor/fixtureeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected slots:
void slotTypeActivated(int index);

protected:
bool checkManufacturerModel();
bool checkFixtureDefinition();
void setCaption();
void ensureNewExtension();
bool newExtensionReminder();
Expand Down