| 64 | } |
| 65 | |
| 66 | void GM_Manager::downloadScript(const QUrl &url) |
| 67 | { |
| 68 | auto *downloader = new GM_Downloader(url, this); |
| 69 | connect(downloader, &GM_Downloader::finished, this, [=](const QString &fileName) { |
| 70 | bool deleteScript = true; |
| 71 | auto *script = new GM_Script(this, fileName); |
| 72 | if (script->isValid()) { |
| 73 | if (!containsScript(script->fullName())) { |
| 74 | GM_AddScriptDialog dialog(this, script); |
| 75 | deleteScript = dialog.exec() != QDialog::Accepted; |
| 76 | } |
| 77 | else { |
| 78 | showNotification(tr("'%1' is already installed").arg(script->name())); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | if (deleteScript) { |
| 83 | delete script; |
| 84 | QFile(fileName).remove(); |
| 85 | } |
| 86 | }); |
| 87 | } |
| 88 | |
| 89 | QString GM_Manager::settingsPath() const |
| 90 | { |