diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-11-05 10:05:22 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-05 13:45:50 -0800 |
commit | 081295cb406f5284b8aae3ef0dcbcdad01241179 (patch) | |
tree | b19a0fae132c52ea8e8c9d95c98287c638e73476 | |
parent | 533d724d1b4380741ce7db91c39262df6c0df062 (diff) | |
download | subsurface-081295cb406f5284b8aae3ef0dcbcdad01241179.tar.gz |
Untangle Profile from MainWindow: files on command line
There's no reason why this should be on the MainWindow widget.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 10 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.h | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 7 | ||||
-rw-r--r-- | subsurface-android-helper.cpp | 5 | ||||
-rw-r--r-- | subsurface-desktop-main.cpp | 9 |
5 files changed, 18 insertions, 15 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index dc45d1d8d..32ad5e30a 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -317,16 +317,6 @@ void MainWindow::setDefaultState() { } } -void MainWindow::setLoadedWithFiles(bool f) -{ - filesAsArguments = f; -} - -bool MainWindow::filesFromCommandLine() const -{ - return filesAsArguments; -} - MainWindow *MainWindow::instance() { return m_Instance; diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 02ec2478c..05844fbd6 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -88,8 +88,6 @@ public: void setToolButtonsEnabled(bool enabled); ProfileWidget2 *graphics() const; PlannerDetails *plannerDetails() const; - void setLoadedWithFiles(bool filesFromCommandLine); - bool filesFromCommandLine() const; void printPlan(); void checkSurvey(QSettings *s); void setApplicationState(const QByteArray& state); diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index a7105b8ca..6177f5b97 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -31,6 +31,9 @@ #include "mainwindow.h" #include "preferences/preferencesdialog.h" +// a couple of helpers we need +extern bool haveFilesOnCommandLine(); + /* This is the global 'Item position' variable. * it should tell you where to position things up * on the canvas. @@ -529,7 +532,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) // special handling for the first time we display things int animSpeedBackup = 0; - if (firstCall && MainWindow::instance()->filesFromCommandLine()) { + if (firstCall && haveFilesOnCommandLine()) { animSpeedBackup = prefs.animation_speed; prefs.animation_speed = 0; firstCall = false; @@ -673,7 +676,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) if (dcText.isEmpty()) dcText = tr("Unknown dive computer"); diveComputerText->setText(dcText); - if (MainWindow::instance()->filesFromCommandLine() && animSpeedBackup != 0) { + if (haveFilesOnCommandLine() && animSpeedBackup != 0) { prefs.animation_speed = animSpeedBackup; } diff --git a/subsurface-android-helper.cpp b/subsurface-android-helper.cpp index ff6da88ca..a9fdf4031 100644 --- a/subsurface-android-helper.cpp +++ b/subsurface-android-helper.cpp @@ -71,3 +71,8 @@ double get_screen_dpi() QDesktopWidget *mydesk = qApp->desktop(); return mydesk->physicalDpiX(); } + +bool haveFilesOnCommandLine() +{ + return false; +} diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index a40edda1b..725011fc2 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -21,6 +21,8 @@ QTranslator *qtTranslator, *ssrfTranslator; +static bool filesOnCommandLine = false; + int main(int argc, char **argv) { int i; @@ -77,7 +79,7 @@ int main(int argc, char **argv) } } MainWindow *m = MainWindow::instance(); - m->setLoadedWithFiles(!files.isEmpty() || !importedFiles.isEmpty()); + filesOnCommandLine = !files.isEmpty() || !importedFiles.isEmpty(); m->loadFiles(files); m->importFiles(importedFiles); // in case something has gone wrong make sure we show the error message @@ -98,3 +100,8 @@ int main(int argc, char **argv) free_prefs(); return 0; } + +bool haveFilesOnCommandLine() +{ + return filesOnCommandLine; +} |