SolarSystemManagerWindow.cpp   SolarSystemManagerWindow.cpp 
skipping to change at line 40 skipping to change at line 40
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include <QFileDialog> #include <QFileDialog>
SolarSystemManagerWindow::SolarSystemManagerWindow() SolarSystemManagerWindow::SolarSystemManagerWindow()
: StelDialog("SolarSystemEditor") : StelDialog("SolarSystemEditor")
, manualImportWindow(NULL) , manualImportWindow(Q_NULLPTR)
{ {
ui = new Ui_solarSystemManagerWindow(); ui = new Ui_solarSystemManagerWindow();
mpcImportWindow = new MpcImportWindow(); mpcImportWindow = new MpcImportWindow();
ssoManager = GETSTELMODULE(SolarSystemEditor); ssEditor = GETSTELMODULE(SolarSystemEditor);
} }
SolarSystemManagerWindow::~SolarSystemManagerWindow() SolarSystemManagerWindow::~SolarSystemManagerWindow()
{ {
delete ui; delete ui;
if (mpcImportWindow) if (mpcImportWindow)
delete mpcImportWindow; delete mpcImportWindow;
if (manualImportWindow) if (manualImportWindow)
delete manualImportWindow; delete manualImportWindow;
skipping to change at line 76 skipping to change at line 76
installKineticScrolling(addscroll); installKineticScrolling(addscroll);
#endif #endif
//Signals //Signals
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
this, SLOT(retranslate())); this, SLOT(retranslate()));
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint))); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint)));
connect(ui->pushButtonCopyFile, SIGNAL(clicked()), this, SLOT(copyCo nfiguration())); connect(ui->pushButtonCopyFile, SIGNAL(clicked()), this, SLOT(copyCo nfiguration()));
connect(ui->pushButtonReplaceFile, SIGNAL(clicked()), this, SLOT(rep laceConfiguration())); connect(ui->pushButtonReplaceFile, SIGNAL(clicked()), this, SLOT(rep laceConfiguration()));
connect(ui->pushButtonRemove, SIGNAL(clicked()), this, SLOT(removeOb connect(ui->pushButtonAddFile, SIGNAL(clicked()), this, SLOT(addConf
ject())); iguration()));
connect(ui->pushButtonRemove, SIGNAL(clicked()), this, SLOT(removeOb
jects()));
connect(ui->pushButtonImportMPC, SIGNAL(clicked()), this, SLOT(newIm portMPC())); connect(ui->pushButtonImportMPC, SIGNAL(clicked()), this, SLOT(newIm portMPC()));
//connect(ui->pushButtonManual, SIGNAL(clicked()), this, SLOT(newImp ortManual())); //connect(ui->pushButtonManual, SIGNAL(clicked()), this, SLOT(newImp ortManual()));
connect(ssoManager, SIGNAL(solarSystemChanged()), this, SLOT(populat connect(ssEditor, SIGNAL(solarSystemChanged()), this, SLOT(populateS
eSolarSystemList())); olarSystemList()));
connect(ui->pushButtonReset, SIGNAL(clicked()), ssoManager, SLOT(res connect(ui->pushButtonReset, SIGNAL(clicked()), ssEditor, SLOT(reset
etSolarSystemToDefault())); SolarSystemToDefault()));
// bug #1350669 (https://bugs.launchpad.net/stellarium/+bug/1350669) // bug #1350669 (https://bugs.launchpad.net/stellarium/+bug/1350669)
connect(ui->listWidgetObjects, SIGNAL(currentRowChanged(int)), ui->l istWidgetObjects, SLOT(repaint())); connect(ui->listWidgetObjects, SIGNAL(currentRowChanged(int)), ui->l istWidgetObjects, SLOT(repaint()));
updateTexts(); updateTexts();
Q_ASSERT(mpcImportWindow); Q_ASSERT(mpcImportWindow);
//Rebuild the list if any planets have been imported //Rebuild the list if any planets have been imported
connect(mpcImportWindow, SIGNAL(objectsImported()), this, SLOT(popul ateSolarSystemList())); connect(mpcImportWindow, SIGNAL(objectsImported()), this, SLOT(popul ateSolarSystemList()));
ui->lineEditUserFilePath->setText(ssoManager->getCustomSolarSystemFi lePath()); ui->lineEditUserFilePath->setText(ssEditor->getCustomSolarSystemFile Path());
populateSolarSystemList(); populateSolarSystemList();
} }
void SolarSystemManagerWindow::updateTexts() void SolarSystemManagerWindow::updateTexts()
{ {
//Solar System tab //Solar System tab
// TRANSLATORS: Appears as the text of hyperlinks linking to website s. :) // TRANSLATORS: Appears as the text of hyperlinks linking to website s. :)
QString linkText(q_("website")); QString linkText(q_("website"));
QString linkCode = QString("<a href=\"http://www.minorplanetcenter.n et/\">%1</a>").arg(linkText); QString linkCode = QString("<a href=\"http://www.minorplanetcenter.n et/\">%1</a>").arg(linkText);
skipping to change at line 131 skipping to change at line 132
void SolarSystemManagerWindow::newImportMPC() void SolarSystemManagerWindow::newImportMPC()
{ {
Q_ASSERT(mpcImportWindow); Q_ASSERT(mpcImportWindow);
mpcImportWindow->setVisible(true); mpcImportWindow->setVisible(true);
} }
void SolarSystemManagerWindow::newImportManual() void SolarSystemManagerWindow::newImportManual()
{ {
if (manualImportWindow == NULL) if (manualImportWindow == Q_NULLPTR)
{ {
manualImportWindow = new ManualImportWindow(); manualImportWindow = new ManualImportWindow();
connect(manualImportWindow, SIGNAL(visibleChanged(bool)), th is, SLOT(resetImportManual(bool))); connect(manualImportWindow, SIGNAL(visibleChanged(bool)), th is, SLOT(resetImportManual(bool)));
} }
manualImportWindow->setVisible(true); manualImportWindow->setVisible(true);
} }
void SolarSystemManagerWindow::resetImportManual(bool show) void SolarSystemManagerWindow::resetImportManual(bool show)
{ {
skipping to change at line 153 skipping to change at line 154
if (show) if (show)
return; return;
if (manualImportWindow) if (manualImportWindow)
{ {
//TODO:Move this out of here! //TODO:Move this out of here!
//Reload the list, in case there are new objects //Reload the list, in case there are new objects
populateSolarSystemList(); populateSolarSystemList();
delete manualImportWindow; delete manualImportWindow;
manualImportWindow = NULL; manualImportWindow = Q_NULLPTR;
//This window is in the background, bring it to the foregrou nd //This window is in the background, bring it to the foregrou nd
dialog->setVisible(true); dialog->setVisible(true);
} }
} }
void SolarSystemManagerWindow::populateSolarSystemList() void SolarSystemManagerWindow::populateSolarSystemList()
{ {
unlocalizedNames.clear(); unlocalizedNames.clear();
foreach (const PlanetP & object, GETSTELMODULE(SolarSystem)->getAllP lanets()) foreach (const PlanetP & object, GETSTELMODULE(SolarSystem)->getAllP lanets())
{ {
unlocalizedNames.insert(object->getNameI18n(), object->getEn // GZ new for 0.16: only insert objects which are minor bodi
glishName()); es.
if ((object->getPlanetType() >= Planet::isAsteroid) && (obje
ct->getEnglishName()!="Pluto"))
unlocalizedNames.insert(object->getNameI18n(), objec
t->getEnglishName());
} }
ui->listWidgetObjects->clear(); ui->listWidgetObjects->clear();
ui->listWidgetObjects->addItems(unlocalizedNames.keys()); ui->listWidgetObjects->addItems(unlocalizedNames.keys());
//No explicit sorting is necessary: sortingEnabled is set in the .ui //No explicit sorting is necessary: sortingEnabled is set in the .ui
} }
void SolarSystemManagerWindow::removeObject() void SolarSystemManagerWindow::removeObjects()
{ {
if(ui->listWidgetObjects->currentItem()) if (ui->listWidgetObjects->selectedItems().length()>0)
{ {
QString ssoI18nName = ui->listWidgetObjects->currentItem()-> // we must disconnect the signal or else the list will be re
text(); built after the first deletion.
QString ssoEnglishName = unlocalizedNames.value(ssoI18nName) disconnect(ssEditor, SIGNAL(solarSystemChanged()), this, SLO
; T(populateSolarSystemList()));
//qDebug() << ssoId; // This is slow for many objects.
//TODO: Ask for confirmation first? // TODO: For more than 50, it may be better to remove from i
ssoManager->removeSsoWithName(ssoEnglishName); ni file and reload all ini files.
foreach (QListWidgetItem *item, ui->listWidgetObjects->selec
tedItems())
{
QString ssoI18nName = item->text();
QString ssoEnglishName = unlocalizedNames.value(ssoI
18nName);
//qDebug() << ssoId;
//TODO: Ask for confirmation first?
ssEditor->removeSsoWithName(ssoEnglishName);
}
connect(ssEditor, SIGNAL(solarSystemChanged()), this, SLOT(p
opulateSolarSystemList()));
populateSolarSystemList();
} }
} }
void SolarSystemManagerWindow::copyConfiguration() void SolarSystemManagerWindow::copyConfiguration()
{ {
QString filePath = QFileDialog::getSaveFileName(0, q_("Save the Sola QString filePath = QFileDialog::getSaveFileName(0, q_("Save the mino
r System configuration file as..."), QDir::homePath() + "/ssystem.ini"); r Solar System bodies as..."), QDir::homePath() + "/ssystem_minor.ini");
ssoManager->copySolarSystemConfigurationFileTo(filePath); ssEditor->copySolarSystemConfigurationFileTo(filePath);
} }
void SolarSystemManagerWindow::replaceConfiguration() void SolarSystemManagerWindow::replaceConfiguration()
{ {
QString filter = q_("Configuration files"); QString filter = q_("Configuration files");
filter.append(" (*.ini)"); filter.append(" (*.ini)");
QString filePath = QFileDialog::getOpenFileName(0, q_("Select a file QString filePath = QFileDialog::getOpenFileName(0, q_("Select a file
to replace the Solar System configuration file"), QDir::homePath(), filter to replace the Solar System minor bodies"), QDir::homePath(), filter);
); ssEditor->replaceSolarSystemConfigurationFileWith(filePath);
ssoManager->replaceSolarSystemConfigurationFileWith(filePath); }
void SolarSystemManagerWindow::addConfiguration()
{
QString filter = q_("Configuration files");
filter.append(" (*.ini)");
QString filePath = QFileDialog::getOpenFileName(0, q_("Select a file
to add the Solar System minor bodies"), QDir::toNativeSeparators(StelFileM
gr::getInstallationDir()+"/data/ssystem_1000comets.ini"), filter);
ssEditor->addFromSolarSystemConfigurationFile(filePath);
} }
 End of changes. 13 change blocks. 
29 lines changed or deleted 57 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/