Remove the ProfileWidget from mainwindow.ui

It is now in mainwindo.cpp

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 19:51:31 -02:00 committed by Dirk Hohndel
parent 2992d78f83
commit 6b038c2a9a
21 changed files with 50 additions and 38 deletions

View file

@ -10,6 +10,7 @@
#include "subsurfacestartup.h"
#include "qt-ui/mainwindow.h"
#include "qt-ui/diveplanner.h"
#include "qt-ui/graphicsview-common.h"
#include <QStringList>
#include <git2.h>

View file

@ -2,6 +2,8 @@
#include "helpers.h"
#include "mainwindow.h"
#include "display.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>

View file

@ -9,6 +9,7 @@
#include "modeldelegates.h"
#include "mainwindow.h"
#include "divepicturewidget.h"
#include "display.h"
#include <QSettings>
#include <QKeyEvent>
#include <QFileDialog>

View file

@ -1,5 +1,6 @@
#include "divelogimportdialog.h"
#include "mainwindow.h"
#include "color.h"
#include "ui_divelogimportdialog.h"
#include <QShortcut>
#include <QDrag>

View file

@ -4,6 +4,7 @@
#include "planner.h"
#include "helpers.h"
#include "models.h"
#include "profile/profilewidget2.h"
#include <QGraphicsSceneMouseEvent>
#include <QMessageBox>

View file

@ -2,6 +2,8 @@
#include "helpers.h"
#include "mainwindow.h"
#include "divelistview.h"
#include "display.h"
#include <QTimer>
#include <QFileDialog>
#include <QMessageBox>

View file

@ -2,6 +2,7 @@
#include "mainwindow.h"
#include "models.h"
#include "divelistview.h"
#include "display.h"
#define CREATE_INSTANCE_METHOD( CLASS ) \
CLASS *CLASS::instance() \

View file

@ -4,6 +4,7 @@
#include "helpers.h"
#include "divelistview.h"
#include "maintab.h"
#include "display.h"
#include <QTimer>
#include <QContextMenuEvent>

View file

@ -12,6 +12,8 @@
#include "modeldelegates.h"
#include "models.h"
#include "divelistview.h"
#include "display.h"
#include "profile/profilewidget2.h"
#if defined(FBSUPPORT)
#include "socialnetworks.h"

View file

@ -21,6 +21,7 @@
#include "updatemanager.h"
#include "planner.h"
#include "filtermodels.h"
#include "profile/profilewidget2.h"
#include "globe.h"
#include "maintab.h"
#ifndef NO_PRINTING
@ -96,7 +97,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(ui.actionRecent2, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent3, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent4, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(information(), SIGNAL(addDiveFinished()), ui.newProfile, SLOT(setProfileState()));
connect(information(), SIGNAL(addDiveFinished()), graphics(), SLOT(setProfileState()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
connect(ui.printPlan, SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
@ -107,7 +108,7 @@ MainWindow::MainWindow() : QMainWindow(),
#endif
ui.mainErrorMessage->hide();
ui.newProfile->setEmptyState();
graphics()->setEmptyState();
initialUiSetup();
readSettings();
diveListView->reload(DiveTripModel::TREE);
@ -139,9 +140,12 @@ MainWindow::MainWindow() : QMainWindow(),
// has no concept of "toolbar" for a non-mainwindow widget (...)
// I need to take the current item that's in the toolbar Position
// and reposition it alongside the grid layout.
QLayoutItem *p = ui.profileInnerLayout->takeAt(0);
ui.profileInnerLayout->addWidget(toolBar, 0, 0);
ui.profileInnerLayout->addItem(p, 0, 1);
// TODO: FIX THIS
// QLayoutItem *p = ui.profileInnerLayout->takeAt(0);
// ui.profileInnerLayout->addWidget(toolBar, 0, 0);
// ui.profileInnerLayout->addItem(p, 0, 1);
// ui.profileInnerLayout->setContentsMargins(QMargins(0, 5, 5, 5));
// ui.profileInnerLayout->setSpacing(0);
// and now for some layout hackery
// this gets us consistent margins everywhere and a much more balanced look
@ -168,9 +172,6 @@ MainWindow::MainWindow() : QMainWindow(),
else
layout->setContentsMargins(margins);
}
margins = QMargins(0, 5, 5, 5);
ui.profileInnerLayout->setContentsMargins(margins);
ui.profileInnerLayout->setSpacing(0);
toolBar->setContentsMargins(zeroMargins);
updateManager = new UpdateManager(this);
@ -234,7 +235,7 @@ void MainWindow::current_dive_changed(int divenr)
select_dive(divenr);
globe()->centerOnCurrentDive();
}
ui.newProfile->plotDive();
graphics()->plotDive();
information()->updateDiveInfo();
}
@ -278,7 +279,7 @@ void MainWindow::on_actionSaveAs_triggered()
ProfileWidget2 *MainWindow::graphics() const
{
return ui.newProfile;
return qobject_cast<ProfileWidget2*>(applicationState["Default"].topRight);
}
void MainWindow::cleanUpEmpty()
@ -287,7 +288,7 @@ void MainWindow::cleanUpEmpty()
information()->clearInfo();
information()->clearEquipment();
information()->updateDiveInfo(true);
ui.newProfile->setEmptyState();
graphics()->setEmptyState();
dive_list()->reload(DiveTripModel::TREE);
globe()->reload();
if (!existing_filename)
@ -310,7 +311,7 @@ bool MainWindow::okToClose(QString message)
void MainWindow::closeCurrentFile()
{
ui.newProfile->setEmptyState();
graphics()->setEmptyState();
/* free the dives and trips */
clear_git_id();
while (dive_table.nr)
@ -386,7 +387,7 @@ void MainWindow::enableShortcuts()
void MainWindow::showProfile()
{
enableShortcuts();
ui.newProfile->setProfileState();
graphics()->setProfileState();
setApplicationState("Default");
}
@ -457,16 +458,16 @@ void MainWindow::planCanceled()
// while planning we might have modified the displayed_dive
// let's refresh what's shown on the profile
showProfile();
ui.newProfile->replot();
graphics()->replot();
refreshDisplay(false);
ui.newProfile->plotDive(get_dive(selected_dive));
graphics()->plotDive(get_dive(selected_dive));
DivePictureModel::instance()->updateDivePictures();
}
void MainWindow::planCreated()
{
// get the new dive selected and assign a number if reasonable
ui.newProfile->setProfileState();
graphics()->setProfileState();
if (displayed_dive.id == 0) {
// we might have added a new dive (so displayed_dive was cleared out by clone_dive()
dive_list()->unselectDives();
@ -527,8 +528,8 @@ void MainWindow::on_actionReplanDive_triggered()
DivePlannerPointsModel::instance()->clear();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
ui.newProfile->setPlanState();
ui.newProfile->clearHandlers();
graphics()->setPlanState();
graphics()->clearHandlers();
setApplicationState("PlanDive");
divePlannerWidget()->setReplanButton(true);
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
@ -549,7 +550,7 @@ void MainWindow::on_actionDivePlanner_triggered()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
setApplicationState("PlanDive");
ui.newProfile->setPlanState();
graphics()->setPlanState();
// create a simple starting dive, using the first gas from the just copied cylidners
setupForAddAndPlan("planned dive"); // don't translate, stored in XML file
@ -593,9 +594,9 @@ void MainWindow::on_actionAddDive_triggered()
information()->addDiveStarted();
ui.newProfile->setAddState();
graphics()->setAddState();
DivePlannerPointsModel::instance()->createSimpleDive();
ui.newProfile->plotDive();
graphics()->plotDive();
}
void MainWindow::on_actionRenumber_triggered()
@ -750,7 +751,7 @@ void MainWindow::on_actionPreviousDC_triggered()
{
unsigned nrdc = number_of_computers(current_dive);
dc_number = (dc_number + nrdc - 1) % nrdc;
ui.newProfile->plotDive();
graphics()->plotDive();
information()->updateDiveInfo();
}
@ -758,7 +759,7 @@ void MainWindow::on_actionNextDC_triggered()
{
unsigned nrdc = number_of_computers(current_dive);
dc_number = (dc_number + 1) % nrdc;
ui.newProfile->plotDive();
graphics()->plotDive();
information()->updateDiveInfo();
}
@ -1396,7 +1397,7 @@ void MainWindow::editCurrentDive()
if (defaultDC == "manually added dive") {
disableShortcuts();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
ui.newProfile->setAddState();
graphics()->setAddState();
setApplicationState("EditDive");
DivePlannerPointsModel::instance()->loadFromDive(d);
information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE);

View file

@ -31,6 +31,7 @@ class QSettings;
class UpdateManager;
class UserManual;
class DivePlannerWidget;
class ProfileWidget2;
class UndoBuffer;
enum MainWindowTitleFormat {

View file

@ -27,13 +27,6 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="ProfileWidget">
<layout class="QGridLayout" name="profileInnerLayout">
<item row="0" column="0" rowspan="3">
<widget class="ProfileWidget2" name="newProfile"/>
</item>
</layout>
</widget>
</widget>
<widget class="QSplitter" name="bottomSplitter">
<property name="orientation">
@ -804,11 +797,6 @@ p, li { white-space: pre-wrap; }
<header>kmessagewidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ProfileWidget2</class>
<extends>QGraphicsView</extends>
<header>qt-ui/profile/profilewidget2.h</header>
</customwidget>
<customwidget>
<class>PlannerSettingsWidget</class>
<extends>QWidget</extends>

View file

@ -4,6 +4,7 @@
#include "mainwindow.h"
#include "models.h"
#include "starwidget.h"
#include "profile/profilewidget2.h"
#include <QCompleter>
#include <QKeyEvent>

View file

@ -14,6 +14,7 @@
#include "qthelper.h"
#include "gettextfromc.h"
#include "display.h"
#include "color.h"
#include <QCoreApplication>
#include <QDebug>

View file

@ -9,6 +9,7 @@
#include "printlayout.h"
#include "modeldelegates.h"
#include "models.h"
#include "profile/profilewidget2.h"
PrintLayout::PrintLayout(PrintDialog *dialogPtr, QPrinter *printerPtr, struct print_options *optionsPtr)
{

View file

@ -5,6 +5,8 @@
#include "diveplotdatamodel.h"
#include "animationfunctions.h"
#include "mainwindow.h"
#include "divelineitem.h"
#include "profilewidget2.h"
static QPen gridPen()
{

View file

@ -10,6 +10,7 @@
#include "libdivecomputer/parser.h"
#include "mainwindow.h"
#include "maintab.h"
#include "profile/profilewidget2.h"
#include <QSettings>

View file

@ -1,5 +1,6 @@
#include "divetextitem.h"
#include "mainwindow.h"
#include "profilewidget2.h"
DiveTextItem::DiveTextItem(QGraphicsItem *parent) : QGraphicsItemGroup(parent),
internalAlignFlags(Qt::AlignHCenter | Qt::AlignVCenter),

View file

@ -1,6 +1,8 @@
#include "ruleritem.h"
#include "preferences.h"
#include "mainwindow.h"
#include "profilewidget2.h"
#include "display.h"
#include <qgraphicssceneevent.h>

View file

@ -12,6 +12,8 @@
#include "helpers.h"
#include "libdivecomputer/parser.h"
#include "divelistview.h"
#include "display.h"
#include "profile/profilewidget2.h"
class MinMaxAvgWidgetPrivate {
public:
@ -170,7 +172,6 @@ void SetpointDialog::buttonClicked(QAbstractButton *button)
add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()), "SP change");
mark_divelist_changed(true);
MainWindow::instance()->graphics()->replot();
}
SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent)

View file

@ -5,7 +5,7 @@
#include "divelist.h"
#include "globe.h"
#include "maintab.h"
#include "display.h"
#include <errno.h>
#include <QDir>