void MainWindow::setMapTitle() { GeoSceneDocument *mapTheme = marbleWidget()->mapTheme(); if ( mapTheme ) { setCaption( tr( mapTheme->head()->name().toLatin1() ) ); } }
MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent ) : KXmlGuiWindow( parent ) { m_part = new MarblePart( this, this, QVariantList() << marbleDataPath ); setCentralWidget( m_part->widget() ); insertChildClient( m_part ); setXMLFile( "marbleui.rc" ); setStandardToolBarMenuEnabled( true ); createGUI( 0 ); QList<QAction*> panelActions = m_part->controlView()->setupDockWidgets( this ); m_part->unplugActionList( "panels_actionlist" ); m_part->plugActionList( "panels_actionlist", panelActions ); // Creating the plugin menus m_part->createInfoBoxesMenu(); m_part->createOnlineServicesMenu(); m_part->createRenderPluginActions(); m_part->createFolderList(); setAutoSaveSettings(); connect( marbleWidget(), SIGNAL(themeChanged(QString)), this, SLOT(setMapTitle())); }
MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent ) : KXmlGuiWindow( parent ) { m_part = new MarblePart( this, this, QVariantList() << marbleDataPath ); setCentralWidget( m_part->widget() ); insertChildClient( m_part ); setXMLFile( "marbleui.rc" ); setStandardToolBarMenuEnabled( true ); createGUI( 0 ); // Creating the plugin menus m_part->createInfoBoxesMenu(); m_part->createOnlineServicesMenu(); m_part->createFolderList(); setAutoSaveSettings(); connect( marbleWidget(), SIGNAL( themeChanged( QString ) ), this, SLOT( setMapTitle() ) ); }
void ControlView::printMapScreenShot( QPointer<QPrintDialog> printDialog) { #ifndef QT_NO_PRINTER PrintOptionsWidget* printOptions = new PrintOptionsWidget( this ); bool const mapCoversViewport = m_marbleWidget->viewport()->mapCoversViewport(); printOptions->setBackgroundControlsEnabled( !mapCoversViewport ); bool hasLegend = m_marbleWidget->model()->legend() != 0; printOptions->setLegendControlsEnabled( hasLegend ); bool hasRoute = marbleWidget()->model()->routingManager()->routingModel()->rowCount() > 0; printOptions->setPrintRouteSummary( hasRoute ); printOptions->setPrintDrivingInstructions( hasRoute ); printOptions->setPrintDrivingInstructionsAdvice( hasRoute ); printOptions->setRouteControlsEnabled( hasRoute ); printDialog->setOptionTabs( QList<QWidget*>() << printOptions ); if ( printDialog->exec() == QDialog::Accepted ) { QTextDocument document; QString text = "<html><head><title>Marble Printout</title></head><body>"; QPalette const originalPalette = m_marbleWidget->palette(); bool const wasBackgroundVisible = m_marbleWidget->showBackground(); bool const hideBackground = !mapCoversViewport && !printOptions->printBackground(); if ( hideBackground ) { // Temporarily remove the black background and layers painting on it m_marbleWidget->setShowBackground( false ); m_marbleWidget->setPalette( QPalette ( Qt::white ) ); m_marbleWidget->update(); } if ( printOptions->printMap() ) { printMap( document, text, printDialog->printer() ); } if ( printOptions->printLegend() ) { printLegend( document, text ); } if ( printOptions->printRouteSummary() ) { printRouteSummary( document, text ); } if ( printOptions->printDrivingInstructions() ) { printDrivingInstructions( document, text ); } if ( printOptions->printDrivingInstructionsAdvice() ) { printDrivingInstructionsAdvice( document, text ); } text += "</body></html>"; document.setHtml( text ); document.print( printDialog->printer() ); if ( hideBackground ) { m_marbleWidget->setShowBackground( wasBackgroundVisible ); m_marbleWidget->setPalette( originalPalette ); m_marbleWidget->update(); } } #endif }