diff --git a/doc/index.docbook b/doc/index.docbook index 53f9bcf6c..df9c8ee58 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1,1487 +1,1478 @@ ]> The &marble; Handbook Torsten Rahn
&Torsten.Rahn.mail;
Dennis Nienhüser
&Dennis.Nienhueser.mail;
2005 2006 2007 &Torsten.Rahn; 2010 2013 &Dennis.Nienhueser; &FDLNotice; 2013-12-12 1.7 (&kde; 4.13) &marble; is a geographical atlas and a virtual globe which lets you quickly explore places on our home planet. You can use &marble; to look up addresses, to easily create maps, measure distances and to retrieve detail information about locations that you have just heard about in the news or on the Internet. The user interface is clean, simple and easy to use. KDE education earth globe geography marble
Introduction &marble; logo &marble; logo Welcome to &marble;, a small interactive globe and geographical atlas that puts the world at your fingertips. Just like a real atlas or a conventional globe &marble; allows you to freely move across its map and lookup places. Furthermore &marble; allows you to zoom in and have many different views on the surface of the Earth. In its default configuration &marble; offers 11 different views: Atlas, OpenStreetMap, Satellite View, Earth at Night, Historical Map 1689, Moon, Plain Map, Precipitation (December), Precipitation (July), Temperature (December) and Temperature (July). &marble; comes with a small database of more than 12,000 locations (cities, mountains, volcanoes) which can be searched for and which are integrated with Wikipedia. Additionally you can measure distances using &marble; between multiple measure points which can be set freely. &marble; is free software and licensed under the &GNU; Lesser General Public License. &marble; quick start guide: Navigation Here is &marble; the first time you run it, either with ApplicationsEducationMarble (Desktop Globe) from the &kmenu; or with &Alt;F2 and entering marble into the field. &marble; main window &marble; main window On the right you can see a topographical map of our beautiful home planet. To allow for better orientation the map offers a scale bar in the lower left corner as well as a windrose on the top right. To navigate and to control the view you can use the tools on the Navigation info box at the right: Press the arrow buttons to rotate the globe. The Up and Down arrow buttons will tilt the earth axis back and forth. The Left and Right arrow buttons will make the earth spin around its physical axis. You can accomplish the same behavior by pressing the &LMB; somewhere on the globe and by moving the mouse while keeping the &LMB; pressed. Using this drag and drop style navigation will allow you to adjust the viewing angle much easier and more precisely. The cursor keys on your keyboard offer another alternative way to quickly change directions. Zoom in and out by moving the vertical slider up and down. If your mouse has got a mouse wheel you can use that one instead - or you just hold the &LMB; and the &RMB; down both at once while moving the mouse up and down. Changing the zoom level step by step can be done via the Zoom In and Zoom Out buttons which are placed above and below the zoom slider (or using the + and - keys on your keyboard). Depending on the map's resolution zooming in will provide you with more detail. Smaller cities will appear and using the topographic map you might notice that coastlines are provided as vector graphics. In case you should get lost you can always reset the viewing angle and zoom level back to the point where we started off: Just hit the Home button (or the Home button on your keyboard). To set the home location to the current position (center of the map) click on Set Home Location in the Bookmarks menu. A click onto the status bar using the &RMB; offers a menu which lets you customize the appearance of the status bar. You can show the position, altitude, the current tile level and a progress indicator that displays the status of the map data download. Choosing different map views for &marble; &marble; comes with 11 different views: Atlas, OpenStreetMap, Satellite View, Earth at Night, Historical Map 1689, Moon, Plain Map, Precipitation (December), Precipitation (July), Temperature (December) and Temperature (July). You can choose among these by pressing the Map View tab on the bottom of &marble;'s toolbox: &marble; map views &marble; Map Views Atlas: A classic topographic map. It uses vector lines ( "MicroWorldDataBase II" ) to mark coastlines, country borders &etc; and bitmap graphics ( "SRTM30" ) to create the height relief. OpenStreetMap: A global roadmap created by the OpenStreetMap (OSM) project. OSM is an open community which creates free editable maps. The OSM data was rendered using Mapnik. Satellite View: Earth as seen from Space. The map is based on NASA's beautiful Blue &marble; Next Generation pictures. Credits: NASA’s Earth Observatory Earth at Night: This image of Earth’s city lights was created with data from the Defense Meteorological Satellite Program (DMSP) Operational Linescan System (OLS). Historical Map 1689: A historical world map from the year 1689 created by G. van Schagen in Amsterdam. Moon: A map of the moon. The map is based on data from the Clementine Moon mission (UVVIS Basemap Mosaic). Credits: NASA/SDIO, Courtesy USGS Astrogeology Research Program. Plain Map: A plain map. It uses vector lines to mark coastlines and country borders &etc; Precipitation (December): A map which shows the average precipitation in December. Precipitation (July): A map which shows the average precipitation (rain/snow/hail/etc) in July. Temperature (December): A map which shows the average temperature in December. Temperature (July): A map which shows the average temperature in July. Searching places using &marble; &marble; comes with a small database of more than 12,000 cities ( from ) and a few mountains and volcanoes. You can find a location by entering its name into the search line on the top of the toolbox (&marble; always uses the native name in Latin letters). As you start typing, suggestions below the search line will appear like this: &marble; searching places &marble; Searching Places As you hit Return, &marble; runners will also query both online and offline searches to return you even more useful data. The following online search runners are available: Nominatim: An online search and reverse geocoding service, using data from HostIP: A reverse geocoding based on IP address, using data from The following offline search runners are also available, depending on extra software and data you have installed: Local Database: All placemarks in all open documents will be searched for. This includes your Bookmarks of course. Monav: An offline search service using the data from Monav offline routing information, based on OSM data Gosmore: An offline reverse geocoding service using data from gosmore setup Once you have found your search on the map you can click on its label or its symbol using the &LMB;. After clicking the name of the location on the map a data sheet will appear, like this: &marble; Data Sheet &marble; Data Sheet On the first tab of the dialog some very basic data is provided, like the name, coordinates and flag of the country the place belongs to. In addition, population numbers for cities get shown, as well as the elevation for mountains. If your computer is connected to the Internet and if you're online, &marble; will try to connect to the popular Internet encyclopedia Wikipedia. If a matching Wikipedia article is available &marble; will display it on the data sheet. The additional data sources can be enabled using ViewOnline services submenu. For example, you should mark Wikipedia menu item to see Wikipedia articles. Find your way with &marble; Besides searching for places, &marble; can display possible routes between two or more of them. Do you want to plan a bicycle tour in the nearby wood? Need driving instructions to get to an address in a foreign city? Click on the Routing tab on the top of &marble;'s toolbox to start planning your trip. Creating a new Route In the Routing tab you'll see two green buttons A and B. Enter the start address in the input field next to the A button, the route start input field. Press &Enter; or click on the Search button to find matching placemarks. A small progress animation will shorten your waiting time while the search is running. Using the search term Weavers Lane, London, the result will look similar to the screenshot below: &marble; address search &marble; Searching Addresses Matching placemarks line up in the list below the input fields. They are also shown in the map. The first result is automatically selected as the route start. In the map, this position is indicated using the same A icon as the button next to the route start input field. If the first result is not your desired route start, click on any other result to make that the new start position. You can either click on it in the result list or on its icon in the map to achieve that. The currently chosen route start is always indicated using the A icon. With the route start at hand, let's move on to enter the destination of our trip. The procedure is the same: Enter the destination address in the input field next to the B button, press &Enter; and select the desired item among the result list. Did you notice that the Search button is now gone and replaced by a Get Directions button? &marble; is signalizing that all information needed to calculate a route has been entered correctly. Click on the Get Directions button to retrieve a suitable route now. If your destination search term is Sun Walk, London, the result will resemble this screenshot: &marble; route result &marble; Displaying a Route If the start (or destination) position is already visible on the screen, you may find it more convenient to select it directly in the map. To do that, click on the A (or B) button next to the input field. Select From Map in the upcoming menu. Once clicked, the map input mode is activated: The next click on a position in the map will become the start (or end) of your trip. The mouse cursor turns into a cross to ease an accurate selection. The selected position will be included in the route and marked in the map. To abort the selection, either click on the button again or press &Esc;. An alternative selection of the route start and destination is provided via the context menu of the map: Click with the &RMB; on the desired location and select Directions from here or Directions to here, respectively. Route Profiles Which route to choose depends on the type of vehicle you plan to use (if any). You can tell &marble; about this and other preferences using route profiles. Each profile contains the settings for a certain routing scenario. On the first start, &marble; creates four common profiles for you: Car (fastest), Car (shortest), Bike, and Pedestrian. The examples in the previous sections used the Car (fastest) profile. Let's revisit the last route with a different profile: Select the Pedestrian option in the Profile combo box. The route now looks like this: &marble; pedestrian routing &marble; Pedestrian routing The proposed route has become shorter because footways are now also included when calculating the best route. If you want to tweak one of the default profiles further, select it in the Profile combo box and click on the Configure link. A new window opens. &marble; route profile configuration &marble; Route Profile configuration The left side lets you configure which routing backends are queried for routes. Eight or more backends are supported by &marble;, some working online and the other ones working offline. Online routing requires an Internet connection to query a route. Offline routing works without an Internet connection, but requires you to download and install offline routing maps in advance. The supported routing backends are CycleStreets: Bicycle routing for the United Kingdom using cyclestreets.net Gosmore: An offline router that also serves as the backend for the Yours online router MapQuest: An online router which provides advanced turn-by-turn instructions An AppKey is required for MapQuest routing to work. You can register the AppKey here. Monav: An offline router that is very fast even when calculating very large routes OSRM: An online router that is very fast even when calculating very large routes OpenRouteService: An online router that also generates driving instructions, limited to Europe Routino: An offline router with a very flexible configuration Yours: An online router that operates world-wide, but lacks driving instructions Once you select and enable a routing backend on the left to include it in routing queries, you can modify its settings on the right side. The settings are specific to each backend. Besides configuring the four default profiles, you can add new profiles and remove existing ones in the &marble; settings in the Routing page. Adjusting Routes &marble; let's you modify several aspects of the route for fine-tuning: Change route options, insert via points, move or remove existing points. The modification of route options has been discussed in the previous section already; we'll concentrate on point management now. Inserting via points is done by drag-and-drop in the map. Every time you move the mouse pointer above any part of the route (except above existing trip points), a green flag icon appears to indicate that it is possible to insert a via point. To start the insert operation, click with the &LMB;. Move the mouse pointer to the desired new position while keeping the &LMB; pressed. Blue lines from the neighboring via points to the new position will appear: &marble; route adding via points &marble; Inserting a via point The new via point will be inserted between the existing neighbor via points once you release the &LMB;. At the same time the existing route is painted dotted to indicate that it contains outdated information. In the background, a new route is prepared which will replace the outdated one automatically. It is also possible to add via points before the start or after the end of the route. To do that, follow the instructions above for inserting a new via point, but press &Ctrl; while moving the mouse. One blue line from the start or the end of the route appears. Its origin indicates where the new via point will be appended. Existing via points can be moved freely across the map. Move the mouse pointer above a via point and drag it to its new location. Once released, the route will be updated automatically. To exclude via points from the route, remove them. This can be done using either the Remove button next to the via point input field or by clicking with the &RMB; on the via point in the map. In the context menu, choose Remove this destination. To start an entirely new route, remove all via points. Loading, Saving and Exporting Routes You can save routes in kml (Keyhole Markup Language) format and load them again at a later point - on the same computer or a different device running &marble;, or share them with your friends or other applications which are able to read kml files (like Google Earth). To save a route to a .kml file, click on the Save icon on the bottom of the routing tab. The upcoming save dialog allows you to choose a file name to save the route to. Similarly loading a route is initiated with the Open icon on the bottom of the routing tab. Select the .kml route file to open in the upcoming open dialog and &marble; loads the route from it. Routes planned in &marble; can be used in other applications or navigation devices which support gpx (GPS eXchange Format) or equivalent formats. If your navigation device does not support gpx directly, you can use a conversion utility like gpsbabel to convert a gpx file exported by &marble; to a suitable format. The export of a route in &marble; is initiated from the routing context menu in the map. Click with the &RMB; on any point of the route in the map. In the context menu that appears, choose Export route...: &marble; route export &marble; Exporting a Route Enter the desired filename in the upcoming save dialog. The filename extension should be gpx to store in gpx format or kml to store in kml (Keyhole Markup Language) format. Note that the internal format of &marble; is kml; in doubt save routes as kml and only use gpx to share routes with other applications that are not capable of reading kml files. Measuring distances with &marble; As mentioned already &marble; always displays a dynamic scale bar on the lower left to estimate distances on the map. Together with the windrose in the top right corner these overlays are provided for better orientation. But there's more: &marble; allows you to measure distances between two or more points on earth. To do so click the respective points in correct order on the globe using the &RMB;. On each click a popup menu will appear which allows you to add a measure point (Add Measure Point) or to remove all measure points altogether (Remove Measure Points): &marble; measuring &marble; measuring distances Once you have added at least two measure points, the total distance will be displayed in the top left corner of the map. &marble; will assume a spherical earth for all measurements which should be accurate enough for most cases. Displaying of distances and bearings for the measured segments can be configured using Measure Tool configuration dialog. Download Map Regions Pre-installed with a set of maps, &marble; is ready to use. When you zoom in at places, more detailed parts of the current map theme are downloaded in the background. This works excellent whenever an Internet connection is available. What to do, however, when traveling to a foreign city where no constant Internet connection is available to download maps? Plan ahead and download those map regions you are going to use. To understand what needs to be downloaded to display certain parts of the map offline, let's briefly look into the concept of tiles which &marble; uses internally. A tile is an image which corresponds to a certain part of the map. Tiles are arranged by &marble; next to each other to form the map image that is displayed to you. Depending on the selected projection mode, tiles are arranged to form a rectangle (Flat Map Projection, left) or a sphere (Globe Projection, right): &marble; projections Tiles at Level 1 in Flat Map (left) and Globe Projection (right) Zooming in at this view, more details need to be displayed. The tiles shown in the two screenshots above are too coarse then; &marble; automatically recognizes this and changes to the next tile level where images provide more details. This keeps going: The more you zoom in, the higher the tile level. The following sketch illustrates the different number of tiles (colored) corresponding to the same map region at different tile levels: &marble; tile levels Different Tile Levels in &marble; When downloading a map region for offline usage, you need to download all tiles in the desired region for all tile levels you plan to use. Because of the connection between tile levels and zoom levels, you can think of it as downloading all tiles in the zoom levels you plan to use. To accomplish this for a certain region, make that region visible in the screen by zooming and moving the Globe. Now open the Download Region... dialog in the File menu. Keep the Visible region option selected to download those tiles that correspond to the map region visible in the screen. Next, select the tile level range (zoom range) you wish to download. The first field corresponds to the smallest, the second field corresponds to the largest tile level that will be downloaded. Tile levels in between will be downloaded as well. &marble; shows how many tiles (images) need to be downloaded and updates this number whenever you change the region or tile level range. &marble; Download Region dialog &marble;'s Download Region dialog The tile level corresponding to the current zoom level is shown in the status bar on the bottom. Please note that you may have to configure &marble; to show that information: Click with the &RMB; on the status bar and select Show Tile Zoom Level. Select OK to trigger the map region download. The progress bar of &marble; will show the download progress (if activated). In case you do know the coordinates of the map region to download, you can enter them by clicking on the Specify region option. The map region visible in the screen will be ignored in that case. You can keep using &marble; while the Download Region dialog is open. This is useful to queue several downloads for different regions or different tile ranges. Just select Apply instead of OK to trigger the map region download. Command Reference Menus and shortcut keys The File Menu &Ctrl;O File Open... Opens a map file. File Open Recent This is a shortcut to open recently opened maps. Clicking on this item opens a list to the side of the menu with several of the most recently opened files. Clicking on a specific file will open it in &marble; - if the file still resides at the same location. &Ctrl;N File Download Maps... Displays the Get Hot New Stuff! dialog to download additional maps for &marble;, among others maps for Mars and Venus. File Create a New Map... Displays the &marble; Map Theme Creation Wizard dialog to create a new map using Web Map Service data, your own image file or Open Street Map indexed tiles. File Download Region... Displays the Download Region dialog to download map data in different zoom levels for offline usage. See Download Map Regions for details. &Ctrl;S File Export Map... Exports a screenshot of &marble;'s map to an image file. &Ctrl;P File Print... Prints a screenshot of &marble;'s map. File Print Preview Opens a window that shows a preview of the printed map. File Work Offline If this option is selected &marble; will no longer download map data from the Internet. The search feature gets restricted to the local database. New routes cannot be retrieved. &Ctrl;Q File Quit Quits &marble; The Edit Menu &Ctrl;C Edit Copy Map Copies a screenshot of &marble;'s map to the global clipboard. Edit Copy Coordinates Copies the current coordinates to the global clipboard. &Ctrl;E Edit Edit Map Allows you to open the current map in the external map editor. The current version supports Potlatch (in a web browser), Merkaartor and JOSM map editors. The View Menu View Current Location Toggle the display of the location page in the left panel. If a GPS device is connected with your computer, &marble; displays longitude and latitude of your current location. View Crosshairs Toggle the display of a simple crosshair in the center of the map. F5 View Redisplay The currently visible part of the map is downloaded again and refreshed on the screen. View Info Boxes In this submenu you can to lock the position of the infoboxes and show or hide the plugins you have enabled in the Plugins page of &marble;s configuration dialog. View Online Services The Wikipedia plugin displays georeferenced Wikipedia articles as an icon on the map. A click onto the icon launches a browser window that displays the referenced site. The data is provided through a webservice via GeoNames.org. Likewise a Photos plugin currently provides photos via the FlickR photo sharing site View Clouds Show real-time cloud cover. A real-time cloud map that gets updated every 3 hours. It uses GOES, METEOSAT, and GMS satellite imagery downloaded from the Geostationary Satellite Imagery page at Dundee University. Credits: Hari Nair, Xplanet Project View Atmosphere Show the diffuse reflection of the atmosphere around the Earth. View Stars Show the star map as seen from the Solar System. View Sun Control... Displays the Sun Control where you can set the Sun Shading and center the map on subsolar point position. View Time Control... Displays the Time Control dialog where you can set date and time and the simulation time speed. View Eclipses in year Displays the list of the eclipses for the year chosen using ViewBrowse Eclipses... menu item. This menu item will be shown only when Eclipses plugin is enabled View Browse Eclipses... Displays the Eclipse Browser dialog where you can set the year to show eclipses for, open plugin settings dialog, view data on eclipse start, end, type and magnitude. Choose some eclipse item from the list and click on Go To Selected Eclipse to view the location of the eclipse on the globe. This menu item will be shown only when Eclipses plugin is enabled The Settings Menu Settings Show Toolbar Toggle the display of the toolbar. Settings Show Statusbar Toggle the display of the status bar. Settings Panels Toggle the display of the &marble; panels. You can make &marble; hide all panels or show them by selecting the Settings Panels Hide All Panels/Show All Panels menu item or pressing F9 key on your keyboard. Settings View Size Switches between various sizes of &marble; map area. You can choose one of the sizes that are suitable for capturing frames for screencast or keep &marble; map area resizable (Default (resizable) menu item). &Ctrl;&Shift;F Settings Full Screen Mode Switches between normal view and full screen view. In full screen view, the titlebar is hidden and the actual application window is resized to the entire screen. Settings Configure &marble; Desktop Globe... Display the &marble; configuration dialog. The Help Menu &help.menu.documentation; Configuring &marble; View Configuration The View configuration dialog The View configuration dialog Distance The unit that gets used to measure altitude, lengths and distances (⪚ km, mi, ft). Angle Specifies the notation of angles in coordinates: By default the Degree-Minute-Second notation (⪚ 54°30'00" ) gets used. As an alternative you can choose decimal degrees (⪚ 54.5°). Still image Specifies the map quality that gets displayed while there is no user input. Usually this allows for high map quality as speed is no concern. During animations Specifies the map quality that gets displayed during map animations (⪚ while dragging the globe). Especially on slow machines it is advisable to set this option to Low Quality as this will give better speed. - -Graphics system - -Specifies the graphics system - Native X11 or Raster (Software rendering) - -that &Qt; uses to draw the map. Changing this setting might be a good idea if there are performance issues with -the system's graphics drivers. - - - Place names Places often have different names in different languages. The label on the map can show the name in the user's language. Alternatively it can display the name in the official language and glyphs of that place. Default map font The default font that gets used on the map. Navigation Configuration The Navigation configuration dialog The Navigation configuration dialog Drag location While dragging the mouse there are two standard behaviors when dealing with a virtual globe: The location below mouse pointer will follow the cursor exactly: As a result ⪚ the north pole will not stay at the top which can lead to confusion. By default &marble; makes sure that north is always up which results in a dragging behavior where the location below the mouse pointer slightly "detaches" from the cursor. Inertial Globe Rotation By default &marble; will use kinetic spinning while dragging the map. You can turn this behavior off using this check box. Animate voyage to the target When searching for a location &marble; can either move instantly to the new location or it can show a travel animation from the previous place to the new place. On Startup By default &marble; will display the home location immediately after the application has started. As an alternative it can also show the last position that was active when the user left the application. External Editor Here, you can define the default editor for the maps or choose Always ask if &marble; should ask you to choose before starting the external editor. Cache & Proxy Configuration The Cache & Proxy configuration dialog The Cache & Proxy configuration dialog Cache There are two caches being used for &marble;: The physical memory which is needed to keep map data in the computer's memory. Increasing the value will make the application more responsive. The hard disc memory cache is used by download contents from the Internet (⪚ Wikipedia data or map data). Decrease this value if you want to save space on the hard disc and if high usage of the Internet is not an issue. Proxy Proxy settings for your local intranet. Please leave empty if there is no proxy. Date & Time Configuration The Date & Time configuration dialog The Date & Time configuration dialog Time Zone Here, you can choose a time zone for &marble;: UTC, system time zone or choose custom time zone. The chosen option changes the map view only if the map can show the light conditions on the surface. When &marble; starts Here, you can choose the date and time which will be used on &marble; start: system time or the last session time. Synchronization Configuration &marble; can upload route and bookmark data to ownCloud server and synchronize them between &marble; instances installed on different devices. The Synchronization configuration dialog The Synchronization configuration dialog Enable synchronization The synchronization can be enabled or disabled using this item. When the synchronization is enabled you can choose whether to synchronize route and bookmark data using the corresponding check boxes or click on Sync now to initiate synchronization immediately. Credentials Here, you can enter your ownClowd credentials. More information on ownClowd configuration can be found on the ownClowd official website. Routing Configuration The Routing configuration dialog The Routing configuration dialog Add Opens a window where you can add a new routing profile. Configure Opens a window where the currently selected routing profile can be configured. Remove Deletes the selected routing profile. Move Up The selected routing profile is moved up one step. It will appear before the one that was previously on top of it. Move Down The selected routing profile is moved down one step. It will appear after the one that was previously below of it. Plugins Configuration The Plugin Configuration widget is the place to activate (or deactivate) Info Boxes, Online Services and other plugins that affect the look of &marble;. Active plugins appear in the View menu where you can toggle their visibility. The Plugins configuration dialog The Plugins configuration dialog Each plugin can be activated and deactivated using the check box on the left. Some plugins provide further configuration options which are accessible by clicking on the tool icon on the right. Amateur Radio Aprs Plugin Retrieves data from the Automatic Packet Reporting System via the Internet, a file or a serial device. The position and status of data senders is displayed in the map and updated in real-time. Annotation Allows you to add annotations on the maps. Atmosphere Displays atmosphere effects. Compass Shows a compass in the map Coordinate Grid Displays a coordinate grid (you can choose the colors of the grid lines). Crosshairs Enable this to display a small crosshair in the center of the map. Download Progress Indicator A pie chart on top of the map that shows the progress of ongoing downloads. Earthquakes Displays the earthquake markers on the map. Eclipses Displays the data about Solar and Moon eclipses. Elevation Profile Displays the elevation profile overlay for the routes on the map. Elevation Profile Marker Marks the current elevation of the elevation profile on the map. GpsInfo Displays a float item that provides GPS information. License Displays a float item that provides copyright information. Measure Tool The plugin to measure distances between two or more points. Displaying of the distance and the bearing between the points can be configured after pressing the tool icon. It is enough to check the corresponding item to make &marble; show the labels or uncheck the item to hide the labels. Navigation Displays the mouse control to zoom and move as float item on the map. OpenCaching.com Displays the geocaching markers on the map. OpenDesktop Items Shows OpenDesktop users' avatars and some extra information about them on the map. Overview Map This is a float item that provides an overview map. Photos Automatically downloads images from around the world in preference to their popularity. Places Displays trending Foursquare places. Position Marker Draws a marker at the current GPS position. Postal Codes Shows postal codes of the area on the map. Routing Displays the routing information and navigation controls. Satellites Displays the Earth and other planets natural and artificial satellites and their orbits. Scale Bar This is a float item that provides a map scale. Speedometer Displays the current cruising speed. Needs some GPS data. Stars A plugin that shows the Starry Sky. Sun A plugin that shows the Sun. Weather Downloads current weather information of cities and displays them in the map. Wikipedia Articles Automatically downloads Wikipedia articles and shows them on the right position on the map. Questions and Answers I cannot see my house on the map / Why should I use &marble; if there is Google Earth already? &marble; aims to be a lightweight fast educational geographical browser that easily runs on any platform that is supported by &Qt;. While higher resolution maps would be nice to have they aren't necessary for every user and every use case (just like you don't use a full blown text processor each time you just need a simple editor). Also notice &marble; is free software and is based on data that can be freely redistributed in the same way that applies to Free Software. Why is &marble; so fast although I don't have hardware acceleration enabled? / Why doesn't &marble; run smoothly on my expensive 3D graphics card? Despite depicting the earth as a globe &marble; doesn't make use of any 3D hardware acceleration. This has the advantage of running at a decent speed on any platform and hardware supported by &Qt;. However it has the disadvantage that it doesn't run as smoothly as it could if it used hardware accelerated OpenGL. &marble; just uses plain 2D graphics and therefore requires a graphics adapter that is fast at drawing 2D graphics. We plan to add an optional OpenGL backend in the future. Will I ever have to pay for &marble;? No, never. But the authors always welcome feedback. &marble; is licensed under the LGPL, so you will never have to pay for this program. How can I contribute? &marble; is not only an application but also a Free Software project. As such it's easy to join: just contact us via the marble-devel mailing list (marble-devel@kde.org). Credits and License &marble; Program Copyright, 2005-2007 &Torsten.Rahn; &Torsten.Rahn.mail; Contributors: &Torsten.Rahn; &Torsten.Rahn.mail; Inge Wallin inge@lysator.liu.se &underFDL; &underLGPL; Installation How to obtain &marble; &install.intro.documentation; Requirements &marble; itself can be found on the &marble; website and is part of the &kde;-Edu project You can find a list of changes in the file ChangeLog in the distribution of &marble;. Compilation and Installation &marble; can be compiled as a &Qt; 4-only version as well as featuring &kde; 4 support. To compile &marble; with &Qt; 4-only support check out &marble; from &kde; Git into ~/marble and just do: cmake -DQTONLY=ON ~/marble and sudo make install. To compile &marble; with &kde; support check instructions on how to compile &kde; applications at &kde;'s TechBase. &documentation.index;
diff --git a/docs/bindings/python/html/marble/Marble.QtMarbleConfigDialog.html b/docs/bindings/python/html/marble/Marble.QtMarbleConfigDialog.html index 42cfe93c7..3bb5691e2 100644 --- a/docs/bindings/python/html/marble/Marble.QtMarbleConfigDialog.html +++ b/docs/bindings/python/html/marble/Marble.QtMarbleConfigDialog.html @@ -1,553 +1,540 @@ Marble.QtMarbleConfigDialog
diff --git a/docs/bindings/python/html/marble/Marble.html b/docs/bindings/python/html/marble/Marble.html index 19d84f844..d8143e7a2 100644 --- a/docs/bindings/python/html/marble/Marble.html +++ b/docs/bindings/python/html/marble/Marble.html @@ -1,500 +1,487 @@ Marble
diff --git a/src/apps/marble-kde/marble.kcfg b/src/apps/marble-kde/marble.kcfg index 0afeb1693..070ee1d3c 100644 --- a/src/apps/marble-kde/marble.kcfg +++ b/src/apps/marble-kde/marble.kcfg @@ -1,342 +1,333 @@ "../../lib/marble/MarbleGlobal.h" QtCore/QDir QtCore/QLocale QFontDatabase 9.4 54.8 1050 0.0 0.0 11564500 true false false false 0 true 1 -100 100 true false true false false 0 false true QDir::homePath() QDir::homePath() false 0 QLocale::MetricSystem Marble::DMSDegree Marble::HighQuality Marble::LowQuality - - - - - - - - Marble::RasterGraphics - Marble::Native QFontDatabase::systemFont(QFontDatabase::GeneralFont) QDir::homePath() false false false false Marble::KeepAxisVertically Marble::ShowHomeLocation true false 0 100 0 999999 0 0 999999 8080 0 65535 true Marble::HttpProxy false false true true false true true true 0 Marble::Oxygen::skyBlue4 200 Marble::Oxygen::seaBlue2 200 Marble::Oxygen::aluminumGray4 200 false owncloud true true diff --git a/src/apps/marble-kde/marble_part.cpp b/src/apps/marble-kde/marble_part.cpp index 4370ce671..a108b7e7e 100644 --- a/src/apps/marble-kde/marble_part.cpp +++ b/src/apps/marble-kde/marble_part.cpp @@ -1,1869 +1,1835 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2007 Tobias Koenig // Copyright 2008 Inge Wallin // Copyright 2009 Jens-Michael Hoffmann // Copyright 2010 Harshit Jain // // Own #include "marble_part.h" // Qt #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE #include #include #include #include #include #include #include #include #include #include #include #include // Marble library classes #include "AbstractFloatItem.h" #include "AbstractDataPlugin.h" #include "EditBookmarkDialog.h" #include "BookmarkManager.h" #include "BookmarkManagerDialog.h" #include "CurrentLocationWidget.h" #include "DialogConfigurationInterface.h" #include "DownloadRegionDialog.h" #include "GeoDataCoordinates.h" #include "GeoDataFolder.h" #include "GeoDataLatLonAltBox.h" #include "GeoDataLookAt.h" #include "GeoDataPlacemark.h" #include "HttpDownloadManager.h" #include "MarbleDirs.h" #include "MarbleDebug.h" #include "MarbleLocale.h" #include "MarbleModel.h" #include "MarblePluginSettingsWidget.h" #include "MapWizard.h" #include "NewBookmarkFolderDialog.h" #include "RenderPluginModel.h" #include "routing/RoutingManager.h" #include "routing/RoutingProfilesModel.h" #include "routing/RoutingProfilesWidget.h" #include "routing/RouteRequest.h" #include "SunControlWidget.h" #include "TimeControlWidget.h" #include "TileCoordsPyramid.h" #include "ViewportParams.h" #include "MarbleClock.h" #include "ParseRunnerPlugin.h" #include "PositionTracking.h" #include "PositionProviderPlugin.h" #include "PluginManager.h" #include "SearchInputWidget.h" #include "MarbleWidgetInputHandler.h" #include "Planet.h" #include "MapThemeDownloadDialog.h" #include "cloudsync/BookmarkSyncManager.h" #include "MovieCaptureDialog.h" #include "cloudsync/RouteSyncManager.h" // Marble non-library classes #include "ControlView.h" #include "settings.h" using namespace Marble; #include "ui_MarbleCacheSettingsWidget.h" #include "ui_MarbleViewSettingsWidget.h" #include "ui_MarbleNavigationSettingsWidget.h" #include "ui_MarbleTimeSettingsWidget.h" namespace Marble { namespace { const char POSITION_STRING[] = I18N_NOOP( "Position: %1" ); const char DISTANCE_STRING[] = I18N_NOOP( "Altitude: %1" ); const char TILEZOOMLEVEL_STRING[] = I18N_NOOP( "Tile Zoom Level: %1" ); const char DATETIME_STRING[] = I18N_NOOP( "Time: %1" ); } K_PLUGIN_FACTORY(MarblePartFactory, registerPlugin();) K_EXPORT_PLUGIN(MarblePartFactory("marble")) MarblePart::MarblePart( QWidget *parentWidget, QObject *parent, const QVariantList &arguments ) : KParts::ReadOnlyPart( parent ), m_sunControlDialog( 0 ), m_timeControlDialog( 0 ), m_downloadRegionDialog( 0 ), m_movieCaptureDialog( 0 ), m_externalMapEditorAction( 0 ), m_recordMovieAction( 0 ), m_stopRecordingAction( 0 ), m_recentFilesAction( 0 ), m_configDialog( 0 ), m_position( QCoreApplication::translate( "Marble", NOT_AVAILABLE ) ), m_tileZoomLevel( QCoreApplication::translate( "Marble", NOT_AVAILABLE ) ), m_positionLabel( 0 ), m_distanceLabel( 0 ) { // only set marble data path when a path was given if ( arguments.count() != 0 && !arguments.first().toString().isEmpty() ) MarbleDirs::setMarbleDataPath( arguments.first().toString() ); // Setting measure system to provide nice standards for all unit questions. // This has to happen before any initialization so plugins (for example) can // use it during initialization. MarbleLocale *marbleLocale = MarbleGlobal::getInstance()->locale(); // KF5 TODO: Read Connecting Calls to Catalogs" in ki18n programmer's guide // and enable translations // KLocale *kLocale = KGlobal::locale(); // if ( kLocale->measureSystem() == KLocale::Metric ) { // marbleLocale->setMeasurementSystem( QLocale::MetricSystem ); // } // else { // marbleLocale->setMeasurementSystem( QLocale::ImperialSystem ); // } marbleLocale->setMeasurementSystem( MarbleLocale::ImperialSystem ); migrateNewstuffConfigFiles(); m_externalEditorMapping[0] = ""; m_externalEditorMapping[1] = "potlatch"; m_externalEditorMapping[2] = "josm"; m_externalEditorMapping[3] = "merkaartor"; m_controlView = new ControlView( parentWidget ); setWidget( m_controlView ); setupActions(); setXMLFile( "marble_part.rc" ); m_statusBarExtension = new KParts::StatusBarExtension( this ); m_statusBarExtension->statusBar()->setUpdatesEnabled( false ); // Load bookmark file. If it does not exist, a default one will be used. m_controlView->marbleModel()->bookmarkManager()->loadFile( "bookmarks/bookmarks.kml" ); initializeCustomTimezone(); setupStatusBar(); readSettings(); m_statusBarExtension->statusBar()->setUpdatesEnabled( true ); // Show startup location switch ( MarbleSettings::onStartup() ) { case LastLocationVisited: { GeoDataLookAt target; target.setLongitude( MarbleSettings::quitLongitude() ); target.setLatitude( MarbleSettings::quitLatitude() ); target.setRange( MarbleSettings::quitRange() ); m_controlView->marbleWidget()->flyTo( target, Instant ); } break; case ShowHomeLocation: m_controlView->marbleWidget()->goHome( Instant ); break; } connect( m_controlView, SIGNAL(showUploadDialog()), this, SLOT(showUploadNewStuffDialog()) ); connect( m_controlView, SIGNAL(showMapWizard()), this, SLOT(showMapWizard()) ); connect( m_controlView, SIGNAL(mapThemeDeleted()), this, SLOT(fallBackToDefaultTheme()) ); } MarblePart::~MarblePart() { writeSettings(); // Check whether this delete is really needed. delete m_configDialog; } ControlView* MarblePart::controlView() const { return m_controlView; } KAboutData *MarblePart::createAboutData() { return new KAboutData( QString( I18N_NOOP( "marble_part" ) ), QString( "Marble" ), ControlView::applicationVersion(), i18n( "A Virtual Globe" ), KAboutLicense::LGPL_V2 ); } bool MarblePart::openUrl( const QUrl &url ) { QFileInfo fileInfo( url.toLocalFile() ); if ( fileInfo.isReadable() ) { m_controlView->marbleModel()->addGeoDataFile( url.toLocalFile() ); m_recentFilesAction->addUrl( url ); return true; } KMessageBox::error( widget(), i18n( "Sorry, unable to open '%1'. The file is not accessible." ).arg( fileInfo.fileName() ), i18n( "File not accessible" ) ); return false; } bool MarblePart::openFile() { const PluginManager *const pluginManager = m_controlView->marbleModel()->pluginManager(); QStringList allFileExtensions; QStringList filters; foreach ( const ParseRunnerPlugin *plugin, pluginManager->parsingRunnerPlugins() ) { if ( plugin->nameId() == "Cache" ) continue; const QStringList fileExtensions = plugin->fileExtensions().replaceInStrings( QRegExp( "^" ), "*." ); const QString filter = QString( "%1 (%2)" ).arg( plugin->fileFormatDescription() ).arg( fileExtensions.join( " " ) ); filters << filter; allFileExtensions << fileExtensions; } allFileExtensions.sort(); // sort since file extensions are visible under Windows const QString allFileTypes = QString( "%1 (%2)" ).arg( i18n( "All Supported Files" ) ).arg( allFileExtensions.join( " " ) ); filters.sort(); filters.prepend( allFileTypes ); const QString filter = filters.join( ";;" ); QStringList fileNames = QFileDialog::getOpenFileNames( widget(), i18n("Open File"), m_lastFileOpenPath, filter ); if ( !fileNames.isEmpty() ) { const QString firstFile = fileNames.first(); m_lastFileOpenPath = QFileInfo( firstFile ).absolutePath(); } foreach( const QString &fileName, fileNames ) { openUrl( QUrl::fromLocalFile(fileName) ); } return true; } void MarblePart::exportMapScreenShot() { QString fileName = QFileDialog::getSaveFileName( widget(), i18n("Export Map"), QDir::homePath(), i18n( "Images *.jpg *.png" ) ); if ( !fileName.isEmpty() ) { // Take the case into account where no file format is indicated const char * format = 0; if ( !fileName.endsWith(QLatin1String( "png" ), Qt::CaseInsensitive) && !fileName.endsWith(QLatin1String( "jpg" ), Qt::CaseInsensitive) ) { format = "JPG"; } QPixmap mapPixmap = m_controlView->mapScreenShot(); bool success = mapPixmap.save( fileName, format ); if ( !success ) { KMessageBox::error( widget(), i18nc( "Application name", "Marble" ), i18n( "An error occurred while trying to save the file.\n" ), KMessageBox::Notify ); } } } void MarblePart::setShowBookmarks( bool show ) { m_controlView->marbleModel()->bookmarkManager()->setShowBookmarks( show ); m_toggleBookmarkDisplayAction->setChecked( show ); // Sync state with the GUI } void MarblePart::setShowClouds( bool isChecked ) { m_controlView->marbleWidget()->setShowClouds( isChecked ); m_showCloudsAction->setChecked( isChecked ); // Sync state with the GUI } void MarblePart::showPositionLabel( bool isChecked ) { m_positionLabel->setVisible( isChecked ); } void MarblePart::showAltitudeLabel( bool isChecked ) { m_distanceLabel->setVisible( isChecked ); } void MarblePart::showTileZoomLevelLabel( bool isChecked ) { m_tileZoomLevelLabel->setVisible( isChecked ); } void MarblePart::showDateTimeLabel( bool isChecked ) { m_clockLabel->setVisible( isChecked ); } void MarblePart::showDownloadProgressBar( bool isChecked ) { MarbleSettings::setShowDownloadProgressBar( isChecked ); // Change visibility only if there is a download happening m_downloadProgressBar->setVisible( isChecked && m_downloadProgressBar->value() >= 0 ); } void MarblePart::showFullScreen( bool isChecked ) { if ( QApplication::activeWindow() ) KToggleFullScreenAction::setFullScreen( QApplication::activeWindow(), isChecked ); m_fullScreenAct->setChecked( isChecked ); // Sync state with the GUI } void MarblePart::showStatusBar( bool isChecked ) { if ( !m_statusBarExtension->statusBar() ) return; m_statusBarExtension->statusBar()->setVisible( isChecked ); } void MarblePart::controlSun() { if ( !m_sunControlDialog ) { m_sunControlDialog = new SunControlWidget( m_controlView->marbleWidget(), m_controlView ); connect( m_sunControlDialog, SIGNAL(showSun(bool)), this, SLOT (showSun(bool)) ); connect( m_sunControlDialog, SIGNAL(showSun(bool)), m_showShadow, SLOT (setChecked(bool)) ); connect( m_sunControlDialog, SIGNAL(isLockedToSubSolarPoint(bool)), m_lockToSubSolarPoint, SLOT (setChecked(bool)) ); connect( m_sunControlDialog, SIGNAL(isSubSolarPointIconVisible(bool)), m_setSubSolarPointIconVisible, SLOT (setChecked(bool)) ); } m_sunControlDialog->show(); m_sunControlDialog->raise(); m_sunControlDialog->activateWindow(); } void MarblePart::controlTime() { if ( !m_timeControlDialog ) { m_timeControlDialog = new TimeControlWidget( m_controlView->marbleModel()->clock() ); } m_timeControlDialog->show(); m_timeControlDialog->raise(); m_timeControlDialog->activateWindow(); } void MarblePart::showSun( bool active ) { m_controlView->marbleWidget()->setShowSunShading( active ); m_sunControlDialog->setSunShading( active ); } void MarblePart::lockToSubSolarPoint( bool lock ) { m_controlView->marbleWidget()->setLockToSubSolarPoint( lock ); } void MarblePart::setSubSolarPointIconVisible( bool show ) { m_controlView->marbleWidget()->setSubSolarPointIconVisible( show ); } void MarblePart::workOffline( bool offline ) { m_controlView->setWorkOffline( offline ); m_newStuffAction->setEnabled( !offline ); m_downloadRegionAction->setEnabled( !offline ); } void MarblePart::copyMap() { QPixmap mapPixmap = m_controlView->mapScreenShot(); QClipboard *clipboard = QApplication::clipboard(); clipboard->setPixmap( mapPixmap ); } void MarblePart::copyCoordinates() { qreal lon = m_controlView->marbleWidget()->centerLongitude(); qreal lat = m_controlView->marbleWidget()->centerLatitude(); QString positionString = GeoDataCoordinates( lon, lat, 0.0, GeoDataCoordinates::Degree ).toString(); QClipboard *clipboard = QApplication::clipboard(); clipboard->setText( positionString ); } void MarblePart::readSettings() { qDebug() << "Start: MarblePart::readSettings()"; // Set home position m_controlView->marbleModel()->setHome( MarbleSettings::homeLongitude(), MarbleSettings::homeLatitude(), MarbleSettings::homeZoom() ); // Map theme and projection QString mapTheme = MarbleSettings::mapTheme(); if ( mapTheme.isEmpty() ) { mapTheme = m_controlView->defaultMapThemeId(); } m_controlView->marbleWidget()->setMapThemeId( mapTheme ); m_controlView->marbleWidget()->setProjection( (Projection) MarbleSettings::projection() ); m_controlView->marbleWidget()->setShowClouds( MarbleSettings::showClouds() ); m_showCloudsAction->setChecked( MarbleSettings::showClouds() ); workOffline( MarbleSettings::workOffline() ); m_workOfflineAction->setChecked( MarbleSettings::workOffline() ); m_lockFloatItemsAct->setChecked(MarbleSettings::lockFloatItemPositions()); lockFloatItemPosition(MarbleSettings::lockFloatItemPositions()); setShowBookmarks( MarbleSettings::showBookmarks() ); // Sun m_controlView->marbleWidget()->setShowSunShading( MarbleSettings::showSun() ); m_showShadow->setChecked( MarbleSettings::showSun() ); m_controlView->marbleWidget()->setShowCityLights( MarbleSettings::showCitylights() ); m_controlView->marbleWidget()->setSubSolarPointIconVisible( MarbleSettings::subSolarPointIconVisible() ); m_controlView->marbleWidget()->setLockToSubSolarPoint( MarbleSettings::lockToSubSolarPoint() ); m_setSubSolarPointIconVisible->setChecked( MarbleSettings::subSolarPointIconVisible() ); m_lockToSubSolarPoint->setChecked( MarbleSettings::lockToSubSolarPoint() ); // View - m_initialGraphicsSystem = (GraphicsSystem) MarbleSettings::graphicsSystem(); - m_previousGraphicsSystem = m_initialGraphicsSystem; - m_lastFileOpenPath = MarbleSettings::lastFileOpenDir(); // Tracking settings readTrackingSettings(); // Load previous route settings m_controlView->marbleModel()->routingManager()->readSettings(); bool const startupWarning = MarbleSettings::showGuidanceModeStartupWarning(); m_controlView->marbleModel()->routingManager()->setShowGuidanceModeStartupWarning( startupWarning ); KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(); if ( sharedConfig->hasGroup( "Routing Profiles" ) ) { QList profiles; KConfigGroup profilesGroup = sharedConfig->group( "Routing Profiles" ); int numProfiles = profilesGroup.readEntry( "Num", 0 ); for ( int i = 0; i < numProfiles; ++i ) { KConfigGroup profileGroup = profilesGroup.group( QString( "Profile %0" ).arg(i) ); QString name = profileGroup.readEntry( "Name", i18n( "Unnamed" ) ); RoutingProfile profile( name ); foreach ( const QString& pluginName, profileGroup.groupList() ) { KConfigGroup pluginGroup = profileGroup.group( pluginName ); profile.pluginSettings().insert( pluginName, QHash() ); foreach ( const QString& key, pluginGroup.keyList() ) { if ( key != "Enabled" ) { profile.pluginSettings()[ pluginName ].insert( key, pluginGroup.readEntry( key ) ); } } } profiles << profile; } m_controlView->marbleModel()->routingManager()->profilesModel()->setProfiles( profiles ); } else { m_controlView->marbleModel()->routingManager()->profilesModel()->loadDefaultProfiles(); } int const profileIndex = MarbleSettings::currentRoutingProfile(); if ( profileIndex >= 0 && profileIndex < m_controlView->marbleModel()->routingManager()->profilesModel()->rowCount() ) { RoutingProfile profile = m_controlView->marbleModel()->routingManager()->profilesModel()->profiles().at( profileIndex ); m_controlView->marbleModel()->routingManager()->routeRequest()->setRoutingProfile( profile ); } PositionTracking *const tracking = m_controlView->marbleModel()->positionTracking(); tracking->readSettings(); QString positionProvider = MarbleSettings::activePositionTrackingPlugin(); if ( !positionProvider.isEmpty() ) { const PluginManager* pluginManager = m_controlView->marbleModel()->pluginManager(); foreach( const PositionProviderPlugin* plugin, pluginManager->positionProviderPlugins() ) { if ( plugin->nameId() == positionProvider ) { PositionProviderPlugin* instance = plugin->newInstance(); tracking->setPositionProviderPlugin( instance ); break; } } } readStatusBarSettings(); updateSettings(); // Time if( MarbleSettings::systemTime() == true ) { /* nothing to do */ } else if( MarbleSettings::lastSessionTime() == true ) { m_controlView->marbleModel()->setClockDateTime( MarbleSettings::dateTime() ); m_controlView->marbleModel()->setClockSpeed( MarbleSettings::speedSlider() ); } readPluginSettings(); m_controlView->setExternalMapEditor( m_externalEditorMapping[MarbleSettings::externalMapEditor()] ); CloudSyncManager* cloudSyncManager = m_controlView->cloudSyncManager(); cloudSyncManager->setOwncloudCredentials( MarbleSettings::owncloudServer(), MarbleSettings::owncloudUsername(), MarbleSettings::owncloudPassword()); cloudSyncManager->setSyncEnabled( MarbleSettings::enableSync() ); cloudSyncManager->routeSyncManager()->setRouteSyncEnabled( MarbleSettings::syncRoutes() ); cloudSyncManager->bookmarkSyncManager()->setBookmarkSyncEnabled( MarbleSettings::syncBookmarks() ); } void MarblePart::readTrackingSettings() { if( MarbleSettings::autoCenter() || MarbleSettings::recenterMode() ) { CurrentLocationWidget *trackingWidget = m_controlView->currentLocationWidget(); if( trackingWidget ) { trackingWidget->setRecenterMode( MarbleSettings::recenterMode() ); trackingWidget->setAutoZoom( MarbleSettings::autoZoom() ); trackingWidget->setTrackVisible( MarbleSettings::trackVisible() ); trackingWidget->setLastOpenPath( MarbleSettings::lastTrackOpenPath() ); trackingWidget->setLastSavePath( MarbleSettings::lastTrackSavePath() ); } } } void MarblePart::readStatusBarSettings() { const bool showPos = MarbleSettings::showPositionLabel(); m_showPositionAction->setChecked( showPos ); showPositionLabel( showPos ); const bool showAlt = MarbleSettings::showAltitudeLabel(); m_showAltitudeAction->setChecked( showAlt ); showAltitudeLabel( showAlt ); const bool showTileZoom = MarbleSettings::showTileZoomLevelLabel(); m_showTileZoomLevelAction->setChecked( showTileZoom ); showTileZoomLevelLabel( showTileZoom ); const bool showDateTime = MarbleSettings::showDateTimeLabel(); m_showDateTimeAction->setChecked( showDateTime ); showDateTimeLabel( showDateTime ); const bool showProgress = MarbleSettings::showDownloadProgressBar(); m_showDownloadProgressAction->setChecked( showProgress ); showDownloadProgressBar( showProgress ); } void MarblePart::writeSettings() { // Get the 'quit' values from the widget and store them in the settings. qreal quitLon = m_controlView->marbleWidget()->lookAt().longitude(); qreal quitLat = m_controlView->marbleWidget()->lookAt().latitude(); qreal quitRange = m_controlView->marbleWidget()->lookAt().range(); MarbleSettings::setQuitLongitude( quitLon ); MarbleSettings::setQuitLatitude( quitLat ); MarbleSettings::setQuitRange( quitRange ); // Get the 'home' values from the widget and store them in the settings. qreal homeLon = 0; qreal homeLat = 0; int homeZoom = 0; m_controlView->marbleModel()->home( homeLon, homeLat, homeZoom ); MarbleSettings::setHomeLongitude( homeLon ); MarbleSettings::setHomeLatitude( homeLat ); MarbleSettings::setHomeZoom( homeZoom ); // Set default font MarbleSettings::setMapFont( m_controlView->marbleWidget()->defaultFont() ); // Get whether animations to the target are enabled MarbleSettings::setAnimateTargetVoyage( m_controlView->marbleWidget()->animationsEnabled() ); // Map theme and projection MarbleSettings::setMapTheme( m_controlView->marbleWidget()->mapThemeId() ); MarbleSettings::setProjection( m_controlView->marbleWidget()->projection() ); MarbleSettings::setShowClouds( m_controlView->marbleWidget()->showClouds() ); MarbleSettings::setWorkOffline( m_workOfflineAction->isChecked() ); MarbleSettings::setStillQuality( m_controlView->marbleWidget()->mapQuality( Still ) ); MarbleSettings::setAnimationQuality( m_controlView->marbleWidget()-> mapQuality( Animation ) ); MarbleSettings::setShowBookmarks( m_controlView->marbleModel()->bookmarkManager()->showBookmarks() ); - // FIXME: Hopefully Qt will have a getter for this one in the future ... - GraphicsSystem graphicsSystem = (GraphicsSystem) MarbleSettings::graphicsSystem(); - MarbleSettings::setGraphicsSystem( graphicsSystem ); - MarbleSettings::setLastFileOpenDir( m_lastFileOpenPath ); MarbleSettings::setDistanceUnit( MarbleGlobal::getInstance()->locale()->measurementSystem() ); MarbleSettings::setAngleUnit( m_controlView->marbleWidget()->defaultAngleUnit() ); // Sun MarbleSettings::setShowSun( m_controlView->marbleWidget()->showSunShading() ); MarbleSettings::setShowCitylights( m_controlView->marbleWidget()->showCityLights() ); MarbleSettings::setLockToSubSolarPoint( m_controlView->marbleWidget()->isLockedToSubSolarPoint() ); MarbleSettings::setSubSolarPointIconVisible( m_controlView->marbleWidget()->isSubSolarPointIconVisible() ); // Tracking CurrentLocationWidget *trackingWidget = m_controlView->currentLocationWidget(); if( trackingWidget ) { MarbleSettings::setRecenterMode( trackingWidget->recenterMode() ); MarbleSettings::setAutoZoom( trackingWidget->autoZoom() ); MarbleSettings::setTrackVisible( trackingWidget->trackVisible() ); MarbleSettings::setLastTrackOpenPath( trackingWidget->lastOpenPath() ); MarbleSettings::setLastTrackSavePath( trackingWidget->lastSavePath() ); } // Caches MarbleSettings::setVolatileTileCacheLimit( m_controlView->marbleWidget()-> volatileTileCacheLimit() / 1024 ); MarbleSettings::setPersistentTileCacheLimit( m_controlView->marbleModel()-> persistentTileCacheLimit() / 1024 ); // Time MarbleSettings::setDateTime( m_controlView->marbleModel()->clockDateTime() ); MarbleSettings::setSpeedSlider( m_controlView->marbleModel()->clockSpeed() ); // Plugins writePluginSettings(); QString positionProvider; PositionTracking* tracking = m_controlView->marbleModel()->positionTracking(); tracking->writeSettings(); if ( tracking->positionProviderPlugin() ) { positionProvider = tracking->positionProviderPlugin()->nameId(); } MarbleSettings::setActivePositionTrackingPlugin( positionProvider ); MarbleSettings::setLockFloatItemPositions( m_lockFloatItemsAct->isChecked() ); writeStatusBarSettings(); // Store recent files KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(); m_recentFilesAction->saveEntries( sharedConfig->group( "RecentFiles" ) ); // Store current route settings RoutingManager *routingManager = m_controlView->marbleWidget()->model()->routingManager(); routingManager->writeSettings(); bool const startupWarning = routingManager->showGuidanceModeStartupWarning(); MarbleSettings::setShowGuidanceModeStartupWarning( startupWarning ); QList profiles = routingManager->profilesModel()->profiles(); RoutingProfile const profile = routingManager->routeRequest()->routingProfile(); MarbleSettings::setCurrentRoutingProfile( profiles.indexOf( profile ) ); QList const editors = m_externalEditorMapping.values(); MarbleSettings::setExternalMapEditor( editors.indexOf( m_controlView->externalMapEditor() ) ); applyPluginState(); MarbleSettings::self()->save(); } void MarblePart::writeStatusBarSettings() { MarbleSettings::setShowPositionLabel( m_showPositionAction->isChecked() ); MarbleSettings::setShowAltitudeLabel( m_showAltitudeAction->isChecked() ); MarbleSettings::setShowTileZoomLevelLabel( m_showTileZoomLevelAction->isChecked() ); MarbleSettings::setShowDateTimeLabel( m_showDateTimeAction->isChecked() ); MarbleSettings::setShowDownloadProgressBar( m_showDownloadProgressAction->isChecked() ); } void MarblePart::setupActions() { // Action: Recent Files m_recentFilesAction = KStandardAction::openRecent( this, SLOT(openUrl(QUrl)), actionCollection() ); KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(); m_recentFilesAction->loadEntries( sharedConfig->group( "RecentFiles" ) ); // Action: Download Region m_downloadRegionAction = new QAction( this ); m_downloadRegionAction->setText( i18nc( "Action for downloading an entire region of a map", "Download Region..." )); actionCollection()->addAction( "file_download_region", m_downloadRegionAction ); connect( m_downloadRegionAction, SIGNAL(triggered()), SLOT(showDownloadRegionDialog())); // Action: Print Map m_printMapAction = KStandardAction::print( this, SLOT(printMapScreenShot()), actionCollection() ); m_printPreviewAction = KStandardAction::printPreview( m_controlView, SLOT(printPreview()), actionCollection() ); // Action: Export Map m_exportMapAction = new QAction( this ); actionCollection()->addAction( "exportMap", m_exportMapAction ); m_exportMapAction->setText( i18nc( "Action for saving the map to a file", "&Export Map..." ) ); m_exportMapAction->setIcon( QIcon::fromTheme( "document-save-as" ) ); actionCollection()->setDefaultShortcut( m_exportMapAction, Qt::CTRL + Qt::Key_S ); connect( m_exportMapAction, SIGNAL(triggered(bool)), this, SLOT(exportMapScreenShot()) ); // Action: Work Offline m_workOfflineAction = new QAction( this ); actionCollection()->addAction( "workOffline", m_workOfflineAction ); m_workOfflineAction->setText( i18nc( "Action for toggling offline mode", "&Work Offline" ) ); m_workOfflineAction->setIcon( QIcon::fromTheme( "user-offline" ) ); m_workOfflineAction->setCheckable( true ); m_workOfflineAction->setChecked( false ); connect( m_workOfflineAction, SIGNAL(triggered(bool)), this, SLOT(workOffline(bool)) ); // Action: Copy Map to the Clipboard m_copyMapAction = KStandardAction::copy( this, SLOT(copyMap()), actionCollection() ); m_copyMapAction->setText( i18nc( "Action for copying the map to the clipboard", "&Copy Map" ) ); // Action: Copy Coordinates string m_copyCoordinatesAction = new QAction( this ); actionCollection()->addAction( "edit_copy_coordinates", m_copyCoordinatesAction ); m_copyCoordinatesAction->setText( i18nc( "Action for copying the coordinates to the clipboard", "C&opy Coordinates" ) ); m_copyCoordinatesAction->setIcon( QIcon( ":/icons/copy-coordinates.png" ) ); connect( m_copyCoordinatesAction, SIGNAL(triggered(bool)), this, SLOT(copyCoordinates()) ); // Action: Open a Gpx or a Kml File m_openAct = KStandardAction::open( this, SLOT(openFile()), actionCollection() ); m_openAct->setText( i18nc( "Action for opening a file", "&Open..." ) ); // Standard actions. So far only Quit. KStandardAction::quit( qApp, SLOT(closeAllWindows()), actionCollection() ); // Action: Get hot new stuff m_newStuffAction = KNS3::standardAction( i18nc( "Action for downloading maps (GHNS)", "Download Maps..."), this, SLOT(showNewStuffDialog()), actionCollection(), "new_stuff" ); m_newStuffAction->setStatusTip( i18nc( "Status tip", "Download new maps")); actionCollection()->setDefaultShortcut( m_newStuffAction, Qt::CTRL + Qt::Key_N ); // Action: Create a New Map m_mapWizardAct = new QAction( i18nc( "Action for creating new maps", "&Create a New Map..." ), this ); m_mapWizardAct->setIcon( QIcon( ":/icons/create-new-map.png" ) ); actionCollection()->addAction( "createMap", m_mapWizardAct ); m_mapWizardAct->setStatusTip( i18nc( "Status tip", "A wizard guides you through the creation of your own map theme." ) ); connect( m_mapWizardAct, SIGNAL(triggered()), SLOT(showMapWizard()) ); KStandardAction::showStatusbar( this, SLOT(showStatusBar(bool)), actionCollection() ); m_fullScreenAct = KStandardAction::fullScreen( 0, 0, widget(), actionCollection() ); connect( m_fullScreenAct, SIGNAL(triggered(bool)), this, SLOT(showFullScreen(bool)) ); // Action: Show Crosshairs option QList pluginList = m_controlView->marbleWidget()->renderPlugins(); QList::const_iterator i = pluginList.constBegin(); QList::const_iterator const end = pluginList.constEnd(); for (; i != end; ++i ) { if ( (*i)->nameId() == "crosshairs" ) { actionCollection()->addAction( "show_crosshairs", (*i)->action() ); } } // Action: Show Clouds option m_showCloudsAction = new QAction( this ); actionCollection()->addAction( "show_clouds", m_showCloudsAction ); m_showCloudsAction->setCheckable( true ); m_showCloudsAction->setChecked( true ); m_showCloudsAction->setIcon( QIcon( ":/icons/clouds.png" ) ); m_showCloudsAction->setText( i18nc( "Action for toggling clouds", "&Clouds" ) ); connect( m_showCloudsAction, SIGNAL(triggered(bool)), this, SLOT(setShowClouds(bool)) ); // Action: Show Sunshade options m_controlSunAction = new QAction( this ); actionCollection()->addAction( "control_sun", m_controlSunAction ); m_controlSunAction->setText( i18nc( "Action for sun control dialog", "S&un Control..." ) ); connect( m_controlSunAction, SIGNAL(triggered(bool)), this, SLOT(controlSun()) ); KStandardAction::redisplay( m_controlView->marbleWidget(), SLOT(reloadMap()), actionCollection() ); // Action: Show Time options m_controlTimeAction = new QAction( this ); actionCollection()->addAction( "control_time", m_controlTimeAction ); m_controlTimeAction->setIcon( QIcon( ":/icons/clock.png" ) ); m_controlTimeAction->setText( i18nc( "Action for time control dialog", "&Time Control..." ) ); connect( m_controlTimeAction, SIGNAL(triggered(bool)), this, SLOT(controlTime()) ); // Action: Lock float items m_lockFloatItemsAct = new QAction ( this ); actionCollection()->addAction( "options_lock_floatitems", m_lockFloatItemsAct ); m_lockFloatItemsAct->setText( i18nc( "Action for locking float items on the map", "Lock Position" ) ); m_lockFloatItemsAct->setIcon( QIcon( ":/icons/unlock.png" ) ); m_lockFloatItemsAct->setCheckable( true ); m_lockFloatItemsAct->setChecked( false ); connect( m_lockFloatItemsAct, SIGNAL(triggered(bool)), this, SLOT(lockFloatItemPosition(bool)) ); KStandardAction::preferences( this, SLOT(editSettings()), actionCollection() ); //Toggle Action: Show sun shadow m_showShadow = new KToggleAction( i18n( "Show Shadow" ), this ); m_showShadow->setIcon( QIcon( "" ) ); // Fixme: Add Icon actionCollection()->addAction( "sun_shadow", m_showShadow ); m_showShadow->setCheckedState( KGuiItem( i18n( "Hide Shadow" ) ) ); m_showShadow->setToolTip(i18n("Shows and hides the shadow of the sun")); connect( m_showShadow, SIGNAL(triggered(bool)), this, SLOT(showSun(bool))); //Toggle Action: Show Sun icon on the Sub-Solar Point m_setSubSolarPointIconVisible = new KToggleAction( i18n( "Show sun icon on the Sub-Solar Point" ), this ); actionCollection()->addAction( "show_icon_on_subsolarpoint", m_setSubSolarPointIconVisible ); m_setSubSolarPointIconVisible->setCheckedState( KGuiItem( i18n( "Hide sun icon on the Sub-Solar Point" ) ) ); m_setSubSolarPointIconVisible->setToolTip( i18n( "Show sun icon on the sub-solar point" ) ); connect( m_setSubSolarPointIconVisible, SIGNAL(triggered(bool)), this, SLOT(setSubSolarPointIconVisible(bool))); //Toggle Action: Lock globe to the Sub-Solar Point m_lockToSubSolarPoint = new KToggleAction( i18n( "Lock Globe to the Sub-Solar Point" ), this ); actionCollection()->addAction( "lock_to_subsolarpoint", m_lockToSubSolarPoint ); m_lockToSubSolarPoint->setCheckedState( KGuiItem( i18n( "Unlock Globe to the Sub-Solar Point" ) ) ); m_lockToSubSolarPoint->setToolTip( i18n( "Lock globe to the sub-solar point" ) ); connect( m_lockToSubSolarPoint, SIGNAL(triggered(bool)), this, SLOT(lockToSubSolarPoint(bool))); // FIXME: Discuss if this is the best place to put this QList::const_iterator it = pluginList.constBegin(); QList::const_iterator const itEnd = pluginList.constEnd(); for (; it != itEnd; ++it ) { if ((*it)->nameId() != "annotation") { connect( (*it), SIGNAL(actionGroupsChanged()), this, SLOT(createPluginMenus()) ); } } m_addBookmarkAction = new QAction( this ); actionCollection()->addAction( "add_bookmark", m_addBookmarkAction ); m_addBookmarkAction->setText( i18nc( "Add Bookmark", "&Add Bookmark" ) ); m_addBookmarkAction->setIcon( QIcon( ":/icons/bookmark-new.png" ) ); actionCollection()->setDefaultShortcut( m_addBookmarkAction, Qt::CTRL + Qt::Key_B ); connect( m_addBookmarkAction, SIGNAL(triggered()), this, SLOT(openEditBookmarkDialog()) ); m_toggleBookmarkDisplayAction = new QAction( this ); actionCollection()->addAction( "show_bookmarks", m_toggleBookmarkDisplayAction ); m_toggleBookmarkDisplayAction->setText( i18nc( "Show Bookmarks", "Show &Bookmarks" ) ); m_toggleBookmarkDisplayAction->setStatusTip( i18n( "Show or hide bookmarks in the map" ) ); m_toggleBookmarkDisplayAction->setCheckable( true ); m_toggleBookmarkDisplayAction->setChecked( m_controlView->marbleModel()->bookmarkManager()->showBookmarks() ); connect( m_toggleBookmarkDisplayAction, SIGNAL(toggled(bool)), m_controlView->marbleModel()->bookmarkManager(), SLOT(setShowBookmarks(bool)) ); m_setHomeAction = new QAction( this ); actionCollection()->addAction( "set_home", m_setHomeAction ); m_setHomeAction->setText( i18n( "&Set Home Location" ) ); m_setHomeAction->setIcon( QIcon::fromTheme( "go-home" ) ); connect( m_setHomeAction, SIGNAL(triggered()), this, SLOT(setHome()) ); m_manageBookmarksAction = new QAction( this ); actionCollection()->addAction( "manage_bookmarks", m_manageBookmarksAction ); m_manageBookmarksAction->setText( i18nc( "Manage Bookmarks", "&Manage Bookmarks" ) ); m_manageBookmarksAction->setIcon( QIcon( ":/icons/bookmarks-organize.png" ) ); connect( m_manageBookmarksAction, SIGNAL(triggered()), this, SLOT(openManageBookmarksDialog()) ); createFolderList(); connect( m_controlView->marbleModel()->bookmarkManager(), SIGNAL(bookmarksChanged()), this, SLOT(createFolderList()) ); m_externalMapEditorAction = new QAction( this ); actionCollection()->addAction( "external_editor", m_externalMapEditorAction ); m_externalMapEditorAction->setText( i18nc( "Edit the map in an external application", "&Edit Map" ) ); m_externalMapEditorAction->setIcon( QIcon( ":/icons/edit-map.png" ) ); actionCollection()->setDefaultShortcut( m_externalMapEditorAction, Qt::CTRL + Qt::Key_E ); connect( m_externalMapEditorAction, SIGNAL(triggered()), m_controlView, SLOT(launchExternalMapEditor()) ); connect( m_controlView->marbleWidget(), SIGNAL(themeChanged(QString)), this, SLOT(updateMapEditButtonVisibility(QString)) ); m_recordMovieAction = new QAction( i18n( "&Record Movie" ), this ); actionCollection()->addAction( "record_movie" , m_recordMovieAction ); m_recordMovieAction->setStatusTip( i18n( "Records a movie of the globe" ) ); actionCollection()->setDefaultShortcut( m_recordMovieAction, Qt::CTRL + Qt::SHIFT + Qt::Key_R ); m_recordMovieAction->setIcon( QIcon( ":/icons/animator.png" ) ); connect( m_recordMovieAction, SIGNAL(triggered()), this, SLOT(showMovieCaptureDialog()) ); m_stopRecordingAction = new QAction( i18n( "&Stop recording" ), this ); actionCollection()->addAction( "stop_recording" , m_stopRecordingAction ); m_stopRecordingAction->setStatusTip( i18n( "Stop recording a movie of the globe" ) ); actionCollection()->setDefaultShortcut( m_recordMovieAction, Qt::CTRL + Qt::SHIFT + Qt::Key_S ); m_stopRecordingAction->setEnabled( false ); connect( m_stopRecordingAction, SIGNAL(triggered()), this, SLOT(stopRecording()) ); } void MarblePart::createFolderList() { QList actionList; QVector folders = m_controlView->marbleModel()->bookmarkManager()->folders(); QVector::const_iterator i = folders.constBegin(); QVector::const_iterator end = folders.constEnd(); for (; i != end; ++i ) { QMenu *m_bookmarksListMenu = new QMenu( (*i)->name() ); createBookmarksListMenu( m_bookmarksListMenu, *(*i) ); connect( m_bookmarksListMenu, SIGNAL(triggered(QAction*)), this, SLOT(lookAtBookmark(QAction*)) ); actionList.append( m_bookmarksListMenu->menuAction() ); } unplugActionList("folders"); plugActionList( "folders", actionList ); } void MarblePart::createBookmarksListMenu( QMenu *m_bookmarksListMenu, const GeoDataFolder &folder ) { m_bookmarksListMenu->clear(); QVector bookmarks = folder.placemarkList(); QVector::const_iterator i = bookmarks.constBegin(); QVector::const_iterator end = bookmarks.constEnd(); for (; i != end; ++i ) { QAction *bookmarkAct = new QAction( (*i)->name(), this ); QVariant var; GeoDataLookAt* lookAt = (*i)->lookAt(); if ( !lookAt ) { GeoDataLookAt coordinateToLookAt; coordinateToLookAt.setCoordinates( (*i)->coordinate() ); coordinateToLookAt.setRange( (*i)->coordinate().altitude() ); } else { var.setValue( *lookAt ); } bookmarkAct->setData( var ); m_bookmarksListMenu->addAction( bookmarkAct ); } } void MarblePart::createInfoBoxesMenu() { QList floatItemList = m_controlView->marbleWidget()->floatItems(); QList actionList; QList::const_iterator i = floatItemList.constBegin(); QList::const_iterator const end = floatItemList.constEnd(); for (; i != end; ++i ) { actionList.append( (*i)->action() ); } unplugActionList( "infobox_actionlist" ); plugActionList( "infobox_actionlist", actionList ); } void MarblePart::createOnlineServicesMenu() { QList renderPluginList = m_controlView->marbleWidget()->renderPlugins(); QList actionList; QList::const_iterator i = renderPluginList.constBegin(); QList::const_iterator const end = renderPluginList.constEnd(); for (; i != end; ++i ) { // FIXME: This will go into the layer manager when AbstractDataPlugin is an interface if( (*i)->renderType() == RenderPlugin::OnlineRenderType ) { actionList.append( (*i)->action() ); } } unplugActionList( "onlineservices_actionlist" ); plugActionList( "onlineservices_actionlist", actionList ); } void MarblePart::createRenderPluginActions() { QList renderPluginList = m_controlView->marbleWidget()->renderPlugins(); QList actionList; QList::const_iterator i = renderPluginList.constBegin(); QList::const_iterator const end = renderPluginList.constEnd(); for (; i != end; ++i ) { if( (*i)->renderType() == RenderPlugin::ThemeRenderType ) { actionList.append( (*i)->action() ); } } unplugActionList( "themerender_actionlist" ); plugActionList( "themerender_actionlist", actionList ); } void MarblePart::showDateTime() { m_clock = QLocale().toString( m_controlView->marbleModel()->clockDateTime().addSecs( m_controlView->marbleModel()->clockTimezone() ), QLocale::ShortFormat ); updateStatusBar(); } void MarblePart::showPosition( const QString& position ) { m_position = position; updateStatusBar(); } void MarblePart::showZoomLevel( const int tileLevel ) { if ( tileLevel == -1 ) m_tileZoomLevel = QCoreApplication::translate( "Marble", NOT_AVAILABLE ); else { m_tileZoomLevel.setNum( tileLevel ); } updateStatusBar(); } void MarblePart::mapThemeChanged( const QString& newMapTheme ) { Q_UNUSED( newMapTheme ); updateTileZoomLevel(); updateStatusBar(); } void MarblePart::createPluginMenus() { unplugActionList("plugins_actionlist"); unplugActionList("plugins_menuactionlist"); QList renderPluginList = m_controlView->marbleWidget()->renderPlugins(); QList::const_iterator i = renderPluginList.constBegin(); QList::const_iterator const end = renderPluginList.constEnd(); for (; i != end; ++i ) { // menus const QList *tmp_actionGroups = (*i)->actionGroups(); if( (*i)->enabled() && tmp_actionGroups ) { foreach( QActionGroup *ag, *tmp_actionGroups ) { plugActionList( "plugins_menuactionlist", ag->actions() ); } } // toolbars const QList *tmp_toolbarActionGroups = (*i)->toolbarActionGroups(); if ( (*i)->enabled() && tmp_toolbarActionGroups ) { foreach( QActionGroup* ag, *tmp_toolbarActionGroups ) { plugActionList( "plugins_actionlist", ag->actions() ); } } } } void MarblePart::updateTileZoomLevel() { const int tileZoomLevel = m_controlView->marbleWidget()->tileZoomLevel(); if ( tileZoomLevel == -1 ) m_tileZoomLevel = QCoreApplication::translate( "Marble", NOT_AVAILABLE ); else { m_tileZoomLevel.setNum( tileZoomLevel ); } } void MarblePart::migrateNewstuffConfigFiles() const { // Newstuff config files used to be in the KDE data directory of the user, but are now // shared between Marble KDE and Marble Qt in Marble's data path of the user. // This method moves an old KDE newstuff config file to the new location if the former // exists and the latter not. QFileInfo const target( MarbleDirs::localPath() + "/newstuff/marble-map-themes.knsregistry" ); if ( !target.exists() ) { QString const source = QStandardPaths::locate( QStandardPaths::GenericDataLocation, "knewstuff3/marble.knsregistry" ); if ( !source.isEmpty() ) { if ( !target.absoluteDir().exists() ) { if ( !QDir::root().mkpath( target.absolutePath() ) ) { mDebug() << "Failed to create target directory " << target.absolutePath() << " needed for newstuff migration"; return; } } QFile registryFile( source ); if ( !registryFile.open( QFile::ReadOnly ) ) { mDebug() << "Cannot parse newstuff xml file"; return; } QDomDocument xml; if ( !xml.setContent( registryFile.readAll() ) ) { mDebug() << "Cannot parse newstuff xml data"; return; } QDomNodeList items = xml.elementsByTagName( "stuff" ); for ( int i = 0; i < items.length(); ++i ) { repairNode( items.item(i), QString("summary") ); repairNode( items.item(i), QString("author") ); } QFile output( target.absoluteFilePath() ); if ( !output.open( QFile::WriteOnly ) ) { mDebug() << "Cannot open " << target.absoluteFilePath() << " for writing"; } else { QTextStream outStream( &output ); outStream << xml.toString( 2 ); outStream.flush(); output.close(); } } } } void MarblePart::repairNode( QDomNode node, const QString &child ) { int const size = node.namedItem( child ).toElement().text().size(); if ( size > 1024 ) { QString const theme = node.namedItem( "name" ).toElement().text(); mDebug() << "Removing GHNS field " << child << " of map theme " << theme << ": Size " << size << " exceeds maximum size (see bug 319542)."; node.removeChild( node.namedItem( child ) ); } } void MarblePart::updateCloudSyncStatus(const QString& status ) { m_ui_cloudSyncSettings.cloudSyncStatus->setText(status); switch (m_controlView->cloudSyncManager()->status()){ case CloudSyncManager::Success: m_ui_cloudSyncSettings.cloudSyncStatus->setStyleSheet("QLabel { color : green; }"); break; case CloudSyncManager::Error: m_ui_cloudSyncSettings.cloudSyncStatus->setStyleSheet("QLabel { color : red; }"); break; case CloudSyncManager::Unknown: m_ui_cloudSyncSettings.cloudSyncStatus->setStyleSheet("QLabel { color : grey; }"); break; } } void MarblePart::updateCloudSyncCredentials() { m_controlView->cloudSyncManager()->setOwncloudCredentials( m_ui_cloudSyncSettings.kcfg_owncloudServer->text(), m_ui_cloudSyncSettings.kcfg_owncloudUsername->text(), m_ui_cloudSyncSettings.kcfg_owncloudPassword->text() ); } void MarblePart::updateStatusBar() { if ( m_positionLabel ) m_positionLabel->setText( i18n( POSITION_STRING, m_position ) ); if ( m_distanceLabel ) m_distanceLabel->setText( i18n( DISTANCE_STRING, m_controlView->marbleWidget()->distanceString() ) ); if ( m_tileZoomLevelLabel ) m_tileZoomLevelLabel->setText( i18n( TILEZOOMLEVEL_STRING, m_tileZoomLevel ) ); if ( m_clockLabel ) m_clockLabel->setText( i18n( DATETIME_STRING, m_clock ) ); } void MarblePart::setupStatusBar() { QFontMetrics statusBarFontMetrics( m_statusBarExtension->statusBar()->fontMetrics() ); // UTM syntax is used in the template string, as it is longer than the lon/lat one QString templatePositionString = QString( "%1 00Z 000000.00 m E, 00000000.00 m N_" ).arg(POSITION_STRING); m_positionLabel = setupStatusBarLabel( templatePositionString ); QString templateDistanceString = QString( "%1 00.000,0 mu" ).arg(DISTANCE_STRING); m_distanceLabel = setupStatusBarLabel( templateDistanceString ); QString templateDateTimeString = QString( "%1 %2" ).arg( DATETIME_STRING , QLocale().toString( QDateTime::fromString ( "01:01:1000", "dd:mm:yyyy"), QLocale::ShortFormat ) ); m_clockLabel = setupStatusBarLabel( templateDateTimeString ); const QString templateTileZoomLevelString = i18n( TILEZOOMLEVEL_STRING, m_tileZoomLevel ); m_tileZoomLevelLabel = setupStatusBarLabel( templateTileZoomLevelString ); connect( m_controlView->marbleWidget(), SIGNAL(mouseMoveGeoPosition(QString)), this, SLOT(showPosition(QString)) ); connect( m_controlView->marbleWidget(), SIGNAL(distanceChanged(QString)), this, SLOT(updateStatusBar()) ); connect( m_controlView->marbleWidget(), SIGNAL(tileLevelChanged(int)), SLOT(showZoomLevel(int))); connect( m_controlView->marbleWidget(), SIGNAL(themeChanged(QString)), this, SLOT(mapThemeChanged(QString)), Qt::QueuedConnection ); connect( m_controlView->marbleModel()->clock(), SIGNAL(timeChanged()), this, SLOT(showDateTime()) ); setupDownloadProgressBar(); setupStatusBarActions(); updateStatusBar(); } QLabel * MarblePart::setupStatusBarLabel( const QString& templateString ) { QFontMetrics statusBarFontMetrics( m_statusBarExtension->statusBar()->fontMetrics() ); QLabel * const label = new QLabel( m_statusBarExtension->statusBar() ); label->setIndent( 5 ); int maxWidth = statusBarFontMetrics.boundingRect( templateString ).width() + 2 * label->margin() + 2 * label->indent(); label->setFixedWidth( maxWidth ); m_statusBarExtension->addStatusBarItem( label, -1, false ); return label; } void MarblePart::setupDownloadProgressBar() { // get status bar and add progress widget QStatusBar * const statusBar = m_statusBarExtension->statusBar(); Q_ASSERT( statusBar ); m_downloadProgressBar = new QProgressBar; m_downloadProgressBar->setVisible( MarbleSettings::showDownloadProgressBar() ); statusBar->addPermanentWidget( m_downloadProgressBar ); HttpDownloadManager * const downloadManager = m_controlView->marbleModel()->downloadManager(); Q_ASSERT( downloadManager ); connect( downloadManager, SIGNAL(progressChanged(int,int)), SLOT(handleProgress(int,int)) ); connect( downloadManager, SIGNAL(jobRemoved()), SLOT(removeProgressItem()) ); } void MarblePart::setupStatusBarActions() { QStatusBar * const statusBar = m_statusBarExtension->statusBar(); Q_ASSERT( statusBar ); statusBar->setContextMenuPolicy( Qt::CustomContextMenu ); connect( statusBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showStatusBarContextMenu(QPoint))); m_showPositionAction = new KToggleAction( i18nc( "Action for toggling", "Show Position" ), this ); m_showDateTimeAction = new KToggleAction( i18nc( "Action for toggling", "Show Date and Time" ), this ); m_showAltitudeAction = new KToggleAction( i18nc( "Action for toggling", "Show Altitude" ), this ); m_showTileZoomLevelAction = new KToggleAction( i18nc( "Action for toggling", "Show Tile Zoom Level" ), this ); m_showDownloadProgressAction = new KToggleAction( i18nc( "Action for toggling", "Show Download Progress Bar" ), this ); connect( m_showPositionAction, SIGNAL(triggered(bool)), this, SLOT(showPositionLabel(bool)) ); connect( m_showAltitudeAction, SIGNAL(triggered(bool)), this, SLOT(showAltitudeLabel(bool)) ); connect( m_showTileZoomLevelAction, SIGNAL(triggered(bool)), this, SLOT(showTileZoomLevelLabel(bool)) ); connect( m_showDateTimeAction, SIGNAL(triggered(bool)), this, SLOT(showDateTimeLabel(bool)) ); connect( m_showDownloadProgressAction, SIGNAL(triggered(bool)), this, SLOT(showDownloadProgressBar(bool)) ); } void MarblePart::showNewStuffDialog() { QPointer dialog( new MapThemeDownloadDialog( m_controlView->marbleWidget() ) ); dialog->exec(); delete dialog; } void MarblePart::showUploadNewStuffDialog() { QString newStuffConfig = QStandardPaths::locate( QStandardPaths::GenericDataLocation, "marble/marble.knsrc" ); qDebug() << "KNS config file:" << newStuffConfig; QPointer dialog( new KNS3::UploadDialog( newStuffConfig, m_controlView ) ); qDebug() << "Creating the archive"; dialog->setUploadFile( QUrl( MapWizard::createArchive( m_controlView, m_controlView->marbleWidget()->mapThemeId() ) ) ); dialog->exec(); MapWizard::deleteArchive( m_controlView->marbleWidget()->mapThemeId() ); delete dialog; } void MarblePart::showDownloadRegionDialog() { MarbleWidget * const marbleWidget = m_controlView->marbleWidget(); if ( !m_downloadRegionDialog ) { m_downloadRegionDialog = new DownloadRegionDialog( marbleWidget, widget() ); // it might be tempting to move the connects to DownloadRegionDialog's "accepted" and // "applied" signals, be aware that the "hidden" signal might be come before the "accepted" // signal, leading to a too early disconnect. connect( m_downloadRegionDialog, SIGNAL(accepted()), SLOT(downloadRegion())); connect( m_downloadRegionDialog, SIGNAL(applied()), SLOT(downloadRegion())); } // FIXME: get allowed range from current map theme m_downloadRegionDialog->setAllowedTileLevelRange( 0, 16 ); m_downloadRegionDialog->setSelectionMethod( DownloadRegionDialog::VisibleRegionMethod ); ViewportParams const * const viewport = marbleWidget->viewport(); m_downloadRegionDialog->setSpecifiedLatLonAltBox( viewport->viewLatLonAltBox() ); m_downloadRegionDialog->setVisibleLatLonAltBox( viewport->viewLatLonAltBox() ); m_downloadRegionDialog->setVisibleTileLevel( marbleWidget->tileZoomLevel() ); m_downloadRegionDialog->show(); m_downloadRegionDialog->raise(); m_downloadRegionDialog->activateWindow(); } void MarblePart::downloadRegion() { Q_ASSERT( m_downloadRegionDialog ); QVector const pyramid = m_downloadRegionDialog->region(); if ( !pyramid.isEmpty() ) { m_controlView->marbleWidget()->downloadRegion( pyramid ); } } void MarblePart::showStatusBarContextMenu( const QPoint& pos ) { QStatusBar * const statusBar = m_statusBarExtension->statusBar(); Q_ASSERT( statusBar ); QMenu statusBarContextMenu( m_controlView->marbleWidget() ); statusBarContextMenu.addAction( m_showPositionAction ); statusBarContextMenu.addAction( m_showDateTimeAction ); statusBarContextMenu.addAction( m_showAltitudeAction ); statusBarContextMenu.addAction( m_showTileZoomLevelAction ); statusBarContextMenu.addAction( m_showDownloadProgressAction ); statusBarContextMenu.exec( statusBar->mapToGlobal( pos )); } void MarblePart::showMapWizard() { // Map Wizard QPointer mapWizard = new MapWizard( m_controlView ); mapWizard->setWmsServers( MarbleSettings::wmsServers() ); mapWizard->setStaticUrlServers( MarbleSettings::staticUrlServers() ); mapWizard->exec(); MarbleSettings::setWmsServers( mapWizard->wmsServers() ); MarbleSettings::setStaticUrlServers( mapWizard->staticUrlServers() ); mapWizard->deleteLater(); } void MarblePart::editSettings() { if ( KConfigDialog::showDialog( "settings" ) ) return; m_configDialog = new KConfigDialog( m_controlView, "settings", MarbleSettings::self() ); // view page Ui_MarbleViewSettingsWidget ui_viewSettings; QWidget *w_viewSettings = new QWidget( 0 ); w_viewSettings->setObjectName( "view_page" ); ui_viewSettings.setupUi( w_viewSettings ); m_configDialog->addPage( w_viewSettings, i18n( "View" ), "configure" ); - // It's experimental -- so we remove it for now. - // FIXME: Delete the following line once OpenGL support is officially supported. - ui_viewSettings.kcfg_graphicsSystem->removeItem( OpenGLGraphics ); - - QString nativeString ( i18n("Native") ); - - #ifdef Q_WS_X11 - nativeString = i18n( "Native (X11)" ); - #endif - #ifdef Q_OS_MAC - nativeString = i18n( "Native (Mac OS X Core Graphics)" ); - #endif - - ui_viewSettings.kcfg_graphicsSystem->setItemText( NativeGraphics, nativeString ); ui_viewSettings.label_labelLocalization->hide(); ui_viewSettings.kcfg_labelLocalization->hide(); // navigation page Ui_MarbleNavigationSettingsWidget ui_navigationSettings; QWidget *w_navigationSettings = new QWidget( 0 ); w_navigationSettings->setObjectName( "navigation_page" ); ui_navigationSettings.setupUi( w_navigationSettings ); m_configDialog->addPage( w_navigationSettings, i18n( "Navigation" ), "transform-move" ); ui_navigationSettings.kcfg_dragLocation->hide(); ui_navigationSettings.label_dragLocation->hide(); // cache page Ui_MarbleCacheSettingsWidget ui_cacheSettings; QWidget *w_cacheSettings = new QWidget( 0 ); w_cacheSettings->setObjectName( "cache_page" ); ui_cacheSettings.setupUi( w_cacheSettings ); m_configDialog->addPage( w_cacheSettings, i18n( "Cache & Proxy" ), "preferences-web-browser-cache" ); connect( ui_cacheSettings.button_clearVolatileCache, SIGNAL(clicked()), m_controlView->marbleWidget(), SLOT(clearVolatileTileCache()) ); connect( ui_cacheSettings.button_clearPersistentCache, SIGNAL(clicked()), m_controlView->marbleModel(), SLOT(clearPersistentTileCache()) ); // time page Ui_MarbleTimeSettingsWidget ui_timeSettings; QWidget *w_timeSettings = new QWidget( 0 ); w_timeSettings->setObjectName( "time_page" ); ui_timeSettings.setupUi( w_timeSettings ); m_configDialog->addPage( w_timeSettings, i18n( "Date & Time" ), "clock" ); // Sync page QWidget *w_cloudSyncSettings = new QWidget( 0 ); w_cloudSyncSettings->setObjectName( "sync_page" ); m_ui_cloudSyncSettings.setupUi( w_cloudSyncSettings ); m_ui_cloudSyncSettings.button_syncNow->setEnabled( MarbleSettings::syncBookmarks() ); m_configDialog->addPage( w_cloudSyncSettings, i18n( "Synchronization" ), "folder-sync" ); connect( m_ui_cloudSyncSettings.button_syncNow, SIGNAL(clicked()), m_controlView->cloudSyncManager()->bookmarkSyncManager(), SLOT(startBookmarkSync()) ); connect( m_ui_cloudSyncSettings.testLoginButton, SIGNAL(clicked()), this, SLOT(updateCloudSyncCredentials()) ); connect( m_controlView->cloudSyncManager(), SIGNAL(statusChanged(QString)), this, SLOT(updateCloudSyncStatus(QString))); // routing page RoutingProfilesWidget *w_routingSettings = new RoutingProfilesWidget( m_controlView->marbleModel() ); w_routingSettings->setObjectName( "routing_page" ); m_configDialog->addPage( w_routingSettings, i18n( "Routing" ), "flag"); // plugin page MarblePluginSettingsWidget *w_pluginSettings = new MarblePluginSettingsWidget(); RenderPluginModel *const pluginModel = new RenderPluginModel( w_pluginSettings ); pluginModel->setRenderPlugins( m_controlView->marbleWidget()->renderPlugins() ); w_pluginSettings->setModel( pluginModel ); w_pluginSettings->setObjectName( "plugin_page" ); m_configDialog->addPage( w_pluginSettings, i18n( "Plugins" ), "preferences-plugin" ); // Setting the icons of the pluginSettings page. w_pluginSettings->setConfigIcon( QIcon::fromTheme( "configure" ) ); w_pluginSettings->setAboutIcon( QIcon::fromTheme( "help-about" ) ); connect( w_pluginSettings, SIGNAL(pluginListViewClicked()), SLOT(enableApplyButton()) ); connect( m_configDialog, SIGNAL(settingsChanged(QString)), SLOT(updateSettings()) ); connect( m_configDialog, SIGNAL(accepted()), SLOT(applyPluginState()) ); connect( m_configDialog, SIGNAL(accepted()), pluginModel, SLOT(applyPluginState()) ); connect( m_configDialog, SIGNAL(rejected()), pluginModel, SLOT(retrievePluginState()) ); m_configDialog->show(); } void MarblePart::enableApplyButton() { //m_configDialog->enableButtonApply( true ); } void MarblePart::applyPluginState() { QList profiles = m_controlView->marbleWidget() ->model()->routingManager()->profilesModel()->profiles(); KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(); KConfigGroup profilesGroup = sharedConfig->group( "Routing Profiles" ); profilesGroup.writeEntry( "Num", profiles.count() ); for ( int i = 0; i < profiles.count(); ++i ) { KConfigGroup profileGroup = profilesGroup.group( QString( "Profile %0" ).arg(i) ); RoutingProfile profile = profiles.at( i ); profileGroup.writeEntry( "Name", profile.name() ); foreach ( const QString &pluginName, profileGroup.groupList() ) { profileGroup.group( pluginName ).deleteGroup(); } foreach ( const QString &key, profile.pluginSettings().keys() ) { KConfigGroup pluginGroup = profileGroup.group( key ); pluginGroup.writeEntry( "Enabled", true ); foreach ( const QString& settingKey, profile.pluginSettings()[ key ].keys() ) { Q_ASSERT( settingKey != "Enabled" ); pluginGroup.writeEntry( settingKey, profile.pluginSettings()[ key ][ settingKey ] ); } } } } void MarblePart::updateSettings() { qDebug() << "Updating Settings ..."; // FIXME: Font doesn't get updated instantly. m_controlView->marbleWidget()->setDefaultFont( MarbleSettings::mapFont() ); m_controlView->marbleWidget()-> setMapQualityForViewContext( (MapQuality) MarbleSettings::stillQuality(), Still ); m_controlView->marbleWidget()-> setMapQualityForViewContext( (MapQuality) MarbleSettings::animationQuality(), Animation ); - GraphicsSystem graphicsSystem = (GraphicsSystem) MarbleSettings::graphicsSystem(); - m_controlView->marbleWidget()-> setDefaultAngleUnit( (AngleUnit) MarbleSettings::angleUnit() ); MarbleGlobal::getInstance()->locale()-> setMeasurementSystem( (MarbleLocale::MeasurementSystem) MarbleSettings::distanceUnit() ); updateStatusBar(); m_controlView->marbleWidget()->setAnimationsEnabled( MarbleSettings::animateTargetVoyage() ); // Cache m_controlView->marbleModel()-> setPersistentTileCacheLimit( MarbleSettings::persistentTileCacheLimit() * 1024 ); m_controlView->marbleWidget()-> setVolatileTileCacheLimit( MarbleSettings::volatileTileCacheLimit() * 1024 ); //Create and export the proxy QNetworkProxy proxy; // Make sure that no proxy is used for an empty string or the default value: if ( MarbleSettings::proxyUrl().isEmpty() || MarbleSettings::proxyUrl() == "http://" ) { proxy.setType( QNetworkProxy::NoProxy ); } else { if ( MarbleSettings::proxyType() == Marble::Socks5Proxy ) { proxy.setType( QNetworkProxy::Socks5Proxy ); } else if ( MarbleSettings::proxyType() == Marble::HttpProxy ) { proxy.setType( QNetworkProxy::HttpProxy ); } else { qDebug() << "Unknown proxy type! Using Http Proxy instead."; proxy.setType( QNetworkProxy::HttpProxy ); } } proxy.setHostName( MarbleSettings::proxyUrl() ); proxy.setPort( MarbleSettings::proxyPort() ); if ( MarbleSettings::proxyAuth() ) { proxy.setUser( MarbleSettings::proxyUser() ); proxy.setPassword( MarbleSettings::proxyPass() ); } QNetworkProxy::setApplicationProxy(proxy); m_controlView->marbleWidget()->update(); - // Show message box - if ( m_initialGraphicsSystem != graphicsSystem - && m_previousGraphicsSystem != graphicsSystem ) { - KMessageBox::information (m_controlView->marbleWidget(), - i18n("You have decided to run Marble with a different graphics system.\n" - "For this change to become effective, Marble has to be restarted.\n" - "Please close the application and start Marble again."), - i18n("Graphics System Change") ); - } - m_previousGraphicsSystem = graphicsSystem; - // Time if( MarbleSettings::systemTimezone() == true ) { QDateTime localTime = QDateTime::currentDateTime().toLocalTime(); localTime.setTimeSpec( Qt::UTC ); m_controlView->marbleModel()->setClockTimezone( QDateTime::currentDateTime().toUTC().secsTo( localTime ) ); } else if( MarbleSettings::utc() == true ) { m_controlView->marbleModel()->setClockTimezone( 0 ); } else if( MarbleSettings::customTimezone() == true ) { m_controlView->marbleModel()->setClockTimezone( m_timezone.value( MarbleSettings::chosenTimezone() ) ); } // Route rendering colors and alpha values QColor tempColor; tempColor = MarbleSettings::routeColorStandard(); tempColor.setAlpha( MarbleSettings::routeAlphaStandard() ); m_controlView->marbleModel()->routingManager()->setRouteColorStandard( tempColor ); tempColor = MarbleSettings::routeColorHighlighted(); tempColor.setAlpha( MarbleSettings::routeAlphaHighlighted() ); m_controlView->marbleModel()->routingManager()->setRouteColorHighlighted( tempColor ); tempColor = MarbleSettings::routeColorAlternative(); tempColor.setAlpha( MarbleSettings::routeAlphaAlternative() ); m_controlView->marbleModel()->routingManager()->setRouteColorAlternative( tempColor ); // External map editor m_controlView->setExternalMapEditor( m_externalEditorMapping[MarbleSettings::externalMapEditor()] ); m_controlView->marbleWidget()->inputHandler()->setInertialEarthRotationEnabled( MarbleSettings::inertialEarthRotation() ); CloudSyncManager* cloudSyncManager = m_controlView->cloudSyncManager(); cloudSyncManager->setOwncloudCredentials( MarbleSettings::owncloudServer(), MarbleSettings::owncloudUsername(), MarbleSettings::owncloudPassword()); cloudSyncManager->setSyncEnabled( MarbleSettings::enableSync() ); cloudSyncManager->routeSyncManager()->setRouteSyncEnabled( MarbleSettings::syncRoutes() ); cloudSyncManager->bookmarkSyncManager()->setBookmarkSyncEnabled( MarbleSettings::syncBookmarks() ); } void MarblePart::writePluginSettings() { KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(); foreach( RenderPlugin *plugin, m_controlView->marbleWidget()->renderPlugins() ) { KConfigGroup group = sharedConfig->group( QString( "plugin_" ) + plugin->nameId() ); const QHash hash = plugin->settings(); QHash::const_iterator it = hash.begin(); while( it != hash.end() ) { group.writeEntry( it.key(), it.value() ); ++it; } group.sync(); } } void MarblePart::readPluginSettings() { disconnect( m_controlView->marbleWidget(), SIGNAL(pluginSettingsChanged()), this, SLOT(writePluginSettings()) ); KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(); foreach( RenderPlugin *plugin, m_controlView->marbleWidget()->renderPlugins() ) { KConfigGroup group = sharedConfig->group( QString( "plugin_" ) + plugin->nameId() ); QHash hash; foreach ( const QString& key, group.keyList() ) { hash.insert( key, group.readEntry( key ) ); } plugin->setSettings( hash ); } connect( m_controlView->marbleWidget(), SIGNAL(pluginSettingsChanged()), this, SLOT(writePluginSettings()) ); } void MarblePart::lockFloatItemPosition( bool enabled ) { QList floatItemList = m_controlView->marbleWidget()->floatItems(); QList::const_iterator i = floatItemList.constBegin(); QList::const_iterator const end = floatItemList.constEnd(); for (; i != end; ++i ) { // Locking one would suffice as it affects all. // Nevertheless go through all. (*i)->setPositionLocked(enabled); } } void MarblePart::handleProgress( int active, int queued ) { m_downloadProgressBar->setUpdatesEnabled( false ); if ( m_downloadProgressBar->value() < 0 ) { m_downloadProgressBar->setMaximum( 1 ); m_downloadProgressBar->setValue( 0 ); m_downloadProgressBar->setVisible( MarbleSettings::showDownloadProgressBar() ); } else { m_downloadProgressBar->setMaximum( qMax( m_downloadProgressBar->maximum(), active + queued ) ); } // qDebug() << "downloadProgressJobAdded: value/maximum: " // << m_downloadProgressBar->value() << '/' << m_downloadProgressBar->maximum(); m_downloadProgressBar->setUpdatesEnabled( true ); } void MarblePart::removeProgressItem() { m_downloadProgressBar->setUpdatesEnabled( false ); m_downloadProgressBar->setValue( m_downloadProgressBar->value() + 1 ); if ( m_downloadProgressBar->value() == m_downloadProgressBar->maximum() ) { m_downloadProgressBar->reset(); m_downloadProgressBar->setVisible( false ); } // qDebug() << "downloadProgressJobCompleted: value/maximum: " // << m_downloadProgressBar->value() << '/' << m_downloadProgressBar->maximum(); m_downloadProgressBar->setUpdatesEnabled( true ); } void MarblePart::openEditBookmarkDialog() { MarbleWidget *widget = m_controlView->marbleWidget(); QPointer dialog = new EditBookmarkDialog( widget->model()->bookmarkManager(), widget ); dialog->setCoordinates( widget->lookAt().coordinates() ); dialog->setRange( widget->lookAt().range() ); dialog->setMarbleWidget( widget ); dialog->setReverseGeocodeName(); if ( dialog->exec() == QDialog::Accepted ) { widget->model()->bookmarkManager()->addBookmark( dialog->folder(), dialog->bookmark() ); } delete dialog; } void MarblePart::setHome() { MarbleWidget *widget = m_controlView->marbleWidget(); widget->model()->setHome( widget->centerLongitude(), widget->centerLatitude(), widget->zoom() ); } void MarblePart::openManageBookmarksDialog() { MarbleModel * const model = m_controlView->marbleModel(); QPointer dialog = new BookmarkManagerDialog( model, m_controlView->marbleWidget() ); dialog->exec(); delete dialog; } void MarblePart::lookAtBookmark( QAction *action) { GeoDataLookAt temp = qvariant_cast( action->data() ) ; m_controlView->marbleWidget()->flyTo( temp ) ; mDebug() << " looking at bookmark having longitude : "<< temp.longitude(GeoDataCoordinates::Degree) << " latitude : "<< temp.latitude(GeoDataCoordinates::Degree) << " distance : " << temp.range(); } void MarblePart::initializeCustomTimezone() { if( m_timezone.count() == 0) { m_timezone.insert( 0, 0 ); m_timezone.insert( 1, 3600 ); m_timezone.insert( 2, 7200 ); m_timezone.insert( 3, 7200 ); m_timezone.insert( 4, 10800 ); m_timezone.insert( 5, 12600 ); m_timezone.insert( 6, 14400 ); m_timezone.insert( 7, 18000 ); m_timezone.insert( 8, 19800 ); m_timezone.insert( 9, 21600 ); m_timezone.insert( 10, 25200 ); m_timezone.insert( 11, 28800 ); m_timezone.insert( 12, 32400 ); m_timezone.insert( 13, 34200 ); m_timezone.insert( 14, 36000 ); m_timezone.insert( 15, 39600 ); m_timezone.insert( 16, 43200 ); m_timezone.insert( 17, -39600 ); m_timezone.insert( 18, -36000 ); m_timezone.insert( 19, -32400 ); m_timezone.insert( 20, -28800 ); m_timezone.insert( 21, -25200 ); m_timezone.insert( 22, -25200 ); m_timezone.insert( 23, -21600 ); m_timezone.insert( 24, -18000 ); m_timezone.insert( 25, -18000 ); m_timezone.insert( 26, -14400 ); m_timezone.insert( 27, -12600 ); m_timezone.insert( 28, -10800 ); m_timezone.insert( 29, -10800 ); m_timezone.insert( 30, -3600 ); } } void MarblePart::printMapScreenShot() { #ifndef QT_NO_PRINTER QPrinter printer( QPrinter::HighResolution ); QPointer printDialog = new QPrintDialog( &printer, widget() ); m_controlView->printMapScreenShot( printDialog ); delete printDialog; #endif } void MarblePart::updateMapEditButtonVisibility( const QString &mapTheme ) { Q_ASSERT( m_externalMapEditorAction ); m_externalMapEditorAction->setVisible( mapTheme == "earth/openstreetmap/openstreetmap.dgml" ); } void MarblePart::fallBackToDefaultTheme() { m_controlView->marbleWidget()->setMapThemeId( m_controlView->defaultMapThemeId() ); } void MarblePart::showMovieCaptureDialog() { if (m_movieCaptureDialog == 0) { m_movieCaptureDialog = new MovieCaptureDialog(m_controlView->marbleWidget(), m_controlView->marbleWidget()); connect( m_movieCaptureDialog, SIGNAL(started()), this, SLOT(changeRecordingState())); } m_movieCaptureDialog->show(); } void MarblePart::stopRecording() { if ( m_movieCaptureDialog ) { m_movieCaptureDialog->stopRecording(); changeRecordingState(); } } void MarblePart::changeRecordingState() { m_recordMovieAction->setEnabled( !m_recordMovieAction->isEnabled() ); m_stopRecordingAction->setEnabled( !m_stopRecordingAction->isEnabled() ); } } #include "moc_marble_part.cpp" #include "marble_part.moc" diff --git a/src/apps/marble-kde/marble_part.h b/src/apps/marble-kde/marble_part.h index ca9a91014..5f2576d16 100644 --- a/src/apps/marble-kde/marble_part.h +++ b/src/apps/marble-kde/marble_part.h @@ -1,275 +1,271 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2007 Tobias Koenig // Copyright 2008 Inge Wallin // Copyright 2009 Jens-Michael Hoffmann // Copyright 2010 Harshit Jain // #ifndef MARBLE_MARBLEPART_H #define MARBLE_MARBLEPART_H #include #include #include #include "MarbleGlobal.h" #include "cloudsync/CloudSyncManager.h" #include #include #include "ui_MarbleCloudSyncSettingsWidget.h" class KAboutData; class QAction; class KToggleAction; class KConfigDialog; class KToolBar; class QLabel; class QPrinter; class QProgressBar; class QStandardItemModel; namespace KParts { class StatusBarExtension; } namespace Marble { class MovieCaptureDialog; class ControlView; class DownloadRegionDialog; class RoutingProfilesWidget; class SunControlWidget; class TimeControlWidget; class GeoDataFolder; class MarblePart: public KParts::ReadOnlyPart { Q_OBJECT public: MarblePart( QWidget *parentWidget, QObject *parent, const QVariantList& ); virtual ~MarblePart(); ControlView *controlView() const; static KAboutData* createAboutData(); void createInfoBoxesMenu(); void createOnlineServicesMenu(); void createRenderPluginActions(); void readTrackingSettings(); void initializeCustomTimezone(); public Q_SLOTS: bool openUrl( const QUrl &url ); bool openFile(); void showPosition( const QString& position); void showZoomLevel( const int ); void showDateTime(); void mapThemeChanged( const QString& newMapTheme ); void createPluginMenus(); void createFolderList(); void fallBackToDefaultTheme(); private Q_SLOTS: void exportMapScreenShot(); void printMapScreenShot(); void copyMap(); void copyCoordinates(); void setShowClouds( bool ); void setShowBookmarks( bool isChecked ); void showFullScreen( bool ); void showStatusBar( bool ); void changeRecordingState(); /** * @brief Show the dateTime label in the status bar. * This slot is connected with the "triggered" signal of * m_showDateTimeAction. */ void showDateTimeLabel( bool isChecked ); /** * @brief Show the position label in the status bar. * This slot is connected with the "triggered" signal of * m_showPositionAction. */ void showPositionLabel( bool isChecked ); /** * @brief Show the altitude label in the status bar. * This slot is connected with the "triggered" signal of * m_showAltitudeAction. */ void showAltitudeLabel( bool isChecked ); /** * @brief Show the tile zoom level label in the status bar. * This slot is connected with the "triggered" signal of * m_showTileZoomLevelAction. */ void showTileZoomLevelLabel( bool isChecked ); /** * @brief Show the download progress bar in the status bar. * This slot is connected with the "triggered" signal of * m_showDownloadProgressAction. */ void showDownloadProgressBar( bool isChecked ); void handleProgress( int active, int queued); void removeProgressItem(); void lockFloatItemPosition( bool ); void controlSun(); void controlTime(); void showSun( bool ); void lockToSubSolarPoint( bool ); void setSubSolarPointIconVisible( bool ); void workOffline( bool ); void setupStatusBar(); void showNewStuffDialog(); void showUploadNewStuffDialog(); void showDownloadRegionDialog(); void downloadRegion(); void showStatusBarContextMenu( const QPoint& pos ); void showMapWizard(); void editSettings(); void enableApplyButton(); void applyPluginState(); void updateSettings(); void updateStatusBar(); void updateCloudSyncStatus(const QString &status); /** * Saves the settings of all plugins. */ void writePluginSettings(); /** * Reads the settings of all plugins. */ void readPluginSettings(); //Bookmark Menu void openEditBookmarkDialog(); void setHome(); void openManageBookmarksDialog(); void createBookmarksListMenu( QMenu *, const GeoDataFolder& ); void lookAtBookmark( QAction * ); // void createBookmarkMenu(); void updateMapEditButtonVisibility( const QString &mapTheme ); void showMovieCaptureDialog(); void stopRecording(); void updateCloudSyncCredentials(); private: void setupActions(); void setupDownloadProgressBar(); void setupStatusBarActions(); QLabel * setupStatusBarLabel( const QString& templateString ); void readSettings(); void readStatusBarSettings(); void writeSettings(); void writeStatusBarSettings(); /** Only updates member variable m_tileZoomLevel, does not trigger screen update. */ void updateTileZoomLevel(); void migrateNewstuffConfigFiles() const; static void repairNode( QDomNode node, const QString &child ); private: // All the functionality is provided by this widget. ControlView *m_controlView; // MarbleControlBox and MarbleWidget SunControlWidget *m_sunControlDialog; TimeControlWidget *m_timeControlDialog; DownloadRegionDialog *m_downloadRegionDialog; MovieCaptureDialog *m_movieCaptureDialog; // Actions for the GUI. QAction *m_exportMapAction; QAction *m_printMapAction; QAction *m_printPreviewAction; QAction *m_workOfflineAction; QAction *m_copyMapAction; QAction *m_copyCoordinatesAction; QAction *m_showCloudsAction; QAction *m_fullScreenAct; QAction *m_openAct; QAction *m_newStuffAction; QAction *m_downloadRegionAction; QAction *m_controlSunAction; QAction *m_controlTimeAction; QAction *m_lockFloatItemsAct; QAction *m_mapWizardAct; QAction *m_externalMapEditorAction; QAction *m_recordMovieAction; QAction *m_stopRecordingAction; KRecentFilesAction *m_recentFilesAction; //Bookmark Menu QAction *m_addBookmarkAction; QAction *m_toggleBookmarkDisplayAction; QAction *m_setHomeAction; QAction *m_manageBookmarksAction; // Actions for the status bar QAction *m_showPositionAction; QAction *m_showDateTimeAction; QAction *m_showAltitudeAction; QAction *m_showTileZoomLevelAction; QAction *m_showDownloadProgressAction; // Action for the tool bar KToggleAction *m_showShadow; KToggleAction *m_lockToSubSolarPoint; KToggleAction *m_setSubSolarPointIconVisible; KConfigDialog *m_configDialog; QHash m_pluginEnabled; QString m_position; QString m_clock; QString m_tileZoomLevel; QString m_lastFileOpenPath; // Items for the statusbar. QLabel *m_positionLabel; QLabel *m_clockLabel; QLabel *m_distanceLabel; QLabel *m_tileZoomLevelLabel; QProgressBar *m_downloadProgressBar; KParts::StatusBarExtension *m_statusBarExtension; - // Information about the graphics system - GraphicsSystem m_initialGraphicsSystem; - GraphicsSystem m_previousGraphicsSystem; - QHash< int, int > m_timezone; QMap m_externalEditorMapping; Ui_MarbleCloudSyncSettingsWidget m_ui_cloudSyncSettings; }; } #endif diff --git a/src/bindings/python/sip/MarbleGlobal.sip b/src/bindings/python/sip/MarbleGlobal.sip index c42c721b5..afa7131a2 100644 --- a/src/bindings/python/sip/MarbleGlobal.sip +++ b/src/bindings/python/sip/MarbleGlobal.sip @@ -1,195 +1,187 @@ // // Copyright 2008 Simon Edwards // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library. If not, see . // %ModuleHeaderCode #include %End namespace Marble { enum TessellationFlag { NoTessellation, Tessellate, RespectLatitudeCircle, FollowGround, RotationIndicatesFill, SkipLatLonNormalization }; typedef QFlags TessellationFlags; enum Projection { Spherical, Equirectangular, Mercator }; enum Dimension { Latitude, Longitude }; typedef QFlags Dimensions; enum AngleUnit { DMSDegree, DecimalDegree, UTM, MGRS }; enum ViewContext { Still, Animation }; enum MapQuality { OutlineQuality, LowQuality, NormalQuality, HighQuality, PrintQuality }; -enum GraphicsSystem -{ - NativeGraphics, - RasterGraphics, - OpenGLGraphics -}; - - enum LabelPositionFlag { NoLabel, LineStart, LineCenter, LineEnd, IgnoreXMargin, IgnoreYMargin }; typedef QFlags LabelPositionFlags; enum LabelLocalization { CustomAndNative, Custom, Native }; enum DragLocation { KeepAxisVertically, FollowMousePointer }; enum OnStartup { ShowHomeLocation, LastLocationVisited }; enum AltitudeMode { ClampToGround, RelativeToGround, Absolute }; enum Pole { AnyPole, NorthPole, SouthPole }; class MarbleGlobal { %TypeHeaderCode #include %End public: static Marble::MarbleGlobal* getInstance (); private: MarbleGlobal (); public: ~MarbleGlobal (); //ig MarbleLocale* locale () const; enum Profile { Default, SmallScreen, HighResolution }; typedef QFlags Profiles; Marble::MarbleGlobal::Profiles profiles () const; void setProfiles (Marble::MarbleGlobal::Profiles profiles); static Marble::MarbleGlobal::Profiles detectProfiles (); }; // MarbleGlobal enum ProxyType { HttpProxy, Socks5Proxy }; enum DownloadUsage { DownloadBulk, DownloadBrowse }; enum FlyToMode { Automatic, Instant, Linear, Jump }; enum SearchMode { GlobalSearch, AreaSearch }; }; // Marble diff --git a/src/bindings/python/sip/QtMarbleConfigDialog.sip b/src/bindings/python/sip/QtMarbleConfigDialog.sip index befd09ac5..b93f49260 100644 --- a/src/bindings/python/sip/QtMarbleConfigDialog.sip +++ b/src/bindings/python/sip/QtMarbleConfigDialog.sip @@ -1,66 +1,65 @@ // Copyright 2009 Simon Edwards // Generated by twine2 // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as // published by the Free Software Foundation; either version 2, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details // You should have received a copy of the GNU Library General Public // License along with this program; if not, write to the // Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace Marble { class QtMarbleConfigDialog : QDialog { %TypeHeaderCode #include %End public: explicit QtMarbleConfigDialog (Marble::MarbleWidget* marbleWidget, QWidget* parent /TransferThis/ = 0); ~QtMarbleConfigDialog (); Marble::AngleUnit angleUnit () const; Marble::MapQuality stillQuality () const; Marble::MapQuality animationQuality () const; int labelLocalization () const; QFont mapFont () const; - Marble::GraphicsSystem graphicsSystem () const; int dragLocation () const; int onStartup () const; bool animateTargetVoyage () const; int volatileTileCacheLimit () const; int persistentTileCacheLimit () const; QString proxyUrl () const; int proxyPort () const; QString proxyUser () const; QString proxyPass () const; bool proxyType () const; bool proxyAuth () const; signals: void settingsChanged (); void clearVolatileCacheClicked (); void clearPersistentCacheClicked (); public: void readSettings (); void writeSettings (); QString externalMapEditor () const; bool systemTime () const; bool lastSessionTime () const; bool systemTimezone () const; bool UTC () const; bool customTimezone () const; int chosenTimezone () const; void initializeCustomTimezone (); QLocale::MeasurementSystem measurementSystem () const; bool inertialEarthRotation () const; }; }; diff --git a/src/bindings/python/sip/global.sip b/src/bindings/python/sip/global.sip index 3c6bb0786..4ce5c2fcc 100644 --- a/src/bindings/python/sip/global.sip +++ b/src/bindings/python/sip/global.sip @@ -1,189 +1,181 @@ // // Copyright 2008 Simon Edwards // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library. If not, see . // %ModuleHeaderCode #include %End namespace Marble { enum TessellationFlag { NoTessellation, Tessellate, RespectLatitudeCircle, FollowGround, RotationIndicatesFill, SkipLatLonNormalization }; typedef QFlags TessellationFlags; enum Projection { Spherical, Equirectangular, Mercator }; enum Dimension { Latitude, Longitude }; typedef QFlags Dimensions; enum AngleUnit { DMSDegree, DecimalDegree, UTM }; enum ViewContext { Still, Animation }; enum MapQuality { OutlineQuality, LowQuality, NormalQuality, HighQuality, PrintQuality }; -enum GraphicsSystem -{ - NativeGraphics, - RasterGraphics, - OpenGLGraphics -}; - - enum LabelPositionFlag { NoLabel, LineStart, LineCenter, LineEnd, IgnoreXMargin, IgnoreYMargin }; typedef QFlags LabelPositionFlags; enum LabelLocalization { CustomAndNative, Custom, Native }; enum DragLocation { KeepAxisVertically, FollowMousePointer }; enum OnStartup { ShowHomeLocation, LastLocationVisited }; enum AltitudeMode { ClampToGround, RelativeToGround, Absolute }; enum Pole { AnyPole, NorthPole, SouthPole }; class MarbleGlobal { %TypeHeaderCode #include %End public: static Marble::MarbleGlobal* getInstance (); private: MarbleGlobal (); public: ~MarbleGlobal (); //ig MarbleLocale* locale () const; enum Profile { Default, SmallScreen, HighResolution }; typedef QFlags Profiles; Marble::MarbleGlobal::Profiles profiles () const; void setProfiles (Marble::MarbleGlobal::Profiles profiles); static Marble::MarbleGlobal::Profiles detectProfiles (); }; // MarbleGlobal enum ProxyType { HttpProxy, Socks5Proxy }; enum DownloadUsage { DownloadBulk, DownloadBrowse }; enum FlyToMode { Automatic, Instant, Linear, Jump }; }; // Marble diff --git a/src/lib/marble/MarbleGlobal.h b/src/lib/marble/MarbleGlobal.h index b7a569554..3c186c568 100644 --- a/src/lib/marble/MarbleGlobal.h +++ b/src/lib/marble/MarbleGlobal.h @@ -1,322 +1,313 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2007-2009 Torsten Rahn // Copyright 2007 Inge Wallin // #ifndef MARBLE_GLOBAL_H #define MARBLE_GLOBAL_H #include #include #include "marble_export.h" #include "MarbleColors.h" // #define QT_STRICT_ITERATORS namespace Marble { enum TessellationFlag { NoTessellation = 0x0, Tessellate = 0x1, RespectLatitudeCircle = 0x2, FollowGround = 0x4, RotationIndicatesFill = 0x8, SkipLatLonNormalization = 0x10 }; Q_DECLARE_FLAGS(TessellationFlags, TessellationFlag) /** * @brief This enum is used to choose the projection shown in the view. */ enum Projection { Spherical, ///< Spherical projection ("Orthographic") Equirectangular, ///< Flat projection ("plate carree") Mercator, ///< Mercator projection Gnomonic, ///< Gnomonic projection Stereographic, ///< Stereographic projection LambertAzimuthal, ///< Lambert Azimuthal Equal-Area projection AzimuthalEquidistant, ///< Azimuthal Equidistant projection VerticalPerspective ///< Vertical perspective projection // NOTE: MarbleWidget::setProjection(int) relies on VerticalPerspective being the last // value above. Adjust that method if you do changes here }; /** * @brief This enum is used to choose the dimension. */ enum Dimension { Latitude, ///< Latitude Longitude ///< Longitude }; Q_DECLARE_FLAGS(Dimensions, Dimension) /** * @brief This enum is used to choose the unit chosen to measure angles. */ enum AngleUnit { DMSDegree, ///< Degrees in DMS notation DecimalDegree, ///< Degrees in decimal notation UTM ///< UTM }; /** * @brief This enum is used to choose context in which map quality gets used. */ enum ViewContext { Still, ///< still image Animation ///< animated view (e.g. while rotating the globe) }; /** * @brief This enum is used to choose the map quality shown in the view. */ enum MapQuality { OutlineQuality, ///< Only a wire representation is drawn LowQuality, ///< Low resolution (e.g. interlaced) NormalQuality, ///< Normal quality HighQuality, ///< High quality (e.g. antialiasing for lines) PrintQuality ///< Print quality }; -/** - * @brief This enum is used to choose which graphics system Qt is using. - */ -enum GraphicsSystem { - NativeGraphics, ///< Uses the native graphics system of the OS - RasterGraphics, ///< Renders everything onto a pixmap - OpenGLGraphics ///< Uses OpenGL -}; - /** * @brief This enum is used to specify the proxy that is used. */ enum ProxyType { HttpProxy, ///< Uses an Http proxy Socks5Proxy ///< Uses a Socks5Proxy }; /** * @brief This enum is used to choose the localization of the labels. */ enum LabelPositionFlag { NoLabel = 0x0, LineStart = 0x1, LineCenter = 0x2, LineEnd = 0x4, IgnoreXMargin = 0x8, IgnoreYMargin = 0x10, FollowLine = 0x20 }; Q_DECLARE_FLAGS(LabelPositionFlags, LabelPositionFlag) /** * @brief This enum is used to choose the localization of the labels. */ enum LabelLocalization { CustomAndNative, ///< Custom and native labels Custom, ///< Shows the name in the user's language Native ///< Display the name in the official language and /// glyphs of the labeled place. }; /** * @brief This enum is used to choose how the globe behaves while dragging. */ enum DragLocation { KeepAxisVertically, ///< Keep planet axis vertically FollowMousePointer ///< Follow mouse pointer exactly }; /** * @brief This enum is used to choose how the globe behaves while dragging. */ enum OnStartup { ShowHomeLocation, ///< Show home location on startup LastLocationVisited ///< Show last location visited on quit }; enum AltitudeMode { ClampToGround, ///< Altitude always sticks to ground level RelativeToGround, ///< Altitude is always given relative to ground level Absolute, ///< Altitude is given relative to the sealevel RelativeToSeaFloor, ///< Altitude is given relative to the sea floor ClampToSeaFloor ///< Altitude always sticks to sea floor }; enum Pole { AnyPole, ///< Any pole NorthPole, ///< Only North Pole SouthPole ///< Only South Pole }; /** * @brief This enum is used to describe the type of download */ enum DownloadUsage { DownloadBulk, ///< Bulk download, for example "File/Download region" DownloadBrowse ///< Browsing mode, normal operation of Marble, like a web browser }; /** * @brief Describes possible flight mode (interpolation between source * and target camera positions) */ enum FlyToMode { Automatic, ///< A sane value is chosen automatically depending on animation settings and the action Instant, ///< Change camera position immediately (no interpolation) Linear, ///< Linear interpolation of lon, lat and distance to ground Jump ///< Linear interpolation of lon and lat, distance increases towards the middle point, then decreases }; /** * @brief Search mode: Global (worldwide) versus area (local, regional) search */ enum SearchMode { GlobalSearch, ///< Search a whole planet AreaSearch ///< Search a certain region of a planet (e.g. visible region) }; /** * @brief */ enum RenderStatus { Complete, ///< All data is there and up to date WaitingForUpdate, ///< Rendering is based on complete, but outdated data, data update was requested WaitingForData, ///< Rendering is based on no or partial data, more data was requested (e.g. pending network queries) Incomplete ///< Data is missing and some error occurred when trying to retrieve it (e.g. network failure) }; const int defaultLevelZeroColumns = 2; const int defaultLevelZeroRows = 1; // Conversion Metric / Imperial System: km vs. miles const qreal MI2KM = 1.609344; const qreal KM2MI = 1.0 / MI2KM; // Conversion Nautical / Imperial System: nm vs. km const qreal NM2KM = 1.852; const qreal KM2NM = 1.0 / NM2KM; const qreal NM2FT = 6080; // nm feet // Conversion Metric / Imperial System: meter vs. feet const qreal M2FT = 3.2808; const qreal FT2M = 1.0 / M2FT; // Conversion Metric / Imperial System: meter vs inch const qreal M2IN = 39.3701; const qreal IN2M = 1.0 / M2IN; // Conversion Metric / Imperial System: meter vs yard const qreal M2YD = 1.09361; const qreal YD2M = 1.0 / M2YD; // Conversion meter vs millimeter const qreal M2MM = 1000.0; const qreal MM2M = 1.0 / M2MM; // Conversion meter vs centimeter const qreal M2CM = 100.0; const qreal CM2M = 1.0 / M2CM; // Conversion degree vs. radians const qreal DEG2RAD = M_PI / 180.0; const qreal RAD2DEG = 180.0 / M_PI; // Conversion meter vs kilometer const qreal KM2METER = 1000.0; const qreal METER2KM = 1.0 / KM2METER; //Conversion hour vs minute const qreal HOUR2MIN = 60.0; const qreal MIN2HOUR = 1.0 / HOUR2MIN; //Conversion (time) minute vs second const qreal MIN2SEC = 60.0; const qreal SEC2MIN = 1.0 / MIN2SEC; //Conversion hour vs second const qreal HOUR2SEC = 3600.0; const qreal SEC2HOUR = 1.0 / HOUR2SEC; // Version definitions to use with an external application (as digiKam) // String for about dialog and http user agent // FIXME: check if blanks are allowed in user agent version numbers const QString MARBLE_VERSION_STRING = QString::fromLatin1( "0.24.21 (0.25 development version)" ); // API Version id: // form : 0xMMmmpp // MM = major revision. // mm = minor revision. // pp = patch revision. #define MARBLE_VERSION 0x001815 static const char NOT_AVAILABLE[] = QT_TRANSLATE_NOOP("Marble", "not available"); const int tileDigits = 6; // Average earth radius in m // Deprecated: Please use model()->planetRadius() instead. const qreal EARTH_RADIUS = 6378137.0; // Maximum level of base tiles const int maxBaseTileLevel = 4; // Default size (width and height) of tiles const unsigned int c_defaultTileSize = 675; class MarbleGlobalPrivate; class MarbleLocale; class MARBLE_EXPORT MarbleGlobal { public: static MarbleGlobal * getInstance(); ~MarbleGlobal(); MarbleLocale * locale() const; enum Profile { Default = 0x0, SmallScreen = 0x1, HighResolution = 0x2 }; Q_DECLARE_FLAGS( Profiles, Profile ) Profiles profiles() const; void setProfiles( Profiles profiles ); /** * Automatically detects the profile. */ static Profiles detectProfiles(); private: MarbleGlobal(); Q_DISABLE_COPY( MarbleGlobal ) MarbleGlobalPrivate * const d; }; } Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::TessellationFlags ) Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::LabelPositionFlags ) Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::MarbleGlobal::Profiles ) #endif diff --git a/src/lib/marble/MarbleViewSettingsWidget.ui b/src/lib/marble/MarbleViewSettingsWidget.ui index 43e153e30..716ea2488 100644 --- a/src/lib/marble/MarbleViewSettingsWidget.ui +++ b/src/lib/marble/MarbleViewSettingsWidget.ui @@ -1,412 +1,379 @@ MarbleViewSettingsWidget 0 0 541 430 &Units 0 0 118 0 &Distance: kcfg_distanceUnit true 0 0 <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The unit that gets used to measure altitude, lengths and distances (e.g. km, mi, ft).</p></body></html> Kilometer, Meter Miles, Feet Nautical miles, Knots 0 0 An&gle: kcfg_angleUnit true <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specifies the notation of angles in coordinates: By default the Degree-Minute-Second notation (e.g. 54°30'00" ) gets used. As an alternative you can choose decimal degrees (e.g. 54.5°).</p></body></html> Degree (DMS) Degree (Decimal) Universal Transverse Mercator (UTM) Map &Quality 0 0 118 0 &Still image: kcfg_stillQuality <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specifies the map quality that gets displayed while there is no user input. Usually this allows for high map quality as speed is no concern.</p></body></html> 3 Outline Quality Low Quality Normal High Quality Print Quality 0 0 During &animations: kcfg_animationQuality <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specifies the map quality that gets displayed during map animations (e.g. while dragging the globe). </p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Especially on slow machines it is advisable to set this option to "low quality" as this will give better speed.</p></body></html> 2 Outline Quality Low Quality Normal High Quality Print Quality - - - - G&raphics system: - - - kcfg_graphicsSystem - - - - - - - Specifies the graphics system that Qt uses to draw the map. -Changing this setting might be a good idea if there are performance issues with the system's graphics drivers. - - - - Native - - - - - Raster (Software rendering) - - - - - OpenGL - - - - Qt::Vertical QSizePolicy::Fixed 20 5 &Text Labels 0 0 118 0 &Place names: kcfg_labelLocalization false <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Places often have different names in different languages. The label on the map can show the name in the user's language. Alternatively it can display the name in the official language and glyphs of that place. </p></body></html> Custom & Native Language Custom Language Native Language 0 0 118 0 Default map &font: kcfg_mapFont <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The default font that gets used on the map.</p></body></html> Qt::Vertical 446 20 diff --git a/src/lib/marble/QtMarbleConfigDialog.cpp b/src/lib/marble/QtMarbleConfigDialog.cpp index 121338c85..2fbc675dd 100644 --- a/src/lib/marble/QtMarbleConfigDialog.cpp +++ b/src/lib/marble/QtMarbleConfigDialog.cpp @@ -1,723 +1,661 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Bastian Holst // Copyright 2012 Mohammed Nafees // // Own #include "QtMarbleConfigDialog.h" #include "ui_MarbleCacheSettingsWidget.h" #include "ui_MarbleViewSettingsWidget.h" #include "ui_MarbleNavigationSettingsWidget.h" #include "ui_MarbleTimeSettingsWidget.h" #include "ui_MarbleCloudSyncSettingsWidget.h" // Qt #include #include #include #include #include -#include #include #include #include #include #include #include // Marble #include "MarbleGlobal.h" #include "DialogConfigurationInterface.h" #include "MarbleDebug.h" #include "MarbleDirs.h" #include "MarblePluginSettingsWidget.h" #include "MarbleLocale.h" #include "MarbleWidget.h" #include "MarbleModel.h" #include "RenderPlugin.h" #include "RenderPluginModel.h" #include "MarbleClock.h" #include "routing/RoutingProfilesWidget.h" #include "BookmarkSyncManager.h" #include "CloudSyncManager.h" namespace Marble { class QtMarbleConfigDialogPrivate { public: QtMarbleConfigDialogPrivate( MarbleWidget *marbleWidget, CloudSyncManager *cloudSyncManager ) : ui_viewSettings(), ui_navigationSettings(), ui_timeSettings(), ui_cacheSettings(), w_pluginSettings( 0 ), m_cloudSyncStatusLabel( 0 ), m_marbleWidget( marbleWidget ), m_syncManager( cloudSyncManager ? cloudSyncManager->bookmarkSyncManager() : 0 ), m_cloudSyncManager(cloudSyncManager), - m_pluginModel(), - m_initialGraphicsSystem(), - m_previousGraphicsSystem() + m_pluginModel() { } Ui::MarbleViewSettingsWidget ui_viewSettings; Ui::MarbleNavigationSettingsWidget ui_navigationSettings; Ui::MarbleTimeSettingsWidget ui_timeSettings; Ui::MarbleCacheSettingsWidget ui_cacheSettings; Ui::MarbleCloudSyncSettingsWidget ui_cloudSyncSettings; MarblePluginSettingsWidget *w_pluginSettings; QSettings m_settings; QLabel *m_cloudSyncStatusLabel; MarbleWidget *const m_marbleWidget; BookmarkSyncManager *const m_syncManager; CloudSyncManager *const m_cloudSyncManager; RenderPluginModel m_pluginModel; QHash< int, int > m_timezone; - - // Information about the graphics system - Marble::GraphicsSystem m_initialGraphicsSystem; - Marble::GraphicsSystem m_previousGraphicsSystem; }; QtMarbleConfigDialog::QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *cloudSyncManager, QWidget *parent ) : QDialog( parent ), d( new QtMarbleConfigDialogPrivate( marbleWidget, cloudSyncManager ) ) { QTabWidget *tabWidget = new QTabWidget( this ); QDialogButtonBox *buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel, Qt::Horizontal, this ); // Connect the signals of the ButtonBox // to the corresponding slots of the dialog. connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) ); // Ok connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) ); // Cancel connect( buttons->button( QDialogButtonBox::Apply ),SIGNAL(clicked()), this, SLOT(writeSettings()) ); // Apply // If the dialog is accepted. Save the settings. connect( this, SIGNAL(accepted()), this, SLOT(writeSettings()) ); // view page QWidget *w_viewSettings = new QWidget( this ); d->ui_viewSettings.setupUi( w_viewSettings ); tabWidget->addTab( w_viewSettings, tr( "View" ) ); - // It's experimental -- so we remove it for now. - // FIXME: Delete the following line once OpenGL support is officially supported. - d->ui_viewSettings.kcfg_graphicsSystem->removeItem( Marble::OpenGLGraphics ); - - QString nativeString ( tr("Native") ); - - #ifdef Q_WS_X11 - nativeString = tr( "Native (X11)" ); - #endif - #ifdef Q_OS_MAC - nativeString = tr( "Native (Mac OS X Core Graphics)" ); - #endif - - d->ui_viewSettings.kcfg_graphicsSystem->setItemText( Marble::NativeGraphics, nativeString ); d->ui_viewSettings.kcfg_labelLocalization->hide(); d->ui_viewSettings.label_labelLocalization->hide(); // navigation page QWidget *w_navigationSettings = new QWidget( this ); d->ui_navigationSettings.setupUi( w_navigationSettings ); tabWidget->addTab( w_navigationSettings, tr( "Navigation" ) ); d->ui_navigationSettings.kcfg_dragLocation->hide(); d->ui_navigationSettings.label_dragLocation->hide(); // cache page QWidget *w_cacheSettings = new QWidget( this ); d->ui_cacheSettings.setupUi( w_cacheSettings ); tabWidget->addTab( w_cacheSettings, tr( "Cache and Proxy" ) ); // Forwarding clear button signals connect( d->ui_cacheSettings.button_clearVolatileCache, SIGNAL(clicked()), SIGNAL(clearVolatileCacheClicked()) ); connect( d->ui_cacheSettings.button_clearPersistentCache, SIGNAL(clicked()), SIGNAL(clearPersistentCacheClicked()) ); // time page QWidget *w_timeSettings = new QWidget( this ); d->ui_timeSettings.setupUi( w_timeSettings ); tabWidget->addTab( w_timeSettings, tr( "Date and Time" ) ); // routing page QWidget *w_routingSettings = new RoutingProfilesWidget( marbleWidget->model() ); tabWidget->addTab( w_routingSettings, tr( "Routing" ) ); // plugin page d->m_pluginModel.setRenderPlugins( d->m_marbleWidget->renderPlugins() ); d->w_pluginSettings = new MarblePluginSettingsWidget( this ); d->w_pluginSettings->setModel( &d->m_pluginModel ); d->w_pluginSettings->setObjectName( "plugin_page" ); tabWidget->addTab( d->w_pluginSettings, tr( "Plugins" ) ); // Setting the icons for the plugin dialog. d->w_pluginSettings->setAboutIcon( QIcon(":/icons/help-about.png") ); d->w_pluginSettings->setConfigIcon( QIcon(":/icons/settings-configure.png") ); connect( this, SIGNAL(rejected()), &d->m_pluginModel, SLOT(retrievePluginState()) ); connect( this, SIGNAL(accepted()), &d->m_pluginModel, SLOT(applyPluginState()) ); QWidget *w_cloudSyncSettings = new QWidget( this ); d->ui_cloudSyncSettings.setupUi( w_cloudSyncSettings ); tabWidget->addTab( w_cloudSyncSettings, tr( "Synchronization" ) ); d->ui_cloudSyncSettings.button_syncNow->setEnabled( syncBookmarks() ); d->m_cloudSyncStatusLabel = d->ui_cloudSyncSettings.cloudSyncStatus; connect( d->ui_cloudSyncSettings.button_syncNow, SIGNAL(clicked()), SIGNAL(syncNowClicked()) ); connect( d->ui_cloudSyncSettings.testLoginButton, SIGNAL(clicked()), this, SLOT(updateCloudSyncCredentials()) ); if ( d->m_syncManager ) { connect(d->m_syncManager, SIGNAL(syncComplete()), this, SLOT(updateLastSync())); updateLastSync(); } if ( d->m_cloudSyncManager ) { connect( d->m_cloudSyncManager, SIGNAL(statusChanged(QString)), this, SLOT(updateCloudSyncStatus(QString))); } // Layout QVBoxLayout *layout = new QVBoxLayout( this ); layout->addWidget( tabWidget ); layout->addWidget( buttons ); this->setLayout( layout ); // When the settings have been changed, write to disk. connect( this, SIGNAL(settingsChanged()), this, SLOT(syncSettings()) ); initializeCustomTimezone(); } QtMarbleConfigDialog::~QtMarbleConfigDialog() { delete d; } void QtMarbleConfigDialog::syncSettings() { d->m_settings.sync(); QNetworkProxy proxy; // Make sure that no proxy is used for an empty string or the default value: if ( proxyUrl().isEmpty() || proxyUrl() == "http://" ) { proxy.setType( QNetworkProxy::NoProxy ); } else { if ( proxyType() == Marble::Socks5Proxy ) { proxy.setType( QNetworkProxy::Socks5Proxy ); } else if ( proxyType() == Marble::HttpProxy ) { proxy.setType( QNetworkProxy::HttpProxy ); } else { mDebug() << "Unknown proxy type! Using Http Proxy instead."; proxy.setType( QNetworkProxy::HttpProxy ); } } proxy.setHostName( proxyUrl() ); proxy.setPort( proxyPort() ); if ( proxyAuth() ) { proxy.setUser( proxyUser() ); proxy.setPassword( proxyPass() ); } QNetworkProxy::setApplicationProxy(proxy); } void QtMarbleConfigDialog::updateCloudSyncCredentials() { if ( d->m_cloudSyncManager ) { d->m_cloudSyncManager->setOwncloudCredentials( d->ui_cloudSyncSettings.kcfg_owncloudServer->text(), d->ui_cloudSyncSettings.kcfg_owncloudUsername->text(), d->ui_cloudSyncSettings.kcfg_owncloudPassword->text() ); } } void QtMarbleConfigDialog::disableSyncNow() { if ( !d->m_syncManager ) { return; } d->ui_cloudSyncSettings.button_syncNow->setDisabled(true); QTimer *timeoutTimer = new QTimer(this); connect(timeoutTimer, SIGNAL(timeout()), timeoutTimer, SLOT(stop())); connect(timeoutTimer, SIGNAL(timeout()), this, SLOT(enableSyncNow())); connect(d->m_syncManager, SIGNAL(syncComplete()), this, SLOT(enableSyncNow())); connect(d->m_syncManager, SIGNAL(syncComplete()), timeoutTimer, SLOT(stop())); connect(d->m_syncManager, SIGNAL(syncComplete()), timeoutTimer, SLOT(deleteLater())); timeoutTimer->start(30*1000); // 30 sec } void QtMarbleConfigDialog::enableSyncNow() { if ( !d->m_syncManager ) { return; } d->ui_cloudSyncSettings.button_syncNow->setEnabled(true); } void QtMarbleConfigDialog::updateLastSync() { if ( !d->m_syncManager ) { return; } if (!d->m_syncManager->lastSync().isValid()) { d->ui_cloudSyncSettings.labelLastSync->setText(tr("Never synchronized.")); return; } const QString title = tr("Last synchronization: %1") .arg(d->m_syncManager->lastSync().toString()); d->ui_cloudSyncSettings.labelLastSync->setText(title); } void QtMarbleConfigDialog::readSettings() { - d->m_initialGraphicsSystem = graphicsSystem(); - d->m_previousGraphicsSystem = d->m_initialGraphicsSystem; - // Sync settings to make sure that we read the current settings. syncSettings(); // View d->ui_viewSettings.kcfg_distanceUnit->setCurrentIndex( measurementSystem() ); d->ui_viewSettings.kcfg_angleUnit->setCurrentIndex( angleUnit() ); d->ui_viewSettings.kcfg_stillQuality->setCurrentIndex( stillQuality() ); d->ui_viewSettings.kcfg_animationQuality->setCurrentIndex( animationQuality() ); d->ui_viewSettings.kcfg_labelLocalization->setCurrentIndex( Marble::Native ); d->ui_viewSettings.kcfg_mapFont->setCurrentFont( mapFont() ); - d->ui_viewSettings.kcfg_graphicsSystem->setCurrentIndex( graphicsSystem() ); // Navigation d->ui_navigationSettings.kcfg_dragLocation->setCurrentIndex( Marble::KeepAxisVertically ); d->ui_navigationSettings.kcfg_onStartup->setCurrentIndex( onStartup() ); d->ui_navigationSettings.kcfg_inertialEarthRotation->setChecked( inertialEarthRotation() ); d->ui_navigationSettings.kcfg_animateTargetVoyage->setChecked( animateTargetVoyage() ); int editorIndex = 0; if ( externalMapEditor() == "potlatch") { editorIndex = 1; } else if ( externalMapEditor() == "josm") { editorIndex = 2; } else if ( externalMapEditor() == "merkaartor") { editorIndex = 3; } d->ui_navigationSettings.kcfg_externalMapEditor->setCurrentIndex( editorIndex ); // Cache d->ui_cacheSettings.kcfg_volatileTileCacheLimit->setValue( volatileTileCacheLimit() ); d->ui_cacheSettings.kcfg_persistentTileCacheLimit->setValue( persistentTileCacheLimit() ); d->ui_cacheSettings.kcfg_proxyUrl->setText( proxyUrl() ); d->ui_cacheSettings.kcfg_proxyPort->setValue( proxyPort() ); d->ui_cacheSettings.kcfg_proxyUser->setText( proxyUser() ); d->ui_cacheSettings.kcfg_proxyPass->setText( proxyPass() ); d->ui_cacheSettings.kcfg_proxyType->setCurrentIndex( proxyType() ); d->ui_cacheSettings.kcfg_proxyAuth->setChecked( proxyAuth() ); // Time d->ui_timeSettings.kcfg_systemTimezone->setChecked( systemTimezone() ); d->ui_timeSettings.kcfg_customTimezone->setChecked( customTimezone() ); d->ui_timeSettings.kcfg_chosenTimezone->setCurrentIndex( chosenTimezone() ); d->ui_timeSettings.kcfg_utc->setChecked( UTC() ); d->ui_timeSettings.kcfg_systemTime->setChecked( systemTime() ); d->ui_timeSettings.kcfg_lastSessionTime->setChecked( lastSessionTime() ); if( systemTimezone() == true ) { QDateTime localTime = QDateTime::currentDateTime().toLocalTime(); localTime.setTimeSpec( Qt::UTC ); d->m_marbleWidget->model()->setClockTimezone( QDateTime::currentDateTime().toUTC().secsTo( localTime ) ); } else if( UTC() == true ) { d->m_marbleWidget->model()->setClockTimezone( 0 ); } else if( customTimezone() == true ) { d->m_marbleWidget->model()->setClockTimezone( d->m_timezone.value( chosenTimezone() ) ); } // Routing // ownCloud d->ui_cloudSyncSettings.kcfg_enableSync->setChecked( syncEnabled() ); d->ui_cloudSyncSettings.kcfg_syncBookmarks->setChecked( syncBookmarks() ); d->ui_cloudSyncSettings.kcfg_syncRoutes->setChecked( syncRoutes() ); d->ui_cloudSyncSettings.kcfg_owncloudServer->setText( owncloudServer() ); d->ui_cloudSyncSettings.kcfg_owncloudUsername->setText( owncloudUsername() ); d->ui_cloudSyncSettings.kcfg_owncloudPassword->setText( owncloudPassword() ); // Read the settings of the plugins d->m_marbleWidget->readPluginSettings( d->m_settings ); // The settings loaded in the config dialog have been changed. emit settingsChanged(); } void QtMarbleConfigDialog::updateCloudSyncStatus( const QString &status ) { d->m_cloudSyncStatusLabel->setText(status); CloudSyncManager::Status status_type = d->m_cloudSyncManager ? d->m_cloudSyncManager->status() : CloudSyncManager::Unknown; switch (status_type) { case CloudSyncManager::Success: d->m_cloudSyncStatusLabel->setStyleSheet("QLabel { color : green; }"); break; case CloudSyncManager::Error: d->m_cloudSyncStatusLabel->setStyleSheet("QLabel { color : red; }"); break; case CloudSyncManager::Unknown: d->m_cloudSyncStatusLabel->setStyleSheet("QLabel { color : grey; }"); break; } } void QtMarbleConfigDialog::writeSettings() { syncSettings(); - // Determining the graphicsSystemString - QString graphicsSystemString; - switch ( d->ui_viewSettings.kcfg_graphicsSystem->currentIndex() ) - { - case Marble::RasterGraphics : - graphicsSystemString = "raster"; - break; - case Marble::OpenGLGraphics : - graphicsSystemString = "opengl"; - break; - default: - case Marble::NativeGraphics : - graphicsSystemString = "native"; - break; - } - d->m_settings.beginGroup( "View" ); d->m_settings.setValue( "distanceUnit", d->ui_viewSettings.kcfg_distanceUnit->currentIndex() ); d->m_settings.setValue( "angleUnit", d->ui_viewSettings.kcfg_angleUnit->currentIndex() ); d->m_settings.setValue( "stillQuality", d->ui_viewSettings.kcfg_stillQuality->currentIndex() ); d->m_settings.setValue( "animationQuality", d->ui_viewSettings.kcfg_animationQuality->currentIndex() ); d->m_settings.setValue( "mapFont", d->ui_viewSettings.kcfg_mapFont->currentFont() ); - d->m_settings.setValue( "graphicsSystem", graphicsSystemString ); d->m_settings.endGroup(); d->m_settings.beginGroup( "Navigation" ); d->m_settings.setValue( "onStartup", d->ui_navigationSettings.kcfg_onStartup->currentIndex() ); d->m_settings.setValue( "inertialEarthRotation", d->ui_navigationSettings.kcfg_inertialEarthRotation->isChecked() ); d->m_settings.setValue( "animateTargetVoyage", d->ui_navigationSettings.kcfg_animateTargetVoyage->isChecked() ); if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 0 ) { d->m_settings.setValue( "externalMapEditor", "" ); } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 1 ) { d->m_settings.setValue( "externalMapEditor", "potlatch" ); } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 2 ) { d->m_settings.setValue( "externalMapEditor", "josm" ); } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 3 ) { d->m_settings.setValue( "externalMapEditor", "merkaartor" ); } else { Q_ASSERT( false && "Unexpected index of the external editor setting" ); } d->m_settings.endGroup(); d->m_settings.beginGroup( "Cache" ); d->m_settings.setValue( "volatileTileCacheLimit", d->ui_cacheSettings.kcfg_volatileTileCacheLimit->value() ); d->m_settings.setValue( "persistentTileCacheLimit", d->ui_cacheSettings.kcfg_persistentTileCacheLimit->value() ); d->m_settings.setValue( "proxyUrl", d->ui_cacheSettings.kcfg_proxyUrl->text() ); d->m_settings.setValue( "proxyPort", d->ui_cacheSettings.kcfg_proxyPort->value() ); d->m_settings.setValue( "proxyType", d->ui_cacheSettings.kcfg_proxyType->currentIndex() ); if ( d->ui_cacheSettings.kcfg_proxyAuth->isChecked() ) { d->m_settings.setValue( "proxyAuth", true ); d->m_settings.setValue( "proxyUser", d->ui_cacheSettings.kcfg_proxyUser->text() ); d->m_settings.setValue( "proxyPass", d->ui_cacheSettings.kcfg_proxyPass->text() ); } else { d->m_settings.setValue( "proxyAuth", false ); } d->m_settings.endGroup(); d->m_settings.beginGroup( "Time" ); d->m_settings.setValue( "systemTimezone", d->ui_timeSettings.kcfg_systemTimezone->isChecked() ); d->m_settings.setValue( "UTC", d->ui_timeSettings.kcfg_utc->isChecked() ); d->m_settings.setValue( "customTimezone", d->ui_timeSettings.kcfg_customTimezone->isChecked() ); d->m_settings.setValue( "systemTime", d->ui_timeSettings.kcfg_systemTime->isChecked() ); d->m_settings.setValue( "lastSessionTime", d->ui_timeSettings.kcfg_lastSessionTime->isChecked() ); d->m_settings.setValue( "chosenTimezone", d->ui_timeSettings.kcfg_chosenTimezone->currentIndex() ); d->m_settings.endGroup(); d->m_settings.beginGroup( "CloudSync" ); d->m_settings.setValue( "enableSync", d->ui_cloudSyncSettings.kcfg_enableSync->isChecked() ); d->m_settings.setValue( "syncBackend", "owncloud" ); d->m_settings.setValue( "syncBookmarks", d->ui_cloudSyncSettings.kcfg_syncBookmarks->isChecked() ); d->m_settings.setValue( "syncRoutes", d->ui_cloudSyncSettings.kcfg_syncRoutes->isChecked() ); d->m_settings.setValue( "owncloudServer", d->ui_cloudSyncSettings.kcfg_owncloudServer->text() ); d->m_settings.setValue( "owncloudUsername", d->ui_cloudSyncSettings.kcfg_owncloudUsername->text() ); d->m_settings.setValue( "owncloudPassword", d->ui_cloudSyncSettings.kcfg_owncloudPassword->text() ); d->m_settings.endGroup(); // Plugins d->m_marbleWidget->writePluginSettings( d->m_settings ); emit settingsChanged(); - - if ( d->m_initialGraphicsSystem != graphicsSystem() - && d->m_previousGraphicsSystem != graphicsSystem() ) { - QMessageBox::information (this, tr("Graphics System Change"), - tr("You have decided to run Marble with a different graphics system.\n" - "For this change to become effective, Marble has to be restarted.\n" - "Please close the application and start Marble again.") ); - } - d->m_previousGraphicsSystem = graphicsSystem(); } MarbleLocale::MeasurementSystem QtMarbleConfigDialog::measurementSystem() const { if( d->m_settings.contains( "View/distanceUnit" ) ) { return (MarbleLocale::MeasurementSystem)d->m_settings.value( "View/distanceUnit" ).toInt(); } MarbleLocale *locale = MarbleGlobal::getInstance()->locale(); return locale->measurementSystem(); } Marble::AngleUnit QtMarbleConfigDialog::angleUnit() const { return (Marble::AngleUnit) d->m_settings.value( "View/angleUnit", Marble::DMSDegree ).toInt(); } void QtMarbleConfigDialog::setAngleUnit(Marble::AngleUnit unit) { d->m_settings.setValue( "View/angleUnit", (int)unit ); d->ui_viewSettings.kcfg_angleUnit->setCurrentIndex( angleUnit() ); emit settingsChanged(); } Marble::MapQuality QtMarbleConfigDialog::stillQuality() const { return (Marble::MapQuality) d->m_settings.value( "View/stillQuality", Marble::HighQuality ).toInt(); } Marble::MapQuality QtMarbleConfigDialog::animationQuality() const { return (Marble::MapQuality) d->m_settings.value( "View/animationQuality", Marble::LowQuality ).toInt(); } QFont QtMarbleConfigDialog::mapFont() const { return d->m_settings.value( "View/mapFont", QApplication::font() ).value(); } -Marble::GraphicsSystem QtMarbleConfigDialog::graphicsSystem() const -{ - QString graphicsSystemString = d->m_settings.value( "View/graphicsSystem", "raster" ).toString(); - - if ( graphicsSystemString == "raster" ) return Marble::RasterGraphics; - if ( graphicsSystemString == "opengl" ) return Marble::OpenGLGraphics; - - // default case: graphicsSystemString == "raster" - return Marble::NativeGraphics; -} - int QtMarbleConfigDialog::onStartup() const { bool smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen; int defaultValue = smallScreen ? Marble::LastLocationVisited : Marble::ShowHomeLocation; return d->m_settings.value( "Navigation/onStartup", defaultValue ).toInt(); } QString QtMarbleConfigDialog::externalMapEditor() const { return d->m_settings.value( "Navigation/externalMapEditor", "" ).toString(); } bool QtMarbleConfigDialog::animateTargetVoyage() const { const bool smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen; return d->m_settings.value( "Navigation/animateTargetVoyage", smallScreen ).toBool(); } bool QtMarbleConfigDialog::inertialEarthRotation() const { return d->m_settings.value( "Navigation/inertialEarthRotation", true ).toBool(); } int QtMarbleConfigDialog::volatileTileCacheLimit() const { int defaultValue = (MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen) ? 6 : 100; return d->m_settings.value( "Cache/volatileTileCacheLimit", defaultValue ).toInt(); } int QtMarbleConfigDialog::persistentTileCacheLimit() const { return d->m_settings.value( "Cache/persistentTileCacheLimit", 0 ).toInt(); // default to unlimited } QString QtMarbleConfigDialog::proxyUrl() const { return d->m_settings.value( "Cache/proxyUrl", "" ).toString(); } int QtMarbleConfigDialog::proxyPort() const { return d->m_settings.value( "Cache/proxyPort", 8080 ).toInt(); } QString QtMarbleConfigDialog::proxyUser() const { return d->m_settings.value( "Cache/proxyUser", "" ).toString(); } QString QtMarbleConfigDialog::proxyPass() const { return d->m_settings.value( "Cache/proxyPass", "" ).toString(); } bool QtMarbleConfigDialog::proxyType() const { return d->m_settings.value( "Cache/proxyType", Marble::HttpProxy ).toInt(); } bool QtMarbleConfigDialog::proxyAuth() const { return d->m_settings.value( "Cache/proxyAuth", false ).toBool(); } bool QtMarbleConfigDialog::systemTimezone() const { return d->m_settings.value( "Time/systemTimezone", true ).toBool(); } bool QtMarbleConfigDialog::customTimezone() const { return d->m_settings.value( "Time/customTimezone", false ).toBool(); } bool QtMarbleConfigDialog::UTC() const { return d->m_settings.value( "Time/UTC", false ).toBool(); } bool QtMarbleConfigDialog::systemTime() const { return d->m_settings.value( "Time/systemTime", true ).toBool(); } bool QtMarbleConfigDialog::lastSessionTime() const { return d->m_settings.value( "Time/lastSessionTime", false ).toBool(); } int QtMarbleConfigDialog::chosenTimezone() const { return d->m_settings.value( "Time/chosenTimezone", 0 ).toInt(); } void QtMarbleConfigDialog::initializeCustomTimezone() { if( d->m_timezone.count() == 0) { d->m_timezone.insert( 0, 0 ); d->m_timezone.insert( 1, 3600 ); d->m_timezone.insert( 2, 7200 ); d->m_timezone.insert( 3, 7200 ); d->m_timezone.insert( 4, 10800 ); d->m_timezone.insert( 5, 12600 ); d->m_timezone.insert( 6, 14400 ); d->m_timezone.insert( 7, 18000 ); d->m_timezone.insert( 8, 19800 ); d->m_timezone.insert( 9, 21600 ); d->m_timezone.insert( 10, 25200 ); d->m_timezone.insert( 11, 28800 ); d->m_timezone.insert( 12, 32400 ); d->m_timezone.insert( 13, 34200 ); d->m_timezone.insert( 14, 36000 ); d->m_timezone.insert( 15, 39600 ); d->m_timezone.insert( 16, 43200 ); d->m_timezone.insert( 17, -39600 ); d->m_timezone.insert( 18, -36000 ); d->m_timezone.insert( 19, -32400 ); d->m_timezone.insert( 20, -28800 ); d->m_timezone.insert( 21, -25200 ); d->m_timezone.insert( 22, -25200 ); d->m_timezone.insert( 23, -21600 ); d->m_timezone.insert( 24, -18000 ); d->m_timezone.insert( 25, -18000 ); d->m_timezone.insert( 26, -14400 ); d->m_timezone.insert( 27, -12600 ); d->m_timezone.insert( 28, -10800 ); d->m_timezone.insert( 29, -10800 ); d->m_timezone.insert( 30, -3600 ); } } bool QtMarbleConfigDialog::syncEnabled() const { return d->m_settings.value( "CloudSync/enableSync", false ).toBool(); } QString QtMarbleConfigDialog::syncBackend() const { return d->m_settings.value( "CloudSync/syncBackend", "" ).toString(); } bool QtMarbleConfigDialog::syncBookmarks() const { return d->m_settings.value( "CloudSync/syncBookmarks", true ).toBool(); } bool QtMarbleConfigDialog::syncRoutes() const { return d->m_settings.value( "CloudSync/syncRoutes", true ).toBool(); } QString QtMarbleConfigDialog::owncloudServer() const { return d->m_settings.value( "CloudSync/owncloudServer", "" ).toString(); } QString QtMarbleConfigDialog::owncloudUsername() const { return d->m_settings.value( "CloudSync/owncloudUsername", "" ).toString(); } QString QtMarbleConfigDialog::owncloudPassword() const { return d->m_settings.value( "CloudSync/owncloudPassword", "" ).toString(); } } #include "moc_QtMarbleConfigDialog.cpp" diff --git a/src/lib/marble/QtMarbleConfigDialog.h b/src/lib/marble/QtMarbleConfigDialog.h index 7d3f152e1..09ff0f37c 100644 --- a/src/lib/marble/QtMarbleConfigDialog.h +++ b/src/lib/marble/QtMarbleConfigDialog.h @@ -1,175 +1,171 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Bastian Holst // #ifndef MARBLE_QTMARBLECONFIGDIALOG_H #define MARBLE_QTMARBLECONFIGDIALOG_H #include #include #include "marble_export.h" #include "MarbleGlobal.h" #include "MarbleLocale.h" namespace Marble { class MarbleWidget; class CloudSyncManager; class QtMarbleConfigDialogPrivate; class MARBLE_EXPORT QtMarbleConfigDialog : public QDialog { Q_OBJECT public: explicit QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *syncManager = 0, QWidget *parent = 0 ); ~QtMarbleConfigDialog(); // View Settings MarbleLocale::MeasurementSystem measurementSystem() const; Marble::AngleUnit angleUnit() const; void setAngleUnit(Marble::AngleUnit unit); Marble::MapQuality stillQuality() const; Marble::MapQuality animationQuality() const; QFont mapFont() const; - // View - Marble::GraphicsSystem graphicsSystem() const; - - // Navigation Settings int onStartup() const; bool animateTargetVoyage() const; QString externalMapEditor() const; bool inertialEarthRotation() const; // Cache Settings int volatileTileCacheLimit() const; int persistentTileCacheLimit() const; QString proxyUrl() const; int proxyPort() const; QString proxyUser() const; QString proxyPass() const; bool proxyType() const; bool proxyAuth() const; // Time Settings /** * Read the value of 'Time/systemTime' key from settings */ bool systemTime() const; /** * Read the value of 'Time/lastSessionTime' key from settings */ bool lastSessionTime() const; /** * Read the value of 'Time/systemTimezone' key from settings */ bool systemTimezone() const; /** * Read the value of 'Time/UTC' key from settings */ bool UTC() const; /** * Read the value of 'Time/customTimezone' key from settings */ bool customTimezone() const; /** * Read the value of 'Time/chosenTimezone' key from settings */ int chosenTimezone() const; void initializeCustomTimezone(); // CloudSync settings bool syncEnabled() const; QString syncBackend() const; bool syncBookmarks() const; bool syncRoutes() const; QString owncloudServer() const; QString owncloudUsername() const; QString owncloudPassword() const; Q_SIGNALS: /** * This signal is emitted when when the loaded settings were changed. * Either by the user or by loading them initially from disk. */ void settingsChanged(); /** * The user clicked on the button to clear volatile tile cache. */ void clearVolatileCacheClicked(); /** * The user clicked on the button to clear persistent tile cache. */ void clearPersistentCacheClicked(); /** * The user clicked on the button to manually synchronize bookmarks. */ void syncNowClicked(); public Q_SLOTS: /** * Disable "Sync Now" button while sync or for 30 sec of timout */ void disableSyncNow(); void enableSyncNow(); /** * Sets new title for the "Last Sync" label indicator */ void updateLastSync(); /** * Read settings and update interface. */ void readSettings(); /** * Show status on cloud sync settings tab */ void updateCloudSyncStatus( const QString &status ); /** * Write settings to disk. */ void writeSettings(); private Q_SLOTS: /** * Synchronize the loaded settings with the file on hard disk. */ void syncSettings(); void updateCloudSyncCredentials(); private: Q_DISABLE_COPY( QtMarbleConfigDialog ) QtMarbleConfigDialogPrivate * const d; }; } // Marble namespace #endif