Showing the changes to interface/src/Application.cpp (1 of 8 files). Show all
Unified · Split
| @@ -170,6 +170,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 169 unmodified lines | ||
| 170 | 170 | _bytesPerSecond(0), |
| 171 | 171 | _recentMaxPackets(0), |
| 172 | 172 | _resetRecentMaxPacketsSoon(true), |
| 173 | + _previousScriptLocation(), | |
| 173 | 174 | _logger(new FileLogger(this)) |
| 174 | 175 | { |
| 175 | 176 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| @@ -3700,12 +3701,20 @@ void Application::loadScript(const QString& scriptName) { · 3524 unmodified lines | ||
| 3700 | 3701 | } |
| 3701 | 3702 | |
| 3702 | 3703 | void Application::loadDialog() { |
| 3703 | − // shut down and stop any existing script | |
| 3704 | − QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | |
| 3705 | − QString suggestedName = desktopLocation.append("/script.js"); | |
| 3704 | + QString suggestedName; | |
| 3705 | + | |
| 3706 | + if (_previousScriptLocation.isEmpty()) { | |
| 3707 | + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | |
| 3708 | + suggestedName = desktopLocation.append("/script.js"); | |
| 3709 | + } else { | |
| 3710 | + suggestedName = _previousScriptLocation; | |
| 3711 | + } | |
| 3706 | 3712 | |
| 3707 | 3713 | QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"), suggestedName, |
| 3708 | 3714 | tr("JavaScript Files (*.js)")); |
| 3715 | + if (!fileNameString.isEmpty()) { | |
| 3716 | + _previousScriptLocation = fileNameString; | |
| 3717 | + } | |
| 3709 | 3718 | |
| 3710 | 3719 | loadScript(fileNameString); |
| 3711 | 3720 | } |