[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdev-xdebug] /: make remotePort configurable in launch config
From:       Niko Sams <niko.sams () gmail ! com>
Date:       2014-02-02 10:15:11
Message-ID: E1W9u51-0000RR-PU () scm ! kde ! org
[Download RAW message or body]

Git commit ec7d6b7004c6d567345c546596fe118d20b1533f by Niko Sams.
Committed on 02/02/2014 at 10:14.
Pushed by nsams into branch 'master'.

make remotePort configurable in launch config

allows using the debugger on a different port than the default 9000 if another
process is already using that.

M  +2    -1    debugjob.cpp
M  +3    -2    debugsession.cpp
M  +2    -0    launchconfigurationpage.cpp
M  +26   -0    launchconfigurationpage.ui

http://commits.kde.org/kdev-xdebug/ec7d6b7004c6d567345c546596fe118d20b1533f

diff --git a/debugjob.cpp b/debugjob.cpp
index 87e589a..eace90a 100644
--- a/debugjob.cpp
+++ b/debugjob.cpp
@@ -165,8 +165,9 @@ XDebugJob::XDebugJob( DebugSession* session, KDevelop::ILaunchConfiguration* cfg
     program << interpreter;
     program << "-d xdebug.remote_enable=1";
     QString remoteHostSetting = cfg->config().readEntry("RemoteHost", QString());
+    int remotePortSetting = cfg->config().readEntry("RemotePort", 9000);
     if (!remoteHostSetting.isEmpty()) program << "-d xdebug.remote_host="+remoteHostSetting;
-    program << "-d xdebug.remote_port="+QString::number(9000);
+    program << "-d xdebug.remote_port="+QString::number(remotePortSetting);
     program << "-d xdebug.idekey="+ideKey;
     program << script.toLocalFile();
     program << arguments;
diff --git a/debugsession.cpp b/debugsession.cpp
index b594ec0..793e75f 100644
--- a/debugsession.cpp
+++ b/debugsession.cpp
@@ -69,10 +69,11 @@ bool DebugSession::listenForConnection(QString& error)
     Q_ASSERT(!m_server);
     m_server = new QTcpServer(this);
     kDebug();
-    if(m_server->listen(QHostAddress::Any, 9000)) {
+    int remotePortSetting = m_launchConfiguration->config().readEntry("RemotePort", 9000);
+    if(m_server->listen(QHostAddress::Any, remotePortSetting)) {
         connect(m_server, SIGNAL(newConnection()), this, SLOT(incomingConnection()));
     } else {
-        error = i18n("Opening port 9000 failed: %1.", m_server->errorString());
+        error = i18n("Opening port %1 failed: %2.", remotePortSetting, m_server->errorString());
         kWarning() << "Error" << m_server->errorString();
         delete m_server;
         m_server = 0;
diff --git a/launchconfigurationpage.cpp b/launchconfigurationpage.cpp
index 17f25b8..9d00619 100644
--- a/launchconfigurationpage.cpp
+++ b/launchconfigurationpage.cpp
@@ -56,12 +56,14 @@ void ConfigPage::loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProj
 {
     m_ui->pathMappings->loadFromConfiguration(cfg);
     m_ui->remoteHost->setText(cfg.readEntry("RemoteHost", QString()));
+    m_ui->remotePort->setValue(cfg.readEntry("RemotePort", 9000));
 }
 
 void ConfigPage::saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* ) const
 {
     m_ui->pathMappings->saveToConfiguration(cfg);
     cfg.writeEntry("RemoteHost", m_ui->remoteHost->text());
+    cfg.writeEntry("RemotePort", m_ui->remotePort->value());
 }
 
 QString ConfigPage::title() const
diff --git a/launchconfigurationpage.ui b/launchconfigurationpage.ui
index b20f717..4f5a999 100644
--- a/launchconfigurationpage.ui
+++ b/launchconfigurationpage.ui
@@ -29,11 +29,17 @@
       <string>Advanced Settings</string>
      </property>
      <layout class="QFormLayout" name="formLayout">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::ExpandingFieldsGrow</enum>
+      </property>
       <item row="0" column="0">
        <widget class="QLabel" name="label_2">
         <property name="text">
          <string>xdebug.remote_host</string>
         </property>
+        <property name="buddy">
+         <cstring>remoteHost</cstring>
+        </property>
        </widget>
       </item>
       <item row="0" column="1">
@@ -43,6 +49,26 @@
         </property>
        </widget>
       </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>xdebug.remote_port</string>
+        </property>
+        <property name="buddy">
+         <cstring>remotePort</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QSpinBox" name="remotePort">
+        <property name="maximum">
+         <number>65535</number>
+        </property>
+        <property name="value">
+         <number>9000</number>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic