mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Store zoomed plot in preferences
This patch makes the 'Zoomed Plot' a preference that can be stored and retrieved, this way if the user sets the plot to be 'zoomed', this information will persist even if they closed or opened subsurface again. Also, added the 'Scale' button on the new profile, but didn't did the glue code yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0307f3d543
commit
8c56b2f45e
8 changed files with 41 additions and 16 deletions
|
@ -52,7 +52,7 @@ struct options {
|
|||
int profile_height, notes_height, tanks_height;
|
||||
};
|
||||
|
||||
extern char zoomed_plot, dc_number;
|
||||
extern char dc_number;
|
||||
|
||||
extern unsigned int amount_selected;
|
||||
|
||||
|
|
1
pref.h
1
pref.h
|
@ -38,6 +38,7 @@ struct preferences {
|
|||
struct units units;
|
||||
short show_sac;
|
||||
bool display_unused_tanks;
|
||||
bool zoomed_plot;
|
||||
};
|
||||
enum unit_system_values { METRIC, IMPERIAL, PERSONALIZE };
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "membuffer.h"
|
||||
|
||||
int selected_dive = -1; /* careful: 0 is a valid value */
|
||||
char zoomed_plot = 0;
|
||||
char dc_number = 0;
|
||||
|
||||
|
||||
|
@ -61,7 +60,7 @@ static void dump_pi (struct plot_info *pi)
|
|||
int get_maxtime(struct plot_info *pi)
|
||||
{
|
||||
int seconds = pi->maxtime;
|
||||
if (zoomed_plot) {
|
||||
if (prefs.zoomed_plot) {
|
||||
/* Rounded up to one minute, with at least 2.5 minutes to
|
||||
* spare.
|
||||
* For dive times shorter than 10 minutes, we use seconds/4 to
|
||||
|
@ -86,7 +85,7 @@ int get_maxdepth(struct plot_info *pi)
|
|||
unsigned mm = pi->maxdepth;
|
||||
int md;
|
||||
|
||||
if (zoomed_plot) {
|
||||
if (prefs.zoomed_plot) {
|
||||
/* Rounded up to 10m, with at least 3m to spare */
|
||||
md = ROUND_UP(mm+3000, 10000);
|
||||
} else {
|
||||
|
|
|
@ -364,12 +364,6 @@ void MainWindow::on_actionAutoGroup_triggered()
|
|||
mark_divelist_changed(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionToggleZoom_triggered()
|
||||
{
|
||||
zoomed_plot = !zoomed_plot;
|
||||
ui.ProfileWidget->refresh();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionYearlyStatistics_triggered()
|
||||
{
|
||||
QTreeView *view = new QTreeView();
|
||||
|
@ -1066,4 +1060,10 @@ void MainWindow::on_profSAC_clicked(bool triggered)
|
|||
TOOLBOX_PREF_PROFILE(show_sac);
|
||||
}
|
||||
|
||||
void MainWindow::on_profScaled_clicked(bool triggered)
|
||||
{
|
||||
prefs.zoomed_plot = triggered;
|
||||
TOOLBOX_PREF_PROFILE(zoomed_plot);
|
||||
}
|
||||
|
||||
#undef TOOLBOX_PREF_PROFILE
|
||||
|
|
|
@ -81,7 +81,6 @@ private slots:
|
|||
void on_actionAddDive_triggered();
|
||||
void on_actionRenumber_triggered();
|
||||
void on_actionAutoGroup_triggered();
|
||||
void on_actionToggleZoom_triggered();
|
||||
void on_actionYearlyStatistics_triggered();
|
||||
|
||||
/* view menu actions */
|
||||
|
@ -123,6 +122,7 @@ private slots:
|
|||
void on_profPn2_clicked(bool triggered);
|
||||
void on_profRuler_clicked(bool triggered);
|
||||
void on_profSAC_clicked(bool triggered);
|
||||
void on_profScaled_clicked(bool triggered);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>763</width>
|
||||
<height>667</height>
|
||||
<width>1418</width>
|
||||
<height>1084</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
|
@ -454,7 +454,7 @@
|
|||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<normaloff>:/flag</normaloff>:/flag</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
|
@ -471,6 +471,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="profScaled">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<normaloff>:/scale</normaloff>:/scale</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>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -564,7 +587,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>763</width>
|
||||
<width>1418</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
|
@ -264,6 +264,7 @@ void PreferencesDialog::loadSettings()
|
|||
GET_INT("gflow", gflow);
|
||||
GET_INT("gfhigh", gfhigh);
|
||||
GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth);
|
||||
GET_BOOL("zoomed_plot", zoomed_plot);
|
||||
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
|
||||
GET_BOOL("show_sac", show_sac);
|
||||
GET_BOOL("display_unused_tanks", display_unused_tanks);
|
||||
|
|
|
@ -1453,9 +1453,10 @@ void ProfileGraphicsView::on_rulerAction()
|
|||
|
||||
void ProfileGraphicsView::on_scaleAction()
|
||||
{
|
||||
zoomed_plot = !zoomed_plot;
|
||||
prefs.zoomed_plot = !prefs.zoomed_plot;
|
||||
refresh();
|
||||
}
|
||||
|
||||
QColor EventItem::getColor(const color_indice_t i)
|
||||
{
|
||||
return profile_color[i].at((isGrayscale) ? 1 : 0);
|
||||
|
|
Loading…
Reference in a new issue