forked from qt-creator/qt-creator
ClassView: Use Qt5-style connects
The heavy lifting was done by clazy. Change-Id: I6aac0c1e66b24bb8b638aee906f9f355d2e23d48 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
729a7345f4
commit
3b669a37cd
@@ -219,61 +219,63 @@ bool Manager::hasChildren(QStandardItem *item) const
|
|||||||
|
|
||||||
void Manager::initialize()
|
void Manager::initialize()
|
||||||
{
|
{
|
||||||
|
using ProjectExplorer::SessionManager;
|
||||||
|
|
||||||
// use Qt::QueuedConnection everywhere
|
// use Qt::QueuedConnection everywhere
|
||||||
|
|
||||||
// internal manager state is changed
|
// internal manager state is changed
|
||||||
connect(this, SIGNAL(stateChanged(bool)), SLOT(onStateChanged(bool)), Qt::QueuedConnection);
|
connect(this, &Manager::stateChanged, this, &Manager::onStateChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
// connections to enable/disable navi widget factory
|
// connections to enable/disable navi widget factory
|
||||||
QObject *sessionManager = ProjectExplorer::SessionManager::instance();
|
SessionManager *sessionManager = SessionManager::instance();
|
||||||
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
connect(sessionManager, &SessionManager::projectAdded,
|
||||||
SLOT(onProjectListChanged()), Qt::QueuedConnection);
|
this, &Manager::onProjectListChanged, Qt::QueuedConnection);
|
||||||
connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
connect(sessionManager, &SessionManager::projectRemoved,
|
||||||
SLOT(onProjectListChanged()), Qt::QueuedConnection);
|
this, &Manager::onProjectListChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
// connect to the progress manager for signals about Parsing tasks
|
// connect to the progress manager for signals about Parsing tasks
|
||||||
connect(ProgressManager::instance(), SIGNAL(taskStarted(Core::Id)),
|
connect(ProgressManager::instance(), &ProgressManager::taskStarted,
|
||||||
SLOT(onTaskStarted(Core::Id)), Qt::QueuedConnection);
|
this, &Manager::onTaskStarted, Qt::QueuedConnection);
|
||||||
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
|
connect(ProgressManager::instance(), &ProgressManager::allTasksFinished,
|
||||||
SLOT(onAllTasksFinished(Core::Id)), Qt::QueuedConnection);
|
this, &Manager::onAllTasksFinished, Qt::QueuedConnection);
|
||||||
|
|
||||||
// when we signals that really document is updated - sent it to the parser
|
// when we signals that really document is updated - sent it to the parser
|
||||||
connect(this, SIGNAL(requestDocumentUpdated(CPlusPlus::Document::Ptr)),
|
connect(this, &Manager::requestDocumentUpdated,
|
||||||
&d->parser, SLOT(parseDocument(CPlusPlus::Document::Ptr)), Qt::QueuedConnection);
|
&d->parser, &Parser::parseDocument, Qt::QueuedConnection);
|
||||||
|
|
||||||
// translate data update from the parser to listeners
|
// translate data update from the parser to listeners
|
||||||
connect(&d->parser, SIGNAL(treeDataUpdate(QSharedPointer<QStandardItem>)),
|
connect(&d->parser, &Parser::treeDataUpdate,
|
||||||
this, SLOT(onTreeDataUpdate(QSharedPointer<QStandardItem>)), Qt::QueuedConnection);
|
this, &Manager::onTreeDataUpdate, Qt::QueuedConnection);
|
||||||
|
|
||||||
// requet current state - immediately after a notification
|
// requet current state - immediately after a notification
|
||||||
connect(this, SIGNAL(requestTreeDataUpdate()),
|
connect(this, &Manager::requestTreeDataUpdate,
|
||||||
&d->parser, SLOT(requestCurrentState()), Qt::QueuedConnection);
|
&d->parser, &Parser::requestCurrentState, Qt::QueuedConnection);
|
||||||
|
|
||||||
// full reset request to parser
|
// full reset request to parser
|
||||||
connect(this, SIGNAL(requestResetCurrentState()),
|
connect(this, &Manager::requestResetCurrentState,
|
||||||
&d->parser, SLOT(resetDataToCurrentState()), Qt::QueuedConnection);
|
&d->parser, &Parser::resetDataToCurrentState, Qt::QueuedConnection);
|
||||||
|
|
||||||
// clear cache request
|
// clear cache request
|
||||||
connect(this, SIGNAL(requestClearCache()),
|
connect(this, &Manager::requestClearCache,
|
||||||
&d->parser, SLOT(clearCache()), Qt::QueuedConnection);
|
&d->parser, &Parser::clearCache, Qt::QueuedConnection);
|
||||||
|
|
||||||
// clear full cache request
|
// clear full cache request
|
||||||
connect(this, SIGNAL(requestClearCacheAll()),
|
connect(this, &Manager::requestClearCacheAll,
|
||||||
&d->parser, SLOT(clearCacheAll()), Qt::QueuedConnection);
|
&d->parser, &Parser::clearCacheAll, Qt::QueuedConnection);
|
||||||
|
|
||||||
// flat mode request
|
// flat mode request
|
||||||
connect(this, SIGNAL(requestSetFlatMode(bool)),
|
connect(this, &Manager::requestSetFlatMode,
|
||||||
&d->parser, SLOT(setFlatMode(bool)), Qt::QueuedConnection);
|
&d->parser, &Parser::setFlatMode, Qt::QueuedConnection);
|
||||||
|
|
||||||
// connect to the cpp model manager for signals about document updates
|
// connect to the cpp model manager for signals about document updates
|
||||||
CppTools::CppModelManager *codeModelManager = CppTools::CppModelManager::instance();
|
CppTools::CppModelManager *codeModelManager = CppTools::CppModelManager::instance();
|
||||||
|
|
||||||
// when code manager signals that document is updated - handle it by ourselves
|
// when code manager signals that document is updated - handle it by ourselves
|
||||||
connect(codeModelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
|
connect(codeModelManager, &CppTools::CppModelManager::documentUpdated,
|
||||||
SLOT(onDocumentUpdated(CPlusPlus::Document::Ptr)), Qt::QueuedConnection);
|
this, &Manager::onDocumentUpdated, Qt::QueuedConnection);
|
||||||
//
|
//
|
||||||
connect(codeModelManager, SIGNAL(aboutToRemoveFiles(QStringList)),
|
connect(codeModelManager, &CppTools::CppModelManager::aboutToRemoveFiles,
|
||||||
&d->parser, SLOT(removeFiles(QStringList)), Qt::QueuedConnection);
|
&d->parser, &Parser::removeFiles, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ signals:
|
|||||||
|
|
||||||
void requestSetFlatMode(bool flat);
|
void requestSetFlatMode(bool flat);
|
||||||
|
|
||||||
public slots:
|
public:
|
||||||
void gotoLocation(const QString &fileName, int line = 0, int column = 0);
|
void gotoLocation(const QString &fileName, int line = 0, int column = 0);
|
||||||
|
|
||||||
void gotoLocations(const QList<QVariant> &locations);
|
void gotoLocations(const QList<QVariant> &locations);
|
||||||
@@ -81,8 +81,9 @@ public slots:
|
|||||||
|
|
||||||
void setFlatMode(bool flat);
|
void setFlatMode(bool flat);
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void onWidgetVisibilityIsChanged(bool visibility);
|
void onWidgetVisibilityIsChanged(bool visibility);
|
||||||
|
|
||||||
|
protected:
|
||||||
void onStateChanged(bool state);
|
void onStateChanged(bool state);
|
||||||
void onProjectListChanged();
|
void onProjectListChanged();
|
||||||
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
||||||
|
|||||||
@@ -112,28 +112,28 @@ NavigationWidget::NavigationWidget(QWidget *parent) :
|
|||||||
|
|
||||||
// connect signal/slots
|
// connect signal/slots
|
||||||
// selected item
|
// selected item
|
||||||
connect(treeView, SIGNAL(activated(QModelIndex)), SLOT(onItemActivated(QModelIndex)));
|
connect(treeView, &QAbstractItemView::activated, this, &NavigationWidget::onItemActivated);
|
||||||
|
|
||||||
// double-clicked item
|
// double-clicked item
|
||||||
connect(treeView, SIGNAL(doubleClicked(QModelIndex)), SLOT(onItemDoubleClicked(QModelIndex)));
|
connect(treeView, &QAbstractItemView::doubleClicked, this, &NavigationWidget::onItemDoubleClicked);
|
||||||
|
|
||||||
// connections to the manager
|
// connections to the manager
|
||||||
Manager *manager = Manager::instance();
|
Manager *manager = Manager::instance();
|
||||||
|
|
||||||
connect(this, SIGNAL(visibilityChanged(bool)),
|
connect(this, &NavigationWidget::visibilityChanged,
|
||||||
manager, SLOT(onWidgetVisibilityIsChanged(bool)));
|
manager, &Manager::onWidgetVisibilityIsChanged);
|
||||||
|
|
||||||
connect(this, SIGNAL(requestGotoLocation(QString,int,int)),
|
connect(this, &NavigationWidget::requestGotoLocation,
|
||||||
manager, SLOT(gotoLocation(QString,int,int)));
|
manager, &Manager::gotoLocation);
|
||||||
|
|
||||||
connect(this, SIGNAL(requestGotoLocations(QList<QVariant>)),
|
connect(this, &NavigationWidget::requestGotoLocations,
|
||||||
manager, SLOT(gotoLocations(QList<QVariant>)));
|
manager, &Manager::gotoLocations);
|
||||||
|
|
||||||
connect(manager, SIGNAL(treeDataUpdate(QSharedPointer<QStandardItem>)),
|
connect(manager, &Manager::treeDataUpdate,
|
||||||
this, SLOT(onDataUpdate(QSharedPointer<QStandardItem>)));
|
this, &NavigationWidget::onDataUpdate);
|
||||||
|
|
||||||
connect(this, SIGNAL(requestTreeDataUpdate()),
|
connect(this, &NavigationWidget::requestTreeDataUpdate,
|
||||||
manager, SLOT(onRequestTreeDataUpdate()));
|
manager, &Manager::onRequestTreeDataUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationWidget::~NavigationWidget()
|
NavigationWidget::~NavigationWidget()
|
||||||
@@ -181,8 +181,8 @@ QList<QToolButton *> NavigationWidget::createToolButtons()
|
|||||||
setFlatMode(false);
|
setFlatMode(false);
|
||||||
|
|
||||||
// connections
|
// connections
|
||||||
connect(fullProjectsModeButton, SIGNAL(toggled(bool)),
|
connect(fullProjectsModeButton.data(), &QAbstractButton::toggled,
|
||||||
this, SLOT(onFullProjectsModeToggled(bool)));
|
this, &NavigationWidget::onFullProjectsModeToggled);
|
||||||
}
|
}
|
||||||
|
|
||||||
list << fullProjectsModeButton;
|
list << fullProjectsModeButton;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ signals:
|
|||||||
|
|
||||||
void requestTreeDataUpdate();
|
void requestTreeDataUpdate();
|
||||||
|
|
||||||
public slots:
|
public:
|
||||||
void onItemActivated(const QModelIndex &index);
|
void onItemActivated(const QModelIndex &index);
|
||||||
void onItemDoubleClicked(const QModelIndex &index);
|
void onItemDoubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ Parser::Parser(QObject *parent)
|
|||||||
connect(this, &Parser::resetDataDone, this, &Parser::onResetDataDone, Qt::QueuedConnection);
|
connect(this, &Parser::resetDataDone, this, &Parser::onResetDataDone, Qt::QueuedConnection);
|
||||||
|
|
||||||
// timer for emitting changes
|
// timer for emitting changes
|
||||||
connect(d->timer, SIGNAL(timeout()), SLOT(requestCurrentState()), Qt::QueuedConnection);
|
connect(d->timer.data(), &QTimer::timeout, this, &Parser::requestCurrentState, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ signals:
|
|||||||
|
|
||||||
void resetDataDone();
|
void resetDataDone();
|
||||||
|
|
||||||
public slots:
|
public:
|
||||||
void clearCacheAll();
|
void clearCacheAll();
|
||||||
|
|
||||||
void clearCache();
|
void clearCache();
|
||||||
@@ -85,13 +85,12 @@ public slots:
|
|||||||
|
|
||||||
void setFlatMode(bool flat);
|
void setFlatMode(bool flat);
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void onResetDataDone();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef QHash<QString, unsigned>::const_iterator CitCachedDocTreeRevision;
|
typedef QHash<QString, unsigned>::const_iterator CitCachedDocTreeRevision;
|
||||||
typedef QHash<QString, QStringList>::const_iterator CitCachedPrjFileLists;
|
typedef QHash<QString, QStringList>::const_iterator CitCachedPrjFileLists;
|
||||||
|
|
||||||
|
void onResetDataDone();
|
||||||
|
|
||||||
void addProject(const ParserTreeItem::Ptr &item, const QStringList &fileList,
|
void addProject(const ParserTreeItem::Ptr &item, const QStringList &fileList,
|
||||||
const QString &projectId = QString());
|
const QString &projectId = QString());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user