targetsetuppage.cpp 20.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/

#include "targetsetuppage.h"

Tobias Hunger's avatar
Tobias Hunger committed
32
33
#include "ui_targetsetuppage.h"

34
#include "qt4project.h"
Tobias Hunger's avatar
Tobias Hunger committed
35
#include "qt4projectmanagerconstants.h"
36
#include "qt4target.h"
Tobias Hunger's avatar
Tobias Hunger committed
37
#include "qtversionmanager.h"
38

39
#include <extensionsystem/pluginmanager.h>
40
#include <projectexplorer/task.h>
dt's avatar
dt committed
41
#include <projectexplorer/taskhub.h>
42
#include <utils/qtcassert.h>
43

44
#include <QtGui/QFileDialog>
45
46
47
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
48
#include <QtGui/QMessageBox>
49
#include <QtGui/QPushButton>
50
51
52
53
#include <QtGui/QTreeWidget>

using namespace Qt4ProjectManager::Internal;

54
55
56
57
58
59
60
61
namespace {
enum Columns {
    NAME_COLUMN = 0,
    STATUS_COLUMN,
    DIRECTORY_COLUMN
};
} // namespace

62
TargetSetupPage::TargetSetupPage(QWidget *parent) :
Tobias Hunger's avatar
Tobias Hunger committed
63
    QWizardPage(parent),
Tobias Hunger's avatar
Tobias Hunger committed
64
    m_preferMobile(false),
65
    m_toggleWillCheck(false),
Tobias Hunger's avatar
Tobias Hunger committed
66
    m_ui(new Ui::TargetSetupPage)
67
{
Tobias Hunger's avatar
Tobias Hunger committed
68
69
70
    m_ui->setupUi(this);
    m_ui->versionTree->header()->setResizeMode(0, QHeaderView::ResizeToContents);
    m_ui->versionTree->header()->setResizeMode(1, QHeaderView::ResizeToContents);
71

Tobias Hunger's avatar
Tobias Hunger committed
72
    connect(m_ui->importButton, SIGNAL(clicked()),
73
            this, SLOT(addShadowBuildLocation()));
74
    connect(m_ui->uncheckButton, SIGNAL(clicked()),
75
            this, SLOT(toggleAll()));
76
77
    connect(m_ui->versionTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
            this, SLOT(handleDoubleClicks(QTreeWidgetItem*,int)));
78
79
80
81
82
}

TargetSetupPage::~TargetSetupPage()
{
    resetInfos();
Tobias Hunger's avatar
Tobias Hunger committed
83
    delete m_ui;
84
85
86
87
}

void TargetSetupPage::setImportInfos(const QList<ImportInfo> &infos)
{
Tobias Hunger's avatar
Tobias Hunger committed
88
    disconnect(m_ui->versionTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
89
90
               this, SLOT(itemWasChanged()));

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    // Create a list of all temporary Qt versions we need to delete in our existing list
    QList<QtVersion *> toDelete;
    foreach (const ImportInfo &info, m_infos) {
        if (info.isTemporary)
            toDelete.append(info.version);
    }
    // Remove those that got copied into the new list to set up
    foreach (const ImportInfo &info, infos) {
        if (info.isTemporary)
            toDelete.removeAll(info.version);
    }
    // Delete the rest
    qDeleteAll(toDelete);
    // ... and clear the list
    m_infos.clear();
106
107
108
109

    // Find possible targets:
    QStringList targets;
    foreach (const ImportInfo &i, infos) {
110
        // Make sure we have no duplicate directories:
111
112
        bool skip = false;
        foreach (const ImportInfo &j, m_infos) {
113
            if (j.isExistingBuild && i.isExistingBuild && (j.directory == i.directory)) {
114
115
116
117
                skip = true;
                break;
            }
        }
118
119
120
        if (skip) {
            if (i.isTemporary)
                delete i.version;
121
            continue;
122
        }
123
124
125
126
127
128
129
130
131
132
133

        m_infos.append(i);

        QSet<QString> versionTargets = i.version->supportedTargetIds();
        foreach (const QString &t, versionTargets) {
            if (!targets.contains(t))
                targets.append(t);
        }
    }
    qSort(targets.begin(), targets.end());

Tobias Hunger's avatar
Tobias Hunger committed
134
    m_ui->versionTree->clear();
135
136
    Qt4TargetFactory factory;
    foreach (const QString &t, targets) {
Tobias Hunger's avatar
Tobias Hunger committed
137
138
        QTreeWidgetItem *targetItem = new QTreeWidgetItem(m_ui->versionTree);
        const QString targetName = factory.displayNameForId(t);
139
140
        targetItem->setText(NAME_COLUMN, targetName);
        targetItem->setToolTip(NAME_COLUMN, targetName);
141
        targetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
142
        targetItem->setData(NAME_COLUMN, Qt::UserRole, t);
143
144
145
        targetItem->setExpanded(true);

        int pos = -1;
146
        foreach (const ImportInfo &i, m_infos) {
147
148
            ++pos;

149
150
151
152
153
154
155
156
157
158
            QString buildDir;
            if (i.directory.isEmpty()) {
                if (i.version->supportsShadowBuilds())
                    buildDir = Qt4Target::defaultShadowBuildDirectory(Qt4Project::defaultTopLevelBuildDirectory(m_proFilePath), t);
                else
                    buildDir = Qt4Project::projectDirectory(m_proFilePath);
            } else {
                buildDir = i.directory;
            }

159
160
161
            if (!i.version->supportsTargetId(t))
                continue;
            QTreeWidgetItem *versionItem = new QTreeWidgetItem(targetItem);
162
163
            updateVersionItem(versionItem, pos);

164
165
            // Prefer imports to creating new builds, but precheck any
            // Qt that exists (if there is no import with that version)
Tobias Hunger's avatar
Tobias Hunger committed
166
            bool shouldCheck = true;
167
168
169
            if (!i.isExistingBuild) {
                foreach (const ImportInfo &j, m_infos) {
                    if (j.isExistingBuild && j.version == i.version) {
Tobias Hunger's avatar
Tobias Hunger committed
170
                        shouldCheck = false;
171
172
173
174
                        break;
                    }
                }
            }
175

Tobias Hunger's avatar
Tobias Hunger committed
176
177
            shouldCheck = shouldCheck && (m_preferMobile == i.version->supportsMobileTarget());
            shouldCheck = shouldCheck || i.isExistingBuild; // always check imports
178
            shouldCheck = shouldCheck || m_infos.count() == 1; // always check only option
179
            versionItem->setCheckState(NAME_COLUMN, shouldCheck ? Qt::Checked : Qt::Unchecked);
180
181
182
        }
    }

Tobias Hunger's avatar
Tobias Hunger committed
183
    connect(m_ui->versionTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
184
185
186
187
188
189
190
191
192
193
194
195
            this, SLOT(itemWasChanged()));

    emit completeChanged();
}

QList<TargetSetupPage::ImportInfo> TargetSetupPage::importInfos() const
{
    return m_infos;
}

bool TargetSetupPage::hasSelection() const
{
Tobias Hunger's avatar
Tobias Hunger committed
196
197
    for (int i = 0; i < m_ui->versionTree->topLevelItemCount(); ++i) {
        QTreeWidgetItem * current = m_ui->versionTree->topLevelItem(i);
198
199
        for (int j = 0; j < current->childCount(); ++j) {
            QTreeWidgetItem * child = current->child(j);
200
            if (child->checkState(NAME_COLUMN) == Qt::Checked)
201
202
203
204
205
206
207
208
                return true;
        }
    }
    return false;
}

bool TargetSetupPage::isTargetSelected(const QString &targetid) const
{
Tobias Hunger's avatar
Tobias Hunger committed
209
210
    for (int i = 0; i < m_ui->versionTree->topLevelItemCount(); ++i) {
        QTreeWidgetItem * current = m_ui->versionTree->topLevelItem(i);
211
        if (current->data(NAME_COLUMN, Qt::UserRole).toString() != targetid)
212
213
214
            continue;
        for (int j = 0; j < current->childCount(); ++j) {
            QTreeWidgetItem * child = current->child(j);
215
            if (child->checkState(NAME_COLUMN) == Qt::Checked)
216
217
218
219
220
221
222
223
224
                return true;
        }
    }
    return false;
}

bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
{
    Q_ASSERT(project->targets().isEmpty());
225
    QtVersionManager *vm = QtVersionManager::instance();
226

Tobias Hunger's avatar
Tobias Hunger committed
227
228
    for (int i = 0; i < m_ui->versionTree->topLevelItemCount(); ++i) {
        QTreeWidgetItem *current = m_ui->versionTree->topLevelItem(i);
229
        QString targetId = current->data(NAME_COLUMN, Qt::UserRole).toString();
230
231
232
233
234
235
236

        QList<BuildConfigurationInfo> targetInfos;
        for (int j = 0; j < current->childCount(); ++j) {
            QTreeWidgetItem *child = current->child(j);
            if (child->checkState(0) != Qt::Checked)
                continue;

237
            ImportInfo &info = m_infos[child->data(NAME_COLUMN, Qt::UserRole).toInt()];
238
239
240
241
242
243

            // Register temporary Qt version
            if (info.isTemporary) {
                vm->addVersion(info.version);
                info.isTemporary = false;
            }
244

245
            // we want to havbe two BCs set up, one to build debug, the other to build release.
246
247
            targetInfos.append(BuildConfigurationInfo(info.version, info.buildConfig,
                                                      info.additionalArguments, info.directory));
248
            targetInfos.append(BuildConfigurationInfo(info.version, info.buildConfig ^ QtVersion::DebugBuild,
249
                                                      info.additionalArguments, info.directory));
250
251
252
253
        }

        // create the target:
        Qt4Target *target = 0;
254
        if (!targetInfos.isEmpty())
255
256
            target = project->targetFactory()->create(project, targetId, targetInfos);

Tobias Hunger's avatar
Tobias Hunger committed
257
        if (target) {
258
            project->addTarget(target);
Tobias Hunger's avatar
Tobias Hunger committed
259
260
261
            if (target->id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
                project->setActiveTarget(target);
        }
262
263
    }

264
265
266
267
268
269
270
    // Create the default target if nothing else was set up:
    if (project->targets().isEmpty()) {
        Qt4Target *target = project->targetFactory()->create(project, Constants::DESKTOP_TARGET_ID);
        if (target)
            project->addTarget(target);
    }

271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
    return !project->targets().isEmpty();
}

void TargetSetupPage::itemWasChanged()
{
    emit completeChanged();
}

bool TargetSetupPage::isComplete() const
{
    return hasSelection();
}

void TargetSetupPage::setImportDirectoryBrowsingEnabled(bool browsing)
{
Tobias Hunger's avatar
Tobias Hunger committed
286
287
    m_ui->importButton->setEnabled(browsing);
    m_ui->importButton->setVisible(browsing);
288
289
290
291
}

void TargetSetupPage::setImportDirectoryBrowsingLocation(const QString &directory)
{
292
    m_defaultShadowBuildLocation = directory;
293
294
}

Tobias Hunger's avatar
Tobias Hunger committed
295
296
297
298
299
void TargetSetupPage::setPreferMobile(bool mobile)
{
    m_preferMobile = mobile;
}

300
301
302
void TargetSetupPage::setProFilePath(const QString &path)
{
    m_proFilePath = path;
303
    if (!m_proFilePath.isEmpty()) {
304
        m_ui->descriptionLabel->setText(tr("Qt Creator can set up the following targets for<br>project <b>%1</b>:",
Tobias Hunger's avatar
Tobias Hunger committed
305
                                           "%1: Project name").arg(QFileInfo(m_proFilePath).baseName()));
306
    }
307
308
309
    // Force regeneration of tree widget contents:
    QList<ImportInfo> tmp = m_infos;
    setImportInfos(tmp);
310
311
}

312
QList<TargetSetupPage::ImportInfo> TargetSetupPage::importInfosForKnownQtVersions()
313
314
315
316
{
    QList<ImportInfo> results;
    QtVersionManager * vm = QtVersionManager::instance();
    QList<QtVersion *> validVersions = vm->validVersions();
317
318
319
    // Fallback in case no valid versions are found:
    if (validVersions.isEmpty())
        validVersions.append(vm->versions().at(0)); // there is always one!
320
321
322
323
    foreach (QtVersion *v, validVersions) {
        ImportInfo info;
        info.isExistingBuild = false;
        info.isTemporary = false;
324
        info.isShadowBuild = v->supportsShadowBuilds();
325
        info.version = v;
326
        info.buildConfig = v->defaultBuildConfig();
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
        results.append(info);
    }
    return results;
}

QList<TargetSetupPage::ImportInfo> TargetSetupPage::filterImportInfos(const QSet<QString> &validTargets,
                                                                      const QList<ImportInfo> &infos)
{
    QList<ImportInfo> results;
    foreach (const ImportInfo &info, infos) {
        Q_ASSERT(info.version);
        foreach (const QString &target, validTargets) {
            if (info.version->supportsTargetId(target))
                results.append(info);
        }
    }
    return results;
}

346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
QList<TargetSetupPage::ImportInfo>
TargetSetupPage::scanDefaultProjectDirectories(Qt4ProjectManager::Qt4Project *project)
{
    // Source directory:
    QList<ImportInfo> importVersions = TargetSetupPage::recursivelyCheckDirectoryForBuild(project->projectDirectory(),
                                                                                          project->file()->fileName());
    QtVersionManager *vm = QtVersionManager::instance();
    foreach(const QString &id, vm->supportedTargetIds()) {
        QString location = Qt4Target::defaultShadowBuildDirectory(project->defaultTopLevelBuildDirectory(), id);
        importVersions.append(TargetSetupPage::recursivelyCheckDirectoryForBuild(location,
                                                                                 project->file()->fileName()));
    }
    return importVersions;
}

361
QList<TargetSetupPage::ImportInfo>
362
TargetSetupPage::recursivelyCheckDirectoryForBuild(const QString &directory, const QString &proFile, int maxdepth)
363
364
365
{
    QList<ImportInfo> results;

366
    if (maxdepth <= 0 || directory.isEmpty())
367
368
369
        return results;

    // Check for in-source builds first:
370
    QString qmakeBinary = QtVersionManager::findQMakeBinaryFromMakefile(directory);
371
    QDir dir(directory);
372
373

    // Recurse into subdirectories:
374
    if (qmakeBinary.isNull() || !QtVersionManager::makefileIsFor(directory, proFile)) {
375
        QStringList subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
376
        foreach (QString subDir, subDirs)
377
            results.append(recursivelyCheckDirectoryForBuild(dir.absoluteFilePath(subDir),
378
                                                             proFile, maxdepth - 1));
379
380
381
382
383
384
        return results;
    }

    // Shiny fresh directory with a Makefile...
    QtVersionManager * vm = QtVersionManager::instance();
    TargetSetupPage::ImportInfo info;
385
    info.directory = dir.absolutePath();
386
    info.isShadowBuild = (info.directory != QFileInfo(proFile).absolutePath());
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418

    // This also means we have a build in there
    // First get the qt version
    info.version = vm->qtVersionForQMakeBinary(qmakeBinary);
    info.isExistingBuild = true;

    // Okay does not yet exist, create
    if (!info.version) {
        info.version = new QtVersion(qmakeBinary);
        info.isTemporary = true;
    }

    QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
            QtVersionManager::scanMakeFile(directory, info.version->defaultBuildConfig());
    info.buildConfig = result.first;
    info.additionalArguments = Qt4BuildConfiguration::removeSpecFromArgumentList(result.second);

    QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArgumentList(result.second, directory, info.version);
    QString versionSpec = info.version->mkspec();

    // Compare mkspecs and add to additional arguments
    if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
        // using the default spec, don't modify additional arguments
    } else {
        info.additionalArguments.prepend(parsedSpec);
        info.additionalArguments.prepend("-spec");
    }

    results.append(info);
    return results;
}

419
void TargetSetupPage::addShadowBuildLocation()
420
{
421
422
423
424
425
426
427
428
429
    QString newPath =
        QFileDialog::getExistingDirectory(this,
                                          tr("Choose a directory to scan for additional shadow builds"),
                                          m_defaultShadowBuildLocation);

    if (newPath.isEmpty())
        return;

    QFileInfo dir(QDir::fromNativeSeparators(newPath));
430
431
    if (!dir.exists() || !dir.isDir())
        return;
432

433
    QList<ImportInfo> tmp;
434
    tmp.append(recursivelyCheckDirectoryForBuild(dir.absoluteFilePath(), m_proFilePath));
435
    if (tmp.isEmpty()) {
Friedemann Kleint's avatar
Friedemann Kleint committed
436
437
        QMessageBox::warning(this, tr("No builds found"),
                             tr("No builds for project file \"%1\" were found in the folder \"%2\".",
438
439
440
441
442
                                "%1: pro-file, %2: directory that was checked.").
                             arg(m_proFilePath, dir.absoluteFilePath()));
        return;
    }
    tmp.append(m_infos);
443
444
445
    setImportInfos(tmp);
}

446
void TargetSetupPage::toggleAll()
447
448
449
450
451
{
    for (int i = 0; i < m_ui->versionTree->topLevelItemCount(); ++i) {
        QTreeWidgetItem *current = m_ui->versionTree->topLevelItem(i);
        for (int j = 0; j < current->childCount(); ++j) {
            QTreeWidgetItem *child = current->child(j);
452
            child->setCheckState(0, m_toggleWillCheck ? Qt::Checked : Qt::Unchecked);
453
454
        }
    }
455
    m_toggleWillCheck = !m_toggleWillCheck;
456
    m_ui->uncheckButton->setText(m_toggleWillCheck ? tr("Check all") : tr("Uncheck all"));
457
458
    m_ui->uncheckButton->setToolTip(m_toggleWillCheck
                                    ? tr("Check all Qt versions") : tr("Uncheck all Qt versions"));
459
460
}

461
462
463
464
465
466
467
468
469
470
471
void TargetSetupPage::handleDoubleClicks(QTreeWidgetItem *item, int column)
{
    int idx = item->data(NAME_COLUMN, Qt::UserRole).toInt();
    if (column == DIRECTORY_COLUMN && item->parent()) {
        if (m_infos[idx].isExistingBuild || !m_infos[idx].version->supportsShadowBuilds())
            return;
        m_infos[idx].isShadowBuild = !m_infos[idx].isShadowBuild;
        updateVersionItem(item, idx);
    }
}

472
473
void TargetSetupPage::resetInfos()
{
Tobias Hunger's avatar
Tobias Hunger committed
474
    m_ui->versionTree->clear();
475
476
477
478
479
480
    foreach (const ImportInfo &info, m_infos) {
        if (info.isTemporary)
            delete info.version;
    }
    m_infos.clear();
}
481

482
483
QPair<QIcon, QString> TargetSetupPage::reportIssues(Qt4ProjectManager::QtVersion *version,
                                                    const QString &buildDir)
484
485
486
487
{
    if (m_proFilePath.isEmpty())
        return qMakePair(QIcon(), QString());

dt's avatar
dt committed
488
489
490
    const ProjectExplorer::TaskHub *taskHub = ExtensionSystem::PluginManager::instance()
                                              ->getObject<ProjectExplorer::TaskHub>();
    QTC_ASSERT(taskHub, return qMakePair(QIcon(), QString()));
491

492
    QList<ProjectExplorer::Task> issues = version->reportIssues(m_proFilePath, buildDir);
493

494
495
    QString text;
    QIcon icon;
496
    foreach (const ProjectExplorer::Task &t, issues) {
497
498
499
500
501
        if (!text.isEmpty())
            text.append(QLatin1String("<br>"));
        // set severity:
        QString severity;
        if (t.type == ProjectExplorer::Task::Error) {
dt's avatar
dt committed
502
            icon = taskHub->taskTypeIcon(t.type);
503
504
505
            severity = tr("<b>Error:</b> ", "Severity is Task::Error");
        } else if (t.type == ProjectExplorer::Task::Warning) {
               if (icon.isNull())
dt's avatar
dt committed
506
                   icon = taskHub->taskTypeIcon(t.type);
507
508
509
510
511
512
513
514
               severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
        }
        text.append(severity + t.description);
    }
    if (!text.isEmpty())
        text = QLatin1String("<nobr>") + text;
    return qMakePair(icon, text);
}
515
516
517
518

void TargetSetupPage::updateVersionItem(QTreeWidgetItem *versionItem, int index)
{
    ImportInfo &info = m_infos[index];
519
520
521
522
523
524
525
526
527
528
529
530
    const QString target = versionItem->parent()->data(NAME_COLUMN, Qt::UserRole).toString();
    QString dir;
    if (info.directory.isEmpty()) {
        Q_ASSERT(!info.isTemporary && !info.isExistingBuild);
        if (info.isShadowBuild)
            dir = Qt4Target::defaultShadowBuildDirectory(Qt4Project::defaultTopLevelBuildDirectory(m_proFilePath), target);
        else
            dir = Qt4Project::projectDirectory(m_proFilePath);
    } else {
        dir = info.directory;
    }
    QPair<QIcon, QString> issues = reportIssues(info.version, dir);
531

Tobias Hunger's avatar
Tobias Hunger committed
532
533
534
535
536
537
538
539
540
541
    //: We are going to build debug and release
    QString buildType = tr("debug and release");
    if ((info.buildConfig & QtVersion::BuildAll) == 0) {
        if (info.buildConfig & QtVersion::DebugBuild)
            //: Debug build
            buildType = tr("debug");
        else
            //: release build
            buildType = tr("release");
    }
542
543

    QString toolTip = info.version->displayName();
Tobias Hunger's avatar
Tobias Hunger committed
544
545
546
547
    //: %1: qmake used (incl. full path), %2: "debug", "release" or "debug and release"
    toolTip.append(tr("<br>using %1 (%2)").
            arg(QDir::toNativeSeparators(info.version->qmakeCommand())).
                   arg(buildType));
548
549
550
551
552
553
554
555
556
557
558
559
    if (!issues.second.isEmpty())
        toolTip.append(QString::fromLatin1("<br><br>%1").arg(issues.second));

    // Column 0:
    versionItem->setToolTip(NAME_COLUMN, toolTip);
    versionItem->setIcon(NAME_COLUMN, issues.first);
    versionItem->setText(NAME_COLUMN, info.version->displayName());
    versionItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
    versionItem->setData(NAME_COLUMN, Qt::UserRole, index);

    // Column 1 (status):
    const QString status = info.isExistingBuild ?
560
561
562
563
                           //: Is this an import of an existing build or a new one?
                           tr("Import") :
                           //: Is this an import of an existing build or a new one?
                           tr("New");
564
565
566
567
568
    versionItem->setText(STATUS_COLUMN, status);
    versionItem->setToolTip(STATUS_COLUMN, status);

    // Column 2 (directory):
    Q_ASSERT(versionItem->parent());
569
570
    versionItem->setText(DIRECTORY_COLUMN, QDir::toNativeSeparators(dir));
    versionItem->setToolTip(DIRECTORY_COLUMN, QDir::toNativeSeparators(dir));
571
}