|
43 | 43 | #include "perfoutputwidgetkonsole.h" |
44 | 44 | #include "perfoutputwidgettext.h" |
45 | 45 | #include "perfrecord.h" |
| 46 | +#include "settings.h" |
46 | 47 |
|
47 | 48 | namespace { |
48 | 49 | bool isIntel() |
@@ -81,11 +82,15 @@ void updateStartRecordingButtonState(const RecordHost* host, const std::unique_p |
81 | 82 | return; |
82 | 83 | } |
83 | 84 |
|
| 85 | + // TODO: move stuff to RecordHost |
84 | 86 | bool enabled = false; |
85 | 87 | switch (selectedRecordType(ui)) { |
86 | 88 | case RecordType::LaunchApplication: |
87 | 89 | enabled = ui->applicationName->url().isValid(); |
88 | 90 | break; |
| 91 | + case RecordType::LaunchRemoteApplication: |
| 92 | + enabled = host->isReady(); |
| 93 | + break; |
89 | 94 | case RecordType::AttachToProcess: |
90 | 95 | enabled = ui->processesTableView->selectionModel()->hasSelection(); |
91 | 96 | break; |
@@ -207,6 +212,20 @@ RecordPage::RecordPage(QWidget* parent) |
207 | 212 | m_recordHost->setClientApplicationArguments(KShell::splitArgs(ui->applicationParametersBox->text())); |
208 | 213 | }); |
209 | 214 |
|
| 215 | + auto settings = Settings::instance(); |
| 216 | + connect(settings, &Settings::devicesChanged, this, [this](const QStringList& devices) { |
| 217 | + ui->deviceComboBox->clear(); |
| 218 | + ui->deviceComboBox->insertItem(0, QStringLiteral("localhost")); |
| 219 | + ui->deviceComboBox->insertItems(1, devices); |
| 220 | + ui->deviceComboBox->setCurrentIndex(0); |
| 221 | + }); |
| 222 | + ui->deviceComboBox->insertItem(0, QStringLiteral("localhost")); |
| 223 | + ui->deviceComboBox->insertItems(1, settings->devices()); |
| 224 | + ui->deviceComboBox->setCurrentIndex(0); |
| 225 | + |
| 226 | + connect(ui->deviceComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, |
| 227 | + [this] { m_recordHost->setHost(ui->deviceComboBox->currentText()); }); |
| 228 | + |
210 | 229 | ui->compressionComboBox->addItem(tr("Disabled"), -1); |
211 | 230 | ui->compressionComboBox->addItem(tr("Enabled (Default Level)"), 0); |
212 | 231 | ui->compressionComboBox->addItem(tr("Level 1 (Fastest)"), 1); |
@@ -246,6 +265,7 @@ RecordPage::RecordPage(QWidget* parent) |
246 | 265 | }); |
247 | 266 |
|
248 | 267 | m_recordHost->setHost(QStringLiteral("localhost")); |
| 268 | + m_recordHost->setRecordType(RecordType::LaunchApplication); |
249 | 269 |
|
250 | 270 | ui->applicationName->comboBox()->setEditable(true); |
251 | 271 | ui->applicationName->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); |
@@ -289,15 +309,18 @@ RecordPage::RecordPage(QWidget* parent) |
289 | 309 |
|
290 | 310 | ui->recordTypeComboBox->addItem(QIcon::fromTheme(QStringLiteral("run-build")), tr("Launch Application"), |
291 | 311 | QVariant::fromValue(RecordType::LaunchApplication)); |
| 312 | + ui->recordTypeComboBox->addItem(QIcon::fromTheme(QStringLiteral("run-build")), tr("Launch Remote Application"), |
| 313 | + QVariant::fromValue(RecordType::LaunchRemoteApplication)); |
292 | 314 | ui->recordTypeComboBox->addItem(QIcon::fromTheme(QStringLiteral("run-install")), tr("Attach To Process(es)"), |
293 | 315 | QVariant::fromValue(RecordType::AttachToProcess)); |
294 | 316 | ui->recordTypeComboBox->addItem(QIcon::fromTheme(QStringLiteral("run-build-install-root")), tr("Profile System"), |
295 | 317 | QVariant::fromValue(RecordType::ProfileSystem)); |
296 | | - connect(ui->recordTypeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, |
297 | | - &RecordPage::updateRecordType); |
| 318 | + |
298 | 319 | connect(ui->recordTypeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), m_recordHost, |
299 | 320 | [this] { m_recordHost->setRecordType(ui->recordTypeComboBox->currentData().value<RecordType>()); }); |
300 | | - connect(m_recordHost, &RecordHost::clientApplicationChanged, this, &RecordPage::updateRecordType); |
| 321 | + |
| 322 | + connect(m_recordHost, &RecordHost::recordTypeChanged, this, &RecordPage::updateRecordType); |
| 323 | + updateRecordType(RecordType::LaunchApplication); |
301 | 324 |
|
302 | 325 | { |
303 | 326 | ui->callGraphComboBox->addItem(tr("None"), QVariant::fromValue(QString())); |
@@ -503,7 +526,7 @@ void RecordPage::showRecordPage() |
503 | 526 | { |
504 | 527 | m_resultsFile.clear(); |
505 | 528 | setError({}); |
506 | | - updateRecordType(); |
| 529 | + m_recordHost->setRecordType(RecordType::LaunchApplication); |
507 | 530 | ui->viewPerfRecordResultsButton->setEnabled(false); |
508 | 531 | } |
509 | 532 |
|
@@ -740,17 +763,25 @@ void RecordPage::setError(const QString& message) |
740 | 763 | ui->applicationRecordErrorMessage->setVisible(!message.isEmpty()); |
741 | 764 | } |
742 | 765 |
|
743 | | -void RecordPage::updateRecordType() |
| 766 | +void RecordPage::updateRecordType(RecordType recordType) |
744 | 767 | { |
745 | 768 | setError({}); |
746 | 769 |
|
| 770 | +==== BASE ==== |
747 | 771 | const auto recordType = selectedRecordType(ui); |
748 | 772 | ui->launchAppBox->setVisible(recordType == RecordType::LaunchApplication); |
| 773 | +==== BASE ==== |
749 | 774 | ui->attachAppBox->setVisible(recordType == RecordType::AttachToProcess); |
750 | 775 |
|
751 | 776 | m_perfOutput->setInputVisible(recordType == RecordType::LaunchApplication); |
752 | 777 | m_perfOutput->clear(); |
753 | 778 |
|
| 779 | + if (recordType == RecordType::LaunchRemoteApplication) { |
| 780 | + ui->applicationName->clear(); |
| 781 | + } else if (recordType == RecordType::LaunchApplication) { |
| 782 | + restoreCombobox(config(), QStringLiteral("applications"), ui->applicationName->comboBox()); |
| 783 | + } |
| 784 | + |
754 | 785 | if (recordType == RecordType::AttachToProcess) { |
755 | 786 | updateProcesses(); |
756 | 787 | } |
|
0 commit comments