Remove the Globe from the mainwindow.ui

Now it's started from mainwindo.cpp and it's part of the
new states

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-02-09 18:43:41 -02:00 committed by Dirk Hohndel
parent cf4d55c470
commit c30aee1ae5
4 changed files with 15 additions and 21 deletions

View file

@ -6,6 +6,7 @@
*/
#include "maintab.h"
#include "mainwindow.h"
#include "globe.h"
#include "helpers.h"
#include "statistics.h"
#include "modeldelegates.h"

View file

@ -21,6 +21,7 @@
#include "updatemanager.h"
#include "planner.h"
#include "filtermodels.h"
#include "globe.h"
#ifndef NO_PRINTING
#include <QPrintDialog>
#include "printdialog.h"
@ -53,14 +54,14 @@ MainWindow::MainWindow() : QMainWindow(),
MainTab *mainTab = new MainTab();
DiveListView *diveListView = new DiveListView();
ProfileWidget2 *profileWidget = new ProfileWidget2();
GlobeGPS *globe = new GlobeGPS();
GlobeGPS *globeGps = new GlobeGPS();
PlannerSettingsWidget *plannerSettings = new PlannerSettingsWidget();
DivePlannerWidget *plannerWidget = new DivePlannerWidget();
PlannerDetails *plannerDetails = new PlannerDetails();
registerApplicationState("Default", mainTab, diveListView, profileWidget, globe );
registerApplicationState("AddDive", mainTab, diveListView, profileWidget, globe );
registerApplicationState("Default", mainTab, diveListView, profileWidget, globeGps );
registerApplicationState("AddDive", mainTab, diveListView, profileWidget, globeGps );
registerApplicationState("PlanDive", plannerWidget, plannerSettings, profileWidget, plannerDetails );
ui.multiFilter->hide();
@ -109,7 +110,7 @@ MainWindow::MainWindow() : QMainWindow(),
diveListView->reload(DiveTripModel::TREE);
diveListView->reloadHeaderActions();
diveListView->setFocus();
ui.globe->reload();
globe()->reload();
diveListView->expand(dive_list()->model()->index(0, 0));
diveListView->scrollTo(dive_list()->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
ui.divePlannerWidget->settingsChanged();
@ -118,7 +119,7 @@ MainWindow::MainWindow() : QMainWindow(),
ui.globePane->hide();
ui.menuView->removeAction(ui.actionViewGlobe);
#else
connect(ui.globe, SIGNAL(coordinatesChanged()), ui.InfoWidget, SLOT(updateGpsCoordinates()));
connect(globe(), SIGNAL(coordinatesChanged()), ui.InfoWidget, SLOT(updateGpsCoordinates()));
#endif
#ifdef NO_USERMANUAL
ui.menuHelp->removeAction(ui.actionUserManual);
@ -200,7 +201,7 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
showError(get_error_string());
ui.InfoWidget->reload();
TankInfoModel::instance()->update();
ui.globe->reload();
globe()->reload();
if (doRecreateDiveList)
recreateDiveList();
ui.diveListPane->setCurrentIndex(0); // switch to the dive list
@ -228,7 +229,7 @@ void MainWindow::current_dive_changed(int divenr)
{
if (divenr >= 0) {
select_dive(divenr);
ui.globe->centerOnCurrentDive();
globe()->centerOnCurrentDive();
}
ui.newProfile->plotDive();
ui.InfoWidget->updateDiveInfo();
@ -285,7 +286,7 @@ void MainWindow::cleanUpEmpty()
ui.InfoWidget->updateDiveInfo(true);
ui.newProfile->setEmptyState();
dive_list()->reload(DiveTripModel::TREE);
ui.globe->reload();
globe()->reload();
if (!existing_filename)
setTitle(MWTF_DEFAULT);
disableShortcuts();
@ -1019,7 +1020,7 @@ DiveListView *MainWindow::dive_list()
GlobeGPS *MainWindow::globe()
{
return ui.globe;
return qobject_cast<GlobeGPS*>(applicationState["Default"].bottomRight);
}
MainTab *MainWindow::information()

View file

@ -70,7 +70,7 @@
</property>
<widget class="QStackedWidget" name="diveListPane">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="diveListLayout"/>
@ -88,11 +88,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="globeLayout">
<item>
<widget class="GlobeGPS" name="globe" native="true"/>
</item>
</layout>
<layout class="QVBoxLayout" name="globeLayout"/>
</widget>
<widget class="QWidget" name="page_5">
<property name="sizePolicy">
@ -843,12 +839,6 @@ p, li { white-space: pre-wrap; }
<header>qt-ui/maintab.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GlobeGPS</class>
<extends>QWidget</extends>
<header>globe.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DivePlannerWidget</class>
<extends>QWidget</extends>

View file

@ -3,6 +3,8 @@
#include "mainwindow.h"
#include "usersurvey.h"
#include "divelist.h"
#include "globe.h"
#include <errno.h>
#include <QDir>