[Marble-commits] KDE/kdeedu/marble/src
Bastian Holst
bastianholst at gmx.de
Wed Mar 24 15:57:15 CET 2010
SVN commit 1107008 by bholst:
Marble profile changes:
* using flags instead of simple enum now
* setProfile() is now setProfile( detectProfile() )
M +1 -1 KdeMainWindow.cpp
M +6 -6 QtMainWindow.cpp
M +1 -1 lib/MarbleAboutDialog.cpp
M +9 -9 lib/global.cpp
M +11 -8 lib/global.h
M +1 -1 lib/global_p.h
M +12 -12 plugins/render/navigation/NavigationFloatItem.cpp
M +1 -1 plugins/render/navigation/NavigationFloatItem.h
--- trunk/KDE/kdeedu/marble/src/KdeMainWindow.cpp #1107007:1107008
@@ -36,7 +36,7 @@
MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent )
: KXmlGuiWindow( parent )
{
- MarbleGlobal::getInstance()->setProfile();
+ MarbleGlobal::getInstance()->setProfiles( MarbleGlobal::detectProfiles() );
m_part = new MarblePart( this, this, QStringList() << marbleDataPath );
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1107007:1107008
@@ -60,7 +60,7 @@
MainWindow::MainWindow(const QString& marbleDataPath, QWidget *parent) : QMainWindow(parent), m_sunControlDialog(0)
{
- MarbleGlobal::getInstance()->setProfile();
+ MarbleGlobal::getInstance()->setProfiles( MarbleGlobal::detectProfiles() );
setUpdatesEnabled( false );
QString selectedPath = marbleDataPath.isEmpty() ? readMarbleDataPath() : marbleDataPath;
@@ -210,7 +210,7 @@
{
// Do not create too many menu entries on a MID
// FIXME: Some of these options should come back.
- if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+ if( MarbleGlobal::getInstance()->profiles() && MarbleGlobal::SmallScreen ) {
return;
}
@@ -287,7 +287,7 @@
// Do not create too many menu entries on a MID
// FIXME: Set up another way of switching the plugins on and off.
- if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+ if( MarbleGlobal::getInstance()->profiles() && MarbleGlobal::SmallScreen ) {
return;
}
@@ -310,7 +310,7 @@
// Do not create too many menu entries on a MID
// FIXME: Set up another way of switching the plugins on and off.
- if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+ if( MarbleGlobal::getInstance()->profiles() && MarbleGlobal::SmallScreen ) {
return;
}
@@ -339,7 +339,7 @@
// Do not create too many menu entries on a MID
// FIXME: Set up another way of switching the plugins on and off.
- if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+ if( MarbleGlobal::getInstance()->profiles() && MarbleGlobal::SmallScreen ) {
return;
}
@@ -696,7 +696,7 @@
resize(settings.value("size", QSize(640, 480)).toSize());
move(settings.value("pos", QPoint(200, 200)).toPoint());
showFullScreen(settings.value("fullScreen", false ).toBool());
- if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+ if( MarbleGlobal::getInstance()->profiles() && MarbleGlobal::SmallScreen ) {
showSideBar(settings.value("sideBar", false ).toBool());
}
else {
--- trunk/KDE/kdeedu/marble/src/lib/MarbleAboutDialog.cpp #1107007:1107008
@@ -58,7 +58,7 @@
d->dataLoaded = false;
d->licenseLoaded = false;
- if( MarbleGlobal::getInstance()->profile() == MarbleGlobal::MobileInternetDevice ) {
+ if( MarbleGlobal::getInstance()->profiles() && MarbleGlobal::SmallScreen ) {
d->uiWidget.m_pMarbleTitleLabel->hide();
d->uiWidget.m_pMarbleLogoLabel->hide();
}
--- trunk/KDE/kdeedu/marble/src/lib/global.cpp #1107007:1107008
@@ -16,7 +16,7 @@
{
MarbleGlobalPrivate::MarbleGlobalPrivate()
- : m_profile( MarbleGlobal::Default )
+ : m_profiles( MarbleGlobal::Default )
{
}
@@ -45,25 +45,25 @@
return &d->m_locale;
}
-MarbleGlobal::Profile MarbleGlobal::profile() const {
- return d->m_profile;
+MarbleGlobal::Profiles MarbleGlobal::profiles() const {
+ return d->m_profiles;
}
-void MarbleGlobal::setProfile( MarbleGlobal::Profile profile ) {
- d->m_profile = profile;
+void MarbleGlobal::setProfiles( MarbleGlobal::Profiles profiles ) {
+ d->m_profiles = profiles;
}
-void MarbleGlobal::setProfile() {
+MarbleGlobal::Profiles MarbleGlobal::detectProfiles() {
MarbleGlobal::Profile profile = MarbleGlobal::Default;
// Checking Qt for maemo flags to find out if we are on a small screen device.
#ifdef Q_WS_HILDON // flag for Qt 4.5 (diablo and fremantle)
- profile = MarbleGlobal::MobileInternetDevice;
+ profile |= MarbleGlobal::SmallScreen;
#endif
#ifdef Q_WS_MAEMO_5
- profile = MarbleGlobal::MobileInternetDevice;
+ profile |= MarbleGlobal::SmallScreen;
#endif
- setProfile( profile );
+ return profile;
}
}
--- trunk/KDE/kdeedu/marble/src/lib/global.h #1107007:1107008
@@ -244,17 +244,19 @@
MarbleLocale * locale() const;
enum Profile {
- Default,
- MobileInternetDevice
+ Default = 0x0,
+ SmallScreen = 0x1
};
+
+ Q_DECLARE_FLAGS( Profiles, Profile )
- Profile profile() const;
- void setProfile( Profile profile );
+ Profiles profiles() const;
+ void setProfiles( Profiles profiles );
/**
- * Automatically sets the profile to the default value for the device marble is running on.
+ * Automatically detects the profile.
*/
- void setProfile();
+ static Profiles detectProfiles();
private:
MarbleGlobal();
@@ -265,7 +267,8 @@
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(Marble::TessellationFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(Marble::LabelPositionFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::TessellationFlags )
+Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::LabelPositionFlags )
+Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::MarbleGlobal::Profiles )
#endif
--- trunk/KDE/kdeedu/marble/src/lib/global_p.h #1107007:1107008
@@ -33,7 +33,7 @@
MarbleLocale m_locale;
- MarbleGlobal::Profile m_profile;
+ MarbleGlobal::Profiles m_profiles;
};
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/navigation/NavigationFloatItem.cpp #1107007:1107008
@@ -33,7 +33,7 @@
: AbstractFloatItem( point ),
m_marbleWidget( 0 ),
m_widgetItem( 0 ),
- m_profile( MarbleGlobal::getInstance()->profile() ),
+ m_profiles( MarbleGlobal::getInstance()->profiles() ),
m_oldViewportRadius( 0 )
{
// Plugin is enabled by default
@@ -41,7 +41,7 @@
// Plugin is not visible by default
setVisible( false );
- if( m_profile == MarbleGlobal::MobileInternetDevice ) {
+ if( m_profiles && MarbleGlobal::SmallScreen ) {
setFrame( FrameGraphicsItem::RectFrame );
}
else {
@@ -90,7 +90,7 @@
{
QWidget *navigationParent = new QWidget( 0 );
- if( m_profile == MarbleGlobal::MobileInternetDevice ) {
+ if( m_profiles && MarbleGlobal::SmallScreen ) {
m_navigationWidgetSmall.setupUi( navigationParent );
}
else {
@@ -105,7 +105,7 @@
setLayout( layout );
- if( m_profile != MarbleGlobal::MobileInternetDevice ) {
+ if( !( m_profiles && MarbleGlobal::SmallScreen ) ) {
connect( m_navigationWidget.zoomSlider, SIGNAL( sliderPressed() ),
this, SLOT( adjustForAnimation() ) );
connect( m_navigationWidget.zoomSlider, SIGNAL( sliderReleased() ),
@@ -148,7 +148,7 @@
int maxZoom = m_marbleWidget->map()->maximumZoom();
//m_navigationWidget.zoomSlider->setRange(minZoom, maxZoom);
- if( m_profile == MarbleGlobal::MobileInternetDevice ) {
+ if( m_profiles && MarbleGlobal::SmallScreen ) {
connect( m_navigationWidgetSmall.zoomInButton, SIGNAL( clicked() ),
m_marbleWidget, SLOT( zoomIn() ) );
connect( m_navigationWidgetSmall.zoomOutButton, SIGNAL( clicked() ),
@@ -195,7 +195,7 @@
void NavigationFloatItem::zoomChanged(int level)
{
- if( m_profile != MarbleGlobal::MobileInternetDevice ) {
+ if( !( m_profiles && MarbleGlobal::SmallScreen ) ) {
m_navigationWidget.zoomSlider->setValue(level);
}
}
@@ -205,15 +205,15 @@
Q_UNUSED(theme);
if ( m_marbleWidget ) {
- if( m_profile == MarbleGlobal::MobileInternetDevice ) {
- updateButtons(m_marbleWidget->map()->zoom());
+ if( m_profiles && MarbleGlobal::SmallScreen ) {
+ updateButtons( m_marbleWidget->map()->zoom() );
}
else {
int minZoom = m_marbleWidget->map()->minimumZoom();
int maxZoom = m_marbleWidget->map()->maximumZoom();
- m_navigationWidget.zoomSlider->setRange(minZoom, maxZoom);
- m_navigationWidget.zoomSlider->setValue(m_marbleWidget->map()->zoom());
- updateButtons(m_navigationWidget.zoomSlider->value());
+ m_navigationWidget.zoomSlider->setRange( minZoom, maxZoom );
+ m_navigationWidget.zoomSlider->setValue( m_marbleWidget->map()->zoom() );
+ updateButtons( m_navigationWidget.zoomSlider->value() );
}
}
}
@@ -248,7 +248,7 @@
QToolButton *zoomInButton;
QToolButton *zoomOutButton;
- if( m_profile == MarbleGlobal::MobileInternetDevice ) {
+ if( m_profiles && MarbleGlobal::SmallScreen ) {
if ( m_marbleWidget ) {
minZoom = m_marbleWidget->map()->minimumZoom();
maxZoom = m_marbleWidget->map()->maximumZoom();
--- trunk/KDE/kdeedu/marble/src/plugins/render/navigation/NavigationFloatItem.h #1107007:1107008
@@ -91,7 +91,7 @@
Ui::Navigation m_navigationWidget;
/** Used Profile */
- MarbleGlobal::Profile m_profile;
+ MarbleGlobal::Profiles m_profiles;
/** Radius of the viewport last time */
int m_oldViewportRadius;
More information about the Marble-commits
mailing list