/* * Angle Measure plug-in for Stellarium * * Copyright (C) 2014 Alexander Wolf * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "config.h" #include "AngleMeasure.hpp" #include "AngleMeasureDialog.hpp" #include "ui_angleMeasureDialog.h" #include "StelApp.hpp" #include "StelLocaleMgr.hpp" #include "StelModule.hpp" #include "StelModuleMgr.hpp" AngleMeasureDialog::AngleMeasureDialog() : am(NULL) { ui = new Ui_angleMeasureDialog(); } AngleMeasureDialog::~AngleMeasureDialog() { delete ui; } void AngleMeasureDialog::retranslate() { if (dialog) { ui->retranslateUi(dialog); setAboutHtml(); } } void AngleMeasureDialog::createDialogContent() { am = GETSTELMODULE(AngleMeasure); ui->setupUi(dialog); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); ui->useDmsFormatCheckBox->setChecked(am->isDmsFormat()); connect(ui->useDmsFormatCheckBox, SIGNAL(toggled(bool)), am, SLOT(useDmsFormat(bool))); ui->showPositionAngleCheckBox->setChecked(am->isPaDisplayed()); connect(ui->showPositionAngleCheckBox, SIGNAL(toggled(bool)), am, SLOT(showPositionAngle(bool))); connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveAngleMeasureSettings())); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(resetAngleMeasureSettings())); setAboutHtml(); } void AngleMeasureDialog::setAboutHtml(void) { QString html = ""; html += "

" + q_("Angle Measure Plug-in") + "

"; html += ""; html += ""; html += ""; html += "
" + q_("Version") + ":" + ANGLEMEASURE_VERSION + "
" + q_("Author") + ":Matthew Gates
" + q_("Contributors") + ":Bogdan Marinov
Alexander Wolf <alex.v.wolf@gmail.com>
"; html += "

" + q_("The Angle Measure plugin is a small tool which is used to measure the angular distance between two points on the sky (and calculation of position angle between those two points).") + "

"; html += "

" + q_("*goes misty eyed* I recall measuring the size of the Cassini Division when I was a student. It was not the high academic glamor one might expect... It was cloudy... It was rainy... The observatory lab had some old scopes set up at one end, pointing at a photograph of Saturn at the other end of the lab. We measured. We calculated. We wished we were in Hawaii.") + "

"; html += "

" + q_("Links") + "

"; html += "

" + QString(q_("Support is provided via the Launchpad website. Be sure to put \"%1\" in the subject when posting.")).arg("Angle Measure plugin") + "

"; html += "

"; StelGui* gui = dynamic_cast(StelApp::getInstance().getGui()); if(gui!=NULL) { QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet); ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlStyleSheet); } ui->aboutTextBrowser->setHtml(html); } void AngleMeasureDialog::saveAngleMeasureSettings() { am->saveSettings(); } void AngleMeasureDialog::resetAngleMeasureSettings() { am->restoreDefaultSettings(); }