• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
TourWidget.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2013 Mihail Ivchenko <ematirov@gmail>
9 // Copyright 2014 Sanjiban Bairagya <sanjiban22393@gmail.com>
10 //
11 
12 #include "TourWidget.h"
13 
14 #include "ui_TourWidget.h"
15 #include "GeoDataDocument.h"
16 #include "GeoDataTour.h"
17 #include "GeoDataTreeModel.h"
18 #include "GeoDataTypes.h"
19 #include "GeoDataFlyTo.h"
20 #include "GeoDataWait.h"
21 #include "GeoDataCamera.h"
22 #include "GeoDataTourControl.h"
23 #include "GeoDataSoundCue.h"
24 #include "GeoWriter.h"
25 #include "KmlElementDictionary.h"
26 #include "MarbleModel.h"
27 #include "MarblePlacemarkModel.h"
28 #include "MarbleWidget.h"
29 #include "ParsingRunnerManager.h"
30 #include "TourPlayback.h"
31 #include "MarbleDebug.h"
32 
33 #include <QFileDialog>
34 #include <QDir>
35 #include <QModelIndex>
36 #include <QMessageBox>
37 #include <QStyledItemDelegate>
38 #include <QAbstractTextDocumentLayout>
39 #include <QPainter>
40 #include <QListView>
41 #include <QApplication>
42 #include <QLabel>
43 #include <QDoubleSpinBox>
44 #include <QRadioButton>
45 #include <QHBoxLayout>
46 #include <QToolButton>
47 #include <QLineEdit>
48 
49 namespace Marble
50 {
51 
52 class TourWidgetPrivate
53 {
54 
55 public:
56  TourWidgetPrivate( TourWidget *parent );
57  GeoDataFeature *getPlaylistFeature() const;
58  void updateRootIndex();
59 
60 public:
61  void openFile();
62  bool openFile( const QString &filename );
63  void createTour();
64  void saveTour();
65  void saveTourAs();
66  void mapCenterOn(const QModelIndex &index );
67  void addFlyTo();
68  void deleteSelected();
69  void updateButtonsStates();
70  void moveUp();
71  void moveDown();
72  void handlePlaybackProgress( const double position );
73 
74 private:
75  GeoDataTour* findTour( GeoDataFeature* feature ) const;
76  GeoDataObject *rootIndexObject() const;
77  bool openDocument( GeoDataDocument *document );
78  bool saveTourAs( const QString &filename );
79  bool overrideModifications();
80  bool m_isChanged;
81 
82 public:
83  TourWidget *q;
84  MarbleWidget *m_widget;
85  Ui::TourWidget m_tourUi;
86  GeoDataTreeModel m_model;
87  TourPlayback m_playback;
88  TourItemDelegate *m_delegate;
89  bool m_playState;
90 };
91 
92 TourWidgetPrivate::TourWidgetPrivate( TourWidget *parent )
93  : m_isChanged( false ),
94  q( parent ),
95  m_widget( 0 ),
96  m_playback( 0 ),
97  m_delegate( 0 ),
98  m_playState( false )
99 {
100  m_tourUi.setupUi( parent );
101  m_tourUi.m_listView->setModel( &m_model );
102  m_tourUi.m_listView->setModelColumn(1);
103 
104  QObject::connect( m_tourUi.m_listView, SIGNAL( activated( QModelIndex ) ), q, SLOT( mapCenterOn( QModelIndex ) ) );
105  QObject::connect( m_tourUi.m_listView->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
106  q, SLOT( updateButtonsStates() ) );
107  QObject::connect( m_tourUi.m_actionAddFlyTo, SIGNAL( triggered() ), q, SLOT( addFlyTo() ) );
108  QObject::connect( m_tourUi.m_actionDelete, SIGNAL( triggered() ), q, SLOT( deleteSelected() ) );
109  QObject::connect( m_tourUi.m_actionMoveUp, SIGNAL( triggered() ), q, SLOT( moveUp() ) );
110  QObject::connect( m_tourUi.m_actionMoveDown, SIGNAL( triggered() ), q, SLOT( moveDown() ) );
111  QObject::connect( q, SIGNAL( featureUpdated( GeoDataFeature* ) ), &m_model, SLOT( updateFeature( GeoDataFeature* ) ) );
112  QObject::connect( m_tourUi.m_actionNewTour, SIGNAL( triggered() ), q, SLOT( createTour() ) );
113  QObject::connect( m_tourUi.m_actionOpenTour, SIGNAL( triggered() ), q, SLOT( openFile() ) );
114  QObject::connect( m_tourUi.m_actionSaveTour, SIGNAL( triggered() ), q, SLOT( saveTour() ) );
115  QObject::connect( m_tourUi.m_actionSaveTourAs, SIGNAL( triggered() ), q, SLOT( saveTourAs() ) );
116  QObject::connect( &m_playback, SIGNAL(centerOn(GeoDataCoordinates)), q, SLOT(centerOn(GeoDataCoordinates)) );
117  QObject::connect( &m_playback, SIGNAL( finished() ), q, SLOT( stopPlaying() ) );
118 }
119 
120 TourWidget::TourWidget( QWidget *parent, Qt::WindowFlags flags )
121  : QWidget( parent, flags ),
122  d( new TourWidgetPrivate( this ) )
123 {
124  layout()->setMargin( 0 );
125 
126  connect( d->m_tourUi.actionPlay, SIGNAL( triggered() ),
127  this, SLOT( togglePlaying() ) );
128  connect( d->m_tourUi.actionStop, SIGNAL( triggered() ),
129  this, SLOT( stopPlaying() ) );
130  connect( d->m_tourUi.m_slider, SIGNAL( sliderMoved( int ) ),
131  this, SLOT( handleSliderMove( int ) ) );
132 
133  d->m_tourUi.m_toolBarPlayback->setDisabled(true);
134 }
135 
136 TourItemDelegate::TourItemDelegate( QListView* view, MarbleWidget* widget ):
137  m_listView( view ), m_widget( widget ), m_editable( true )
138 {
139  QObject::connect( this, SIGNAL( editingChanged( QModelIndex ) ), m_listView, SLOT( update( QModelIndex ) ) );
140  m_listView->setEditTriggers( QAbstractItemView::NoEditTriggers );
141 }
142 
143 void TourItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
144 {
145  QStyleOptionViewItemV4 styleOption = option;
146  styleOption.text = QString();
147  QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &styleOption, painter);
148 
149  QAbstractTextDocumentLayout::PaintContext paintContext;
150  if (styleOption.state & QStyle::State_Selected) {
151  paintContext.palette.setColor(QPalette::Text,
152  styleOption.palette.color(QPalette::Active, QPalette::HighlightedText));
153  }
154 
155  QTextDocument label;
156  QRect const labelRect = position(Label, option);
157  label.setTextWidth( labelRect.width() );
158  label.setDefaultFont( option.font );
159 
160  QStyleOptionButton button;
161  button.state = option.state;
162  button.palette = option.palette;
163  button.features = QStyleOptionButton::None;
164  button.iconSize = QSize( 16, 16 );
165  button.state &= ~QStyle::State_HasFocus;
166  if( !editable() ) {
167  button.state &= ~QStyle::State_Enabled;
168  }
169 
170  QRect const iconRect = position( GeoDataElementIcon, option );
171 
172  GeoDataObject *object = qvariant_cast<GeoDataObject*>(index.data( MarblePlacemarkModel::ObjectPointerRole ) );
173  if ( object->nodeType() == GeoDataTypes::GeoDataTourControlType && !m_editingIndices.contains( index ) ) {
174  GeoDataTourControl *tourControl = static_cast<GeoDataTourControl*> ( object );
175  GeoDataTourControl::PlayMode const playMode = tourControl->playMode();
176 
177  if ( playMode == GeoDataTourControl::Play ) {
178  label.setHtml( tr("Play the tour") );
179  } else if ( playMode == GeoDataTourControl::Pause ) {
180  label.setHtml( tr("Pause the tour") );
181  }
182  painter->save();
183  painter->translate( labelRect.topLeft() );
184  painter->setClipRect( 0, 0, labelRect.width(), labelRect.height() );
185  label.documentLayout()->draw( painter, paintContext );
186  painter->restore();
187  button.icon = QIcon( ":/marble/document-edit.png" );
188 
189  QRect const buttonRect = position( EditButton, option );;
190  button.rect = buttonRect;
191 
192  QIcon const icon = QIcon( ":/marble/media-playback-pause.png" );
193  painter->drawPixmap( iconRect, icon.pixmap( iconRect.size() ) );
194 
195  } else if ( object->nodeType() == GeoDataTypes::GeoDataFlyToType && !m_editingIndices.contains( index ) ) {
196  GeoDataCoordinates const flyToCoords = index.data( MarblePlacemarkModel::CoordinateRole ).value<GeoDataCoordinates>();
197  label.setHtml( flyToCoords.toString() );
198  button.icon = QIcon( ":/marble/document-edit.png" );
199 
200  painter->save();
201  painter->translate( labelRect.topLeft() );
202  painter->setClipRect( 0, 0, labelRect.width(), labelRect.height() );
203  label.documentLayout()->draw( painter, paintContext );
204  painter->restore();
205 
206  QRect const buttonRect = position( EditButton, option );
207  button.rect = buttonRect;
208 
209  QIcon const icon = QIcon( ":/marble/flag.png" );
210  painter->drawPixmap( iconRect, icon.pixmap( iconRect.size() ) );
211 
212  } else if ( object->nodeType() == GeoDataTypes::GeoDataWaitType && !m_editingIndices.contains( index ) ) {
213  GeoDataWait *wait = static_cast<GeoDataWait*> ( object );
214  label.setHtml( tr("Wait for %1 seconds").arg( QString::number( wait->duration() ) ) );
215 
216  painter->save();
217  painter->translate( labelRect.topLeft() );
218  painter->setClipRect( 0, 0, labelRect.width(), labelRect.height() );
219  label.documentLayout()->draw( painter, paintContext );
220  painter->restore();
221 
222  button.icon = QIcon( ":/marble/document-edit.png" );
223 
224  QRect const buttonRect = position( EditButton, option );
225  button.rect = buttonRect;
226 
227  QIcon const icon = QIcon( ":/marble/player-time.png" );
228  painter->drawPixmap( iconRect, icon.pixmap( iconRect.size() ) );
229 
230  } else if ( object->nodeType() == GeoDataTypes::GeoDataSoundCueType && !m_editingIndices.contains( index ) ) {
231  GeoDataSoundCue *soundCue = static_cast<GeoDataSoundCue*>( object );
232  label.setHtml( soundCue->href().section("/", -1) );
233 
234  painter->save();
235  painter->translate( labelRect.topLeft() );
236  painter->setClipRect( 0, 0, labelRect.width(), labelRect.height() );
237  label.documentLayout()->draw( painter, paintContext );
238  painter->restore();
239 
240  QStyleOptionButton playButton = button;
241 
242  button.icon = QIcon( ":/marble/document-edit.png" );
243  QRect const buttonRect = position( EditButton, option );
244  button.rect = buttonRect;
245 
246  playButton.icon = QIcon( ":/marble/playback-play.png" );
247  QRect const playButtonRect = position( ActionButton, option );
248  playButton.rect = playButtonRect;
249  QApplication::style()->drawControl( QStyle::CE_PushButton, &playButton, painter );
250 
251  QIcon const icon = QIcon( ":/marble/audio-x-generic.png" );
252  painter->drawPixmap( iconRect, icon.pixmap( iconRect.size() ) );
253  }
254  QApplication::style()->drawControl( QStyle::CE_PushButton, &button, painter );
255 }
256 
257 QRect TourItemDelegate::position(Element element, const QStyleOptionViewItem &option )
258 {
259  QPoint const topCol1 = option.rect.topLeft() + QPoint(10, 10);
260  QPoint const topCol2 = topCol1 + QPoint(30, 0);
261  QPoint const topCol3 = topCol2 + QPoint(210, 0);
262  QPoint const topCol4 = topCol3 + QPoint(30, 0);
263  QSize const labelSize = QSize(220, 30);
264  QSize const iconsSize = QSize(22, 22);
265 
266  switch(element)
267  {
268  case GeoDataElementIcon:
269  return QRect( topCol1, iconsSize );
270  case Label:
271  return QRect( topCol2, labelSize );
272  case EditButton:
273  return QRect( topCol3, iconsSize );
274  case ActionButton:
275  return QRect( topCol4, iconsSize );
276  }
277  return QRect();
278 }
279 
280 
281 QSize TourItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
282 {
283  Q_UNUSED( option );
284  Q_UNUSED( index );
285  return QSize(290,50);
286 }
287 
288 QWidget* TourItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
289 {
290  Q_UNUSED( option );
291  GeoDataObject *object = qvariant_cast<GeoDataObject*>(index.data( MarblePlacemarkModel::ObjectPointerRole ) );
292  if ( object->nodeType() == GeoDataTypes::GeoDataFlyToType ) {
293  FlyToEditWidget* widget = new FlyToEditWidget(index, m_widget, parent);
294  connect(widget, SIGNAL(editingDone(QModelIndex)), this, SLOT(closeEditor(QModelIndex)));
295  connect( this, SIGNAL( editableChanged( bool) ), widget, SLOT( setEditable( bool ) ) );
296  return widget;
297 
298  } else if ( object->nodeType() == GeoDataTypes::GeoDataTourControlType ) {
299  TourControlEditWidget* widget = new TourControlEditWidget(index, parent);
300  connect(widget, SIGNAL(editingDone(QModelIndex)), this, SLOT(closeEditor(QModelIndex)));
301  connect( this, SIGNAL( editableChanged( bool) ), widget, SLOT( setEditable( bool ) ) );
302  return widget;
303 
304  } else if ( object->nodeType() == GeoDataTypes::GeoDataWaitType ) {
305  WaitEditWidget* widget = new WaitEditWidget(index, parent);
306  connect(widget, SIGNAL(editingDone(QModelIndex)), this, SLOT(closeEditor(QModelIndex)));
307  connect( this, SIGNAL( editableChanged( bool) ), widget, SLOT( setEditable( bool ) ) );
308  return widget;
309 
310  } else if ( object->nodeType() == GeoDataTypes::GeoDataSoundCueType ) {
311  SoundCueEditWidget* widget = new SoundCueEditWidget(index, parent);
312  connect(widget, SIGNAL(editingDone(QModelIndex)), this, SLOT(closeEditor(QModelIndex)));
313  connect( this, SIGNAL( editableChanged( bool) ), widget, SLOT( setEditable( bool ) ) );
314  return widget;
315 
316  }
317  return 0;
318 }
319 
320 bool TourItemDelegate::editable() const
321 {
322  return m_editable;
323 }
324 
325 void TourItemDelegate::setEditable( bool editable )
326 {
327  if( m_editable != editable ) {
328  m_editable = editable;
329  emit editableChanged( m_editable );
330  }
331 }
332 
333 bool TourItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
334 {
335  Q_UNUSED( model );
336  if ( ( event->type() == QEvent::MouseButtonRelease ) && editable() ) {
337  QMouseEvent *mouseEvent = static_cast<QMouseEvent*>( event );
338  QRect editRect = position( EditButton, option );
339  if ( editRect.contains( mouseEvent->pos() ) ) {
340  if( m_editingIndices.contains( index ) ) {
341  m_editingIndices.removeOne( index );
342  emit editingChanged( index );
343  return true;
344  }else{
345  m_editingIndices.append( index );
346  m_listView->openPersistentEditor( index );
347  }
348  emit editingChanged( index );
349  return true;
350  }
351  }
352  return false;
353 }
354 
355 void TourItemDelegate::closeEditor( const QModelIndex &index )
356 {
357  emit edited( index );
358  m_listView->closePersistentEditor( index );
359  m_editingIndices.removeOne( index );
360 }
361 
362 TourWidget::~TourWidget()
363 {
364  delete d;
365 }
366 
367 void TourWidget::setMarbleWidget( MarbleWidget *widget )
368 {
369  d->m_widget = widget;
370  d->m_delegate = new TourItemDelegate( d->m_tourUi.m_listView, d->m_widget );
371  QObject::connect( d->m_delegate, SIGNAL( edited( QModelIndex ) ), this, SLOT( updateDuration() ) );
372  d->m_tourUi.m_listView->setItemDelegate( d->m_delegate );
373 }
374 
375 void TourWidget::togglePlaying()
376 {
377  if( !d->m_playState ){
378  d->m_playState = true;
379  startPlaying();
380  } else {
381  d->m_playState = false;
382  pausePlaying();
383  }
384 }
385 
386 void TourWidget::startPlaying()
387 {
388  d->m_playback.play();
389  d->m_tourUi.actionPlay->setIcon( QIcon( ":/marble/playback-pause.png" ) );
390  d->m_tourUi.actionPlay->setEnabled( true );
391  d->m_tourUi.actionStop->setEnabled( true );
392  d->m_delegate->setEditable( false );
393 }
394 
395 void TourWidget::pausePlaying()
396 {
397  d->m_playback.pause();
398  d->m_tourUi.actionPlay->setIcon( QIcon( ":/marble/playback-play.png" ) );
399  d->m_tourUi.actionPlay->setEnabled( true );
400  d->m_tourUi.actionStop->setEnabled( true );
401 }
402 
403 void TourWidget::stopPlaying()
404 {
405  d->m_playback.stop();
406  d->m_tourUi.actionPlay->setIcon( QIcon( ":/marble/playback-play.png" ) );
407  d->m_tourUi.actionPlay->setEnabled( true );
408  d->m_tourUi.actionStop->setEnabled( false );
409  d->m_playState = false;
410  d->m_delegate->setEditable( true );
411 }
412 
413 void TourWidget::handleSliderMove( int value )
414 {
415  d->m_playback.seek( value / 100.0 );
416 }
417 
418 void TourWidgetPrivate::openFile()
419 {
420  if ( overrideModifications() ) {
421  QString const filename = QFileDialog::getOpenFileName( q, QObject::tr( "Open Tour" ), QDir::homePath(), QObject::tr( "KML Tours (*.kml)" ) );
422  if ( !filename.isEmpty() ) {
423  ParsingRunnerManager manager( m_widget->model()->pluginManager() );
424  GeoDataDocument* document = manager.openFile( filename );
425  openDocument( document );
426  }
427  }
428 }
429 
430 bool TourWidgetPrivate::openFile( const QString &filename )
431 {
432  if ( overrideModifications() ) {
433  if ( !filename.isEmpty() ) {
434  ParsingRunnerManager manager( m_widget->model()->pluginManager() );
435  GeoDataDocument* document = manager.openFile( filename );
436  return openDocument( document );
437  }
438  }
439 
440  return false;
441 }
442 
443 GeoDataTour *TourWidgetPrivate::findTour( GeoDataFeature *feature ) const
444 {
445  if ( feature && feature->nodeType() == GeoDataTypes::GeoDataTourType ) {
446  return static_cast<GeoDataTour*>( feature );
447  }
448 
449  GeoDataContainer *container = dynamic_cast<GeoDataContainer*>( feature );
450  if ( container ) {
451  QVector<GeoDataFeature*>::Iterator end = container->end();
452  QVector<GeoDataFeature*>::Iterator iter = container->begin();
453  for( ; iter != end; ++iter ) {
454  GeoDataTour *tour = findTour( *iter );
455  if ( tour ) {
456  return tour;
457  }
458  }
459  }
460  return 0;
461 }
462 
463 void TourWidgetPrivate::mapCenterOn( const QModelIndex &index )
464 {
465  QVariant coordinatesVariant = m_model.data( index, MarblePlacemarkModel::CoordinateRole );
466  if ( !coordinatesVariant.isNull() ) {
467  GeoDataCoordinates const coordinates = coordinatesVariant.value<GeoDataCoordinates>();
468  GeoDataLookAt lookat;
469  lookat.setCoordinates( coordinates );
470  lookat.setRange( coordinates.altitude() );
471  m_widget->flyTo( lookat, Instant );
472  }
473 }
474 
475 void TourWidgetPrivate::addFlyTo()
476 {
477  GeoDataFlyTo *flyTo = new GeoDataFlyTo();
478  flyTo->setView( new GeoDataLookAt( m_widget->lookAt() ) );
479  GeoDataLookAt *lookat = new GeoDataLookAt( m_widget->lookAt() );
480  lookat->setAltitude( lookat->range() );
481  flyTo->setView( lookat );
482  GeoDataObject *rootObject = rootIndexObject();
483  if ( rootObject->nodeType() == GeoDataTypes::GeoDataPlaylistType ) {
484  GeoDataPlaylist *playlist = static_cast<GeoDataPlaylist*>( rootObject );
485  QModelIndex currentIndex = m_tourUi.m_listView->currentIndex();
486  if ( currentIndex.isValid() ) {
487  playlist->insertPrimitive( currentIndex.row()+1, flyTo );
488  } else {
489  playlist->addPrimitive( flyTo );
490  }
491  m_isChanged = true;
492  m_tourUi.m_actionSaveTour->setEnabled( true );
493  }
494 }
495 
496 void TourWidgetPrivate::deleteSelected()
497 {
498  QString title = QObject::tr( "Remove Selected Items" );
499  QString text = QObject::tr( "Are you sure want to remove selected items?" );
500  QPointer<QMessageBox> dialog = new QMessageBox( QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::No, q );
501  dialog->setDefaultButton( QMessageBox::No );
502  if ( dialog->exec() == QMessageBox::Yes ) {
503  GeoDataObject *rootObject = rootIndexObject();
504  if ( rootObject && rootObject->nodeType() == GeoDataTypes::GeoDataPlaylistType ) {
505  GeoDataPlaylist *playlist = static_cast<GeoDataPlaylist*>( rootObject );
506  QModelIndexList selected = m_tourUi.m_listView->selectionModel()->selectedIndexes();
507  qSort( selected.begin(), selected.end(), qGreater<QModelIndex>() );
508  QModelIndexList::iterator end = selected.end();
509  QModelIndexList::iterator iter = selected.begin();
510  for( ; iter != end; ++iter ) {
511  playlist->removePrimitiveAt( iter->row() );
512  }
513  m_isChanged = true;
514  m_tourUi.m_actionSaveTour->setEnabled( true );
515  }
516  }
517  delete dialog;
518 }
519 
520 void TourWidgetPrivate::updateButtonsStates()
521 {
522  QModelIndexList selectedIndexes = m_tourUi.m_listView->selectionModel()->selectedIndexes();
523  if ( selectedIndexes.isEmpty() ) {
524  m_tourUi.m_actionDelete->setEnabled( false );
525  m_tourUi.m_actionMoveDown->setEnabled( false );
526  m_tourUi.m_actionMoveUp->setEnabled( false );
527  } else {
528  m_tourUi.m_actionDelete->setEnabled( true );
529  qSort( selectedIndexes.begin(), selectedIndexes.end(), qLess<QModelIndex>() );
530  QModelIndexList::iterator end = selectedIndexes.end()-1;
531  QModelIndexList::iterator start = selectedIndexes.begin();
532  m_tourUi.m_actionMoveUp->setEnabled( ( start->row() != 0 ) ); // if we can move up enable action else disable.
533  GeoDataObject *rootObject = rootIndexObject();
534  if ( rootObject && rootObject->nodeType() == GeoDataTypes::GeoDataPlaylistType ) {
535  GeoDataPlaylist *playlist = static_cast<GeoDataPlaylist*>( rootObject );
536  m_tourUi.m_actionMoveDown->setEnabled( ( end->row() != playlist->size()-1 ) ); // if we can move down enable action else disable.
537  }
538  }
539 }
540 
541 void TourWidgetPrivate::moveUp()
542 {
543  GeoDataObject *rootObject = rootIndexObject();
544  if ( rootObject && rootObject->nodeType() == GeoDataTypes::GeoDataPlaylistType ) {
545  GeoDataPlaylist *playlist = static_cast<GeoDataPlaylist*>( rootObject );
546  QModelIndexList selected = m_tourUi.m_listView->selectionModel()->selectedIndexes();
547  qSort( selected.begin(), selected.end(), qLess<QModelIndex>() );
548  QModelIndexList::iterator end = selected.end();
549  QModelIndexList::iterator iter = selected.begin();
550  for( ; iter != end; ++iter ) {
551  int const index = iter->row();
552  Q_ASSERT( index > 0 );
553  playlist->swapPrimitives( index-1, index );
554  }
555  m_isChanged = true;
556  m_tourUi.m_actionSaveTour->setEnabled( true );
557  }
558 }
559 
560 void TourWidgetPrivate::moveDown()
561 {
562  GeoDataObject *rootObject = rootIndexObject();
563  if ( rootObject && rootObject->nodeType() == GeoDataTypes::GeoDataPlaylistType ) {
564  GeoDataPlaylist *playlist = static_cast<GeoDataPlaylist*>( rootObject );
565  QModelIndexList selected = m_tourUi.m_listView->selectionModel()->selectedIndexes();
566  qSort( selected.begin(), selected.end(), qGreater<QModelIndex>() );
567  QModelIndexList::iterator end = selected.end();
568  QModelIndexList::iterator iter = selected.begin();
569  for( ; iter != end; ++iter ) {
570  int const index = iter->row();
571  Q_ASSERT( index < playlist->size()-1 );
572  playlist->swapPrimitives( index, index+1 );
573  }
574  m_isChanged = true;
575  m_tourUi.m_actionSaveTour->setEnabled( true );
576  }
577 }
578 
579 GeoDataFeature* TourWidgetPrivate::getPlaylistFeature() const
580 {
581  GeoDataObject *rootObject = rootIndexObject();
582  if ( rootObject && rootObject->nodeType() == GeoDataTypes::GeoDataPlaylistType ) {
583  GeoDataPlaylist *playlist = static_cast<GeoDataPlaylist*>( rootObject );
584  GeoDataObject *object = playlist->parent();
585  if ( object && object->nodeType() == GeoDataTypes::GeoDataTourType ) {
586  return static_cast<GeoDataFeature*>( object );
587  }
588  }
589  return 0;
590 }
591 
592 void TourWidgetPrivate::updateRootIndex()
593 {
594  GeoDataTour *tour = findTour( m_model.rootDocument() );
595  if ( tour ){
596  GeoDataPlaylist *playlist = tour->playlist();
597  if ( playlist ) {
598  m_tourUi.m_listView->setRootIndex( m_model.index( playlist ) );
599  }
600  m_playback.setMarbleWidget( m_widget );
601  m_playback.setTour( tour );
602  m_tourUi.m_slider->setMaximum( m_playback.duration() * 100 );
603  QObject::connect( &m_playback, SIGNAL( centerOn( GeoDataCoordinates ) ),
604  m_widget, SLOT( centerOn( GeoDataCoordinates ) ) );
605  QObject::connect( &m_playback, SIGNAL( progressChanged( double ) ),
606  q, SLOT( handlePlaybackProgress( double ) ) );
607  q->stopPlaying();
608  m_tourUi.m_toolBarPlayback->setEnabled( true );
609  m_tourUi.actionPlay->setEnabled( true );
610  m_tourUi.actionStop->setEnabled( false );
611  }
612 }
613 
614 void TourWidget::addFlyTo()
615 {
616  d->addFlyTo();
617  GeoDataFeature *feature = d->getPlaylistFeature();
618  if ( feature ){
619  emit featureUpdated( feature );
620  d->updateRootIndex();
621  }
622 }
623 
624 void TourWidget::deleteSelected()
625 {
626  d->deleteSelected();
627  GeoDataFeature *feature = d->getPlaylistFeature();
628  if ( feature ) {
629  emit featureUpdated( feature );
630  d->updateRootIndex();
631  }
632 }
633 
634 void TourWidget::updateDuration()
635 {
636  d->m_tourUi.m_slider->setMaximum( d->m_playback.duration() * 100 );
637 }
638 
639 void TourWidget::centerOn( const GeoDataCoordinates &coordinates )
640 {
641  if ( d->m_widget ) {
642  GeoDataLookAt lookat;
643  lookat.setCoordinates( coordinates );
644  lookat.setRange( coordinates.altitude() );
645  d->m_widget->flyTo( lookat, Instant );
646  }
647 }
648 
649 void TourWidget::moveDown()
650 {
651  d->moveDown();
652  GeoDataFeature *feature = d->getPlaylistFeature();
653  if ( feature ) {
654  emit featureUpdated( feature );
655  d->updateRootIndex();
656  }
657 }
658 
659 void TourWidget::moveUp()
660 {
661  d->moveUp();
662  GeoDataFeature *feature = d->getPlaylistFeature();
663  if ( feature ) {
664  emit featureUpdated( feature );
665  d->updateRootIndex();
666  }
667 }
668 
669 GeoDataObject *TourWidgetPrivate::rootIndexObject() const
670 {
671  QModelIndex const rootIndex = m_tourUi.m_listView->rootIndex();
672  return rootIndex.isValid() ? static_cast<GeoDataObject*>( rootIndex.internalPointer() ) : 0;
673 }
674 
675 void TourWidgetPrivate::createTour()
676 {
677  if ( overrideModifications() ) {
678  GeoDataDocument *document = new GeoDataDocument();
679  document->setDocumentRole( UserDocument );
680  document->setName( "New Tour" );
681  GeoDataTour *tour = new GeoDataTour();
682  tour->setName( "New Tour" );
683  GeoDataPlaylist *playlist = new GeoDataPlaylist;
684  tour->setPlaylist( playlist );
685  document->append( static_cast<GeoDataFeature*>( tour ) );
686  openDocument( document );
687  m_isChanged = true;
688  m_tourUi.m_actionSaveTour->setEnabled( true );
689  }
690 }
691 
692 bool TourWidgetPrivate::openDocument(GeoDataDocument* document)
693 {
694  if ( document ) {
695  GeoDataDocument* oldDocument = m_model.rowCount() ? m_model.rootDocument() : 0;
696  if ( oldDocument ) {
697  m_widget->model()->removeGeoData( oldDocument->fileName() );
698  }
699  if ( !document->fileName().isEmpty() ) {
700  m_widget->model()->addGeoDataFile( document->fileName() );
701  }
702  m_model.setRootDocument( document );
703  m_isChanged = false;
704  updateRootIndex();
705  m_tourUi.m_actionAddFlyTo->setEnabled( true );
706  m_tourUi.m_actionSaveTourAs->setEnabled( true );
707  m_tourUi.m_actionSaveTour->setEnabled( false );
708  m_tourUi.m_slider->setEnabled( true );
709  m_isChanged = false;
710  delete oldDocument;
711  return true;
712  }
713  return false;
714 }
715 
716 void TourWidgetPrivate::saveTour()
717 {
718  if ( m_model.rowCount() ) {
719  if ( !m_model.rootDocument()->fileName().isEmpty() ) {
720  saveTourAs( m_model.rootDocument()->fileName() );
721  } else {
722  saveTourAs();
723  }
724  }
725 }
726 
727 void TourWidgetPrivate::saveTourAs()
728 {
729  if ( m_model.rowCount() )
730  {
731  QString const filename = QFileDialog::getSaveFileName( q, QObject::tr( "Save Tour as" ), QDir::homePath(), QObject::tr( "KML Tours (*.kml)" ) );
732  if ( !filename.isEmpty() ) {
733  saveTourAs( filename );
734  }
735  }
736 }
737 
738 bool TourWidgetPrivate::saveTourAs(const QString &filename)
739 {
740  if ( !filename.isEmpty() )
741  {
742  QFile file( filename );
743  if ( file.open( QIODevice::WriteOnly ) ) {
744  GeoWriter writer;
745  writer.setDocumentType( kml::kmlTag_nameSpaceOgc22 );
746  if ( writer.write( &file, m_model.rootDocument() ) ) {
747  file.close();
748  m_tourUi.m_actionSaveTour->setEnabled( false );
749  m_isChanged = false;
750  GeoDataDocument* document = m_model.rootDocument();
751  if ( !document->fileName().isNull() ) {
752  m_widget->model()->removeGeoData( document->fileName() );
753  }
754  m_widget->model()->addGeoDataFile( filename );
755  m_model.rootDocument()->setFileName( filename );
756  return true;
757  }
758  }
759  }
760  return false;
761 }
762 
763 bool TourWidgetPrivate::overrideModifications()
764 {
765  GeoDataDocument* oldDocument = m_model.rowCount() ? m_model.rootDocument() : 0;
766  if ( oldDocument && m_isChanged ) {
767  QString title = QObject::tr( "Discard Changes" );
768  QString text = QObject::tr( "Are you sure want to discard all unsaved changes and close current document?" );
769  QPointer<QMessageBox> dialog = new QMessageBox( QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::No, q );
770  dialog->setDefaultButton( QMessageBox::No );
771  if ( dialog->exec() != QMessageBox::Yes ) {
772  delete dialog;
773  return false;
774  }
775  delete dialog;
776  }
777  return true;
778 }
779 
780 bool TourWidget::openTour( const QString &filename)
781 {
782  return d->openFile( filename );
783 }
784 
785 void TourWidgetPrivate::handlePlaybackProgress(const double position)
786 {
787  if( !m_tourUi.m_slider->isSliderDown() ){
788  m_tourUi.m_slider->setValue( position * 100 );
789  }
790 }
791 
792 FlyToEditWidget::FlyToEditWidget( const QModelIndex &index, MarbleWidget* widget, QWidget *parent ) :
793  QWidget( parent ),
794  m_widget( widget ),
795  m_index( index ),
796  m_button( new QToolButton )
797 {
798  QHBoxLayout *layout = new QHBoxLayout;
799  layout->setSpacing( 5 );
800 
801  QLabel* iconLabel = new QLabel;
802  iconLabel->setPixmap( QPixmap( ":/marble/flag.png" ) );
803  layout->addWidget( iconLabel );
804 
805  QLabel* flyToLabel = new QLabel;
806  flyToLabel->setText( tr( "Current map center" ) );
807  layout->addWidget( flyToLabel );
808 
809  m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
810  connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
811  layout->addWidget( m_button );
812 
813  setLayout( layout );
814 }
815 
816 bool FlyToEditWidget::editable() const
817 {
818  return m_button->isEnabled();
819 }
820 
821 void FlyToEditWidget::save()
822 {
823  if(flyToElement()->view()!=0){
824  GeoDataCoordinates coords = m_widget->focusPoint();
825  coords.setAltitude( m_widget->lookAt().range() );
826  if ( flyToElement()->view()->nodeType() == GeoDataTypes::GeoDataCameraType ) {
827  GeoDataCamera* camera = dynamic_cast<GeoDataCamera*>( flyToElement()->view() );
828  camera->setCoordinates( coords );
829  }else if ( flyToElement()->view()->nodeType() == GeoDataTypes::GeoDataLookAtType ) {
830  GeoDataLookAt* lookAt = dynamic_cast<GeoDataLookAt*>( flyToElement()->view() );
831  lookAt->setCoordinates( coords );
832  }else{
833  GeoDataLookAt* lookAt = new GeoDataLookAt;
834  lookAt->setCoordinates( coords );
835  flyToElement()->setView( lookAt );
836  }
837  }
838  emit editingDone(m_index);
839 }
840 
841 void FlyToEditWidget::setEditable( bool editable )
842 {
843  m_button->setEnabled( editable );
844 }
845 
846 GeoDataFlyTo* FlyToEditWidget::flyToElement()
847 {
848  GeoDataObject *object = qvariant_cast<GeoDataObject*>(m_index.data( MarblePlacemarkModel::ObjectPointerRole ) );
849  Q_ASSERT( object );
850  Q_ASSERT( object->nodeType() == GeoDataTypes::GeoDataFlyToType );
851  return static_cast<GeoDataFlyTo*>( object );
852 }
853 
854 TourControlEditWidget::TourControlEditWidget( const QModelIndex &index, QWidget *parent ) :
855  QWidget( parent ),
856  m_index( index ),
857  m_button( new QToolButton ),
858  m_radio_play( new QRadioButton ),
859  m_radio_pause( new QRadioButton )
860 {
861  QHBoxLayout *layout = new QHBoxLayout;
862  layout->setSpacing( 5 );
863 
864  QLabel* iconLabel = new QLabel;
865  iconLabel->setPixmap( QPixmap( ":/marble/media-playback-pause.png" ) );
866  layout->addWidget( iconLabel );
867 
868  layout->addWidget( m_radio_play );
869  m_radio_play->setText( tr( "Play" ) );
870 
871  layout->addWidget( m_radio_pause );
872  m_radio_pause->setText( tr( "Pause" ) );
873 
874  if( tourControlElement()->playMode() == GeoDataTourControl::Play ){
875  m_radio_play->setChecked( true );
876  }else{
877  m_radio_pause->setChecked( true );
878  }
879 
880  m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
881  connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
882  layout->addWidget( m_button );
883 
884  setLayout( layout );
885 }
886 
887 bool TourControlEditWidget::editable() const
888 {
889  return m_button->isEnabled();
890 }
891 
892 void TourControlEditWidget::save()
893 {
894  if( m_radio_play->isChecked() ){
895  tourControlElement()->setPlayMode( GeoDataTourControl::Play );
896  }else{
897  tourControlElement()->setPlayMode( GeoDataTourControl::Pause );
898  }
899  emit editingDone(m_index);
900 }
901 
902 void TourControlEditWidget::setEditable( bool editable )
903 {
904  m_button->setEnabled( editable );
905 }
906 
907 GeoDataTourControl* TourControlEditWidget::tourControlElement()
908 {
909  GeoDataObject *object = qvariant_cast<GeoDataObject*>(m_index.data( MarblePlacemarkModel::ObjectPointerRole ) );
910  Q_ASSERT( object );
911  Q_ASSERT( object->nodeType() == GeoDataTypes::GeoDataTourControlType );
912  return static_cast<GeoDataTourControl*>( object );
913 }
914 
915 WaitEditWidget::WaitEditWidget( const QModelIndex &index, QWidget *parent ) :
916  QWidget( parent ),
917  m_index( index ),
918  m_button( new QToolButton ),
919  m_spinBox( new QDoubleSpinBox )
920 {
921  QHBoxLayout *layout = new QHBoxLayout;
922  layout->setSpacing( 5 );
923 
924  QLabel* iconLabel = new QLabel;
925  iconLabel->setPixmap( QPixmap( ":/marble/audio-x-generic.png" ) );
926  layout->addWidget( iconLabel );
927 
928  QLabel *waitLabel = new QLabel;
929  waitLabel->setText( tr( "Wait duration:" ) );
930  layout->addWidget( waitLabel );
931 
932  layout->addWidget( m_spinBox );
933  m_spinBox->setValue( waitElement()->duration() );
934 
935  m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
936  connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
937  layout->addWidget( m_button );
938 
939  setLayout( layout );
940 }
941 
942 bool WaitEditWidget::editable() const
943 {
944  return m_button->isEnabled();
945 }
946 
947 void WaitEditWidget::save()
948 {
949  waitElement()->setDuration( m_spinBox->value() );
950  emit editingDone(m_index);
951 }
952 
953 void WaitEditWidget::setEditable( bool editable )
954 {
955  m_button->setEnabled( editable );
956 }
957 
958 GeoDataWait* WaitEditWidget::waitElement()
959 {
960  GeoDataObject *object = qvariant_cast<GeoDataObject*>(m_index.data( MarblePlacemarkModel::ObjectPointerRole ) );
961  Q_ASSERT( object );
962  Q_ASSERT( object->nodeType() == GeoDataTypes::GeoDataWaitType );
963  return static_cast<GeoDataWait*>( object );
964 }
965 
966 SoundCueEditWidget::SoundCueEditWidget( const QModelIndex &index, QWidget *parent ) :
967  QWidget( parent ),
968  m_index( index ),
969  m_button( new QToolButton ),
970  m_lineEdit( new QLineEdit )
971 {
972  QHBoxLayout *layout = new QHBoxLayout;
973  layout->setSpacing( 5 );
974 
975  QLabel* iconLabel = new QLabel;
976  iconLabel->setPixmap( QPixmap( ":/marble/playback-play.png" ) );
977  layout->addWidget( iconLabel );
978 
979  m_lineEdit->setPlaceholderText( "Audio location" );
980  layout->addWidget( m_lineEdit );
981 
982  m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
983  connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
984  layout->addWidget( m_button );
985 
986  setLayout( layout );
987 }
988 
989 bool SoundCueEditWidget::editable() const
990 {
991  return m_button->isEnabled();
992 }
993 
994 void SoundCueEditWidget::save()
995 {
996  soundCueElement()->setHref( m_lineEdit->text() );
997  emit editingDone(m_index);
998 }
999 
1000 void SoundCueEditWidget::setEditable( bool editable )
1001 {
1002  m_button->setEnabled( editable );
1003 }
1004 
1005 GeoDataSoundCue* SoundCueEditWidget::soundCueElement()
1006 {
1007  GeoDataObject *object = qvariant_cast<GeoDataObject*>(m_index.data( MarblePlacemarkModel::ObjectPointerRole ) );
1008  Q_ASSERT( object );
1009  Q_ASSERT( object->nodeType() == GeoDataTypes::GeoDataSoundCueType );
1010  return static_cast<GeoDataSoundCue*>( object );
1011 }
1012 
1013 }
1014 
1015 #include "TourWidget.moc"
QWidget::layout
QLayout * layout() const
GeoDataDocument.h
Marble::WaitEditWidget::setEditable
void setEditable(bool editable)
Definition: TourWidget.cpp:953
QModelIndex
Marble::TourItemDelegate::createEditor
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: TourWidget.cpp:288
QEvent
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
QWidget
QRect::size
QSize size() const
QEvent::type
Type type() const
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:65
Marble::TourItemDelegate::paint
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: TourWidget.cpp:143
Marble::TourControlEditWidget::editingDone
void editingDone(const QModelIndex &index)
Marble::GeoDataTypes::GeoDataLookAtType
const char * GeoDataLookAtType
Definition: GeoDataTypes.cpp:58
Marble::GeoDataCoordinates::setAltitude
void setAltitude(const qreal altitude)
set the altitude of the Point in meters
Definition: GeoDataCoordinates.cpp:1191
Marble::GeoDataTourControl::PlayMode
PlayMode
Definition: GeoDataTourControl.h:22
Marble::FlyToEditWidget::editingDone
void editingDone(const QModelIndex &index)
QVector::begin
iterator begin()
QLineEdit::text
text
Marble::ParsingRunnerManager
Definition: ParsingRunnerManager.h:31
Marble::TourItemDelegate::setEditable
void setEditable(bool editable)
Definition: TourWidget.cpp:325
Marble::TourWidget::~TourWidget
~TourWidget()
Definition: TourWidget.cpp:362
Marble::TourItemDelegate::Label
Definition: TourWidget.h:206
MarbleModel.h
This file contains the headers for MarbleModel.
Marble::WaitEditWidget::WaitEditWidget
WaitEditWidget(const QModelIndex &index, QWidget *parent=0)
Definition: TourWidget.cpp:915
Marble::GeoDataTourControl::playMode
PlayMode playMode() const
Definition: GeoDataTourControl.cpp:42
Marble::TourWidget::pausePlaying
void pausePlaying()
Definition: TourWidget.cpp:395
Marble::GeoDataObject
A base class for all geodata objects.
Definition: GeoDataObject.h:48
Marble::TourWidget::openTour
bool openTour(const QString &filename)
Definition: TourWidget.cpp:780
QLabel::setPixmap
void setPixmap(const QPixmap &)
Marble::TourItemDelegate::TourItemDelegate
TourItemDelegate(QListView *view, MarbleWidget *widget)
Definition: TourWidget.cpp:136
QPointer
Marble::SoundCueEditWidget
Definition: TourWidget.h:118
QPainter::save
void save()
QHBoxLayout
QVariant::value
T value() const
Marble::SoundCueEditWidget::editable
bool editable() const
Definition: TourWidget.cpp:989
Marble::GeoDataCamera
Definition: GeoDataCamera.h:22
GeoDataWait.h
QRect::height
int height() const
Marble::GeoDataWait::duration
double duration() const
Definition: GeoDataWait.cpp:42
Marble::TourWidget::startPlaying
void startPlaying()
Definition: TourWidget.cpp:386
QPoint
QMouseEvent
Marble::MarblePlacemarkModel::ObjectPointerRole
The pointer to a specific object.
Definition: MarblePlacemarkModel.h:62
QDir::homePath
QString homePath()
MarbleDebug.h
QAbstractButton::setIcon
void setIcon(const QIcon &icon)
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
Marble::WaitEditWidget
Definition: TourWidget.h:94
QFile
Marble::GeoDataLookAt::range
qreal range() const
Retrieve the distance (in meters) between the camera and the object looked at.
Definition: GeoDataLookAt.cpp:120
Marble::TourControlEditWidget
Definition: TourWidget.h:69
Marble::TourWidget::setMarbleWidget
void setMarbleWidget(MarbleWidget *widget)
Definition: TourWidget.cpp:367
Marble::GeoDataObject::nodeType
virtual const char * nodeType() const =0
Provides type information for downcasting a GeoNode.
ParsingRunnerManager.h
QStyleOptionButton
QIcon::pixmap
QPixmap pixmap(const QSize &size, Mode mode, State state) const
GeoWriter.h
Marble::TourWidget::togglePlaying
void togglePlaying()
Definition: TourWidget.cpp:375
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
Marble::TourItemDelegate
Definition: TourWidget.h:185
QObject::event
virtual bool event(QEvent *e)
GeoDataCamera.h
QListView
Marble::TourItemDelegate::editorEvent
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
Definition: TourWidget.cpp:333
QAbstractItemView::openPersistentEditor
void openPersistentEditor(const QModelIndex &index)
Marble::MarbleWidget::lookAt
GeoDataLookAt lookAt() const
Return the lookAt.
Definition: MarbleWidget.cpp:1181
Marble::TourControlEditWidget::TourControlEditWidget
TourControlEditWidget(const QModelIndex &index, QWidget *parent=0)
Definition: TourWidget.cpp:854
QRect
QModelIndex::isValid
bool isValid() const
QDoubleSpinBox
TourWidget.h
QWidget::isEnabled
bool isEnabled() const
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QString::number
QString number(int n, int base)
Marble::GeoDataSoundCue
Definition: GeoDataSoundCue.h:19
QList::append
void append(const T &value)
GeoDataSoundCue.h
Marble::None
Definition: tools/osm-addresses/OsmParser.h:40
Marble::TourControlEditWidget::editable
bool editable() const
Definition: TourWidget.cpp:887
Marble::GeoDataWait
Definition: GeoDataWait.h:19
QWidget::setLayout
void setLayout(QLayout *layout)
QVariant::isNull
bool isNull() const
QMessageBox
Marble::GeoDataCamera::setCoordinates
void setCoordinates(const GeoDataCoordinates &coordinates)
Definition: GeoDataCamera.cpp:67
KmlElementDictionary.h
QStyleOptionViewItem
QStyle
Marble::GeoDataFlyTo
Definition: GeoDataFlyTo.h:23
QPainter::drawPixmap
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
Marble::UserDocument
Definition: GeoDataDocument.h:42
Marble::TourItemDelegate::sizeHint
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: TourWidget.cpp:281
QPainter
QString::isEmpty
bool isEmpty() const
Marble::TourWidget::stopPlaying
void stopPlaying()
Definition: TourWidget.cpp:403
GeoDataTourControl.h
QModelIndex::row
int row() const
Marble::WaitEditWidget::editable
bool editable() const
Definition: TourWidget.cpp:942
Marble::TourItemDelegate::editable
bool editable() const
Definition: TourWidget.cpp:320
Marble::GeoDataTypes::GeoDataFlyToType
const char * GeoDataFlyToType
Definition: GeoDataTypes.cpp:41
TourPlayback.h
QTextDocument::documentLayout
QAbstractTextDocumentLayout * documentLayout() const
QModelIndex::internalPointer
void * internalPointer() const
QAbstractItemView::setEditTriggers
void setEditTriggers(QFlags< QAbstractItemView::EditTrigger > triggers)
QDoubleSpinBox::setValue
void setValue(double val)
Marble::SoundCueEditWidget::SoundCueEditWidget
SoundCueEditWidget(const QModelIndex &index, QWidget *parent=0)
Definition: TourWidget.cpp:966
Marble::GeoDataTypes::GeoDataSoundCueType
const char * GeoDataSoundCueType
Definition: GeoDataTypes.cpp:79
QRect::contains
bool contains(const QPoint &point, bool proper) const
Marble::TourItemDelegate::editingChanged
void editingChanged(QModelIndex index)
Marble::GeoDataTypes::GeoDataTourControlType
const char * GeoDataTourControlType
Definition: GeoDataTypes.cpp:84
QLabel::setText
void setText(const QString &)
QString
Marble::GeoDataTypes::GeoDataTourType
const char * GeoDataTourType
Definition: GeoDataTypes.cpp:83
MarblePlacemarkModel.h
Marble::GeoDataTypes::GeoDataPlaylistType
const char * GeoDataPlaylistType
Definition: GeoDataTypes.cpp:67
QLineEdit::setPlaceholderText
void setPlaceholderText(const QString &)
Marble::FlyToEditWidget
Definition: TourWidget.h:45
Marble::Element
Definition: tools/osm-addresses/OsmParser.h:52
QLayout::setMargin
void setMargin(int margin)
Marble::SoundCueEditWidget::editingDone
void editingDone(const QModelIndex &index)
Marble::TourItemDelegate::ActionButton
Definition: TourWidget.h:208
GeoDataTreeModel.h
QAbstractTextDocumentLayout::PaintContext
Marble::GeoDataFlyTo::setView
void setView(GeoDataAbstractView *view)
Definition: GeoDataFlyTo.cpp:120
QPixmap
Marble::TourItemDelegate::editableChanged
void editableChanged(bool editable)
Marble::TourWidget::TourWidget
TourWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Definition: TourWidget.cpp:120
Marble::kml::kmlTag_nameSpaceOgc22
const char * kmlTag_nameSpaceOgc22
Definition: KmlElementDictionary.cpp:34
QToolButton
QTextDocument::setDefaultFont
void setDefaultFont(const QFont &font)
Marble::GeoDataSoundCue::href
QString href() const
Definition: GeoDataSoundCue.cpp:41
QSize
QList::contains
bool contains(const T &value) const
QPainter::restore
void restore()
Marble::MarblePlacemarkModel::CoordinateRole
The GeoDataCoordinates coordinate.
Definition: MarblePlacemarkModel.h:53
QAbstractButton::setChecked
void setChecked(bool)
Marble::GeoDataTypes::GeoDataCameraType
const char * GeoDataCameraType
Definition: GeoDataTypes.cpp:31
QItemSelection
QTextDocument::setTextWidth
void setTextWidth(qreal width)
QRect::width
int width() const
QPainter::setClipRect
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
QVector
Marble::GeoDataTypes::GeoDataWaitType
const char * GeoDataWaitType
Definition: GeoDataTypes.cpp:85
QModelIndex::data
QVariant data(int role) const
GeoDataFlyTo.h
QApplication::style
QStyle * style()
QRadioButton
QTextDocument
Marble::MarbleWidget::focusPoint
GeoDataCoordinates focusPoint() const
Definition: MarbleWidget.cpp:1186
Marble::FlyToEditWidget::FlyToEditWidget
FlyToEditWidget(const QModelIndex &index, MarbleWidget *widget, QWidget *parent=0)
Definition: TourWidget.cpp:792
Marble::GeoDataTourControl::Pause
Definition: GeoDataTourControl.h:24
QStyle::drawControl
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
Marble::GeoDataTourControl::setPlayMode
void setPlayMode(const PlayMode &mode)
Definition: GeoDataTourControl.cpp:47
Marble::WaitEditWidget::editingDone
void editingDone(const QModelIndex &index)
Marble::GeoDataCoordinates::toString
QString toString() const
return a string representation of the coordinate this is a convenience function which uses the defaul...
Definition: GeoDataCoordinates.cpp:921
Marble::GeoDataWait::setDuration
void setDuration(double duration)
Definition: GeoDataWait.cpp:47
QFileDialog::getSaveFileName
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
QRect::topLeft
QPoint topLeft() const
Marble::FlyToEditWidget::editable
bool editable() const
Definition: TourWidget.cpp:816
QPainter::translate
void translate(const QPointF &offset)
QAbstractItemModel
QTextDocument::setHtml
void setHtml(const QString &html)
QString::section
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
QAbstractTextDocumentLayout::draw
virtual void draw(QPainter *painter, const PaintContext &context)=0
QAbstractButton::setText
void setText(const QString &text)
Marble::TourPlayback::centerOn
void centerOn(const GeoDataCoordinates &coordinates)
Marble::SoundCueEditWidget::setEditable
void setEditable(bool editable)
Definition: TourWidget.cpp:1000
MarbleWidget.h
This file contains the headers for MarbleWidget.
createTour
GeoDataTour * createTour(const Route &route)
Definition: tour-preview.cpp:66
Qt::WindowFlags
typedef WindowFlags
Marble::TourWidget::featureUpdated
void featureUpdated(GeoDataFeature *feature)
QAbstractItemView::closePersistentEditor
void closePersistentEditor(const QModelIndex &index)
Marble::Instant
Change camera position immediately (no interpolation)
Definition: MarbleGlobal.h:175
QLineEdit
QMouseEvent::pos
const QPoint & pos() const
QFileDialog::getOpenFileName
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
QStyleOptionViewItemV4
MarbleWidget
Wraps a Marble::MarbleWidget, providing access to important properties and methods.
Definition: MarbleDeclarativeWidget.h:50
Marble::TourItemDelegate::edited
void edited(QModelIndex index)
GeoDataTypes.h
Marble::GeoDataTourControl::Play
Definition: GeoDataTourControl.h:23
Marble::TourWidget::handleSliderMove
void handleSliderMove(int)
Definition: TourWidget.cpp:413
Marble::FlyToEditWidget::setEditable
void setEditable(bool editable)
Definition: TourWidget.cpp:841
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QLabel
QVector::end
iterator end()
QList::removeOne
bool removeOne(const T &value)
GeoDataTour.h
Marble::GeoDataSoundCue::setHref
void setHref(const QString &url)
Definition: GeoDataSoundCue.cpp:46
Marble::TourItemDelegate::EditButton
Definition: TourWidget.h:207
QBoxLayout::setSpacing
void setSpacing(int spacing)
Marble::GeoDataFlyTo::view
const GeoDataAbstractView * view() const
Definition: GeoDataFlyTo.cpp:110
QIcon
Marble::TourItemDelegate::GeoDataElementIcon
Definition: TourWidget.h:205
Marble::TourPlayback::finished
void finished()
QVariant
Marble::GeoDataTourControl
Definition: GeoDataTourControl.h:19
Marble::TourControlEditWidget::setEditable
void setEditable(bool editable)
Definition: TourWidget.cpp:902
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal