diff --git a/src/lib/marble/SunControlWidget.cpp b/src/lib/marble/SunControlWidget.cpp index 90700e354..2c20c19e6 100644 --- a/src/lib/marble/SunControlWidget.cpp +++ b/src/lib/marble/SunControlWidget.cpp @@ -1,132 +1,132 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2008 David Roberts // Copyright 2008 Inge Wallin // Copyright 2010 Harshit Jain // Copyright 2012 Mohammed Nafees // // Own #include "SunControlWidget.h" #include "ui_SunControlWidget.h" // Qt #include #include // Marble #include "MarbleDebug.h" #include "MarbleWidget.h" using namespace Marble; /* TRANSLATOR Marble::SunControlWidget */ SunControlWidget::SunControlWidget( MarbleWidget* marbleWidget, QWidget* parent ) : QDialog( parent ), m_uiWidget( new Ui::SunControlWidget ), m_marbleWidget( marbleWidget ), m_shadow( "shadow" ) { m_uiWidget->setupUi( this ); m_uiWidget->lockWarningLabel->hide(); connect( m_uiWidget->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()) ); - connect( m_uiWidget->buttonBox, SIGNAL(reject()), this, SLOT(reject()) ); + connect( m_uiWidget->buttonBox, SIGNAL(rejected()), this, SLOT(reject()) ); connect( m_uiWidget->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()) ); connect( m_uiWidget->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept()) ); setModal( false ); } SunControlWidget::~SunControlWidget() { delete m_uiWidget; } void SunControlWidget::apply() { if( m_uiWidget->sunShading->isChecked() ) { if( m_uiWidget->showShadow->isChecked() ) { emit showSun( true ); m_marbleWidget->setShowCityLights( false ); m_shadow = "shadow"; } else if( m_uiWidget->showNightMap->isChecked() ) { emit showSun( true ); m_marbleWidget->setShowCityLights( true ); m_shadow = "nightmap"; } } else { emit showSun( false ); m_marbleWidget->setShowCityLights( false ); } if( m_uiWidget->lockToSubSolarPointCheckBox->isChecked() ) { m_marbleWidget->setLockToSubSolarPoint( true ); emit isLockedToSubSolarPoint( true ); } else { m_marbleWidget->setLockToSubSolarPoint( false ); emit isLockedToSubSolarPoint( false ); } if( m_uiWidget->subSolarIconCheckBox->isChecked() ) { m_marbleWidget->setSubSolarPointIconVisible( true ); emit isSubSolarPointIconVisible( true ); } else { m_marbleWidget->setSubSolarPointIconVisible( false ); emit isSubSolarPointIconVisible( false ); } } void SunControlWidget::setSunShading( bool active ) { m_uiWidget->sunShading->setChecked( active ); } void SunControlWidget::showEvent( QShowEvent* event ) { if( !event->spontaneous() ) { // Loading all options if( m_marbleWidget->showSunShading() ) { m_uiWidget->sunShading->setChecked( true ); m_uiWidget->showShadow->setChecked( m_marbleWidget->showSunShading() ); m_uiWidget->showNightMap->setChecked( m_marbleWidget->showCityLights() ); } else { m_uiWidget->showShadow->setChecked( false ); if (m_shadow == QLatin1String("shadow")) { m_uiWidget->showShadow->setChecked( true ); } else { m_uiWidget->showNightMap->setChecked( true ); } } m_uiWidget->subSolarIconCheckBox->setChecked( m_marbleWidget->isSubSolarPointIconVisible() ); m_uiWidget->lockToSubSolarPointCheckBox->setChecked( m_marbleWidget->isLockedToSubSolarPoint() ); } } #include "moc_SunControlWidget.cpp" diff --git a/src/lib/marble/TileCreatorDialog.cpp b/src/lib/marble/TileCreatorDialog.cpp index 9fc0734ba..e20f8e671 100644 --- a/src/lib/marble/TileCreatorDialog.cpp +++ b/src/lib/marble/TileCreatorDialog.cpp @@ -1,94 +1,94 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn // Copyright 2007 Inge Wallin // // Own #include "TileCreatorDialog.h" // Qt #include #include // Marble #include "MarbleDebug.h" #include "TileCreator.h" #include "ui_TileCreatorDialog.h" namespace Marble { class TileCreatorDialogPrivate { public: Ui::TileCreatorDialog uiWidget; TileCreator *m_creator; }; TileCreatorDialog::TileCreatorDialog(TileCreator *creator, QWidget *parent) : QDialog(parent), d( new TileCreatorDialogPrivate ) { d->m_creator = creator; d->uiWidget.setupUi(this); connect( d->m_creator, SIGNAL(progress(int)), this, SLOT(setProgress(int)), Qt::QueuedConnection ); - connect( d->uiWidget.buttonBox, SIGNAL(reject()), + connect( d->uiWidget.buttonBox, SIGNAL(rejected()), this, SLOT(cancelTileCreation()) ); // Start the creation process d->m_creator->start(); } void TileCreatorDialog::cancelTileCreation() { d->uiWidget.buttonBox->button(QDialogButtonBox::Cancel)->setEnabled( false ); /** @todo: Cancelling mostly crashes Marble. Fix that and uncomment below */ // d->m_creator->cancelTileCreation(); } TileCreatorDialog::~TileCreatorDialog() { disconnect( d->m_creator, SIGNAL(progress(int)), this, SLOT(setProgress(int)) ); if ( d->m_creator->isRunning() ) d->m_creator->cancelTileCreation(); d->m_creator->wait(); d->m_creator->deleteLater(); delete d; } void TileCreatorDialog::setProgress( int progress ) { d->uiWidget.progressBar->setValue( progress ); if ( progress == 100 ) { QTimer::singleShot( 0, this, SLOT(accept()) ); } } void TileCreatorDialog::setSummary( const QString& name, const QString& description ) { const QString summary = QLatin1String("") + QCoreApplication::translate("DGML", name.toUtf8().constData()) + QLatin1String("
") + QCoreApplication::translate("DGML", description.toUtf8().constData()); d->uiWidget.descriptionLabel->setText( summary ); } } #include "moc_TileCreatorDialog.cpp" diff --git a/src/lib/marble/TimeControlWidget.cpp b/src/lib/marble/TimeControlWidget.cpp index c9457ae44..b10990d64 100644 --- a/src/lib/marble/TimeControlWidget.cpp +++ b/src/lib/marble/TimeControlWidget.cpp @@ -1,97 +1,97 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2010 Harshit Jain // // Own #include "TimeControlWidget.h" #include "ui_TimeControlWidget.h" // Qt #include #include // Marble #include "MarbleClock.h" #include "MarbleDebug.h" using namespace Marble; /* TRANSLATOR Marble::TimeControlWidget */ TimeControlWidget::TimeControlWidget( MarbleClock* clock, QWidget* parent ) : QDialog( parent ), m_uiWidget( new Ui::TimeControlWidget ), m_clock( clock ), m_lastDateTime() { m_uiWidget->setupUi( this ); connect( m_uiWidget->speedSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSpeedLabel(int)) ); connect( m_uiWidget->nowToolButton, SIGNAL(clicked()), this, SLOT(nowClicked()) ); connect( m_uiWidget->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()) ); - connect( m_uiWidget->buttonBox, SIGNAL(reject()), this, SLOT(reject()) ); + connect( m_uiWidget->buttonBox, SIGNAL(rejected()), this, SLOT(reject()) ); connect( m_uiWidget->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()) ); connect( m_uiWidget->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept()) ); connect( m_clock, SIGNAL(timeChanged()), this, SLOT(updateDateTime()) ); connect( m_clock, SIGNAL(updateIntervalChanged(int)), this, SLOT(updateRefreshRate(int)) ); setModal( false ); } TimeControlWidget::~TimeControlWidget() { delete m_uiWidget; } void TimeControlWidget::updateSpeedLabel( int speed ) { m_uiWidget->speedLabel->setText( QString( "%1x" ).arg( speed ) ); } void TimeControlWidget::updateRefreshRate( int seconds ) { m_uiWidget->refreshIntervalSpinBox->setValue( seconds ); } void TimeControlWidget::updateDateTime() { m_uiWidget->currentDateTimeEdit->setDateTime( m_clock->dateTime().addSecs( m_clock->timezone() ) ); } void TimeControlWidget::nowClicked() { m_uiWidget->newDateTimeEdit->setDateTime( QDateTime::currentDateTime().toUTC().addSecs( m_clock->timezone() ) ); } void TimeControlWidget::apply() { if( m_lastDateTime != m_uiWidget->newDateTimeEdit->dateTime() ) { m_lastDateTime = m_uiWidget->newDateTimeEdit->dateTime(); m_clock->setDateTime( m_lastDateTime.toUTC() ); } m_clock->setUpdateInterval( m_uiWidget->refreshIntervalSpinBox->value() ); m_clock->setSpeed( m_uiWidget->speedSlider->value() ); } void TimeControlWidget::showEvent(QShowEvent* event) { if( !event->spontaneous() ) { // Loading all options m_uiWidget->refreshIntervalSpinBox->setValue( m_clock->updateInterval() ); m_uiWidget->speedSlider->setValue( m_clock->speed() ); m_uiWidget->speedLabel->setText( QString( "%1x" ).arg( m_clock->speed() ) ); updateDateTime(); m_lastDateTime = m_clock->dateTime(); m_uiWidget->newDateTimeEdit->setDateTime( m_lastDateTime.addSecs( m_clock->timezone() ) ); } } #include "moc_TimeControlWidget.cpp" diff --git a/src/plugins/render/annotate/DownloadOsmDialog.cpp b/src/plugins/render/annotate/DownloadOsmDialog.cpp index c5606c814..7338270f2 100644 --- a/src/plugins/render/annotate/DownloadOsmDialog.cpp +++ b/src/plugins/render/annotate/DownloadOsmDialog.cpp @@ -1,173 +1,173 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2017 Sutirtha Ghosh // //Self #include "DownloadOsmDialog.h" //Qt #include #include #include #include #include #include //Marble #include "ui_DownloadOsmDialog.h" #include "MarbleWidget.h" #include "ViewParams.h" #include "ViewportParams.h" #include "GeoDataLatLonAltBox.h" #include "GeoDataLatLonBox.h" #include "MarbleGlobal.h" #include "AnnotatePlugin.h" #include "LatLonBoxWidget.h" namespace Marble { DownloadOsmDialog::DownloadOsmDialog(MarbleWidget *parent,AnnotatePlugin *annotatePlugin) : QDialog(parent), m_marbleWidget(parent), m_latLonBoxWidget(new LatLonBoxWidget) { setupUi(this); horizontalLayout->addWidget(m_latLonBoxWidget); this->setWindowTitle("Download"); connect(m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(updateCoordinates(GeoDataLatLonAltBox) ) ); m_downloadButton = new QPushButton(tr("Download")); m_downloadButton->setDefault(true); buttonBox->addButton(m_downloadButton,QDialogButtonBox::ActionRole); connect( m_downloadButton, SIGNAL(clicked(bool)), this, SLOT(downloadFile()) ); - connect( buttonBox, SIGNAL(reject()), this, SLOT(close()) ); + connect( buttonBox, SIGNAL(rejected()), this, SLOT(close()) ); connect( this, SIGNAL(openFile(QString)), annotatePlugin, SLOT(openAnnotationFile(QString)) ); progressBar->hide(); updateCoordinates(); } DownloadOsmDialog::~DownloadOsmDialog() { } void DownloadOsmDialog::updateCoordinates() { m_latLonBoxWidget->setLatLonBox( m_marbleWidget->viewport()->viewLatLonAltBox() ); } void DownloadOsmDialog::updateCoordinates( const GeoDataLatLonAltBox& boundingBox ) { m_latLonBoxWidget->setLatLonBox( boundingBox ); } void DownloadOsmDialog::downloadFile() { QString m_west; QString m_south; QString m_east; QString m_north; QString url; m_isDownloadSuccess=false; m_file = new QTemporaryFile(QDir::tempPath()+"/"+"XXXXXXosmdata.osm"); if(!m_file->open()) { QMessageBox::information(this, tr("ERROR"), "Unable to create temporary file to download OSM data to."); this->close(); } m_downloadButton->setEnabled(false); m_west=QString::number( m_latLonBoxWidget->latLonBox().west()*RAD2DEG ); m_south=QString::number( m_latLonBoxWidget->latLonBox().south()*RAD2DEG ); m_east=QString::number( m_latLonBoxWidget->latLonBox().east()*RAD2DEG ); m_north=QString::number( m_latLonBoxWidget->latLonBox().north()*RAD2DEG ); url="http://api.openstreetmap.org/api/0.6/map?bbox="; url+=m_west+","; url+=m_south+","; url+=m_east+","; url+=m_north; m_reply = m_qnam.get(QNetworkRequest(QUrl(url))); connect( m_reply, SIGNAL(finished()), this, SLOT(httpFinished()) ); connect( m_reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()) ); progressBar->show(); progressBar->setMinimum(0); progressBar->setMaximum(0); } void DownloadOsmDialog::httpReadyRead() { //Reads all the data present and writes it to the file whenever data is //available if ( m_file ){ m_file->write(m_reply->readAll()); } } void DownloadOsmDialog::httpFinished() { QVariant statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); int status = statusCode.toInt(); //in case download fails due to network error or server not available if ( m_reply->error()==QNetworkReply::NoError ){ m_isDownloadSuccess=true; } else { switch(status) { case 400: QMessageBox::information(this, tr("ERROR"), "The selected region contains too much data.Please select a smaller region and try again."); m_downloadButton->setEnabled(true); m_isDownloadSuccess=false; break; case 509: QMessageBox::information(this, tr("ERROR"), "The bandwidth limit exceeded.Please try again later."); m_downloadButton->setEnabled(true); m_isDownloadSuccess=false; break; default: QMessageBox::information(this, tr("ERROR"),"Sorry, a network error occured.Please check your internet connection" " or try again later."); m_downloadButton->setEnabled(true); m_isDownloadSuccess=false; break; } } progressBar->hide(); m_file->flush(); m_file->close(); if( m_isDownloadSuccess ) { emit openFile(m_file->fileName()); } m_reply->deleteLater(); m_reply=nullptr; delete m_file; m_file=nullptr; if( m_isDownloadSuccess ) { this->close(); } } } #include "moc_DownloadOsmDialog.cpp"