2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2010-07-13 15:02:37 +02:00
|
|
|
#include "qmlprojectrunconfiguration.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#include "qmlproject.h"
|
|
|
|
|
#include "qmlprojectmanagerconstants.h"
|
2010-11-29 11:42:58 +01:00
|
|
|
#include "qmlprojectrunconfigurationwidget.h"
|
2013-01-29 17:42:13 +01:00
|
|
|
#include "qmlprojectenvironmentaspect.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
#include <coreplugin/editormanager/ieditor.h>
|
|
|
|
|
#include <coreplugin/icore.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <coreplugin/idocument.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qtoutputformatter.h>
|
|
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2017-11-27 11:58:57 +01:00
|
|
|
#include <qtsupport/desktopqtversion.h>
|
2010-11-29 09:45:30 +01:00
|
|
|
|
2013-10-23 22:07:46 +03:00
|
|
|
#include <utils/fileutils.h>
|
2015-02-04 09:32:46 +01:00
|
|
|
#include <utils/mimetypes/mimedatabase.h>
|
2013-10-23 22:07:46 +03:00
|
|
|
#include <utils/qtcprocess.h>
|
2011-01-05 14:44:52 +01:00
|
|
|
#include <utils/winutils.h>
|
2015-08-05 15:16:27 +02:00
|
|
|
#include <qmljstools/qmljstoolsconstants.h>
|
2010-12-21 12:39:14 +01:00
|
|
|
|
2013-08-30 16:38:57 +02:00
|
|
|
using namespace Core;
|
2014-05-26 22:13:14 +03:00
|
|
|
using namespace ProjectExplorer;
|
2017-12-20 19:11:10 +01:00
|
|
|
using namespace QtSupport;
|
|
|
|
|
|
2010-11-29 09:45:30 +01:00
|
|
|
using namespace QmlProjectManager::Internal;
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
namespace QmlProjectManager {
|
|
|
|
|
|
2013-08-30 16:38:57 +02:00
|
|
|
const char M_CURRENT_FILE[] = "CurrentFile";
|
2010-11-29 09:45:30 +01:00
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target)
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
: RunConfiguration(target, Constants::QML_SCENE_RC_ID)
|
2010-02-16 13:39:13 +01:00
|
|
|
{
|
2013-11-01 14:13:41 +01:00
|
|
|
addExtraAspect(new QmlProjectEnvironmentAspect(this));
|
|
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
// reset default settings in constructor
|
|
|
|
|
connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
|
|
|
|
|
this, &QmlProjectRunConfiguration::changeCurrentFile);
|
|
|
|
|
connect(EditorManager::instance(), &EditorManager::currentDocumentStateChanged,
|
|
|
|
|
this, [this] { changeCurrentFile(); });
|
|
|
|
|
|
|
|
|
|
connect(target, &Target::kitChanged,
|
|
|
|
|
this, &QmlProjectRunConfiguration::updateEnabledState);
|
|
|
|
|
m_scriptFile = M_CURRENT_FILE;
|
|
|
|
|
|
2017-11-27 11:48:43 +01:00
|
|
|
setDisplayName(tr("QML Scene", "QMLRunConfiguration display name."));
|
2017-09-01 13:23:02 +02:00
|
|
|
updateEnabledState();
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-25 15:00:20 +01:00
|
|
|
Runnable QmlProjectRunConfiguration::runnable() const
|
|
|
|
|
{
|
|
|
|
|
StandardRunnable r;
|
|
|
|
|
r.executable = executable();
|
|
|
|
|
r.commandLineArguments = commandLineArguments();
|
|
|
|
|
r.runMode = ApplicationLauncher::Gui;
|
2016-04-21 12:04:53 +02:00
|
|
|
r.environment = extraAspect<QmlProjectEnvironmentAspect>()->environment();
|
2017-11-28 15:57:15 +01:00
|
|
|
r.workingDirectory = static_cast<QmlProject *>(project())->targetDirectory(target()).toString();
|
2016-01-25 15:00:20 +01:00
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-26 16:30:35 +02:00
|
|
|
QString QmlProjectRunConfiguration::disabledReason() const
|
|
|
|
|
{
|
2017-07-17 14:34:05 +02:00
|
|
|
if (mainScript().isEmpty())
|
|
|
|
|
return tr("No script file to execute.");
|
2017-11-28 15:57:15 +01:00
|
|
|
if (DeviceTypeKitInformation::deviceTypeId(target()->kit())
|
|
|
|
|
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|
|
|
|
|
&& !QFileInfo::exists(executable())) {
|
2017-11-27 11:48:43 +01:00
|
|
|
return tr("No qmlscene found.");
|
2017-11-28 15:57:15 +01:00
|
|
|
}
|
|
|
|
|
if (executable().isEmpty())
|
|
|
|
|
return tr("No qmlscene binary specified for target device.");
|
2017-07-17 14:34:05 +02:00
|
|
|
return RunConfiguration::disabledReason();
|
2011-05-26 16:30:35 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-11 11:20:11 +02:00
|
|
|
QString QmlProjectRunConfiguration::executable() const
|
2010-09-28 17:26:27 +02:00
|
|
|
{
|
2017-12-20 19:11:10 +01:00
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
2017-11-28 15:57:15 +01:00
|
|
|
if (!version) // No Qt version in Kit. Don't try to run qmlscene.
|
|
|
|
|
return QString();
|
|
|
|
|
|
|
|
|
|
const Id deviceType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
|
|
|
|
if (deviceType == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
|
|
|
|
// If not given explicitly by Qt Version, try to pick it from $PATH.
|
|
|
|
|
return version->type() == QtSupport::Constants::DESKTOPQT
|
|
|
|
|
? static_cast<QtSupport::DesktopQtVersion *>(version)->qmlsceneCommand()
|
|
|
|
|
: QString("qmlscene");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
|
|
|
|
|
if (dev.isNull()) // No device set. We don't know where to run qmlscene.
|
2010-10-04 15:03:01 +02:00
|
|
|
return QString();
|
2012-08-23 14:53:03 +02:00
|
|
|
|
2017-11-28 15:57:15 +01:00
|
|
|
const QString qmlscene = dev->qmlsceneCommand();
|
|
|
|
|
// If not given explicitly by device, try to pick it from $PATH.
|
|
|
|
|
return qmlscene.isEmpty() ? QString("qmlscene") : qmlscene;
|
2010-09-28 17:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-11 11:20:11 +02:00
|
|
|
QString QmlProjectRunConfiguration::commandLineArguments() const
|
2010-02-16 13:39:13 +01:00
|
|
|
{
|
|
|
|
|
// arguments in .user file
|
2010-10-19 11:14:03 +02:00
|
|
|
QString args = m_qmlViewerArgs;
|
2017-11-28 15:57:15 +01:00
|
|
|
const IDevice::ConstPtr device = DeviceKitInformation::device(target()->kit());
|
|
|
|
|
const Utils::OsType osType = device ? device->osType() : Utils::HostOsInfo::hostOs();
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
// arguments from .qmlproject file
|
2012-07-04 15:50:07 +02:00
|
|
|
QmlProject *project = static_cast<QmlProject *>(target()->project());
|
2012-12-03 15:28:34 +01:00
|
|
|
foreach (const QString &importPath, project->customImportPaths()) {
|
2017-11-28 15:57:15 +01:00
|
|
|
Utils::QtcProcess::addArg(&args, QLatin1String("-I"), osType);
|
|
|
|
|
Utils::QtcProcess::addArg(&args, importPath, osType);
|
2010-02-16 13:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2017-11-28 15:57:15 +01:00
|
|
|
const QString main
|
|
|
|
|
= project->targetFile(Utils::FileName::fromString(mainScript()), target()).toString(); ;
|
|
|
|
|
if (!main.isEmpty())
|
|
|
|
|
Utils::QtcProcess::addArg(&args, main, osType);
|
2010-02-16 13:39:13 +01:00
|
|
|
return args;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-16 11:46:47 +02:00
|
|
|
QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
|
2010-02-16 13:39:13 +01:00
|
|
|
{
|
2014-01-16 12:16:25 +01:00
|
|
|
return new QmlProjectRunConfigurationWidget(this);
|
2010-02-16 13:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-15 12:59:44 +02:00
|
|
|
Utils::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
|
2010-10-18 12:39:02 +02:00
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
return new QtSupport::QtOutputFormatter(target()->project());
|
2010-10-18 12:39:02 +02:00
|
|
|
}
|
2010-04-13 10:58:30 +02:00
|
|
|
|
2010-12-03 17:04:29 +01:00
|
|
|
QmlProjectRunConfiguration::MainScriptSource QmlProjectRunConfiguration::mainScriptSource() const
|
|
|
|
|
{
|
2012-07-04 15:50:07 +02:00
|
|
|
QmlProject *project = static_cast<QmlProject *>(target()->project());
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!project->mainFile().isEmpty())
|
2012-01-02 11:53:37 +01:00
|
|
|
return FileInProjectFile;
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!m_mainScriptFilename.isEmpty())
|
2010-12-03 17:04:29 +01:00
|
|
|
return FileInSettings;
|
2012-01-02 11:53:37 +01:00
|
|
|
return FileInEditor;
|
2010-12-03 17:04:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Returns absolute path to main script file.
|
|
|
|
|
*/
|
2010-02-16 13:39:13 +01:00
|
|
|
QString QmlProjectRunConfiguration::mainScript() const
|
|
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
QmlProject *project = qobject_cast<QmlProject *>(target()->project());
|
|
|
|
|
if (!project)
|
|
|
|
|
return m_currentFileFilename;
|
|
|
|
|
if (!project->mainFile().isEmpty()) {
|
|
|
|
|
const QString pathInProject = project->mainFile();
|
2012-01-02 11:53:37 +01:00
|
|
|
if (QFileInfo(pathInProject).isAbsolute())
|
|
|
|
|
return pathInProject;
|
|
|
|
|
else
|
2017-11-28 15:57:15 +01:00
|
|
|
return QDir(project->canonicalProjectDir().toString()).absoluteFilePath(pathInProject);
|
2010-12-03 17:04:29 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-02 11:53:37 +01:00
|
|
|
if (!m_mainScriptFilename.isEmpty())
|
2010-12-03 17:04:29 +01:00
|
|
|
return m_mainScriptFilename;
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2012-01-02 11:53:37 +01:00
|
|
|
return m_currentFileFilename;
|
2010-02-16 13:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-03 17:04:29 +01:00
|
|
|
void QmlProjectRunConfiguration::setScriptSource(MainScriptSource source,
|
|
|
|
|
const QString &settingsPath)
|
2010-02-16 13:39:13 +01:00
|
|
|
{
|
2010-12-10 13:19:55 +01:00
|
|
|
if (source == FileInEditor) {
|
2012-11-26 21:24:16 +02:00
|
|
|
m_scriptFile = QLatin1String(M_CURRENT_FILE);
|
2010-12-03 17:04:29 +01:00
|
|
|
m_mainScriptFilename.clear();
|
|
|
|
|
} else if (source == FileInProjectFile) {
|
|
|
|
|
m_scriptFile.clear();
|
|
|
|
|
m_mainScriptFilename.clear();
|
|
|
|
|
} else { // FileInSettings
|
|
|
|
|
m_scriptFile = settingsPath;
|
|
|
|
|
m_mainScriptFilename
|
2014-05-02 12:53:36 +02:00
|
|
|
= target()->project()->projectDirectory().toString() + QLatin1Char('/') + m_scriptFile;
|
2010-03-05 11:11:05 +01:00
|
|
|
}
|
2017-07-17 14:34:05 +02:00
|
|
|
updateEnabledState();
|
2014-01-16 12:16:25 +01:00
|
|
|
|
|
|
|
|
emit scriptSourceChanged();
|
2010-02-16 13:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2014-05-26 22:13:14 +03:00
|
|
|
Abi QmlProjectRunConfiguration::abi() const
|
2011-02-01 18:36:00 +01:00
|
|
|
{
|
2014-05-26 22:13:14 +03:00
|
|
|
Abi hostAbi = Abi::hostAbi();
|
|
|
|
|
return Abi(hostAbi.architecture(), hostAbi.os(), hostAbi.osFlavor(),
|
|
|
|
|
Abi::RuntimeQmlFormat, hostAbi.wordWidth());
|
2011-02-01 18:36:00 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
QVariantMap QmlProjectRunConfiguration::toMap() const
|
|
|
|
|
{
|
2014-05-26 22:13:14 +03:00
|
|
|
QVariantMap map(RunConfiguration::toMap());
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
map.insert(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY), m_qmlViewerArgs);
|
|
|
|
|
map.insert(QLatin1String(Constants::QML_MAINSCRIPT_KEY), m_scriptFile);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QmlProjectRunConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
m_qmlViewerArgs = map.value(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY)).toString();
|
2012-11-26 21:24:16 +02:00
|
|
|
m_scriptFile = map.value(QLatin1String(Constants::QML_MAINSCRIPT_KEY), QLatin1String(M_CURRENT_FILE)).toString();
|
2010-11-29 12:50:44 +01:00
|
|
|
|
2012-11-26 21:24:16 +02:00
|
|
|
if (m_scriptFile == QLatin1String(M_CURRENT_FILE))
|
2010-12-03 17:04:29 +01:00
|
|
|
setScriptSource(FileInEditor);
|
2012-04-24 15:49:09 +02:00
|
|
|
else if (m_scriptFile.isEmpty())
|
2010-12-03 17:04:29 +01:00
|
|
|
setScriptSource(FileInProjectFile);
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
2010-12-03 17:04:29 +01:00
|
|
|
setScriptSource(FileInSettings, m_scriptFile);
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
return RunConfiguration::fromMap(map);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-30 16:38:57 +02:00
|
|
|
void QmlProjectRunConfiguration::changeCurrentFile(IEditor *editor)
|
2010-08-19 16:51:27 +02:00
|
|
|
{
|
2013-11-05 13:30:08 +01:00
|
|
|
if (!editor)
|
|
|
|
|
editor = EditorManager::currentEditor();
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
if (editor)
|
2014-12-21 21:54:30 +02:00
|
|
|
m_currentFileFilename = editor->document()->filePath().toString();
|
2017-07-17 14:34:05 +02:00
|
|
|
updateEnabledState();
|
2010-08-19 16:51:27 +02:00
|
|
|
}
|
|
|
|
|
|
2017-07-17 14:34:05 +02:00
|
|
|
void QmlProjectRunConfiguration::updateEnabledState()
|
2010-03-05 11:11:05 +01:00
|
|
|
{
|
2010-08-19 16:51:27 +02:00
|
|
|
bool qmlFileFound = false;
|
2012-01-02 11:53:37 +01:00
|
|
|
if (mainScriptSource() == FileInEditor) {
|
2013-08-30 16:38:57 +02:00
|
|
|
IDocument *document = EditorManager::currentDocument();
|
2017-03-02 12:07:11 +01:00
|
|
|
Utils::MimeType mainScriptMimeType = Utils::mimeTypeForFile(mainScript());
|
2013-07-09 11:52:44 +02:00
|
|
|
if (document) {
|
2014-12-21 21:54:30 +02:00
|
|
|
m_currentFileFilename = document->filePath().toString();
|
2017-10-17 18:53:28 +02:00
|
|
|
if (mainScriptMimeType.matchesName(
|
|
|
|
|
QLatin1String(ProjectExplorer::Constants::QML_MIMETYPE))
|
|
|
|
|
|| mainScriptMimeType.matchesName(
|
|
|
|
|
QLatin1String(ProjectExplorer::Constants::QMLUI_MIMETYPE))) {
|
2010-08-19 16:51:27 +02:00
|
|
|
qmlFileFound = true;
|
2017-10-17 18:53:28 +02:00
|
|
|
}
|
2010-06-10 09:10:11 +02:00
|
|
|
}
|
2013-07-09 11:52:44 +02:00
|
|
|
if (!document
|
2015-08-05 15:16:27 +02:00
|
|
|
|| mainScriptMimeType.matchesName(QLatin1String(QmlJSTools::Constants::QMLPROJECT_MIMETYPE))) {
|
2010-11-29 09:45:30 +01:00
|
|
|
// find a qml file with lowercase filename. This is slow, but only done
|
|
|
|
|
// in initialization/other border cases.
|
2017-12-06 10:27:27 +01:00
|
|
|
foreach (const Utils::FileName &filename, target()->project()->files(Project::AllFiles)) {
|
|
|
|
|
const QFileInfo fi = filename.toFileInfo();
|
2010-03-08 14:36:44 +01:00
|
|
|
|
2017-10-17 18:53:28 +02:00
|
|
|
if (!filename.isEmpty() && fi.baseName()[0].isLower()) {
|
|
|
|
|
Utils::MimeType type = Utils::mimeTypeForFile(fi);
|
|
|
|
|
if (type.matchesName(QLatin1String(ProjectExplorer::Constants::QML_MIMETYPE))
|
|
|
|
|
|| type.matchesName(
|
|
|
|
|
QLatin1String(ProjectExplorer::Constants::QMLUI_MIMETYPE))) {
|
2017-12-06 10:27:27 +01:00
|
|
|
m_currentFileFilename = filename.toString();
|
2017-10-17 18:53:28 +02:00
|
|
|
qmlFileFound = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2010-03-08 14:36:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2010-03-05 11:11:05 +01:00
|
|
|
}
|
2010-08-19 16:51:27 +02:00
|
|
|
} else { // use default one
|
2010-12-03 17:04:29 +01:00
|
|
|
qmlFileFound = !mainScript().isEmpty();
|
2010-08-19 16:51:27 +02:00
|
|
|
}
|
|
|
|
|
|
2017-11-28 15:57:15 +01:00
|
|
|
if (!qmlFileFound) {
|
2017-07-17 14:34:05 +02:00
|
|
|
setEnabled(false);
|
2017-11-28 15:57:15 +01:00
|
|
|
} else {
|
|
|
|
|
const QString exe = executable();
|
|
|
|
|
if (exe.isEmpty()) {
|
|
|
|
|
setEnabled(false);
|
|
|
|
|
} else {
|
|
|
|
|
RunConfiguration::updateEnabledState();
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-05 11:11:05 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
} // namespace QmlProjectManager
|