QmlDesigner: Remove unneeded qualifications

Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
  next if file =~ %r{src/shared/qbs|/qmljs/}
  s = File.read(file)
  s.scan(/^using namespace (.*);$/) {
    ns = $1
    t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
      before = $1
      char = $2
      if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
        m
      else
        before + char
      end
    }
    if t != s
      puts file
      File.open(file, 'w').write(t)
    end
  }
}

Change-Id: I492792bb9e5655c55795e938031efc557c9a462f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Orgad Shaneh
2015-02-03 23:48:57 +02:00
committed by Orgad Shaneh
parent 42af154c77
commit b6de2d1bd8
55 changed files with 319 additions and 312 deletions

View File

@@ -50,8 +50,7 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
LocalApplicationRunConfiguration *larc =
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
QTC_ASSERT(larc, return 0);
ProjectExplorer::EnvironmentAspect *environment
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>();
QTC_ASSERT(environment, return 0);
Configuration conf;
conf.executable = larc->executable();
@@ -102,8 +101,7 @@ void LocalQmlProfilerRunner::start()
m_launcher.setEnvironment(m_configuration.environment);
connect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)),
this, SLOT(spontaneousStop(int,QProcess::ExitStatus)));
m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_configuration.executable,
arguments);
m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments);
emit started();
}

View File

@@ -96,7 +96,7 @@ void QmlProfilerAttachDialog::setPort(const int port)
d->portSpinBox->setValue(port);
}
ProjectExplorer::Kit *QmlProfilerAttachDialog::kit() const
Kit *QmlProfilerAttachDialog::kit() const
{
return d->kitChooser->currentKit();
}

View File

@@ -342,7 +342,7 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime)
d->modelManager->traceTime()->increaseEndTime(maximumTime);
d->qmlDataReady = true;
if (!d->v8clientplugin ||
d->v8clientplugin.data()->state() != QmlDebug::QmlDebugClient::Enabled ||
d->v8clientplugin.data()->state() != QmlDebugClient::Enabled ||
d->v8DataReady) {
emit dataReadyForProcessing();
// once complete is sent, reset the flags
@@ -355,7 +355,7 @@ void QmlProfilerClientManager::v8Complete()
{
d->v8DataReady = true;
if (!d->qmlclientplugin ||
d->qmlclientplugin.data()->state() != QmlDebug::QmlDebugClient::Enabled ||
d->qmlclientplugin.data()->state() != QmlDebugClient::Enabled ||
d->qmlDataReady) {
emit dataReadyForProcessing();
// once complete is sent, reset the flags

View File

@@ -68,9 +68,9 @@ struct RootEventType : public QmlProfilerDataModel::QmlEventTypeData {
{
QString rootEventName = QmlProfilerEventsMainView::tr("<program>");
displayName = rootEventName;
location = QmlDebug::QmlEventLocation(rootEventName, 1, 1);
message = QmlDebug::MaximumMessage;
rangeType = QmlDebug::MaximumRangeType;
location = QmlEventLocation(rootEventName, 1, 1);
message = MaximumMessage;
rangeType = MaximumRangeType;
detailType = -1;
data = QmlProfilerEventsMainView::tr("Main Program");
}
@@ -339,30 +339,30 @@ bool QmlProfilerEventsWidget::showExtendedStatistics() const
void QmlProfilerEventsWidget::setShowJavaScript(bool show)
{
d->modelProxy->setEventTypeAccepted(QmlDebug::Javascript, show);
d->modelProxy->setEventTypeAccepted(Javascript, show);
d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd);
}
void QmlProfilerEventsWidget::setShowQml(bool show)
{
d->modelProxy->setEventTypeAccepted(QmlDebug::Binding, show);
d->modelProxy->setEventTypeAccepted(QmlDebug::HandlingSignal, show);
d->modelProxy->setEventTypeAccepted(QmlDebug::Compiling, show);
d->modelProxy->setEventTypeAccepted(QmlDebug::Creating, show);
d->modelProxy->setEventTypeAccepted(Binding, show);
d->modelProxy->setEventTypeAccepted(HandlingSignal, show);
d->modelProxy->setEventTypeAccepted(Compiling, show);
d->modelProxy->setEventTypeAccepted(Creating, show);
d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd);
}
bool QmlProfilerEventsWidget::showJavaScript() const
{
return d->modelProxy->eventTypeAccepted(QmlDebug::Javascript);
return d->modelProxy->eventTypeAccepted(Javascript);
}
bool QmlProfilerEventsWidget::showQml() const
{
return d->modelProxy->eventTypeAccepted(QmlDebug::Binding) &&
d->modelProxy->eventTypeAccepted(QmlDebug::HandlingSignal) &&
d->modelProxy->eventTypeAccepted(QmlDebug::Compiling) &&
d->modelProxy->eventTypeAccepted(QmlDebug::Creating);
return d->modelProxy->eventTypeAccepted(Binding) &&
d->modelProxy->eventTypeAccepted(HandlingSignal) &&
d->modelProxy->eventTypeAccepted(Compiling) &&
d->modelProxy->eventTypeAccepted(Creating);
}
////////////////////////////////////////////////////////////////////////////////////
@@ -700,15 +700,15 @@ void QmlProfilerEventsMainView::parseModelProxy()
}
}
QString QmlProfilerEventsMainView::nameForType(QmlDebug::RangeType typeNumber)
QString QmlProfilerEventsMainView::nameForType(RangeType typeNumber)
{
switch (typeNumber) {
case QmlDebug::Painting: return QmlProfilerEventsMainView::tr("Paint");
case QmlDebug::Compiling: return QmlProfilerEventsMainView::tr("Compile");
case QmlDebug::Creating: return QmlProfilerEventsMainView::tr("Create");
case QmlDebug::Binding: return QmlProfilerEventsMainView::tr("Binding");
case QmlDebug::HandlingSignal: return QmlProfilerEventsMainView::tr("Signal");
case QmlDebug::Javascript: return QmlProfilerEventsMainView::tr("JavaScript");
case Painting: return QmlProfilerEventsMainView::tr("Paint");
case Compiling: return QmlProfilerEventsMainView::tr("Compile");
case Creating: return QmlProfilerEventsMainView::tr("Create");
case Binding: return QmlProfilerEventsMainView::tr("Binding");
case HandlingSignal: return QmlProfilerEventsMainView::tr("Signal");
case Javascript: return QmlProfilerEventsMainView::tr("JavaScript");
default: return QString();
}
}

View File

@@ -646,21 +646,21 @@ void QmlProfilerTool::clientsDisconnected()
// If the connection is closed while the app is still running, no special action is needed
}
template<QmlDebug::ProfileFeature feature>
template<ProfileFeature feature>
void QmlProfilerTool::updateFeaturesMenu(quint64 features)
{
if (features & (1ULL << (feature))) {
QAction *action = d->m_featuresMenu->addAction(tr(QmlProfilerModelManager::featureName(
static_cast<QmlDebug::ProfileFeature>(feature))));
static_cast<ProfileFeature>(feature))));
action->setCheckable(true);
action->setData(static_cast<uint>(feature));
action->setChecked(d->m_profilerState->recordingFeatures() & (1ULL << (feature)));
}
updateFeaturesMenu<static_cast<QmlDebug::ProfileFeature>(feature + 1)>(features);
updateFeaturesMenu<static_cast<ProfileFeature>(feature + 1)>(features);
}
template<>
void QmlProfilerTool::updateFeaturesMenu<QmlDebug::MaximumProfileFeature>(quint64 features)
void QmlProfilerTool::updateFeaturesMenu<MaximumProfileFeature>(quint64 features)
{
Q_UNUSED(features);
return;
@@ -672,7 +672,7 @@ void QmlProfilerTool::setAvailableFeatures(quint64 features)
d->m_profilerState->setRecordingFeatures(features); // by default, enable them all.
if (d->m_featuresMenu) {
d->m_featuresMenu->clear();
updateFeaturesMenu<static_cast<QmlDebug::ProfileFeature>(0)>(features);
updateFeaturesMenu<static_cast<ProfileFeature>(0)>(features);
}
}

View File

@@ -79,41 +79,41 @@ Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == QmlDebug::MaximumMessage * sizeof(con
namespace QmlProfiler {
namespace Internal {
static QPair<QmlDebug::Message, QmlDebug::RangeType> qmlTypeAsEnum(const QString &typeString)
static QPair<Message, RangeType> qmlTypeAsEnum(const QString &typeString)
{
QPair<QmlDebug::Message, QmlDebug::RangeType> ret(QmlDebug::MaximumMessage,
QmlDebug::MaximumRangeType);
QPair<Message, RangeType> ret(MaximumMessage,
MaximumRangeType);
for (int i = 0; i < QmlDebug::MaximumMessage; ++i) {
for (int i = 0; i < MaximumMessage; ++i) {
if (typeString == _(MESSAGE_STRINGS[i])) {
ret.first = static_cast<QmlDebug::Message>(i);
ret.first = static_cast<Message>(i);
break;
}
}
for (int i = 0; i < QmlDebug::MaximumRangeType; ++i) {
for (int i = 0; i < MaximumRangeType; ++i) {
if (typeString == _(RANGE_TYPE_STRINGS[i])) {
ret.second = static_cast<QmlDebug::RangeType>(i);
ret.second = static_cast<RangeType>(i);
break;
}
}
if (ret.first == QmlDebug::MaximumMessage && ret.second == QmlDebug::MaximumRangeType) {
if (ret.first == MaximumMessage && ret.second == MaximumRangeType) {
bool isNumber = false;
int type = typeString.toUInt(&isNumber);
if (isNumber && type < QmlDebug::MaximumRangeType)
if (isNumber && type < MaximumRangeType)
// Allow saving ranges as numbers, but not messages.
ret.second = static_cast<QmlDebug::RangeType>(type);
ret.second = static_cast<RangeType>(type);
}
return ret;
}
static QString qmlTypeAsString(QmlDebug::Message message, QmlDebug::RangeType rangeType)
static QString qmlTypeAsString(Message message, RangeType rangeType)
{
if (rangeType < QmlDebug::MaximumRangeType)
if (rangeType < MaximumRangeType)
return _(RANGE_TYPE_STRINGS[rangeType]);
else if (message != QmlDebug::MaximumMessage)
else if (message != MaximumMessage)
return _(MESSAGE_STRINGS[message]);
else
return QString::number((int)rangeType);
@@ -247,7 +247,7 @@ void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream)
}
if (elementName == _("type")) {
QPair<QmlDebug::Message, QmlDebug::RangeType> enums = qmlTypeAsEnum(readData);
QPair<Message, RangeType> enums = qmlTypeAsEnum(readData);
event.message = enums.first;
event.rangeType = enums.second;
break;
@@ -513,14 +513,14 @@ void QmlProfilerFileWriter::save(QIODevice *device)
const QmlProfilerDataModel::QmlEventTypeData &event = m_qmlEvents[range.typeIndex];
// special: animation event
if (event.message == QmlDebug::Event && event.detailType == QmlDebug::AnimationFrame) {
if (event.message == Event && event.detailType == AnimationFrame) {
stream.writeAttribute(_("framerate"), QString::number(range.numericData1));
stream.writeAttribute(_("animationcount"), QString::number(range.numericData2));
stream.writeAttribute(_("thread"), QString::number(range.numericData3));
}
// special: pixmap cache event
if (event.message == QmlDebug::PixmapCacheEvent) {
if (event.message == PixmapCacheEvent) {
if (event.detailType == PixmapSizeKnown) {
stream.writeAttribute(_("width"), QString::number(range.numericData1));
stream.writeAttribute(_("height"), QString::number(range.numericData2));
@@ -531,7 +531,7 @@ void QmlProfilerFileWriter::save(QIODevice *device)
stream.writeAttribute(_("refCount"), QString::number(range.numericData3));
}
if (event.message == QmlDebug::SceneGraphFrame) {
if (event.message == SceneGraphFrame) {
// special: scenegraph frame events
if (range.numericData1 > 0)
stream.writeAttribute(_("timing1"), QString::number(range.numericData1));
@@ -546,7 +546,7 @@ void QmlProfilerFileWriter::save(QIODevice *device)
}
// special: memory allocation event
if (event.message == QmlDebug::MemoryAllocation)
if (event.message == MemoryAllocation)
stream.writeAttribute(_("amount"), QString::number(range.numericData1));
stream.writeEndElement();

View File

@@ -135,8 +135,8 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
d->m_modelProxy->addModel(new QmlProfilerAnimationsModel(modelManager, d->m_modelProxy));
for (int i = 0; i < QmlDebug::MaximumRangeType; ++i)
d->m_modelProxy->addModel(new QmlProfilerRangeModel(modelManager, (QmlDebug::RangeType)i,
for (int i = 0; i < MaximumRangeType; ++i)
d->m_modelProxy->addModel(new QmlProfilerRangeModel(modelManager, (RangeType)i,
d->m_modelProxy));
// Connect this last so that it's executed after the models have updated their data.