Skip to content

Commit

Permalink
Hips: show survey copyright in info dialog
Browse files Browse the repository at this point in the history
Also make it a clickable link to the copyright url.
  • Loading branch information
guillaumechereau committed Apr 12, 2018
1 parent 37870b2 commit 48fe39e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/gui/ViewDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static QString getHipsType(const HipsSurveyP hips)

void ViewDialog::updateHips()
{

StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
// Update the groups combobox.
QComboBox* typeComboBox = ui->surveyTypeComboBox;
disconnect(typeComboBox, 0, 0, 0);
Expand Down Expand Up @@ -562,15 +562,19 @@ void ViewDialog::updateHips()
{
QJsonObject props = currentHips->property("properties").toJsonObject();
QString html = QString("<h1>%1</h1>\n").arg(props["obs_title"].toString());

if (props.contains("obs_copyright") && props.contains("obs_copyright_url"))
{
html += QString("<p>Copyright <a href='%2'>%1</a></p>\n")
.arg(props["obs_copyright"].toString()).arg(props["obs_copyright_url"].toString());
}
html += QString("<p>%1</p>\n").arg(props["obs_description"].toString());

html += "<h2>" + q_("properties") + "</h2>\n<ul>\n";
for (auto iter = props.constBegin(); iter != props.constEnd(); iter++)
{
html += QString("<li><b>%1</b> %2</li>\n").arg(iter.key()).arg(iter.value().toString());
}
html += "</ul>\n";
ui->surveysTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
ui->surveysTextBrowser->setHtml(html);
}

Expand Down
6 changes: 5 additions & 1 deletion src/gui/viewDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3607,7 +3607,11 @@
<widget class="QComboBox" name="surveyTypeComboBox"/>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QTextBrowser" name="surveysTextBrowser"/>
<widget class="QTextBrowser" name="surveysTextBrowser">
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
Expand Down

0 comments on commit 48fe39e

Please sign in to comment.