]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - src/tim/prune/App.java
Set main window title
[GpsPrune.git] / src / tim / prune / App.java
index 3a778588ab815a7f30c4b396e4de9d2c266836da..247a1332fc6f931c0836ab0e6fdfc36a563cec07 100644 (file)
@@ -51,6 +51,7 @@ public class App
 {
        // Instance variables
        private JFrame _frame = null;
+       private String _titlePrefix = null;
        private Track _track = null;
        private TrackInfo _trackInfo = null;
        private int _lastSavePosition = 0;
@@ -79,6 +80,7 @@ public class App
        public App(JFrame inFrame)
        {
                _frame = inFrame;
+               _titlePrefix = _frame.getTitle();
                _undoStack = new UndoStack();
                _track = new Track();
                _trackInfo = new TrackInfo(_track);
@@ -759,6 +761,8 @@ public class App
                        + " '" + inSourceInfo.getName() + "'");
                // update menu
                _menuManager.informFileLoaded();
+               // update main window title
+               updateTitle();
                // Remove busy lock
                _busyLoading = false;
                // load next file if there's a queue
@@ -1001,4 +1005,16 @@ public class App
        public void setCurrentMode(AppMode inMode) {
                _appMode = inMode;
        }
+
+       /** Update main window title **/
+       public void updateTitle() {
+               ArrayList<String> filenames = _trackInfo.getFileInfo().getFilenames();
+               if (filenames.size() > 0) {
+                       _frame.setTitle(_titlePrefix + ": " + String.join(", ", filenames));
+               }
+               else
+               {
+                       _frame.setTitle(_titlePrefix);
+               }
+       }
 }