| 3048 | } |
| 3049 | |
| 3050 | QString MainWindow::locationToLink(const QString& file, int firstLine, int firstColumn, int lastLine, int lastColumn, const QColor& color) |
| 3051 | { |
| 3052 | QString label = QFileInfo(file).baseName(); |
| 3053 | if (file.endsWith("untitled_model.mzn")) { |
| 3054 | QFileInfo fi(file); |
| 3055 | for (QTemporaryDir* d : cleanupTmpDirs) { |
| 3056 | QFileInfo tmpFileInfo(d->path() + "/untitled_model.mzn"); |
| 3057 | if (fi.canonicalFilePath( )== tmpFileInfo.canonicalFilePath()) { |
| 3058 | label = "Playground"; |
| 3059 | break; |
| 3060 | } |
| 3061 | } |
| 3062 | } |
| 3063 | QString position; |
| 3064 | if (firstLine == lastLine) { |
| 3065 | if (firstColumn == lastColumn) { |
| 3066 | position = QString("%1.%2") |
| 3067 | .arg(firstLine) |
| 3068 | .arg(firstColumn); |
| 3069 | } else { |
| 3070 | position = QString("%1.%2-%3") |
| 3071 | .arg(firstLine) |
| 3072 | .arg(firstColumn) |
| 3073 | .arg(lastColumn); |
| 3074 | } |
| 3075 | } else { |
| 3076 | position = QString("%1-%2.%3-%4") |
| 3077 | .arg(firstLine) |
| 3078 | .arg(firstColumn) |
| 3079 | .arg(lastLine) |
| 3080 | .arg(lastColumn); |
| 3081 | } |
| 3082 | QUrl url = QUrl::fromLocalFile(file); |
| 3083 | url.setQuery(QString("line=%1&column=%2").arg(firstLine).arg(firstColumn)); |
| 3084 | url.setScheme("err"); |
| 3085 | return QString("<a style=\"color:%1\" href=\"%2\">%3:%4</a>") |
| 3086 | .arg(color.name()) |
| 3087 | .arg(url.toString()) |
| 3088 | .arg(label) |
| 3089 | .arg(position); |
| 3090 | } |
| 3091 | |
| 3092 | void MainWindow::startVisualisation(const QString& model, const QStringList& data, const QString& key, const QString& url, const QJsonValue& userData, MznProcess* proc) |
| 3093 | { |