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

View File

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