diff --git a/plugins/SkyCultureMaker/src/ScmSkyCulture.cpp b/plugins/SkyCultureMaker/src/ScmSkyCulture.cpp index 035ce650d1ead..f7ceab8652562 100644 --- a/plugins/SkyCultureMaker/src/ScmSkyCulture.cpp +++ b/plugins/SkyCultureMaker/src/ScmSkyCulture.cpp @@ -163,9 +163,7 @@ bool scm::ScmSkyCulture::saveDescriptionAsMarkdown(QFile &file) out << "## References\n" << desc.references << "\n\n"; - out << "## Classification\n " << classificationTypeToString(desc.classification) << "\n\n"; - - out << "## License\n### " << license.name << "\n" << license.description << "\n\n"; + out << "## License\n\n" << license.name << "\n\n"; try { diff --git a/plugins/SkyCultureMaker/src/SkyCultureMaker.cpp b/plugins/SkyCultureMaker/src/SkyCultureMaker.cpp index 5b2c8b7281e9d..336c0d5c47703 100644 --- a/plugins/SkyCultureMaker/src/SkyCultureMaker.cpp +++ b/plugins/SkyCultureMaker/src/SkyCultureMaker.cpp @@ -428,14 +428,6 @@ void SkyCultureMaker::updateSkyCultureDialog() scmSkyCultureDialog->setConstellations(currentSkyCulture->getConstellations()); } -void SkyCultureMaker::setSkyCultureDialogInfoLabel(const QString &text) -{ - if (scmSkyCultureDialog != nullptr) - { - scmSkyCultureDialog->setInfoLabel(text); - } -} - void SkyCultureMaker::setSkyCultureDescription(const scm::Description &description) { if (currentSkyCulture != nullptr) @@ -585,3 +577,24 @@ void SkyCultureMaker::initSetting(QSettings *conf, const QString key, const QVar conf->setValue(key, defaultValue); } } + +void SkyCultureMaker::showUserInfoMessage(QWidget *parent, const QString &dialogName, const QString &message) +{ + const QString level = q_("INFO"); + const QString title = dialogName.isEmpty() ? level : dialogName + ": " + level; + QMessageBox::information(parent, title, message); +} + +void SkyCultureMaker::showUserWarningMessage(QWidget *parent, const QString &dialogName, const QString &message) +{ + const QString level = q_("WARNING"); + const QString title = dialogName.isEmpty() ? level : dialogName + ": " + level; + QMessageBox::warning(parent, title, message); +} + +void SkyCultureMaker::showUserErrorMessage(QWidget *parent, const QString &dialogName, const QString &message) +{ + const QString level = q_("ERROR"); + const QString title = dialogName.isEmpty() ? level : dialogName + ": " + level; + QMessageBox::critical(parent, title, message); +} diff --git a/plugins/SkyCultureMaker/src/SkyCultureMaker.hpp b/plugins/SkyCultureMaker/src/SkyCultureMaker.hpp index bc99c2dfc7b59..7aa854302ecfe 100644 --- a/plugins/SkyCultureMaker/src/SkyCultureMaker.hpp +++ b/plugins/SkyCultureMaker/src/SkyCultureMaker.hpp @@ -37,6 +37,7 @@ #include #include #include +#include class QPixmap; class StelButton; @@ -177,12 +178,6 @@ class SkyCultureMaker : public StelModule */ void updateSkyCultureDialog(); - /** - * @brief Sets the info label text in the sky culture dialog. - * @param text The text to set in the info label. - */ - void setSkyCultureDialogInfoLabel(const QString &text); - /** * @brief Sets the current sky culture description. * @param description The description to set. @@ -238,6 +233,33 @@ class SkyCultureMaker : public StelModule */ void openConstellationDialog(const QString &constellationId); + /** + * @brief Displays an information message to the user. + * + * @param parent The parent widget of the message box. + * @param dialogName The name of the dialog to be shown in the title bar. + * @param message The message to be displayed. + */ + void showUserInfoMessage(QWidget *parent, const QString &dialogName, const QString &message); + + /** + * @brief Displays a warning message to the user. + * + * @param parent The parent widget of the message box. + * @param dialogName The name of the dialog to be shown in the title bar. + * @param message The message to be displayed. + */ + void showUserWarningMessage(QWidget *parent, const QString &dialogName, const QString &message); + + /** + * @brief Displays an error message to the user. + * + * @param parent The parent widget of the message box. + * @param dialogName The name of the dialog to be shown in the title bar. + * @param message The message to be displayed. + */ + void showUserErrorMessage(QWidget *parent, const QString &dialogName, const QString &message); + signals: void eventIsScmEnabled(bool b); diff --git a/plugins/SkyCultureMaker/src/gui/ScmConstellationDialog.cpp b/plugins/SkyCultureMaker/src/gui/ScmConstellationDialog.cpp index 18b6929043b06..2f864e1a9c873 100644 --- a/plugins/SkyCultureMaker/src/gui/ScmConstellationDialog.cpp +++ b/plugins/SkyCultureMaker/src/gui/ScmConstellationDialog.cpp @@ -79,11 +79,11 @@ void ScmConstellationDialog::loadFromConstellation(scm::ScmConstellation *conste constellationPronounce = constellation->getPronounce(); constellationIPA = constellation->getIPA(); - ui->enNameTE->setPlainText(constellationEnglishName); - ui->idTE->setPlainText(constellationId); - ui->natNameTE->setPlainText(constellationNativeName.value_or("")); - ui->pronounceTE->setPlainText(constellationPronounce.value_or("")); - ui->ipaTE->setPlainText(constellationIPA.value_or("")); + ui->enNameLE->setText(constellationEnglishName); + ui->idLE->setText(constellationId); + ui->natNameLE->setText(constellationNativeName.value_or("")); + ui->pronounceLE->setText(constellationPronounce.value_or("")); + ui->ipaLE->setText(constellationIPA.value_or("")); // Hide the original constellation while editing constellation->hide(); @@ -115,7 +115,7 @@ void ScmConstellationDialog::setIsDarkConstellation(bool isDark) } // the value changed, so we should reset some data from the previous mode - if(isDarkConstellation != isDark) + if (isDarkConstellation != isDark) { // reset drawn lines as they are not compatible between modes draw->resetDrawing(); @@ -200,38 +200,38 @@ void ScmConstellationDialog::createDialogContent() // LABELS TAB - connect(ui->enNameTE, &QTextEdit::textChanged, this, + connect(ui->enNameLE, &QLineEdit::textChanged, this, [this]() { - constellationEnglishName = ui->enNameTE->toPlainText(); + constellationEnglishName = ui->enNameLE->text(); QString newConstId = constellationEnglishName.toLower().replace(" ", "_"); constellationPlaceholderId = newConstId; - ui->idTE->setPlaceholderText(newConstId); + ui->idLE->setPlaceholderText(newConstId); }); - connect(ui->idTE, &QTextEdit::textChanged, this, [this]() { constellationId = ui->idTE->toPlainText(); }); - connect(ui->natNameTE, &QTextEdit::textChanged, this, + connect(ui->idLE, &QLineEdit::textChanged, this, [this]() { constellationId = ui->idLE->text(); }); + connect(ui->natNameLE, &QLineEdit::textChanged, this, [this]() { - constellationNativeName = ui->natNameTE->toPlainText(); + constellationNativeName = ui->natNameLE->text(); if (constellationNativeName->isEmpty()) { constellationNativeName = std::nullopt; } }); - connect(ui->pronounceTE, &QTextEdit::textChanged, this, + connect(ui->pronounceLE, &QLineEdit::textChanged, this, [this]() { - constellationPronounce = ui->pronounceTE->toPlainText(); + constellationPronounce = ui->pronounceLE->text(); if (constellationPronounce->isEmpty()) { constellationPronounce = std::nullopt; } }); - connect(ui->ipaTE, &QTextEdit::textChanged, this, + connect(ui->ipaLE, &QLineEdit::textChanged, this, [this]() { - constellationIPA = ui->ipaTE->toPlainText(); + constellationIPA = ui->ipaLE->text(); if (constellationIPA->isEmpty()) { constellationIPA = std::nullopt; @@ -241,10 +241,6 @@ void ScmConstellationDialog::createDialogContent() void ScmConstellationDialog::handleFontChanged() { - QFont infoLblFont = QApplication::font(); - infoLblFont.setBold(true); - ui->infoLbl->setFont(infoLblFont); - QFont labelsTitleFont = QApplication::font(); labelsTitleFont.setPixelSize(labelsTitleFont.pixelSize() + 2); labelsTitleFont.setBold(true); @@ -300,7 +296,8 @@ void ScmConstellationDialog::triggerUploadImage() if (!fileInfo.isFile()) { - ui->infoLbl->setText(q_("Choosen path is not a valid file:\n") + filePath); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Chosen path is not a valid file:\n") + filePath); return; } @@ -308,13 +305,11 @@ void ScmConstellationDialog::triggerUploadImage() fileInfo.suffix().compare("JPG", Qt::CaseInsensitive) == 0 || fileInfo.suffix().compare("JPEG", Qt::CaseInsensitive) == 0)) { - ui->infoLbl->setText(q_("Chosen file is not a PNG, JPG or JPEG image:\n") + filePath); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Chosen file is not a PNG, JPG or JPEG image:\n") + filePath); return; } - // Reset text - ui->infoLbl->setText(""); - QPixmap image = QPixmap(fileInfo.absoluteFilePath()); imageItem->setImage(image); imageItem->show(); @@ -337,7 +332,8 @@ void ScmConstellationDialog::bindSelectedStar() { if (!imageItem->hasAnchorSelection()) { - ui->infoLbl->setText(q_("WARNING: Select an anchor to bind to.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("No anchor was selected. Please select an anchor to bind to.")); qDebug() << "SkyCultureMaker: No anchor was selected."; return; } @@ -347,38 +343,41 @@ void ScmConstellationDialog::bindSelectedStar() if (!objectMgr.getWasSelected()) { - ui->infoLbl->setText(q_("WARNING: Select a star to bind to the current selected anchor.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("No star was selected to bind to the current selected anchor.")); qDebug() << "SkyCultureMaker: No star was selected to bind to."; return; } StelObjectP stelObj = objectMgr.getLastSelectedObject(); assert(stelObj != nullptr); // Checked through getWasSelected - if (stelObj->getType().compare("star", Qt::CaseInsensitive) != 0) + if (stelObj->getType().compare("star", Qt::CaseInsensitive) != 0 && + stelObj->getType().compare("nebula", Qt::CaseInsensitive) != 0) { - ui->infoLbl->setText(q_("WARNING: The selected object must be of type star.")); - qDebug() << "SkyCultureMaker: The selected object is not of type start, got " << stelObj->getType(); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("The selected object must be of type Star or Nebula.")); + qDebug() << "SkyCultureMaker: The selected object is not of type Star, got " << stelObj->getType(); return; } ScmConstellationImageAnchor *anchor = imageItem->getSelectedAnchor(); if (anchor == nullptr) { - ui->infoLbl->setText(q_("WARNING: No anchor is selected.")); - qDebug() << "SkyCultureMaker: No anchor is selected"; + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("No anchor was selected. Please select an anchor to bind to.")); + qDebug() << "SkyCultureMaker: No anchor was selected"; return; } bool success = anchor->trySetStarHip(stelObj->getID()); if (success == false) { - ui->infoLbl->setText(q_("WARNING: The selected object must contain a HIP number.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("The selected object must contain a HIP number.")); qDebug() << "SkyCultureMaker: The object does not contain a HIP, id = " << stelObj->getID(); return; } - ui->infoLbl->setText(""); // Reset - updateArtwork(); } @@ -396,14 +395,16 @@ bool ScmConstellationDialog::canConstellationBeSaved() const scm::ScmSkyCulture *currentSkyCulture = maker->getCurrentSkyCulture(); if (currentSkyCulture == nullptr) { - ui->infoLbl->setText(q_("WARNING: Could not save: Sky Culture is not set")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: Sky Culture is not set")); qDebug() << "SkyCultureMaker: Could not save: Sky Culture is not set"; return false; } if (constellationEnglishName.isEmpty()) { - ui->infoLbl->setText(q_("WARNING: Could not save: English name is empty")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: English name is empty")); qDebug() << "SkyCultureMaker: Could not save: English name is empty"; return false; } @@ -412,7 +413,8 @@ bool ScmConstellationDialog::canConstellationBeSaved() const QString finalId = constellationId.isEmpty() ? constellationPlaceholderId : constellationId; if (finalId.isEmpty()) { - ui->infoLbl->setText(q_("WARNING: Could not save: Constellation ID is empty")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: Constellation ID is empty")); qDebug() << "SkyCultureMaker: Could not save: Constellation ID is empty"; return false; } @@ -420,7 +422,8 @@ bool ScmConstellationDialog::canConstellationBeSaved() const // Not editing a constellation, but the ID already exists if (constellationBeingEdited == nullptr && currentSkyCulture->getConstellation(finalId) != nullptr) { - ui->infoLbl->setText(q_("WARNING: Could not save: Constellation with this ID already exists")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: Constellation with this ID already exists")); qDebug() << "SkyCultureMaker: Could not save: Constellation with this ID already exists, id = " << finalId; return false; @@ -429,7 +432,8 @@ bool ScmConstellationDialog::canConstellationBeSaved() const else if (constellationBeingEdited != nullptr && constellationBeingEdited->getId() != finalId && currentSkyCulture->getConstellation(finalId) != nullptr) { - ui->infoLbl->setText(q_("WARNING: Could not save: Constellation with this ID already exists")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: Constellation with this ID already exists")); qDebug() << "SkyCultureMaker: Could not save: Constellation with this ID already exists, id = " << finalId; return false; @@ -439,7 +443,8 @@ bool ScmConstellationDialog::canConstellationBeSaved() const auto drawnConstellation = maker->getScmDraw()->getCoordinates(); if (drawnConstellation.empty()) { - ui->infoLbl->setText(q_("WARNING: Could not save: The constellation does not contain any drawings")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: The constellation does not contain any drawings")); qDebug() << "SkyCultureMaker: Could not save: The constellation does not contain any drawings"; return false; } @@ -449,8 +454,9 @@ bool ScmConstellationDialog::canConstellationBeSaved() const { if (!imageItem->isImageAnchored()) { - ui->infoLbl->setText(q_("WARNING: Could not save: An artwork is attached, but not all " - "anchors have a star bound.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), + q_("Could not save: An artwork is attached, but not all " + "anchors have a star bound.")); qDebug() << "SkyCultureMaker: Could not save: An artwork is attached, but not all " "anchors have a star bound."; return false; @@ -524,22 +530,22 @@ void ScmConstellationDialog::resetDialog() setIsDarkConstellation(false); constellationId.clear(); - ui->idTE->clear(); + ui->idLE->clear(); constellationPlaceholderId.clear(); - ui->idTE->setPlaceholderText(""); + ui->idLE->setPlaceholderText(""); constellationEnglishName.clear(); - ui->enNameTE->clear(); + ui->enNameLE->clear(); constellationNativeName = std::nullopt; - ui->natNameTE->clear(); + ui->natNameLE->clear(); constellationPronounce = std::nullopt; - ui->pronounceTE->clear(); + ui->pronounceLE->clear(); constellationIPA = std::nullopt; - ui->ipaTE->clear(); + ui->ipaLE->clear(); ui->bind_star->setEnabled(false); imageItem->hide(); diff --git a/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.cpp b/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.cpp index c57a5afedcdbd..a99cd654a01e3 100644 --- a/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.cpp +++ b/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.cpp @@ -86,10 +86,10 @@ void ScmSkyCultureDialog::createDialogContent() connect(ui->titleBar, &TitleBar::closeClicked, this, &ScmSkyCultureDialog::close); // Overview Tab - connect(ui->skyCultureNameTE, &QTextEdit::textChanged, this, + connect(ui->skyCultureNameLE, &QLineEdit::textChanged, this, [this]() { - name = ui->skyCultureNameTE->toPlainText(); + name = ui->skyCultureNameLE->text(); if (name.isEmpty()) { ui->ExportSkyCultureBtn->setEnabled(false); @@ -176,13 +176,13 @@ void ScmSkyCultureDialog::saveSkyCulture() // check if license is set if (desc.license == scm::LicenseType::NONE) { - ui->infoLbl->setText(q_("WARNING: Please select a license for the sky culture.")); + maker->showUserWarningMessage(dialog, ui->titleBar->title(), q_("Please select a license for the sky culture.")); return; } // check if description is complete if (!desc.isComplete()) { - ui->infoLbl->setText(q_("WARNING: The sky culture description is not complete.")); + maker->showUserWarningMessage(dialog, ui->titleBar->title(), q_("The sky culture description is not complete. Please fill in all required fields.")); return; } @@ -300,7 +300,7 @@ scm::Description ScmSkyCultureDialog::getDescriptionFromTextEdit() const { scm::Description desc; - desc.name = ui->skyCultureNameTE->toPlainText(); + desc.name = ui->skyCultureNameLE->text(); desc.authors = ui->authorsTE->toPlainText(); desc.license = ui->licenseCB->currentData().value(); desc.cultureDescription = ui->cultureDescriptionTE->toPlainText(); @@ -321,23 +321,11 @@ scm::Description ScmSkyCultureDialog::getDescriptionFromTextEdit() const return desc; } -void ScmSkyCultureDialog::setInfoLabel(const QString &text) -{ - if (ui && dialog) - { - ui->infoLbl->setText(text); - } - else - { - qDebug() << "ScmSkyCultureDialog: UI or dialog is not initialized."; - } -} - void ScmSkyCultureDialog::resetDialog() { if (ui && dialog) { - ui->skyCultureNameTE->clear(); + ui->skyCultureNameLE->clear(); ui->authorsTE->clear(); ui->cultureDescriptionTE->clear(); ui->aboutTE->clear(); @@ -357,7 +345,6 @@ void ScmSkyCultureDialog::resetDialog() name.clear(); setIdFromName(name); resetConstellations(); - maker->setSkyCultureDialogInfoLabel(""); maker->setSkyCultureDescription(getDescriptionFromTextEdit()); updateRemoveConstellationButton(); } diff --git a/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.hpp b/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.hpp index 0d55aaca8e987..39d9a85b5cbcb 100644 --- a/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.hpp +++ b/plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.hpp @@ -59,13 +59,6 @@ class ScmSkyCultureDialog : public StelDialogSeparate */ void resetConstellations(); - /** - * @brief Sets the info label text. - * - * @param text The text to set in the info label. - */ - void setInfoLabel(const QString &text); - /** * @brief Resets all fields in the dialog to their default values. */ diff --git a/plugins/SkyCultureMaker/src/gui/ScmSkyCultureExportDialog.cpp b/plugins/SkyCultureMaker/src/gui/ScmSkyCultureExportDialog.cpp index 80d5a9d814252..254f9c6346f55 100644 --- a/plugins/SkyCultureMaker/src/gui/ScmSkyCultureExportDialog.cpp +++ b/plugins/SkyCultureMaker/src/gui/ScmSkyCultureExportDialog.cpp @@ -96,7 +96,7 @@ void ScmSkyCultureExportDialog::exportSkyCulture() if (currentSkyCulture == nullptr) { qWarning() << "SkyCultureMaker: current sky culture is nullptr. Cannot export."; - maker->setSkyCultureDialogInfoLabel(q_("ERROR: No sky culture is set.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("No sky culture is set.")); ScmSkyCultureExportDialog::close(); return; } @@ -110,7 +110,7 @@ void ScmSkyCultureExportDialog::exportSkyCulture() { qWarning() << "SkyCultureMaker: Could not export sky culture. User cancelled or failed to choose " "directory."; - maker->setSkyCultureDialogInfoLabel(q_("ERROR: Failed to choose export directory.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to choose export directory.")); return; // User cancelled or failed to choose directory } @@ -118,7 +118,7 @@ void ScmSkyCultureExportDialog::exportSkyCulture() { qWarning() << "SkyCultureMaker: Sky culture with ID" << skyCultureId << "already exists. Cannot export."; - maker->setSkyCultureDialogInfoLabel(q_("ERROR: Sky culture with this ID already exists.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Sky culture with this ID already exists.")); // dont close the dialog here, so the user can delete the folder first return; } @@ -127,9 +127,9 @@ void ScmSkyCultureExportDialog::exportSkyCulture() bool createdDirectorySuccessfully = skyCultureDirectory.mkpath("."); if (!createdDirectorySuccessfully) { - maker->setSkyCultureDialogInfoLabel(q_("ERROR: Failed to create sky culture directory.")); qWarning() << "SkyCultureMaker: Failed to create sky culture directory at" << skyCultureDirectory.absolutePath(); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to create sky culture directory.")); return; } @@ -138,8 +138,8 @@ void ScmSkyCultureExportDialog::exportSkyCulture() QDir::separator() + "illustrations"); if (!savedIllustrationsSuccessfully) { - maker->setSkyCultureDialogInfoLabel(q_("WARNING: Failed to save the illustrations.")); qWarning() << "SkyCultureMaker: Failed to export sky culture illustrations."; + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to save the illustrations.")); // delete the created directory skyCultureDirectory.removeRecursively(); ScmSkyCultureExportDialog::close(); @@ -153,7 +153,7 @@ void ScmSkyCultureExportDialog::exportSkyCulture() if (scJsonDoc.isNull() || scJsonDoc.isEmpty()) { qWarning() << "SkyCultureMaker: Failed to create JSON document for sky culture."; - maker->setSkyCultureDialogInfoLabel(q_("ERROR: Failed to create JSON document for sky culture.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to create JSON document for sky culture.")); skyCultureDirectory.removeRecursively(); ScmSkyCultureExportDialog::close(); return; @@ -162,7 +162,7 @@ void ScmSkyCultureExportDialog::exportSkyCulture() if (!scJsonFile.open(QIODevice::WriteOnly | QIODevice::Text)) { qWarning() << "SkyCultureMaker: Failed to open index.json for writing."; - maker->setSkyCultureDialogInfoLabel(q_("ERROR: Failed to open index.json for writing.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to open index.json for writing.")); skyCultureDirectory.removeRecursively(); ScmSkyCultureExportDialog::close(); return; @@ -174,7 +174,7 @@ void ScmSkyCultureExportDialog::exportSkyCulture() bool savedDescriptionSuccessfully = maker->saveSkyCultureDescription(skyCultureDirectory); if (!savedDescriptionSuccessfully) { - maker->setSkyCultureDialogInfoLabel(q_("WARNING: Failed to export sky culture description.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to export sky culture description.")); qWarning() << "SkyCultureMaker: Failed to export sky culture description."; skyCultureDirectory.removeRecursively(); ScmSkyCultureExportDialog::close(); @@ -185,15 +185,16 @@ void ScmSkyCultureExportDialog::exportSkyCulture() bool savedCMakeListsSuccessfully = saveSkyCultureCMakeListsFile(skyCultureDirectory); if (!savedCMakeListsSuccessfully) { - maker->setSkyCultureDialogInfoLabel(q_("WARNING: Failed to export CMakeLists.txt.")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("Failed to export CMakeLists.txt.")); qWarning() << "SkyCultureMaker: Failed to export CMakeLists.txt."; skyCultureDirectory.removeRecursively(); ScmSkyCultureExportDialog::close(); return; } - maker->setSkyCultureDialogInfoLabel(q_("Sky culture exported successfully to ") + - skyCultureDirectory.absolutePath()); + maker->showUserInfoMessage(this->dialog, ui->titleBar->title(), + q_("Sky culture exported successfully to ") + + skyCultureDirectory.absolutePath()); qInfo() << "SkyCultureMaker: Sky culture exported successfully to" << skyCultureDirectory.absolutePath(); ScmSkyCultureExportDialog::close(); @@ -213,7 +214,7 @@ bool ScmSkyCultureExportDialog::chooseExportDirectory(const QString& skyCultureI if (!QDir(selectedDirectory).exists()) { - maker->setSkyCultureDialogInfoLabel(q_("ERROR: The selected directory is not valid")); + maker->showUserErrorMessage(this->dialog, ui->titleBar->title(), q_("ERROR: The selected directory is not valid")); qDebug() << "SkyCultureMaker: Selected non-existing export directory"; return false; } diff --git a/plugins/SkyCultureMaker/src/gui/ScmStartDialog.cpp b/plugins/SkyCultureMaker/src/gui/ScmStartDialog.cpp index 3035b4a1a2039..81d489832af8a 100644 --- a/plugins/SkyCultureMaker/src/gui/ScmStartDialog.cpp +++ b/plugins/SkyCultureMaker/src/gui/ScmStartDialog.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include ScmStartDialog::ScmStartDialog(SkyCultureMaker *maker) diff --git a/plugins/SkyCultureMaker/src/gui/scmConstellationDialog.ui b/plugins/SkyCultureMaker/src/gui/scmConstellationDialog.ui index 115ef70de67d6..ebd3e28a9ebe6 100644 --- a/plugins/SkyCultureMaker/src/gui/scmConstellationDialog.ui +++ b/plugins/SkyCultureMaker/src/gui/scmConstellationDialog.ui @@ -6,22 +6,10 @@ 0 0 - 360 - 454 + 458 + 408 - - - 360 - 454 - - - - - 1000000 - 999999 - - @@ -84,12 +72,12 @@ + + Revert the last drawn line. + Undo - - Revert the last drawn line. - @@ -127,8 +115,7 @@ 10 - - + @@ -138,12 +125,13 @@ - - - - 16777215 - 32 - + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> @@ -155,14 +143,7 @@ - - - - 16777215 - 32 - - - + @@ -172,14 +153,7 @@ - - - - 16777215 - 32 - - - + @@ -189,14 +163,7 @@ - - - - 16777215 - 32 - - - + @@ -206,19 +173,12 @@ - - - - 16777215 - 32 - - - + - + - Qt::Orientation::Vertical + Qt::Vertical @@ -259,26 +219,23 @@ true - QFrame::Shape::StyledPanel - - - QFrame::Shadow::Plain + QFrame::NoFrame - Qt::ScrollBarPolicy::ScrollBarAlwaysOff + Qt::ScrollBarAsNeeded - Qt::ScrollBarPolicy::ScrollBarAlwaysOff + Qt::ScrollBarAsNeeded - QAbstractScrollArea::SizeAdjustPolicy::AdjustIgnored + QAbstractScrollArea::AdjustIgnored - QLayout::SizeConstraint::SetDefaultConstraint + QLayout::SetDefaultConstraint 0 @@ -346,7 +303,7 @@ WhatsThisCursor - Qt::ContextMenuPolicy::NoContextMenu + Qt::NoContextMenu <html><head/><body><p><span>Usage:<br/>1. Upload an image</span></p><p><span>2. Three anchor points appear in the center of the image<br/>- An anchor is green when selected</span></p><p><span>3. Select a star of your choice</span></p><p><span>4. Click the 'Bind Star' button </span></p><p><span>5. The anchor is represented in a brighter color to indicate that it is bound to a star<br/>- The corresponding bound star gets automatically selected when an anchor is selected <br/>- 'Bind Star' does overwrite the current binding with the selected star if a binding already exists</span></p></body></html> @@ -374,16 +331,16 @@ - + - + 0 0 - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -409,9 +366,15 @@ 20 + + 10 + 20 + + 10 + @@ -428,42 +391,6 @@ - - - - 20 - - - 5 - - - 20 - - - - - - - - true - - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 10 - - - - diff --git a/plugins/SkyCultureMaker/src/gui/scmConvertDialog.ui b/plugins/SkyCultureMaker/src/gui/scmConvertDialog.ui index cf7a81873d25e..4bd817f2d84df 100644 --- a/plugins/SkyCultureMaker/src/gui/scmConvertDialog.ui +++ b/plugins/SkyCultureMaker/src/gui/scmConvertDialog.ui @@ -2,14 +2,6 @@ scmConvertDialog - - - 0 - 0 - 400 - 200 - - 0 diff --git a/plugins/SkyCultureMaker/src/gui/scmHideOrAbortMakerDialog.ui b/plugins/SkyCultureMaker/src/gui/scmHideOrAbortMakerDialog.ui index 64097ad7f1c0f..417a81a649736 100644 --- a/plugins/SkyCultureMaker/src/gui/scmHideOrAbortMakerDialog.ui +++ b/plugins/SkyCultureMaker/src/gui/scmHideOrAbortMakerDialog.ui @@ -2,14 +2,6 @@ scmHideOrAbortMakerDialog - - - 0 - 0 - 500 - 160 - - @@ -100,6 +92,9 @@ Qt::AlignCenter + + 20 + diff --git a/plugins/SkyCultureMaker/src/gui/scmSkyCultureDialog.ui b/plugins/SkyCultureMaker/src/gui/scmSkyCultureDialog.ui index 3093a8dd6af2f..781cd083989ea 100644 --- a/plugins/SkyCultureMaker/src/gui/scmSkyCultureDialog.ui +++ b/plugins/SkyCultureMaker/src/gui/scmSkyCultureDialog.ui @@ -6,22 +6,10 @@ 0 0 - 355 - 426 + 372 + 543 - - - 355 - 0 - - - - - 1000000 - 999999 - - @@ -77,12 +65,6 @@ - - - 16777215 - 800 - - 0 @@ -105,23 +87,7 @@ - - - - 100 - 32 - - - - - 16777215 - 32 - - - - false - - + @@ -132,12 +98,6 @@ - - - 100 - 64 - - QListWidget, QListWidget::viewport { @@ -166,12 +126,6 @@ 0 - - - 140 - 0 - - Add Constellation @@ -185,12 +139,6 @@ 0 - - - 140 - 0 - - Add Dark Constellation @@ -204,12 +152,6 @@ 0 - - - 140 - 0 - - Edit @@ -223,12 +165,6 @@ 0 - - - 140 - 0 - - Remove @@ -263,12 +199,6 @@ - - - 130 - 0 - - Export Sky Culture @@ -308,8 +238,8 @@ 0 0 - 320 - 1886 + 229 + 2930 @@ -388,12 +318,6 @@ - - - 16777215 - 80 - - false @@ -411,12 +335,6 @@ - - - 16777215 - 120 - - false @@ -434,12 +352,6 @@ - - - 16777215 - 120 - - false @@ -485,12 +397,6 @@ - - - 16777215 - 100 - - false @@ -508,12 +414,6 @@ - - - 16777215 - 100 - - false @@ -531,12 +431,6 @@ - - - 16777215 - 100 - - false @@ -554,12 +448,6 @@ - - - 16777215 - 100 - - false @@ -577,12 +465,6 @@ - - - 16777215 - 100 - - false @@ -600,12 +482,6 @@ - - - 16777215 - 100 - - false @@ -623,12 +499,6 @@ - - - 16777215 - 100 - - false @@ -670,12 +540,6 @@ - - - 16777215 - 120 - - false @@ -693,12 +557,6 @@ - - - 16777215 - 120 - - false @@ -731,40 +589,6 @@ - - - - - - - 40 - 20 - - - - - - - - - - - true - - - - - - - - 40 - 20 - - - - - - diff --git a/plugins/SkyCultureMaker/src/gui/scmSkyCultureExportDialog.ui b/plugins/SkyCultureMaker/src/gui/scmSkyCultureExportDialog.ui index e09329849ec83..0ea69fb250f39 100644 --- a/plugins/SkyCultureMaker/src/gui/scmSkyCultureExportDialog.ui +++ b/plugins/SkyCultureMaker/src/gui/scmSkyCultureExportDialog.ui @@ -2,32 +2,12 @@ scmSkyCultureExportDialog - - - 0 - 0 - 656 - 300 - - 0 0 - - - 400 - 250 - - - - - 1000000 - 999999 - - diff --git a/plugins/SkyCultureMaker/src/gui/scmStartDialog.ui b/plugins/SkyCultureMaker/src/gui/scmStartDialog.ui index ac757d4d11b69..76a53d7b84cd6 100644 --- a/plugins/SkyCultureMaker/src/gui/scmStartDialog.ui +++ b/plugins/SkyCultureMaker/src/gui/scmStartDialog.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 200 + 304 + 93 @@ -103,6 +103,9 @@ Qt::AlignCenter + + 20 + diff --git a/plugins/SkyCultureMaker/src/types/License.hpp b/plugins/SkyCultureMaker/src/types/License.hpp index db14a5b4012d2..ee7f3146e38ce 100644 --- a/plugins/SkyCultureMaker/src/types/License.hpp +++ b/plugins/SkyCultureMaker/src/types/License.hpp @@ -50,21 +50,29 @@ enum class LicenseType { NONE = 0, CC0, - CC_BY + CC_BY, + CC_BY_NC, + CC_BY_ND, + CC_BY_NC_ND }; //! Map of license types to their corresponding name and description const std::map LICENSES = { {LicenseType::NONE, License("None", "Please select a valid license.")}, - {LicenseType::CC0, License("CC0", + {LicenseType::CC0, License("CC0 1.0", "This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. " "The person who associated a work with this deed has dedicated the work to the public domain by " "waiving all of his or her rights to the work worldwide under copyright law, including all related " "and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform " "the work, even for commercial purposes, all without asking permission.")}, - {LicenseType::CC_BY, License("CC BY", - "This work is licensed under the Creative Commons Attribution 4.0 License; Reusage allowed" - " - please mention author(s).")} + {LicenseType::CC_BY, License("CC BY 4.0", + "This work is licensed under the Creative Commons Attribution 4.0 License.")}, + {LicenseType::CC_BY_NC, License("CC BY-NC 4.0", + "This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 License.")}, + {LicenseType::CC_BY_ND, License("CC BY-ND 4.0", + "This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.")}, + {LicenseType::CC_BY_NC_ND, License("CC BY-NC-ND 4.0", + "This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 License.")} }; } // namespace scm