Commit 4a61bcb4 authored by Milian Wolff's avatar Milian Wolff

Merge branch '5.6'

parents 52216a13 4887d28e
......@@ -146,7 +146,9 @@ bool CMakeCacheModel::setData(const QModelIndex& index, const QVariant& value, i
{
bool ret = QStandardItemModel::setData(index, value, role);
if (ret) {
m_modifiedRows.insert(index.row());
const auto i = index.row();
m_modifiedRows.insert(i);
emit valueChanged(item(i, 0)->text(), item(i, 2)->text());
}
return ret;
}
......
......@@ -51,7 +51,10 @@ class CMakeCacheModel : public QStandardItemModel
KDevelop::Path filePath() const;
void read();
QVariantMap changedValues() const;
Q_SIGNALS:
void valueChanged(const QString& name, const QString& value) const;
public Q_SLOTS:
void reset();
......
......@@ -39,6 +39,7 @@
#include "cmakebuilderconfig.h"
#include <debug.h>
#include <cmakeutils.h>
#include <cmakefileapi.h>
#include <interfaces/iproject.h>
#include <project/interfaces/ibuildsystemmanager.h>
#include <project/interfaces/iprojectbuilder.h>
......@@ -114,13 +115,20 @@ void CMakePreferences::initAdvanced()
m_prefsUi->environment->setCurrentProfile( CMake::currentEnvironment(m_project) );
m_prefsUi->installationPrefix->setText(CMake::currentInstallDir(m_project).toLocalFile());
m_prefsUi->installationPrefix->setMode(KFile::Directory);
const QString buildType = CMake::currentBuildType(m_project);
setBuildType(CMake::currentBuildType(m_project));
m_prefsUi->extraArguments->setEditText(CMake::currentExtraArguments(m_project));
m_prefsUi->cMakeExecutable->setText(CMake::currentCMakeExecutable(m_project).toLocalFile());
}
void CMakePreferences::setBuildType(const QString& buildType)
{
if (m_prefsUi->buildType->currentText() == buildType)
return;
if (m_prefsUi->buildType->findText(buildType) == -1) {
m_prefsUi->buildType->addItem(buildType);
}
m_prefsUi->buildType->setCurrentIndex(m_prefsUi->buildType->findText(buildType));
m_prefsUi->extraArguments->setEditText(CMake::currentExtraArguments(m_project));
m_prefsUi->cMakeExecutable->setText(CMake::currentCMakeExecutable(m_project).toLocalFile());
}
void CMakePreferences::reset()
......@@ -158,10 +166,7 @@ void CMakePreferences::apply()
CMake::setCurrentInstallDir( m_project, Path(m_prefsUi->installationPrefix->text()) );
const QString buildType = m_prefsUi->buildType->currentText();
if (m_prefsUi->buildType->findText(buildType) == -1) {
m_prefsUi->buildType->addItem(buildType);
}
CMake::setCurrentBuildType( m_project, buildType );
CMake::setCurrentBuildType(m_project, buildType);
CMake::setCurrentExtraArguments( m_project, m_prefsUi->extraArguments->currentText() );
CMake::setCurrentCMakeExecutable( m_project, Path(m_prefsUi->cMakeExecutable->text()) );
......@@ -223,6 +228,20 @@ void CMakePreferences::updateCache(const Path &newBuildDir)
this, &CMakePreferences::configureCacheView);
connect(m_prefsUi->cacheList->selectionModel(), &QItemSelectionModel::currentChanged,
this, &CMakePreferences::listSelectionChanged);
connect(m_currentModel, &CMakeCacheModel::valueChanged, this,
[this](const QString& name, const QString& value) {
if (name == QLatin1String("CMAKE_BUILD_TYPE")) {
setBuildType(value);
}
});
connect(m_prefsUi->buildType, &QComboBox::currentTextChanged, m_currentModel, [this](const QString& value) {
if (!m_currentModel)
return;
const auto items = m_currentModel->findItems(QStringLiteral("CMAKE_BUILD_TYPE"));
for (auto* item : items) {
m_currentModel->setData(m_currentModel->index(item->row(), 2), value);
}
});
}
else
{
......@@ -366,6 +385,13 @@ void CMakePreferences::removeBuildDir()
void CMakePreferences::configure()
{
if (CMake::FileApi::supported(CMake::currentCMakeExecutable(m_project).toLocalFile())) {
// the file api already does a configure internally when we reload the model
// so don't do it twice
m_project->reloadModel();
return;
}
IProjectBuilder *b=m_project->buildSystemManager()->builder();
KJob* job=b->configure(m_project);
if( m_currentModel ) {
......
......@@ -64,7 +64,8 @@ class CMakePreferences : public KDevelop::ConfigPage
private:
void configure();
void initAdvanced();
void setBuildType(const QString& buildType);
KDevelop::IProject* m_project;
KDevelop::Path m_srcFolder;
KDevelop::Path m_subprojFolder;
......
......@@ -283,7 +283,7 @@ void DebugSession::handleVersion(const QStringList& s)
// minimal version is 7.0,0
QRegularExpression rx(QStringLiteral("([0-9]+)\\.([0-9]+)(\\.([0-9]+))?"));
const auto match = rx.match(response);
if (!match.hasMatch() || QVersionNumber::fromString(match.capturedRef(0)) < QVersionNumber(7, 0, 0)) {
if (!match.hasMatch() || QVersionNumber::fromString(match.capturedRef(0).toString()) < QVersionNumber(7, 0, 0)) {
if (!qobject_cast<QGuiApplication*>(qApp)) {
//for unittest
qFatal("You need a graphical application.");
......
......@@ -30,14 +30,14 @@ int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
KAboutData aboutData(QLatin1String("QMake Parser"), "qmake-parser", QLatin1String("1.0"));
aboutData.setShortDescription("Parse QMake project files");
KAboutData aboutData(QLatin1String("QMake Parser"), QLatin1String("qmake-parser"), QLatin1String("1.0"));
aboutData.setShortDescription(QLatin1String("Parse QMake project files"));
KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption(QLatin1String("debug"), "Enable output of the debug AST"));
parser.addPositionalArgument("files", "QMake project files");
parser.addOption(QCommandLineOption(QLatin1String("debug"), QLatin1String("Enable output of the debug AST")));
parser.addPositionalArgument(QLatin1String("files"), QLatin1String("QMake project files"));
parser.process(app);
aboutData.processCommandLine(&parser);
......@@ -47,7 +47,7 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}
const bool debug = parser.isSet("debug");
const bool debug = parser.isSet(QLatin1String("debug"));
foreach (const auto arg, parser.positionalArguments()) {
QMake::Driver driver;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment