forked from qt-creator/qt-creator
QmakeProjectManager: Proliferate FilePath use
Change-Id: Ife92980a179a2872e4dd5083b60bbd0561be55bc Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -38,8 +38,8 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace QmakeProjectManager;
|
namespace QmakeProjectManager {
|
||||||
using namespace QmakeProjectManager::Internal;
|
namespace Internal {
|
||||||
|
|
||||||
const char qt_file_dialog_filter_reg_exp[] =
|
const char qt_file_dialog_filter_reg_exp[] =
|
||||||
"^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
|
"^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
|
||||||
@@ -79,8 +79,8 @@ static bool validateLibraryPath(const Utils::FilePath &filePath,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddLibraryWizard::AddLibraryWizard(const QString &fileName, QWidget *parent) :
|
AddLibraryWizard::AddLibraryWizard(const Utils::FilePath &proFile, QWidget *parent) :
|
||||||
Utils::Wizard(parent), m_proFile(fileName)
|
Utils::Wizard(parent), m_proFile(proFile)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Add Library"));
|
setWindowTitle(tr("Add Library"));
|
||||||
m_libraryTypePage = new LibraryTypePage(this);
|
m_libraryTypePage = new LibraryTypePage(this);
|
||||||
@@ -93,7 +93,7 @@ AddLibraryWizard::AddLibraryWizard(const QString &fileName, QWidget *parent) :
|
|||||||
|
|
||||||
AddLibraryWizard::~AddLibraryWizard() = default;
|
AddLibraryWizard::~AddLibraryWizard() = default;
|
||||||
|
|
||||||
QString AddLibraryWizard::proFile() const
|
Utils::FilePath AddLibraryWizard::proFile() const
|
||||||
{
|
{
|
||||||
return m_proFile;
|
return m_proFile;
|
||||||
}
|
}
|
||||||
@@ -294,10 +294,9 @@ SummaryPage::SummaryPage(AddLibraryWizard *parent)
|
|||||||
void SummaryPage::initializePage()
|
void SummaryPage::initializePage()
|
||||||
{
|
{
|
||||||
m_snippet = m_libraryWizard->snippet();
|
m_snippet = m_libraryWizard->snippet();
|
||||||
QFileInfo fi(m_libraryWizard->proFile());
|
|
||||||
m_summaryLabel->setText(
|
m_summaryLabel->setText(
|
||||||
tr("The following snippet will be added to the<br><b>%1</b> file:")
|
tr("The following snippet will be added to the<br><b>%1</b> file:")
|
||||||
.arg(fi.fileName()));
|
.arg(m_libraryWizard->proFile().fileName()));
|
||||||
QString richSnippet;
|
QString richSnippet;
|
||||||
{
|
{
|
||||||
QTextStream str(&richSnippet);
|
QTextStream str(&richSnippet);
|
||||||
@@ -316,3 +315,6 @@ QString SummaryPage::snippet() const
|
|||||||
{
|
{
|
||||||
return m_snippet;
|
return m_snippet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // QmakeProjectManager
|
||||||
|
@@ -76,20 +76,18 @@ public:
|
|||||||
|
|
||||||
Q_DECLARE_FLAGS(Platforms, Platform)
|
Q_DECLARE_FLAGS(Platforms, Platform)
|
||||||
|
|
||||||
explicit AddLibraryWizard(const QString &fileName, QWidget *parent = nullptr);
|
explicit AddLibraryWizard(const Utils::FilePath &proFile, QWidget *parent = nullptr);
|
||||||
~AddLibraryWizard() override;
|
~AddLibraryWizard() override;
|
||||||
|
|
||||||
LibraryKind libraryKind() const;
|
LibraryKind libraryKind() const;
|
||||||
QString proFile() const;
|
Utils::FilePath proFile() const;
|
||||||
QString snippet() const;
|
QString snippet() const;
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LibraryTypePage *m_libraryTypePage = nullptr;
|
LibraryTypePage *m_libraryTypePage = nullptr;
|
||||||
DetailsPage *m_detailsPage = nullptr;
|
DetailsPage *m_detailsPage = nullptr;
|
||||||
SummaryPage *m_summaryPage = nullptr;
|
SummaryPage *m_summaryPage = nullptr;
|
||||||
QString m_proFile;
|
Utils::FilePath m_proFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LibraryTypePage : public QWizardPage
|
class LibraryTypePage : public QWizardPage
|
||||||
|
@@ -40,22 +40,24 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace QmakeProjectManager;
|
using namespace Utils;
|
||||||
using namespace QmakeProjectManager::Internal;
|
|
||||||
|
namespace QmakeProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
static void fillLibraryPlatformTypes(QComboBox *comboBox)
|
static void fillLibraryPlatformTypes(QComboBox *comboBox)
|
||||||
{
|
{
|
||||||
comboBox->clear();
|
comboBox->clear();
|
||||||
comboBox->addItem("Windows (*.lib lib*.a)", int(Utils::OsTypeWindows));
|
comboBox->addItem("Windows (*.lib lib*.a)", int(OsTypeWindows));
|
||||||
comboBox->addItem("Linux (lib*.so lib*.a)", int(Utils::OsTypeLinux));
|
comboBox->addItem("Linux (lib*.so lib*.a)", int(OsTypeLinux));
|
||||||
comboBox->addItem("macOS (*.dylib *.a *.framework)", int(Utils::OsTypeMac));
|
comboBox->addItem("macOS (*.dylib *.a *.framework)", int(OsTypeMac));
|
||||||
const int currentIndex = comboBox->findData(int(Utils::HostOsInfo::hostOs()));
|
const int currentIndex = comboBox->findData(int(HostOsInfo::hostOs()));
|
||||||
comboBox->setCurrentIndex(std::max(0, currentIndex));
|
comboBox->setCurrentIndex(std::max(0, currentIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryDetailsController::LibraryDetailsController(
|
LibraryDetailsController::LibraryDetailsController(
|
||||||
Ui::LibraryDetailsWidget *libraryDetails,
|
Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile, QObject *parent) :
|
const FilePath &proFile, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_proFile(proFile),
|
m_proFile(proFile),
|
||||||
m_libraryDetailsWidget(libraryDetails)
|
m_libraryDetailsWidget(libraryDetails)
|
||||||
@@ -65,12 +67,12 @@ LibraryDetailsController::LibraryDetailsController(
|
|||||||
setLinkageGroupVisible(true);
|
setLinkageGroupVisible(true);
|
||||||
setMacLibraryGroupVisible(true);
|
setMacLibraryGroupVisible(true);
|
||||||
setPackageLineEditVisible(false);
|
setPackageLineEditVisible(false);
|
||||||
const bool isMacOs = libraryPlatformType() == Utils::OsTypeMac;
|
const bool isMacOs = libraryPlatformType() == OsTypeMac;
|
||||||
const bool isWindows = libraryPlatformType() == Utils::OsTypeWindows;
|
const bool isWindows = libraryPlatformType() == OsTypeWindows;
|
||||||
setMacLibraryRadiosVisible(!isMacOs);
|
setMacLibraryRadiosVisible(!isMacOs);
|
||||||
setLinkageRadiosVisible(isWindows);
|
setLinkageRadiosVisible(isWindows);
|
||||||
|
|
||||||
connect(m_libraryDetailsWidget->includePathChooser, &Utils::PathChooser::rawPathChanged,
|
connect(m_libraryDetailsWidget->includePathChooser, &PathChooser::rawPathChanged,
|
||||||
this, &LibraryDetailsController::slotIncludePathChanged);
|
this, &LibraryDetailsController::slotIncludePathChanged);
|
||||||
connect(m_libraryDetailsWidget->frameworkRadio, &QAbstractButton::clicked,
|
connect(m_libraryDetailsWidget->frameworkRadio, &QAbstractButton::clicked,
|
||||||
this, &LibraryDetailsController::slotMacLibraryTypeChanged);
|
this, &LibraryDetailsController::slotMacLibraryTypeChanged);
|
||||||
@@ -108,9 +110,9 @@ AddLibraryWizard::MacLibraryType LibraryDetailsController::macLibraryType() cons
|
|||||||
return m_macLibraryType;
|
return m_macLibraryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::OsType LibraryDetailsController::libraryPlatformType() const
|
OsType LibraryDetailsController::libraryPlatformType() const
|
||||||
{
|
{
|
||||||
return Utils::OsType(m_libraryDetailsWidget->libraryTypeComboBox->currentData().value<int>());
|
return OsType(m_libraryDetailsWidget->libraryTypeComboBox->currentData().value<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LibraryDetailsController::libraryPlatformFilter() const
|
QString LibraryDetailsController::libraryPlatformFilter() const
|
||||||
@@ -198,7 +200,7 @@ void LibraryDetailsController::updateGui()
|
|||||||
// UGLY HACK END
|
// UGLY HACK END
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LibraryDetailsController::proFile() const
|
FilePath LibraryDetailsController::proFile() const
|
||||||
{
|
{
|
||||||
return m_proFile;
|
return m_proFile;
|
||||||
}
|
}
|
||||||
@@ -397,7 +399,7 @@ static QString smartQuote(const QString &aString)
|
|||||||
{
|
{
|
||||||
// The OS type is not important in that case, but use always the same
|
// The OS type is not important in that case, but use always the same
|
||||||
// in order not to generate different quoting depending on host platform
|
// in order not to generate different quoting depending on host platform
|
||||||
return Utils::ProcessArgs::quoteArg(aString, Utils::OsTypeLinux);
|
return ProcessArgs::quoteArg(aString, OsTypeLinux);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString appendSeparator(const QString &aString)
|
static QString appendSeparator(const QString &aString)
|
||||||
@@ -622,15 +624,15 @@ static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platform
|
|||||||
|
|
||||||
NonInternalLibraryDetailsController::NonInternalLibraryDetailsController(
|
NonInternalLibraryDetailsController::NonInternalLibraryDetailsController(
|
||||||
Ui::LibraryDetailsWidget *libraryDetails,
|
Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile, QObject *parent) :
|
const FilePath &proFile, QObject *parent) :
|
||||||
LibraryDetailsController(libraryDetails, proFile, parent)
|
LibraryDetailsController(libraryDetails, proFile, parent)
|
||||||
{
|
{
|
||||||
setLibraryComboBoxVisible(false);
|
setLibraryComboBoxVisible(false);
|
||||||
setLibraryPathChooserVisible(true);
|
setLibraryPathChooserVisible(true);
|
||||||
|
|
||||||
connect(libraryDetailsWidget()->libraryPathChooser, &Utils::PathChooser::validChanged,
|
connect(libraryDetailsWidget()->libraryPathChooser, &PathChooser::validChanged,
|
||||||
this, &LibraryDetailsController::completeChanged);
|
this, &LibraryDetailsController::completeChanged);
|
||||||
connect(libraryDetailsWidget()->libraryPathChooser, &Utils::PathChooser::rawPathChanged,
|
connect(libraryDetailsWidget()->libraryPathChooser, &PathChooser::rawPathChanged,
|
||||||
this, &NonInternalLibraryDetailsController::slotLibraryPathChanged);
|
this, &NonInternalLibraryDetailsController::slotLibraryPathChanged);
|
||||||
connect(libraryDetailsWidget()->removeSuffixCheckBox, &QAbstractButton::toggled,
|
connect(libraryDetailsWidget()->removeSuffixCheckBox, &QAbstractButton::toggled,
|
||||||
this, &NonInternalLibraryDetailsController::slotRemoveSuffixChanged);
|
this, &NonInternalLibraryDetailsController::slotRemoveSuffixChanged);
|
||||||
@@ -646,7 +648,7 @@ NonInternalLibraryDetailsController::NonInternalLibraryDetailsController(
|
|||||||
AddLibraryWizard::LinkageType NonInternalLibraryDetailsController::suggestedLinkageType() const
|
AddLibraryWizard::LinkageType NonInternalLibraryDetailsController::suggestedLinkageType() const
|
||||||
{
|
{
|
||||||
AddLibraryWizard::LinkageType type = AddLibraryWizard::NoLinkage;
|
AddLibraryWizard::LinkageType type = AddLibraryWizard::NoLinkage;
|
||||||
if (libraryPlatformType() != Utils::OsTypeWindows) {
|
if (libraryPlatformType() != OsTypeWindows) {
|
||||||
if (libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
if (libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
||||||
QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->filePath().toString());
|
QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->filePath().toString());
|
||||||
if (fi.suffix() == QLatin1String("a"))
|
if (fi.suffix() == QLatin1String("a"))
|
||||||
@@ -661,7 +663,7 @@ AddLibraryWizard::LinkageType NonInternalLibraryDetailsController::suggestedLink
|
|||||||
AddLibraryWizard::MacLibraryType NonInternalLibraryDetailsController::suggestedMacLibraryType() const
|
AddLibraryWizard::MacLibraryType NonInternalLibraryDetailsController::suggestedMacLibraryType() const
|
||||||
{
|
{
|
||||||
AddLibraryWizard::MacLibraryType type = AddLibraryWizard::NoLibraryType;
|
AddLibraryWizard::MacLibraryType type = AddLibraryWizard::NoLibraryType;
|
||||||
if (libraryPlatformType() == Utils::OsTypeMac) {
|
if (libraryPlatformType() == OsTypeMac) {
|
||||||
if (libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
if (libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
||||||
QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->filePath().toString());
|
QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->filePath().toString());
|
||||||
if (fi.suffix() == QLatin1String("framework"))
|
if (fi.suffix() == QLatin1String("framework"))
|
||||||
@@ -695,7 +697,7 @@ QString NonInternalLibraryDetailsController::suggestedIncludePath() const
|
|||||||
void NonInternalLibraryDetailsController::updateWindowsOptionsEnablement()
|
void NonInternalLibraryDetailsController::updateWindowsOptionsEnablement()
|
||||||
{
|
{
|
||||||
bool ena = platforms() & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform);
|
bool ena = platforms() & (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform);
|
||||||
if (libraryPlatformType() == Utils::OsTypeWindows) {
|
if (libraryPlatformType() == OsTypeWindows) {
|
||||||
libraryDetailsWidget()->addSuffixCheckBox->setEnabled(ena);
|
libraryDetailsWidget()->addSuffixCheckBox->setEnabled(ena);
|
||||||
ena = true;
|
ena = true;
|
||||||
}
|
}
|
||||||
@@ -732,10 +734,10 @@ void NonInternalLibraryDetailsController::slotRemoveSuffixChanged(bool ena)
|
|||||||
void NonInternalLibraryDetailsController::handleLibraryTypeChange()
|
void NonInternalLibraryDetailsController::handleLibraryTypeChange()
|
||||||
{
|
{
|
||||||
libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter(libraryPlatformFilter());
|
libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter(libraryPlatformFilter());
|
||||||
const bool isMacOs = libraryPlatformType() == Utils::OsTypeMac;
|
const bool isMacOs = libraryPlatformType() == OsTypeMac;
|
||||||
const bool isWindows = libraryPlatformType() == Utils::OsTypeWindows;
|
const bool isWindows = libraryPlatformType() == OsTypeWindows;
|
||||||
libraryDetailsWidget()->libraryPathChooser->setExpectedKind(isMacOs ? Utils::PathChooser::Any
|
libraryDetailsWidget()->libraryPathChooser->setExpectedKind(isMacOs ? PathChooser::Any
|
||||||
: Utils::PathChooser::File);
|
: PathChooser::File);
|
||||||
setMacLibraryRadiosVisible(!isMacOs);
|
setMacLibraryRadiosVisible(!isMacOs);
|
||||||
setLinkageRadiosVisible(isWindows);
|
setLinkageRadiosVisible(isWindows);
|
||||||
setRemoveSuffixVisible(isWindows);
|
setRemoveSuffixVisible(isWindows);
|
||||||
@@ -752,7 +754,7 @@ void NonInternalLibraryDetailsController::slotLibraryTypeChanged()
|
|||||||
|
|
||||||
void NonInternalLibraryDetailsController::handleLibraryPathChange()
|
void NonInternalLibraryDetailsController::handleLibraryPathChange()
|
||||||
{
|
{
|
||||||
if (libraryPlatformType() == Utils::OsTypeWindows) {
|
if (libraryPlatformType() == OsTypeWindows) {
|
||||||
bool subfoldersEnabled = true;
|
bool subfoldersEnabled = true;
|
||||||
bool removeSuffixEnabled = true;
|
bool removeSuffixEnabled = true;
|
||||||
if (libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
if (libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
||||||
@@ -797,13 +799,13 @@ QString NonInternalLibraryDetailsController::snippet() const
|
|||||||
QString libName;
|
QString libName;
|
||||||
const bool removeSuffix = isWindowsGroupVisible()
|
const bool removeSuffix = isWindowsGroupVisible()
|
||||||
&& libraryDetailsWidget()->removeSuffixCheckBox->isChecked();
|
&& libraryDetailsWidget()->removeSuffixCheckBox->isChecked();
|
||||||
if (libraryPlatformType() == Utils::OsTypeWindows) {
|
if (libraryPlatformType() == OsTypeWindows) {
|
||||||
libName = fi.completeBaseName();
|
libName = fi.completeBaseName();
|
||||||
if (removeSuffix && !libName.isEmpty()) // remove last letter which needs to be "d"
|
if (removeSuffix && !libName.isEmpty()) // remove last letter which needs to be "d"
|
||||||
libName = libName.left(libName.size() - 1);
|
libName = libName.left(libName.size() - 1);
|
||||||
if (fi.completeSuffix() == QLatin1String("a")) // the mingw lib case
|
if (fi.completeSuffix() == QLatin1String("a")) // the mingw lib case
|
||||||
libName = libName.mid(3); // cut the "lib" prefix
|
libName = libName.mid(3); // cut the "lib" prefix
|
||||||
} else if (libraryPlatformType() == Utils::OsTypeMac) {
|
} else if (libraryPlatformType() == OsTypeMac) {
|
||||||
if (macLibraryType() == AddLibraryWizard::FrameworkType)
|
if (macLibraryType() == AddLibraryWizard::FrameworkType)
|
||||||
libName = fi.completeBaseName();
|
libName = fi.completeBaseName();
|
||||||
else
|
else
|
||||||
@@ -817,7 +819,7 @@ QString NonInternalLibraryDetailsController::snippet() const
|
|||||||
if (isWindowsGroupVisible()) {
|
if (isWindowsGroupVisible()) {
|
||||||
// when we are on Win but we don't generate the code for Win
|
// when we are on Win but we don't generate the code for Win
|
||||||
// we still need to remove "debug" or "release" subfolder
|
// we still need to remove "debug" or "release" subfolder
|
||||||
const bool useSubfoldersCondition = (libraryPlatformType() == Utils::OsTypeWindows)
|
const bool useSubfoldersCondition = (libraryPlatformType() == OsTypeWindows)
|
||||||
? true : platforms() & (AddLibraryWizard::WindowsMinGWPlatform
|
? true : platforms() & (AddLibraryWizard::WindowsMinGWPlatform
|
||||||
| AddLibraryWizard::WindowsMSVCPlatform);
|
| AddLibraryWizard::WindowsMSVCPlatform);
|
||||||
if (useSubfoldersCondition)
|
if (useSubfoldersCondition)
|
||||||
@@ -829,10 +831,10 @@ QString NonInternalLibraryDetailsController::snippet() const
|
|||||||
QString targetRelativePath;
|
QString targetRelativePath;
|
||||||
QString includeRelativePath;
|
QString includeRelativePath;
|
||||||
if (isIncludePathVisible()) { // generate also the path to lib
|
if (isIncludePathVisible()) { // generate also the path to lib
|
||||||
QFileInfo pfi(proFile());
|
QFileInfo pfi = proFile().toFileInfo();
|
||||||
QDir pdir = pfi.absoluteDir();
|
QDir pdir = pfi.absoluteDir();
|
||||||
QString absoluteLibraryPath = fi.absolutePath();
|
QString absoluteLibraryPath = fi.absolutePath();
|
||||||
if (libraryPlatformType() == Utils::OsTypeWindows && useSubfolders) { // drop last subfolder which needs to be "debug" or "release"
|
if (libraryPlatformType() == OsTypeWindows && useSubfolders) { // drop last subfolder which needs to be "debug" or "release"
|
||||||
QFileInfo libfi(absoluteLibraryPath);
|
QFileInfo libfi(absoluteLibraryPath);
|
||||||
absoluteLibraryPath = libfi.absolutePath();
|
absoluteLibraryPath = libfi.absolutePath();
|
||||||
}
|
}
|
||||||
@@ -862,7 +864,7 @@ QString NonInternalLibraryDetailsController::snippet() const
|
|||||||
|
|
||||||
PackageLibraryDetailsController::PackageLibraryDetailsController(
|
PackageLibraryDetailsController::PackageLibraryDetailsController(
|
||||||
Ui::LibraryDetailsWidget *libraryDetails,
|
Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile, QObject *parent)
|
const FilePath &proFile, QObject *parent)
|
||||||
: NonInternalLibraryDetailsController(libraryDetails, proFile, parent)
|
: NonInternalLibraryDetailsController(libraryDetails, proFile, parent)
|
||||||
{
|
{
|
||||||
setPlatformsVisible(false);
|
setPlatformsVisible(false);
|
||||||
@@ -897,11 +899,11 @@ QString PackageLibraryDetailsController::snippet() const
|
|||||||
|
|
||||||
bool PackageLibraryDetailsController::isLinkPackageGenerated() const
|
bool PackageLibraryDetailsController::isLinkPackageGenerated() const
|
||||||
{
|
{
|
||||||
const Project *project = SessionManager::projectForFile(Utils::FilePath::fromString(proFile()));
|
const Project *project = SessionManager::projectForFile(proFile());
|
||||||
if (!project)
|
if (!project)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ProjectNode *projectNode = project->findNodeForBuildKey(proFile());
|
const ProjectNode *projectNode = project->findNodeForBuildKey(proFile().toString());
|
||||||
if (!projectNode)
|
if (!projectNode)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -921,7 +923,7 @@ bool PackageLibraryDetailsController::isLinkPackageGenerated() const
|
|||||||
|
|
||||||
SystemLibraryDetailsController::SystemLibraryDetailsController(
|
SystemLibraryDetailsController::SystemLibraryDetailsController(
|
||||||
Ui::LibraryDetailsWidget *libraryDetails,
|
Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile, QObject *parent)
|
const FilePath &proFile, QObject *parent)
|
||||||
: NonInternalLibraryDetailsController(libraryDetails, proFile, parent)
|
: NonInternalLibraryDetailsController(libraryDetails, proFile, parent)
|
||||||
{
|
{
|
||||||
setIncludePathVisible(false);
|
setIncludePathVisible(false);
|
||||||
@@ -934,7 +936,7 @@ SystemLibraryDetailsController::SystemLibraryDetailsController(
|
|||||||
|
|
||||||
ExternalLibraryDetailsController::ExternalLibraryDetailsController(
|
ExternalLibraryDetailsController::ExternalLibraryDetailsController(
|
||||||
Ui::LibraryDetailsWidget *libraryDetails,
|
Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile, QObject *parent)
|
const FilePath &proFile, QObject *parent)
|
||||||
: NonInternalLibraryDetailsController(libraryDetails, proFile, parent)
|
: NonInternalLibraryDetailsController(libraryDetails, proFile, parent)
|
||||||
{
|
{
|
||||||
setIncludePathVisible(true);
|
setIncludePathVisible(true);
|
||||||
@@ -949,7 +951,7 @@ void ExternalLibraryDetailsController::updateWindowsOptionsEnablement()
|
|||||||
|
|
||||||
bool subfoldersEnabled = true;
|
bool subfoldersEnabled = true;
|
||||||
bool removeSuffixEnabled = true;
|
bool removeSuffixEnabled = true;
|
||||||
if (libraryPlatformType() == Utils::OsTypeWindows
|
if (libraryPlatformType() == OsTypeWindows
|
||||||
&& libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
&& libraryDetailsWidget()->libraryPathChooser->isValid()) {
|
||||||
QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->filePath().toString());
|
QFileInfo fi(libraryDetailsWidget()->libraryPathChooser->filePath().toString());
|
||||||
QFileInfo dfi(fi.absolutePath());
|
QFileInfo dfi(fi.absolutePath());
|
||||||
@@ -968,9 +970,8 @@ void ExternalLibraryDetailsController::updateWindowsOptionsEnablement()
|
|||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
|
|
||||||
InternalLibraryDetailsController::InternalLibraryDetailsController(
|
InternalLibraryDetailsController::InternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
Ui::LibraryDetailsWidget *libraryDetails,
|
const FilePath &proFile, QObject *parent)
|
||||||
const QString &proFile, QObject *parent)
|
|
||||||
: LibraryDetailsController(libraryDetails, proFile, parent)
|
: LibraryDetailsController(libraryDetails, proFile, parent)
|
||||||
{
|
{
|
||||||
setLinkageRadiosVisible(false);
|
setLinkageRadiosVisible(false);
|
||||||
@@ -980,7 +981,7 @@ InternalLibraryDetailsController::InternalLibraryDetailsController(
|
|||||||
setWindowsGroupVisible(true);
|
setWindowsGroupVisible(true);
|
||||||
setRemoveSuffixVisible(false);
|
setRemoveSuffixVisible(false);
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
libraryDetailsWidget()->useSubfoldersCheckBox->setEnabled(true);
|
libraryDetailsWidget()->useSubfoldersCheckBox->setEnabled(true);
|
||||||
|
|
||||||
connect(libraryDetailsWidget()->libraryComboBox,
|
connect(libraryDetailsWidget()->libraryComboBox,
|
||||||
@@ -1034,7 +1035,7 @@ QString InternalLibraryDetailsController::suggestedIncludePath() const
|
|||||||
|
|
||||||
void InternalLibraryDetailsController::updateWindowsOptionsEnablement()
|
void InternalLibraryDetailsController::updateWindowsOptionsEnablement()
|
||||||
{
|
{
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
libraryDetailsWidget()->addSuffixCheckBox->setEnabled(true);
|
libraryDetailsWidget()->addSuffixCheckBox->setEnabled(true);
|
||||||
libraryDetailsWidget()->winGroupBox->setEnabled(platforms()
|
libraryDetailsWidget()->winGroupBox->setEnabled(platforms()
|
||||||
& (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform));
|
& (AddLibraryWizard::WindowsMinGWPlatform | AddLibraryWizard::WindowsMSVCPlatform));
|
||||||
@@ -1047,7 +1048,7 @@ void InternalLibraryDetailsController::updateProFile()
|
|||||||
libraryDetailsWidget()->libraryComboBox->clear();
|
libraryDetailsWidget()->libraryComboBox->clear();
|
||||||
|
|
||||||
const QmakeProject *project
|
const QmakeProject *project
|
||||||
= dynamic_cast<QmakeProject *>(SessionManager::projectForFile(Utils::FilePath::fromString(proFile())));
|
= dynamic_cast<QmakeProject *>(SessionManager::projectForFile(proFile()));
|
||||||
if (!project)
|
if (!project)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1091,7 +1092,7 @@ void InternalLibraryDetailsController::slotCurrentLibraryChanged()
|
|||||||
currentIndex, Qt::ToolTipRole).toString());
|
currentIndex, Qt::ToolTipRole).toString());
|
||||||
QmakeProFile *proFile = m_proFiles.at(currentIndex);
|
QmakeProFile *proFile = m_proFiles.at(currentIndex);
|
||||||
const QStringList configVar = proFile->variableValue(Variable::Config);
|
const QStringList configVar = proFile->variableValue(Variable::Config);
|
||||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
bool useSubfolders = false;
|
bool useSubfolders = false;
|
||||||
if (configVar.contains(QLatin1String("debug_and_release"))
|
if (configVar.contains(QLatin1String("debug_and_release"))
|
||||||
&& configVar.contains(QLatin1String("debug_and_release_target")))
|
&& configVar.contains(QLatin1String("debug_and_release_target")))
|
||||||
@@ -1130,10 +1131,10 @@ QString InternalLibraryDetailsController::snippet() const
|
|||||||
|
|
||||||
// relative path for the project for which we insert the snippet,
|
// relative path for the project for which we insert the snippet,
|
||||||
// it's relative to the root project
|
// it's relative to the root project
|
||||||
const QString proRelavitePath = rootDir.relativeFilePath(proFile());
|
const QString proRelavitePath = rootDir.relativeFilePath(proFile().toString());
|
||||||
|
|
||||||
// project for which we insert the snippet
|
// project for which we insert the snippet
|
||||||
const Project *project = SessionManager::projectForFile(Utils::FilePath::fromString(proFile()));
|
const Project *project = SessionManager::projectForFile(proFile());
|
||||||
|
|
||||||
// the build directory of the active build configuration
|
// the build directory of the active build configuration
|
||||||
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
|
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
|
||||||
@@ -1147,7 +1148,7 @@ QString InternalLibraryDetailsController::snippet() const
|
|||||||
QDir projectBuildDir(pfi.absolutePath());
|
QDir projectBuildDir(pfi.absolutePath());
|
||||||
|
|
||||||
// current project node from combobox
|
// current project node from combobox
|
||||||
QFileInfo fi(proFile());
|
QFileInfo fi = proFile().toFileInfo();
|
||||||
QDir projectSrcDir(fi.absolutePath());
|
QDir projectSrcDir(fi.absolutePath());
|
||||||
|
|
||||||
// project node which we want to link against
|
// project node which we want to link against
|
||||||
@@ -1175,3 +1176,6 @@ QString InternalLibraryDetailsController::snippet() const
|
|||||||
useSubfolders, addSuffix);
|
useSubfolders, addSuffix);
|
||||||
return snippetMessage;
|
return snippetMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // QmakeProjectManager
|
||||||
|
@@ -38,7 +38,7 @@ class LibraryDetailsController : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit LibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
explicit LibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile,
|
const Utils::FilePath &proFile,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
virtual bool isComplete() const = 0;
|
virtual bool isComplete() const = 0;
|
||||||
virtual QString snippet() const = 0;
|
virtual QString snippet() const = 0;
|
||||||
@@ -54,7 +54,7 @@ protected:
|
|||||||
AddLibraryWizard::MacLibraryType macLibraryType() const;
|
AddLibraryWizard::MacLibraryType macLibraryType() const;
|
||||||
Utils::OsType libraryPlatformType() const;
|
Utils::OsType libraryPlatformType() const;
|
||||||
QString libraryPlatformFilter() const;
|
QString libraryPlatformFilter() const;
|
||||||
QString proFile() const;
|
Utils::FilePath proFile() const;
|
||||||
bool isIncludePathChanged() const;
|
bool isIncludePathChanged() const;
|
||||||
bool guiSignalsIgnored() const;
|
bool guiSignalsIgnored() const;
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
AddLibraryWizard::LinkageType m_linkageType = AddLibraryWizard::NoLinkage;
|
AddLibraryWizard::LinkageType m_linkageType = AddLibraryWizard::NoLinkage;
|
||||||
AddLibraryWizard::MacLibraryType m_macLibraryType = AddLibraryWizard::NoLibraryType;
|
AddLibraryWizard::MacLibraryType m_macLibraryType = AddLibraryWizard::NoLibraryType;
|
||||||
|
|
||||||
QString m_proFile;
|
Utils::FilePath m_proFile;
|
||||||
|
|
||||||
bool m_ignoreGuiSignals = false;
|
bool m_ignoreGuiSignals = false;
|
||||||
bool m_includePathChanged = false;
|
bool m_includePathChanged = false;
|
||||||
@@ -118,7 +118,7 @@ class NonInternalLibraryDetailsController : public LibraryDetailsController
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit NonInternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
explicit NonInternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile,
|
const Utils::FilePath &proFile,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
QString snippet() const override;
|
QString snippet() const override;
|
||||||
@@ -143,7 +143,7 @@ class PackageLibraryDetailsController : public NonInternalLibraryDetailsControll
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PackageLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
explicit PackageLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile,
|
const Utils::FilePath &proFile,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
QString snippet() const override;
|
QString snippet() const override;
|
||||||
@@ -160,7 +160,7 @@ class SystemLibraryDetailsController : public NonInternalLibraryDetailsControlle
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SystemLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
explicit SystemLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile,
|
const Utils::FilePath &proFile,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
protected:
|
protected:
|
||||||
void updateWindowsOptionsEnablement() override final {
|
void updateWindowsOptionsEnablement() override final {
|
||||||
@@ -173,7 +173,7 @@ class ExternalLibraryDetailsController : public NonInternalLibraryDetailsControl
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ExternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
explicit ExternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile,
|
const Utils::FilePath &proFile,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
protected:
|
protected:
|
||||||
void updateWindowsOptionsEnablement() override final;
|
void updateWindowsOptionsEnablement() override final;
|
||||||
@@ -184,7 +184,7 @@ class InternalLibraryDetailsController : public LibraryDetailsController
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit InternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
explicit InternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails,
|
||||||
const QString &proFile,
|
const Utils::FilePath &proFile,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
QString snippet() const override;
|
QString snippet() const override;
|
||||||
|
@@ -73,6 +73,7 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -90,7 +91,7 @@ public:
|
|||||||
void buildStateChanged(Project *pro);
|
void buildStateChanged(Project *pro);
|
||||||
void updateBuildFileAction();
|
void updateBuildFileAction();
|
||||||
void disableBuildFileMenus();
|
void disableBuildFileMenus();
|
||||||
void enableBuildFileMenus(const Utils::FilePath &file);
|
void enableBuildFileMenus(const FilePath &file);
|
||||||
|
|
||||||
Core::Context projectContext;
|
Core::Context projectContext;
|
||||||
|
|
||||||
@@ -114,15 +115,15 @@ public:
|
|||||||
|
|
||||||
QAction *m_runQMakeAction = nullptr;
|
QAction *m_runQMakeAction = nullptr;
|
||||||
QAction *m_runQMakeActionContextMenu = nullptr;
|
QAction *m_runQMakeActionContextMenu = nullptr;
|
||||||
Utils::ParameterAction *m_buildSubProjectContextMenu = nullptr;
|
ParameterAction *m_buildSubProjectContextMenu = nullptr;
|
||||||
QAction *m_subProjectRebuildSeparator = nullptr;
|
QAction *m_subProjectRebuildSeparator = nullptr;
|
||||||
QAction *m_rebuildSubProjectContextMenu = nullptr;
|
QAction *m_rebuildSubProjectContextMenu = nullptr;
|
||||||
QAction *m_cleanSubProjectContextMenu = nullptr;
|
QAction *m_cleanSubProjectContextMenu = nullptr;
|
||||||
QAction *m_buildFileContextMenu = nullptr;
|
QAction *m_buildFileContextMenu = nullptr;
|
||||||
Utils::ParameterAction *m_buildSubProjectAction = nullptr;
|
ParameterAction *m_buildSubProjectAction = nullptr;
|
||||||
QAction *m_rebuildSubProjectAction = nullptr;
|
QAction *m_rebuildSubProjectAction = nullptr;
|
||||||
QAction *m_cleanSubProjectAction = nullptr;
|
QAction *m_cleanSubProjectAction = nullptr;
|
||||||
Utils::ParameterAction *m_buildFileAction = nullptr;
|
ParameterAction *m_buildFileAction = nullptr;
|
||||||
QAction *m_addLibraryAction = nullptr;
|
QAction *m_addLibraryAction = nullptr;
|
||||||
QAction *m_addLibraryActionContextMenu = nullptr;
|
QAction *m_addLibraryActionContextMenu = nullptr;
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ public:
|
|||||||
void buildFile();
|
void buildFile();
|
||||||
|
|
||||||
void handleSubDirContextMenu(QmakeBuildSystem::Action action, bool isFileBuild);
|
void handleSubDirContextMenu(QmakeBuildSystem::Action action, bool isFileBuild);
|
||||||
void addLibraryImpl(const QString &fileName, TextEditor::BaseTextEditor *editor);
|
void addLibraryImpl(const FilePath &filePath, TextEditor::BaseTextEditor *editor);
|
||||||
void runQMakeImpl(Project *p, ProjectExplorer::Node *node);
|
void runQMakeImpl(Project *p, ProjectExplorer::Node *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -181,8 +182,8 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
//register actions
|
//register actions
|
||||||
Command *command = nullptr;
|
Command *command = nullptr;
|
||||||
|
|
||||||
d->m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""),
|
d->m_buildSubProjectContextMenu = new ParameterAction(tr("Build"), tr("Build \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled/*handled manually*/,
|
ParameterAction::AlwaysEnabled/*handled manually*/,
|
||||||
this);
|
this);
|
||||||
command = ActionManager::registerAction(d->m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext);
|
command = ActionManager::registerAction(d->m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext);
|
||||||
command->setAttribute(Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
@@ -227,8 +228,8 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
connect(d->m_buildFileContextMenu, &QAction::triggered,
|
connect(d->m_buildFileContextMenu, &QAction::triggered,
|
||||||
d, &QmakeProjectManagerPluginPrivate::buildFileContextMenu);
|
d, &QmakeProjectManagerPluginPrivate::buildFileContextMenu);
|
||||||
|
|
||||||
d->m_buildSubProjectAction = new Utils::ParameterAction(tr("Build &Subproject"), tr("Build &Subproject \"%1\""),
|
d->m_buildSubProjectAction = new ParameterAction(tr("Build &Subproject"), tr("Build &Subproject \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled, this);
|
ParameterAction::AlwaysEnabled, this);
|
||||||
command = ActionManager::registerAction(d->m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext);
|
command = ActionManager::registerAction(d->m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext);
|
||||||
command->setAttribute(Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
@@ -244,8 +245,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
connect(d->m_runQMakeAction, &QAction::triggered,
|
connect(d->m_runQMakeAction, &QAction::triggered,
|
||||||
d, &QmakeProjectManagerPluginPrivate::runQMake);
|
d, &QmakeProjectManagerPluginPrivate::runQMake);
|
||||||
|
|
||||||
d->m_rebuildSubProjectAction = new QAction(Icons::REBUILD.icon(), tr("Rebuild"),
|
d->m_rebuildSubProjectAction = new QAction(ProjectExplorer::Icons::REBUILD.icon(), tr("Rebuild"), this);
|
||||||
this);
|
|
||||||
d->m_rebuildSubProjectAction->setWhatsThis(tr("Rebuild Subproject"));
|
d->m_rebuildSubProjectAction->setWhatsThis(tr("Rebuild Subproject"));
|
||||||
command = ActionManager::registerAction(d->m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext);
|
command = ActionManager::registerAction(d->m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext);
|
||||||
command->setAttribute(Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
@@ -265,8 +265,8 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
connect(d->m_cleanSubProjectAction, &QAction::triggered,
|
connect(d->m_cleanSubProjectAction, &QAction::triggered,
|
||||||
d, &QmakeProjectManagerPluginPrivate::cleanSubDirContextMenu);
|
d, &QmakeProjectManagerPluginPrivate::cleanSubDirContextMenu);
|
||||||
|
|
||||||
d->m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""),
|
d->m_buildFileAction = new ParameterAction(tr("Build File"), tr("Build File \"%1\""),
|
||||||
Utils::ParameterAction::AlwaysEnabled, this);
|
ParameterAction::AlwaysEnabled, this);
|
||||||
command = ActionManager::registerAction(d->m_buildFileAction, Constants::BUILDFILE, projectContext);
|
command = ActionManager::registerAction(d->m_buildFileAction, Constants::BUILDFILE, projectContext);
|
||||||
command->setAttribute(Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
command->setAttribute(Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
@@ -361,33 +361,33 @@ static QmakeProFileNode *buildableFileProFile(Node *node)
|
|||||||
void QmakeProjectManagerPluginPrivate::addLibrary()
|
void QmakeProjectManagerPluginPrivate::addLibrary()
|
||||||
{
|
{
|
||||||
if (auto editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor()))
|
if (auto editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor()))
|
||||||
addLibraryImpl(editor->document()->filePath().toString(), editor);
|
addLibraryImpl(editor->document()->filePath(), editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeProjectManagerPluginPrivate::addLibraryContextMenu()
|
void QmakeProjectManagerPluginPrivate::addLibraryContextMenu()
|
||||||
{
|
{
|
||||||
QString projectPath;
|
FilePath projectPath;
|
||||||
|
|
||||||
Node *node = ProjectTree::currentNode();
|
Node *node = ProjectTree::currentNode();
|
||||||
if (ContainerNode *cn = node->asContainerNode())
|
if (ContainerNode *cn = node->asContainerNode())
|
||||||
projectPath = cn->project()->projectFilePath().toString();
|
projectPath = cn->project()->projectFilePath();
|
||||||
else if (dynamic_cast<QmakeProFileNode *>(node))
|
else if (dynamic_cast<QmakeProFileNode *>(node))
|
||||||
projectPath = node->filePath().toString();
|
projectPath = node->filePath();
|
||||||
|
|
||||||
addLibraryImpl(projectPath, nullptr);
|
addLibraryImpl(projectPath, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeProjectManagerPluginPrivate::addLibraryImpl(const QString &fileName, BaseTextEditor *editor)
|
void QmakeProjectManagerPluginPrivate::addLibraryImpl(const FilePath &filePath, BaseTextEditor *editor)
|
||||||
{
|
{
|
||||||
if (fileName.isEmpty())
|
if (filePath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Internal::AddLibraryWizard wizard(fileName, Core::ICore::dialogParent());
|
Internal::AddLibraryWizard wizard(filePath, Core::ICore::dialogParent());
|
||||||
if (wizard.exec() != QDialog::Accepted)
|
if (wizard.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!editor)
|
if (!editor)
|
||||||
editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditor(fileName,
|
editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditor(filePath,
|
||||||
Constants::PROFILE_EDITOR_ID, Core::EditorManager::DoNotMakeVisible));
|
Constants::PROFILE_EDITOR_ID, Core::EditorManager::DoNotMakeVisible));
|
||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
@@ -448,7 +448,7 @@ void QmakeProjectManagerPluginPrivate::buildFile()
|
|||||||
if (!currentDocument)
|
if (!currentDocument)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const Utils::FilePath file = currentDocument->filePath();
|
const FilePath file = currentDocument->filePath();
|
||||||
Node *n = ProjectTree::nodeForFile(file);
|
Node *n = ProjectTree::nodeForFile(file);
|
||||||
FileNode *node = n ? n->asFileNode() : nullptr;
|
FileNode *node = n ? n->asFileNode() : nullptr;
|
||||||
if (!node)
|
if (!node)
|
||||||
@@ -599,7 +599,7 @@ void QmakeProjectManagerPluginPrivate::disableBuildFileMenus()
|
|||||||
m_buildFileContextMenu->setEnabled(false);
|
m_buildFileContextMenu->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeProjectManagerPluginPrivate::enableBuildFileMenus(const Utils::FilePath &file)
|
void QmakeProjectManagerPluginPrivate::enableBuildFileMenus(const FilePath &file)
|
||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
Reference in New Issue
Block a user