mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move the Profile out of the mainwindow.ui
And place it in mainwindow.cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6b038c2a9a
commit
4867ee8ad8
4 changed files with 17 additions and 104 deletions
|
@ -192,6 +192,9 @@ class PlannerDetails : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PlannerDetails(QWidget *parent = 0);
|
explicit PlannerDetails(QWidget *parent = 0);
|
||||||
|
QPushButton *printPlan() const { return ui.printPlan; }
|
||||||
|
QTextEdit *divePlanOutput() const { return ui.divePlanOutput; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::plannerDetails ui;
|
Ui::plannerDetails ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,6 +67,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
registerApplicationState("EditDive", mainTab, diveListView, profileWidget, globeGps );
|
registerApplicationState("EditDive", mainTab, diveListView, profileWidget, globeGps );
|
||||||
registerApplicationState("PlanDive", plannerWidget, plannerSettings, profileWidget, plannerDetails );
|
registerApplicationState("PlanDive", plannerWidget, plannerSettings, profileWidget, plannerDetails );
|
||||||
registerApplicationState("EditPlannedDive", plannerWidget, diveListView, profileWidget, globeGps );
|
registerApplicationState("EditPlannedDive", plannerWidget, diveListView, profileWidget, globeGps );
|
||||||
|
setApplicationState("Default");
|
||||||
|
|
||||||
ui.multiFilter->hide();
|
ui.multiFilter->hide();
|
||||||
// what is a sane order for those icons? we should have the ones the user is
|
// what is a sane order for those icons? we should have the ones the user is
|
||||||
|
@ -100,7 +101,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(information(), SIGNAL(addDiveFinished()), graphics(), SLOT(setProfileState()));
|
connect(information(), SIGNAL(addDiveFinished()), graphics(), SLOT(setProfileState()));
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
||||||
connect(ui.printPlan, SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
|
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
|
||||||
connect(ui.menu_Edit, SIGNAL(aboutToShow()), this, SLOT(checkForUndoAndRedo()));
|
connect(ui.menu_Edit, SIGNAL(aboutToShow()), this, SLOT(checkForUndoAndRedo()));
|
||||||
#ifdef NO_PRINTING
|
#ifdef NO_PRINTING
|
||||||
ui.printPlan->hide();
|
ui.printPlan->hide();
|
||||||
|
@ -176,7 +177,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
|
|
||||||
updateManager = new UpdateManager(this);
|
updateManager = new UpdateManager(this);
|
||||||
undoBuffer = new UndoBuffer(this);
|
undoBuffer = new UndoBuffer(this);
|
||||||
setApplicationState("Default");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -184,6 +184,10 @@ MainWindow::~MainWindow()
|
||||||
m_Instance = NULL;
|
m_Instance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlannerDetails *MainWindow::plannerDetails() const {
|
||||||
|
return qobject_cast<PlannerDetails*>(applicationState["PlanDive"].bottomRight);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::setLoadedWithFiles(bool f)
|
void MainWindow::setLoadedWithFiles(bool f)
|
||||||
{
|
{
|
||||||
filesAsArguments = f;
|
filesAsArguments = f;
|
||||||
|
@ -212,7 +216,8 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
|
||||||
#ifdef NO_MARBLE
|
#ifdef NO_MARBLE
|
||||||
ui.globePane->hide();
|
ui.globePane->hide();
|
||||||
#endif
|
#endif
|
||||||
ui.globePane->setCurrentIndex(0);
|
|
||||||
|
setApplicationState("Default");
|
||||||
dive_list()->setEnabled(true);
|
dive_list()->setEnabled(true);
|
||||||
dive_list()->setFocus();
|
dive_list()->setFocus();
|
||||||
WSInfoModel::instance()->updateInfo();
|
WSInfoModel::instance()->updateInfo();
|
||||||
|
@ -483,13 +488,13 @@ void MainWindow::planCreated()
|
||||||
|
|
||||||
void MainWindow::setPlanNotes(const char *notes)
|
void MainWindow::setPlanNotes(const char *notes)
|
||||||
{
|
{
|
||||||
ui.divePlanOutput->setHtml(notes);
|
plannerDetails()->divePlanOutput()->setHtml(notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::printPlan()
|
void MainWindow::printPlan()
|
||||||
{
|
{
|
||||||
#ifndef NO_PRINTING
|
#ifndef NO_PRINTING
|
||||||
QString diveplan = ui.divePlanOutput->toHtml();
|
QString diveplan = plannerDetails()->divePlanOutput()->toHtml();
|
||||||
QString withDisclaimer = QString("<img height=50 src=\":subsurface-icon\"> ") + diveplan + QString(disclaimer);
|
QString withDisclaimer = QString("<img height=50 src=\":subsurface-icon\"> ") + diveplan + QString(disclaimer);
|
||||||
|
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
@ -498,9 +503,9 @@ void MainWindow::printPlan()
|
||||||
if (dialog->exec() != QDialog::Accepted)
|
if (dialog->exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui.divePlanOutput->setHtml(withDisclaimer);
|
plannerDetails()->divePlanOutput()->setHtml(withDisclaimer);
|
||||||
ui.divePlanOutput->print(&printer);
|
plannerDetails()->divePlanOutput()->print(&printer);
|
||||||
ui.divePlanOutput->setHtml(diveplan);
|
plannerDetails()->divePlanOutput()->setHtml(diveplan);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,8 +539,6 @@ void MainWindow::on_actionReplanDive_triggered()
|
||||||
divePlannerWidget()->setReplanButton(true);
|
divePlannerWidget()->setReplanButton(true);
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
|
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&displayed_dive, true);
|
||||||
ui.diveListPane->setCurrentIndex(1); // switch to the plan output
|
|
||||||
ui.globePane->setCurrentIndex(1);
|
|
||||||
#ifdef NO_MARBLE
|
#ifdef NO_MARBLE
|
||||||
ui.globePane->show();
|
ui.globePane->show();
|
||||||
#endif
|
#endif
|
||||||
|
@ -559,8 +562,6 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
DivePictureModel::instance()->updateDivePictures();
|
DivePictureModel::instance()->updateDivePictures();
|
||||||
divePlannerWidget()->setReplanButton(false);
|
divePlannerWidget()->setReplanButton(false);
|
||||||
|
|
||||||
ui.diveListPane->setCurrentIndex(1); // switch to the plan output
|
|
||||||
ui.globePane->setCurrentIndex(1);
|
|
||||||
#ifdef NO_MARBLE
|
#ifdef NO_MARBLE
|
||||||
ui.globePane->show();
|
ui.globePane->show();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
void cleanUpEmpty();
|
void cleanUpEmpty();
|
||||||
void setToolButtonsEnabled(bool enabled);
|
void setToolButtonsEnabled(bool enabled);
|
||||||
ProfileWidget2 *graphics() const;
|
ProfileWidget2 *graphics() const;
|
||||||
|
PlannerDetails *plannerDetails() const;
|
||||||
void setLoadedWithFiles(bool filesFromCommandLine);
|
void setLoadedWithFiles(bool filesFromCommandLine);
|
||||||
bool filesFromCommandLine() const;
|
bool filesFromCommandLine() const;
|
||||||
void setPlanNotes(const char *notes);
|
void setPlanNotes(const char *notes);
|
||||||
|
|
|
@ -41,98 +41,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="PlannerSettingsWidget" name="plannerSettingsWidget"/>
|
<widget class="PlannerSettingsWidget" name="plannerSettingsWidget"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStackedWidget" name="globePane">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="stackedWidgetPage1">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="globeLayout"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="page_5">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="divePlanLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="divePlanOutputLabel">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string><html><head/><body><p><span style=" font-weight:600;">Dive plan details</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="textFormat">
|
|
||||||
<enum>Qt::RichText</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="printPlan">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Print</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="divePlanOutput">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">font: 13pt "Courier";</string>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="html">
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'Courier'; font-size:13pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'.Curier New';"><br /></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Reference in a new issue