mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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:
parent
2992d78f83
commit
6b038c2a9a
21 changed files with 50 additions and 38 deletions
1
main.cpp
1
main.cpp
|
@ -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>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "helpers.h"
|
||||
#include "mainwindow.h"
|
||||
#include "display.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "modeldelegates.h"
|
||||
#include "mainwindow.h"
|
||||
#include "divepicturewidget.h"
|
||||
#include "display.h"
|
||||
#include <QSettings>
|
||||
#include <QKeyEvent>
|
||||
#include <QFileDialog>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "divelogimportdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "color.h"
|
||||
#include "ui_divelogimportdialog.h"
|
||||
#include <QShortcut>
|
||||
#include <QDrag>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "planner.h"
|
||||
#include "helpers.h"
|
||||
#include "models.h"
|
||||
#include "profile/profilewidget2.h"
|
||||
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QMessageBox>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "helpers.h"
|
||||
#include "mainwindow.h"
|
||||
#include "divelistview.h"
|
||||
#include "display.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "mainwindow.h"
|
||||
#include "models.h"
|
||||
#include "divelistview.h"
|
||||
#include "display.h"
|
||||
|
||||
#define CREATE_INSTANCE_METHOD( CLASS ) \
|
||||
CLASS *CLASS::instance() \
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "helpers.h"
|
||||
#include "divelistview.h"
|
||||
#include "maintab.h"
|
||||
#include "display.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QContextMenuEvent>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -31,6 +31,7 @@ class QSettings;
|
|||
class UpdateManager;
|
||||
class UserManual;
|
||||
class DivePlannerWidget;
|
||||
class ProfileWidget2;
|
||||
class UndoBuffer;
|
||||
|
||||
enum MainWindowTitleFormat {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "mainwindow.h"
|
||||
#include "models.h"
|
||||
#include "starwidget.h"
|
||||
#include "profile/profilewidget2.h"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QKeyEvent>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "qthelper.h"
|
||||
#include "gettextfromc.h"
|
||||
#include "display.h"
|
||||
#include "color.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "diveplotdatamodel.h"
|
||||
#include "animationfunctions.h"
|
||||
#include "mainwindow.h"
|
||||
#include "divelineitem.h"
|
||||
#include "profilewidget2.h"
|
||||
|
||||
static QPen gridPen()
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "libdivecomputer/parser.h"
|
||||
#include "mainwindow.h"
|
||||
#include "maintab.h"
|
||||
#include "profile/profilewidget2.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "divetextitem.h"
|
||||
#include "mainwindow.h"
|
||||
#include "profilewidget2.h"
|
||||
|
||||
DiveTextItem::DiveTextItem(QGraphicsItem *parent) : QGraphicsItemGroup(parent),
|
||||
internalAlignFlags(Qt::AlignHCenter | Qt::AlignVCenter),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "ruleritem.h"
|
||||
#include "preferences.h"
|
||||
#include "mainwindow.h"
|
||||
#include "profilewidget2.h"
|
||||
#include "display.h"
|
||||
|
||||
#include <qgraphicssceneevent.h>
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "divelist.h"
|
||||
#include "globe.h"
|
||||
#include "maintab.h"
|
||||
|
||||
#include "display.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <QDir>
|
||||
|
|
Loading…
Reference in a new issue