[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/marble
From: Torsten Rahn <tackat () kde ! org>
Date: 2008-04-19 21:25:06
Message-ID: 1208640306.791417.2774.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 798907 by rahn:
Now everything has been ported to emulate the old
behaviour. Only the dgml-maps are missing.
For the full port to DGML we need to add the
Layermanagement class now ...
Switch the four DGML2 defines to 1 to see the
(not that visible) difference.
M +16 -0 ChangeLog
M +5 -0 src/ControlView.cpp
M +20 -89 src/lib/MapThemeManager.cpp
M +25 -11 src/lib/MarbleControlBox.cpp
M +3 -0 src/lib/MarbleControlBox.h
--- trunk/KDE/kdeedu/marble/ChangeLog #798906:798907
@@ -1,3 +1,19 @@
+2008-04-19 Torsten Rahn <rahn@kde.org>
+
+ Now everything has been ported to emulate the old
+ behaviour. Only the dgml-maps are missing.
+ For the full port to DGML we need to add the
+ Layermanagement class now ...
+
+ Switch the four DGML2 defines to 1 to see the
+ (not that visible) difference.
+
+ * src/ControlView.cpp:
+ * src/lib/MapThemeManager.cpp:
+ * src/lib/MarbleControlBox.{cpp,h}:
+
+ - Make the MarbleControlBox work with DGML2
+
2008-04-19 Patrick Spendrin <ps_ml@gmx.de>
* AbstractScanlineTextureMapper.cpp
--- trunk/KDE/kdeedu/marble/src/ControlView.cpp #798906:798907
@@ -9,6 +9,8 @@
// Copyright 2007 Inge Wallin <ingwa@kde.org>"
//
+#define DGML2 0
+
#include "ControlView.h"
#include <QtGui/QLayout>
@@ -48,6 +50,9 @@
m_control->addMarbleWidget( m_marbleWidget );
m_mapThemeManager = new MapThemeManager;
+#if DGML2
+ m_control->setMapThemeModel( m_mapThemeManager->mapThemeModel() );
+#endif
}
ControlView::~ControlView()
--- trunk/KDE/kdeedu/marble/src/lib/MapThemeManager.cpp #798906:798907
@@ -36,7 +36,9 @@
updateMapThemeModel();
/*
- qDebug() << "MapThemeManager lives!";
+// Should we put this into
+// static QString MapThemeManager::suggestTheme( QString themeSuggestedBySettings \
); +// ??
QStringList mapthemedirs = findMapThemes( "maps/" );
QString selectedmap;
@@ -63,6 +65,7 @@
MapThemeManager::~MapThemeManager()
{
+ delete m_mapThemeModel;
}
GeoSceneDocument* MapThemeManager::loadMapTheme( const QString& mapThemeStringID )
@@ -214,9 +217,6 @@
void MapThemeManager::updateMapThemeModel()
{
-// QModelIndex parent;
-// m_mapThemeModel->insertColumns(0, 3, parent);
-
QStringList stringlist = findMapThemes( "maps/" );
QStringListIterator it(stringlist);
@@ -237,24 +237,12 @@
continue;
}
- QList<QStandardItem *> itemList;
- itemList << new QStandardItem( mapTheme->head()->name() );
- itemList << new QStandardItem( mapTheme->head()->description() );
- itemList << new QStandardItem( mapTheme->head()->description() );
-
- m_mapThemeModel->appendRow(itemList);
-/*
-// maptheme->open( MarbleDirs::path( "maps/" + currentmaptheme ) );
-
- m_mapThemeModel->insertRows( row, 1, QModelIndex() );
-// m_mapThemeModel->setData( m_mapThemeModel->index( row, 0, QModelIndex() ),
-// tr( maptheme->name().toUtf8() ),
-// Qt::DisplayRole );
-
QPixmap themeIconPixmap;
QString relativePath;
-// relativePath = "maps/" + maptheme->prefix() + '/' + maptheme->icon();
+ relativePath = "maps/"
+ + mapTheme->head()->target() + "/" + mapTheme->head()->theme() \
+ "/" + + mapTheme->head()->icon()->pixmap();
themeIconPixmap.load( MarbleDirs::path( relativePath ) );
if ( themeIconPixmap.isNull() ) {
@@ -268,81 +256,24 @@
QIcon mapThemeIcon = QIcon(themeIconPixmap);
- m_mapThemeModel->setData( m_mapThemeModel->index( row, 0, QModelIndex() ), \
mapThemeIcon,
- Qt::DecorationRole );
-// m_mapThemeModel->setData( m_mapThemeModel->index( row, 0, QModelIndex() ),
-// QString( "<span style=\" max-width: 150 px;\"> " + \
tr( maptheme->description().toUtf8() ) + " </span>"),
-// Qt::ToolTipRole);
- m_mapThemeModel->setData( m_mapThemeModel->index( row, 1, QModelIndex() ),
- currentmaptheme );
-*/
- }
-}
+ QString name = mapTheme->head()->name();
+ QString description = mapTheme->head()->description();
-/*
-QStandardItemModel* MapTheme::mapThemeModel( const QStringList& stringlist )
-{
+ QList<QStandardItem *> itemList;
+ QStandardItem *item = new QStandardItem( name );
+ item->setData( name, Qt::DisplayRole );
+ item->setData( mapThemeIcon, Qt::DecorationRole );
+ item->setData( QString( "<span style=\" max-width: 150 px;\"> "
+ + tr( description.toUtf8() ) + " </span>"), Qt::ToolTipRole);
- QStandardItemModel *mapthememodel = new QStandardItemModel();
+ itemList << item;
+ itemList << new QStandardItem( description );
+ itemList << new QStandardItem( mapTheme->head()->target() + "/"
+ + mapTheme->head()->theme() );
- QModelIndex parent;
- mapthememodel->insertColumns(0, 3, parent);
-
- mapthememodel->setHeaderData(0, Qt::Horizontal, tr("Name"));
- mapthememodel->setHeaderData(1, Qt::Horizontal, tr("Description"));
- mapthememodel->setHeaderData(2, Qt::Horizontal, tr("Path"));
-
- QStringListIterator it(stringlist);
- MapTheme *maptheme = new MapTheme();
-
- // Make sure we don't keep excessively large previews in memory
- // TODO: Scale the icon down to the default icon size in katlasselectview.
- // For now maxIconSize already equals what's expected by the listview.
- QSize maxIconSize( 136,136 );
-
- int row = 0;
- while ( it.hasNext() ) {
- QString currentmaptheme = it.next();
-
- maptheme->open( MarbleDirs::path( "maps/" + currentmaptheme ) );
-
- mapthememodel->insertRows( row, 1, QModelIndex() );
- mapthememodel->setData( mapthememodel->index( row, 0, QModelIndex() ),
- tr( maptheme->name().toUtf8() ),
- Qt::DisplayRole );
-
- QPixmap themeIconPixmap;
- QString relativePath;
-
- relativePath = "maps/" + maptheme->prefix() + '/' +
-maptheme->icon();
- themeIconPixmap.load( MarbleDirs::path( relativePath ) );
-
- if ( themeIconPixmap.isNull() ) {
- relativePath = "svg/application-x-marble-gray.png";
- themeIconPixmap.load( MarbleDirs::path( relativePath ) );
- }
- else {
- themeIconPixmap = themeIconPixmap.scaled( maxIconSize,
- Qt::KeepAspectRatio, Qt::SmoothTransformation );
- }
-
- QIcon mapThemeIcon = QIcon(themeIconPixmap);
-
- mapthememodel->setData( mapthememodel->index( row, 0, QModelIndex() ), \
mapThemeIcon,
- Qt::DecorationRole );
- mapthememodel->setData( mapthememodel->index( row, 0, QModelIndex() ),
- QString( "<span style=\" max-width: 150 px;\"> " + \
tr( maptheme->description().toUtf8() ) + " </span>"),
- Qt::ToolTipRole);
- mapthememodel->setData( mapthememodel->index( row, 1, QModelIndex() ),
- currentmaptheme );
+ m_mapThemeModel->appendRow(itemList);
}
-
- delete maptheme;
-
- return mapthememodel;
}
-*/
#include "MapThemeManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #798906:798907
@@ -20,13 +20,15 @@
* Boston, MA 02110-1301, USA.
*/
+#define DGML2 0
+
#include "MarbleControlBox.h"
#include <QtCore/QtAlgorithms>
#include <QtCore/QDebug>
#include <QtCore/QTimer>
#include <QtGui/QSortFilterProxyModel>
-#include <QtGui/QStringListModel>
+#include <QtGui/QStandardItemModel>
#include <QtGui/QTextFrame>
#include "ui_MarbleControlBox.h"
@@ -57,7 +59,7 @@
QWidget *m_currentLocationWidget;
QWidget *m_fileViewWidget;
- QStandardItemModel *m_mapthememodel;
+ QStandardItemModel *m_mapThemeModel;
QSortFilterProxyModel *m_sortproxy;
};
@@ -135,8 +137,11 @@
connect( d->uiWidget.locationListView, SIGNAL( centerOn( const QModelIndex& ) ),
this, SLOT( mapCenterOnSignal( const \
QModelIndex& ) ) );
- d->m_mapthememodel = 0;
+ d->m_mapThemeModel = 0;
+
+#if !DGML2
updateMapThemes();
+#endif
connect( d->uiWidget.marbleThemeSelectView, SIGNAL( selectMapTheme( const \
QString& ) ),
this, SIGNAL( selectMapTheme( const \
QString& ) ) ); @@ -153,7 +158,7 @@
MarbleControlBox::~MarbleControlBox()
{
- delete d->m_mapthememodel;
+ delete d->m_mapThemeModel;
delete d;
}
@@ -161,10 +166,16 @@
void MarbleControlBox::updateMapThemes()
{
QStringList mapthemedirs = MapTheme::findMapThemes( "maps" );
- d->m_mapthememodel = MapTheme::mapThemeModel( mapthemedirs );
- d->uiWidget.marbleThemeSelectView->setModel( d->m_mapthememodel );
+ d->m_mapThemeModel = MapTheme::mapThemeModel( mapthemedirs );
+ d->uiWidget.marbleThemeSelectView->setModel( d->m_mapThemeModel );
}
+void MarbleControlBox::setMapThemeModel( QStandardItemModel *mapThemeModel ) {
+ d->m_mapThemeModel = mapThemeModel;
+ d->uiWidget.marbleThemeSelectView->setModel( d->m_mapThemeModel );
+}
+
+
void MarbleControlBox::updateButtons( int value )
{
if ( value <= d->uiWidget.zoomSlider->minimum() ) {
@@ -516,16 +527,19 @@
void MarbleControlBox::selectTheme( const QString &theme )
{
- for ( int row = 0; row < d->m_mapthememodel->rowCount(); ++row ) {
- QModelIndex itIndexName = d->m_mapthememodel->index( row, 1, QModelIndex() \
);
- QModelIndex itIndex = d->m_mapthememodel->index( row, 0, QModelIndex() \
);
- // qDebug() << "Select Theme: " << theme << " Stored: " << \
d->m_mapthememodel->data( itIndexName ).toString(); + if ( !d->m_mapThemeModel )
+ return;
+ for ( int row = 0; row < d->m_mapThemeModel->rowCount(); ++row ) {
+ QModelIndex itIndexName = d->m_mapThemeModel->index( row, 1, QModelIndex() \
); + QModelIndex itIndex = d->m_mapThemeModel->index( row, 0, \
QModelIndex() ); + // qDebug() << "Select Theme: " << theme << " Stored: " << \
d->m_mapThemeModel->data( itIndexName ).toString(); +
// If we have found the theme in the theme model,
// and it is not the one that we already have,
// then
// set the new one in the ui.
- if ( theme == d->m_mapthememodel->data( itIndexName ).toString()
+ if ( theme == d->m_mapThemeModel->data( itIndexName ).toString()
&& itIndexName != d->uiWidget.marbleThemeSelectView->currentIndex() ) {
// Mark the correct picture for the selected map theme and
// also make sure it's shown.
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.h #798906:798907
@@ -38,6 +38,7 @@
class MarbleWidget;
class MarbleControlBoxPrivate;
+class QStandardItemModel;
/**
* @short A widget class that contains advanced controls for a
@@ -115,6 +116,8 @@
* theme, e.g. after he/she used GHNS.
*/
void updateMapThemes();
+
+ void setMapThemeModel( QStandardItemModel *model );
Q_SIGNALS:
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic