TelescopeControl.cpp   TelescopeControl.cpp 
skipping to change at line 89 skipping to change at line 89
info.authors = "Bogdan Marinov, Johannes Gajdosik"; info.authors = "Bogdan Marinov, Johannes Gajdosik";
info.contact = "http://stellarium.org"; info.contact = "http://stellarium.org";
info.description = N_("This plug-in allows Stellarium to send \"slew \" commands to a telescope on a computerized mount (a \"GoTo telescope\")." ); info.description = N_("This plug-in allows Stellarium to send \"slew \" commands to a telescope on a computerized mount (a \"GoTo telescope\")." );
info.version = TELESCOPE_CONTROL_VERSION; info.version = TELESCOPE_CONTROL_VERSION;
return info; return info;
} }
/////////////////////////////////////////////////////////////////////////// ///// /////////////////////////////////////////////////////////////////////////// /////
// Constructor and destructor // Constructor and destructor
TelescopeControl::TelescopeControl() TelescopeControl::TelescopeControl()
: toolbarButton(NULL) : toolbarButton(Q_NULLPTR)
, useTelescopeServerLogs(false) , useTelescopeServerLogs(false)
, useServerExecutables(false) , useServerExecutables(false)
, telescopeDialog(NULL) , telescopeDialog(Q_NULLPTR)
, slewDialog(NULL) , slewDialog(Q_NULLPTR)
, actionGroupId("PluginTelescopeControl") , actionGroupId("PluginTelescopeControl")
, moveToSelectedActionId("actionMove_Telescope_To_Selection_%1") , moveToSelectedActionId("actionMove_Telescope_To_Selection_%1")
, moveToCenterActionId("actionSlew_Telescope_To_Direction_%1") , moveToCenterActionId("actionSlew_Telescope_To_Direction_%1")
{ {
setObjectName("TelescopeControl"); setObjectName("TelescopeControl");
connectionTypeNames.insert(ConnectionVirtual, "virtual"); connectionTypeNames.insert(ConnectionVirtual, "virtual");
connectionTypeNames.insert(ConnectionInternal, "internal"); connectionTypeNames.insert(ConnectionInternal, "internal");
connectionTypeNames.insert(ConnectionLocal, "local"); connectionTypeNames.insert(ConnectionLocal, "local");
connectionTypeNames.insert(ConnectionRemote, "remote"); connectionTypeNames.insert(ConnectionRemote, "remote");
connectionTypeNames.insert(ConnectionRTS2, "RTS2");
} }
TelescopeControl::~TelescopeControl() TelescopeControl::~TelescopeControl()
{ {
} }
/////////////////////////////////////////////////////////////////////////// ///// /////////////////////////////////////////////////////////////////////////// /////
// Methods inherited from the StelModule class // Methods inherited from the StelModule class
// init(), update(), draw(), getCallOrder() // init(), update(), draw(), getCallOrder()
void TelescopeControl::init() void TelescopeControl::init()
skipping to change at line 189 skipping to change at line 190
this, SLOT(translateActionDescriptions())); this, SLOT(translateActionDescriptions()));
//Create and initialize dialog windows //Create and initialize dialog windows
telescopeDialog = new TelescopeDialog(); telescopeDialog = new TelescopeDialog();
slewDialog = new SlewDialog(); slewDialog = new SlewDialog();
addAction("actionShow_Slew_Window", N_("Telescope Control"), N_("Move a telescope to a given set of coordinates"), slewDialog, "visible ", "Ctrl+0"); addAction("actionShow_Slew_Window", N_("Telescope Control"), N_("Move a telescope to a given set of coordinates"), slewDialog, "visible ", "Ctrl+0");
//Create toolbar button //Create toolbar button
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui()); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui());
if (gui!=NULL) if (gui!=Q_NULLPTR)
{ {
toolbarButton = new StelButton(NULL, toolbarButton = new StelButton(Q_NULLPTR,
QPixmap(":/telescopeC ontrol/button_Slew_Dialog_on.png"), QPixmap(":/telescopeC ontrol/button_Slew_Dialog_on.png"),
QPixmap(":/telescopeC ontrol/button_Slew_Dialog_off.png"), QPixmap(":/telescopeC ontrol/button_Slew_Dialog_off.png"),
QPixmap(":/graphicGui /glow32x32.png"), QPixmap(":/graphicGui /glow32x32.png"),
"actionShow_Slew_Wind ow"); "actionShow_Slew_Wind ow");
gui->getButtonBar()->addButton(toolbarButton, "065-p luginsGroup"); gui->getButtonBar()->addButton(toolbarButton, "065-p luginsGroup");
} }
} }
catch (std::runtime_error &e) catch (std::runtime_error &e)
{ {
qWarning() << "[TelescopeControl] init() error: " << e.what( ); qWarning() << "[TelescopeControl] init() error: " << e.what( );
skipping to change at line 357 skipping to change at line 358
StelObjectP TelescopeControl::searchByName(const QString &name) const StelObjectP TelescopeControl::searchByName(const QString &name) const
{ {
foreach (const TelescopeClientP& telescope, telescopeClients) foreach (const TelescopeClientP& telescope, telescopeClients)
{ {
if (telescope->getEnglishName() == name) if (telescope->getEnglishName() == name)
return qSharedPointerCast<StelObject>(telescope); return qSharedPointerCast<StelObject>(telescope);
} }
return 0; return 0;
} }
QString TelescopeControl::getStelObjectType() const
{
return TelescopeClient::TELESCOPECLIENT_TYPE;
}
bool TelescopeControl::configureGui(bool show) bool TelescopeControl::configureGui(bool show)
{ {
if(show) if(show)
{ {
telescopeDialog->setVisible(true); telescopeDialog->setVisible(true);
} }
return true; return true;
} }
skipping to change at line 387 skipping to change at line 393
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
if (omgr->getSelectedObject().isEmpty()) if (omgr->getSelectedObject().isEmpty())
return; return;
StelObjectP selectObject = omgr->getSelectedObject().at(0); StelObjectP selectObject = omgr->getSelectedObject().at(0);
if (!selectObject) // should never happen if (!selectObject) // should never happen
return; return;
Vec3d objectPosition = selectObject->getJ2000EquatorialPos(StelApp:: getInstance().getCore()); Vec3d objectPosition = selectObject->getJ2000EquatorialPos(StelApp:: getInstance().getCore());
telescopeGoto(idx, objectPosition); telescopeGoto(idx, objectPosition, selectObject);
} }
void TelescopeControl::slewTelescopeToViewDirection(const int idx) void TelescopeControl::slewTelescopeToViewDirection(const int idx)
{ {
// Find out the coordinates of the target // Find out the coordinates of the target
Vec3d centerPosition = GETSTELMODULE(StelMovementMgr)->getViewDirect ionJ2000(); Vec3d centerPosition = GETSTELMODULE(StelMovementMgr)->getViewDirect ionJ2000();
telescopeGoto(idx, centerPosition); telescopeGoto(idx, centerPosition);
} }
skipping to change at line 423 skipping to change at line 429
const Vec3f& c(obj->getInfoColor()); const Vec3f& c(obj->getInfoColor());
sPainter.setColor(c[0], c[1], c[2]); sPainter.setColor(c[0], c[1], c[2]);
selectionTexture->bind(); selectionTexture->bind();
sPainter.setBlending(true); sPainter.setBlending(true);
sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 25., S telApp::getInstance().getTotalRunTime() * 40.); sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 25., S telApp::getInstance().getTotalRunTime() * 40.);
} }
#endif //COMPATIBILITY_001002 #endif //COMPATIBILITY_001002
} }
void TelescopeControl::telescopeGoto(int slotNumber, const Vec3d &j2000Pos) void TelescopeControl::telescopeGoto(int slotNumber, const Vec3d &j2000Pos, StelObjectP selectObject)
{ {
//TODO: See the original code. I think that something is wrong here. .. //TODO: See the original code. I think that something is wrong here. ..
if(telescopeClients.contains(slotNumber)) if(telescopeClients.contains(slotNumber))
telescopeClients.value(slotNumber)->telescopeGoto(j2000Pos); telescopeClients.value(slotNumber)->telescopeGoto(j2000Pos, selectObject);
} }
void TelescopeControl::communicate(void) void TelescopeControl::communicate(void)
{ {
if (!telescopeClients.empty()) if (!telescopeClients.empty())
{ {
QMap<int, TelescopeClientP>::const_iterator telescope = tele scopeClients.constBegin(); QMap<int, TelescopeClientP>::const_iterator telescope = tele scopeClients.constBegin();
while (telescope != telescopeClients.end()) while (telescope != telescopeClients.end())
{ {
logAtSlot(telescope.key());//If there's no log, it w ill be ignored logAtSlot(telescope.key());//If there's no log, it w ill be ignored
skipping to change at line 742 skipping to change at line 748
qDebug() << "[TelescopeControl] Unable to load teles cope: Invalid equinox value at slot" << key; qDebug() << "[TelescopeControl] Unable to load teles cope: Invalid equinox value at slot" << key;
map.remove(key); map.remove(key);
continue; continue;
} }
QString hostName("localhost"); QString hostName("localhost");
int portTCP = 0; int portTCP = 0;
int delay = 0; int delay = 0;
QString deviceModelName; QString deviceModelName;
QString portSerial; QString portSerial;
QString rts2Url("localhost");
QString rts2Username("");
QString rts2Password("");
if (connectionType == ConnectionInternal) if (connectionType == ConnectionInternal)
{ {
//Serial port and device model //Serial port and device model
deviceModelName = telescope.value("device_model").to String(); deviceModelName = telescope.value("device_model").to String();
portSerial = telescope.value("serial_port").toString (); portSerial = telescope.value("serial_port").toString ();
if(deviceModelName.isEmpty()) if(deviceModelName.isEmpty())
{ {
qDebug() << "[TelescopeControl] Unable to lo ad telescope: No device model specified at slot" << key; qDebug() << "[TelescopeControl] Unable to lo ad telescope: No device model specified at slot" << key;
skipping to change at line 785 skipping to change at line 794
//Validation: Host name //Validation: Host name
hostName = telescope.value("host_name").toString(); hostName = telescope.value("host_name").toString();
if(hostName.isEmpty()) if(hostName.isEmpty())
{ {
qDebug() << "[TelescopeControl] loadTelescop es(): No host name at slot" << key; qDebug() << "[TelescopeControl] loadTelescop es(): No host name at slot" << key;
map.remove(key); map.remove(key);
continue; continue;
} }
} }
if (connectionType != ConnectionVirtual) if (connectionType == ConnectionRTS2)
{ {
//Validation: TCP port //Validation: Host name
portTCP = telescope.value("tcp_port").toInt(); rts2Url = telescope.value("url").toString();
if(!telescope.contains("tcp_port") || !isValidPort(p if(rts2Url.isEmpty())
ortTCP))
{ {
qDebug() << "[TelescopeControl] Unable to lo ad telescope: No valid TCP port at slot" << key; qDebug() << "[TelescopeControl] loadTelescop es(): No URL at slot" << key;
map.remove(key); map.remove(key);
continue; continue;
} }
rts2Username = telescope.value("username").toString(
);
rts2Password = telescope.value("password").toString(
);
}
if (connectionType != ConnectionVirtual)
{
if (connectionType != ConnectionRTS2)
{
//Validation: TCP port
portTCP = telescope.value("tcp_port").toInt(
);
if(!telescope.contains("tcp_port") || !isVal
idPort(portTCP))
{
qDebug() << "[TelescopeControl] Unab
le to load telescope: No valid TCP port at slot" << key;
map.remove(key);
continue;
}
}
//Validation: Delay //Validation: Delay
delay = telescope.value("delay", 0).toInt(); delay = telescope.value("delay", 0).toInt();
if(!isValidDelay(delay)) if(!isValidDelay(delay))
{ {
qDebug() << "[TelescopeControl] Unable to lo ad telescope: No valid delay at slot" << key; qDebug() << "[TelescopeControl] Unable to lo ad telescope: No valid delay at slot" << key;
map.remove(key); map.remove(key);
continue; continue;
} }
} }
skipping to change at line 875 skipping to change at line 901
{ {
qDebug() << "[TelescopeContr ol] Unable to create a telescope client at slot" << slot; qDebug() << "[TelescopeContr ol] Unable to create a telescope client at slot" << slot;
//Unnecessary due to if-else construction; //Unnecessary due to if-else construction;
//also, causes bug #608533 //also, causes bug #608533
//continue; //continue;
} }
} }
} }
else else
{ {
if(!startClientAtSlot(slot, connectionType, name, equinox, hostName, portTCP, delay, internalCircles)) if(!startClientAtSlot(slot, connectionType, name, equinox, hostName, portTCP, delay, internalCircles, deviceModelName, portSerial, rts2Url, rts2Username, rts2Password))
{ {
qDebug() << "[TelescopeControl] Unab le to create a telescope client at slot" << slot; qDebug() << "[TelescopeControl] Unab le to create a telescope client at slot" << slot;
//Unnecessary due to if-else constru ction; //Unnecessary due to if-else constru ction;
//also, causes bug #608533 //also, causes bug #608533
//continue; //continue;
} }
} }
} }
//If this line is reached, the telescope at this slot has be en loaded successfully //If this line is reached, the telescope at this slot has be en loaded successfully
skipping to change at line 899 skipping to change at line 925
if(telescopesCount > 0) if(telescopesCount > 0)
{ {
result = map; result = map;
qDebug() << "[TelescopeControl] Loaded successfully" << tele scopesCount qDebug() << "[TelescopeControl] Loaded successfully" << tele scopesCount
<< "telescopes."; << "telescopes.";
} }
telescopeDescriptions = result; telescopeDescriptions = result;
} }
bool TelescopeControl::addTelescopeAtSlot(int slot, ConnectionType connecti onType, QString name, QString equinox, QString host, int portTCP, int delay , bool connectAtStartup, QList<double> circles, QString deviceModelName, QS tring portSerial) bool TelescopeControl::addTelescopeAtSlot(int slot, ConnectionType connecti onType, QString name, QString equinox, QString host, int portTCP, int delay , bool connectAtStartup, QList<double> circles, QString deviceModelName, QS tring portSerial, QString rts2Url, QString rts2Username, QString rts2Passwo rd)
{ {
//Validation //Validation
if(!isValidSlotNumber(slot) || name.isEmpty() || equinox.isEmpty() | | connectionType <= ConnectionNA || connectionType >= ConnectionCount) if(!isValidSlotNumber(slot) || name.isEmpty() || equinox.isEmpty() | | connectionType <= ConnectionNA || connectionType >= ConnectionCount)
return false; return false;
//Create a new map node and fill it with parameters //Create a new map node and fill it with parameters
QVariantMap telescope; QVariantMap telescope;
telescope.insert("name", name); telescope.insert("name", name);
telescope.insert("connection", connectionTypeNames.value(connectionT ype)); telescope.insert("connection", connectionTypeNames.value(connectionT ype));
telescope.insert("equinox", equinox);//TODO: Validation! telescope.insert("equinox", equinox);//TODO: Validation!
if (connectionType == ConnectionRemote) if (connectionType == ConnectionRemote)
{ {
//TODO: Add more validation! //TODO: Add more validation!
if (host.isEmpty()) if (host.isEmpty())
return false; return false;
telescope.insert("host_name", host); telescope.insert("host_name", host);
} }
if(connectionType == ConnectionRTS2)
{
if (rts2Url.isEmpty())
return false;
telescope.insert("url", rts2Url);
telescope.insert("username", rts2Username);
telescope.insert("password", rts2Password);
}
if(connectionType == ConnectionInternal) if(connectionType == ConnectionInternal)
{ {
if (!deviceModels.contains(deviceModelName)) if (!deviceModels.contains(deviceModelName))
return false; return false;
telescope.insert("device_model", deviceModelName); telescope.insert("device_model", deviceModelName);
if (portSerial.isEmpty()) if (portSerial.isEmpty())
return false; return false;
telescope.insert("serial_port", portSerial); telescope.insert("serial_port", portSerial);
} }
if (connectionType != ConnectionVirtual) if (connectionType != ConnectionVirtual)
{ {
if (!isValidPort(portTCP)) if (connectionType != ConnectionRTS2)
return false; {
telescope.insert("tcp_port", portTCP); if (!isValidPort(portTCP))
return false;
telescope.insert("tcp_port", portTCP);
}
if (!isValidDelay(delay)) if (!isValidDelay(delay))
return false; return false;
telescope.insert("delay", delay); telescope.insert("delay", delay);
} }
telescope.insert("connect_at_startup", connectAtStartup); telescope.insert("connect_at_startup", connectAtStartup);
if(!circles.isEmpty()) if(!circles.isEmpty())
{ {
skipping to change at line 956 skipping to change at line 994
for(int i = 0; i < circles.size(); i++) for(int i = 0; i < circles.size(); i++)
circleList.append(circles[i]); circleList.append(circles[i]);
telescope.insert("circles", circleList); telescope.insert("circles", circleList);
} }
telescopeDescriptions.insert(QString::number(slot), telescope); telescopeDescriptions.insert(QString::number(slot), telescope);
return true; return true;
} }
bool TelescopeControl::getTelescopeAtSlot(int slot, ConnectionType& connect ionType, QString& name, QString& equinox, QString& host, int& portTCP, int& delay, bool& connectAtStartup, QList<double>& circles, QString& deviceMode lName, QString& portSerial) bool TelescopeControl::getTelescopeAtSlot(int slot, ConnectionType& connect ionType, QString& name, QString& equinox, QString& host, int& portTCP, int& delay, bool& connectAtStartup, QList<double>& circles, QString& deviceMode lName, QString& portSerial, QString& rts2Url, QString& rts2Username, QStrin g& rts2Password)
{ {
//Validation //Validation
if(!isValidSlotNumber(slot)) if(!isValidSlotNumber(slot))
return false; return false;
//Read the node at that slot //Read the node at that slot
QVariantMap telescope = telescopeDescriptions.value(QString::number( slot)).toMap(); QVariantMap telescope = telescopeDescriptions.value(QString::number( slot)).toMap();
if(telescope.isEmpty()) if(telescope.isEmpty())
{ {
telescopeDescriptions.remove(QString::number(slot)); telescopeDescriptions.remove(QString::number(slot));
skipping to change at line 992 skipping to change at line 1030
circles.append(circleList.value(i, -1.0).toDouble()) ; circles.append(circleList.value(i, -1.0).toDouble()) ;
} }
QString connection = telescope.value("connection").toString(); QString connection = telescope.value("connection").toString();
connectionType = connectionTypeNames.key(connection, ConnectionVirtu al); connectionType = connectionTypeNames.key(connection, ConnectionVirtu al);
if(connectionType == ConnectionInternal) if(connectionType == ConnectionInternal)
{ {
deviceModelName = telescope.value("device_model").toString() ; deviceModelName = telescope.value("device_model").toString() ;
portSerial = telescope.value("serial_port").toString(); portSerial = telescope.value("serial_port").toString();
} }
if(connectionType == ConnectionRTS2)
{
rts2Url = telescope.value("url").toString();
rts2Username = telescope.value("username").toString();
rts2Password = telescope.value("password").toString();
}
return true; return true;
} }
bool TelescopeControl::removeTelescopeAtSlot(int slot) bool TelescopeControl::removeTelescopeAtSlot(int slot)
{ {
//Validation //Validation
if(!isValidSlotNumber(slot)) if(!isValidSlotNumber(slot))
return false; return false;
skipping to change at line 1022 skipping to change at line 1066
QString name; QString name;
QString equinox; QString equinox;
QString host; QString host;
ConnectionType connectionType; ConnectionType connectionType;
int portTCP; int portTCP;
int delay; int delay;
bool connectAtStartup; bool connectAtStartup;
QList<double> circles; QList<double> circles;
QString deviceModelName; QString deviceModelName;
QString portSerial; QString portSerial;
if(!getTelescopeAtSlot(slot, connectionType, name, equinox, host, po QString rts2Url;
rtTCP, delay, connectAtStartup, circles, deviceModelName, portSerial)) QString rts2Username;
QString rts2Password;
if(!getTelescopeAtSlot(slot, connectionType, name, equinox, host, po
rtTCP, delay, connectAtStartup, circles, deviceModelName, portSerial, rts2U
rl, rts2Username, rts2Password))
{ {
//TODO: Add debug //TODO: Add debug
return false; return false;
} }
if(connectionType == ConnectionInternal && !deviceModelName.isEmpty( )) if(connectionType == ConnectionInternal && !deviceModelName.isEmpty( ))
{ {
if(deviceModels[deviceModelName].useExecutable) if(deviceModels[deviceModelName].useExecutable)
{ {
if (startClientAtSlot(slot, connectionType, name, eq uinox, host, portTCP, delay, circles)) if (startClientAtSlot(slot, connectionType, name, eq uinox, host, portTCP, delay, circles))
skipping to change at line 1058 skipping to change at line 1105
logAtSlot(slot); logAtSlot(slot);
if (startClientAtSlot(slot, connectionType, name, eq uinox, QString(), 0, delay, circles, deviceModelName, portSerial)) if (startClientAtSlot(slot, connectionType, name, eq uinox, QString(), 0, delay, circles, deviceModelName, portSerial))
{ {
emit clientConnected(slot, name); emit clientConnected(slot, name);
return true; return true;
} }
} }
} }
else else
{ {
if (startClientAtSlot(slot, connectionType, name, equinox, h ost, portTCP, delay, circles)) if (startClientAtSlot(slot, connectionType, name, equinox, h ost, portTCP, delay, circles, deviceModelName, portSerial, rts2Url, rts2Use rname, rts2Password))
{ {
emit clientConnected(slot, name); emit clientConnected(slot, name);
return true; return true;
} }
} }
return false; return false;
} }
bool TelescopeControl::stopTelescopeAtSlot(int slot) bool TelescopeControl::stopTelescopeAtSlot(int slot)
skipping to change at line 1194 skipping to change at line 1241
telescopeServerProcess[slotNumber]->terminate(); telescopeServerProcess[slotNumber]->terminate();
#endif //Q_OS_WIN #endif //Q_OS_WIN
telescopeServerProcess[slotNumber]->waitForFinished(); telescopeServerProcess[slotNumber]->waitForFinished();
delete telescopeServerProcess[slotNumber]; delete telescopeServerProcess[slotNumber];
telescopeServerProcess.remove(slotNumber); telescopeServerProcess.remove(slotNumber);
return true; return true;
} }
bool TelescopeControl::startClientAtSlot(int slotNumber, ConnectionType con nectionType, QString name, QString equinox, QString host, int portTCP, int delay, QList<double> circles, QString deviceModelName, QString portSerial) bool TelescopeControl::startClientAtSlot(int slotNumber, ConnectionType con nectionType, QString name, QString equinox, QString host, int portTCP, int delay, QList<double> circles, QString deviceModelName, QString portSerial, QString rts2Url, QString rts2Username, QString rts2Password)
{ {
//Validation //Validation
if(!isValidSlotNumber(slotNumber)) if(!isValidSlotNumber(slotNumber))
return false; return false;
//Check if it's not already running //Check if it's not already running
//Should it return, or should it remove the old one and proceed? //Should it return, or should it remove the old one and proceed?
if(telescopeClients.contains(slotNumber)) if(telescopeClients.contains(slotNumber))
{ {
//TODO: Add debug. Update logic? //TODO: Add debug. Update logic?
skipping to change at line 1225 skipping to change at line 1272
case ConnectionInternal: case ConnectionInternal:
if(!deviceModelName.isEmpty() && !portSerial.isEmpty ()) if(!deviceModelName.isEmpty() && !portSerial.isEmpty ())
initString = QString("%1:%2:%3:%4:%5").arg(n ame, deviceModels[deviceModelName].server, equinox, portSerial, QString::nu mber(delay)); initString = QString("%1:%2:%3:%4:%5").arg(n ame, deviceModels[deviceModelName].server, equinox, portSerial, QString::nu mber(delay));
break; break;
case ConnectionLocal: case ConnectionLocal:
if (isValidPort(portTCP)) if (isValidPort(portTCP))
initString = QString("%1:TCP:%2:%3:%4:%5").a rg(name, equinox, "localhost", QString::number(portTCP), QString::number(de lay)); initString = QString("%1:TCP:%2:%3:%4:%5").a rg(name, equinox, "localhost", QString::number(portTCP), QString::number(de lay));
break; break;
case ConnectionRTS2:
if (!rts2Url.isEmpty())
initString = QString("%1:RTS2:%2:http://%3:%
4@%5").arg(name, equinox, rts2Username, rts2Password, rts2Url);
break;
case ConnectionRemote: case ConnectionRemote:
default: default:
if (isValidPort(portTCP) && !host.isEmpty()) if (isValidPort(portTCP) && !host.isEmpty())
initString = QString("%1:TCP:%2:%3:%4:%5").a rg(name, equinox, host, QString::number(portTCP), QString::number(delay)); initString = QString("%1:TCP:%2:%3:%4:%5").a rg(name, equinox, host, QString::number(portTCP), QString::number(delay));
} }
//qDebug() << "initString:" << initString; qDebug() << "connectionType:" << connectionType << " initString:" << initString;
TelescopeClient* newTelescope = TelescopeClient::create(initString); TelescopeClient* newTelescope = TelescopeClient::create(initString);
if (newTelescope) if (newTelescope)
{ {
//Add FOV circles to the client if there are any specified //Add FOV circles to the client if there are any specified
if(!circles.isEmpty() && circles.size() <= MAX_CIRCLE_COUNT) if(!circles.isEmpty() && circles.size() <= MAX_CIRCLE_COUNT)
for (int i = 0; i < circles.size(); ++i) for (int i = 0; i < circles.size(); ++i)
newTelescope->addOcular(circles[i]); newTelescope->addOcular(circles[i]);
telescopeClients.insert(slotNumber, TelescopeClientP(newTele scope)); telescopeClients.insert(slotNumber, TelescopeClientP(newTele scope));
skipping to change at line 1550 skipping to change at line 1602
telescopeServerLogStreams.remove(slot); telescopeServerLogStreams.remove(slot);
telescopeServerLogFiles.remove(slot); telescopeServerLogFiles.remove(slot);
} }
} }
void TelescopeControl::logAtSlot(int slot) void TelescopeControl::logAtSlot(int slot)
{ {
if(telescopeServerLogStreams.contains(slot)) if(telescopeServerLogStreams.contains(slot))
log_file = telescopeServerLogStreams.value(slot); log_file = telescopeServerLogStreams.value(slot);
} }
QStringList TelescopeControl::listMatchingObjects(const QString& objPrefix,
int maxNbItem, bool useStartOfWords, bool inEnglish) const
{
QStringList result;
if (maxNbItem<=0)
return result;
QString tn;
bool find;
foreach (const TelescopeClientP& telescope, telescopeClients)
{
tn = inEnglish ? telescope->getEnglishName() : telescope->ge
tNameI18n();
find = false;
if (useStartOfWords)
{
if (objPrefix.toUpper()==tn.mid(0, objPrefix.size())
.toUpper())
find = true;
}
else
{
if (tn.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{
result << tn;
}
}
result.sort();
if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end());
return result;
}
void TelescopeControl::translations()
{
#if 0
// TRANSLATORS: Description for Meade AutoStar compatible mounts
N_("Any telescope or telescope mount compatible with Meade's AutoSta
r controller.")
// TRANSLATORS: Description for Meade LX200 (compatible) mounts
N_("Any telescope or telescope mount compatible with Meade LX200.")
// TRANSLATORS: Description for Meade ETX70 (#494 Autostar, #506 CCS
) mounts
N_("Meade's ETX70 with the #494 Autostar controller and the #506 Con
nector Cable Set.")
// TRANSLATORS: Description for Losmandy G-11 mounts
N_("Losmandy's G-11 telescope mount.")
// TRANSLATORS: Description for Wildcard Innovations Argo Navis (Mea
de mode) mounts
N_("Wildcard Innovations' Argo Navis DTC in Meade LX200 emulation mo
de.")
// TRANSLATORS: Description for Celestron NexStar (compatible) mount
s
N_("Any telescope or telescope mount compatible with Celestron NexSt
ar.")
// TRANSLATORS: Description for Sky-Watcher SynScan (version 3 or la
ter) mounts
N_("Any Sky-Watcher mount that uses version 3 or later of the SynSca
n hand controller.")
// TRANSLATORS: Description for Sky-Watcher SynScan AZ GOTO mounts
N_("The Sky-Watcher SynScan AZ GOTO mount used in a number of telesc
ope models.")
#endif
}
 End of changes. 26 change blocks. 
25 lines changed or deleted 83 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/