TelescopeControl.cpp   TelescopeControl.cpp 
skipping to change at line 25 skipping to change at line 25
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "TelescopeControl.hpp" #include "TelescopeControl.hpp"
#include "TelescopeClient.hpp" #include "TelescopeClient.hpp"
#include "TelescopeDialog.hpp" #include "TelescopeDialog.hpp"
#include "SlewDialog.hpp" #include "SlewDialog.hpp"
#include "LogFile.hpp" #include "LogFile.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
skipping to change at line 75 skipping to change at line 75
return new TelescopeControl(); return new TelescopeControl();
} }
StelPluginInfo TelescopeControlStelPluginInterface::getPluginInfo() const StelPluginInfo TelescopeControlStelPluginInterface::getPluginInfo() const
{ {
// Allow to load the resources when used as a static plugin // Allow to load the resources when used as a static plugin
Q_INIT_RESOURCE(TelescopeControl); Q_INIT_RESOURCE(TelescopeControl);
StelPluginInfo info; StelPluginInfo info;
info.id = "TelescopeControl"; info.id = "TelescopeControl";
info.displayedName = q_("Telescope Control"); info.displayedName = N_("Telescope Control");
info.authors = "Bogdan Marinov, Johannes Gajdosik"; info.authors = "Bogdan Marinov, Johannes Gajdosik";
info.contact = "http://stellarium.org"; info.contact = "http://stellarium.org";
info.description = q_("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\")." );
return info; return info;
} }
Q_EXPORT_PLUGIN2(TelescopeControl, TelescopeControlStelPluginInterface) Q_EXPORT_PLUGIN2(TelescopeControl, TelescopeControlStelPluginInterface)
/////////////////////////////////////////////////////////////////////////// ///// /////////////////////////////////////////////////////////////////////////// /////
// Constructor and destructor // Constructor and destructor
TelescopeControl::TelescopeControl() TelescopeControl::TelescopeControl()
{ {
setObjectName("TelescopeControl"); setObjectName("TelescopeControl");
skipping to change at line 641 skipping to change at line 641
//Open/create the JSON file //Open/create the JSON file
QString telescopesJsonPath = StelFileMgr::findFile("modules/ TelescopeControl", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr: :Writable)) + "/telescopes.json"; QString telescopesJsonPath = StelFileMgr::findFile("modules/ TelescopeControl", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr: :Writable)) + "/telescopes.json";
QFile telescopesJsonFile(telescopesJsonPath); QFile telescopesJsonFile(telescopesJsonPath);
if(!telescopesJsonFile.open(QFile::WriteOnly|QFile::Text)) if(!telescopesJsonFile.open(QFile::WriteOnly|QFile::Text))
{ {
qWarning() << "TelescopeControl: Telescopes can not be saved. A file can not be open for writing:" << telescopesJsonPath; qWarning() << "TelescopeControl: Telescopes can not be saved. A file can not be open for writing:" << telescopesJsonPath;
return; return;
} }
//Add the version: //Add the version:
telescopeDescriptions.insert("version", QString(PLUGIN_VERSI ON)); telescopeDescriptions.insert("version", QString(TELESCOPE_CO NTROL_VERSION));
//Convert the tree to JSON //Convert the tree to JSON
StelJsonParser::write(telescopeDescriptions, &telescopesJson File); StelJsonParser::write(telescopeDescriptions, &telescopesJson File);
telescopesJsonFile.flush();//Is this necessary? telescopesJsonFile.flush();//Is this necessary?
telescopesJsonFile.close(); telescopesJsonFile.close();
} }
catch(std::runtime_error &e) catch(std::runtime_error &e)
{ {
qWarning() << "TelescopeControl: Error saving telescopes: " << e.what(); qWarning() << "TelescopeControl: Error saving telescopes: " << e.what();
return; return;
skipping to change at line 693 skipping to change at line 693
} }
//File contains any telescopes? //File contains any telescopes?
if(map.isEmpty()) if(map.isEmpty())
{ {
telescopeDescriptions = result; telescopeDescriptions = result;
return; return;
} }
QString version = map.value("version", "0.0.0").toString(); QString version = map.value("version", "0.0.0").toString();
if(version < QString(PLUGIN_VERSION)) if(version < QString(TELESCOPE_CONTROL_VERSION))
{ {
QString newName = telescopesJsonPath + ".backup." + QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss"); QString newName = telescopesJsonPath + ".backup." + QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss");
if(telescopesJsonFile.rename(newName)) if(telescopesJsonFile.rename(newName))
{ {
qWarning() << "TelescopeControl: The existin g version of telescopes.json is obsolete. Backing it up as" << newName; qWarning() << "TelescopeControl: The existin g version of telescopes.json is obsolete. Backing it up as" << newName;
qWarning() << "TelescopeControl: A blank tel escopes.json file will have to be created."; qWarning() << "TelescopeControl: A blank tel escopes.json file will have to be created.";
telescopeDescriptions = result; telescopeDescriptions = result;
return; return;
} }
else else
skipping to change at line 1340 skipping to change at line 1340
{ {
qWarning() << "TelescopeControl: Can't open for read ing" << deviceModelsJsonPath; qWarning() << "TelescopeControl: Can't open for read ing" << deviceModelsJsonPath;
useDefaultList = true; useDefaultList = true;
} }
else else
{ {
//Check the version and move the old file if necessa ry //Check the version and move the old file if necessa ry
QVariantMap deviceModelsJsonMap; QVariantMap deviceModelsJsonMap;
deviceModelsJsonMap = StelJsonParser::parse(&deviceM odelsJsonFile).toMap(); deviceModelsJsonMap = StelJsonParser::parse(&deviceM odelsJsonFile).toMap();
QString version = deviceModelsJsonMap.value("version ", "0.0.0").toString(); QString version = deviceModelsJsonMap.value("version ", "0.0.0").toString();
if(version < QString(PLUGIN_VERSION)) if(version < QString(TELESCOPE_CONTROL_VERSION))
{ {
deviceModelsJsonFile.close(); deviceModelsJsonFile.close();
QString newName = deviceModelsJsonPath + ".b ackup." + QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss"); QString newName = deviceModelsJsonPath + ".b ackup." + QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss");
if(deviceModelsJsonFile.rename(newName)) if(deviceModelsJsonFile.rename(newName))
{ {
qWarning() << "TelescopeControl: The existing version of device_models.json is obsolete. Backing it up as" << n ewName; qWarning() << "TelescopeControl: The existing version of device_models.json is obsolete. Backing it up as" << n ewName;
if(!restoreDeviceModelsListTo(device ModelsJsonPath)) if(!restoreDeviceModelsListTo(device ModelsJsonPath))
{ {
useDefaultList = true; useDefaultList = true;
} }
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 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/