mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove the old profile from the main screen of Subsurface
This patch partially removes the code for the old profile from Subsurface. It removes the use of the old profile on the mainwindow, but keeping the code in the tree for now. A bit of code-cleanup also entered this commit because I had to change every instance of the code that used the old profile. Now to the real code-cleanup Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6dec4b0556
commit
ac9a23ef3b
9 changed files with 383 additions and 500 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include "../dive.h"
|
#include "../dive.h"
|
||||||
#include "../divelist.h"
|
#include "../divelist.h"
|
||||||
#include "../planner.h"
|
#include "../planner.h"
|
||||||
|
#include "display.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "diveplanner.h"
|
#include "diveplanner.h"
|
||||||
#include "divelist.h"
|
#include "divelist.h"
|
||||||
#include "qthelper.h"
|
#include "qthelper.h"
|
||||||
|
#include "display.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
|
|
|
@ -54,7 +54,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(update()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(update()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(reloadHeaderActions()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(reloadHeaderActions()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ProfileWidget, SLOT(refresh()));
|
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.InfoWidget, SLOT(updateDiveInfo()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.InfoWidget, SLOT(updateDiveInfo()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlanner, SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlanner, SLOT(settingsChanged()));
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlannerWidget, SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlannerWidget, SLOT(settingsChanged()));
|
||||||
|
@ -96,7 +95,6 @@ void MainWindow::refreshDisplay(bool recreateDiveList)
|
||||||
{
|
{
|
||||||
ui.InfoWidget->reload();
|
ui.InfoWidget->reload();
|
||||||
TankInfoModel::instance()->update();
|
TankInfoModel::instance()->update();
|
||||||
ui.ProfileWidget->refresh();
|
|
||||||
ui.globe->reload();
|
ui.globe->reload();
|
||||||
if (recreateDiveList)
|
if (recreateDiveList)
|
||||||
ui.ListWidget->reload(DiveTripModel::CURRENT);
|
ui.ListWidget->reload(DiveTripModel::CURRENT);
|
||||||
|
@ -110,7 +108,6 @@ void MainWindow::current_dive_changed(int divenr)
|
||||||
select_dive(divenr);
|
select_dive(divenr);
|
||||||
ui.globe->centerOn(get_dive(selected_dive));
|
ui.globe->centerOn(get_dive(selected_dive));
|
||||||
}
|
}
|
||||||
redrawProfile();
|
|
||||||
|
|
||||||
/* It looks like it's a bit too cumberstone to send *one* dive using a QList,
|
/* It looks like it's a bit too cumberstone to send *one* dive using a QList,
|
||||||
* but this is just futureproofness, it's the best way in the future to show more than
|
* but this is just futureproofness, it's the best way in the future to show more than
|
||||||
|
@ -121,11 +118,6 @@ void MainWindow::current_dive_changed(int divenr)
|
||||||
ui.InfoWidget->updateDiveInfo(divenr);
|
ui.InfoWidget->updateDiveInfo(divenr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::redrawProfile()
|
|
||||||
{
|
|
||||||
ui.ProfileWidget->refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionNew_triggered()
|
void MainWindow::on_actionNew_triggered()
|
||||||
{
|
{
|
||||||
on_actionClose_triggered();
|
on_actionClose_triggered();
|
||||||
|
@ -146,10 +138,6 @@ void MainWindow::on_actionOpen_triggered()
|
||||||
loadFiles(QStringList() << filename);
|
loadFiles(QStringList() << filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTabWidget *MainWindow::tabWidget()
|
|
||||||
{
|
|
||||||
return ui.tabWidget;
|
|
||||||
}
|
|
||||||
void MainWindow::on_actionSave_triggered()
|
void MainWindow::on_actionSave_triggered()
|
||||||
{
|
{
|
||||||
file_save();
|
file_save();
|
||||||
|
@ -160,13 +148,18 @@ void MainWindow::on_actionSaveAs_triggered()
|
||||||
file_save_as();
|
file_save_as();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfileWidget2* MainWindow::graphics() const
|
||||||
|
{
|
||||||
|
return ui.newProfile;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::cleanUpEmpty()
|
void MainWindow::cleanUpEmpty()
|
||||||
{
|
{
|
||||||
ui.InfoWidget->clearStats();
|
ui.InfoWidget->clearStats();
|
||||||
ui.InfoWidget->clearInfo();
|
ui.InfoWidget->clearInfo();
|
||||||
ui.InfoWidget->clearEquipment();
|
ui.InfoWidget->clearEquipment();
|
||||||
ui.InfoWidget->updateDiveInfo(-1);
|
ui.InfoWidget->updateDiveInfo(-1);
|
||||||
ui.ProfileWidget->clear();
|
ui.newProfile->setEmptyState();
|
||||||
ui.ListWidget->reload(DiveTripModel::TREE);
|
ui.ListWidget->reload(DiveTripModel::TREE);
|
||||||
ui.globe->reload();
|
ui.globe->reload();
|
||||||
if (!existing_filename)
|
if (!existing_filename)
|
||||||
|
@ -377,28 +370,6 @@ void MainWindow::on_actionYearlyStatistics_triggered()
|
||||||
view->show();
|
view->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_mainSplitter_splitterMoved(int pos, int idx)
|
|
||||||
{
|
|
||||||
redrawProfile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_infoProfileSplitter_splitterMoved(int pos, int idx)
|
|
||||||
{
|
|
||||||
redrawProfile();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* So, here's the deal.
|
|
||||||
* We have a few QSplitters that takes care of helping us with the
|
|
||||||
* size of a few widgets, they are ok, and we should continue using them
|
|
||||||
* to manage the visibility of them too. But the way that we did before was to
|
|
||||||
* widget->hide(); something, and if you hided something using the splitter,
|
|
||||||
* by holding it's handle and collapsing the widget, then you used the 'ctrl+number'
|
|
||||||
* shortcut to show it, it whould only show a gray panel.
|
|
||||||
*
|
|
||||||
* This patch makes everything behave using the splitters.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define BEHAVIOR QList<int>()
|
#define BEHAVIOR QList<int>()
|
||||||
void MainWindow::on_actionViewList_triggered()
|
void MainWindow::on_actionViewList_triggered()
|
||||||
{
|
{
|
||||||
|
@ -412,7 +383,6 @@ void MainWindow::on_actionViewProfile_triggered()
|
||||||
beginChangeState(PROFILE_MAXIMIZED);
|
beginChangeState(PROFILE_MAXIMIZED);
|
||||||
ui.infoProfileSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED);
|
ui.infoProfileSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED);
|
||||||
ui.mainSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED);
|
ui.mainSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED);
|
||||||
redrawProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionViewInfo_triggered()
|
void MainWindow::on_actionViewInfo_triggered()
|
||||||
|
@ -470,7 +440,6 @@ void MainWindow::on_actionViewAll_triggered()
|
||||||
ui.infoProfileSplitter->setSizes(infoProfileSizes);
|
ui.infoProfileSplitter->setSizes(infoProfileSizes);
|
||||||
ui.listGlobeSplitter->setSizes(listGlobeSizes);
|
ui.listGlobeSplitter->setSizes(listGlobeSizes);
|
||||||
}
|
}
|
||||||
redrawProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::beginChangeState(CurrentState s)
|
void MainWindow::beginChangeState(CurrentState s)
|
||||||
|
@ -495,7 +464,6 @@ void MainWindow::on_actionPreviousDC_triggered()
|
||||||
dc_number--;
|
dc_number--;
|
||||||
ui.InfoWidget->updateDiveInfo(selected_dive);
|
ui.InfoWidget->updateDiveInfo(selected_dive);
|
||||||
ui.newProfile->plotDives(QList<struct dive *>() << (current_dive));
|
ui.newProfile->plotDives(QList<struct dive *>() << (current_dive));
|
||||||
redrawProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionNextDC_triggered()
|
void MainWindow::on_actionNextDC_triggered()
|
||||||
|
@ -503,7 +471,6 @@ void MainWindow::on_actionNextDC_triggered()
|
||||||
dc_number++;
|
dc_number++;
|
||||||
ui.InfoWidget->updateDiveInfo(selected_dive);
|
ui.InfoWidget->updateDiveInfo(selected_dive);
|
||||||
ui.newProfile->plotDives(QList<struct dive *>() << (current_dive));
|
ui.newProfile->plotDives(QList<struct dive *>() << (current_dive));
|
||||||
redrawProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFullScreen_triggered(bool checked)
|
void MainWindow::on_actionFullScreen_triggered(bool checked)
|
||||||
|
@ -696,11 +663,6 @@ GlobeGPS *MainWindow::globe()
|
||||||
return ui.globe;
|
return ui.globe;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileGraphicsView *MainWindow::graphics()
|
|
||||||
{
|
|
||||||
return ui.ProfileWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
MainTab *MainWindow::information()
|
MainTab *MainWindow::information()
|
||||||
{
|
{
|
||||||
return ui.InfoWidget;
|
return ui.InfoWidget;
|
||||||
|
|
|
@ -60,7 +60,6 @@ public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
static MainWindow *instance();
|
static MainWindow *instance();
|
||||||
ProfileGraphicsView *graphics();
|
|
||||||
MainTab *information();
|
MainTab *information();
|
||||||
void loadRecentFiles(QSettings *s);
|
void loadRecentFiles(QSettings *s);
|
||||||
void addRecentFile(const QStringList &newFiles);
|
void addRecentFile(const QStringList &newFiles);
|
||||||
|
@ -77,7 +76,7 @@ public:
|
||||||
void loadFiles(const QStringList files);
|
void loadFiles(const QStringList files);
|
||||||
void importFiles(const QStringList importFiles);
|
void importFiles(const QStringList importFiles);
|
||||||
void cleanUpEmpty();
|
void cleanUpEmpty();
|
||||||
QTabWidget *tabWidget();
|
ProfileWidget2 *graphics() const;
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
/* file menu action */
|
/* file menu action */
|
||||||
|
@ -119,10 +118,6 @@ slots:
|
||||||
void on_actionUserManual_triggered();
|
void on_actionUserManual_triggered();
|
||||||
void on_actionDivePlanner_triggered();
|
void on_actionDivePlanner_triggered();
|
||||||
|
|
||||||
/* monitor resize of the info-profile splitter */
|
|
||||||
void on_mainSplitter_splitterMoved(int pos, int idx);
|
|
||||||
void on_infoProfileSplitter_splitterMoved(int pos, int idx);
|
|
||||||
|
|
||||||
void current_dive_changed(int divenr);
|
void current_dive_changed(int divenr);
|
||||||
void initialUiSetup();
|
void initialUiSetup();
|
||||||
|
|
||||||
|
@ -163,7 +158,6 @@ private:
|
||||||
static MainWindow *m_Instance;
|
static MainWindow *m_Instance;
|
||||||
bool askSaveChanges();
|
bool askSaveChanges();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void redrawProfile();
|
|
||||||
void file_save();
|
void file_save();
|
||||||
void file_save_as();
|
void file_save_as();
|
||||||
void beginChangeState(CurrentState s);
|
void beginChangeState(CurrentState s);
|
||||||
|
|
|
@ -90,10 +90,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_5">
|
<widget class="QWidget" name="page_5">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -106,60 +103,10 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Old Profile</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<item>
|
|
||||||
<widget class="ProfileGraphicsView" name="ProfileWidget"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>New Profile</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<item row="0" column="0">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="profPO2">
|
<widget class="QToolButton" name="profPO2">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable the pO2 Graph</string>
|
<string>Enable the pO2 Graph</string>
|
||||||
|
@ -185,7 +132,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QToolButton" name="profPn2">
|
<widget class="QToolButton" name="profPn2">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable the pN2 Graph</string>
|
<string>Enable the pN2 Graph</string>
|
||||||
|
@ -211,7 +158,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<widget class="QToolButton" name="profPhe">
|
<widget class="QToolButton" name="profPhe">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable the pHe graph</string>
|
<string>Enable the pHe graph</string>
|
||||||
|
@ -237,7 +184,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="3" column="0">
|
||||||
<widget class="QToolButton" name="profDcCeiling">
|
<widget class="QToolButton" name="profDcCeiling">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -266,7 +213,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="4" column="0">
|
||||||
<widget class="QToolButton" name="profCalcCeiling">
|
<widget class="QToolButton" name="profCalcCeiling">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -295,7 +242,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="5" column="0">
|
||||||
<widget class="QToolButton" name="profCalcAllTissues">
|
<widget class="QToolButton" name="profCalcAllTissues">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Calculate All Tissues</string>
|
<string>Calculate All Tissues</string>
|
||||||
|
@ -321,7 +268,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="6" column="0">
|
||||||
<widget class="QToolButton" name="profIncrement3m">
|
<widget class="QToolButton" name="profIncrement3m">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Show Calculated Ceiling with 3m Increments</string>
|
<string>Show Calculated Ceiling with 3m Increments</string>
|
||||||
|
@ -347,7 +294,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="7" column="0">
|
||||||
<widget class="QToolButton" name="profMod">
|
<widget class="QToolButton" name="profMod">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable MOD</string>
|
<string>Enable MOD</string>
|
||||||
|
@ -373,7 +320,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="8" column="0">
|
||||||
<widget class="QToolButton" name="profEad">
|
<widget class="QToolButton" name="profEad">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable EAD, END, and EADD</string>
|
<string>Enable EAD, END, and EADD</string>
|
||||||
|
@ -399,7 +346,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="9" column="0">
|
||||||
<widget class="QToolButton" name="profNdl_tts">
|
<widget class="QToolButton" name="profNdl_tts">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Show NDL / TTS</string>
|
<string>Show NDL / TTS</string>
|
||||||
|
@ -425,7 +372,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="10" column="0">
|
||||||
<widget class="QToolButton" name="profSAC">
|
<widget class="QToolButton" name="profSAC">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Show SAC Rate</string>
|
<string>Show SAC Rate</string>
|
||||||
|
@ -451,7 +398,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="11" column="0">
|
||||||
<widget class="QToolButton" name="profRuler">
|
<widget class="QToolButton" name="profRuler">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable / Disable the Ruler</string>
|
<string>Enable / Disable the Ruler</string>
|
||||||
|
@ -477,7 +424,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="12" column="0">
|
||||||
<widget class="QToolButton" name="profScaled">
|
<widget class="QToolButton" name="profScaled">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Rescale depth axis</string>
|
<string>Rescale depth axis</string>
|
||||||
|
@ -503,7 +450,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1" rowspan="14">
|
||||||
|
<widget class="ProfileWidget2" name="newProfile"/>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -518,16 +468,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="ProfileWidget2" name="newProfile"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="page_6">
|
<widget class="QWidget" name="page_6">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -597,7 +537,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1418</width>
|
<width>1418</width>
|
||||||
<height>22</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
@ -983,11 +923,6 @@
|
||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>divelistview.h</header>
|
<header>divelistview.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>ProfileGraphicsView</class>
|
|
||||||
<extends>QGraphicsView</extends>
|
|
||||||
<header>profilegraphics.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GlobeGPS</class>
|
<class>GlobeGPS</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
|
|
@ -131,18 +131,16 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
|
||||||
painter.scale(scaleX, scaleY);
|
painter.scale(scaleX, scaleY);
|
||||||
|
|
||||||
// setup the profile widget
|
// setup the profile widget
|
||||||
ProfileGraphicsView *profile = MainWindow::instance()->graphics();
|
ProfileWidget2 profile;
|
||||||
const int profileFrameStyle = profile->frameStyle();
|
profile.setFrameStyle(QFrame::NoFrame);
|
||||||
profile->setFrameStyle(QFrame::NoFrame);
|
// profile->setPrintMode(true, !printOptions->color_selected);
|
||||||
profile->clear();
|
|
||||||
profile->setPrintMode(true, !printOptions->color_selected);
|
|
||||||
QSize originalSize = profile->size();
|
|
||||||
// swap rows/col for landscape
|
// swap rows/col for landscape
|
||||||
if (printer->orientation() == QPrinter::Landscape) {
|
if (printer->orientation() == QPrinter::Landscape) {
|
||||||
int swap = divesPerColumn;
|
int swap = divesPerColumn;
|
||||||
divesPerColumn = divesPerRow;
|
divesPerColumn = divesPerRow;
|
||||||
divesPerRow = swap;
|
divesPerRow = swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// padding in pixels between two dives. no padding if only one dive per page.
|
// padding in pixels between two dives. no padding if only one dive per page.
|
||||||
const int padDef = 20;
|
const int padDef = 20;
|
||||||
const int padW = (divesPerColumn < 2) ? 0 : padDef;
|
const int padW = (divesPerColumn < 2) ? 0 : padDef;
|
||||||
|
@ -154,11 +152,11 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
|
||||||
const int padPT = 5;
|
const int padPT = 5;
|
||||||
// create a model and table
|
// create a model and table
|
||||||
ProfilePrintModel model;
|
ProfilePrintModel model;
|
||||||
QTableView *table = createProfileTable(&model, scaledW);
|
QPointer<QTableView> table(createProfileTable(&model, scaledW));
|
||||||
// profilePrintTableMaxH updates after the table is created
|
// profilePrintTableMaxH updates after the table is created
|
||||||
const int tableH = profilePrintTableMaxH;
|
const int tableH = profilePrintTableMaxH;
|
||||||
// resize the profile widget
|
// resize the profile widget
|
||||||
profile->resize(scaledW, scaledH - tableH - padPT);
|
profile.resize(scaledW, scaledH - tableH - padPT);
|
||||||
// offset table or profile on top
|
// offset table or profile on top
|
||||||
int yOffsetProfile = 0, yOffsetTable = 0;
|
int yOffsetProfile = 0, yOffsetTable = 0;
|
||||||
if (printOptions->notes_up)
|
if (printOptions->notes_up)
|
||||||
|
@ -182,8 +180,8 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
|
||||||
|
|
||||||
// draw a profile
|
// draw a profile
|
||||||
painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile);
|
painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile);
|
||||||
profile->plot(dive, true);
|
profile.plotDives( QList<struct dive*>() << dive);
|
||||||
profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT));
|
profile.render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT));
|
||||||
painter.setTransform(origTransform);
|
painter.setTransform(origTransform);
|
||||||
|
|
||||||
// draw a table
|
// draw a table
|
||||||
|
@ -195,15 +193,6 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
|
||||||
printed++;
|
printed++;
|
||||||
emit signalProgress((printed * 100) / total);
|
emit signalProgress((printed * 100) / total);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cleanup
|
|
||||||
painter.end();
|
|
||||||
delete table;
|
|
||||||
profile->setFrameStyle(profileFrameStyle);
|
|
||||||
profile->setPrintMode(false);
|
|
||||||
profile->resize(originalSize);
|
|
||||||
profile->clear();
|
|
||||||
profile->plot(current_dive, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we create a table that has a fixed height, but can stretch to fit certain width */
|
/* we create a table that has a fixed height, but can stretch to fit certain width */
|
||||||
|
|
|
@ -94,7 +94,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
QTableView *diveDepthTableView = new QTableView();
|
QTableView *diveDepthTableView = new QTableView();
|
||||||
diveDepthTableView->setModel(dataModel);
|
diveDepthTableView->setModel(dataModel);
|
||||||
MainWindow::instance()->tabWidget()->addTab(diveDepthTableView, "Depth Model");
|
diveDepthTableView->show();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
||||||
action->setData(event->globalPos());
|
action->setData(event->globalPos());
|
||||||
QList<QGraphicsItem *> itemsAtPos = scene()->items(mapToScene(mapFromGlobal(event->globalPos())));
|
QList<QGraphicsItem *> itemsAtPos = scene()->items(mapToScene(mapFromGlobal(event->globalPos())));
|
||||||
Q_FOREACH(QGraphicsItem * i, itemsAtPos) {
|
Q_FOREACH(QGraphicsItem * i, itemsAtPos) {
|
||||||
EventItem *item = dynamic_cast<EventItem *>(i);
|
DiveEventItem *item = dynamic_cast<DiveEventItem *>(i);
|
||||||
if (!item)
|
if (!item)
|
||||||
continue;
|
continue;
|
||||||
action = new QAction(&m);
|
action = new QAction(&m);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
COLUMNS
|
COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
ProfileWidget2(QWidget *parent);
|
ProfileWidget2(QWidget *parent = 0);
|
||||||
void plotDives(QList<dive *> dives);
|
void plotDives(QList<dive *> dives);
|
||||||
virtual bool eventFilter(QObject *, QEvent *);
|
virtual bool eventFilter(QObject *, QEvent *);
|
||||||
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "../dive.h"
|
#include "../dive.h"
|
||||||
#include "../divelist.h"
|
#include "../divelist.h"
|
||||||
|
#include "../display.h"
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
#include <unistd.h> // for dup(2)
|
#include <unistd.h> // for dup(2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue