File indexing completed on 2021-12-21 13:15:51

0001 /*
0002  * XDebug Debugger Support
0003  *
0004  * Copyright 2009 Niko Sams <niko.sams@gmail.com>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of the
0009  * License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public
0017  * License along with this program; if not, write to the
0018  * Free Software Foundation, Inc.,
0019  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0020  */
0021 
0022 #include "launchconfigurationpage.h"
0023 
0024 #include <QIcon>
0025 #include <KLocalizedString>
0026 
0027 #include "ui_launchconfigurationpage.h"
0028 #include "launchconfig.h"
0029 #include "debugsession.h"
0030 
0031 namespace XDebug {
0032 KDevelop::LaunchConfigurationPage* ConfigPageFactory::createWidget(QWidget* parent)
0033 {
0034     return new ConfigPage(parent);
0035 }
0036 
0037 ConfigPage::ConfigPage(QWidget* parent)
0038     : LaunchConfigurationPage(parent)
0039 {
0040     m_ui = new Ui::LaunchConfigurationWidget;
0041     m_ui->setupUi(this);
0042 
0043     connect(m_ui->pathMappings, &KDevelop::PathMappingsWidget::changed, this, &ConfigPage::changed);
0044 }
0045 
0046 QIcon ConfigPage::icon() const
0047 {
0048     return QIcon();
0049 }
0050 
0051 void ConfigPage::loadFromConfiguration(const KConfigGroup& cfg, KDevelop::IProject*)
0052 {
0053     m_ui->pathMappings->loadFromConfiguration(cfg);
0054     m_ui->remoteHost->setText(cfg.readEntry("RemoteHost", QString()));
0055     m_ui->remotePort->setValue(cfg.readEntry("RemotePort", 9000));
0056 }
0057 
0058 void ConfigPage::saveToConfiguration(KConfigGroup cfg, KDevelop::IProject*) const
0059 {
0060     m_ui->pathMappings->saveToConfiguration(cfg);
0061     cfg.writeEntry("RemoteHost", m_ui->remoteHost->text());
0062     cfg.writeEntry("RemotePort", m_ui->remotePort->value());
0063 }
0064 
0065 QString ConfigPage::title() const
0066 {
0067     return i18n("XDebug Configuration");
0068 }
0069 }