2022-04-19 06:16:41 +00:00
|
|
|
//
|
|
|
|
// Created by bbr on 18. 04. 2022..
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "name_dialog.h"
|
2022-05-27 06:18:17 +00:00
|
|
|
|
|
|
|
display::NameDialog::NameDialog(domain::ComponentInstance *instance) : componentInstance(instance) {
|
|
|
|
auto *layout = new QVBoxLayout(this);
|
|
|
|
layout->addWidget(new QLabel("Izmjeni ime", this));
|
|
|
|
|
|
|
|
edit = new QLineEdit(this);
|
|
|
|
edit->insert(instance->name.c_str());
|
|
|
|
layout->addWidget(edit);
|
|
|
|
this->setWindowTitle("Izmjeni ime");
|
|
|
|
auto *button = new QPushButton("Ažuriraj", this);
|
|
|
|
connect(button, &QPushButton::clicked, this, &NameDialog::onNameChange);
|
|
|
|
layout->addWidget(button);
|
|
|
|
this->setLayout(layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
display::NameDialog::NameDialog(domain::BusInstance *instance): busInstance(instance) {
|
|
|
|
auto *layout = new QVBoxLayout(this);
|
|
|
|
layout->addWidget(new QLabel("Izmjeni ime", this));
|
|
|
|
|
|
|
|
edit = new QLineEdit(this);
|
|
|
|
edit->insert(instance->name.c_str());
|
|
|
|
layout->addWidget(edit);
|
|
|
|
this->setWindowTitle("Izmjeni ime");
|
|
|
|
auto *button = new QPushButton("Ažuriraj", this);
|
|
|
|
connect(button, &QPushButton::clicked, this, &NameDialog::onNameChange);
|
|
|
|
layout->addWidget(button);
|
|
|
|
this->setLayout(layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void display::NameDialog::onNameChange() {
|
|
|
|
if (componentInstance != nullptr) {
|
|
|
|
componentInstance->name = this->edit->text().toStdString();
|
|
|
|
} else if (busInstance != nullptr) {
|
|
|
|
busInstance->name = this->edit->text().toStdString();
|
|
|
|
}
|
|
|
|
this->close();
|
|
|
|
}
|