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 | _bytesPerSecond(0), | 170 | _bytesPerSecond(0), |
| 171 | _recentMaxPackets(0), | 171 | _recentMaxPackets(0), |
| 172 | _resetRecentMaxPacketsSoon(true), | 172 | _resetRecentMaxPacketsSoon(true), |
| 173 | _previousScriptLocation(), | ||
| 173 | _logger(new FileLogger(this)) | 174 | _logger(new FileLogger(this)) |
| 174 | { | 175 | { |
| 175 | // read the ApplicationInfo.ini file for Name/Version/Domain information | 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 | void Application::loadDialog() { | 3703 | void Application::loadDialog() { |
| 3703 | // shut down and stop any existing script | 3704 | QString suggestedName; |
| 3704 | QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | 3705 | |
| 3705 | QString suggestedName = desktopLocation.append("/script.js"); | 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 | QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"), suggestedName, | 3713 | QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"), suggestedName, |
| 3708 | tr("JavaScript Files (*.js)")); | 3714 | tr("JavaScript Files (*.js)")); |
| 3715 | if (!fileNameString.isEmpty()) { | ||
| 3716 | _previousScriptLocation = fileNameString; | ||
| 3717 | } | ||
| 3709 | 3718 | ||
| 3710 | loadScript(fileNameString); | 3719 | loadScript(fileNameString); |
| 3711 | } | 3720 | } |