• 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
  • apps
  • marble-kde
KdeMainWindow.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 2006-2007 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007 Inge Wallin <ingwa@kde.org>
10 //
11 
12 // Own
13 #include "KdeMainWindow.h"
14 
15 // Qt
16 #include <QProgressBar>
17 #include <QToolBar>
18 #include <QAction>
19 #include <QActionGroup>
20 
21 // KDE
22 #include <kaction.h>
23 #include <kactioncollection.h>
24 #include <kparts/part.h>
25 #include <kparts/componentfactory.h>
26 #include <kxmlguifactory.h>
27 
28 // GeoData
29 #include <GeoSceneDocument.h>
30 #include <GeoSceneHead.h>
31 
32 // Local dir
33 #include "MarbleDebug.h"
34 #include "ControlView.h"
35 #include "marble_part.h"
36 
37 namespace Marble
38 {
39 
40 MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent )
41  : KXmlGuiWindow( parent ),
42  m_savedSize( QSize( -1, -1 ) )
43 {
44  m_part = new MarblePart( this, this, QVariantList() << marbleDataPath );
45 
46  setCentralWidget( m_part->widget() );
47 
48  insertChildClient( m_part );
49 
50  setXMLFile( "marbleui.rc" );
51 
52  setStandardToolBarMenuEnabled( true );
53 
54  createGUI( 0 );
55  QList<QAction*> panelActions = m_part->controlView()->setupDockWidgets( this );
56  m_part->readTrackingSettings();
57  m_part->unplugActionList( "panels_actionlist" );
58  m_part->plugActionList( "panels_actionlist", panelActions );
59 
60  // View size actions
61  m_viewSizeActsGroup = new QActionGroup( this );
62 
63  QAction *actDefault = new QAction( tr( "Default (Resizable)" ), this );
64  actDefault->setCheckable(true);
65  m_viewSizeActsGroup->addAction(actDefault);
66 
67  QAction *actSeparator = new QAction(this);
68  actSeparator->setSeparator(true);
69  m_viewSizeActsGroup->addAction(actSeparator);
70 
71  QAction *actNtsc = new QAction( tr( "NTSC (720x486)" ), this );
72  actNtsc->setData( QSize( 720, 486 ) );
73  actNtsc->setCheckable(true);
74  m_viewSizeActsGroup->addAction(actNtsc);
75 
76  QAction *actPal = new QAction( tr( "PAL (720x576)" ), this );
77  actPal->setData( QSize( 720, 576 ) );
78  actPal->setCheckable(true);
79  m_viewSizeActsGroup->addAction(actPal);
80 
81  QAction *actNtsc16x9 = new QAction( tr( "NTSC 16:9 (864x486)" ), this );
82  actNtsc16x9->setData( QSize( 864, 486 ) );
83  actNtsc16x9->setCheckable(true);
84  m_viewSizeActsGroup->addAction(actNtsc16x9);
85 
86  QAction *actPal16x9 = new QAction( tr( "PAL 16:9 (1024x576)" ), this );
87  actPal16x9->setData( QSize( 1024, 576 ) );
88  actPal16x9->setCheckable(true);
89  m_viewSizeActsGroup->addAction(actPal16x9);
90 
91  QAction *actDvd = new QAction( tr( "DVD (852x480p)" ), this );
92  actDvd->setData( QSize( 852, 480 ) );
93  actDvd->setCheckable(true);
94  m_viewSizeActsGroup->addAction(actDvd);
95 
96  QAction *actHd = new QAction( tr( "HD (1280x720p)" ), this );
97  actHd->setData( QSize( 1280, 720 ) );
98  actHd->setCheckable(true);
99  m_viewSizeActsGroup->addAction(actHd);
100 
101  QAction *actFullhd = new QAction( tr( "Full HD (1920x1080p)" ), this );
102  actFullhd->setData( QSize( 1920, 1080 ) );
103  actFullhd->setCheckable(true);
104  m_viewSizeActsGroup->addAction(actFullhd);
105 
106  QAction *actDc = new QAction( tr( "Digital Cinema (2048x1536)" ), this );
107  actDc->setData( QSize( 2048, 1536 ) );
108  actDc->setCheckable(true);
109  m_viewSizeActsGroup->addAction(actDc);
110 
124  connect( m_viewSizeActsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeViewSize(QAction*)) );
125 
126  actDefault->setChecked( true );
127 
128  m_part->plugActionList( "viewSize_actionlist", m_viewSizeActsGroup->actions() );
129 
130  // Creating the plugin menus
131  m_part->createInfoBoxesMenu();
132  m_part->createOnlineServicesMenu();
133  m_part->createRenderPluginActions();
134  m_part->createFolderList();
135 
136  setAutoSaveSettings();
137 
138  connect( marbleWidget(), SIGNAL(themeChanged(QString)),
139  this, SLOT(setMapTitle()));
140 }
141 
142 MainWindow::~MainWindow()
143 {
144  factory()->removeClient( m_part );
145  delete m_part;
146 }
147 
148 ControlView* MainWindow::marbleControl() const
149 {
150  return m_part->controlView();
151 }
152 
153 MarbleWidget* MainWindow::marbleWidget() const
154 {
155  return m_part->controlView()->marbleWidget();
156 }
157 
158 void MainWindow::setMapTitle()
159 {
160  GeoSceneDocument *mapTheme = marbleWidget()->mapTheme();
161  if ( mapTheme ) {
162  setCaption( tr( mapTheme->head()->name().toLatin1() ) );
163  }
164 }
165 
166 void MainWindow::changeViewSize( QAction* action )
167 {
168  mDebug()<<size();
169  mDebug()<<minimumSize()<<maximumSize();
170  if ( action->data().type() == QVariant::Size ) {
171  if ( m_savedSize.isEmpty() ) {
172  m_savedSize = marbleControl()->size();
173  }
174  marbleControl()->setFixedSize( action->data().toSize() );
175  adjustSize();
176  } else {
177  marbleControl()->setMinimumSize( QSize( 0, 0 ) );
178  marbleControl()->setMaximumSize( QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ) );
179  marbleControl()->resize( m_savedSize );
180  marbleControl()->setMinimumSize( m_savedSize );
181  adjustSize();
182  marbleControl()->setMinimumSize( QSize( 0, 0 ) );
183  m_savedSize.setHeight( -1 );
184  }
185  mDebug()<<marbleControl()->size();
186  mDebug()<<size();
187 }
188 
189 }
190 #include "KdeMainWindow.moc"
Marble::MarblePart
Definition: marble_part.h:56
GeoSceneHead.h
Marble::MainWindow::setMapTitle
void setMapTitle()
Definition: KdeMainWindow.cpp:158
KdeMainWindow.h
QWidget
QSize::setHeight
void setHeight(int height)
marble_part.h
QAction::setSeparator
void setSeparator(bool b)
Marble::MainWindow::marbleControl
ControlView * marbleControl() const
Definition: KdeMainWindow.cpp:148
QActionGroup
QSize::isEmpty
bool isEmpty() const
QAction::setChecked
void setChecked(bool)
QAction::data
QVariant data() const
QActionGroup::addAction
QAction * addAction(QAction *action)
GeoSceneDocument.h
Marble::MainWindow::~MainWindow
~MainWindow()
Definition: KdeMainWindow.cpp:142
QWidget::adjustSize
void adjustSize()
MarbleDebug.h
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
Marble::MainWindow::MainWindow
MainWindow(const QString &marbleDataPath=QString(), QWidget *parent=0)
Definition: KdeMainWindow.cpp:40
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
QWidget::size
QSize size() const
QWidget::minimumSize
QSize minimumSize() const
KXmlGuiWindow
Marble::MarblePart::createFolderList
void createFolderList()
Definition: marble_part.cpp:1028
QMainWindow::setCentralWidget
void setCentralWidget(QWidget *widget)
QString
QList< QAction * >
Marble::GeoSceneHead::name
QString name() const
Definition: GeoSceneHead.cpp:91
QVariant::toSize
QSize toSize() const
Marble::GeoSceneDocument::head
const GeoSceneHead * head() const
Definition: GeoSceneDocument.cpp:86
QAction::setData
void setData(const QVariant &userData)
QSize
QWidget::setFixedSize
void setFixedSize(const QSize &s)
Marble::GeoSceneDocument
A container for features parsed from the DGML file.
Definition: GeoSceneDocument.h:44
QAction::setCheckable
void setCheckable(bool)
QWidget::maximumSize
QSize maximumSize() const
Marble::MarblePart::readTrackingSettings
void readTrackingSettings()
Definition: marble_part.cpp:621
QActionGroup::actions
QList< QAction * > actions() const
QString::toLatin1
QByteArray toLatin1() const
QAction
QWidget::setCaption
void setCaption(const QString &c)
Marble::MarbleWidget::mapTheme
GeoSceneDocument * mapTheme() const
Get the GeoSceneDocument object of the current map theme.
Definition: MarbleWidget.cpp:782
Marble::MarblePart::controlView
ControlView * controlView() const
Definition: marble_part.cpp:217
ControlView.h
Marble::MainWindow::marbleWidget
MarbleWidget * marbleWidget() const
Definition: KdeMainWindow.cpp:153
Marble::MainWindow::changeViewSize
void changeViewSize(QAction *)
Definition: KdeMainWindow.cpp:166
QVariant::type
Type type() const
Marble::MarblePart::createInfoBoxesMenu
void createInfoBoxesMenu()
Definition: marble_part.cpp:1075
Marble::ControlView::marbleWidget
MarbleWidget * marbleWidget()
Definition: ControlView.h:60
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Marble::ControlView
Definition: ControlView.h:46
Marble::MarblePart::createOnlineServicesMenu
void createOnlineServicesMenu()
Definition: marble_part.cpp:1091
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::MarblePart::createRenderPluginActions
void createRenderPluginActions()
Definition: marble_part.cpp:1111
Marble::ControlView::setupDockWidgets
QList< QAction * > setupDockWidgets(QMainWindow *mainWindow)
Definition: ControlView.cpp:529
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 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