diff options
-rw-r--r-- | main.cpp | 6 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 10 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 3 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 16 |
4 files changed, 33 insertions, 2 deletions
@@ -48,8 +48,10 @@ int main(int argc, char **argv) files.push_back(QString(prefs.default_filename)); } parse_xml_exit(); - MainWindow::instance()->loadFiles(files); - MainWindow::instance()->importFiles(importedFiles); + MainWindow *m = MainWindow::instance(); + m->setLoadedWithFiles( !files.isEmpty() || !importedFiles.isEmpty()); + m->loadFiles(files); + m->importFiles(importedFiles); if (!quit) run_ui(); exit_ui(); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 34ff4baf4..426e979f7 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -85,6 +85,16 @@ MainWindow::~MainWindow() m_Instance = NULL; } +void MainWindow::setLoadedWithFiles(bool f) +{ + filesAsArguments = f; +} + +bool MainWindow::filesFromCommandLine() const +{ + return filesAsArguments; +} + MainWindow *MainWindow::instance() { return m_Instance; diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 70b9793f7..94655e516 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -78,6 +78,8 @@ public: void cleanUpEmpty(); void setToolButtonsEnabled(bool enabled); ProfileWidget2 *graphics() const; + void setLoadedWithFiles(bool filesFromCommandLine); + bool filesFromCommandLine() const; private slots: /* file menu action */ @@ -165,6 +167,7 @@ private: void saveSplitterSizes(); QString lastUsedDir(); void updateLastUsedDir(const QString &s); + bool filesAsArguments; }; MainWindow *mainWindow(); diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index d03d0dc83..0a4062ec1 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -316,12 +316,23 @@ void ProfileWidget2::setupSceneAndFlags() // Currently just one dive, but the plan is to enable All of the selected dives. void ProfileWidget2::plotDives(QList<dive *> dives) { + static bool firstCall = true; + // I Know that it's a list, but currently we are // using just the first. struct dive *d = dives.first(); if (!d) return; + int animSpeedBackup = -1; + if(firstCall && MainWindow::instance()->filesFromCommandLine()){ + QSettings s; + s.beginGroup("Animations"); + animSpeedBackup = s.value("animation_speed",500).toInt(); + s.setValue("animation_speed",0); + firstCall = false; + } + // restore default zoom level and tooltip position if (zoomLevel) { const qreal defScale = 1.0 / qPow(zoomFactor, (qreal)zoomLevel); @@ -431,6 +442,11 @@ void ProfileWidget2::plotDives(QList<dive *> dives) // qDebug() << event->getEvent()->name << "@" << event->getEvent()->time.seconds; } diveComputerText->setText(currentdc->model); + if (MainWindow::instance()->filesFromCommandLine() && animSpeedBackup != -1){ + QSettings s; + s.beginGroup("Animations"); + s.setValue("animation_speed",animSpeedBackup); + } } void ProfileWidget2::settingsChanged() |