Skip to content

Commit

Permalink
UI: add color selector for tray icon
Browse files Browse the repository at this point in the history
  • Loading branch information
szszszsz committed Aug 14, 2021
1 parent 18de4af commit 950e522
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1936,3 +1936,13 @@ void MainWindow::on_hotpRadioButton_clicked(bool checked)
if (checked)
ui->slotComboBox->setCurrentIndex(TOTP_SlotCount + 1);
}

void MainWindow::on_btn_trayColorChange_clicked()
{
QColorDialog d;
d.setCurrentColor(ui->trayIconColorEdit->text());
auto res = d.exec();
if (res == QDialog::Accepted) {
ui->trayIconColorEdit->setText(d.currentColor().name());
}
}
2 changes: 2 additions & 0 deletions src/ui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ private slots:

void on_hotpRadioButton_clicked(bool checked);

void on_btn_trayColorChange_clicked();

public:
void generateOTPConfig(OTPSlot *slot);
unsigned int get_supported_secret_length_base32() const;
Expand Down
7 changes: 7 additions & 0 deletions src/ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_trayColorChange">
<property name="text">
<string>Change color</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="trayIconColorEdit">
<property name="sizePolicy">
Expand Down

0 comments on commit 950e522

Please sign in to comment.