mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Merge branch 'bugfixes' of git://github.com/tcanabrava/subsurface
This commit is contained in:
commit
f63605e02e
6 changed files with 43 additions and 57 deletions
3
main.cpp
3
main.cpp
|
@ -52,9 +52,10 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (no_filenames) {
|
if (no_filenames) {
|
||||||
|
QString defaultFile(prefs.default_filename);
|
||||||
|
if (!defaultFile.isEmpty())
|
||||||
files.push_back( QString(prefs.default_filename) );
|
files.push_back( QString(prefs.default_filename) );
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_xml_exit();
|
parse_xml_exit();
|
||||||
subsurface_command_line_exit(&argc, &argv);
|
subsurface_command_line_exit(&argc, &argv);
|
||||||
mainWindow()->loadFiles(files);
|
mainWindow()->loadFiles(files);
|
||||||
|
|
12
pref.h
12
pref.h
|
@ -6,17 +6,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* can't use 'bool' for the boolean values - different size in C and C++ */
|
/* can't use 'bool' for the boolean values - different size in C and C++ */
|
||||||
typedef struct {
|
|
||||||
short cylinder;
|
|
||||||
short temperature;
|
|
||||||
short totalweight;
|
|
||||||
short suit;
|
|
||||||
short nitrox;
|
|
||||||
short sac;
|
|
||||||
short otu;
|
|
||||||
short maxcns;
|
|
||||||
} visible_cols_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
short po2;
|
short po2;
|
||||||
short pn2;
|
short pn2;
|
||||||
|
@ -30,7 +19,6 @@ struct preferences {
|
||||||
const char *divelist_font;
|
const char *divelist_font;
|
||||||
const char *default_filename;
|
const char *default_filename;
|
||||||
double font_size;
|
double font_size;
|
||||||
visible_cols_t visible_cols;
|
|
||||||
partial_pressure_graphs_t pp_graphs;
|
partial_pressure_graphs_t pp_graphs;
|
||||||
short mod;
|
short mod;
|
||||||
double mod_ppO2;
|
double mod_ppO2;
|
||||||
|
|
17
prefs.c
17
prefs.c
|
@ -81,15 +81,6 @@ void save_preferences(void)
|
||||||
SAVE_UNIT("fahrenheit", temperature, FAHRENHEIT);
|
SAVE_UNIT("fahrenheit", temperature, FAHRENHEIT);
|
||||||
SAVE_UNIT("lbs", weight, LBS);
|
SAVE_UNIT("lbs", weight, LBS);
|
||||||
|
|
||||||
SAVE_BOOL("TEMPERATURE", visible_cols.temperature);
|
|
||||||
SAVE_BOOL("TOTALWEIGHT", visible_cols.totalweight);
|
|
||||||
SAVE_BOOL("SUIT", visible_cols.suit);
|
|
||||||
SAVE_BOOL("CYLINDER", visible_cols.cylinder);
|
|
||||||
SAVE_BOOL("NITROX", visible_cols.nitrox);
|
|
||||||
SAVE_BOOL("SAC", visible_cols.sac);
|
|
||||||
SAVE_BOOL("OTU", visible_cols.otu);
|
|
||||||
SAVE_BOOL("MAXCNS", visible_cols.maxcns);
|
|
||||||
|
|
||||||
SAVE_STRING("divelist_font", divelist_font);
|
SAVE_STRING("divelist_font", divelist_font);
|
||||||
|
|
||||||
SAVE_BOOL("po2graph", pp_graphs.po2);
|
SAVE_BOOL("po2graph", pp_graphs.po2);
|
||||||
|
@ -144,14 +135,6 @@ void load_preferences(void)
|
||||||
GET_UNIT("lbs", weight, KG, LBS);
|
GET_UNIT("lbs", weight, KG, LBS);
|
||||||
|
|
||||||
/* an unset key is 'default' */
|
/* an unset key is 'default' */
|
||||||
GET_BOOL("CYLINDER", visible_cols.cylinder);
|
|
||||||
GET_BOOL("TEMPERATURE", visible_cols.temperature);
|
|
||||||
GET_BOOL("TOTALWEIGHT", visible_cols.totalweight);
|
|
||||||
GET_BOOL("SUIT", visible_cols.suit);
|
|
||||||
GET_BOOL("NITROX", visible_cols.nitrox);
|
|
||||||
GET_BOOL("OTU", visible_cols.otu);
|
|
||||||
GET_BOOL("MAXCNS", visible_cols.maxcns);
|
|
||||||
GET_BOOL("SAC", visible_cols.sac);
|
|
||||||
GET_BOOL("po2graph", pp_graphs.po2);
|
GET_BOOL("po2graph", pp_graphs.po2);
|
||||||
GET_BOOL("pn2graph", pp_graphs.pn2);
|
GET_BOOL("pn2graph", pp_graphs.pn2);
|
||||||
GET_BOOL("phegraph", pp_graphs.phe);
|
GET_BOOL("phegraph", pp_graphs.phe);
|
||||||
|
|
|
@ -192,7 +192,16 @@ void DiveListView::reloadHeaderActions()
|
||||||
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
|
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
|
||||||
QString settingName = QString("showColumn%1").arg(i);
|
QString settingName = QString("showColumn%1").arg(i);
|
||||||
QAction *a = new QAction(title, header());
|
QAction *a = new QAction(title, header());
|
||||||
bool shown = s.value(settingName, true).toBool();
|
bool showHeaderFirstRun = !(
|
||||||
|
i == DiveTripModel::MAXCNS
|
||||||
|
|| i == DiveTripModel::NITROX
|
||||||
|
|| i == DiveTripModel::OTU
|
||||||
|
|| i == DiveTripModel::TEMPERATURE
|
||||||
|
|| i == DiveTripModel::TOTALWEIGHT
|
||||||
|
|| i == DiveTripModel::SUIT
|
||||||
|
|| i == DiveTripModel::CYLINDER
|
||||||
|
|| i == DiveTripModel::SAC );
|
||||||
|
bool shown = s.value(settingName, showHeaderFirstRun).toBool();
|
||||||
a->setCheckable(true);
|
a->setCheckable(true);
|
||||||
a->setChecked(shown);
|
a->setChecked(shown);
|
||||||
a->setProperty("index", i);
|
a->setProperty("index", i);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QWebView>
|
#include <QWebView>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include "divelistview.h"
|
#include "divelistview.h"
|
||||||
#include "starwidget.h"
|
#include "starwidget.h"
|
||||||
|
|
||||||
|
@ -504,11 +505,30 @@ void MainWindow::initialUiSetup()
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
QSize sz = settings.value("size").value<QSize>();
|
QSize sz = settings.value("size", qApp->desktop()->size()).value<QSize>();
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
|
||||||
|
if (settings.value("mainSplitter").isValid()){
|
||||||
ui.mainSplitter->restoreState(settings.value("mainSplitter").toByteArray());
|
ui.mainSplitter->restoreState(settings.value("mainSplitter").toByteArray());
|
||||||
ui.infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray());
|
ui.infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray());
|
||||||
ui.listGlobeSplitter->restoreState(settings.value("listGlobeSplitter").toByteArray());
|
ui.listGlobeSplitter->restoreState(settings.value("listGlobeSplitter").toByteArray());
|
||||||
|
} else {
|
||||||
|
QList<int> mainSizes;
|
||||||
|
mainSizes.append( qApp->desktop()->size().height() * 0.7 );
|
||||||
|
mainSizes.append( qApp->desktop()->size().height() * 0.3 );
|
||||||
|
ui.mainSplitter->setSizes( mainSizes );
|
||||||
|
|
||||||
|
QList<int> infoProfileSizes;
|
||||||
|
infoProfileSizes.append( qApp->desktop()->size().width() * 0.3 );
|
||||||
|
infoProfileSizes.append( qApp->desktop()->size().width() * 0.7 );
|
||||||
|
ui.infoProfileSplitter->setSizes(infoProfileSizes);
|
||||||
|
|
||||||
|
QList<int> listGlobeSizes;
|
||||||
|
listGlobeSizes.append( qApp->desktop()->size().width() * 0.7 );
|
||||||
|
listGlobeSizes.append( qApp->desktop()->size().width() * 0.3 );
|
||||||
|
ui.listGlobeSplitter->setSizes(listGlobeSizes);
|
||||||
|
}
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("ListWidget");
|
settings.beginGroup("ListWidget");
|
||||||
|
@ -550,16 +570,6 @@ void MainWindow::readSettings()
|
||||||
}
|
}
|
||||||
GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
|
GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
s.beginGroup("DisplayListColumns");
|
|
||||||
GET_BOOL("CYLINDER", visible_cols.cylinder);
|
|
||||||
GET_BOOL("TEMPERATURE", visible_cols.temperature);
|
|
||||||
GET_BOOL("TOTALWEIGHT", visible_cols.totalweight);
|
|
||||||
GET_BOOL("SUIT", visible_cols.suit);
|
|
||||||
GET_BOOL("NITROX", visible_cols.nitrox);
|
|
||||||
GET_BOOL("OTU", visible_cols.otu);
|
|
||||||
GET_BOOL("MAXCNS", visible_cols.maxcns);
|
|
||||||
GET_BOOL("SAC", visible_cols.sac);
|
|
||||||
s.endGroup();
|
|
||||||
s.beginGroup("TecDetails");
|
s.beginGroup("TecDetails");
|
||||||
GET_BOOL("po2graph", pp_graphs.po2);
|
GET_BOOL("po2graph", pp_graphs.po2);
|
||||||
GET_BOOL("pn2graph", pp_graphs.pn2);
|
GET_BOOL("pn2graph", pp_graphs.pn2);
|
||||||
|
@ -618,16 +628,6 @@ void MainWindow::writeSettings()
|
||||||
SAVE_VALUE("weight", units.weight);
|
SAVE_VALUE("weight", units.weight);
|
||||||
SAVE_VALUE("vertical_speed_time", units.vertical_speed_time);
|
SAVE_VALUE("vertical_speed_time", units.vertical_speed_time);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
settings.beginGroup("DisplayListColumns");
|
|
||||||
SAVE_VALUE("TEMPERATURE", visible_cols.temperature);
|
|
||||||
SAVE_VALUE("TOTALWEIGHT", visible_cols.totalweight);
|
|
||||||
SAVE_VALUE("SUIT", visible_cols.suit);
|
|
||||||
SAVE_VALUE("CYLINDER", visible_cols.cylinder);
|
|
||||||
SAVE_VALUE("NITROX", visible_cols.nitrox);
|
|
||||||
SAVE_VALUE("SAC", visible_cols.sac);
|
|
||||||
SAVE_VALUE("OTU", visible_cols.otu);
|
|
||||||
SAVE_VALUE("MAXCNS", visible_cols.maxcns);
|
|
||||||
settings.endGroup();
|
|
||||||
settings.beginGroup("TecDetails");
|
settings.beginGroup("TecDetails");
|
||||||
SAVE_VALUE("po2graph", pp_graphs.po2);
|
SAVE_VALUE("po2graph", pp_graphs.po2);
|
||||||
SAVE_VALUE("pn2graph", pp_graphs.pn2);
|
SAVE_VALUE("pn2graph", pp_graphs.pn2);
|
||||||
|
@ -751,6 +751,9 @@ void MainWindow::setTitle(enum MainWindowTitleFormat format)
|
||||||
|
|
||||||
void MainWindow::importFiles(const QStringList fileNames)
|
void MainWindow::importFiles(const QStringList fileNames)
|
||||||
{
|
{
|
||||||
|
if (fileNames.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QByteArray fileNamePtr;
|
QByteArray fileNamePtr;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
for (int i = 0; i < fileNames.size(); ++i) {
|
||||||
|
@ -774,6 +777,9 @@ void MainWindow::importFiles(const QStringList fileNames)
|
||||||
|
|
||||||
void MainWindow::loadFiles(const QStringList fileNames)
|
void MainWindow::loadFiles(const QStringList fileNames)
|
||||||
{
|
{
|
||||||
|
if (fileNames.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
QByteArray fileNamePtr;
|
QByteArray fileNamePtr;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ struct preferences prefs;
|
||||||
struct preferences default_prefs = {
|
struct preferences default_prefs = {
|
||||||
.units = SI_UNITS,
|
.units = SI_UNITS,
|
||||||
.unit_system = METRIC,
|
.unit_system = METRIC,
|
||||||
.visible_cols = { TRUE, FALSE, },
|
|
||||||
.pp_graphs = {
|
.pp_graphs = {
|
||||||
.po2 = FALSE,
|
.po2 = FALSE,
|
||||||
.pn2 = FALSE,
|
.pn2 = FALSE,
|
||||||
|
|
Loading…
Reference in a new issue