Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions plugins/SkyCultureMaker/src/SkyCultureMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ SkyCultureMaker::SkyCultureMaker()
: isScmEnabled(false)
, isLineDrawEnabled(false)
{
qDebug() << "SkyCulture Maker constructed";
qDebug() << "SkyCultureMaker constructed";

setObjectName("SkyCultureMaker");
font.setPixelSize(25);

drawObj = new scm::ScmDraw();
scmStartDialog = new ScmStartDialog(this);
Expand Down
19 changes: 19 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmConstellationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ void ScmConstellationDialog::createDialogContent()
connect(ui->saveBtn, &QPushButton::clicked, this, &ScmConstellationDialog::saveConstellation);
connect(ui->cancelBtn, &QPushButton::clicked, this, &ScmConstellationDialog::cancel);

connect(&StelApp::getInstance(), &StelApp::fontChanged, this, &ScmConstellationDialog::handleFontChanged);
connect(&StelApp::getInstance(), &StelApp::guiFontSizeChanged, this, &ScmConstellationDialog::handleFontChanged);

handleFontChanged();

// LABELS TAB

connect(ui->enNameTE, &QTextEdit::textChanged, this,
[this]()
{
Expand Down Expand Up @@ -181,6 +187,18 @@ 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);
ui->labelsTitle->setFont(labelsTitleFont);
}

void ScmConstellationDialog::togglePen(bool checked)
{
if (checked)
Expand Down Expand Up @@ -314,6 +332,7 @@ void ScmConstellationDialog::bindSelectedStar()

void ScmConstellationDialog::tabChanged(int index)
{
Q_UNUSED(index);
ui->penBtn->setChecked(false);
ui->eraserBtn->setChecked(false);
maker->setDrawTool(scm::DrawTools::None);
Expand Down
3 changes: 3 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmConstellationDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public slots:
*/
void resetDialog();

protected slots:
void handleFontChanged();

private slots:
void togglePen(bool checked);
void toggleEraser(bool checked);
Expand Down
12 changes: 12 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmHideOrAbortMakerDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ void ScmHideOrAbortMakerDialog::createDialogContent()
connect(ui->titleBar, &TitleBar::closeClicked, this, &ScmHideOrAbortMakerDialog::cancelDialog);
connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

connect(&StelApp::getInstance(), &StelApp::fontChanged, this, &ScmHideOrAbortMakerDialog::handleFontChanged);
connect(&StelApp::getInstance(), &StelApp::guiFontSizeChanged, this,
&ScmHideOrAbortMakerDialog::handleFontChanged);
handleFontChanged();

// Buttons
connect(ui->scmMakerAbortButton, &QPushButton::clicked, this,
&ScmHideOrAbortMakerDialog::abortScmCreationProcess); // Abort
Expand All @@ -69,6 +74,13 @@ void ScmHideOrAbortMakerDialog::createDialogContent()
&ScmHideOrAbortMakerDialog::cancelDialog); // Cancel
}

void ScmHideOrAbortMakerDialog::handleFontChanged()
{
QFont questionFont = QApplication::font();
questionFont.setPixelSize(questionFont.pixelSize() + 4);
ui->questionLbl->setFont(questionFont);
}

// TODO: save state of the current sky culture
void ScmHideOrAbortMakerDialog::hideScmCreationProcess()
{
Expand Down
3 changes: 3 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmHideOrAbortMakerDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class ScmHideOrAbortMakerDialog : public StelDialogSeparate
public slots:
void retranslate() override;

protected slots:
void handleFontChanged();

private slots:
void hideScmCreationProcess();
void abortScmCreationProcess();
Expand Down
20 changes: 19 additions & 1 deletion plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ void ScmSkyCultureDialog::createDialogContent()
connect(ui->constellationsList, &QListWidget::itemSelectionChanged, this,
&ScmSkyCultureDialog::updateRemoveConstellationButton);

// License Tab
connect(&StelApp::getInstance(), &StelApp::fontChanged, this, &ScmSkyCultureDialog::handleFontChanged);
connect(&StelApp::getInstance(), &StelApp::guiFontSizeChanged, this, &ScmSkyCultureDialog::handleFontChanged);
handleFontChanged();

// Description Tab

// add all licenses to the combo box
for (const auto &license : scm::LICENSES)
Expand Down Expand Up @@ -149,6 +153,20 @@ void ScmSkyCultureDialog::createDialogContent()
}
}

void ScmSkyCultureDialog::handleFontChanged()
{
QFont headlineFont = QApplication::font();
headlineFont.setPixelSize(headlineFont.pixelSize() + 2);
ui->currentSCNameLbl->setFont(headlineFont);
ui->constellationsLbl->setFont(headlineFont);
ui->selectLicenseLbl->setFont(headlineFont);

QFont descriptionTabLblFont = QApplication::font();
descriptionTabLblFont.setPixelSize(descriptionTabLblFont.pixelSize() + 2);
descriptionTabLblFont.setBold(true);
ui->descriptionTabLbl->setFont(descriptionTabLblFont);
}

void ScmSkyCultureDialog::saveSkyCulture()
{
scm::Description desc = getDescriptionFromTextEdit();
Expand Down
3 changes: 3 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmSkyCultureDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public slots:
void retranslate() override;
void close() override;

protected slots:
void handleFontChanged();

private slots:
void saveSkyCulture();
void constellationDialog();
Expand Down
39 changes: 28 additions & 11 deletions plugins/SkyCultureMaker/src/gui/ScmSkyCultureExportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ void ScmSkyCultureExportDialog::createDialogContent()
{
ui->setupUi(dialog);

connect(&StelApp::getInstance(), &StelApp::fontChanged, this, &ScmSkyCultureExportDialog::handleFontChanged);
connect(&StelApp::getInstance(), &StelApp::guiFontSizeChanged, this,
&ScmSkyCultureExportDialog::handleFontChanged);
handleFontChanged();

connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
connect(ui->titleBar, &TitleBar::closeClicked, this, &ScmSkyCultureExportDialog::close);
Expand All @@ -70,6 +75,14 @@ void ScmSkyCultureExportDialog::createDialogContent()
connect(ui->cancelBtn, &QPushButton::clicked, this, &ScmSkyCultureExportDialog::close);
}

void ScmSkyCultureExportDialog::handleFontChanged()
{
QFont titleLblFont = QApplication::font();
titleLblFont.setPixelSize(titleLblFont.pixelSize() + 2);
titleLblFont.setBold(true);
ui->titleLbl->setFont(titleLblFont);
}

void ScmSkyCultureExportDialog::saveSkyCulture()
{
if (maker == nullptr)
Expand All @@ -88,22 +101,23 @@ void ScmSkyCultureExportDialog::saveSkyCulture()
return;
}

QString skyCultureId = currentSkyCulture->getId();
QString skyCultureId = currentSkyCulture->getId();

// Let the user choose the export directory with skyCulturesPath as default
QDir skyCultureDirectory;
bool exportDirectoryChosen = chooseExportDirectory(skyCultureId, skyCultureDirectory);
if (!exportDirectoryChosen)
{
qWarning() << "SkyCultureMaker: Could not export sky culture. User cancelled or failed to choose directory.";
qWarning() << "SkyCultureMaker: Could not export sky culture. User cancelled or failed to choose "
"directory.";
maker->setSkyCultureDialogInfoLabel("ERROR: Failed to choose export directory.");
return; // User cancelled or failed to choose directory
}

if (skyCultureDirectory.exists())
{
qWarning() << "SkyCultureMaker: Sky culture with ID" << skyCultureId
<< "already exists. Cannot export.";
<< "already exists. Cannot export.";
maker->setSkyCultureDialogInfoLabel("ERROR: Sky culture with this ID already exists.");
// dont close the dialog here, so the user can delete the folder first
return;
Expand All @@ -114,7 +128,8 @@ void ScmSkyCultureExportDialog::saveSkyCulture()
if (!createdDirectorySuccessfully)
{
maker->setSkyCultureDialogInfoLabel("ERROR: Failed to create sky culture directory.");
qWarning() << "SkyCultureMaker: Failed to create sky culture directory at" << skyCultureDirectory.absolutePath();
qWarning() << "SkyCultureMaker: Failed to create sky culture directory at"
<< skyCultureDirectory.absolutePath();
return;
}

Expand Down Expand Up @@ -177,27 +192,29 @@ void ScmSkyCultureExportDialog::saveSkyCulture()
return;
}

maker->setSkyCultureDialogInfoLabel("Sky culture exported successfully to " + skyCultureDirectory.absolutePath());
maker->setSkyCultureDialogInfoLabel("Sky culture exported successfully to " +
skyCultureDirectory.absolutePath());
qInfo() << "SkyCultureMaker: Sky culture exported successfully to" << skyCultureDirectory.absolutePath();
ScmSkyCultureExportDialog::close();
}

bool ScmSkyCultureExportDialog::chooseExportDirectory(const QString& skyCultureId, QDir& skyCultureDirectory)
{
QString selectedDirectory = QFileDialog::getExistingDirectory(nullptr, tr("Choose Export Directory"), skyCulturesPath);
QString selectedDirectory = QFileDialog::getExistingDirectory(nullptr, tr("Choose Export Directory"),
skyCulturesPath);
if (selectedDirectory.isEmpty())
{
// User cancelled the dialog
return false;
}

if (!QDir(selectedDirectory).exists())
{
maker->setSkyCultureDialogInfoLabel("ERROR: The selected directory is not valid");
qDebug() << "SkyCultureMaker: Selected non-existing export directory";
return false;
}

skyCultureDirectory = QDir(selectedDirectory + QDir::separator() + skyCultureId);
return true;
}
Expand All @@ -210,7 +227,7 @@ void ScmSkyCultureExportDialog::saveAndExitSkyCulture()
maker->setIsScmEnabled(false);
}

bool ScmSkyCultureExportDialog::saveSkyCultureCMakeListsFile(const QDir &directory)
bool ScmSkyCultureExportDialog::saveSkyCultureCMakeListsFile(const QDir& directory)
{
QFile cmakeListsFile(directory.absoluteFilePath("CMakeLists.txt"));
if (!cmakeListsFile.open(QIODevice::WriteOnly | QIODevice::Text))
Expand Down
3 changes: 3 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmSkyCultureExportDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class ScmSkyCultureExportDialog : public StelDialogSeparate
public slots:
void retranslate() override;

protected slots:
void handleFontChanged();

private:
Ui_scmSkyCultureExportDialog *ui = nullptr;
SkyCultureMaker *maker = nullptr;
Expand Down
25 changes: 19 additions & 6 deletions plugins/SkyCultureMaker/src/gui/ScmStartDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ void ScmStartDialog::createDialogContent()
ui->setupUi(dialog);

// connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
connect(ui->titleBar, &TitleBar::closeClicked, this, &ScmStartDialog::closeDialog);
connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
connect(&StelApp::getInstance(), &StelApp::fontChanged, this, &ScmStartDialog::handleFontChanged);
connect(&StelApp::getInstance(), &StelApp::guiFontSizeChanged, this, &ScmStartDialog::handleFontChanged);

// Buttons
connect(ui->scmStartCancelpushButton, &QPushButton::clicked, this, &ScmStartDialog::closeDialog); // Cancel
Expand All @@ -79,10 +79,15 @@ void ScmStartDialog::createDialogContent()
connect(ui->scmStartEditpushButton, &QPushButton::clicked, this,
&ScmStartDialog::closeDialog); // Edit - TODO: add logic (currently closing the window)

connect(ui->titleBar, &TitleBar::closeClicked, this, &ScmStartDialog::closeDialog);
connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
// Init the correct font
handleFontChanged();

/* =============================================== SkyCultureConverter ============================================== */
#ifdef SCM_CONVERTER_ENABLED_CPP
ui->scmStartConvertpushButton->setToolTip(
tr("Convert SkyCultures from the legacy (fab) format to the new (json) format"));
tr("Convert sky cultures from the legacy (fab) format to the new (json) format"));
connect(ui->scmStartConvertpushButton, &QPushButton::clicked, this,
[this]()
{
Expand All @@ -96,10 +101,18 @@ void ScmStartDialog::createDialogContent()
#else // SCM_CONVERTER_ENABLED_CPP is not defined
// Converter is disabled, so disable the button
ui->scmStartConvertpushButton->setEnabled(false);
ui->scmStartConvertpushButton->setToolTip(
tr("The Sky Culture Converter has been turned off for this build."));
ui->scmStartConvertpushButton->setToolTip(tr("The Sky Culture Converter has been turned off for this build."));
#endif // SCM_CONVERTER_ENABLED_CPP
/* ================================================================================================================== */
/* ================================================================================================================== */
}

void ScmStartDialog::handleFontChanged()
{
// Set welcome label font size
QFont welcomeLabelFont = QApplication::font();
welcomeLabelFont.setPixelSize(welcomeLabelFont.pixelSize() + 4);
welcomeLabelFont.setBold(true);
ui->welcomeLabel->setFont(welcomeLabelFont);
}

void ScmStartDialog::startScmCreationProcess()
Expand Down
3 changes: 3 additions & 0 deletions plugins/SkyCultureMaker/src/gui/ScmStartDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class ScmStartDialog : public StelDialog
public slots:
void retranslate() override;

protected slots:
void handleFontChanged();

private slots:
void startScmCreationProcess();
void closeDialog();
Expand Down
10 changes: 0 additions & 10 deletions plugins/SkyCultureMaker/src/gui/scmConstellationDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@
</property>
<item>
<widget class="QLabel" name="labelsTitle">
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="text">
<string>Please name the Constellation</string>
</property>
Expand Down Expand Up @@ -449,11 +444,6 @@
</property>
<item>
<widget class="QLabel" name="infoLbl">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
Expand Down
8 changes: 1 addition & 7 deletions plugins/SkyCultureMaker/src/gui/scmHideOrAbortMakerDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,7 @@
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>16</pointsize>
<strikeout>false</strikeout>
</font>
</property>
<widget class="QLabel" name="questionLbl">
<property name="text">
<string>Hide the plugin to resume later or abort the process?</string>
</property>
Expand Down
Loading