AddRemoveLandscapesDialog.cpp   AddRemoveLandscapesDialog.cpp 
skipping to change at line 32 skipping to change at line 32
#include "Dialog.hpp" #include "Dialog.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include <QDebug> #include <QDebug>
#include <QFileDialog> #include <QFileDialog>
#include <QString> #include <QString>
#include <QMessageBox>
AddRemoveLandscapesDialog::AddRemoveLandscapesDialog() : StelDialog("AddRem oveLandscapes") AddRemoveLandscapesDialog::AddRemoveLandscapesDialog() : StelDialog("AddRem oveLandscapes")
{ {
ui = new Ui_addRemoveLandscapesDialogForm; ui = new Ui_addRemoveLandscapesDialogForm;
landscapeManager = GETSTELMODULE(LandscapeMgr); landscapeManager = GETSTELMODULE(LandscapeMgr);
lastUsedDirectoryPath = QDir::homePath(); lastUsedDirectoryPath = QDir::homePath();
} }
AddRemoveLandscapesDialog::~AddRemoveLandscapesDialog() AddRemoveLandscapesDialog::~AddRemoveLandscapesDialog()
{ {
skipping to change at line 117 skipping to change at line 118
updateSidePane(-1); updateSidePane(-1);
} }
} }
void AddRemoveLandscapesDialog::browseForArchiveClicked() void AddRemoveLandscapesDialog::browseForArchiveClicked()
{ {
QString caption = q_("Select a ZIP archive that contains a Stellariu m landscape"); QString caption = q_("Select a ZIP archive that contains a Stellariu m landscape");
// TRANSLATORS: This string is displayed in the "Files of type:" dro p-down list in the standard file selection dialog. // TRANSLATORS: This string is displayed in the "Files of type:" dro p-down list in the standard file selection dialog.
QString filter = q_("ZIP archives"); QString filter = q_("ZIP archives");
filter += " (*.zip)"; filter += " (*.zip)";
QString sourceArchivePath = QFileDialog::getOpenFileName(NULL, capti on, lastUsedDirectoryPath, filter); QString sourceArchivePath = QFileDialog::getOpenFileName(Q_NULLPTR, caption, lastUsedDirectoryPath, filter);
bool useLandscape = ui->checkBoxUseLandscape->isChecked(); bool useLandscape = ui->checkBoxUseLandscape->isChecked();
if (!sourceArchivePath.isEmpty() && QFile::exists(sourceArchivePath) ) if (!sourceArchivePath.isEmpty() && QFile::exists(sourceArchivePath) )
{ {
//Remember the last successfully used directory //Remember the last successfully used directory
lastUsedDirectoryPath = QFileInfo(sourceArchivePath).path(); lastUsedDirectoryPath = QFileInfo(sourceArchivePath).path();
QString newLandscapeID = landscapeManager->installLandscapeF romArchive(sourceArchivePath, useLandscape); QString newLandscapeID = landscapeManager->installLandscapeF romArchive(sourceArchivePath, useLandscape);
if(!newLandscapeID.isEmpty()) if(!newLandscapeID.isEmpty())
{ {
//Show a message //Show a message
skipping to change at line 151 skipping to change at line 152
//Show an error message //Show an error message
QString failureMessage = q_("No landscape wa s installed."); QString failureMessage = q_("No landscape wa s installed.");
displayMessage(q_("Error!"), failureMessage) ; displayMessage(q_("Error!"), failureMessage) ;
} }
} }
} }
} }
void AddRemoveLandscapesDialog::removeClicked() void AddRemoveLandscapesDialog::removeClicked()
{ {
QString landscapeID = ui->listWidgetUserLandscapes->currentItem()->d int reply = QMessageBox(QMessageBox::Question,
ata(0).toString(); q_("Remove an installed landscape"),
if(landscapeManager->removeLandscape(landscapeID)) q_("Do you really want to remove this landsc
{ ape?"),
//populateLists();//No longer needed after the migration to QMessageBox::Yes|QMessageBox::No).exec();
signals/slots
QString successMessage = QString(q_("Landscape \"%1\" has b if (reply == QMessageBox::Yes)
een removed successfully.")).arg(landscapeID);
displayMessage(q_("Success"), successMessage);
}
else
{ {
//If no error message has been displayed by the signal/slot QString landscapeID = ui->listWidgetUserLandscapes->currentI
mechanism, tem()->data(0).toString();
//display a generic message. if(landscapeManager->removeLandscape(landscapeID))
if (!ui->groupBoxMessage->isVisible()) {
{ //populateLists();//No longer needed after the migra
//Show an error message tion to signals/slots
//NB! This string is used elsewhere. Modify both to QString successMessage = QString(q_("Landscape \"%1
avoid two nearly identical translations. \" has been removed successfully.")).arg(landscapeID);
QString failureMessage = q_("The selected landscape displayMessage(q_("Success"), successMessage);
could not be (completely) removed."); }
displayMessage(q_("Error!"), failureMessage); else
{
//If no error message has been displayed by the sign
al/slot mechanism,
//display a generic message.
if (!ui->groupBoxMessage->isVisible())
{
//Show an error message
//NB! This string is used elsewhere. Modify
both to avoid two nearly identical translations.
QString failureMessage = q_("The selected la
ndscape could not be (completely) removed.");
displayMessage(q_("Error!"), failureMessage)
;
}
} }
} }
} }
void AddRemoveLandscapesDialog::updateSidePane(int newRow) void AddRemoveLandscapesDialog::updateSidePane(int newRow)
{ {
bool displaySidePane = (newRow >= 0); bool displaySidePane = (newRow >= 0);
ui->labelLandscapeName->setVisible(displaySidePane); ui->labelLandscapeName->setVisible(displaySidePane);
ui->labelLandscapeSize->setVisible(displaySidePane); ui->labelLandscapeSize->setVisible(displaySidePane);
ui->pushButtonRemove->setEnabled(displaySidePane); ui->pushButtonRemove->setEnabled(displaySidePane);
ui->labelWarning->setEnabled(displaySidePane); ui->labelWarning->setEnabled(displaySidePane);
if (!displaySidePane) if (!displaySidePane)
 End of changes. 5 change blocks. 
24 lines changed or deleted 34 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/