MpcImportWindow.cpp   MpcImportWindow.cpp 
skipping to change at line 334 skipping to change at line 334
void MpcImportWindow::pasteClipboardURL() void MpcImportWindow::pasteClipboardURL()
{ {
ui->lineEditURL->setText(QGuiApplication::clipboard()->text()); ui->lineEditURL->setText(QGuiApplication::clipboard()->text());
} }
void MpcImportWindow::selectFile() void MpcImportWindow::selectFile()
{ {
QStringList directories = QStandardPaths::standardLocations(QStandar dPaths::DesktopLocation) + QStringList directories = QStandardPaths::standardLocations(QStandar dPaths::DesktopLocation) +
QStandardPaths::st andardLocations(QStandardPaths::HomeLocation) << "/"; QStandardPaths::st andardLocations(QStandardPaths::HomeLocation) << "/";
QString filePath = QFileDialog::getOpenFileName(Q_NULLPTR, "Select a text file", directories[0]); QString filePath = QFileDialog::getOpenFileName(Q_NULLPTR, q_("Selec t a text file"), directories[0]);
ui->lineEditFilePath->setText(filePath); ui->lineEditFilePath->setText(filePath);
} }
void MpcImportWindow::bookmarkSelected(QString bookmarkTitle) void MpcImportWindow::bookmarkSelected(QString bookmarkTitle)
{ {
if (bookmarkTitle.isEmpty() || bookmarks.value(importType).value(boo kmarkTitle).isEmpty()) if (bookmarkTitle.isEmpty() || bookmarks.value(importType).value(boo kmarkTitle).isEmpty())
{ {
ui->lineEditURL->clear(); ui->lineEditURL->clear();
return; return;
} }
QString bookmarkUrl = bookmarks.value(importType).value(bookmarkTitl e); QString bookmarkUrl = bookmarks.value(importType).value(bookmarkTitl e);
ui->lineEditURL->setText(bookmarkUrl); ui->lineEditURL->setText(bookmarkUrl);
} }
void MpcImportWindow::populateCandidateObjects(QList<SsoElements> objects) void MpcImportWindow::populateCandidateObjects(QList<SsoElements> objects)
{ {
candidatesForAddition.clear(); candidatesForAddition.clear();
//Get a list of the current objects //Get a list of the current objects
QHash<QString,QString> defaultSsoIdentifiers = ssoManager->getDefaul tSsoIdentifiers(); //QHash<QString,QString> defaultSsoIdentifiers = ssoManager->getDefa ultSsoIdentifiers();
QHash<QString,QString> loadedSsoIdentifiers = ssoManager->listAllLoa dedSsoIdentifiers(); QHash<QString,QString> loadedSsoIdentifiers = ssoManager->listAllLoa dedSsoIdentifiers();
//Separating the objects into visual groups in the list //Separating the objects into visual groups in the list
int newDefaultSsoIndex = 0; //int newDefaultSsoIndex = 0;
int newLoadedSsoIndex = 0; int newLoadedSsoIndex = 0;
int newNovelSsoIndex = 0; int newNovelSsoIndex = 0;
int insertionIndex = 0; int insertionIndex = 0;
QStandardItemModel * model = candidateObjectsModel; QStandardItemModel * model = candidateObjectsModel;
model->clear(); model->clear();
model->setColumnCount(1); model->setColumnCount(1);
foreach (SsoElements object, objects) foreach (SsoElements object, objects)
{ {
skipping to change at line 392 skipping to change at line 392
name.append('*'); name.append('*');
object.insert("name", name); object.insert("name", name);
} }
} }
QStandardItem * item = new QStandardItem(); QStandardItem * item = new QStandardItem();
item->setText(name); item->setText(name);
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setCheckState(Qt::Unchecked); item->setCheckState(Qt::Unchecked);
if (defaultSsoIdentifiers.contains(name)) // if (defaultSsoIdentifiers.contains(name))
{ // {
//Duplicate of a default solar system object // //Duplicate of a default solar system object
QFont itemFont(item->font()); // QFont itemFont(item->font());
itemFont.setBold(true); // itemFont.setBold(true);
item->setFont(itemFont); // item->setFont(itemFont);
candidatesForUpdate.append(object); // candidatesForUpdate.append(object);
insertionIndex = newDefaultSsoIndex; // insertionIndex = newDefaultSsoIndex;
newDefaultSsoIndex++; // newDefaultSsoIndex++;
newLoadedSsoIndex++; // newLoadedSsoIndex++;
newNovelSsoIndex++; // newNovelSsoIndex++;
} // }
else if (loadedSsoIdentifiers.contains(name)) // else
if (loadedSsoIdentifiers.contains(name))
{ {
//Duplicate of another existing object //Duplicate of another existing object
QFont itemFont(item->font()); QFont itemFont(item->font());
itemFont.setItalic(true); itemFont.setItalic(true);
item->setFont(itemFont); item->setFont(itemFont);
candidatesForUpdate.append(object); candidatesForUpdate.append(object);
insertionIndex = newLoadedSsoIndex; insertionIndex = newLoadedSsoIndex;
newLoadedSsoIndex++; newLoadedSsoIndex++;
skipping to change at line 626 skipping to change at line 627
disconnect(networkManager, SIGNAL(finished(QNetworkReply*)), this, S LOT(downloadComplete(QNetworkReply*))); disconnect(networkManager, SIGNAL(finished(QNetworkReply*)), this, S LOT(downloadComplete(QNetworkReply*)));
deleteDownloadProgressBar(); deleteDownloadProgressBar();
ui->pushButtonAbortDownload->setVisible(false); ui->pushButtonAbortDownload->setVisible(false);
/* /*
qDebug() << "reply->isOpen():" << reply->isOpen() qDebug() << "reply->isOpen():" << reply->isOpen()
<< "reply->isReadable():" << reply->isReadable() << "reply->isReadable():" << reply->isReadable()
<< "reply->isFinished():" << reply->isFinished(); << "reply->isFinished():" << reply->isFinished();
*/ */
if(reply->error()) if(reply->error() || reply->bytesAvailable()==0)
{ {
qWarning() << "Download error: While downloading" qWarning() << "Download error: While downloading"
<< reply->url().toString() << reply->url().toString()
<< "the following error occured:" << "the following error occured:"
<< reply->errorString(); << reply->errorString();
enableInterface(true); enableInterface(true);
reply->deleteLater(); reply->deleteLater();
downloadReply = Q_NULLPTR; downloadReply = Q_NULLPTR;
return; return;
} }
skipping to change at line 812 skipping to change at line 813
queryReply = 0; queryReply = 0;
sendQueryToUrl(redirectUrl); sendQueryToUrl(redirectUrl);
return; return;
} }
deleteQueryProgressBar(); deleteQueryProgressBar();
//Hide the abort button - a reply has been received //Hide the abort button - a reply has been received
ui->pushButtonAbortQuery->setVisible(false); ui->pushButtonAbortQuery->setVisible(false);
if (reply->error()) if (reply->error() || reply->bytesAvailable()==0)
{ {
qWarning() << "Download error: While trying to access" qWarning() << "Download error: While trying to access"
<< reply->url().toString() << reply->url().toString()
<< "the following error occured:" << "the following error occured:"
<< reply->errorString(); << reply->errorString();
ui->labelQueryMessage->setText(reply->errorString());//TODO: Decide if this is a good idea ui->labelQueryMessage->setText(reply->errorString());//TODO: Decide if this is a good idea
ui->labelQueryMessage->setVisible(true); ui->labelQueryMessage->setVisible(true);
enableInterface(true); enableInterface(true);
reply->deleteLater(); reply->deleteLater();
skipping to change at line 988 skipping to change at line 989
QString fileVersion = jsonRoot.value("version").toSt ring(); QString fileVersion = jsonRoot.value("version").toSt ring();
if (fileVersion.isEmpty()) if (fileVersion.isEmpty())
fileVersion = "0.0.0"; fileVersion = "0.0.0";
loadBookmarksGroup(jsonRoot.value("mpcMinorPlanets") .toMap(), bookmarks[MpcMinorPlanets]); loadBookmarksGroup(jsonRoot.value("mpcMinorPlanets") .toMap(), bookmarks[MpcMinorPlanets]);
loadBookmarksGroup(jsonRoot.value("mpcComets").toMap (), bookmarks[MpcComets]); loadBookmarksGroup(jsonRoot.value("mpcComets").toMap (), bookmarks[MpcComets]);
bookmarksFile.close(); bookmarksFile.close();
//If nothing was read, continue //If nothing was read, continue
if (!bookmarks.value(MpcComets).isEmpty() && !bookma rks[MpcMinorPlanets].isEmpty() && StelUtils::compareVersions(fileVersion, S OLARSYSTEMEDITOR_VERSION)==0) if (!bookmarks.value(MpcComets).isEmpty() && !bookma rks[MpcMinorPlanets].isEmpty() && StelUtils::compareVersions(fileVersion, S OLARSYSTEMEDITOR_PLUGIN_VERSION)==0)
return; return;
} }
} }
qDebug() << "Bookmarks file can't be read. Hard-coded bookmarks will be used."; qDebug() << "Bookmarks file can't be read. Hard-coded bookmarks will be used.";
//Initialize with hard-coded values //Initialize with hard-coded values
bookmarks[MpcMinorPlanets].insert("MPC's list of bright minor planet bookmarks[MpcMinorPlanets].insert("MPC's list of bright minor planet
s at opposition in 2016", "http://www.minorplanetcenter.net/iau/Ephemerides s at opposition in 2017", "http://www.minorplanetcenter.net/iau/Ephemerides
/Bright/2016/Soft00Bright.txt"); /Bright/2017/Soft00Bright.txt");
bookmarks[MpcMinorPlanets].insert("MPC's list of observable critical
-list numbered minor planets", "http://www.minorplanetcenter.net/iau/Epheme
rides/CritList/Soft00CritList.txt");
bookmarks[MpcMinorPlanets].insert("MPC's list of observable distant minor planets", "http://www.minorplanetcenter.net/iau/Ephemerides/Distant/S oft00Distant.txt"); bookmarks[MpcMinorPlanets].insert("MPC's list of observable distant minor planets", "http://www.minorplanetcenter.net/iau/Ephemerides/Distant/S oft00Distant.txt");
bookmarks[MpcMinorPlanets].insert("MPC's list of observable unusual minor planets", "http://www.minorplanetcenter.net/iau/Ephemerides/Unusual/S oft00Unusual.txt");
bookmarks[MpcMinorPlanets].insert("MPCORB: near-Earth asteroids (NEA s)", "http://www.minorplanetcenter.net/iau/MPCORB/NEA.txt"); bookmarks[MpcMinorPlanets].insert("MPCORB: near-Earth asteroids (NEA s)", "http://www.minorplanetcenter.net/iau/MPCORB/NEA.txt");
bookmarks[MpcMinorPlanets].insert("MPCORB: potentially hazardous ast eroids (PHAs)", "http://www.minorplanetcenter.net/iau/MPCORB/PHA.txt"); bookmarks[MpcMinorPlanets].insert("MPCORB: potentially hazardous ast eroids (PHAs)", "http://www.minorplanetcenter.net/iau/MPCORB/PHA.txt");
bookmarks[MpcMinorPlanets].insert("MPCORB: TNOs, Centaurs and SDOs", "http://www.minorplanetcenter.net/iau/MPCORB/Distant.txt"); bookmarks[MpcMinorPlanets].insert("MPCORB: TNOs, Centaurs and SDOs", "http://www.minorplanetcenter.net/iau/MPCORB/Distant.txt");
bookmarks[MpcMinorPlanets].insert("MPCORB: other unusual objects", " http://www.minorplanetcenter.net/iau/MPCORB/Unusual.txt"); bookmarks[MpcMinorPlanets].insert("MPCORB: other unusual objects", " http://www.minorplanetcenter.net/iau/MPCORB/Unusual.txt");
bookmarks[MpcMinorPlanets].insert("MPCORB: orbits from the latest DO U MPEC", "http://www.minorplanetcenter.net/iau/MPCORB/DAILY.DAT"); bookmarks[MpcMinorPlanets].insert("MPCORB: orbits from the latest DO U MPEC", "http://www.minorplanetcenter.net/iau/MPCORB/DAILY.DAT");
bookmarks[MpcMinorPlanets].insert("MPCORB: elements of NEAs for curr ent epochs (today)", "http://www.minorplanetcenter.net/iau/MPCORB/NEAm00.tx t");
bookmarks[MpcMinorPlanets].insert("MPCAT: Unusual minor planets (inc luding NEOs)", "http://www.minorplanetcenter.net/iau/ECS/MPCAT/unusual.txt" ); bookmarks[MpcMinorPlanets].insert("MPCAT: Unusual minor planets (inc luding NEOs)", "http://www.minorplanetcenter.net/iau/ECS/MPCAT/unusual.txt" );
bookmarks[MpcMinorPlanets].insert("MPCAT: Distant minor planets (Cen taurs and transneptunians)", "http://www.minorplanetcenter.net/iau/ECS/MPCA T/distant.txt"); bookmarks[MpcMinorPlanets].insert("MPCAT: Distant minor planets (Cen taurs and transneptunians)", "http://www.minorplanetcenter.net/iau/ECS/MPCA T/distant.txt");
bookmarks[MpcMinorPlanets].insert("MPCAT: Numbered objects", "http:/ /www.minorplanetcenter.net/iau/ECS/MPCAT/mpn.txt");
bookmarks[MpcComets].insert("MPC's list of observable comets", "http ://www.minorplanetcenter.net/iau/Ephemerides/Comets/Soft00Cmt.txt"); bookmarks[MpcComets].insert("MPC's list of observable comets", "http ://www.minorplanetcenter.net/iau/Ephemerides/Comets/Soft00Cmt.txt");
bookmarks[MpcComets].insert("MPCORB: comets", "http://www.minorplane tcenter.net/iau/MPCORB/CometEls.txt"); bookmarks[MpcComets].insert("MPCORB: comets", "http://www.minorplane tcenter.net/iau/MPCORB/CometEls.txt");
//Try to save them to a file //Try to save them to a file
saveBookmarks(); saveBookmarks();
} }
void MpcImportWindow::loadBookmarksGroup(QVariantMap source, Bookmarks & bo okmarkGroup) void MpcImportWindow::loadBookmarksGroup(QVariantMap source, Bookmarks & bo okmarkGroup)
{ {
if (source.isEmpty()) if (source.isEmpty())
skipping to change at line 1049 skipping to change at line 1054
if (bookmarksFile.open(QFile::ReadOnly | QFile::Text )) if (bookmarksFile.open(QFile::ReadOnly | QFile::Text ))
{ {
jsonRoot = StelJsonParser::parse(bookmarksFi le.readAll()).toMap(); jsonRoot = StelJsonParser::parse(bookmarksFi le.readAll()).toMap();
bookmarksFile.close(); bookmarksFile.close();
} }
} }
QFile bookmarksFile(bookmarksFilePath); QFile bookmarksFile(bookmarksFilePath);
if (bookmarksFile.open(QFile::WriteOnly | QFile::Truncate | QFile::Text)) if (bookmarksFile.open(QFile::WriteOnly | QFile::Truncate | QFile::Text))
{ {
jsonRoot.insert("version", SOLARSYSTEMEDITOR_VERSION ); jsonRoot.insert("version", SOLARSYSTEMEDITOR_PLUGIN_ VERSION);
QVariantMap minorPlanetsObject; QVariantMap minorPlanetsObject;
saveBookmarksGroup(bookmarks[MpcMinorPlanets], minor PlanetsObject); saveBookmarksGroup(bookmarks[MpcMinorPlanets], minor PlanetsObject);
//qDebug() << minorPlanetsObject.keys(); //qDebug() << minorPlanetsObject.keys();
jsonRoot.insert("mpcMinorPlanets", minorPlanetsObjec t); jsonRoot.insert("mpcMinorPlanets", minorPlanetsObjec t);
QVariantMap cometsObject; QVariantMap cometsObject;
saveBookmarksGroup(bookmarks[MpcComets], cometsObjec t); saveBookmarksGroup(bookmarks[MpcComets], cometsObjec t);
jsonRoot.insert("mpcComets", cometsObject); jsonRoot.insert("mpcComets", cometsObject);
 End of changes. 12 change blocks. 
25 lines changed or deleted 32 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/