Skip to content

Commit

Permalink
ShvClientServiceWidget: generate API key
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanda Vacek committed Jul 6, 2024
1 parent 702a0ac commit 024f9aa
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ ShvClientServiceWidget::ShvClientServiceWidget(QWidget *parent)
connect(ui->shvUrl, &QLineEdit::textChanged, this, &ShvClientServiceWidget::updateQrCodeUrl);
connect(ui->shvApiKey, &QLineEdit::textChanged, this, &ShvClientServiceWidget::updateQrCodeUrl);
connect(ui->shvEventPath, &QLineEdit::textChanged, this, &ShvClientServiceWidget::updateQrCodeUrl);
connect(ui->btGenerateApiKey, &QAbstractButton::clicked, this, [this]() {
auto *event_plugin = getPlugin<EventPlugin>();
ui->shvApiKey->setText(event_plugin->createShvApiKey());
});
}

ShvClientServiceWidget::~ShvClientServiceWidget()
Expand Down Expand Up @@ -62,7 +66,7 @@ bool ShvClientServiceWidget::saveSettings()
if(svc) {
auto ss = svc->settings();
ss.setShvConnectionUrl(ui->shvUrl->text());
//svc->setApiKey(ui->edApiKey->text().trimmed());
ss.setApiKey(ui->shvApiKey->text().trimmed());
svc->setSettings(ss);
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,78 @@
<property name="windowTitle">
<string>SHV API service</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>SHV url</string>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="shvUrl"/>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="shvEventPath">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="shvUrl"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>API key</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="shvApiKey">
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="qrCodeUrl">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>SHV url</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Event path</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="shvEventPath">
<item row="2" column="2">
<widget class="QPushButton" name="btGenerateApiKey">
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="shvApiKey">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>QR code url</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="qrCodeUrl">
<property name="readOnly">
<bool>true</bool>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
Expand Down

0 comments on commit 024f9aa

Please sign in to comment.