Scenery3dDialog.cpp   Scenery3dDialog.cpp 
skipping to change at line 23 skipping to change at line 23
* 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 "Scenery3dDialog.hpp" #include "Scenery3dDialog.hpp"
#include "Scenery3dDialog_p.hpp" #include "Scenery3dDialog_p.hpp"
#include "Scenery3dMgr.hpp" #include "Scenery3d.hpp"
#include "SceneInfo.hpp" #include "SceneInfo.hpp"
#include "S3DEnum.hpp" #include "S3DEnum.hpp"
#include "StoredViewDialog.hpp" #include "StoredViewDialog.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QLineEdit> #include <QLineEdit>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QTimer> #include <QTimer>
Scenery3dDialog::Scenery3dDialog(QObject* parent) : StelDialog("Scenery3d", parent), mgr(NULL) Scenery3dDialog::Scenery3dDialog(QObject* parent) : StelDialog("Scenery3d", parent), mgr(Q_NULLPTR)
{ {
ui = new Ui_scenery3dDialogForm; ui = new Ui_scenery3dDialogForm;
} }
Scenery3dDialog::~Scenery3dDialog() Scenery3dDialog::~Scenery3dDialog()
{ {
delete ui; delete ui;
} }
void Scenery3dDialog::retranslate() void Scenery3dDialog::retranslate()
skipping to change at line 74 skipping to change at line 74
but->setProperty("stelOriginalText",but->text()); but->setProperty("stelOriginalText",but->text());
} }
updateShortcutStrings(); updateShortcutStrings();
} }
} }
void Scenery3dDialog::createDialogContent() void Scenery3dDialog::createDialogContent()
{ {
//manager should be created at this point //manager should be created at this point
mgr = GETSTELMODULE(Scenery3dMgr); mgr = GETSTELMODULE(Scenery3d);
Q_ASSERT(mgr); Q_ASSERT(mgr);
//additionally, Scenery3dMgr::init should have been called to make s ure the correct values are set for hardware support //additionally, Scenery3dMgr::init should have been called to make s ure the correct values are set for hardware support
//load Ui from form file //load Ui from form file
ui->setupUi(dialog); ui->setupUi(dialog);
updateToolTipStrings(); updateToolTipStrings();
//hook up retranslate event //hook up retranslate event
skipping to change at line 102 skipping to change at line 102
connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint))); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint)));
connect(ui->scenery3dListWidget, &QListWidget::currentItemChanged, t his, &Scenery3dDialog::scenery3dChanged); connect(ui->scenery3dListWidget, &QListWidget::currentItemChanged, t his, &Scenery3dDialog::scenery3dChanged);
//checkboxes can connect directly to manager //checkboxes can connect directly to manager
connect(ui->checkBoxEnablePixelLight, SIGNAL(clicked(bool)),mgr, connect(ui->checkBoxEnablePixelLight, SIGNAL(clicked(bool)),mgr,
SLOT(setEnablePixelLighting(bool))); SLOT(setEnablePixelLighting(bool)));
connect(ui->checkBoxEnableShadows, SIGNAL(clicked(bool)), mgr, connect(ui->checkBoxEnableShadows, SIGNAL(clicked(bool)), mgr,
SLOT(setEnableShadows(bool))); SLOT(setEnableShadows(bool)));
connect(ui->checkBoxEnableBump, SIGNAL(clicked(bool)), mgr, connect(ui->checkBoxEnableBump, SIGNAL(clicked(bool)), mgr,
SLOT(setEnableBumps(bool))); SLOT(setEnableBumps(bool)));
connect(ui->checkBoxEnableLazyDrawing, &QCheckBox::clicked, mgr, &Sc connect(ui->checkBoxEnableLazyDrawing, &QCheckBox::clicked, mgr, &Sc
enery3dMgr::setEnableLazyDrawing); enery3d::setEnableLazyDrawing);
connect(ui->checkBoxDominantFace, &QCheckBox::clicked, mgr, &Scenery connect(ui->checkBoxDominantFace, &QCheckBox::clicked, mgr, &Scenery
3dMgr::setOnlyDominantFaceWhenMoving); 3d::setOnlyDominantFaceWhenMoving);
connect(ui->checkBoxSecondDominantFace, &QCheckBox::clicked, mgr, &S connect(ui->checkBoxSecondDominantFace, &QCheckBox::clicked, mgr, &S
cenery3dMgr::setSecondDominantFaceWhenMoving); cenery3d::setSecondDominantFaceWhenMoving);
connect(ui->checkBoxPCSS, &QCheckBox::clicked, mgr, &Scenery3dMgr::s connect(ui->checkBoxPCSS, &QCheckBox::clicked, mgr, &Scenery3d::setE
etEnablePCSS); nablePCSS);
connect(ui->spinLazyDrawingInterval, static_cast<void (QDoubleSpinBo connect(ui->spinLazyDrawingInterval, static_cast<void (QDoubleSpinBo
x::*)(double)>(&QDoubleSpinBox::valueChanged), mgr, &Scenery3dMgr::setLazyD x::*)(double)>(&QDoubleSpinBox::valueChanged), mgr, &Scenery3d::setLazyDraw
rawingInterval); ingInterval);
connect(ui->checkBoxSimpleShadows, &QCheckBox::clicked, mgr, &Scener connect(ui->checkBoxSimpleShadows, &QCheckBox::clicked, mgr, &Scener
y3dMgr::setUseSimpleShadows); y3d::setUseSimpleShadows);
connect(ui->checkBoxCubemapShadows, &QCheckBox::clicked, mgr, &Scene connect(ui->checkBoxCubemapShadows, &QCheckBox::clicked, mgr, &Scene
ry3dMgr::setUseFullCubemapShadows); ry3d::setUseFullCubemapShadows);
//hook up some Scenery3d actions //hook up some Scenery3d actions
StelActionMgr* acMgr = StelApp::getInstance().getStelActionManager() ; StelActionMgr* acMgr = StelApp::getInstance().getStelActionManager() ;
StelAction* ac = acMgr->findAction("actionShow_Scenery3d_torchlight" ); StelAction* ac = acMgr->findAction("actionShow_Scenery3d_torchlight" );
if(ac) if(ac)
{ {
ui->checkBoxTorchlight->setProperty("stelActionKey",ac->getI d()); ui->checkBoxTorchlight->setProperty("stelActionKey",ac->getI d());
ui->checkBoxTorchlight->setProperty("stelOriginalText",ui->c heckBoxTorchlight->text()); ui->checkBoxTorchlight->setProperty("stelOriginalText",ui->c heckBoxTorchlight->text());
ui->checkBoxTorchlight->setChecked(ac->isChecked()); ui->checkBoxTorchlight->setChecked(ac->isChecked());
connect(ac,&StelAction::toggled,ui->checkBoxTorchlight, &QCh eckBox::setChecked); connect(ac,&StelAction::toggled,ui->checkBoxTorchlight, &QCh eckBox::setChecked);
skipping to change at line 147 skipping to change at line 147
//the "new" syntax is extremly ugly in case signals have overloads //the "new" syntax is extremly ugly in case signals have overloads
connect(ui->comboBoxCubemapMode, static_cast<void (QComboBox::*)(int )>(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBoxCub emapMode_currentIndexChanged); connect(ui->comboBoxCubemapMode, static_cast<void (QComboBox::*)(int )>(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBoxCub emapMode_currentIndexChanged);
connect(ui->comboBoxShadowFiltering, static_cast<void (QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBo xShadowFiltering_currentIndexChanged); connect(ui->comboBoxShadowFiltering, static_cast<void (QComboBox::*) (int)>(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBo xShadowFiltering_currentIndexChanged);
connect(ui->comboBoxCubemapSize,static_cast<void (QComboBox::*)(int) >(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBoxCube mapSize_currentIndexChanged); connect(ui->comboBoxCubemapSize,static_cast<void (QComboBox::*)(int) >(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBoxCube mapSize_currentIndexChanged);
connect(ui->comboBoxShadowmapSize,static_cast<void (QComboBox::*)(in t)>(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBoxSh adowmapSize_currentIndexChanged); connect(ui->comboBoxShadowmapSize,static_cast<void (QComboBox::*)(in t)>(&QComboBox::currentIndexChanged), this, &Scenery3dDialog::on_comboBoxSh adowmapSize_currentIndexChanged);
connect(ui->sliderTorchStrength, &QSlider::valueChanged, this, &Scen ery3dDialog::on_sliderTorchStrength_valueChanged); connect(ui->sliderTorchStrength, &QSlider::valueChanged, this, &Scen ery3dDialog::on_sliderTorchStrength_valueChanged);
connect(ui->sliderTorchRange, &QSlider::valueChanged, this, &Scenery 3dDialog::on_sliderTorchRange_valueChanged); connect(ui->sliderTorchRange, &QSlider::valueChanged, this, &Scenery 3dDialog::on_sliderTorchRange_valueChanged);
connect(ui->checkBoxDefaultScene, &QCheckBox::stateChanged, this, &S cenery3dDialog::on_checkBoxDefaultScene_stateChanged); connect(ui->checkBoxDefaultScene, &QCheckBox::stateChanged, this, &S cenery3dDialog::on_checkBoxDefaultScene_stateChanged);
connect(ui->pushButtonOpenStoredViewDialog, &QPushButton::clicked, m gr, &Scenery3dMgr::showStoredViewDialog); connect(ui->pushButtonOpenStoredViewDialog, &QPushButton::clicked, m gr, &Scenery3d::showStoredViewDialog);
updateShortcutStrings(); updateShortcutStrings();
createUpdateConnections(); createUpdateConnections();
// Fill the scenery list // Fill the scenery list
QListWidget* l = ui->scenery3dListWidget; QListWidget* l = ui->scenery3dListWidget;
l->blockSignals(true); l->blockSignals(true);
l->clear(); l->clear();
QStringList sceneList = SceneInfo::getAllSceneNames(); QStringList sceneList = SceneInfo::getAllSceneNames();
foreach (const QString sceneName, sceneList) foreach (const QString sceneName, sceneList)
skipping to change at line 210 skipping to change at line 210
//init resolution boxes //init resolution boxes
initResolutionCombobox(ui->comboBoxCubemapSize); initResolutionCombobox(ui->comboBoxCubemapSize);
initResolutionCombobox(ui->comboBoxShadowmapSize); initResolutionCombobox(ui->comboBoxShadowmapSize);
setToInitialValues(); setToInitialValues();
} }
void Scenery3dDialog::createUpdateConnections() void Scenery3dDialog::createUpdateConnections()
{ {
//connect Scenery3d update events //connect Scenery3d update events
connect(mgr, &Scenery3dMgr::enablePixelLightingChanged, ui->checkBox connect(mgr, &Scenery3d::enablePixelLightingChanged, ui->checkBoxEna
EnablePixelLight, &QCheckBox::setChecked); blePixelLight, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::enablePixelLightingChanged, ui->checkBox connect(mgr, &Scenery3d::enablePixelLightingChanged, ui->checkBoxEna
EnableShadows, &QCheckBox::setEnabled); bleShadows, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::enablePixelLightingChanged, ui->checkBox connect(mgr, &Scenery3d::enablePixelLightingChanged, ui->checkBoxEna
EnableBump, &QCheckBox::setEnabled); bleBump, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::enableShadowsChanged, ui->checkBoxEnable connect(mgr, &Scenery3d::enableShadowsChanged, ui->checkBoxEnableSha
Shadows, &QCheckBox::setChecked); dows, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::enableBumpsChanged, ui->checkBoxEnableBu connect(mgr, &Scenery3d::enableBumpsChanged, ui->checkBoxEnableBump,
mp, &QCheckBox::setChecked); &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::enablePCSSChanged,ui->checkBoxPCSS,&QChe connect(mgr, &Scenery3d::enablePCSSChanged,ui->checkBoxPCSS,&QCheckB
ckBox::setChecked); ox::setChecked);
connect(mgr, &Scenery3dMgr::enableShadowsChanged, ui->checkBoxSimple connect(mgr, &Scenery3d::enableShadowsChanged, ui->checkBoxSimpleSha
Shadows, &QCheckBox::setEnabled); dows, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::enableShadowsChanged, ui->checkBoxCubema connect(mgr, &Scenery3d::enableShadowsChanged, ui->checkBoxCubemapSh
pShadows, &QCheckBox::setEnabled); adows, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::useSimpleShadowsChanged, ui->checkBoxSim connect(mgr, &Scenery3d::useSimpleShadowsChanged, ui->checkBoxSimple
pleShadows, &QCheckBox::setChecked); Shadows, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::useFullCubemapShadowsChanged, ui->checkB connect(mgr, &Scenery3d::useFullCubemapShadowsChanged, ui->checkBoxC
oxCubemapShadows, &QCheckBox::setChecked); ubemapShadows, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::cubemappingModeChanged, ui->comboBoxCube connect(mgr, &Scenery3d::cubemappingModeChanged, ui->comboBoxCubemap
mapMode, &QComboBox::setCurrentIndex); Mode, &QComboBox::setCurrentIndex);
connect(mgr, &Scenery3dMgr::shadowFilterQualityChanged, this, &Scene connect(mgr, &Scenery3d::shadowFilterQualityChanged, this, &Scenery3
ry3dDialog::updateShadowFilterQuality); dDialog::updateShadowFilterQuality);
connect(mgr, &Scenery3dMgr::torchStrengthChanged, this, &Scenery3dDi connect(mgr, &Scenery3d::torchStrengthChanged, this, &Scenery3dDialo
alog::updateTorchStrength); g::updateTorchStrength);
connect(mgr, &Scenery3dMgr::torchRangeChanged, this, &Scenery3dDialo connect(mgr, &Scenery3d::torchRangeChanged, this, &Scenery3dDialog::
g::updateTorchRange); updateTorchRange);
connect(mgr, &Scenery3dMgr::enableLazyDrawingChanged, ui->checkBoxEn connect(mgr, &Scenery3d::enableLazyDrawingChanged, ui->checkBoxEnabl
ableLazyDrawing, &QCheckBox::setChecked); eLazyDrawing, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::enableLazyDrawingChanged, ui->labelLazyD connect(mgr, &Scenery3d::enableLazyDrawingChanged, ui->labelLazyDraw
rawingInterval, &QCheckBox::setEnabled); ingInterval, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::enableLazyDrawingChanged, ui->spinLazyDr connect(mgr, &Scenery3d::enableLazyDrawingChanged, ui->spinLazyDrawi
awingInterval, &QCheckBox::setEnabled); ngInterval, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::enableLazyDrawingChanged, ui->checkBoxDo connect(mgr, &Scenery3d::enableLazyDrawingChanged, ui->checkBoxDomin
minantFace, &QCheckBox::setEnabled); antFace, &QCheckBox::setEnabled);
connect(mgr, &Scenery3dMgr::enableLazyDrawingChanged, this, &Scenery connect(mgr, &Scenery3d::enableLazyDrawingChanged, this, &Scenery3dD
3dDialog::updateSecondDominantFaceEnabled); ialog::updateSecondDominantFaceEnabled);
connect(mgr, &Scenery3dMgr::lazyDrawingIntervalChanged, this, &Scene connect(mgr, &Scenery3d::lazyDrawingIntervalChanged, this, &Scenery3
ry3dDialog::updateLazyDrawingInterval); dDialog::updateLazyDrawingInterval);
connect(mgr, &Scenery3dMgr::onlyDominantFaceWhenMovingChanged, ui->c connect(mgr, &Scenery3d::onlyDominantFaceWhenMovingChanged, ui->chec
heckBoxDominantFace, &QCheckBox::setChecked); kBoxDominantFace, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::onlyDominantFaceWhenMovingChanged, this, connect(mgr, &Scenery3d::onlyDominantFaceWhenMovingChanged, this, &S
&Scenery3dDialog::updateSecondDominantFaceEnabled); cenery3dDialog::updateSecondDominantFaceEnabled);
connect(mgr, &Scenery3dMgr::secondDominantFaceWhenMovingChanged, ui- connect(mgr, &Scenery3d::secondDominantFaceWhenMovingChanged, ui->ch
>checkBoxSecondDominantFace, &QCheckBox::setChecked); eckBoxSecondDominantFace, &QCheckBox::setChecked);
connect(mgr, &Scenery3dMgr::currentSceneChanged, this, &Scenery3dDia log::updateCurrentScene); connect(mgr, &Scenery3d::currentSceneChanged, this, &Scenery3dDialog ::updateCurrentScene);
} }
void Scenery3dDialog::updateToolTipStrings() void Scenery3dDialog::updateToolTipStrings()
{ {
QString toolTipEnablePixelLight = QString("<html><head/><body><p>%1< /p><p>%2</p></body></html>") QString toolTipEnablePixelLight = QString("<html><head/><body><p>%1< /p><p>%2</p></body></html>")
.arg(q_("Provides more accurate lighting by calculat ing it per-pixel instead of per-vertex.")) .arg(q_("Provides more accurate lighting by calculat ing it per-pixel instead of per-vertex."))
.arg(q_("Required for bump mapping and shadows!")); .arg(q_("Required for bump mapping and shadows!"));
QString toolTipSimpleShadows = QString("<html><head/><body><p>%1</p> <p>%2</p></body></html>") QString toolTipSimpleShadows = QString("<html><head/><body><p>%1</p> <p>%2</p></body></html>")
.arg(q_("Uses only a single shadow cascade instead o f up to four.")) .arg(q_("Uses only a single shadow cascade instead o f up to four."))
.arg(q_("Provides a speedup in exchange for shadow q uality, especially in large scenes.")); .arg(q_("Provides a speedup in exchange for shadow q uality, especially in large scenes."));
skipping to change at line 397 skipping to change at line 397
} }
void Scenery3dDialog::on_checkBoxDefaultScene_stateChanged(int value) void Scenery3dDialog::on_checkBoxDefaultScene_stateChanged(int value)
{ {
QList<QListWidgetItem*> sel = ui->scenery3dListWidget->selectedItems (); QList<QListWidgetItem*> sel = ui->scenery3dListWidget->selectedItems ();
if(sel.size()==0) if(sel.size()==0)
return; return;
if(value) if(value)
{ {
QString id = SceneInfo::getIDFromName(sel.at(0)->text()); QString id = SceneInfo::getIDFromName(sel.at(0)->data(Qt::Us erRole).toString());
if(!id.isEmpty()) if(!id.isEmpty())
mgr->setDefaultScenery3dID(id); mgr->setDefaultScenery3dID(id);
} }
else else
mgr->setDefaultScenery3dID(""); mgr->setDefaultScenery3dID("");
} }
void Scenery3dDialog::scenery3dChanged(QListWidgetItem* item) void Scenery3dDialog::scenery3dChanged(QListWidgetItem* item)
{ {
SceneInfo info = mgr->loadScenery3dByName(item->data(Qt::UserRole).t oString()); SceneInfo info = mgr->loadScenery3dByName(item->data(Qt::UserRole).t oString());
 End of changes. 9 change blocks. 
72 lines changed or deleted 72 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/