<commit_before>#include "processlauncherwidget.h"

#include <QFileDialog>
#include <QLineEdit>

#include "../OrbitCore/Params.h"
#include "App.h"
#include "ui_processlauncherwidget.h"

ProcessLauncherWidget::ProcessLauncherWidget(QWidget* parent)
    : QWidget(parent), ui(new Ui::ProcessLauncherWidget) {
  ui->setupUi(this);
  ui->ProcessComboBox->lineEdit()->setPlaceholderText("Process");
  ui->WorkingDirComboBox->lineEdit()->setPlaceholderText("Working Directory");
  ui->ArgumentsComboBox->lineEdit()->setPlaceholderText("Arguments");

  ui->gridLayout_2->setColumnStretch(0, 90);
  ui->checkBoxPause->setChecked(GParams.m_StartPaused);

  ui->ProcessComboBox->lineEdit()->setText("");
}

ProcessLauncherWidget::~ProcessLauncherWidget() { delete ui; }

void ProcessLauncherWidget::SetDataView(DataView* data_view) {
  ui->LiveProcessList->Initialize(data_view, SelectionType::kDefault,
                                  FontType::kDefault);

  if (GParams.m_ProcessFilter != "") {
    ui->LiveProcessList->SetFilter(GParams.m_ProcessFilter.c_str());
  }
}

void ProcessLauncherWidget::Refresh() { ui->LiveProcessList->Refresh(); }

void ProcessLauncherWidget::SetProcessParams() {
  if (GParams.m_ProcessPath != "") {
    ui->ProcessComboBox->lineEdit()->setText(GParams.m_ProcessPath.c_str());
  }
  if (GParams.m_WorkingDirectory != "") {
    ui->WorkingDirComboBox->lineEdit()->setText(
        GParams.m_WorkingDirectory.c_str());
  }
  if (GParams.m_Arguments != "") {
    ui->ArgumentsComboBox->lineEdit()->setText(GParams.m_Arguments.c_str());
  }
}

void ProcessLauncherWidget::UpdateProcessParams() {
  GParams.m_ProcessPath = ui->ProcessComboBox->lineEdit()->text().toStdString();
  GParams.m_Arguments = ui->ArgumentsComboBox->lineEdit()->text().toStdString();
  GParams.m_WorkingDirectory =
      ui->WorkingDirComboBox->lineEdit()->text().toStdString();
}

void ProcessLauncherWidget::on_BrowseButton_clicked() {
  QStringList list = QFileDialog::getOpenFileNames(
      this, "Select an executable file...", "", "*.exe");
  for (auto& file : list) {
    ui->ProcessComboBox->lineEdit()->setText(file);
    break;
  }
}

void ProcessLauncherWidget::on_LaunchButton_clicked() {
  QString process = ui->ProcessComboBox->lineEdit()->text();
  QString workingDir = ui->WorkingDirComboBox->lineEdit()->text();
  QString args = ui->ArgumentsComboBox->lineEdit()->text();
  GOrbitApp->OnLaunchProcess(process.toStdString(), workingDir.toStdString(),
                             args.toStdString());
}

void ProcessLauncherWidget::on_checkBoxPause_clicked(bool checked) {
  GParams.m_StartPaused = checked;
  GParams.Save();
}

void ProcessLauncherWidget::on_BrowseWorkingDirButton_clicked() {
  QString dir = QFileDialog::getExistingDirectory(
      this, tr("Open Directory"), "/home",
      QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
  ui->WorkingDirComboBox->lineEdit()->setText(dir);
}
<commit_msg>Hide ui to launch local process<commit_after>#include "processlauncherwidget.h"

#include <QFileDialog>
#include <QLineEdit>

#include "../OrbitCore/Params.h"
#include "App.h"
#include "absl/flags/flag.h"
#include "ui_processlauncherwidget.h"

ABSL_DECLARE_FLAG(bool, non_release_features);

ProcessLauncherWidget::ProcessLauncherWidget(QWidget* parent)
    : QWidget(parent), ui(new Ui::ProcessLauncherWidget) {
  ui->setupUi(this);
  ui->ProcessComboBox->lineEdit()->setPlaceholderText("Process");
  ui->WorkingDirComboBox->lineEdit()->setPlaceholderText("Working Directory");
  ui->ArgumentsComboBox->lineEdit()->setPlaceholderText("Arguments");

  ui->gridLayout_2->setColumnStretch(0, 90);
  ui->checkBoxPause->setChecked(GParams.m_StartPaused);

  ui->ProcessComboBox->lineEdit()->setText("");

  if (!absl::GetFlag(FLAGS_non_release_features)) {
    ui->frame->setVisible(false);
  }
}

ProcessLauncherWidget::~ProcessLauncherWidget() { delete ui; }

void ProcessLauncherWidget::SetDataView(DataView* data_view) {
  ui->LiveProcessList->Initialize(data_view, SelectionType::kDefault,
                                  FontType::kDefault);

  if (GParams.m_ProcessFilter != "") {
    ui->LiveProcessList->SetFilter(GParams.m_ProcessFilter.c_str());
  }
}

void ProcessLauncherWidget::Refresh() { ui->LiveProcessList->Refresh(); }

void ProcessLauncherWidget::SetProcessParams() {
  if (GParams.m_ProcessPath != "") {
    ui->ProcessComboBox->lineEdit()->setText(GParams.m_ProcessPath.c_str());
  }
  if (GParams.m_WorkingDirectory != "") {
    ui->WorkingDirComboBox->lineEdit()->setText(
        GParams.m_WorkingDirectory.c_str());
  }
  if (GParams.m_Arguments != "") {
    ui->ArgumentsComboBox->lineEdit()->setText(GParams.m_Arguments.c_str());
  }
}

void ProcessLauncherWidget::UpdateProcessParams() {
  GParams.m_ProcessPath = ui->ProcessComboBox->lineEdit()->text().toStdString();
  GParams.m_Arguments = ui->ArgumentsComboBox->lineEdit()->text().toStdString();
  GParams.m_WorkingDirectory =
      ui->WorkingDirComboBox->lineEdit()->text().toStdString();
}

void ProcessLauncherWidget::on_BrowseButton_clicked() {
  QStringList list = QFileDialog::getOpenFileNames(
      this, "Select an executable file...", "", "*.exe");
  for (auto& file : list) {
    ui->ProcessComboBox->lineEdit()->setText(file);
    break;
  }
}

void ProcessLauncherWidget::on_LaunchButton_clicked() {
  QString process = ui->ProcessComboBox->lineEdit()->text();
  QString workingDir = ui->WorkingDirComboBox->lineEdit()->text();
  QString args = ui->ArgumentsComboBox->lineEdit()->text();
  GOrbitApp->OnLaunchProcess(process.toStdString(), workingDir.toStdString(),
                             args.toStdString());
}

void ProcessLauncherWidget::on_checkBoxPause_clicked(bool checked) {
  GParams.m_StartPaused = checked;
  GParams.Save();
}

void ProcessLauncherWidget::on_BrowseWorkingDirButton_clicked() {
  QString dir = QFileDialog::getExistingDirectory(
      this, tr("Open Directory"), "/home",
      QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
  ui->WorkingDirComboBox->lineEdit()->setText(dir);
}

{'fraction_non_alphanumeric': 0.15714757345658634, 'fraction_numerical': 0.0013205678441729944, 'mean_word_length': 5.473290598290598, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 123, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5265228', 'n_tokens_mistral': 1931, 'n_tokens_neox': 1896, 'n_words': 232}