1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
/*
* LLDB Debugger Support
* Copyright 2016 Aetf <aetf@unlimitedcodeworks.xyz>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "lldbconfigpage.h"
#include "ui_lldbconfigpage.h"
#include "dbgglobal.h"
#include <util/environmentselectionwidget.h>
#include <KConfigGroup>
#include <KUrlRequester>
#include <QComboBox>
#include <QGroupBox>
#include <QLineEdit>
#include <QRegularExpression>
#include <QRegularExpressionValidator>
using namespace KDevelop;
namespace Config = KDevMI::LLDB::Config;
LldbConfigPage::LldbConfigPage(QWidget* parent)
: LaunchConfigurationPage(parent)
, ui(new Ui::LldbConfigPage)
{
ui->setupUi(this);
ui->lineDebuggerExec->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly);
ui->lineConfigScript->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly);
QRegularExpression rx(QStringLiteral(R"([^:]+:\d+)"));
ui->lineRemoteServer->setValidator(new QRegularExpressionValidator(rx, this));
ui->comboStartWith->setItemData(0, QStringLiteral("ApplicationOutput"));
ui->comboStartWith->setItemData(1, QStringLiteral("GdbConsole"));
ui->comboStartWith->setItemData(2, QStringLiteral("FrameStack"));
connect(ui->lineDebuggerExec, &KUrlRequester::textChanged, this, &LldbConfigPage::changed);
connect(ui->lineDebuggerArgs, &QLineEdit::textChanged, this, &LldbConfigPage::changed);
connect(ui->comboEnv, &EnvironmentSelectionWidget::currentProfileChanged,
this, &LldbConfigPage::changed);
connect(ui->lineConfigScript, &KUrlRequester::textChanged, this, &LldbConfigPage::changed);
connect(ui->comboStartWith, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &LldbConfigPage::changed);
connect(ui->groupRemote, &QGroupBox::clicked, this, &LldbConfigPage::changed);
connect(ui->lineRemoteServer, &QLineEdit::textChanged, this, &LldbConfigPage::changed);
connect(ui->lineOnDevPath, &QLineEdit::textChanged, this, &LldbConfigPage::changed);
}
LldbConfigPage::~LldbConfigPage()
{
delete ui;
}
QIcon LldbConfigPage::icon() const
{
return {};
}
QString LldbConfigPage::title() const
{
return i18n("LLDB Configuration");
}
void LldbConfigPage::loadFromConfiguration(const KConfigGroup& cfg, KDevelop::IProject *)
{
bool block = blockSignals(true);
ui->lineDebuggerExec->setUrl(cfg.readEntry(Config::LldbExecutableEntry, QUrl()));
ui->lineDebuggerArgs->setText(cfg.readEntry(Config::LldbArgumentsEntry, QString()));
ui->comboEnv->setCurrentProfile(cfg.readEntry(Config::LldbEnvironmentEntry, QString()));
ui->checkInheritSystem->setChecked(cfg.readEntry(Config::LldbInheritSystemEnvEntry, true));
ui->lineConfigScript->setUrl(cfg.readEntry(Config::LldbConfigScriptEntry, QUrl()));
ui->checkBreakOnStart->setChecked(cfg.readEntry(KDevMI::Config::BreakOnStartEntry, false));
ui->comboStartWith->setCurrentIndex(ui->comboStartWith->findData(
cfg.readEntry(KDevMI::Config::StartWithEntry, "ApplicationOutput")));
ui->groupRemote->setChecked(cfg.readEntry(Config::LldbRemoteDebuggingEntry, false));
ui->lineRemoteServer->setText(cfg.readEntry(Config::LldbRemoteServerEntry, QString()));
ui->lineOnDevPath->setText(cfg.readEntry(Config::LldbRemotePathEntry, QString()));
blockSignals(block);
}
void LldbConfigPage::saveToConfiguration(KConfigGroup cfg, KDevelop::IProject *) const
{
cfg.writeEntry(Config::LldbExecutableEntry, ui->lineDebuggerExec->url());
cfg.writeEntry(Config::LldbArgumentsEntry, ui->lineDebuggerArgs->text());
cfg.writeEntry(Config::LldbEnvironmentEntry, ui->comboEnv->currentProfile());
cfg.writeEntry(Config::LldbInheritSystemEnvEntry, ui->checkInheritSystem->isChecked());
cfg.writeEntry(Config::LldbConfigScriptEntry, ui->lineConfigScript->url());
cfg.writeEntry(KDevMI::Config::BreakOnStartEntry, ui->checkBreakOnStart->isChecked());
cfg.writeEntry(KDevMI::Config::StartWithEntry, ui->comboStartWith->currentData().toString());
cfg.writeEntry(Config::LldbRemoteDebuggingEntry, ui->groupRemote->isChecked());
cfg.writeEntry(Config::LldbRemoteServerEntry, ui->lineRemoteServer->text());
cfg.writeEntry(Config::LldbRemotePathEntry, ui->lineOnDevPath->text());
}
KDevelop::LaunchConfigurationPage * LldbConfigPageFactory::createWidget(QWidget* parent)
{
return new LldbConfigPage(parent);
}
|