[Kstars-devel] KDE/kdeedu/kstars/kstars/indi
Jasem Mutlaq
mutlaqja at ikarustech.com
Thu May 28 01:36:55 CEST 2009
SVN commit 973851 by mutlaqja:
Using QueuedConnection to permit proper cleanup of the device manager in case of errors. Furthermore, using QTcpserver instead of KDE3 sockets to find suitable sockets for INDI server. Removing unnecessary debug statements.
CCMAIL:kstars-devel at kde.org
M +1 -3 devicemanager.cpp
M +10 -26 indidriver.cpp
M +1 -1 indimenu.cpp
M +1 -6 indistd.cpp
--- trunk/KDE/kdeedu/kstars/kstars/indi/devicemanager.cpp #973850:973851
@@ -128,8 +128,6 @@
void DeviceManager::connectionSuccess()
{
- kDebug() << "Connection success!!";
-
QTextStream serverFP(&serverSocket);
foreach (IDevice *device, managed_devices)
@@ -346,7 +344,7 @@
indi_dev.append(dp);
emit newDevice(dp);
- connect(dp->stdDev, SIGNAL(newTelescope()), parent->ksw->indiDriver(), SLOT(newTelescopeDiscovered()));
+ connect(dp->stdDev, SIGNAL(newTelescope()), parent->ksw->indiDriver(), SLOT(newTelescopeDiscovered()), Qt::QueuedConnection);
/* ok */
return dp;
--- trunk/KDE/kdeedu/kstars/kstars/indi/indidriver.cpp #973850:973851
@@ -28,6 +28,7 @@
#include <QTreeWidget>
#include <QIcon>
#include <QDialog>
+#include <QTcpServer>
#include <KMenu>
#include <KMessageBox>
@@ -39,7 +40,6 @@
#include <KIconLoader>
#include <kstandarddirs.h>
-#include <k3serversocket.h>
#include "indimenu.h"
#include "ui_indihostconf.h"
@@ -375,8 +375,6 @@
void INDIDriver::updateMenuActions()
{
-
-
// We iterate over devices, we enable INDI Control Panel if we have any active device
// We enable capture image sequence if we have any imaging device
@@ -406,30 +404,16 @@
}
}
+
tmpAction = ksw->actionCollection()->action("capture_sequence");
if (tmpAction != NULL)
tmpAction->setEnabled(activeImaging);
- tmpAction = NULL;
tmpAction = ksw->actionCollection()->action("indi_cpl");
if (tmpAction != NULL)
- tmpAction->setEnabled(activeDevice);
-#if 0
- /* FIXME The following seems to cause a crash in KStars when we use
- the telescope wizard to automatically search for scopes. I can't
- find any correlation! */
+ tmpAction->setEnabled(activeDevice);
- // Troubled Code START
- tmpAction = ksw->actionCollection()->action("indi_cpl");
- if (!tmpAction)
- kDebug() << "Warning: indi_cpl action not found";
- else
- tmpAction->setEnabled(activeDevice);
- // Troubled Code END
-#endif
-
-
}
void INDIDriver::saveDevicesToDisk()
@@ -554,15 +538,13 @@
// recycle
if (currentPort > lastPort) currentPort = Options::serverPortStart().toInt();
- KNetwork::KServerSocket ss;
- ss.setFamily(KNetwork::KResolver::InetFamily);
+ QTcpServer temp_server;
for(; currentPort <= lastPort; currentPort++)
{
- ss.setAddress( QString::number( currentPort ) );
- bool success = ss.listen();
- if(success && ss.error() == KNetwork::KSocketBase::NoError )
+ bool success = temp_server.listen(QHostAddress::LocalHost, currentPort);
+ if(success)
{
- ss.close();
+ temp_server.close();
return currentPort;
}
}
@@ -583,6 +565,7 @@
return false;
}
+ indiDir.setNameFilters(QStringList("*.xml"));
indiDir.setFilter(QDir::Files | QDir::NoSymLinks);
QFileInfoList list = indiDir.entryInfoList();
@@ -605,6 +588,7 @@
return;
}
+ kDebug() << "Processing driver: " << driverName << endl;
char errmsg[1024];
char c;
LilXML *xmlParser = newLilXML();
@@ -623,7 +607,7 @@
}
else if (errmsg[0])
{
- kDebug() << QString(errmsg);
+ kDebug() << QString(errmsg) << endl;
delLilXML(xmlParser);
return;
}
--- trunk/KDE/kdeedu/kstars/kstars/indi/indimenu.cpp #973850:973851
@@ -137,7 +137,7 @@
{
foreach(INDI_D *device, deviceManager->indi_dev)
ksw->indiDriver()->disableDevice(device);
- //ksw->indiDriver()->shutDeviceManager(deviceManager);
+
delete managers.takeAt(i);
}
}
--- trunk/KDE/kdeedu/kstars/kstars/indi/indistd.cpp #973850:973851
@@ -650,6 +650,7 @@
break;
case EQUATORIAL_EOD_COORD:
+ case HORIZONTAL_COORD:
emit newTelescope();
break;
@@ -667,8 +668,6 @@
INDI_P *prop;
- //initDevCounter = 0;
-
if ( Options::useTimeUpdate() && Options::useComputerSource())
{
prop = dp->findProp("TIME_UTC");
@@ -676,7 +675,6 @@
{
driverTimeUpdated = false;
updateTime();
- //initDevCounter += 5;
}
}
@@ -687,7 +685,6 @@
{
driverLocationUpdated = false;
updateLocation();
- //initDevCounter += 2;
}
}
@@ -905,12 +902,10 @@
if (device->deviceType == KSTARS_TELESCOPE)
{
Options::setTelescopePort( lp->text );
- kDebug() << "Setting telescope port " << lp->text;
}
else if (device->deviceType == KSTARS_VIDEO)
{
Options::setVideoPort( lp->text );
- kDebug() << "Setting video port " << lp->text;
}
break;
}
More information about the Kstars-devel
mailing list