Add quick colors to Linux GUI

This commit is contained in:
Adam Honse 2019-06-20 12:27:01 -05:00
parent d94d6eb569
commit 8f96f9535d
3 changed files with 181 additions and 10 deletions

View file

@ -7,6 +7,50 @@ OpenAuraSDKQtDialog::OpenAuraSDKQtDialog(std::vector<i2c_smbus_interface *>& bus
{
ui->setupUi(this);
QPalette pal;
pal = ui->ButtonRed->palette();
pal.setColor(QPalette::Button, QColor(255, 0, 0));
ui->ButtonRed->setAutoFillBackground(true);
ui->ButtonRed->setPalette(pal);
ui->ButtonRed->setFlat(true);
ui->ButtonRed->update();
pal = ui->ButtonYellow->palette();
pal.setColor(QPalette::Button, QColor(255, 255, 0));
ui->ButtonYellow->setAutoFillBackground(true);
ui->ButtonYellow->setPalette(pal);
ui->ButtonYellow->setFlat(true);
ui->ButtonYellow->update();
pal = ui->ButtonGreen->palette();
pal.setColor(QPalette::Button, QColor(0, 255, 0));
ui->ButtonGreen->setAutoFillBackground(true);
ui->ButtonGreen->setPalette(pal);
ui->ButtonGreen->setFlat(true);
ui->ButtonGreen->update();
pal = ui->ButtonCyan->palette();
pal.setColor(QPalette::Button, QColor(0, 255, 255));
ui->ButtonCyan->setAutoFillBackground(true);
ui->ButtonCyan->setPalette(pal);
ui->ButtonCyan->setFlat(true);
ui->ButtonCyan->update();
pal = ui->ButtonBlue->palette();
pal.setColor(QPalette::Button, QColor(0, 0, 255));
ui->ButtonBlue->setAutoFillBackground(true);
ui->ButtonBlue->setPalette(pal);
ui->ButtonBlue->setFlat(true);
ui->ButtonBlue->update();
pal = ui->ButtonMagenta->palette();
pal.setColor(QPalette::Button, QColor(255, 0, 255));
ui->ButtonMagenta->setAutoFillBackground(true);
ui->ButtonMagenta->setPalette(pal);
ui->ButtonMagenta->setFlat(true);
ui->ButtonMagenta->update();
for (int i = 0; i < controllers.size(); i++)
{
ui->ComboDevices->addItem(controllers[i]->name.c_str());
@ -26,6 +70,48 @@ void OpenAuraSDKQtDialog::show()
QMainWindow::show();
}
void Ui::OpenAuraSDKQtDialog::on_ButtonRed_clicked()
{
ui->EditLED0R->setText("255");
ui->EditLED0G->setText("0");
ui->EditLED0B->setText("0");
}
void Ui::OpenAuraSDKQtDialog::on_ButtonYellow_clicked()
{
ui->EditLED0R->setText("255");
ui->EditLED0G->setText("255");
ui->EditLED0B->setText("0");
}
void Ui::OpenAuraSDKQtDialog::on_ButtonGreen_clicked()
{
ui->EditLED0R->setText("0");
ui->EditLED0G->setText("255");
ui->EditLED0B->setText("0");
}
void Ui::OpenAuraSDKQtDialog::on_ButtonCyan_clicked()
{
ui->EditLED0R->setText("0");
ui->EditLED0G->setText("255");
ui->EditLED0B->setText("255");
}
void Ui::OpenAuraSDKQtDialog::on_ButtonBlue_clicked()
{
ui->EditLED0R->setText("0");
ui->EditLED0G->setText("0");
ui->EditLED0B->setText("255");
}
void Ui::OpenAuraSDKQtDialog::on_ButtonMagenta_clicked()
{
ui->EditLED0R->setText("255");
ui->EditLED0G->setText("0");
ui->EditLED0B->setText("255");
}
void Ui::OpenAuraSDKQtDialog::on_ButtonSetAll_clicked()
{
RGBColor color = ToRGBColor(

View file

@ -33,6 +33,13 @@ protected:
std::vector<RGBController *>& controllers;
private slots:
void on_ButtonRed_clicked();
void on_ButtonYellow_clicked();
void on_ButtonGreen_clicked();
void on_ButtonCyan_clicked();
void on_ButtonBlue_clicked();
void on_ButtonMagenta_clicked();
void on_ButtonSetAll_clicked();
void on_ButtonSetDevice_clicked();

View file

@ -18,7 +18,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<y>80</y>
<width>80</width>
<height>20</height>
</rect>
@ -31,7 +31,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<y>110</y>
<width>80</width>
<height>20</height>
</rect>
@ -44,7 +44,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
@ -54,7 +54,7 @@
<property name="geometry">
<rect>
<x>70</x>
<y>30</y>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
@ -64,7 +64,7 @@
<property name="geometry">
<rect>
<x>130</x>
<y>30</y>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
@ -74,7 +74,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
@ -87,7 +87,7 @@
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
@ -100,7 +100,7 @@
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
@ -205,7 +205,7 @@
<property name="geometry">
<rect>
<x>100</x>
<y>90</y>
<y>110</y>
<width>80</width>
<height>20</height>
</rect>
@ -218,7 +218,7 @@
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<y>80</y>
<width>80</width>
<height>20</height>
</rect>
@ -227,6 +227,84 @@
<string>Set Device</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonRed">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonYellow">
<property name="geometry">
<rect>
<x>40</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonGreen">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonCyan">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonBlue">
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonMagenta">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources/>