Skip to content

Commit

Permalink
Add restart notice when NeoPixels settings are changed
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongGino committed Aug 24, 2024
1 parent b6f059e commit 588ee1b
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
35 changes: 35 additions & 0 deletions guiwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,20 @@ QString PrettifyName()
}


void guiWindow::PixelsDiff()
{
if(settingsTable[customLEDcount] == settingsTable_orig[customLEDcount] &&
settingsTable[customLEDstatic] == settingsTable_orig[customLEDstatic] &&
settingsTable[customLEDcolor1] == settingsTable_orig[customLEDcolor1] &&
settingsTable[customLEDcolor2] == settingsTable_orig[customLEDcolor2] &&
settingsTable[customLEDcolor3] == settingsTable_orig[customLEDcolor3]) {
ui->pixelChangeNotice->setVisible(false);
} else {
ui->pixelChangeNotice->setVisible(true);
}
}


void guiWindow::on_confirmButton_clicked()
{
QMessageBox messageBox;
Expand Down Expand Up @@ -817,6 +831,7 @@ void guiWindow::on_confirmButton_clicked()
} else {
statusBar()->showMessage("Sent settings successfully!", 5000);
SyncSettings();
PixelsDiff();
DiffUpdate();
ui->boardLabel->setText(PrettifyName());
}
Expand Down Expand Up @@ -1991,6 +2006,10 @@ void guiWindow::on_neopixelStrandLengthBox_valueChanged(int arg1)
if(arg1 < settingsTable[customLEDstatic]) {
ui->customLEDstaticSpinbox->setValue(arg1);
}

// show NeoPixel notice if values are updated
PixelsDiff();

DiffUpdate();
}

Expand Down Expand Up @@ -2023,6 +2042,10 @@ void guiWindow::on_customLEDstaticSpinbox_valueChanged(int arg1)
break;
}
}

// show NeoPixel notice if values are updated
PixelsDiff();

DiffUpdate();
}

Expand All @@ -2041,6 +2064,10 @@ void guiWindow::on_customLEDstaticBtn1_clicked()
packedColor |= *blue;
settingsTable[customLEDcolor1] = packedColor;
ui->customLEDstaticBtn1->setStyleSheet(QString("background-color: #%1").arg(packedColor, 6, 16, QLatin1Char('0')));

// show NeoPixel notice if values are updated
PixelsDiff();

DiffUpdate();
}
}
Expand All @@ -2060,6 +2087,10 @@ void guiWindow::on_customLEDstaticBtn2_clicked()
packedColor |= *blue;
settingsTable[customLEDcolor2] = packedColor;
ui->customLEDstaticBtn2->setStyleSheet(QString("background-color: #%1").arg(packedColor, 6, 16, QLatin1Char('0')));

// show NeoPixel notice if values are updated
PixelsDiff();

DiffUpdate();
}
}
Expand All @@ -2079,6 +2110,10 @@ void guiWindow::on_customLEDstaticBtn3_clicked()
packedColor |= *blue;
settingsTable[customLEDcolor3] = packedColor;
ui->customLEDstaticBtn3->setStyleSheet(QString("background-color: #%1").arg(packedColor, 6, 16, QLatin1Char('0')));

// show NeoPixel notice if values are updated
PixelsDiff();

DiffUpdate();
}
}
Expand Down
2 changes: 2 additions & 0 deletions guiwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ private slots:

void DiffUpdate();

void PixelsDiff();

void PopupWindow(QString errorTitle, QString errorMessage, QString windowTitle, int errorType);

void PortsSearch();
Expand Down
26 changes: 22 additions & 4 deletions guiwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,24 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="pixelChangeNotice">
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Changes to NeoPixel settings may require a power cycle to update properly!</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1542,7 +1560,7 @@
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
<string>&amp;Help</string>
</property>
<addaction name="actionOpenFIRE_Documentation"/>
<addaction name="actionOpenFIRE_Serial_Usage"/>
Expand All @@ -1557,20 +1575,20 @@
</widget>
<action name="actionAbout_UI">
<property name="text">
<string>About OpenFIRE...</string>
<string>&amp;About OpenFIRE...</string>
</property>
</action>
<action name="actionOpenFIRE_Documentation">
<property name="text">
<string>OpenFIRE Documentation...</string>
<string>&amp;OpenFIRE Documentation...</string>
</property>
<property name="shortcut">
<string>Alt+D</string>
</property>
</action>
<action name="actionOpenFIRE_Serial_Usage">
<property name="text">
<string>OpenFIRE Serial Usage Docs...</string>
<string>OpenFIRE &amp;Serial Usage Docs...</string>
</property>
<property name="shortcut">
<string>Alt+S</string>
Expand Down

0 comments on commit 588ee1b

Please sign in to comment.