Commit 888eb178 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Read indidrivers.xml as the first file. Silenty ignore replicas. Do not allow...

Read indidrivers.xml as the first file. Silenty ignore replicas. Do not allow device manager to start INDI services for remote drivers
parent 9b7303a8
...@@ -152,7 +152,6 @@ DriverManager::~DriverManager() ...@@ -152,7 +152,6 @@ DriverManager::~DriverManager()
void DriverManager::processDeviceStatus(DriverInfo * dv) void DriverManager::processDeviceStatus(DriverInfo * dv)
{ {
if (dv == NULL) if (dv == NULL)
return; return;
...@@ -172,28 +171,33 @@ void DriverManager::processDeviceStatus(DriverInfo * dv) ...@@ -172,28 +171,33 @@ void DriverManager::processDeviceStatus(DriverInfo * dv)
foreach (QTreeWidgetItem * item, ui->localTreeWidget->findItems(dv->getTreeLabel(), Qt::MatchExactly | Qt::MatchRecursive)) foreach (QTreeWidgetItem * item, ui->localTreeWidget->findItems(dv->getTreeLabel(), Qt::MatchExactly | Qt::MatchRecursive))
{ {
item->setText(LOCAL_VERSION_COLUMN, dv->getVersion()); item->setText(LOCAL_VERSION_COLUMN, dv->getVersion());
if (manager) if (manager)
mode = manager->getMode(); mode = manager->getMode();
dState = dv->getServerState(); dState = dv->getServerState();
cState = dv->getClientState() && dState; cState = dv->getClientState() && dState;
bool locallyAvailable=false; bool locallyAvailable=false;
if (dv->getAuxInfo().contains("LOCALLY_AVAILABLE")) if (dv->getAuxInfo().contains("LOCALLY_AVAILABLE"))
locallyAvailable = dv->getAuxInfo().value("LOCALLY_AVAILABLE", false).toBool(); locallyAvailable = dv->getAuxInfo().value("LOCALLY_AVAILABLE", false).toBool();
switch (mode) switch (mode)
{ {
case SERVER_ONLY: case SERVER_ONLY:
ui->runServiceB->setEnabled(!dState);
ui->stopServiceB->setEnabled(dState);
if(locallyAvailable) if(locallyAvailable)
{
ui->runServiceB->setEnabled(!dState);
ui->stopServiceB->setEnabled(dState);
item->setIcon(LOCAL_STATUS_COLUMN, dState ? ui->runningPix : ui->stopPix); item->setIcon(LOCAL_STATUS_COLUMN, dState ? ui->runningPix : ui->stopPix);
}
else
{
ui->runServiceB->setEnabled(false);
ui->stopServiceB->setEnabled(false);
}
if (dState) if (dState)
{ {
item->setIcon(LOCAL_MODE_COLUMN, ui->serverMode); item->setIcon(LOCAL_MODE_COLUMN, ui->serverMode);
...@@ -208,11 +212,19 @@ void DriverManager::processDeviceStatus(DriverInfo * dv) ...@@ -208,11 +212,19 @@ void DriverManager::processDeviceStatus(DriverInfo * dv)
break; break;
case SERVER_CLIENT: case SERVER_CLIENT:
ui->runServiceB->setEnabled(!cState);
ui->stopServiceB->setEnabled(cState);
if(locallyAvailable) if(locallyAvailable)
{
ui->runServiceB->setEnabled(!cState);
ui->stopServiceB->setEnabled(cState);
item->setIcon(LOCAL_STATUS_COLUMN, cState ? ui->runningPix : ui->stopPix); item->setIcon(LOCAL_STATUS_COLUMN, cState ? ui->runningPix : ui->stopPix);
}
else
{
ui->runServiceB->setEnabled(false);
ui->stopServiceB->setEnabled(false);
}
if (cState) if (cState)
{ {
item->setIcon(LOCAL_MODE_COLUMN, ui->localMode); item->setIcon(LOCAL_MODE_COLUMN, ui->localMode);
...@@ -952,6 +964,11 @@ bool DriverManager::readXMLDrivers() ...@@ -952,6 +964,11 @@ bool DriverManager::readXMLDrivers()
QDir indiDir; QDir indiDir;
QString driverName; QString driverName;
// This is the XML file shipped with KStars that contains all supported INDI drivers.
QString indiDriversXML = KSPaths::locate(QStandardPaths::GenericDataLocation, "indidrivers.xml");
if (indiDriversXML.isEmpty() == false)
processXMLDriver(indiDriversXML);
QString driversDir=Options::indiDriversDir(); QString driversDir=Options::indiDriversDir();
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
if(Options::indiDriversAreInternal()) if(Options::indiDriversAreInternal())
...@@ -1138,7 +1155,6 @@ bool DriverManager::buildDriverElement(XMLEle * root, QTreeWidgetItem * DGroup, ...@@ -1138,7 +1155,6 @@ bool DriverManager::buildDriverElement(XMLEle * root, QTreeWidgetItem * DGroup,
QVariantMap vMap; QVariantMap vMap;
double focal_length (-1), aperture (-1); double focal_length (-1), aperture (-1);
ap = findXMLAtt(root, "label"); ap = findXMLAtt(root, "label");
if (!ap) if (!ap)
{ {
...@@ -1148,6 +1164,10 @@ bool DriverManager::buildDriverElement(XMLEle * root, QTreeWidgetItem * DGroup, ...@@ -1148,6 +1164,10 @@ bool DriverManager::buildDriverElement(XMLEle * root, QTreeWidgetItem * DGroup,
label = valuXMLAtt(ap); label = valuXMLAtt(ap);
// Label is unique, so if we have the same label, we simply ignore
if (findDriverByLabel(label) != NULL)
return true;
// Search for optional port attribute // Search for optional port attribute
ap = findXMLAtt(root, "port"); ap = findXMLAtt(root, "port");
if (ap) if (ap)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment