From 25f3fe145d4e382ef9295da748e27dbeffbc6a2a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 21 Sep 2018 02:09:11 +0300 Subject: [PATCH 01/16] RemoteLinux: Remove usage of deprecated QDateTime::toTime_t Change-Id: I84708eea3f7a24400776169ffaea122e50100d8e Reviewed-by: Eike Ziller --- src/plugins/remotelinux/tarpackagecreationstep.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index bcf631d8f23..475a9dfc4e4 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -361,8 +361,9 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn const QByteArray sizeString = QString::fromLatin1("%1").arg(fileInfo.size(), sizeof header.length - 1, 8, QLatin1Char('0')).toLatin1(); std::memcpy(&header.length, sizeString.data(), sizeString.length()); - const QByteArray mtimeString = QString::fromLatin1("%1").arg(fileInfo.lastModified().toTime_t(), - sizeof header.mtime - 1, 8, QLatin1Char('0')).toLatin1(); + const QByteArray mtimeString = QString::fromLatin1("%1").arg( + fileInfo.lastModified().toSecsSinceEpoch(), + sizeof header.mtime - 1, 8, QLatin1Char('0')).toLatin1(); std::memcpy(&header.mtime, mtimeString.data(), mtimeString.length()); if (fileInfo.isDir()) header.typeflag = '5'; From a5d53979641f2908a427d6acc9bcd87890b99941 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 28 Sep 2018 10:16:13 +0200 Subject: [PATCH 02/16] UpdateInfo: Fix unnecessary initialization delay No need to start a one minute timer in delayedInitialize and then even delay the next one by returning true from there. Just start the timer in extensionsInitialized directly. Change-Id: Ie36c8cef588603b1e9cb27a3a14db5d1dec1dae9 Reviewed-by: Christian Stenger --- src/plugins/updateinfo/updateinfoplugin.cpp | 8 +------- src/plugins/updateinfo/updateinfoplugin.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 9ffb8d2ed08..917bda94745 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -179,16 +179,10 @@ bool UpdateInfoPlugin::isCheckForUpdatesRunning() const return d->m_checkUpdatesCommand; } -bool UpdateInfoPlugin::delayedInitialize() +void UpdateInfoPlugin::extensionsInitialized() { if (isAutomaticCheck()) QTimer::singleShot(OneMinute, this, &UpdateInfoPlugin::startAutoCheckForUpdates); - - return true; -} - -void UpdateInfoPlugin::extensionsInitialized() -{ } bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString *errorMessage) diff --git a/src/plugins/updateinfo/updateinfoplugin.h b/src/plugins/updateinfo/updateinfoplugin.h index 689d1baecfd..4b1a6147576 100644 --- a/src/plugins/updateinfo/updateinfoplugin.h +++ b/src/plugins/updateinfo/updateinfoplugin.h @@ -52,7 +52,6 @@ public: UpdateInfoPlugin(); virtual ~UpdateInfoPlugin(); - bool delayedInitialize(); void extensionsInitialized(); bool initialize(const QStringList &arguments, QString *errorMessage); From a108a912ddaf935fe614fb6e499588a7c9e45fb8 Mon Sep 17 00:00:00 2001 From: Sergey Morozov Date: Sat, 22 Sep 2018 14:36:02 +0300 Subject: [PATCH 03/16] Cppcheck: Fix progress parsing Change-Id: I14bc5b93b00fee25d9e307606c4fc7b30ca23fe8 Reviewed-by: Orgad Shaneh --- src/plugins/cppcheck/cppchecktool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cppcheck/cppchecktool.cpp b/src/plugins/cppcheck/cppchecktool.cpp index e77001a7b36..cbf53aad796 100644 --- a/src/plugins/cppcheck/cppchecktool.cpp +++ b/src/plugins/cppcheck/cppchecktool.cpp @@ -47,7 +47,7 @@ namespace Internal { CppcheckTool::CppcheckTool(CppcheckTextMarkManager &marks) : m_marks(marks), - m_progressRegexp("^.* checked (\\d)% done$"), + m_progressRegexp("^.* checked (\\d+)% done$"), m_messageRegexp("^(.+),(\\d+),(\\w+),(\\w+),(.*)$") { m_runner = std::make_unique(*this); From 754fd66a0b14d62864ca343f966f3990d997748a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 28 Sep 2018 00:25:23 +0300 Subject: [PATCH 04/16] Git: Suppress error messages for newly initialized repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib7161e165fdf9cc2b1167b683e8e3dac17e0f1d6 Reviewed-by: AndrĂ© Hartmann --- src/plugins/git/gitclient.cpp | 5 +++-- src/plugins/git/gitclient.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 8263ea29ac9..fe370f45235 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1564,10 +1564,11 @@ bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QS } // Retrieve head revision -QString GitClient::synchronousTopRevision(const QString &workingDirectory, QString *errorMessageIn) +QString GitClient::synchronousTopRevision(const QString &workingDirectory) { QString revision; - if (!synchronousRevParseCmd(workingDirectory, HEAD, &revision, errorMessageIn)) + QString errorMessage; + if (!synchronousRevParseCmd(workingDirectory, HEAD, &revision, &errorMessage)) return QString(); return revision; diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 03ee95dd5f8..30df75fb907 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -235,7 +235,7 @@ public: QString synchronousTopic(const QString &workingDirectory) const; bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref, QString *output, QString *errorMessage = nullptr) const; - QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = nullptr); + QString synchronousTopRevision(const QString &workingDirectory); void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision, QString &precedes, QString &follows) const; bool isRemoteCommit(const QString &workingDirectory, const QString &commit); From 017f4d7c4d6ec5b2f667ba5d0ad692e7f52ac182 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 22 Sep 2018 22:50:29 +0200 Subject: [PATCH 05/16] Git: Add shortcut to "manage remotes" to branch view Change-Id: I36d9196a41869176f8ad602f1ba406402fc5b77c Reviewed-by: Orgad Shaneh --- src/plugins/git/branchview.cpp | 3 +++ src/plugins/git/gitplugin.cpp | 4 ++-- src/plugins/git/gitplugin.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index 7487e73b5f7..406304608dd 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -180,6 +180,9 @@ void BranchView::slotCustomContextMenu(const QPoint &point) contextMenu.addAction(tr("Fetch"), this, [this, &remote]() { GitPlugin::client()->fetch(m_repository, *remote); }); + contextMenu.addSeparator(); + contextMenu.addAction(tr("Manage Remotes..."), GitPlugin::instance(), + &GitPlugin::manageRemotes); } if (hasActions) { if (!currentSelected && (isLocal || isTag)) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 2869d73bc7d..cafcc554702 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -573,7 +573,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) remoteRepositoryMenu->addSeparator(context); createRepositoryAction(remoteRepositoryMenu, tr("Manage Remotes..."), "Git.RemoteList", - context, false, std::bind(&GitPlugin::remoteList, this)); + context, false, std::bind(&GitPlugin::manageRemotes, this)); /* \"Remote Repository" menu */ @@ -1314,7 +1314,7 @@ void GitPlugin::branchList() NavigationWidget::activateSubWidget(Constants::GIT_BRANCH_VIEW_ID, Side::Right); } -void GitPlugin::remoteList() +void GitPlugin::manageRemotes() { showNonModalDialog(currentState().topLevel(), m_remoteDialog); } diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 3a73ebc1b73..fde722bd4b8 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -92,6 +92,7 @@ public: QObject *remoteCommand(const QStringList &options, const QString &workingDirectory, const QStringList &args) override; + void manageRemotes(); protected: void updateActions(VcsBase::VcsBasePlugin::ActionState) override; @@ -135,7 +136,6 @@ private: void stashSnapshot(); void stashPop(); void branchList(); - void remoteList(); void stashList(); void fetch(); void pull(); From 546956a302d7a91006460b55e699e1b832b02a3d Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Thu, 27 Sep 2018 21:01:53 +0200 Subject: [PATCH 06/16] Git: Allow creating a new repository from branch view ... when clicking "Add Branch" in a project that is not under git version control. The "Add Branch" serves no purpose here, so re-use it to call this (already existing) function. Done-with: Orgad Shaneh Change-Id: Ib23d2cbeec0598e0b6f00cbde265793cc25e6142 Reviewed-by: Orgad Shaneh --- src/plugins/git/branchview.cpp | 8 +++++++- src/plugins/git/gitplugin.cpp | 5 +++++ src/plugins/git/gitplugin.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index 406304608dd..4619a21e7ec 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -67,7 +67,6 @@ BranchView::BranchView() : m_model(new BranchModel(GitPlugin::client(), this)) { m_addButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon()); - m_addButton->setToolTip(tr("Add Branch")); m_addButton->setProperty("noArrow", true); connect(m_addButton, &QToolButton::clicked, this, &BranchView::add); @@ -126,10 +125,12 @@ void BranchView::refresh(const QString &repository, bool force) m_repository = repository; if (m_repository.isEmpty()) { m_repositoryLabel->setText(tr("")); + m_addButton->setToolTip(tr("Create Git Repository...")); m_branchView->setEnabled(false); } else { m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository)); m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository)); + m_addButton->setToolTip(tr("Add Branch...")); m_branchView->setEnabled(true); } QString errorMessage; @@ -252,6 +253,11 @@ QModelIndex BranchView::selectedIndex() bool BranchView::add() { + if (m_repository.isEmpty()) { + GitPlugin::instance()->initRepository(); + return true; + } + QModelIndex trackedIndex = selectedIndex(); QString trackedBranch = m_model->fullName(trackedIndex); if (trackedBranch.isEmpty()) { diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index cafcc554702..87aac67ef09 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1319,6 +1319,11 @@ void GitPlugin::manageRemotes() showNonModalDialog(currentState().topLevel(), m_remoteDialog); } +void GitPlugin::initRepository() +{ + createRepository(); +} + void GitPlugin::stashList() { showNonModalDialog(currentState().topLevel(), m_stashDialog); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index fde722bd4b8..8722cc058d8 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -93,6 +93,7 @@ public: QObject *remoteCommand(const QStringList &options, const QString &workingDirectory, const QStringList &args) override; void manageRemotes(); + void initRepository(); protected: void updateActions(VcsBase::VcsBasePlugin::ActionState) override; From f01ee04f4fa1334ca6e2dcc6c31289676f98d1b1 Mon Sep 17 00:00:00 2001 From: Sergey Morozov Date: Sat, 22 Sep 2018 14:22:03 +0300 Subject: [PATCH 07/16] Cppcheck: Kill current check process only when needed Kill only if it processes specified files Change-Id: I5dee99ec8aeaf3bf4d9dbf6aad195f54176170a2 Reviewed-by: Orgad Shaneh --- src/plugins/cppcheck/cppcheckrunner.cpp | 10 ++++++---- src/plugins/cppcheck/cppcheckrunner.h | 2 +- src/plugins/cppcheck/cppchecktool.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/cppcheck/cppcheckrunner.cpp b/src/plugins/cppcheck/cppcheckrunner.cpp index b1d5f1b6c69..c7472588386 100644 --- a/src/plugins/cppcheck/cppcheckrunner.cpp +++ b/src/plugins/cppcheck/cppcheckrunner.cpp @@ -87,17 +87,19 @@ void CppcheckRunner::addToQueue(const Utils::FileNameList &files, } if (m_isRunning) { - if (existing == m_currentFiles) - m_process->kill(); // Further processing in handleFinished + stop(existing); return; } m_queueTimer.start(); } -void CppcheckRunner::stop() +void CppcheckRunner::stop(const Utils::FileNameList &files) { - if (m_isRunning) + if (!m_isRunning) + return; + + if (files.isEmpty() || m_currentFiles == files) m_process->kill(); } diff --git a/src/plugins/cppcheck/cppcheckrunner.h b/src/plugins/cppcheck/cppcheckrunner.h index 760105c462c..733ef07d6d8 100644 --- a/src/plugins/cppcheck/cppcheckrunner.h +++ b/src/plugins/cppcheck/cppcheckrunner.h @@ -51,7 +51,7 @@ public: void addToQueue(const Utils::FileNameList &files, const QString &additionalArguments = {}); void removeFromQueue(const Utils::FileNameList &files); - void stop(); + void stop(const Utils::FileNameList &files = {}); const Utils::FileNameList ¤tFiles() const; QString currentCommand() const; diff --git a/src/plugins/cppcheck/cppchecktool.cpp b/src/plugins/cppcheck/cppchecktool.cpp index cbf53aad796..28111cd3f6e 100644 --- a/src/plugins/cppcheck/cppchecktool.cpp +++ b/src/plugins/cppcheck/cppchecktool.cpp @@ -229,7 +229,7 @@ void CppcheckTool::addToQueue(const Utils::FileNameList &files, CppTools::Projec void CppcheckTool::stop(const Utils::FileNameList &files) { m_runner->removeFromQueue(files); - m_runner->stop(); + m_runner->stop(files); } void CppcheckTool::startParsing() From e9eeaf33b3a84b32b2ef31c964b8cbea738cac59 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 30 Sep 2018 08:46:48 +0300 Subject: [PATCH 08/16] Git: Detect also gitfile in isVcsFileOrDirectory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic182407505fbcb9b5bd1768126885c4b06a30280 Reviewed-by: AndrĂ© Hartmann --- src/plugins/git/gitversioncontrol.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index aa6069e2f74..dc0607cbb73 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -78,8 +78,11 @@ Core::Id GitVersionControl::id() const bool GitVersionControl::isVcsFileOrDirectory(const Utils::FileName &fileName) const { - return fileName.toFileInfo().isDir() - && !fileName.fileName().compare(".git", Utils::HostOsInfo::fileNameCaseSensitivity()); + if (fileName.fileName().compare(".git", Utils::HostOsInfo::fileNameCaseSensitivity())) + return false; + if (fileName.toFileInfo().isDir()) + return true; + return QFile(fileName.toString()).readLine().startsWith("gitdir: "); } bool GitVersionControl::isConfigured() const From 488f3c61d2508f3410d0ecaf40ea9ea732c619d6 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 28 Sep 2018 08:32:04 +0200 Subject: [PATCH 09/16] AutoTest: Add filter for interfering option Bring GTest options and environment variables on par. Change-Id: If350fac04f965a1d493fe0cff0fe3eb8d1dddae0 Reviewed-by: David Schulz --- src/plugins/autotest/gtest/gtestconfiguration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp index dacd84c4324..8297289407f 100644 --- a/src/plugins/autotest/gtest/gtestconfiguration.cpp +++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp @@ -54,7 +54,8 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted) "--gtest_stream_result_to=", "--gtest_break_on_failure", "--gtest_throw_on_failure", - "--gtest_color=" + "--gtest_color=", + "--gtest_print_time=" }; QSet allowed = Utils::filtered(provided.toSet(), [] (const QString &arg) { From 7d779bad7cc052c4d09859fc46d95792e4f0658f Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 28 Sep 2018 09:10:03 +0200 Subject: [PATCH 10/16] AutoTest: Fix icons for results pane Summary items with type pass or fail including warnings had wrong or no icon at all. Change-Id: I2ce3c7c8f0c9c93e80809281ede0aba17fc59e82 Reviewed-by: David Schulz --- src/plugins/autotest/testresultmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index d4dd274c478..a694ba8c228 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -69,9 +69,9 @@ static QIcon testResultIcon(Result::Type result) { case Result::MessageTestCaseFail: return icons[Result::Fail]; case Result::MessageTestCaseSuccessWarn: - return icons[13]; - case Result::MessageTestCaseFailWarn: return icons[14]; + case Result::MessageTestCaseFailWarn: + return icons[15]; default: return QIcon(); } From 18a6265f1374d1389629530d664d7a1593af14e1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 28 Sep 2018 10:36:42 +0200 Subject: [PATCH 11/16] ProjectExplorer: Make kits available earlier during startup delayedInitialize is run in reverse dependency order, so ProjectExplorer's will naturally be run very late during startup. It also depends on which other plugins do what during delayed initialization. Since we want the kits to be available early during startup, so the user can e.g. click on a project in Welcome mode and have them available, it is better to use a custom, short timer for this instead. Task-number: QTCREATORBUG-19381 Change-Id: I7bafa9cf77b86c11d420bb684eadf51c48abd5ed Reviewed-by: hjk --- src/plugins/projectexplorer/projectexplorer.cpp | 5 +++-- src/plugins/projectexplorer/projectexplorer.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e223c1d2f10..a63d8dafa0d 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1686,9 +1686,11 @@ void ProjectExplorerPlugin::extensionsInitialized() BuildManager::extensionsInitialized(); DeviceManager::instance()->addDevice(IDevice::Ptr(new DesktopDevice)); + // delay restoring kits until UI is shown for improved perceived startup performance + QTimer::singleShot(0, this, &ProjectExplorerPlugin::restoreKits); } -bool ProjectExplorerPlugin::delayedInitialize() +void ProjectExplorerPlugin::restoreKits() { dd->determineSessionToRestoreAtStartup(); ExtraAbi::load(); // Load this before Toolchains! @@ -1696,7 +1698,6 @@ bool ProjectExplorerPlugin::delayedInitialize() ToolChainManager::restoreToolChains(); dd->m_kitManager->restoreKits(); QTimer::singleShot(0, dd, &ProjectExplorerPluginPrivate::restoreSession); // delay a bit... - return true; } void ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu() diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 48281d2581c..153f8d0c105 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -123,7 +123,7 @@ public: //PluginInterface bool initialize(const QStringList &arguments, QString *errorMessage) override; void extensionsInitialized() override; - bool delayedInitialize() override; + void restoreKits(); ShutdownFlag aboutToShutdown() override; static void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes); From e2e9707510ae653fe40597b9f954eae11ec52201 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 28 Sep 2018 10:25:34 +0200 Subject: [PATCH 12/16] Fix plugin loading profiling report We print a report both before and after a plugin's initialization method is called, but only the time spent till after the method call should be counted. This makes a different for the delayedInitialize cycle: Before delayedInitialize is called of a plugin, there can be a delay after the previous one. But this delay should not be counted as part of the initialization time of the plugin. Change-Id: I4e5fb53cd83cb36a45a599cfc3f1f8539f6327f9 Reviewed-by: Christian Stenger --- src/libs/extensionsystem/pluginmanager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 665b89f8862..b6ee6afa11e 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -1525,16 +1525,16 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s const int absoluteElapsedMS = m_profileTimer->elapsed(); const int elapsedMS = absoluteElapsedMS - m_profileElapsedMS; m_profileElapsedMS = absoluteElapsedMS; - if (spec) - m_profileTotal[spec] += elapsedMS; if (spec) qDebug("%-22s %-22s %8dms (%8dms)", what, qPrintable(spec->name()), absoluteElapsedMS, elapsedMS); else qDebug("%-45s %8dms (%8dms)", what, absoluteElapsedMS, elapsedMS); if (what && *what == '<') { QString tc; - if (spec) + if (spec) { + m_profileTotal[spec] += elapsedMS; tc = spec->name() + '_'; + } tc += QString::fromUtf8(QByteArray(what + 1)); Utils::Benchmarker::report("loadPlugins", tc, elapsedMS); } From c6906304a2bb238bc3c78b1c5461efe21b1109f7 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 1 Oct 2018 10:15:29 +0200 Subject: [PATCH 13/16] Help: Fix 'Get Started Now' button Change-Id: If9fed047f29ee069569f1317b8844bf4369f8cb7 Reviewed-by: Eike Ziller --- src/plugins/help/helpmanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h index 97b0b4e427d..1939839ec8d 100644 --- a/src/plugins/help/helpmanager.h +++ b/src/plugins/help/helpmanager.h @@ -76,7 +76,7 @@ public: static void aboutToShutdown(); - void handleHelpRequest( + Q_INVOKABLE void handleHelpRequest( const QUrl &url, Core::HelpManager::HelpViewerLocation location = Core::HelpManager::HelpModeAlways) override; From c5d961fe015e9870cd2580fdaa459277ed182e50 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 1 Oct 2018 11:21:32 +0200 Subject: [PATCH 14/16] Squish: Let startQC() return applicationContext Change-Id: I56aff938095948031ff7b4e5fd522654208e4f6b Reviewed-by: Robert Loehning --- tests/system/shared/qtcreator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 734a65f0d5d..cd572a4a794 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -65,7 +65,7 @@ def startQC(additionalParameters=None, withPreparedSettingsPath=True): if platform.system() in ('Microsoft', 'Windows'): # for hooking into native file dialog appWithOptions.extend(('-platform', 'windows:dialogs=none')) test.log("Starting now: %s" % ' '.join(appWithOptions)) - startApplication(' '.join(appWithOptions)) + return startApplication(' '.join(appWithOptions)) def startedWithoutPluginError(): try: From 1785b0f56111f10eb81df9977f24c73358e1eb9b Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 3 Aug 2018 15:48:20 +0200 Subject: [PATCH 15/16] Squish: Use TestSections in tst_create_proj_wizard Change-Id: Ib097f629a1815e9f372e4bdf91faa14b3a7b9042 Reviewed-by: Christian Stenger --- .../tst_create_proj_wizard/test.py | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/system/suite_general/tst_create_proj_wizard/test.py b/tests/system/suite_general/tst_create_proj_wizard/test.py index 16834d19b83..c27e8722f3b 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -68,20 +68,21 @@ def main(): for current in availableProjectTypes: category = current.keys()[0] template = current.values()[0] - displayedPlatforms = __createProject__(category, template) - if template.startswith("Qt Quick Application - "): - qtVersionsForQuick = ["5.6", "5.10"] if template == "Qt Quick Application - Empty" else ["5.10"] - for counter, qtVersion in enumerate(qtVersionsForQuick): - def additionalFunc(displayedPlatforms, qtVersion): - requiredQtVersion = __createProjectHandleQtQuickSelection__(qtVersion) - __modifyAvailableTargets__(displayedPlatforms, requiredQtVersion, True) - handleBuildSystemVerifyKits(category, template, kits, displayedPlatforms, - additionalFunc, qtVersion) - # are there more Quick combinations - then recreate this project - if counter < len(qtVersionsForQuick) - 1: - displayedPlatforms = __createProject__(category, template) - continue - handleBuildSystemVerifyKits(category, template, kits, displayedPlatforms) + with TestSection("Testing project template %s -> %s" % (category, template)): + displayedPlatforms = __createProject__(category, template) + if template.startswith("Qt Quick Application - "): + qtVersionsForQuick = ["5.6", "5.10"] if template == "Qt Quick Application - Empty" else ["5.10"] + for counter, qtVersion in enumerate(qtVersionsForQuick): + def additionalFunc(displayedPlatforms, qtVersion): + requiredQtVersion = __createProjectHandleQtQuickSelection__(qtVersion) + __modifyAvailableTargets__(displayedPlatforms, requiredQtVersion, True) + handleBuildSystemVerifyKits(category, template, kits, displayedPlatforms, + additionalFunc, qtVersion) + # are there more Quick combinations - then recreate this project + if counter < len(qtVersionsForQuick) - 1: + displayedPlatforms = __createProject__(category, template) + continue + handleBuildSystemVerifyKits(category, template, kits, displayedPlatforms) invokeMenuItem("File", "Exit") From f5647cc2c4c54d32a79039f19149dfd7781380aa Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 24 Sep 2018 12:26:46 +0200 Subject: [PATCH 16/16] Allow non-host-platform libraries in Add Library wizard Since much of the available UI and behavior depends on which platform's library we start with, let the user choose a platform filter. Default is the host OS. Task-number: QTCREATORBUG-17995 Change-Id: Ic8bec7ac30eecf08c1684da4f2823a8add8f6d20 Reviewed-by: Jarek Kobus --- src/libs/utils/pathchooser.cpp | 1 + .../librarydetailscontroller.cpp | 90 +++++++++++-------- .../librarydetailscontroller.h | 3 + .../librarydetailswidget.ui | 56 +++++++----- 4 files changed, 94 insertions(+), 56 deletions(-) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 7efe61db630..45600b7aa1d 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -655,6 +655,7 @@ QString PathChooser::promptDialogTitle() const void PathChooser::setPromptDialogFilter(const QString &filter) { d->m_dialogFilter = filter; + d->m_lineEdit->validate(); } QString PathChooser::promptDialogFilter() const diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp index 12bc0e69fc0..5e7ba07673e 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp +++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp @@ -43,6 +43,16 @@ using namespace ProjectExplorer; using namespace QmakeProjectManager; using namespace QmakeProjectManager::Internal; +static void fillLibraryPlatformTypes(QComboBox *comboBox) +{ + comboBox->clear(); + comboBox->addItem("Windows (*.lib lib*.a)", int(Utils::OsTypeWindows)); + comboBox->addItem("Linux (lib*.so lib*.a)", int(Utils::OsTypeLinux)); + comboBox->addItem("macOS (*.dylib *.a *.framework)", int(Utils::OsTypeMac)); + const int currentIndex = comboBox->findData(int(Utils::HostOsInfo::hostOs())); + comboBox->setCurrentIndex(std::max(0, currentIndex)); +} + LibraryDetailsController::LibraryDetailsController( Ui::LibraryDetailsWidget *libraryDetails, const QString &proFile, QObject *parent) : @@ -73,6 +83,8 @@ LibraryDetailsController::LibraryDetailsController( this, &LibraryDetailsController::slotPlatformChanged); connect(m_libraryDetailsWidget->winCheckBox, &QAbstractButton::clicked, this, &LibraryDetailsController::slotPlatformChanged); + + fillLibraryPlatformTypes(m_libraryDetailsWidget->libraryTypeComboBox); } Ui::LibraryDetailsWidget *LibraryDetailsController::libraryDetailsWidget() const @@ -95,6 +107,16 @@ AddLibraryWizard::MacLibraryType LibraryDetailsController::macLibraryType() cons return m_macLibraryType; } +Utils::OsType LibraryDetailsController::libraryPlatformType() const +{ + return Utils::OsType(m_libraryDetailsWidget->libraryTypeComboBox->currentData().value()); +} + +QString LibraryDetailsController::libraryPlatformFilter() const +{ + return m_libraryDetailsWidget->libraryTypeComboBox->currentText(); +} + void LibraryDetailsController::updateGui() { // read values from gui @@ -249,6 +271,8 @@ void LibraryDetailsController::setMacLibraryGroupVisible(bool ena) void LibraryDetailsController::setLibraryPathChooserVisible(bool ena) { + libraryDetailsWidget()->libraryTypeComboBox->setVisible(ena); + libraryDetailsWidget()->libraryTypeLabel->setVisible(ena); libraryDetailsWidget()->libraryPathChooser->setVisible(ena); libraryDetailsWidget()->libraryFileLabel->setVisible(ena); } @@ -578,29 +602,6 @@ NonInternalLibraryDetailsController::NonInternalLibraryDetailsController( setLibraryComboBoxVisible(false); setLibraryPathChooserVisible(true); - if (Utils::HostOsInfo::isWindowsHost()) { - libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter( - QLatin1String("Library file (*.lib lib*.a)")); - setLinkageRadiosVisible(true); - setRemoveSuffixVisible(true); - } else { - setLinkageRadiosVisible(false); - setRemoveSuffixVisible(false); - } - - if (Utils::HostOsInfo::isLinuxHost()) - libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter( - QLatin1String("Library file (lib*.so lib*.a)")); - - if (Utils::HostOsInfo::isMacHost()) { - libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter( - QLatin1String("Library file (*.dylib *.a *.framework)")); - // QLatin1String("Library file (lib*.dylib lib*.a *.framework)")); - libraryDetailsWidget()->libraryPathChooser->setExpectedKind(Utils::PathChooser::Any); - } else { - libraryDetailsWidget()->libraryPathChooser->setExpectedKind(Utils::PathChooser::File); - } - connect(libraryDetailsWidget()->libraryPathChooser, &Utils::PathChooser::validChanged, this, &LibraryDetailsController::completeChanged); connect(libraryDetailsWidget()->libraryPathChooser, &Utils::PathChooser::rawPathChanged, @@ -611,12 +612,15 @@ NonInternalLibraryDetailsController::NonInternalLibraryDetailsController( this, &NonInternalLibraryDetailsController::slotLinkageTypeChanged); connect(libraryDetailsWidget()->staticRadio, &QAbstractButton::clicked, this, &NonInternalLibraryDetailsController::slotLinkageTypeChanged); + connect(libraryDetailsWidget()->libraryTypeComboBox, &QComboBox::currentTextChanged, + this, &NonInternalLibraryDetailsController::slotLibraryTypeChanged); + slotLibraryTypeChanged(); } AddLibraryWizard::LinkageType NonInternalLibraryDetailsController::suggestedLinkageType() const { AddLibraryWizard::LinkageType type = AddLibraryWizard::NoLinkage; - if (!Utils::HostOsInfo::isWindowsHost()) { + if (libraryPlatformType() != Utils::OsTypeWindows) { if (libraryDetailsWidget()->libraryPathChooser->isValid()) { QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->path()); if (fi.suffix() == QLatin1String("a")) @@ -631,7 +635,7 @@ AddLibraryWizard::LinkageType NonInternalLibraryDetailsController::suggestedLink AddLibraryWizard::MacLibraryType NonInternalLibraryDetailsController::suggestedMacLibraryType() const { AddLibraryWizard::MacLibraryType type = AddLibraryWizard::NoLibraryType; - if (Utils::HostOsInfo::isMacHost()) { + if (libraryPlatformType() == Utils::OsTypeMac) { if (libraryDetailsWidget()->libraryPathChooser->isValid()) { QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->path()); if (fi.suffix() == QLatin1String("framework")) @@ -665,7 +669,7 @@ QString NonInternalLibraryDetailsController::suggestedIncludePath() const void NonInternalLibraryDetailsController::updateWindowsOptionsEnablement() { bool ena = platforms() & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); - if (Utils::HostOsInfo::isWindowsHost()) { + if (libraryPlatformType() == Utils::OsTypeWindows) { libraryDetailsWidget()->addSuffixCheckBox->setEnabled(ena); ena = true; } @@ -695,9 +699,26 @@ void NonInternalLibraryDetailsController::slotRemoveSuffixChanged(bool ena) } } +void NonInternalLibraryDetailsController::slotLibraryTypeChanged() +{ + libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter(libraryPlatformFilter()); + const bool isMacOs = libraryPlatformType() == Utils::OsTypeMac; + const bool isWindows = libraryPlatformType() == Utils::OsTypeWindows; + libraryDetailsWidget()->libraryPathChooser->setExpectedKind(isMacOs ? Utils::PathChooser::Any + : Utils::PathChooser::File); + setMacLibraryRadiosVisible(!isMacOs); + setLinkageRadiosVisible(isWindows); + setRemoveSuffixVisible(isWindows); + + updateWindowsOptionsEnablement(); + slotLibraryPathChanged(); + slotLinkageTypeChanged(); + libraryDetailsWidget()->detailsLayout->parentWidget()->window()->adjustSize(); +} + void NonInternalLibraryDetailsController::slotLibraryPathChanged() { - if (Utils::HostOsInfo::isWindowsHost()) { + if (libraryPlatformType() == Utils::OsTypeWindows) { bool subfoldersEnabled = true; bool removeSuffixEnabled = true; if (libraryDetailsWidget()->libraryPathChooser->isValid()) { @@ -739,13 +760,13 @@ QString NonInternalLibraryDetailsController::snippet() const QString libName; const bool removeSuffix = isWindowsGroupVisible() && libraryDetailsWidget()->removeSuffixCheckBox->isChecked(); - if (Utils::HostOsInfo::isWindowsHost()) { + if (libraryPlatformType() == Utils::OsTypeWindows) { libName = fi.completeBaseName(); if (removeSuffix && !libName.isEmpty()) // remove last letter which needs to be "d" libName = libName.left(libName.size() - 1); if (fi.completeSuffix() == QLatin1String("a")) // the mingw lib case libName = libName.mid(3); // cut the "lib" prefix - } else if (Utils::HostOsInfo::isMacHost()) { + } else if (libraryPlatformType() == Utils::OsTypeMac) { if (macLibraryType() == AddLibraryWizard::FrameworkType) libName = fi.completeBaseName(); else @@ -759,7 +780,7 @@ QString NonInternalLibraryDetailsController::snippet() const if (isWindowsGroupVisible()) { // when we are on Win but we don't generate the code for Win // we still need to remove "debug" or "release" subfolder - const bool useSubfoldersCondition = (Utils::HostOsInfo::isWindowsHost()) + const bool useSubfoldersCondition = (libraryPlatformType() == Utils::OsTypeWindows) ? true : platforms() & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform); if (useSubfoldersCondition) @@ -774,7 +795,7 @@ QString NonInternalLibraryDetailsController::snippet() const QFileInfo pfi(proFile()); QDir pdir = pfi.absoluteDir(); QString absoluteLibraryPath = fi.absolutePath(); - if (Utils::HostOsInfo::isWindowsHost() && useSubfolders) { // drop last subfolder which needs to be "debug" or "release" + if (libraryPlatformType() == Utils::OsTypeWindows && useSubfolders) { // drop last subfolder which needs to be "debug" or "release" QFileInfo libfi(absoluteLibraryPath); absoluteLibraryPath = libfi.absolutePath(); } @@ -889,12 +910,10 @@ void ExternalLibraryDetailsController::updateWindowsOptionsEnablement() { NonInternalLibraryDetailsController::updateWindowsOptionsEnablement(); - if (!Utils::HostOsInfo::isWindowsHost()) - return; - bool subfoldersEnabled = true; bool removeSuffixEnabled = true; - if (libraryDetailsWidget()->libraryPathChooser->isValid()) { + if (libraryPlatformType() == Utils::OsTypeWindows + && libraryDetailsWidget()->libraryPathChooser->isValid()) { QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->path()); QFileInfo dfi(fi.absolutePath()); const QString parentFolderName = dfi.fileName().toLower(); @@ -905,7 +924,6 @@ void ExternalLibraryDetailsController::updateWindowsOptionsEnablement() if (baseName.isEmpty() || baseName.at(baseName.size() - 1).toLower() != QLatin1Char('d')) removeSuffixEnabled = false; - } libraryDetailsWidget()->useSubfoldersCheckBox->setEnabled(subfoldersEnabled); libraryDetailsWidget()->removeSuffixCheckBox->setEnabled(removeSuffixEnabled); diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.h b/src/plugins/qmakeprojectmanager/librarydetailscontroller.h index 7aab3b0cc51..a23d9de3763 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.h +++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.h @@ -52,6 +52,8 @@ protected: AddLibraryWizard::Platforms platforms() const; AddLibraryWizard::LinkageType linkageType() const; AddLibraryWizard::MacLibraryType macLibraryType() const; + Utils::OsType libraryPlatformType() const; + QString libraryPlatformFilter() const; QString proFile() const; bool isIncludePathChanged() const; bool guiSignalsIgnored() const; @@ -127,6 +129,7 @@ protected: private: void slotLinkageTypeChanged(); void slotRemoveSuffixChanged(bool ena); + void slotLibraryTypeChanged(); void slotLibraryPathChanged(); }; diff --git a/src/plugins/qmakeprojectmanager/librarydetailswidget.ui b/src/plugins/qmakeprojectmanager/librarydetailswidget.ui index 0d3b4b1c120..0fdace08198 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailswidget.ui +++ b/src/plugins/qmakeprojectmanager/librarydetailswidget.ui @@ -6,13 +6,23 @@ 0 0 - 455 - 370 + 456 + 438 + + QLayout::SetMinimumSize + + + + + Library file: + + + @@ -20,30 +30,20 @@ - - - - - - - Library file: - - - - - - - + Include path: - + - + + + + Package: @@ -51,7 +51,20 @@ - + + + + + + + + + Library type: + + + + + @@ -115,7 +128,10 @@ - + + + QLayout::SetMinimumSize +