#include "ViewCommandLinePage.hxx" #include #include #include
#include "LaunchConfig.hxx" #if 0 #include "ExtraSettingsSection.hxx" #include "LauncherArgumentTokenizer.hxx" #endif ViewCommandLinePage::ViewCommandLinePage(QWidget *parent) : QWidget(parent) { QVBoxLayout* vbox = new QVBoxLayout(this); setLayout(vbox); m_browser = new QTextEdit(this); m_browser->setReadOnly(true); vbox->addWidget(m_browser); } #if 0 void ViewCommandLinePage::setExtraSettingsSection(ExtraSettingsSection *ess) { m_extraSettings = ess; } #endif void ViewCommandLinePage::setLaunchConfig(LaunchConfig *config) { m_config = config; } void ViewCommandLinePage::update() { QString html; string_list commandLineOpts = flightgear::Options::sharedInstance()->extractOptions(); if (!commandLineOpts.empty()) { html += tr("

Options passed on the command line:

\n"); html += "
    \n"; for (auto opt : commandLineOpts) { html += QString("
  • --") + QString::fromStdString(opt) + "
  • \n"; } html += "
\n"; } #if 0 if (m_extraSettings) { LauncherArgumentTokenizer tk; Q_FOREACH(auto arg, tk.tokenize(m_extraSettings->argsText())) { // m_config->setArg(arg.arg, arg.value); } } #endif m_config->reset(); m_config->collect(); html += tr("

Options set in the launcher:

\n"); html += "
    \n"; for (auto arg : m_config->values()) { if (arg.value.isEmpty()) { html += QString("
  • --") + arg.arg + "
  • \n"; } else if (arg.arg == "prop") { html += QString("
  • --") + arg.arg + ":" + arg.value + "
  • \n"; } else { html += QString("
  • --") + arg.arg + "=" + arg.value + "
  • \n"; } } html += "
\n"; m_browser->setHtml(html); }