* @brief Writes a fresh shortcut + sidecar at the user-chosen path. */
| 194 | * @brief Writes a fresh shortcut + sidecar at the user-chosen path. |
| 195 | */ |
| 196 | void Misc::ShortcutGenerator::generate(const QString& outputPath, |
| 197 | const QString& title, |
| 198 | const QString& iconPath, |
| 199 | const QString& projectFile, |
| 200 | bool fullscreen, |
| 201 | bool actionsPanel, |
| 202 | bool fileTransmission, |
| 203 | bool csvExport, |
| 204 | bool mdfExport, |
| 205 | bool sessionExport, |
| 206 | bool consoleExport, |
| 207 | const QString& taskbarMode, |
| 208 | const QStringList& taskbarButtons, |
| 209 | const QString& themeName) |
| 210 | { |
| 211 | if (!hasProLicense()) { |
| 212 | Q_EMIT shortcutFailed(tr("A Pro license is required to generate shortcuts.")); |
| 213 | return; |
| 214 | } |
| 215 | |
| 216 | if (outputPath.isEmpty()) { |
| 217 | Q_EMIT shortcutFailed(tr("No output path was provided.")); |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | QString resolvedPath = |
| 222 | QUrl(outputPath).isLocalFile() ? QUrl(outputPath).toLocalFile() : outputPath; |
| 223 | |
| 224 | # if defined(Q_OS_MAC) |
| 225 | if (!resolvedPath.endsWith(QStringLiteral(".app"), Qt::CaseInsensitive)) |
| 226 | resolvedPath += QStringLiteral(".app"); |
| 227 | # endif |
| 228 | |
| 229 | const QString resolvedProject = |
| 230 | QUrl(projectFile).isLocalFile() ? QUrl(projectFile).toLocalFile() : projectFile; |
| 231 | |
| 232 | QStringList args = buildArguments(resolvedProject, |
| 233 | fullscreen, |
| 234 | actionsPanel, |
| 235 | fileTransmission, |
| 236 | csvExport, |
| 237 | mdfExport, |
| 238 | sessionExport, |
| 239 | consoleExport, |
| 240 | taskbarMode, |
| 241 | taskbarButtons, |
| 242 | themeName); |
| 243 | |
| 244 | args << QStringLiteral("--shortcut-path") << resolvedPath; |
| 245 | |
| 246 | QString resolvedIcon = iconPath; |
| 247 | if (QUrl(resolvedIcon).isLocalFile()) |
| 248 | resolvedIcon = QUrl(resolvedIcon).toLocalFile(); |
| 249 | |
| 250 | if (resolvedIcon.startsWith(QStringLiteral("qrc:"))) |
| 251 | resolvedIcon.clear(); |
| 252 | |
| 253 | if (resolvedIcon.isEmpty() || !QFileInfo::exists(resolvedIcon)) |
no test coverage detected