Commit a592bf54 authored by Christoph Cullmann's avatar Christoph Cullmann

disable ctags indexing per default

one can enable it via

"index": true

in the .kateproject.

The GUI tells this now.

BUG: 412351
BUG: 387830
parent 7dfcc36e
{
"name": "Kate"
, "index": true
, "files": [ { "git": 1 } ]
, "build": {
"directory": "build"
, "build": "make all"
, "clean": "make clean"
, "quick": "gcc -Wall -g -o %n %f"
}
}
......@@ -143,16 +143,16 @@ bool KateProject::load(const QVariantMap &globalProject, bool force)
*/
m_projectMap = globalProject;
/**
* emit that we changed stuff
*/
// emit that we changed stuff
emit projectMapChanged();
KateProjectWorker *w = new KateProjectWorker(m_baseDir, m_projectMap);
// trigger loading of project in background thread
auto w = new KateProjectWorker(m_baseDir, m_projectMap);
connect(w, &KateProjectWorker::loadDone, this, &KateProject::loadProjectDone);
connect(w, &KateProjectWorker::loadIndexDone, this, &KateProject::loadIndexDone);
m_weaver->stream() << w;
// we are done here
return true;
}
......
......@@ -136,7 +136,7 @@ void KateProjectInfoViewIndex::indexAvailable()
/**
* update enabled state of widgets
*/
const bool valid = m_project->projectIndex()->isValid();
const bool valid = m_project->projectIndex() && m_project->projectIndex()->isValid();
m_lineEdit->setEnabled(valid);
m_treeView->setEnabled(valid);
......@@ -152,7 +152,14 @@ void KateProjectInfoViewIndex::indexAvailable()
m_messageWidget->setCloseButtonVisible(true);
m_messageWidget->setMessageType(KMessageWidget::Warning);
m_messageWidget->setWordWrap(false);
m_messageWidget->setText(i18n("The index could not be created. Please install 'ctags'."));
// disabled or failed to create?
if (m_project->projectIndex()) {
m_messageWidget->setText(i18n("The index could not be created. Please install 'ctags'."));
} else {
m_messageWidget->setText(i18n("The index is not enabled. Please add '\"index\": true' to your .kateproject file."));
}
static_cast<QVBoxLayout *>(layout())->insertWidget(0, m_messageWidget);
} else {
m_messageWidget->animatedShow();
......
......@@ -57,9 +57,7 @@ void KateProjectWorker::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
emit loadDone(topLevel, file2Item);
/**
* load index
*/
// trigger index loading, will internally handle enable/disabled
loadIndex(files);
}
......@@ -466,12 +464,21 @@ QStringList KateProjectWorker::filesFromDirectory(const QDir &_dir, bool recursi
void KateProjectWorker::loadIndex(const QStringList &files)
{
/**
* load index, if enabled
* before this was default on, which is dangerous for large repositories, e.g. out-of-memory or out-of-disk
*/
if (!m_projectMap[QStringLiteral("index")].toBool()) {
emit loadIndexDone(KateProjectSharedProjectIndex());
return;
}
/**
* create new index, this will do the loading in the constructor
* wrap it into shared pointer for transfer to main thread
*/
const QString keyCtags = QStringLiteral("ctags");
KateProjectSharedProjectIndex index(new KateProjectIndex(files, m_projectMap[keyCtags].toMap()));
emit loadIndexDone(index);
}
......@@ -91,13 +91,13 @@ private:
/**
* our project, only as QObject, we only send messages back and forth!
*/
QObject *m_project;
QObject * m_project;
/**
* project base directory name
*/
QString m_baseDir;
QVariantMap m_projectMap;
const QString m_baseDir;
const QVariantMap m_projectMap;
};
#endif
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