[Marble-commits] KDE/kdeedu/marble/src/lib
Bastian Holst
bastianholst at gmx.de
Thu Sep 30 00:10:04 CEST 2010
SVN commit 1181055 by bholst:
Splitted the FileViewWidget out of the MarbleControlBox
M +2 -0 CMakeLists.txt
A FileViewWidget.cpp [License: LGPL]
A FileViewWidget.h [License: LGPL]
M +4 -50 MarbleControlBox.cpp
M +0 -2 MarbleControlBox.h
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1181054:1181055
@@ -65,6 +65,7 @@
MarbleModel.cpp
MarbleMap.cpp
MarbleControlBox.cpp
+ FileViewWidget.cpp
LegendWidget.cpp
CurrentLocationWidget.cpp
MarbleNavigator.cpp
@@ -306,6 +307,7 @@
MarbleModel.h
MarbleControlBox.h
LegendWidget.h
+ FileViewWidget.h
CurrentLocationWidget.h
MarbleNavigator.h
MarbleDataFacade.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1181054:1181055
@@ -25,16 +25,15 @@
#include <QtCore/QTime>
#include <QtCore/QTimer>
-#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
#include <QtGui/QCheckBox>
#include "global.h"
#include "CurrentLocationWidget.h"
+#include "FileViewWidget.h"
#include "LegendWidget.h"
#include "MarbleWidget.h"
#include "MarbleModel.h"
-#include "FileViewModel.h"
#include "MarblePlacemarkModel.h"
#include "RoutingWidget.h"
#include "MarbleRunnerManager.h"
@@ -51,7 +50,6 @@
#include "ui_NavigationWidget.h"
#include "ui_MapViewWidget.h"
#include "ui_CurrentLocationWidget.h"
-#include "ui_FileViewWidget.h"
namespace Marble
{
@@ -73,12 +71,10 @@
CurrentLocationWidget *m_currentLocationWidget;
- QWidget *m_fileViewWidget;
- Ui::FileViewWidget m_fileViewUi;
+ FileViewWidget *m_fileViewWidget;
QStandardItemModel *m_mapThemeModel;
QSortFilterProxyModel *m_sortproxy;
- QSortFilterProxyModel *m_treeSortProxy;
MapThemeSortFilterProxyModel *m_mapSortProxy;
MarbleRunnerManager *m_runnerManager;
@@ -122,8 +118,7 @@
}
addItem( d->m_mapViewWidget, d->m_mapViewWidget->windowTitle() );
- d->m_fileViewWidget = new QWidget( this );
- d->m_fileViewUi.setupUi( d->m_fileViewWidget );
+ d->m_fileViewWidget = new FileViewWidget( this );
addItem( d->m_fileViewWidget, d->m_fileViewWidget->windowTitle() );
d->m_currentLocationWidget = new CurrentLocationWidget( this );
@@ -278,27 +273,7 @@
// FIXME: Why does this fail: "selection model works on a different model than the view..." ?
// d->m_navigationUi.locationListView->setSelectionModel( d->m_widget->placemarkSelectionModel() );
- //set up everything for the FileModel
- d->m_fileViewUi.m_fileView->setModel( widget->fileViewModel() );
- delete d->m_fileViewUi.m_fileView->selectionModel();
- d->m_fileViewUi.m_fileView->setSelectionModel(
- widget->fileViewModel()->selectionModel());
- connect( d->m_fileViewUi.m_fileView->selectionModel(),
- SIGNAL( selectionChanged( QItemSelection, QItemSelection )),
- this,
- SLOT( enableFileViewActions() ) );
- connect( d->m_fileViewUi.m_saveButton, SIGNAL( clicked() ) ,
- widget->fileViewModel(), SLOT( saveFile() ) );
- connect( d->m_fileViewUi.m_closeButton, SIGNAL( clicked() ) ,
- widget->fileViewModel(), SLOT( closeFile() ) );
- d->m_treeSortProxy = new QSortFilterProxyModel(this);
- d->m_treeSortProxy->setSourceModel( widget->model()->treeModel() );
- d->m_treeSortProxy->setDynamicSortFilter( true );
- d->m_fileViewUi.m_treeView->setModel( d->m_treeSortProxy );
- d->m_fileViewUi.m_treeView->setSortingEnabled( true );
- connect( d->m_fileViewUi.m_treeView, SIGNAL(activated(QModelIndex)),
- this, SLOT(mapCenterOnTreeViewModel(QModelIndex)) );
-
+ d->m_fileViewWidget->setMarbleWidget( widget );
d->m_legendWidget->setMarbleWidget( widget );
// Connect necessary signals.
@@ -403,14 +378,6 @@
d->m_navigationUi.zoomSlider->blockSignals( false );
}
-void MarbleControlBox::enableFileViewActions()
-{
- bool tmp = d->m_fileViewUi.m_fileView->selectionModel()
- ->selectedIndexes().count() ==1;
- d->m_fileViewUi.m_saveButton->setEnabled( tmp );
- d->m_fileViewUi.m_closeButton->setEnabled( tmp );
-}
-
void MarbleControlBox::setNavigationTabShown( bool show )
{
QString title = tr( "Navigation" );
@@ -612,19 +579,6 @@
emit centerOn( d->m_sortproxy->mapToSource( index ), true );
}
-void MarbleControlBox::mapCenterOnTreeViewModel( const QModelIndex &index )
-{
- if (!index.isValid()) {
- return;
- }
- GeoDataObject *object = static_cast<GeoDataObject*>(d->m_treeSortProxy->mapToSource(index).internalPointer());
- if (dynamic_cast<GeoDataPlacemark*>(object))
- {
- GeoDataCoordinates coord = (dynamic_cast<GeoDataPlacemark*>(object))->coordinate();
- d->m_widget->centerOn( coord, true );
- }
-}
-
void MarbleControlBox::adjustForAnimation()
{
// TODO: use signals here as well
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.h #1181054:1181055
@@ -187,7 +187,6 @@
* doesn't emit the zoomChanged signal.
*/
void changeZoom( int zoom );
- void enableFileViewActions();
/**
* @brief Control whether the Navigation tab is shown.
@@ -239,7 +238,6 @@
void updateButtons( int );
void mapCenterOnSignal( const QModelIndex & );
- void mapCenterOnTreeViewModel( const QModelIndex & );
void adjustForAnimation();
void adjustForStill();
More information about the Marble-commits
mailing list