QmlProfiler: Eliminate some clang warnings

Explicitly check the user-given port for the right range, drop an
unnecessary switch/default clause, and reorder members for better
memory alignment.

Change-Id: I82e9f4353debd6b211d251ecd83fc642a04bdd87
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-11-21 13:23:26 +01:00
parent 1b74172019
commit 7d550cd7c4

View File

@@ -109,11 +109,6 @@ public:
QAction *m_stopAction = 0; QAction *m_stopAction = 0;
QToolButton *m_clearButton = 0; QToolButton *m_clearButton = 0;
// elapsed time display
QTimer m_recordingTimer;
QTime m_recordingElapsedTime;
QLabel *m_timeLabel = 0;
// open search // open search
QToolButton *m_searchButton = 0; QToolButton *m_searchButton = 0;
@@ -125,6 +120,11 @@ public:
QAction *m_saveQmlTrace = 0; QAction *m_saveQmlTrace = 0;
QAction *m_loadQmlTrace = 0; QAction *m_loadQmlTrace = 0;
// elapsed time display
QLabel *m_timeLabel = 0;
QTimer m_recordingTimer;
QTime m_recordingElapsedTime;
bool m_toolBusy = false; bool m_toolBusy = false;
}; };
@@ -449,7 +449,8 @@ void QmlProfilerTool::updateTimeDisplay()
if (d->m_profilerState->serverRecording()) { if (d->m_profilerState->serverRecording()) {
seconds = d->m_recordingElapsedTime.elapsed() / 1000.0; seconds = d->m_recordingElapsedTime.elapsed() / 1000.0;
break; break;
} // else fall through }
Q_FALLTHROUGH();
case QmlProfilerStateManager::Idle: case QmlProfilerStateManager::Idle:
if (d->m_profilerModelManager->state() != QmlProfilerModelManager::Empty && if (d->m_profilerModelManager->state() != QmlProfilerModelManager::Empty &&
d->m_profilerModelManager->state() != QmlProfilerModelManager::ClearingData) d->m_profilerModelManager->state() != QmlProfilerModelManager::ClearingData)
@@ -523,14 +524,14 @@ void QmlProfilerTool::attachToWaitingApplication()
return; return;
Id kitId; Id kitId;
quint16 port; int port;
Kit *kit = 0; Kit *kit = 0;
{ {
QSettings *settings = ICore::settings(); QSettings *settings = ICore::settings();
kitId = Id::fromSetting(settings->value(QLatin1String("AnalyzerQmlAttachDialog/kitId"))); kitId = Id::fromSetting(settings->value(QLatin1String("AnalyzerQmlAttachDialog/kitId")));
port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toUInt(); port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toInt();
QmlProfilerAttachDialog dialog; QmlProfilerAttachDialog dialog;
@@ -542,6 +543,8 @@ void QmlProfilerTool::attachToWaitingApplication()
kit = dialog.kit(); kit = dialog.kit();
port = dialog.port(); port = dialog.port();
QTC_ASSERT(port >= 0, return);
QTC_ASSERT(port <= std::numeric_limits<quint16>::max(), return);
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), kit->id().toSetting()); settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), kit->id().toSetting());
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/port"), port); settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/port"), port);
@@ -771,8 +774,6 @@ void QmlProfilerTool::profilerDataModelStateChanged()
updateTimeDisplay(); updateTimeDisplay();
setButtonsEnabled(true); setButtonsEnabled(true);
createTextMarks(); createTextMarks();
break;
default:
break; break;
} }
} }