mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Enable defautl_filename in settings
We don't have a UI to set it, yet, so you have to manually set it in the config file, but once you do that it works... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
aea8493165
commit
ed6a54f506
2 changed files with 15 additions and 6 deletions
12
qt-gui.cpp
12
qt-gui.cpp
|
@ -27,6 +27,7 @@
|
|||
#include <QStringList>
|
||||
#include <QTextCodec>
|
||||
#include <QTranslator>
|
||||
#include <QSettings>
|
||||
|
||||
class Translator: public QTranslator
|
||||
{
|
||||
|
@ -65,6 +66,7 @@ void init_qt_ui(int *argcp, char ***argvp)
|
|||
|
||||
void init_ui(int *argcp, char ***argvp)
|
||||
{
|
||||
QVariant v;
|
||||
application = new QApplication(*argcp, *argvp);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
|
@ -75,6 +77,16 @@ void init_ui(int *argcp, char ***argvp)
|
|||
QTextCodec::setCodecForCStrings(QTextCodec::codecForMib(106));
|
||||
#endif
|
||||
|
||||
QSettings settings("hohndel.org","subsurface");
|
||||
settings.beginGroup("GeneralSettings");
|
||||
v = settings.value(QString("default_filename"));
|
||||
if (v.isValid()) {
|
||||
QString name = v.toString();
|
||||
prefs.default_filename = strdup(name.toUtf8());
|
||||
qDebug("default filename %s", prefs.default_filename);
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
#if 0
|
||||
subsurface_open_conf();
|
||||
|
||||
|
|
|
@ -402,12 +402,6 @@ void MainWindow::readSettings()
|
|||
prefs.divelist_font = strdup(v.toString);
|
||||
#endif
|
||||
|
||||
#if DONT_KNOW_HOW_TO_DO_THAT
|
||||
v = settings.value(QString("default_filename"));
|
||||
if (v.isValid())
|
||||
prefs.default_filename = strdup(v.toString);
|
||||
#endif
|
||||
|
||||
#if ONCE_WE_HAVE_MAPS
|
||||
v = settings.value(QString_int("map_provider"));
|
||||
if(v.isValid())
|
||||
|
@ -467,6 +461,9 @@ void MainWindow::writeSettings()
|
|||
SAVE_VALUE("gflow", gflow);
|
||||
SAVE_VALUE("gfhigh", gfhigh);
|
||||
settings.endGroup();
|
||||
settings.beginGroup("GeneralSettings");
|
||||
SAVE_VALUE("default_filename", default_filename);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
|
|
Loading…
Add table
Reference in a new issue