mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Register from SettingsDialog
This commit is contained in:
parent
c993ca611e
commit
f6a63b90fc
5 changed files with 24 additions and 7 deletions
|
@ -47,7 +47,7 @@ class RegistDialog : public QDialog
|
||||||
void ValidateInput();
|
void ValidateInput();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RegistDialog(Settings *settings, QString host = QString(), QWidget *parent = nullptr);
|
explicit RegistDialog(Settings *settings, const QString &host = QString(), QWidget *parent = nullptr);
|
||||||
~RegistDialog();
|
~RegistDialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -36,6 +36,7 @@ class SettingsDialog : public QDialog
|
||||||
private slots:
|
private slots:
|
||||||
void UpdateRegisteredHosts();
|
void UpdateRegisteredHosts();
|
||||||
void UpdateRegisteredHostsButtons();
|
void UpdateRegisteredHostsButtons();
|
||||||
|
void RegisterNewHost();
|
||||||
void DeleteRegisteredHost();
|
void DeleteRegisteredHost();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -115,10 +115,15 @@ void MainWindow::ServerItemWidgetTriggered()
|
||||||
return;
|
return;
|
||||||
const auto &server = display_servers[index];
|
const auto &server = display_servers[index];
|
||||||
|
|
||||||
// TODO: check if already registered and connect
|
if(server.registered)
|
||||||
|
{
|
||||||
RegistDialog regist_dialog(settings, server.GetHostAddr(), this);
|
// TODO: connect
|
||||||
regist_dialog.exec();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegistDialog regist_dialog(settings, server.GetHostAddr(), this);
|
||||||
|
regist_dialog.exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UpdateDiscoveryEnabled()
|
void MainWindow::UpdateDiscoveryEnabled()
|
||||||
|
|
|
@ -33,7 +33,7 @@ Q_DECLARE_METATYPE(ChiakiLogLevel)
|
||||||
|
|
||||||
static const QRegularExpression pin_re(QString("[0-9]").repeated(PIN_LENGTH));
|
static const QRegularExpression pin_re(QString("[0-9]").repeated(PIN_LENGTH));
|
||||||
|
|
||||||
RegistDialog::RegistDialog(Settings *settings, QString host, QWidget *parent)
|
RegistDialog::RegistDialog(Settings *settings, const QString &host, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
settings(settings)
|
settings(settings)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,10 @@ RegistDialog::RegistDialog(Settings *settings, QString host, QWidget *parent)
|
||||||
|
|
||||||
host_edit = new QLineEdit(this);
|
host_edit = new QLineEdit(this);
|
||||||
form_layout->addRow(tr("Host:"), host_edit);
|
form_layout->addRow(tr("Host:"), host_edit);
|
||||||
host_edit->setText(host);
|
if(host.isEmpty())
|
||||||
|
host_edit->setText("255.255.255.255");
|
||||||
|
else
|
||||||
|
host_edit->setText(host);
|
||||||
|
|
||||||
psn_id_edit = new QLineEdit(this);
|
psn_id_edit = new QLineEdit(this);
|
||||||
form_layout->addRow(tr("PSN ID (username):"), psn_id_edit);
|
form_layout->addRow(tr("PSN ID (username):"), psn_id_edit);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <settingsdialog.h>
|
#include <settingsdialog.h>
|
||||||
#include <settings.h>
|
#include <settings.h>
|
||||||
|
#include <registdialog.h>
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
@ -46,6 +47,7 @@ SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) : QDialog(pa
|
||||||
|
|
||||||
auto register_new_button = new QPushButton(tr("Register New"), this);
|
auto register_new_button = new QPushButton(tr("Register New"), this);
|
||||||
registered_hosts_buttons_layout->addWidget(register_new_button);
|
registered_hosts_buttons_layout->addWidget(register_new_button);
|
||||||
|
connect(register_new_button, &QPushButton::clicked, this, &SettingsDialog::RegisterNewHost);
|
||||||
|
|
||||||
delete_registered_host_button = new QPushButton(tr("Delete"), this);
|
delete_registered_host_button = new QPushButton(tr("Delete"), this);
|
||||||
registered_hosts_buttons_layout->addWidget(delete_registered_host_button);
|
registered_hosts_buttons_layout->addWidget(delete_registered_host_button);
|
||||||
|
@ -81,6 +83,12 @@ void SettingsDialog::UpdateRegisteredHostsButtons()
|
||||||
delete_registered_host_button->setEnabled(registered_hosts_list_widget->currentIndex().isValid());
|
delete_registered_host_button->setEnabled(registered_hosts_list_widget->currentIndex().isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::RegisterNewHost()
|
||||||
|
{
|
||||||
|
RegistDialog dialog(settings, QString(), this);
|
||||||
|
dialog.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsDialog::DeleteRegisteredHost()
|
void SettingsDialog::DeleteRegisteredHost()
|
||||||
{
|
{
|
||||||
auto item = registered_hosts_list_widget->currentItem();
|
auto item = registered_hosts_list_widget->currentItem();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue