-
Notifications
You must be signed in to change notification settings - Fork 1
Connection settings #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
42df9e0
004d132
4635473
e5357cf
296f9b8
fed85bd
f736f80
8107c9b
2accd6f
5ce93db
df7b400
107134b
dc21962
b1b88ea
1a991bc
9ed943b
506d699
9029d78
dd30fec
4bf5cac
2654cc4
0d91c2d
d27fd7e
86ac968
80eb9f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,14 +17,13 @@ DeviceConfigTab::DeviceConfigTab(SettingsModel* pSettingsModel, | |
| const QJsonObject& deviceValues, | ||
| QWidget* parent) | ||
| : QWidget(parent), | ||
| _pLayout(nullptr), | ||
| _pLayout(new QVBoxLayout(this)), | ||
| _pNameEdit(new QLineEdit(this)), | ||
| _pAdapterCombo(new QComboBox(this)), | ||
| _pSchemaForm(nullptr), | ||
| _pSettingsModel(pSettingsModel), | ||
| _deviceId(deviceValues.value("id").toInt(-1)) | ||
| { | ||
| _pLayout = new QVBoxLayout(this); | ||
| setLayout(_pLayout); | ||
|
|
||
| auto* nameRow = new QHBoxLayout; | ||
|
|
@@ -33,10 +32,9 @@ DeviceConfigTab::DeviceConfigTab(SettingsModel* pSettingsModel, | |
| nameRow->addStretch(); | ||
| _pLayout->addLayout(nameRow); | ||
|
|
||
| int deviceId = deviceValues.value("id").toInt(-1); | ||
| if (deviceId >= 0 && pSettingsModel->deviceList().contains(static_cast<deviceId_t>(deviceId))) | ||
| if (_deviceId >= 0 && pSettingsModel->hasDevice(static_cast<deviceId_t>(_deviceId))) | ||
| { | ||
| _pNameEdit->setText(pSettingsModel->deviceSettings(static_cast<deviceId_t>(deviceId))->name()); | ||
| _pNameEdit->setText(pSettingsModel->deviceSettings(static_cast<deviceId_t>(_deviceId))->name()); | ||
| } | ||
|
|
||
| auto* adapterRow = new QHBoxLayout; | ||
|
|
@@ -66,6 +64,7 @@ DeviceConfigTab::DeviceConfigTab(SettingsModel* pSettingsModel, | |
| _pAdapterCombo->setCurrentIndex(idx); | ||
| } | ||
|
|
||
| connect(_pNameEdit, &QLineEdit::textChanged, this, &DeviceConfigTab::onNameChanged); | ||
| connect(_pAdapterCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | ||
| &DeviceConfigTab::onAdapterChanged); | ||
|
|
||
|
|
@@ -96,15 +95,29 @@ void DeviceConfigTab::onAdapterChanged(int index) | |
| } | ||
| defaultValues["id"] = currentId; | ||
|
|
||
| if (_deviceId >= 0 && _pSettingsModel->hasDevice(static_cast<deviceId_t>(_deviceId))) | ||
| { | ||
| _pSettingsModel->deviceSettings(static_cast<deviceId_t>(_deviceId))->setAdapterId(newAdapterId); | ||
| } | ||
|
|
||
| rebuildSchemaForm(newAdapterId, defaultValues); | ||
| } | ||
|
|
||
| void DeviceConfigTab::onNameChanged(const QString& name) | ||
| { | ||
| if (_deviceId >= 0 && _pSettingsModel->hasDevice(static_cast<deviceId_t>(_deviceId))) | ||
| { | ||
| _pSettingsModel->deviceSettings(static_cast<deviceId_t>(_deviceId))->setName(name); | ||
| } | ||
| emit nameChanged(name); | ||
| } | ||
|
Comment on lines
+106
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name edits and tab close write to a stale
Consider keeping 🤖 Prompt for AI Agents |
||
|
|
||
| void DeviceConfigTab::rebuildSchemaForm(const QString& adapterId, const QJsonObject& deviceValues) | ||
| { | ||
| if (_pSchemaForm) | ||
| { | ||
| _pLayout->removeWidget(_pSchemaForm); | ||
| delete _pSchemaForm; | ||
| _pSchemaForm->deleteLater(); | ||
| _pSchemaForm = nullptr; | ||
| } | ||
|
|
||
|
|
@@ -137,3 +150,8 @@ QString DeviceConfigTab::deviceName() const | |
| { | ||
| return _pNameEdit->text(); | ||
| } | ||
|
|
||
| int DeviceConfigTab::deviceId() const | ||
| { | ||
| return _deviceId; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the version format aligned with the JSON-RPC spec.
Line 268 now advertises
0.0.1-master:ac7eec7, but the spec documents debug versions as"<semver>-<git-branch>". The extra:<hash>suffix is undocumented and can break consumers that parse or compare the version using the published format.Proposed format alignment
🤖 Prompt for AI Agents