QmakeProject: Polish class

Use final, get rid of some useless headers and debug code

Change-Id: Icb1110f6eda4e17d143d8bdf17167d6c3046b884
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-01-30 15:04:20 +01:00
parent f97911d0fe
commit b139b057a1
2 changed files with 12 additions and 67 deletions

View File

@@ -70,8 +70,6 @@ using namespace QmakeProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
enum { debug = 0 };
namespace QmakeProjectManager { namespace QmakeProjectManager {
namespace Internal { namespace Internal {
@@ -303,8 +301,6 @@ void QmakeProject::updateFileList()
if (newFiles != *m_projectFiles) { if (newFiles != *m_projectFiles) {
*m_projectFiles = newFiles; *m_projectFiles = newFiles;
emit fileListChanged(); emit fileListChanged();
if (debug)
qDebug() << Q_FUNC_INFO << *m_projectFiles;
} }
} }
@@ -342,9 +338,6 @@ Project::RestoreResult QmakeProject::fromMap(const QVariantMap &map, QString *er
void QmakeProject::updateCodeModels() void QmakeProject::updateCodeModels()
{ {
if (debug)
qDebug() << "QmakeProject::updateCodeModel()";
if (activeTarget() && !activeTarget()->activeBuildConfiguration()) if (activeTarget() && !activeTarget()->activeBuildConfiguration())
return; return;
@@ -497,12 +490,7 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
if (m_asyncUpdateState == ShuttingDown) if (m_asyncUpdateState == ShuttingDown)
return; return;
if (debug)
qDebug()<<"schduleAsyncUpdate (node)"<<node->filePath();
if (m_cancelEvaluate) { if (m_cancelEvaluate) {
if (debug)
qDebug()<<" Already canceling, nothing to do";
// A cancel is in progress // A cancel is in progress
// That implies that a full update is going to happen afterwards // That implies that a full update is going to happen afterwards
// So we don't need to do anything // So we don't need to do anything
@@ -514,20 +502,14 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
if (m_asyncUpdateState == AsyncFullUpdatePending) { if (m_asyncUpdateState == AsyncFullUpdatePending) {
// Just postpone // Just postpone
if (debug)
qDebug()<<" full update pending, restarting timer";
startAsyncTimer(delay); startAsyncTimer(delay);
} else if (m_asyncUpdateState == AsyncPartialUpdatePending } else if (m_asyncUpdateState == AsyncPartialUpdatePending
|| m_asyncUpdateState == Base) { || m_asyncUpdateState == Base) {
if (debug)
qDebug()<<" adding node to async update list, setting state to AsyncPartialUpdatePending";
// Add the node // Add the node
m_asyncUpdateState = AsyncPartialUpdatePending; m_asyncUpdateState = AsyncPartialUpdatePending;
QList<QmakeProFileNode *>::iterator it; QList<QmakeProFileNode *>::iterator it;
bool add = true; bool add = true;
if (debug)
qDebug()<<"scheduleAsyncUpdate();"<<m_partialEvaluate.size()<<"nodes";
it = m_partialEvaluate.begin(); it = m_partialEvaluate.begin();
while (it != m_partialEvaluate.end()) { while (it != m_partialEvaluate.end()) {
if (*it == node) { if (*it == node) {
@@ -558,23 +540,17 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
// change a partial update gets in progress and then another // change a partial update gets in progress and then another
// batch of changes come in, which triggers a full update // batch of changes come in, which triggers a full update
// even if that's not really needed // even if that's not really needed
if (debug)
qDebug()<<" Async update in progress, scheduling new one afterwards";
scheduleAsyncUpdate(delay); scheduleAsyncUpdate(delay);
} }
} }
void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay) void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay)
{ {
if (debug)
qDebug()<<"scheduleAsyncUpdate";
if (m_asyncUpdateState == ShuttingDown) if (m_asyncUpdateState == ShuttingDown)
return; return;
if (m_cancelEvaluate) { // we are in progress of canceling if (m_cancelEvaluate) { // we are in progress of canceling
// and will start the evaluation after that // and will start the evaluation after that
if (debug)
qDebug()<<" canceling is in progress, doing nothing";
return; return;
} }
@@ -582,15 +558,11 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay)
setAllBuildConfigurationsEnabled(false); setAllBuildConfigurationsEnabled(false);
if (m_asyncUpdateState == AsyncUpdateInProgress) { if (m_asyncUpdateState == AsyncUpdateInProgress) {
if (debug)
qDebug()<<" update in progress, canceling and setting state to full update pending";
m_cancelEvaluate = true; m_cancelEvaluate = true;
m_asyncUpdateState = AsyncFullUpdatePending; m_asyncUpdateState = AsyncFullUpdatePending;
return; return;
} }
if (debug)
qDebug()<<" starting timer for full update, setting state to full update pending";
m_partialEvaluate.clear(); m_partialEvaluate.clear();
m_asyncUpdateState = AsyncFullUpdatePending; m_asyncUpdateState = AsyncFullUpdatePending;
@@ -609,9 +581,6 @@ void QmakeProject::startAsyncTimer(QmakeProFileNode::AsyncUpdateDelay delay)
void QmakeProject::incrementPendingEvaluateFutures() void QmakeProject::incrementPendingEvaluateFutures()
{ {
++m_pendingEvaluateFuturesCount; ++m_pendingEvaluateFuturesCount;
if (debug)
qDebug()<<"incrementPendingEvaluateFutures to"<<m_pendingEvaluateFuturesCount;
m_asyncUpdateFutureInterface->setProgressRange(m_asyncUpdateFutureInterface->progressMinimum(), m_asyncUpdateFutureInterface->setProgressRange(m_asyncUpdateFutureInterface->progressMinimum(),
m_asyncUpdateFutureInterface->progressMaximum() + 1); m_asyncUpdateFutureInterface->progressMaximum() + 1);
} }
@@ -620,16 +589,9 @@ void QmakeProject::decrementPendingEvaluateFutures()
{ {
--m_pendingEvaluateFuturesCount; --m_pendingEvaluateFuturesCount;
if (debug)
qDebug()<<"decrementPendingEvaluateFutures to"<<m_pendingEvaluateFuturesCount;
m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1); m_asyncUpdateFutureInterface->setProgressValue(m_asyncUpdateFutureInterface->progressValue() + 1);
if (m_pendingEvaluateFuturesCount == 0) { if (m_pendingEvaluateFuturesCount == 0) {
if (debug)
qDebug()<<" WOHOO, no pending futures, cleaning up";
// We are done! // We are done!
if (debug)
qDebug()<<" reporting finished";
m_asyncUpdateFutureInterface->reportFinished(); m_asyncUpdateFutureInterface->reportFinished();
delete m_asyncUpdateFutureInterface; delete m_asyncUpdateFutureInterface;
@@ -638,8 +600,6 @@ void QmakeProject::decrementPendingEvaluateFutures()
// TODO clear the profile cache ? // TODO clear the profile cache ?
if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) { if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) {
if (debug)
qDebug()<<" Oh update is pending start the timer";
rootProjectNode()->setParseInProgressRecursive(true); rootProjectNode()->setParseInProgressRecursive(true);
setAllBuildConfigurationsEnabled(false); setAllBuildConfigurationsEnabled(false);
startAsyncTimer(QmakeProFileNode::ParseLater); startAsyncTimer(QmakeProFileNode::ParseLater);
@@ -656,8 +616,6 @@ void QmakeProject::decrementPendingEvaluateFutures()
updateRunConfigurations(); updateRunConfigurations();
emit proFilesEvaluated(); emit proFilesEvaluated();
emit parsingFinished(); emit parsingFinished();
if (debug)
qDebug()<<" Setting state to Base";
} }
} }
} }
@@ -670,8 +628,6 @@ bool QmakeProject::wasEvaluateCanceled()
void QmakeProject::asyncUpdate() void QmakeProject::asyncUpdate()
{ {
m_asyncUpdateTimer.setInterval(3000); m_asyncUpdateTimer.setInterval(3000);
if (debug)
qDebug()<<"async update, timer expired, doing now";
m_qmakeVfs->invalidateCache(); m_qmakeVfs->invalidateCache();
@@ -682,25 +638,17 @@ void QmakeProject::asyncUpdate()
Core::ProgressManager::addTask(m_asyncUpdateFutureInterface->future(), Core::ProgressManager::addTask(m_asyncUpdateFutureInterface->future(),
tr("Reading Project \"%1\"").arg(displayName()), tr("Reading Project \"%1\"").arg(displayName()),
Constants::PROFILE_EVALUATE); Constants::PROFILE_EVALUATE);
if (debug)
qDebug()<<" adding task";
m_asyncUpdateFutureInterface->reportStarted(); m_asyncUpdateFutureInterface->reportStarted();
if (m_asyncUpdateState == AsyncFullUpdatePending) { if (m_asyncUpdateState == AsyncFullUpdatePending) {
if (debug)
qDebug()<<" full update, starting with root node";
rootProjectNode()->asyncUpdate(); rootProjectNode()->asyncUpdate();
} else { } else {
if (debug)
qDebug()<<" partial update,"<<m_partialEvaluate.size()<<"nodes to update";
foreach (QmakeProFileNode *node, m_partialEvaluate) foreach (QmakeProFileNode *node, m_partialEvaluate)
node->asyncUpdate(); node->asyncUpdate();
} }
m_partialEvaluate.clear(); m_partialEvaluate.clear();
if (debug)
qDebug()<<" Setting state to AsyncUpdateInProgress";
m_asyncUpdateState = AsyncUpdateInProgress; m_asyncUpdateState = AsyncUpdateInProgress;
} }

View File

@@ -30,7 +30,6 @@
#include "qmakenodes.h" #include "qmakenodes.h"
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <QStringList> #include <QStringList>
#include <QFutureInterface> #include <QFutureInterface>
@@ -47,8 +46,6 @@ namespace QtSupport { class ProFileReader; }
namespace QmakeProjectManager { namespace QmakeProjectManager {
class QmakeBuildConfiguration; class QmakeBuildConfiguration;
class QmakePriFileNode;
class QmakeProFileNode;
namespace Internal { namespace Internal {
class CentralizedFolderWatcher; class CentralizedFolderWatcher;
@@ -63,19 +60,19 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeProject : public ProjectExplorer::Project
public: public:
QmakeProject(QmakeManager *manager, const QString &proFile); QmakeProject(QmakeManager *manager, const QString &proFile);
~QmakeProject() override; ~QmakeProject() final;
QString displayName() const override; QString displayName() const final;
QmakeManager *projectManager() const override; QmakeManager *projectManager() const final;
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMesage) const override; bool supportsKit(ProjectExplorer::Kit *k, QString *errorMesage) const final;
QmakeProFileNode *rootProjectNode() const override; QmakeProFileNode *rootProjectNode() const final;
bool validParse(const Utils::FileName &proFilePath) const; bool validParse(const Utils::FileName &proFilePath) const;
bool parseInProgress(const Utils::FileName &proFilePath) const; bool parseInProgress(const Utils::FileName &proFilePath) const;
virtual QStringList files(FilesMode fileMode) const override; virtual QStringList files(FilesMode fileMode) const final;
virtual QStringList filesGeneratedFrom(const QString &file) const override; virtual QStringList filesGeneratedFrom(const QString &file) const final;
enum Parsing {ExactParse, ExactAndCumulativeParse }; enum Parsing {ExactParse, ExactAndCumulativeParse };
QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(), QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(),
@@ -116,11 +113,11 @@ public:
void watchFolders(const QStringList &l, QmakePriFileNode *node); void watchFolders(const QStringList &l, QmakePriFileNode *node);
void unwatchFolders(const QStringList &l, QmakePriFileNode *node); void unwatchFolders(const QStringList &l, QmakePriFileNode *node);
bool needsConfiguration() const override; bool needsConfiguration() const final;
void configureAsExampleProject(const QSet<Core::Id> &platforms) override; void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
bool requiresTargetPanel() const override; bool requiresTargetPanel() const final;
/// \internal /// \internal
QString disabledReasonForRunConfiguration(const Utils::FileName &proFilePath); QString disabledReasonForRunConfiguration(const Utils::FileName &proFilePath);
@@ -131,7 +128,7 @@ public:
void emitBuildDirectoryInitialized(); void emitBuildDirectoryInitialized();
static void proFileParseError(const QString &errorMessage); static void proFileParseError(const QString &errorMessage);
ProjectExplorer::ProjectImporter *projectImporter() const override; ProjectExplorer::ProjectImporter *projectImporter() const final;
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown }; enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState asyncUpdateState() const; AsyncUpdateState asyncUpdateState() const;
@@ -148,7 +145,7 @@ public:
void scheduleAsyncUpdateLater() { scheduleAsyncUpdate(); } void scheduleAsyncUpdateLater() { scheduleAsyncUpdate(); }
protected: protected:
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override; RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final;
private: private:
void asyncUpdate(); void asyncUpdate();