ConfigurationDialog.cpp   ConfigurationDialog.cpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2008 Fabien Chereau * Copyright (C) 2008 Fabien Chereau
* Copyright (C) 2012 Timothy Reaves * Copyright (C) 2012 Timothy Reaves
* Copyright (C) 2012 Bogdan Marinov
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Dialog.hpp" #include "Dialog.hpp"
#include "ConfigurationDialog.hpp" #include "ConfigurationDialog.hpp"
#include "CustomInfoDialog.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include "StelMainWindow.hpp" #include "StelMainWindow.hpp"
#include "ui_configurationDialog.h" #include "ui_configurationDialog.h"
#include "StelAppGraphicsWidget.hpp" #include "StelAppGraphicsWidget.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
skipping to change at line 67 skipping to change at line 67
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QFileDialog> #include <QFileDialog>
ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NUL L), gui(agui) ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NUL L), gui(agui)
{ {
ui = new Ui_configurationDialogForm; ui = new Ui_configurationDialogForm;
customInfoDialog = NULL;
hasDownloadedStarCatalog = false; hasDownloadedStarCatalog = false;
isDownloadingStarCatalog = false; isDownloadingStarCatalog = false;
savedProjectionType = StelApp::getInstance().getCore()->getCurrentPr ojectionType(); savedProjectionType = StelApp::getInstance().getCore()->getCurrentPr ojectionType();
} }
ConfigurationDialog::~ConfigurationDialog() ConfigurationDialog::~ConfigurationDialog()
{ {
delete ui; delete ui;
ui=NULL; ui = 0;
delete customInfoDialog;
customInfoDialog = NULL;
} }
void ConfigurationDialog::retranslate() void ConfigurationDialog::retranslate()
{ {
if (dialog) { if (dialog) {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
//Hack to shrink the tabs to optimal size after language cha nge //Hack to shrink the tabs to optimal size after language cha nge
//by causing the list items to be laid out again. //by causing the list items to be laid out again.
ui->stackListWidget->setWrapping(false); ui->stackListWidget->setWrapping(false);
updateTabBarListWidgetWidth();
//Initial FOV and direction on the "Main" page //Initial FOV and direction on the "Main" page
updateConfigLabels(); updateConfigLabels();
//Star catalog download button and info //Star catalog download button and info
updateStarCatalogControlsText(); updateStarCatalogControlsText();
//Script information //Script information
//(trigger re-displaying the description of the current item ) //(trigger re-displaying the description of the current item )
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
skipping to change at line 112 skipping to change at line 110
//Plug-in information //Plug-in information
populatePluginsList(); populatePluginsList();
} }
} }
void ConfigurationDialog::styleChanged() void ConfigurationDialog::styleChanged()
{ {
// Nothing for now // Nothing for now
} }
void ConfigurationDialog::updateIconsColor()
{
QPixmap pixmap(50, 50);
QStringList icons;
icons << "main" << "info" << "navigation" << "tools" << "scripts" <<
"plugins";
bool redIcon = false;
if (StelApp::getInstance().getVisionModeNight())
redIcon = true;
foreach(const QString &iconName, icons)
{
pixmap.load(":/graphicGui/tabicon-" + iconName +".png");
if (redIcon)
pixmap = StelButton::makeRed(pixmap);
ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(
QIcon(pixmap));
}
}
void ConfigurationDialog::createDialogContent() void ConfigurationDialog::createDialogContent()
{ {
const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(StelCore::FrameJ2000); const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(StelCore::FrameJ2000);
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
ui->setupUi(dialog); ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate()));
connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)) , this, SLOT(updateIconsColor()));
// Set the main tab activated by default // Set the main tab activated by default
ui->configurationStackedWidget->setCurrentIndex(0); ui->configurationStackedWidget->setCurrentIndex(0);
updateIconsColor();
ui->stackListWidget->setCurrentRow(0); ui->stackListWidget->setCurrentRow(0);
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
// Main tab // Main tab
// Fill the language list widget from the available list // Fill the language list widget from the available list
QString appLang = StelApp::getInstance().getLocaleMgr().getAppLangua ge(); QString appLang = StelApp::getInstance().getLocaleMgr().getAppLangua ge();
QComboBox* cb = ui->programLanguageComboBox; QComboBox* cb = ui->programLanguageComboBox;
cb->clear(); cb->clear();
cb->addItems(StelTranslator::globalTranslator.getAvailableLanguagesN amesNative(StelFileMgr::getLocaleDir())); cb->addItems(StelTranslator::globalTranslator.getAvailableLanguagesN amesNative(StelFileMgr::getLocaleDir()));
skipping to change at line 153 skipping to change at line 172
if (lt!=-1) if (lt!=-1)
cb->setCurrentIndex(lt); cb->setCurrentIndex(lt);
connect(cb, SIGNAL(currentIndexChanged(const QString&)), this, SLOT( selectLanguage(const QString&))); connect(cb, SIGNAL(currentIndexChanged(const QString&)), this, SLOT( selectLanguage(const QString&)));
connect(ui->getStarsButton, SIGNAL(clicked()), this, SLOT(downloadSt ars())); connect(ui->getStarsButton, SIGNAL(clicked()), this, SLOT(downloadSt ars()));
connect(ui->downloadCancelButton, SIGNAL(clicked()), this, SLOT(canc elDownload())); connect(ui->downloadCancelButton, SIGNAL(clicked()), this, SLOT(canc elDownload()));
connect(ui->downloadRetryButton, SIGNAL(clicked()), this, SLOT(downl oadStars())); connect(ui->downloadRetryButton, SIGNAL(clicked()), this, SLOT(downl oadStars()));
resetStarCatalogControls(); resetStarCatalogControls();
// Selected object info // Selected object info
if (gui->getInfoTextFilters() == (StelObject::InfoStringGroup)0) if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(0))
{ {
ui->noSelectedInfoRadio->setChecked(true); ui->noSelectedInfoRadio->setChecked(true);
ui->pushButtonCustomInfoDialog->setEnabled(false);
} }
else if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(St elObject::ShortInfo)) else if (gui->getInfoTextFilters() == StelObject::ShortInfo)
{ {
ui->briefSelectedInfoRadio->setChecked(true); ui->briefSelectedInfoRadio->setChecked(true);
ui->pushButtonCustomInfoDialog->setEnabled(false);
} }
else if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(St elObject::AllInfo)) else if (gui->getInfoTextFilters() == StelObject::AllInfo)
{ {
ui->allSelectedInfoRadio->setChecked(true); ui->allSelectedInfoRadio->setChecked(true);
ui->pushButtonCustomInfoDialog->setEnabled(false);
} }
else else
{ {
ui->customSelectedInfoRadio->setChecked(true); ui->customSelectedInfoRadio->setChecked(true);
ui->pushButtonCustomInfoDialog->setEnabled(true);
} }
updateSelectedInfoCheckBoxes();
connect(ui->noSelectedInfoRadio, SIGNAL(released()), this, SLOT(setN oSelectedInfo())); connect(ui->noSelectedInfoRadio, SIGNAL(released()), this, SLOT(setN oSelectedInfo()));
connect(ui->allSelectedInfoRadio, SIGNAL(released()), this, SLOT(set AllSelectedInfo())); connect(ui->allSelectedInfoRadio, SIGNAL(released()), this, SLOT(set AllSelectedInfo()));
connect(ui->briefSelectedInfoRadio, SIGNAL(released()), this, SLOT(s etBriefSelectedInfo())); connect(ui->briefSelectedInfoRadio, SIGNAL(released()), this, SLOT(s etBriefSelectedInfo()));
connect(ui->customSelectedInfoRadio, SIGNAL(released()), this, SLOT( connect(ui->buttonGroupDisplayedFields, SIGNAL(buttonClicked(int)),
setCustomSelectedInfo())); this, SLOT(setSelectedInfoFromCheckBoxes()));
connect(ui->pushButtonCustomInfoDialog, SIGNAL(clicked()), this, SLO
T(showCustomInfoDialog()));
// Navigation tab // Navigation tab
// Startup time // Startup time
if (core->getStartupTimeMode()=="actual") if (core->getStartupTimeMode()=="actual")
ui->systemTimeRadio->setChecked(true); ui->systemTimeRadio->setChecked(true);
else if (core->getStartupTimeMode()=="today") else if (core->getStartupTimeMode()=="today")
ui->todayRadio->setChecked(true); ui->todayRadio->setChecked(true);
else else
ui->fixedTimeRadio->setChecked(true); ui->fixedTimeRadio->setChecked(true);
connect(ui->systemTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setSt artupTimeMode())); connect(ui->systemTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setSt artupTimeMode()));
skipping to change at line 223 skipping to change at line 238
ui->selectSingleConstellationButton->setChecked(cmgr->getFlagIsolate Selected()); ui->selectSingleConstellationButton->setChecked(cmgr->getFlagIsolate Selected());
connect(ui->selectSingleConstellationButton, SIGNAL(toggled(bool)), cmgr, SLOT(setFlagIsolateSelected(bool))); connect(ui->selectSingleConstellationButton, SIGNAL(toggled(bool)), cmgr, SLOT(setFlagIsolateSelected(bool)));
ui->diskViewportCheckbox->setChecked(proj->getMaskType() == StelProj ector::MaskDisk); ui->diskViewportCheckbox->setChecked(proj->getMaskType() == StelProj ector::MaskDisk);
connect(ui->diskViewportCheckbox, SIGNAL(toggled(bool)), this, SLOT( setDiskViewport(bool))); connect(ui->diskViewportCheckbox, SIGNAL(toggled(bool)), this, SLOT( setDiskViewport(bool)));
ui->autoZoomResetsDirectionCheckbox->setChecked(mvmgr->getFlagAutoZo omOutResetsDirection()); ui->autoZoomResetsDirectionCheckbox->setChecked(mvmgr->getFlagAutoZo omOutResetsDirection());
connect(ui->autoZoomResetsDirectionCheckbox, SIGNAL(toggled(bool)), mvmgr, SLOT(setFlagAutoZoomOutResetsDirection(bool))); connect(ui->autoZoomResetsDirectionCheckbox, SIGNAL(toggled(bool)), mvmgr, SLOT(setFlagAutoZoomOutResetsDirection(bool)));
ui->showFlipButtonsCheckbox->setChecked(gui->getFlagShowFlipButtons( )); ui->showFlipButtonsCheckbox->setChecked(gui->getFlagShowFlipButtons( ));
connect(ui->showFlipButtonsCheckbox, SIGNAL(toggled(bool)), gui, SLO T(setFlagShowFlipButtons(bool))); connect(ui->showFlipButtonsCheckbox, SIGNAL(toggled(bool)), gui, SLO T(setFlagShowFlipButtons(bool)));
ui->showNebulaBgButtonCheckbox->setChecked(gui->getFlagShowNebulaBac
kgroundButton());
connect(ui->showNebulaBgButtonCheckbox, SIGNAL(toggled(bool)), gui,
SLOT(setFlagShowNebulaBackgroundButton(bool)));
ui->mouseTimeoutCheckbox->setChecked(StelMainGraphicsView::getInstan ce().getFlagCursorTimeout()); ui->mouseTimeoutCheckbox->setChecked(StelMainGraphicsView::getInstan ce().getFlagCursorTimeout());
ui->mouseTimeoutSpinBox->setValue(StelMainGraphicsView::getInstance( ).getCursorTimeout()); ui->mouseTimeoutSpinBox->setValue(StelMainGraphicsView::getInstance( ).getCursorTimeout());
connect(ui->mouseTimeoutCheckbox, SIGNAL(clicked()), this, SLOT(curs orTimeOutChanged())); connect(ui->mouseTimeoutCheckbox, SIGNAL(clicked()), this, SLOT(curs orTimeOutChanged()));
connect(ui->mouseTimeoutCheckbox, SIGNAL(toggled(bool)), this, SLOT( cursorTimeOutChanged())); connect(ui->mouseTimeoutCheckbox, SIGNAL(toggled(bool)), this, SLOT( cursorTimeOutChanged()));
connect(ui->mouseTimeoutSpinBox, SIGNAL(valueChanged(double)), this, SLOT(cursorTimeOutChanged(double))); connect(ui->mouseTimeoutSpinBox, SIGNAL(valueChanged(double)), this, SLOT(cursorTimeOutChanged(double)));
connect(ui->setViewingOptionAsDefaultPushButton, SIGNAL(clicked()), this, SLOT(saveCurrentViewOptions())); connect(ui->setViewingOptionAsDefaultPushButton, SIGNAL(clicked()), this, SLOT(saveCurrentViewOptions()));
connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(set DefaultViewOptions())); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(set DefaultViewOptions()));
ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir()); ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir());
skipping to change at line 262 skipping to change at line 280
populateScriptsList(); populateScriptsList();
connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(populateScrip tsList())); connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(populateScrip tsList()));
#endif #endif
// plugins control // plugins control
connect(ui->pluginsListWidget, SIGNAL(currentTextChanged(const QStri ng&)), this, SLOT(pluginsSelectionChanged(const QString&))); connect(ui->pluginsListWidget, SIGNAL(currentTextChanged(const QStri ng&)), this, SLOT(pluginsSelectionChanged(const QString&)));
connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int))); connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int)));
connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(plu ginConfigureCurrentSelection())); connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(plu ginConfigureCurrentSelection()));
populatePluginsList(); populatePluginsList();
connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetIt em *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWi dgetItem*)));
updateConfigLabels(); updateConfigLabels();
updateTabBarListWidgetWidth();
} }
void ConfigurationDialog::selectLanguage(const QString& langName) void ConfigurationDialog::selectLanguage(const QString& langName)
{ {
QString code = StelTranslator::nativeNameToIso639_1Code(langName); QString code = StelTranslator::nativeNameToIso639_1Code(langName);
StelApp::getInstance().getLocaleMgr().setAppLanguage(code); StelApp::getInstance().getLocaleMgr().setAppLanguage(code);
StelApp::getInstance().getLocaleMgr().setSkyLanguage(code); StelApp::getInstance().getLocaleMgr().setSkyLanguage(code);
StelMainWindow::getInstance().initTitleI18n(); StelMainWindow::getInstance().initTitleI18n();
} }
skipping to change at line 314 skipping to change at line 332
else else
{ {
core->setCurrentProjectionType((StelCore::ProjectionType)sav edProjectionType); core->setCurrentProjectionType((StelCore::ProjectionType)sav edProjectionType);
StelMainGraphicsView::getInstance().getStelAppGraphicsWidget ()->setViewportEffect("none"); StelMainGraphicsView::getInstance().getStelAppGraphicsWidget ()->setViewportEffect("none");
} }
} }
void ConfigurationDialog::setNoSelectedInfo(void) void ConfigurationDialog::setNoSelectedInfo(void)
{ {
gui->setInfoTextFilters(StelObject::InfoStringGroup(0)); gui->setInfoTextFilters(StelObject::InfoStringGroup(0));
ui->pushButtonCustomInfoDialog->setEnabled(false); updateSelectedInfoCheckBoxes();
} }
void ConfigurationDialog::setAllSelectedInfo(void) void ConfigurationDialog::setAllSelectedInfo(void)
{ {
gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::AllI nfo)); gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::AllI nfo));
ui->pushButtonCustomInfoDialog->setEnabled(false); updateSelectedInfoCheckBoxes();
} }
void ConfigurationDialog::setBriefSelectedInfo(void) void ConfigurationDialog::setBriefSelectedInfo(void)
{ {
gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::Shor tInfo)); gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::Shor tInfo));
ui->pushButtonCustomInfoDialog->setEnabled(false); updateSelectedInfoCheckBoxes();
} }
void ConfigurationDialog::setCustomSelectedInfo(void) void ConfigurationDialog::setSelectedInfoFromCheckBoxes()
{ {
gui->setInfoTextFilters(StelObject::InfoStringGroup(StelApp::getInst // As this signal will be called when a checbox is toggled,
ance().getStelObjectMgr().getCustomInfoString())); // change the general mode to Custom.
ui->pushButtonCustomInfoDialog->setEnabled(true); if (!ui->customSelectedInfoRadio->isChecked())
ui->customSelectedInfoRadio->setChecked(true);
StelObject::InfoStringGroup flags(0);
if (ui->checkBoxName->isChecked())
flags |= StelObject::Name;
if (ui->checkBoxCatalogNumbers->isChecked())
flags |= StelObject::CatalogNumber;
if (ui->checkBoxVisualMag->isChecked())
flags |= StelObject::Magnitude;
if (ui->checkBoxAbsoluteMag->isChecked())
flags |= StelObject::AbsoluteMagnitude;
if (ui->checkBoxRaDecJ2000->isChecked())
flags |= StelObject::RaDecJ2000;
if (ui->checkBoxRaDecOfDate->isChecked())
flags |= StelObject::RaDecOfDate;
if (ui->checkBoxHourAngle->isChecked())
flags |= StelObject::HourAngle;
if (ui->checkBoxAltAz->isChecked())
flags |= StelObject::AltAzi;
if (ui->checkBoxDistance->isChecked())
flags |= StelObject::Distance;
if (ui->checkBoxSize->isChecked())
flags |= StelObject::Size;
if (ui->checkBoxExtra1->isChecked())
flags |= StelObject::Extra1;
if (ui->checkBoxExtra2->isChecked())
flags |= StelObject::Extra2;
if (ui->checkBoxExtra3->isChecked())
flags |= StelObject::Extra3;
gui->setInfoTextFilters(flags);
} }
void ConfigurationDialog::cursorTimeOutChanged() void ConfigurationDialog::cursorTimeOutChanged()
{ {
StelMainGraphicsView::getInstance().setFlagCursorTimeout(ui->mouseTi meoutCheckbox->isChecked()); StelMainGraphicsView::getInstance().setFlagCursorTimeout(ui->mouseTi meoutCheckbox->isChecked());
StelMainGraphicsView::getInstance().setCursorTimeout(ui->mouseTimeou tSpinBox->value()); StelMainGraphicsView::getInstance().setCursorTimeout(ui->mouseTimeou tSpinBox->value());
} }
void ConfigurationDialog::browseForScreenshotDir() void ConfigurationDialog::browseForScreenshotDir()
{ {
QString oldScreenshorDir = StelFileMgr::getScreenshotDir(); QString oldScreenshorDir = StelFileMgr::getScreenshotDir();
QString newScreenshotDir = QFileDialog::getExistingDirectory(NULL, q #ifdef Q_OS_MAC
_("Select screenshot directory"), oldScreenshorDir, QFileDialog::ShowDirsOn //work-around for Qt bug - http://bugreports.qt.nokia.com/b
ly); rowse/QTBUG-16722
QString newScreenshotDir = QFileDialog::getExistingDirectory
(NULL, q_("Select screenshot directory"), oldScreenshorDir, QFileDialog::Do
ntUseNativeDialog);
#else
QString newScreenshotDir = QFileDialog::getExistingDirectory
(NULL, q_("Select screenshot directory"), oldScreenshorDir, QFileDialog::Sh
owDirsOnly);
#endif
if (!newScreenshotDir.isEmpty()) { if (!newScreenshotDir.isEmpty()) {
// remove trailing slash // remove trailing slash
if (newScreenshotDir.right(1) == "/") if (newScreenshotDir.right(1) == "/")
newScreenshotDir = newScreenshotDir.left(newScreensh otDir.length()-1); newScreenshotDir = newScreenshotDir.left(newScreensh otDir.length()-1);
ui->screenshotDirEdit->setText(newScreenshotDir); ui->screenshotDirEdit->setText(newScreenshotDir);
} }
} }
skipping to change at line 461 skipping to change at line 517
// Save default location // Save default location
StelApp::getInstance().getCore()->setDefaultLocationID(core->getCurr entLocation().getID()); StelApp::getInstance().getCore()->setDefaultLocationID(core->getCurr entLocation().getID());
// configuration dialog / main tab // configuration dialog / main tab
QString langName = StelApp::getInstance().getLocaleMgr().getAppLangu age(); QString langName = StelApp::getInstance().getLocaleMgr().getAppLangu age();
conf->setValue("localization/app_locale", StelTranslator::nativeName ToIso639_1Code(langName)); conf->setValue("localization/app_locale", StelTranslator::nativeName ToIso639_1Code(langName));
langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage(); langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
conf->setValue("localization/sky_locale", StelTranslator::nativeName ToIso639_1Code(langName)); conf->setValue("localization/sky_locale", StelTranslator::nativeName ToIso639_1Code(langName));
if (gui->getInfoTextFilters() == (StelObject::InfoStringGroup)0) // configuration dialog / selected object info tab
const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters()
;
if (flags == StelObject::InfoStringGroup(0))
conf->setValue("gui/selected_object_info", "none"); conf->setValue("gui/selected_object_info", "none");
else if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(St elObject::ShortInfo)) else if (flags == StelObject::InfoStringGroup(StelObject::ShortInfo) )
conf->setValue("gui/selected_object_info", "short"); conf->setValue("gui/selected_object_info", "short");
else if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(St elObject::AllInfo)) else if (flags == StelObject::InfoStringGroup(StelObject::AllInfo))
conf->setValue("gui/selected_object_info", "all"); conf->setValue("gui/selected_object_info", "all");
else else
{
conf->setValue("gui/selected_object_info", "custom"); conf->setValue("gui/selected_object_info", "custom");
conf->beginGroup("custom_selected_info");
conf->setValue("flag_show_name", (bool) (flags & StelObject:
:Name));
conf->setValue("flag_show_catalognumber",
(bool) (flags & StelObject::CatalogNumber));
conf->setValue("flag_show_magnitude",
(bool) (flags & StelObject::Magnitude));
conf->setValue("flag_show_absolutemagnitude",
(bool) (flags & StelObject::AbsoluteMagnitude
));
conf->setValue("flag_show_radecj2000",
(bool) (flags & StelObject::RaDecJ2000));
conf->setValue("flag_show_radecofdate",
(bool) (flags & StelObject::RaDecOfDate));
conf->setValue("flag_show_hourangle",
(bool) (flags & StelObject::HourAngle));
conf->setValue("flag_show_altaz",
(bool) (flags & StelObject::AltAzi));
conf->setValue("flag_show_distance",
(bool) (flags & StelObject::Distance));
conf->setValue("flag_show_size",
(bool) (flags & StelObject::Size));
conf->setValue("flag_show_extra1",
(bool) (flags & StelObject::Extra1));
conf->setValue("flag_show_extra2",
(bool) (flags & StelObject::Extra2));
conf->setValue("flag_show_extra3",
(bool) (flags & StelObject::Extra3));
conf->endGroup();
}
// toolbar auto-hide status // toolbar auto-hide status
conf->setValue("gui/auto_hide_horizontal_toolbar", gui->getAutoHideH orizontalButtonBar()); conf->setValue("gui/auto_hide_horizontal_toolbar", gui->getAutoHideH orizontalButtonBar());
conf->setValue("gui/auto_hide_vertical_toolbar", gui->getAutoHideVer ticalButtonBar()); conf->setValue("gui/auto_hide_vertical_toolbar", gui->getAutoHideVer ticalButtonBar());
conf->setValue("gui/flag_show_nebulae_background_button", gui->getFl agShowNebulaBackgroundButton());
mvmgr->setInitFov(mvmgr->getCurrentFov()); mvmgr->setInitFov(mvmgr->getCurrentFov());
mvmgr->setInitViewDirectionToCurrent(); mvmgr->setInitViewDirectionToCurrent();
// configuration dialog / navigation tab // configuration dialog / navigation tab
conf->setValue("navigation/flag_enable_zoom_keys", mvmgr->getFlagEna bleZoomKeys()); conf->setValue("navigation/flag_enable_zoom_keys", mvmgr->getFlagEna bleZoomKeys());
conf->setValue("navigation/flag_enable_mouse_navigation", mvmgr->get FlagEnableMouseNavigation()); conf->setValue("navigation/flag_enable_mouse_navigation", mvmgr->get FlagEnableMouseNavigation());
conf->setValue("navigation/flag_enable_move_keys", mvmgr->getFlagEna bleMoveKeys()); conf->setValue("navigation/flag_enable_move_keys", mvmgr->getFlagEna bleMoveKeys());
conf->setValue("navigation/startup_time_mode", core->getStartupTimeM ode()); conf->setValue("navigation/startup_time_mode", core->getStartupTimeM ode());
conf->setValue("navigation/today_time", core->getInitTodayTime()); conf->setValue("navigation/today_time", core->getInitTodayTime());
skipping to change at line 705 skipping to change at line 794
} }
#endif #endif
void ConfigurationDialog::setFixedDateTimeToCurrent(void) void ConfigurationDialog::setFixedDateTimeToCurrent(void)
{ {
ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(StelApp: :getInstance().getCore()->getJDay())); ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(StelApp: :getInstance().getCore()->getJDay()));
ui->fixedTimeRadio->setChecked(true); ui->fixedTimeRadio->setChecked(true);
setStartupTimeMode(); setStartupTimeMode();
} }
void ConfigurationDialog::changePage(QListWidgetItem *current, QListWidgetI
tem *previous)
{
if (!current)
current = previous;
ui->configurationStackedWidget->setCurrentIndex(ui->stackListWidget-
>row(current));
}
void ConfigurationDialog::resetStarCatalogControls() void ConfigurationDialog::resetStarCatalogControls()
{ {
const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatal ogsDescription(); const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatal ogsDescription();
nextStarCatalogToDownload.clear(); nextStarCatalogToDownload.clear();
int idx=0; int idx=0;
foreach (const QVariant& catV, catalogConfig) foreach (const QVariant& catV, catalogConfig)
{ {
++idx; ++idx;
const QVariantMap& m = catV.toMap(); const QVariantMap& m = catV.toMap();
const bool checked = m.value("checked").toBool(); const bool checked = m.value("checked").toBool();
skipping to change at line 930 skipping to change at line 1012
ui->downloadRetryButton->setVisible(true); ui->downloadRetryButton->setVisible(true);
} }
else else
{ {
hasDownloadedStarCatalog = true; hasDownloadedStarCatalog = true;
} }
resetStarCatalogControls(); resetStarCatalogControls();
} }
void ConfigurationDialog::showCustomInfoDialog() void ConfigurationDialog::updateSelectedInfoCheckBoxes()
{
const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters()
;
ui->checkBoxName->setChecked(flags & StelObject::Name);
ui->checkBoxCatalogNumbers->setChecked(flags & StelObject::CatalogNu
mber);
ui->checkBoxVisualMag->setChecked(flags & StelObject::Magnitude);
ui->checkBoxAbsoluteMag->setChecked(flags & StelObject::AbsoluteMagn
itude);
ui->checkBoxRaDecJ2000->setChecked(flags & StelObject::RaDecJ2000);
ui->checkBoxRaDecOfDate->setChecked(flags & StelObject::RaDecOfDate)
;
ui->checkBoxHourAngle->setChecked(flags & StelObject::HourAngle);
ui->checkBoxAltAz->setChecked(flags & StelObject::AltAzi);
ui->checkBoxDistance->setChecked(flags & StelObject::Distance);
ui->checkBoxSize->setChecked(flags & StelObject::Size);
ui->checkBoxExtra1->setChecked(flags & StelObject::Extra1);
ui->checkBoxExtra2->setChecked(flags & StelObject::Extra2);
ui->checkBoxExtra3->setChecked(flags & StelObject::Extra3);
}
void ConfigurationDialog::updateTabBarListWidgetWidth()
{ {
if(customInfoDialog == NULL) QAbstractItemModel* model = ui->stackListWidget->model();
customInfoDialog = new CustomInfoDialog(); if (!model)
return;
// Update list item sizes after translation
ui->stackListWidget->adjustSize();
int width = 0;
for (int row = 0; row < model->rowCount(); row++)
{
QModelIndex index = model->index(row, 0);
width += ui->stackListWidget->sizeHintForIndex(index).width(
);
}
// TODO: Limit the width to the width of the screen *available to th
e window*
// FIXME: This works only sometimes...
/*if (width <= ui->stackListWidget->width())
{
//qDebug() << width << ui->stackListWidget->width();
return;
}*/
// Hack to force the window to be resized...
ui->stackListWidget->setMinimumWidth(width);
customInfoDialog->setVisible(true); // FIXME: This works only sometimes...
/*
dialog->adjustSize();
dialog->update();
// ... and allow manual resize later.
ui->stackListWidget->setMinimumWidth(0);
*/
} }
 End of changes. 36 change blocks. 
44 lines changed or deleted 184 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/