Files
OpenRGB/qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.cpp
Chris 2e02f1d782 Adding ability to switch language files at runtime to resolve #2743
* Removing .qm files from Windows build as they are inbuilt as of a7adfe251
* Moving translation change code to the OpenRGBSettingsPage
* Adding a changeEvent() to applicable Widgets to facilitate language updates
* Workaround added to TabLabel to accomodate translation context origin
* Added zh_TW locale to OpenRGB.pro
* Updated all translations to include the latest untranslated strings
2022-11-27 04:07:30 +00:00

58 lines
1.2 KiB
C++

#include "OpenRGBYeelightSettingsEntry.h"
#include "ui_OpenRGBYeelightSettingsEntry.h"
#include "net_port.h"
#include <QInputDialog>
using namespace Ui;
OpenRGBYeelightSettingsEntry::OpenRGBYeelightSettingsEntry(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBYeelightSettingsEntryUi)
{
ui->setupUi(this);
}
OpenRGBYeelightSettingsEntry::~OpenRGBYeelightSettingsEntry()
{
delete ui;
}
void OpenRGBYeelightSettingsEntry::changeEvent(QEvent *event)
{
if(event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this);
}
}
void OpenRGBYeelightSettingsEntry::on_HostIPChooserButton_clicked()
{
char hostname[256];
gethostname(hostname, 256);
char **in_addrs = gethostbyname(hostname)->h_addr_list;
QStringList in_addr_list;
while (*in_addrs != NULL)
{
in_addr_list << inet_ntoa(*((struct in_addr*) *in_addrs));
in_addrs++;
}
QInputDialog inp;
inp.setOptions(QInputDialog::UseListViewForComboBoxItems);
inp.setComboBoxItems(in_addr_list);
inp.setWindowTitle(tr("Choose an IP..."));
inp.setLabelText(tr("Choose the correct IP for the host"));
if(!inp.exec())
{
return;
}
ui->HostIPEdit->setText(inp.textValue());
}