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 "maintab.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "globe.h"
#include "helpers.h" #include "helpers.h"
#include "statistics.h" #include "statistics.h"
#include "modeldelegates.h" #include "modeldelegates.h"

View file

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

View file

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

View file

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