Commit 3b669a37 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ClassView: Use Qt5-style connects

The heavy lifting was done by clazy.

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