bsnes/higan/target-ethos/settings/server.cpp

33 lines
1.1 KiB
C++

ServerSettings *serverSettings = nullptr;
ServerSettings::ServerSettings() {
title.setFont(application->titleFont);
title.setText("Server Settings");
hostLabel.setText("Hostname:");
userLabel.setText("Username:");
passLabel.setText("Password:");
unsigned width = min(
Font(application->normalFont).geometry("Hostname:").width,
Font(application->normalFont).geometry("Username:").width
);
append(title, {~0, 0}, 5);
append(hostLayout, {~0, 0}, 5);
hostLayout.append(hostLabel, {width, 0}, 5);
hostLayout.append(hostEdit, {~0, 0});
append(userLayout, {~0, 0});
userLayout.append(userLabel, {width, 0}, 5);
userLayout.append(userEdit, {~0, 0}, 5);
userLayout.append(passLabel, {0, 0}, 5);
userLayout.append(passEdit, {~0, 0});
hostEdit.setText(config->server.hostname);
userEdit.setText(config->server.username);
passEdit.setText(config->server.password);
hostEdit.onChange = [&] { config->server.hostname = hostEdit.text(); };
userEdit.onChange = [&] { config->server.username = userEdit.text(); };
passEdit.onChange = [&] { config->server.password = passEdit.text(); };
}