summaryrefslogtreecommitdiffstats
path: root/qt-ui/printlayout.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-03-07 12:42:13 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-07 08:54:20 -0800
commitac9a23ef3b6942093bc33a5ee4fac89bec665581 (patch)
tree853eb19996b1edb321fc9d7836cf473866fa3368 /qt-ui/printlayout.cpp
parent6dec4b055601526a0c8bf9e45dfe0ff648d80489 (diff)
downloadsubsurface-ac9a23ef3b6942093bc33a5ee4fac89bec665581.tar.gz
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>
Diffstat (limited to 'qt-ui/printlayout.cpp')
-rw-r--r--qt-ui/printlayout.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp
index e06bedaa2..b84f2ecea 100644
--- a/qt-ui/printlayout.cpp
+++ b/qt-ui/printlayout.cpp
@@ -131,18 +131,16 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
painter.scale(scaleX, scaleY);
// setup the profile widget
- ProfileGraphicsView *profile = MainWindow::instance()->graphics();
- const int profileFrameStyle = profile->frameStyle();
- profile->setFrameStyle(QFrame::NoFrame);
- profile->clear();
- profile->setPrintMode(true, !printOptions->color_selected);
- QSize originalSize = profile->size();
+ ProfileWidget2 profile;
+ profile.setFrameStyle(QFrame::NoFrame);
+// profile->setPrintMode(true, !printOptions->color_selected);
// swap rows/col for landscape
if (printer->orientation() == QPrinter::Landscape) {
int swap = divesPerColumn;
divesPerColumn = divesPerRow;
divesPerRow = swap;
}
+
// padding in pixels between two dives. no padding if only one dive per page.
const int padDef = 20;
const int padW = (divesPerColumn < 2) ? 0 : padDef;
@@ -154,11 +152,11 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
const int padPT = 5;
// create a model and table
ProfilePrintModel model;
- QTableView *table = createProfileTable(&model, scaledW);
+ QPointer<QTableView> table(createProfileTable(&model, scaledW));
// profilePrintTableMaxH updates after the table is created
const int tableH = profilePrintTableMaxH;
// resize the profile widget
- profile->resize(scaledW, scaledH - tableH - padPT);
+ profile.resize(scaledW, scaledH - tableH - padPT);
// offset table or profile on top
int yOffsetProfile = 0, yOffsetTable = 0;
if (printOptions->notes_up)
@@ -182,8 +180,8 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
// draw a profile
painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile);
- profile->plot(dive, true);
- profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT));
+ profile.plotDives( QList<struct dive*>() << dive);
+ profile.render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT));
painter.setTransform(origTransform);
// draw a table
@@ -195,15 +193,6 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
printed++;
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 */