mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	TankBar: hook into prefs and make ppGraphs resize accordingly
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									e71119b40b
								
							
						
					
					
						commit
						e8d430341c
					
				
					 7 changed files with 71 additions and 16 deletions
				
			
		
							
								
								
									
										1
									
								
								pref.h
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								pref.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -46,6 +46,7 @@ struct preferences {
 | 
			
		|||
	short zoomed_plot;
 | 
			
		||||
	short hrgraph;
 | 
			
		||||
	short rulergraph;
 | 
			
		||||
	short tankbar;
 | 
			
		||||
	short save_userid_local;
 | 
			
		||||
	char *userid;
 | 
			
		||||
	int ascrate75;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -242,6 +242,7 @@ void MainWindow::setToolButtonsEnabled(bool enabled)
 | 
			
		|||
	ui.profScaled->setEnabled(enabled);
 | 
			
		||||
	ui.profHR->setEnabled(enabled);
 | 
			
		||||
	ui.profTogglePicture->setEnabled(enabled);
 | 
			
		||||
	ui.profTankbar->setEnabled(enabled);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MainWindow::okToClose(QString message)
 | 
			
		||||
| 
						 | 
				
			
			@ -796,6 +797,7 @@ void MainWindow::readSettings()
 | 
			
		|||
	TOOLBOX_PREF_BUTTON(rulergraph, rulergraph, profRuler);
 | 
			
		||||
	TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC);
 | 
			
		||||
	TOOLBOX_PREF_BUTTON(show_pictures_in_profile, show_pictures_in_profile, profTogglePicture);
 | 
			
		||||
	TOOLBOX_PREF_BUTTON(tankbar, tankbar, profTankbar);
 | 
			
		||||
	s.endGroup();
 | 
			
		||||
	s.beginGroup("DiveComputer");
 | 
			
		||||
	default_dive_computer_vendor = getSetting(s, "dive_computer_vendor");
 | 
			
		||||
| 
						 | 
				
			
			@ -1270,6 +1272,7 @@ TOOLBOX_PREF_PROFILE(profRuler, rulergraph, rulergraph);
 | 
			
		|||
TOOLBOX_PREF_PROFILE(profSAC, show_sac, show_sac);
 | 
			
		||||
TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot);
 | 
			
		||||
TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile);
 | 
			
		||||
TOOLBOX_PREF_PROFILE(profTankbar, tankbar, tankbar);
 | 
			
		||||
 | 
			
		||||
void MainWindow::turnOffNdlTts()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1289,10 +1292,11 @@ void MainWindow::on_actionExport_triggered()
 | 
			
		|||
 | 
			
		||||
void MainWindow::setEnabledToolbar(bool arg1)
 | 
			
		||||
{
 | 
			
		||||
	 QList<QToolButton*> toolBar; toolBar << ui.profCalcAllTissues << ui.profCalcCeiling
 | 
			
		||||
		<< ui.profDcCeiling << ui.profEad << ui.profHR << ui.profIncrement3m
 | 
			
		||||
		<< ui.profMod << ui.profNdl_tts << ui.profNdl_tts << ui.profPhe << ui.profPn2
 | 
			
		||||
		<< ui.profPO2 << ui.profRuler << ui.profSAC << ui.profScaled << ui.profTogglePicture;
 | 
			
		||||
	 QList<QToolButton*> toolBar;
 | 
			
		||||
	 toolBar << ui.profCalcAllTissues << ui.profCalcCeiling << ui.profDcCeiling << ui.profEad <<
 | 
			
		||||
		    ui.profHR << ui.profIncrement3m << ui.profMod << ui.profNdl_tts << ui.profNdl_tts <<
 | 
			
		||||
		    ui.profPhe << ui.profPn2 << ui.profPO2 << ui.profRuler << ui.profSAC << ui.profScaled <<
 | 
			
		||||
		    ui.profTogglePicture << ui.profTankbar;
 | 
			
		||||
	Q_FOREACH(QToolButton *b, toolBar)
 | 
			
		||||
		b->setEnabled(arg1);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -141,6 +141,7 @@ slots:
 | 
			
		|||
	void on_profSAC_clicked(bool triggered);
 | 
			
		||||
	void on_profScaled_clicked(bool triggered);
 | 
			
		||||
	void on_profTogglePicture_clicked(bool triggered);
 | 
			
		||||
	void on_profTankbar_clicked(bool triggered);
 | 
			
		||||
	void on_actionExport_triggered();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,7 +109,7 @@
 | 
			
		|||
         <property name="spacing">
 | 
			
		||||
          <number>0</number>
 | 
			
		||||
         </property>
 | 
			
		||||
         <item row="15" column="0">
 | 
			
		||||
         <item row="17" column="0">
 | 
			
		||||
          <spacer name="verticalSpacer">
 | 
			
		||||
           <property name="orientation">
 | 
			
		||||
            <enum>Qt::Vertical</enum>
 | 
			
		||||
| 
						 | 
				
			
			@ -440,6 +440,9 @@
 | 
			
		|||
           </property>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="0" column="1" rowspan="19">
 | 
			
		||||
          <widget class="ProfileWidget2" name="newProfile"/>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="0" column="0">
 | 
			
		||||
          <widget class="QToolButton" name="profPO2">
 | 
			
		||||
           <property name="toolTip">
 | 
			
		||||
| 
						 | 
				
			
			@ -466,9 +469,6 @@
 | 
			
		|||
           </property>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="0" column="1" rowspan="16">
 | 
			
		||||
          <widget class="ProfileWidget2" name="newProfile"/>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="1" column="0">
 | 
			
		||||
          <widget class="QToolButton" name="profPn2">
 | 
			
		||||
           <property name="toolTip">
 | 
			
		||||
| 
						 | 
				
			
			@ -495,6 +495,32 @@
 | 
			
		|||
           </property>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="15" column="0">
 | 
			
		||||
          <widget class="QToolButton" name="profTankbar">
 | 
			
		||||
           <property name="toolTip">
 | 
			
		||||
            <string>Toggle Cylinder Bar</string>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="text">
 | 
			
		||||
            <string>...</string>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="icon">
 | 
			
		||||
            <iconset resource="../subsurface.qrc">
 | 
			
		||||
             <normaloff>:/gaschange</normaloff>:/gaschange</iconset>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="iconSize">
 | 
			
		||||
            <size>
 | 
			
		||||
             <width>24</width>
 | 
			
		||||
             <height>24</height>
 | 
			
		||||
            </size>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="checkable">
 | 
			
		||||
            <bool>true</bool>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="autoRaise">
 | 
			
		||||
            <bool>true</bool>
 | 
			
		||||
           </property>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="14" column="0">
 | 
			
		||||
          <widget class="QToolButton" name="profTogglePicture">
 | 
			
		||||
           <property name="toolTip">
 | 
			
		||||
| 
						 | 
				
			
			@ -664,7 +690,7 @@ p, li { white-space: pre-wrap; }
 | 
			
		|||
     <x>0</x>
 | 
			
		||||
     <y>0</y>
 | 
			
		||||
     <width>1682</width>
 | 
			
		||||
     <height>27</height>
 | 
			
		||||
     <height>19</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <widget class="QMenu" name="menuFile">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -315,6 +315,7 @@ void PreferencesDialog::loadSettings()
 | 
			
		|||
	GET_BOOL("calcndltts", calcndltts);
 | 
			
		||||
	GET_BOOL("calcalltissues", calcalltissues);
 | 
			
		||||
	GET_BOOL("hrgraph", hrgraph);
 | 
			
		||||
	GET_BOOL("tankbar", tankbar);
 | 
			
		||||
	GET_INT("gflow", gflow);
 | 
			
		||||
	GET_INT("gfhigh", gfhigh);
 | 
			
		||||
	GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,6 +56,7 @@ static struct _ItemPos {
 | 
			
		|||
	_Pos tankBar;
 | 
			
		||||
	_Axis depth;
 | 
			
		||||
	_Axis partialPressure;
 | 
			
		||||
	_Axis partialPressureWithTankBar;
 | 
			
		||||
	_Axis time;
 | 
			
		||||
	_Axis cylinder;
 | 
			
		||||
	_Axis temperature;
 | 
			
		||||
| 
						 | 
				
			
			@ -306,7 +307,9 @@ void ProfileWidget2::setupItemSizes()
 | 
			
		|||
	itemPos.partialPressure.pos.off.setX(110);
 | 
			
		||||
	itemPos.partialPressure.pos.off.setY(63);
 | 
			
		||||
	itemPos.partialPressure.expanded.setP1(QPointF(0, 0));
 | 
			
		||||
	itemPos.partialPressure.expanded.setP2(QPointF(0, 27));
 | 
			
		||||
	itemPos.partialPressure.expanded.setP2(QPointF(0, 30));
 | 
			
		||||
	itemPos.partialPressureWithTankBar = itemPos.partialPressure;
 | 
			
		||||
	itemPos.partialPressureWithTankBar.expanded.setP2(QPointF(0, 27));
 | 
			
		||||
 | 
			
		||||
	// cylinder axis config
 | 
			
		||||
	itemPos.cylinder.pos.on.setX(3);
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +421,14 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
 | 
			
		|||
	// reset some item visibility on printMode changes
 | 
			
		||||
	toolTipItem->setVisible(!printMode);
 | 
			
		||||
	rulerItem->setVisible(prefs.rulergraph && !printMode);
 | 
			
		||||
	tankItem->setVisible(true);
 | 
			
		||||
	tankItem->setVisible(prefs.tankbar);
 | 
			
		||||
	if (prefs.tankbar) {
 | 
			
		||||
		gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
 | 
			
		||||
		gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
 | 
			
		||||
	} else {
 | 
			
		||||
		gasYAxis->setPos(itemPos.partialPressure.pos.on);
 | 
			
		||||
		gasYAxis->setLine(itemPos.partialPressure.expanded);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (currentState == EMPTY)
 | 
			
		||||
		setProfileState();
 | 
			
		||||
| 
						 | 
				
			
			@ -563,6 +573,13 @@ void ProfileWidget2::settingsChanged()
 | 
			
		|||
		temperatureAxis->animateChangeLine(itemPos.temperature.expanded);
 | 
			
		||||
		cylinderPressureAxis->animateChangeLine(itemPos.cylinder.expanded);
 | 
			
		||||
	}
 | 
			
		||||
	if (prefs.tankbar) {
 | 
			
		||||
		gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
 | 
			
		||||
		gasYAxis->animateChangeLine(itemPos.partialPressureWithTankBar.expanded);
 | 
			
		||||
	} else {
 | 
			
		||||
		gasYAxis->setPos(itemPos.partialPressure.pos.on);
 | 
			
		||||
		gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
 | 
			
		||||
	}
 | 
			
		||||
	if (prefs.zoomed_plot != isPlotZoomed) {
 | 
			
		||||
		isPlotZoomed = prefs.zoomed_plot;
 | 
			
		||||
		needReplot = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -796,9 +813,13 @@ void ProfileWidget2::setProfileState()
 | 
			
		|||
	po2GasItem->setVisible(prefs.pp_graphs.po2);
 | 
			
		||||
	pheGasItem->setVisible(prefs.pp_graphs.phe);
 | 
			
		||||
 | 
			
		||||
	gasYAxis->setPos(itemPos.partialPressure.pos.on);
 | 
			
		||||
	gasYAxis->setLine(itemPos.partialPressure.expanded);
 | 
			
		||||
 | 
			
		||||
	if (prefs.tankbar) {
 | 
			
		||||
		gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
 | 
			
		||||
		gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
 | 
			
		||||
	} else {
 | 
			
		||||
		gasYAxis->setPos(itemPos.partialPressure.pos.on);
 | 
			
		||||
		gasYAxis->setLine(itemPos.partialPressure.expanded);
 | 
			
		||||
	}
 | 
			
		||||
	timeAxis->setPos(itemPos.time.pos.on);
 | 
			
		||||
	timeAxis->setLine(itemPos.time.expanded);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -821,7 +842,7 @@ void ProfileWidget2::setProfileState()
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	rulerItem->setVisible(prefs.rulergraph);
 | 
			
		||||
	tankItem->setVisible(true);
 | 
			
		||||
	tankItem->setVisible(prefs.tankbar);
 | 
			
		||||
	tankItem->setPos(itemPos.tankBar.on);
 | 
			
		||||
 | 
			
		||||
	#define HIDE_ALL(TYPE, CONTAINER) \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,8 @@ struct preferences default_prefs = {
 | 
			
		|||
	.drop_stone_mode = false,
 | 
			
		||||
	.bottomsac = 20000,
 | 
			
		||||
	.decosac = 17000,
 | 
			
		||||
	.show_pictures_in_profile = true
 | 
			
		||||
	.show_pictures_in_profile = true,
 | 
			
		||||
	.tankbar = false
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int run_survey;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue