forked from qt-creator/qt-creator
Utils: Introduce GlobalFileChangeBlocker
Tracks application state, and signals when it is changed. Supports forcing blocked state with reference counting. Change-Id: Ic173d42446b1b08bd4a1e7c1acf38c68644d30b3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
81ce096719
commit
c225216b93
@@ -76,8 +76,6 @@ ClangModelManagerSupport::ClangModelManagerSupport()
|
||||
QTC_CHECK(!m_instance);
|
||||
m_instance = this;
|
||||
|
||||
QApplication::instance()->installEventFilter(this);
|
||||
|
||||
CppTools::CppModelManager::instance()->setCurrentDocumentFilter(
|
||||
std::make_unique<ClangCurrentDocumentFilter>());
|
||||
|
||||
@@ -141,11 +139,6 @@ std::unique_ptr<CppTools::AbstractOverviewModel> ClangModelManagerSupport::creat
|
||||
return std::make_unique<OverviewModel>();
|
||||
}
|
||||
|
||||
void ClangModelManagerSupport::setBackendJobsPostponed(bool postponed)
|
||||
{
|
||||
m_communicator.setBackendJobsPostponed(postponed);
|
||||
}
|
||||
|
||||
CppTools::BaseEditorDocumentProcessor *ClangModelManagerSupport::createEditorDocumentProcessor(
|
||||
TextEditor::TextDocument *baseTextDocument)
|
||||
{
|
||||
@@ -219,20 +212,6 @@ void ClangModelManagerSupport::connectToWidgetsMarkContextMenuRequested(QWidget
|
||||
}
|
||||
}
|
||||
|
||||
bool ClangModelManagerSupport::eventFilter(QObject *obj, QEvent *e)
|
||||
{
|
||||
if (obj == QApplication::instance() && e->type() == QEvent::ApplicationStateChange) {
|
||||
switch (QApplication::applicationState()) {
|
||||
case Qt::ApplicationInactive: setBackendJobsPostponed(true); break;
|
||||
case Qt::ApplicationActive: setBackendJobsPostponed(false); break;
|
||||
default:
|
||||
QTC_CHECK(false && "Unexpected Qt::ApplicationState");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor)
|
||||
{
|
||||
QTC_ASSERT(editor, return);
|
||||
|
||||
Reference in New Issue
Block a user