diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/android/androiddevice.cpp | 2 | ||||
-rw-r--r-- | src/plugins/docker/dockerdevice.cpp | 37 | ||||
-rw-r--r-- | src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp | 16 | ||||
-rw-r--r-- | src/plugins/qmldesigner/components/navigator/navigatortreeview.h | 5 | ||||
-rw-r--r-- | src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp | 5 | ||||
-rw-r--r-- | src/plugins/qmldesigner/dynamiclicensecheck.h | 51 | ||||
-rw-r--r-- | src/plugins/qmldesigner/qmldesignerplugin.cpp | 17 | ||||
-rw-r--r-- | src/plugins/qmlprojectmanager/qmlprojectplugin.cpp | 2 | ||||
-rw-r--r-- | src/plugins/remotelinux/filesystemaccess_test.cpp | 47 | ||||
-rw-r--r-- | src/plugins/remotelinux/filesystemaccess_test.h | 1 | ||||
-rw-r--r-- | src/plugins/texteditor/snippets/snippeteditor.cpp | 5 | ||||
-rw-r--r-- | src/plugins/texteditor/snippets/snippeteditor.h | 1 |
12 files changed, 149 insertions, 40 deletions
diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index 3c2d4fd5d1a..8609fc7a89f 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -624,7 +624,7 @@ void AndroidDeviceManager::HandleAvdsListChange() } QVector<Id> connectedDevs; - for (auto item : m_avdsFutureWatcher.result()) { + for (const AndroidDeviceInfo &item : m_avdsFutureWatcher.result()) { const Utils::Id deviceId = AndroidDevice::idFromDeviceInfo(item); const QString displayName = AndroidDevice::displayNameFromInfo(item); IDevice::ConstPtr dev = devMgr->find(deviceId); diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index cfa4f54f65d..8b01467e27a 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -51,6 +51,7 @@ #include <utils/environment.h> #include <utils/fileutils.h> #include <utils/hostosinfo.h> +#include <utils/infolabel.h> #include <utils/layoutbuilder.h> #include <utils/overridecursor.h> #include <utils/pathlisteditor.h> @@ -324,13 +325,26 @@ public: data.useLocalUidGid = on; }); + m_pathsListLabel = new InfoLabel(tr("Paths to mount:")); + // FIXME: 8.0: use + //m_pathsListLabel->setToolTip(tr("Source directory list should not be empty")); + m_pathsListEdit = new PathListEditor; + // FIXME: 8.0: use + //m_pathsListEdit->setPlaceholderText(tr("Host directories to mount into the container")); m_pathsListEdit->setToolTip(tr("Maps paths in this list one-to-one to the " "docker container.")); m_pathsListEdit->setPathList(data.mounts); - connect(m_pathsListEdit, &PathListEditor::changed, this, [dockerDevice, this]() { + auto markupMounts = [this] { + const bool isEmpty = m_pathsListEdit->pathList().isEmpty(); + m_pathsListLabel->setType(isEmpty ? InfoLabel::Warning : InfoLabel::None); + }; + markupMounts(); + + connect(m_pathsListEdit, &PathListEditor::changed, this, [dockerDevice, markupMounts, this] { dockerDevice->setMounts(m_pathsListEdit->pathList()); + markupMounts(); }); auto logView = new QTextBrowser; @@ -346,6 +360,8 @@ public: searchDirsComboBox->addItem(tr("Search in Selected Directories")); auto searchDirsLineEdit = new FancyLineEdit; + // FIXME: 8.0: use + //searchDirsLineEdit->setPlaceholderText(tr("Semicolon-separated list of directories")); searchDirsLineEdit->setToolTip( tr("Select the paths in the docker image that should be scanned for kit entries.")); searchDirsLineEdit->setHistoryCompleter("DockerMounts", true); @@ -397,7 +413,7 @@ public: daemonStateLabel, m_daemonReset, m_daemonState, Break(), m_runAsOutsideUser, Break(), Column { - new QLabel(tr("Paths to mount:")), + m_pathsListLabel, m_pathsListEdit, }, Break(), Column { @@ -437,7 +453,8 @@ private: QToolButton *m_daemonReset; QLabel *m_daemonState; QCheckBox *m_runAsOutsideUser; - Utils::PathListEditor *m_pathsListEdit; + InfoLabel *m_pathsListLabel; + PathListEditor *m_pathsListEdit; KitDetector m_kitItemDetector; }; @@ -1545,12 +1562,19 @@ public: m_log = new QTextBrowser; m_log->setVisible(false); + const QString fail = QString{"Docker: "} + + QCoreApplication::translate("Debugger::Internal::GdbEngine", + "Process failed to start."); + auto errorLabel = new Utils::InfoLabel(fail, Utils::InfoLabel::Error, this); + errorLabel->setVisible(false); + m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); using namespace Layouting; Column { m_view, m_log, + errorLabel, m_buttons, }.attachTo(this); @@ -1588,6 +1612,13 @@ public: m_log->append(DockerDevice::tr("Error: %1").arg(out)); }); + connect(m_process, &Utils::QtcProcess::finished, + this, [this, errorLabel]() { + if (m_process->exitCode() != 0) { + errorLabel->setVisible(true); + } + }); + connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, [this] { const QModelIndexList selectedRows = m_view->selectionModel()->selectedRows(); QTC_ASSERT(selectedRows.size() == 1, return); diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp index 2d1ef6f554d..d679e6017d4 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp @@ -281,4 +281,20 @@ bool NavigatorTreeView::viewportEvent(QEvent *event) return QTreeView::viewportEvent(event); } +void NavigatorTreeView::mousePressEvent(QMouseEvent *event) +{ + // Block drag from starting if press was on an item that is not draggable. + // This is necessary as it is the selected items that are dragged and the pressed item may not + // be a selected item, e.g. when pressing on locked item, leading to unexpected drags. + m_dragAllowed = model()->flags(indexAt(event->pos())) & Qt::ItemIsDragEnabled; + + QTreeView::mousePressEvent(event); +} + +void NavigatorTreeView::startDrag(Qt::DropActions supportedActions) +{ + if (m_dragAllowed) + QTreeView::startDrag(supportedActions); +} + } diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreeview.h b/src/plugins/qmldesigner/components/navigator/navigatortreeview.h index 227746e207d..6f2211f82bd 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreeview.h +++ b/src/plugins/qmldesigner/components/navigator/navigatortreeview.h @@ -40,8 +40,13 @@ public: static void drawSelectionBackground(QPainter *painter, const QStyleOption &option); bool viewportEvent(QEvent *event) override; +protected: + void mousePressEvent(QMouseEvent *event) override; + void startDrag(Qt::DropActions supportedActions) override; + private: PreviewToolTip *m_previewToolTip = nullptr; qint32 m_previewToolTipNodeId = -1; + bool m_dragAllowed = true; }; } diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp index 14f1982b72d..c49a8c5035b 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp @@ -32,9 +32,9 @@ #include <coreplugin/messagebox.h> #include "pluginmanager/widgetpluginmanager.h" - #include <QDebug> #include <QMessageBox> +#include <QMutex> enum { debug = false @@ -107,6 +107,7 @@ void MetaInfoPrivate::parseItemLibraryDescriptions() using QmlDesigner::Internal::MetaInfoPrivate; MetaInfo MetaInfo::s_global; +QMutex s_lock; QStringList MetaInfo::s_pluginDirs; @@ -157,6 +158,8 @@ ItemLibraryInfo *MetaInfo::itemLibraryInfo() const */ MetaInfo MetaInfo::global() { + QMutexLocker locker(&s_lock); + if (!s_global.m_p->m_isInitialized) { s_global.m_p = QSharedPointer<MetaInfoPrivate>(new MetaInfoPrivate(&s_global)); s_global.m_p->initialize(); diff --git a/src/plugins/qmldesigner/dynamiclicensecheck.h b/src/plugins/qmldesigner/dynamiclicensecheck.h index 8cc7982895c..fb1e3661b85 100644 --- a/src/plugins/qmldesigner/dynamiclicensecheck.h +++ b/src/plugins/qmldesigner/dynamiclicensecheck.h @@ -42,27 +42,48 @@ enum FoundLicense { enterprise }; -FoundLicense checkLicense() { +namespace Internal { +ExtensionSystem::IPlugin *licenseCheckerPlugin() +{ const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault( ExtensionSystem::PluginManager::plugins(), Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker"))); - if (!pluginSpec) - return community; - - ExtensionSystem::IPlugin *plugin = pluginSpec->plugin(); + if (pluginSpec) + return pluginSpec->plugin(); + return nullptr; +} +} // namespace Internal - if (!plugin) - return community; - bool retVal = false; - bool success = QMetaObject::invokeMethod(plugin, - "qdsEnterpriseLicense", - Qt::DirectConnection, - Q_RETURN_ARG(bool, retVal)); - if (success && retVal) - return enterprise; +FoundLicense checkLicense() +{ + if (auto plugin = Internal::licenseCheckerPlugin()) { + bool retVal = false; + bool success = QMetaObject::invokeMethod(plugin, + "qdsEnterpriseLicense", + Qt::DirectConnection, + Q_RETURN_ARG(bool, retVal)); + if (success && retVal) + return enterprise; + else + return professional; + } + return community; +} - return professional; +QString licensee() +{ + if (auto plugin = Internal::licenseCheckerPlugin()) { + QString retVal; + bool success = QMetaObject::invokeMethod(plugin, + "licensee", + Qt::DirectConnection, + Q_RETURN_ARG(QString, retVal)); + if (success) + return retVal; + } + return {}; } + } // namespace Utils diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index b9ea5c5107b..d23575a8395 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -35,6 +35,7 @@ #include "qmldesignerconstants.h" #include "qmldesignerprojectmanager.h" #include "settingspage.h" +#include "dynamiclicensecheck.h" #include <metainfo.h> #include <connectionview.h> @@ -312,14 +313,24 @@ bool QmlDesignerPlugin::delayedInitialize() d->viewManager.registerFormEditorTool(std::make_unique<QmlDesigner::TransitionTool>()); if (QmlProjectManager::QmlProject::isQtDesignStudio()) { + d->mainWidget.initialize(); + emitUsageStatistics("StandaloneMode"); if (QmlProjectManager::QmlProject::isQtDesignStudioStartedFromQtC()) emitUsageStatistics("QDSlaunchedFromQtC"); - emitUsageStatistics("QDSstartupCount"); + emitUsageStatistics("QDSstartupCount"); + + FoundLicense license = checkLicense(); + if (license == FoundLicense::enterprise) + Core::ICore::appendAboutInformation(tr("License: Enterprise")); + else if (license == FoundLicense::professional) + Core::ICore::appendAboutInformation(tr("License: Professional")); + + if (!licensee().isEmpty()) + Core::ICore::appendAboutInformation(tr("Licensee: %1").arg(licensee())); } - if (QmlProjectManager::QmlProject::isQtDesignStudio()) - d->mainWidget.initialize(); + MetaInfo::global(); return true; } diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index 17cce6402f8..bc7b6f3bde9 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -210,7 +210,7 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage) QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); - if (!editor) + if (!editor || !modelManager) return; if (d->lastMessageBox) diff --git a/src/plugins/remotelinux/filesystemaccess_test.cpp b/src/plugins/remotelinux/filesystemaccess_test.cpp index 2c95a5ca81b..1cf68a056c7 100644 --- a/src/plugins/remotelinux/filesystemaccess_test.cpp +++ b/src/plugins/remotelinux/filesystemaccess_test.cpp @@ -41,10 +41,12 @@ using namespace Utils; namespace RemoteLinux { namespace Internal { -static const char TEST_IP[] = "127.0.0.1"; static const char TEST_DIR[] = "/tmp/testdir"; -static const FilePath baseFilePath = FilePath::fromString("ssh://" + QString(TEST_IP) - + QString(TEST_DIR)); + +static const FilePath baseFilePath() +{ + return FilePath::fromString("ssh://" + QSsh::SshTest::userAtHost() + QString(TEST_DIR)); +} TestLinuxDeviceFactory::TestLinuxDeviceFactory() : IDeviceFactory("test") @@ -54,11 +56,9 @@ TestLinuxDeviceFactory::TestLinuxDeviceFactory() setConstructionFunction(&LinuxDevice::create); setCreator([] { LinuxDevice::Ptr newDev = LinuxDevice::create(); - qDebug() << "device : " << newDev->type(); newDev->setType("test"); - QSsh::SshConnectionParameters sshParams = newDev->sshParameters(); - sshParams.setHost(TEST_IP); - sshParams.setPort(22); + qDebug() << "device : " << newDev->type(); + QSsh::SshConnectionParameters sshParams = QSsh::SshTest::getParameters(); newDev->setSshParameters(sshParams); return newDev; }); @@ -66,15 +66,28 @@ TestLinuxDeviceFactory::TestLinuxDeviceFactory() FilePath createFile(const QString &name) { - FilePath testFilePath = baseFilePath / name; - FilePath dummyFilePath = FilePath::fromString("ssh://" + QString(TEST_IP) + "/dev/null"); + FilePath testFilePath = baseFilePath() / name; + FilePath dummyFilePath = FilePath::fromString("ssh://" + QSsh::SshTest::userAtHost() + "/dev/null"); dummyFilePath.copyFile(testFilePath); return testFilePath; } void FileSystemAccessTest::initTestCase() { - FilePath filePath = baseFilePath; + const QSsh::SshConnectionParameters params = QSsh::SshTest::getParameters(); + qDebug() << "Using following SSH parameter:" + << "\nHost:" << params.host() + << "\nPort:" << params.port() + << "\nUser:" << params.userName() + << "\nSSHKey:" << params.privateKeyFile; + if (!QSsh::SshTest::checkParameters(params)) { + m_skippedAtWhole = true; + QSsh::SshTest::printSetupHelp(); + QSKIP("Ensure you have added your default ssh public key to your own authorized keys and " + "environment QTC_REMOTELINUX_SSH_DEFAULTS set or follow setup help above."); + return; + } + FilePath filePath = baseFilePath(); if (DeviceManager::deviceForPath(filePath) == nullptr) { DeviceManager *const devMgr = DeviceManager::instance(); @@ -87,13 +100,15 @@ void FileSystemAccessTest::initTestCase() void FileSystemAccessTest::cleanupTestCase() { - QVERIFY(baseFilePath.exists()); - QVERIFY(baseFilePath.removeRecursively()); + if (m_skippedAtWhole) // no need to clean up either + return; + QVERIFY(baseFilePath().exists()); + QVERIFY(baseFilePath().removeRecursively()); } void FileSystemAccessTest::testDirStatuses() { - FilePath filePath = baseFilePath; + FilePath filePath = baseFilePath(); QVERIFY(filePath.exists()); QVERIFY(filePath.isDir()); QVERIFY(filePath.isWritableDir()); @@ -120,7 +135,7 @@ void FileSystemAccessTest::testDirStatuses() void FileSystemAccessTest::testBytesAvailable() { - FilePath testFilePath = FilePath::fromString("ssh://" + QString(TEST_IP) + "/tmp"); + FilePath testFilePath = FilePath::fromString("ssh://" + QSsh::SshTest::userAtHost() + "/tmp"); QVERIFY(testFilePath.exists()); QVERIFY(testFilePath.bytesAvailable() > 0); } @@ -143,9 +158,9 @@ void FileSystemAccessTest::testFileActions() // ToDo: remove ".contains", make fileContents exact equal content QVERIFY(testFilePath.fileContents().contains(content)); - QVERIFY(testFilePath.renameFile(baseFilePath / "test1")); + QVERIFY(testFilePath.renameFile(baseFilePath() / "test1")); // It is Ok that FilePath doesn't change itself after rename. - FilePath newTestFilePath = baseFilePath / "test1"; + FilePath newTestFilePath = baseFilePath() / "test1"; QVERIFY(newTestFilePath.exists()); QVERIFY(!testFilePath.removeFile()); QVERIFY(newTestFilePath.exists()); diff --git a/src/plugins/remotelinux/filesystemaccess_test.h b/src/plugins/remotelinux/filesystemaccess_test.h index 4b43e202d44..7dacd1ae936 100644 --- a/src/plugins/remotelinux/filesystemaccess_test.h +++ b/src/plugins/remotelinux/filesystemaccess_test.h @@ -53,6 +53,7 @@ private slots: private: TestLinuxDeviceFactory m_testLinuxDeviceFactory; + bool m_skippedAtWhole = false; }; } // Internal diff --git a/src/plugins/texteditor/snippets/snippeteditor.cpp b/src/plugins/texteditor/snippets/snippeteditor.cpp index 63ca32273a9..01e3757182d 100644 --- a/src/plugins/texteditor/snippets/snippeteditor.cpp +++ b/src/plugins/texteditor/snippets/snippeteditor.cpp @@ -61,4 +61,9 @@ void SnippetEditorWidget::focusOutEvent(QFocusEvent *event) TextEditorWidget::focusOutEvent(event); } +void SnippetEditorWidget::contextMenuEvent(QContextMenuEvent *e) +{ + QPlainTextEdit::contextMenuEvent(e); +} + } // namespace diff --git a/src/plugins/texteditor/snippets/snippeteditor.h b/src/plugins/texteditor/snippets/snippeteditor.h index 8bb972cf685..f422c09bb5f 100644 --- a/src/plugins/texteditor/snippets/snippeteditor.h +++ b/src/plugins/texteditor/snippets/snippeteditor.h @@ -42,6 +42,7 @@ signals: protected: void focusOutEvent(QFocusEvent *event) override; + void contextMenuEvent(QContextMenuEvent *e) override; int extraAreaWidth(int * /* markWidthPtr */ = nullptr) const override { return 0; } }; |