Format all files
This commit is contained in:
@@ -62,16 +62,19 @@
|
||||
#include <qwt_plot_grid.h>
|
||||
#include <qwt_plot_renderer.h>
|
||||
|
||||
TracePlot::TracePlot(QWidget *parent):
|
||||
QwtPlot(parent), isInitialized(false),
|
||||
TracePlot::TracePlot(QWidget* parent) :
|
||||
QwtPlot(parent),
|
||||
isInitialized(false),
|
||||
customLabelScaleDraw(new CustomLabelScaleDraw(drawingProperties.getLabels()))
|
||||
{
|
||||
canvas()->setCursor(Qt::ArrowCursor);
|
||||
setUpActions();
|
||||
}
|
||||
|
||||
void TracePlot::init(TraceNavigator *navigator, QScrollBar *scrollBar, TracePlotLineDataSource *tracePlotLineDataSource,
|
||||
CommentModel *commentModel)
|
||||
void TracePlot::init(TraceNavigator* navigator,
|
||||
QScrollBar* scrollBar,
|
||||
TracePlotLineDataSource* tracePlotLineDataSource,
|
||||
CommentModel* commentModel)
|
||||
{
|
||||
Q_ASSERT(isInitialized == false);
|
||||
isInitialized = true;
|
||||
@@ -87,13 +90,19 @@ void TracePlot::init(TraceNavigator *navigator, QScrollBar *scrollBar, TracePlot
|
||||
|
||||
QObject::connect(commentModel, &CommentModel::rowsRemoved, this, &TracePlot::commentsChanged);
|
||||
|
||||
QObject::connect(commentModel->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
QObject::connect(commentModel->selectionModel(),
|
||||
&QItemSelectionModel::selectionChanged,
|
||||
this,
|
||||
&TracePlot::commentsChanged);
|
||||
|
||||
auto selectedTracePlotLineModel = tracePlotLineDataSource->getSelectedModel();
|
||||
QObject::connect(selectedTracePlotLineModel, &QAbstractItemModel::rowsInserted, this,
|
||||
QObject::connect(selectedTracePlotLineModel,
|
||||
&QAbstractItemModel::rowsInserted,
|
||||
this,
|
||||
&TracePlot::recreateCollapseButtons);
|
||||
QObject::connect(selectedTracePlotLineModel, &QAbstractItemModel::rowsRemoved, this,
|
||||
QObject::connect(selectedTracePlotLineModel,
|
||||
&QAbstractItemModel::rowsRemoved,
|
||||
this,
|
||||
&TracePlot::recreateCollapseButtons);
|
||||
|
||||
connectNavigatorQ_SIGNALS();
|
||||
@@ -103,7 +112,8 @@ void TracePlot::init(TraceNavigator *navigator, QScrollBar *scrollBar, TracePlot
|
||||
setUpTracePlotItem();
|
||||
setUpZoom();
|
||||
setUpQueryEditor();
|
||||
mouseLabel = new TracePlotMouseLabel(this, navigator->GeneralTraceInfo().clkPeriod, this->mouseDownData.zoomSpan);
|
||||
mouseLabel = new TracePlotMouseLabel(
|
||||
this, navigator->GeneralTraceInfo().clkPeriod, this->mouseDownData.zoomSpan);
|
||||
getAndDrawComments();
|
||||
setZoomLevel(1000);
|
||||
|
||||
@@ -116,19 +126,16 @@ void TracePlot::init(TraceNavigator *navigator, QScrollBar *scrollBar, TracePlot
|
||||
void TracePlot::setUpActions()
|
||||
{
|
||||
insertComment = new QAction("Insert comment", this);
|
||||
QObject::connect(insertComment, SIGNAL(triggered()), this,
|
||||
SLOT(on_insertComment()));
|
||||
QObject::connect(insertComment, SIGNAL(triggered()), this, SLOT(on_insertComment()));
|
||||
|
||||
goToTime = new QAction("Go to time", this);
|
||||
QObject::connect(goToTime, SIGNAL(triggered()), this, SLOT(on_goToTime()));
|
||||
|
||||
goToTransaction = new QAction("Go to transaction", this);
|
||||
QObject::connect(goToTransaction, SIGNAL(triggered()), this,
|
||||
SLOT(on_goToTransaction()));
|
||||
QObject::connect(goToTransaction, SIGNAL(triggered()), this, SLOT(on_goToTransaction()));
|
||||
|
||||
deselectAll = new QAction("Deselect all", this);
|
||||
QObject::connect(deselectAll, SIGNAL(triggered()), this,
|
||||
SLOT(on_deselectAll()));
|
||||
QObject::connect(deselectAll, SIGNAL(triggered()), this, SLOT(on_deselectAll()));
|
||||
|
||||
goToPhase = new QAction("Go to phase", this);
|
||||
QObject::connect(goToPhase, SIGNAL(triggered()), this, SLOT(on_goToPhase()));
|
||||
@@ -136,73 +143,74 @@ void TracePlot::setUpActions()
|
||||
showQueryEditor = new QAction("Execute query", this);
|
||||
showQueryEditor->setShortcut(QKeySequence("ctrl+e"));
|
||||
addAction(showQueryEditor);
|
||||
QObject::connect(showQueryEditor, SIGNAL(triggered()), this,
|
||||
SLOT(on_executeQuery()));
|
||||
QObject::connect(showQueryEditor, SIGNAL(triggered()), this, SLOT(on_executeQuery()));
|
||||
|
||||
selectNextRefresh = new QAction("Select next refresh", this);
|
||||
addAction(selectNextRefresh);
|
||||
QObject::connect(selectNextRefresh, SIGNAL(triggered()), this,
|
||||
SLOT(on_selectNextRefresh()));
|
||||
QObject::connect(selectNextRefresh, SIGNAL(triggered()), this, SLOT(on_selectNextRefresh()));
|
||||
|
||||
selectNextActivate = new QAction("Select next activate", this);
|
||||
addAction(selectNextActivate);
|
||||
QObject::connect(selectNextActivate, SIGNAL(triggered()), this,
|
||||
SLOT(on_selectNextActivate()));
|
||||
QObject::connect(selectNextActivate, SIGNAL(triggered()), this, SLOT(on_selectNextActivate()));
|
||||
|
||||
selectNextPrecharge = new QAction("Select next precharge", this);
|
||||
addAction(selectNextPrecharge);
|
||||
QObject::connect(selectNextPrecharge, SIGNAL(triggered()), this,
|
||||
SLOT(on_selectNextPrecharge()));
|
||||
QObject::connect(
|
||||
selectNextPrecharge, SIGNAL(triggered()), this, SLOT(on_selectNextPrecharge()));
|
||||
|
||||
selectNextCommand = new QAction("Select next command", this);
|
||||
addAction(selectNextCommand);
|
||||
QObject::connect(selectNextCommand, SIGNAL(triggered()), this,
|
||||
SLOT(on_selectNextCommand()));
|
||||
QObject::connect(selectNextCommand, SIGNAL(triggered()), this, SLOT(on_selectNextCommand()));
|
||||
|
||||
// selectNextActb = new QAction("Select next atcb", this);
|
||||
// selectNextActb->setShortcut(QKeySequence("alt+b"));
|
||||
// addAction(selectNextActb);
|
||||
// QObject::connect(selectNextActb, SIGNAL(triggered()), this,
|
||||
// SLOT(on_selectNextActb()));
|
||||
//
|
||||
// selectNextPreb = new QAction("Select next preb", this);
|
||||
// selectNextPreb->setShortcut(QKeySequence("alt+q"));
|
||||
// addAction(selectNextPreb);
|
||||
// QObject::connect(selectNextPreb, SIGNAL(triggered()), this,
|
||||
// SLOT(on_selectNextPreb()));
|
||||
//
|
||||
// selectNextRefb = new QAction("Select next refb", this);
|
||||
// selectNextRefb->setShortcut(QKeySequence("alt+s"));
|
||||
// addAction(selectNextRefb);
|
||||
// QObject::connect(selectNextRefb, SIGNAL(triggered()), this,
|
||||
// SLOT(on_selectNextRefb()));
|
||||
// selectNextActb = new QAction("Select next atcb", this);
|
||||
// selectNextActb->setShortcut(QKeySequence("alt+b"));
|
||||
// addAction(selectNextActb);
|
||||
// QObject::connect(selectNextActb, SIGNAL(triggered()), this,
|
||||
// SLOT(on_selectNextActb()));
|
||||
//
|
||||
// selectNextPreb = new QAction("Select next preb", this);
|
||||
// selectNextPreb->setShortcut(QKeySequence("alt+q"));
|
||||
// addAction(selectNextPreb);
|
||||
// QObject::connect(selectNextPreb, SIGNAL(triggered()), this,
|
||||
// SLOT(on_selectNextPreb()));
|
||||
//
|
||||
// selectNextRefb = new QAction("Select next refb", this);
|
||||
// selectNextRefb->setShortcut(QKeySequence("alt+s"));
|
||||
// addAction(selectNextRefb);
|
||||
// QObject::connect(selectNextRefb, SIGNAL(triggered()), this,
|
||||
// SLOT(on_selectNextRefb()));
|
||||
|
||||
setColorGroupingPhase = new QAction("Group by Phase", this);
|
||||
setColorGroupingPhase->setCheckable(true);
|
||||
setColorGroupingPhase->setChecked(true);
|
||||
addAction(setColorGroupingPhase);
|
||||
QObject::connect(setColorGroupingPhase, SIGNAL(triggered()), this,
|
||||
SLOT(on_colorGroupingPhase()));
|
||||
QObject::connect(
|
||||
setColorGroupingPhase, SIGNAL(triggered()), this, SLOT(on_colorGroupingPhase()));
|
||||
|
||||
setColorGroupingTransaction = new QAction("Group by Transaction", this);
|
||||
setColorGroupingTransaction->setCheckable(true);
|
||||
addAction(setColorGroupingTransaction);
|
||||
QObject::connect(setColorGroupingTransaction, SIGNAL(triggered()), this,
|
||||
QObject::connect(setColorGroupingTransaction,
|
||||
SIGNAL(triggered()),
|
||||
this,
|
||||
SLOT(on_colorGroupingTransaction()));
|
||||
|
||||
setColorGroupingRainbowTransaction = new QAction("Group by Transaction - Rainbow Colored", this);
|
||||
setColorGroupingRainbowTransaction =
|
||||
new QAction("Group by Transaction - Rainbow Colored", this);
|
||||
setColorGroupingRainbowTransaction->setCheckable(true);
|
||||
addAction(setColorGroupingRainbowTransaction);
|
||||
QObject::connect(setColorGroupingRainbowTransaction, SIGNAL(triggered()), this,
|
||||
QObject::connect(setColorGroupingRainbowTransaction,
|
||||
SIGNAL(triggered()),
|
||||
this,
|
||||
SLOT(on_colorGroupingRainbowTransaction()));
|
||||
|
||||
setColorGroupingThread = new QAction("Group by Thread", this);
|
||||
setColorGroupingThread->setCheckable(true);
|
||||
addAction(setColorGroupingThread);
|
||||
QObject::connect(setColorGroupingThread, SIGNAL(triggered()), this,
|
||||
SLOT(on_colorGroupingThread()));
|
||||
QObject::connect(
|
||||
setColorGroupingThread, SIGNAL(triggered()), this, SLOT(on_colorGroupingThread()));
|
||||
|
||||
QActionGroup *colorGroupingGroup = new QActionGroup(this);
|
||||
QActionGroup* colorGroupingGroup = new QActionGroup(this);
|
||||
colorGroupingGroup->addAction(setColorGroupingPhase);
|
||||
colorGroupingGroup->addAction(setColorGroupingTransaction);
|
||||
colorGroupingGroup->addAction(setColorGroupingRainbowTransaction);
|
||||
@@ -210,13 +218,12 @@ void TracePlot::setUpActions()
|
||||
|
||||
exportToPdf = new QAction("Export to SVG", this);
|
||||
addAction(exportToPdf);
|
||||
QObject::connect(exportToPdf, SIGNAL(triggered()), this,
|
||||
SLOT(on_exportToPDF()));
|
||||
QObject::connect(exportToPdf, SIGNAL(triggered()), this, SLOT(on_exportToPDF()));
|
||||
|
||||
toggleCollapsedState = new ToggleCollapsedAction(this);
|
||||
addAction(toggleCollapsedState);
|
||||
QObject::connect(toggleCollapsedState, SIGNAL(triggered()), this,
|
||||
SLOT(on_toggleCollapsedState()));
|
||||
QObject::connect(
|
||||
toggleCollapsedState, SIGNAL(triggered()), this, SLOT(on_toggleCollapsedState()));
|
||||
toggleCollapsedState->setShortcut(Qt::CTRL + Qt::Key_X);
|
||||
|
||||
disabledDependencies = new QAction("Disabled", this);
|
||||
@@ -232,33 +239,50 @@ void TracePlot::setUpActions()
|
||||
switchDrawDependencyTextsOption->setChecked(true);
|
||||
disabledDependencies->setChecked(true);
|
||||
|
||||
QObject::connect(disabledDependencies, &QAction::triggered, this, [&]() {
|
||||
drawingProperties.drawDependenciesOption.draw = DependencyOption::Disabled;
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
QObject::connect(selectedDependencies, &QAction::triggered, this, [&]() {
|
||||
drawingProperties.drawDependenciesOption.draw = DependencyOption::Selected;
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
QObject::connect(allDependencies, &QAction::triggered, this, [&]() {
|
||||
drawingProperties.drawDependenciesOption.draw = DependencyOption::All;
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
QObject::connect(switchDrawDependencyTextsOption, &QAction::triggered, this, [&]() {
|
||||
if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Disabled)
|
||||
QObject::connect(disabledDependencies,
|
||||
&QAction::triggered,
|
||||
this,
|
||||
[&]()
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.draw = DependencyOption::Disabled;
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
QObject::connect(selectedDependencies,
|
||||
&QAction::triggered,
|
||||
this,
|
||||
[&]()
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.draw = DependencyOption::Selected;
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
QObject::connect(allDependencies,
|
||||
&QAction::triggered,
|
||||
this,
|
||||
[&]()
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.draw = DependencyOption::All;
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
QObject::connect(
|
||||
switchDrawDependencyTextsOption,
|
||||
&QAction::triggered,
|
||||
this,
|
||||
[&]()
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled;
|
||||
switchDrawDependencyTextsOption->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled;
|
||||
switchDrawDependencyTextsOption->setChecked(false);
|
||||
}
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
if (drawingProperties.drawDependenciesOption.text == DependencyTextOption::Disabled)
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.text = DependencyTextOption::Enabled;
|
||||
switchDrawDependencyTextsOption->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingProperties.drawDependenciesOption.text = DependencyTextOption::Disabled;
|
||||
switchDrawDependencyTextsOption->setChecked(false);
|
||||
}
|
||||
currentTraceTimeChanged();
|
||||
});
|
||||
|
||||
QActionGroup *dependenciesGroup = new QActionGroup(this);
|
||||
QActionGroup* dependenciesGroup = new QActionGroup(this);
|
||||
dependenciesGroup->addAction(disabledDependencies);
|
||||
dependenciesGroup->addAction(selectedDependencies);
|
||||
dependenciesGroup->addAction(allDependencies);
|
||||
@@ -271,22 +295,30 @@ void TracePlot::setUpContextMenu()
|
||||
contextMenu = new QMenu(this);
|
||||
contextMenu->addActions({deselectAll});
|
||||
|
||||
QMenu *colorGroupingSubMenu = new QMenu("Group by", contextMenu);
|
||||
colorGroupingSubMenu->addActions(
|
||||
{setColorGroupingPhase, setColorGroupingTransaction, setColorGroupingRainbowTransaction, setColorGroupingThread});
|
||||
QMenu* colorGroupingSubMenu = new QMenu("Group by", contextMenu);
|
||||
colorGroupingSubMenu->addActions({setColorGroupingPhase,
|
||||
setColorGroupingTransaction,
|
||||
setColorGroupingRainbowTransaction,
|
||||
setColorGroupingThread});
|
||||
contextMenu->addMenu(colorGroupingSubMenu);
|
||||
|
||||
dependenciesSubMenu = new QMenu("Show dependencies", contextMenu);
|
||||
dependenciesSubMenu->addActions(
|
||||
{disabledDependencies, selectedDependencies, allDependencies, switchDrawDependencyTextsOption});
|
||||
dependenciesSubMenu->addActions({disabledDependencies,
|
||||
selectedDependencies,
|
||||
allDependencies,
|
||||
switchDrawDependencyTextsOption});
|
||||
contextMenu->addMenu(dependenciesSubMenu);
|
||||
|
||||
QMenu *goToSubMenu = new QMenu("Go to", contextMenu);
|
||||
QMenu* goToSubMenu = new QMenu("Go to", contextMenu);
|
||||
goToSubMenu->addActions({goToPhase, goToTransaction, goToTime});
|
||||
contextMenu->addMenu(goToSubMenu);
|
||||
|
||||
QMenu *selectSubMenu = new QMenu("Select", contextMenu);
|
||||
selectSubMenu->addActions({selectNextRefresh, selectNextActivate, selectNextPrecharge, selectNextCommand /*, selectNextActb, selectNextPreb, selectNextRefb */});
|
||||
QMenu* selectSubMenu = new QMenu("Select", contextMenu);
|
||||
selectSubMenu->addActions(
|
||||
{selectNextRefresh,
|
||||
selectNextActivate,
|
||||
selectNextPrecharge,
|
||||
selectNextCommand /*, selectNextActb, selectNextPreb, selectNextRefb */});
|
||||
contextMenu->addMenu(selectSubMenu);
|
||||
|
||||
contextMenu->addActions({showQueryEditor, insertComment, exportToPdf, toggleCollapsedState});
|
||||
@@ -294,23 +326,31 @@ void TracePlot::setUpContextMenu()
|
||||
|
||||
void TracePlot::connectNavigatorQ_SIGNALS()
|
||||
{
|
||||
QObject::connect(navigator, SIGNAL(currentTraceTimeChanged()), this,
|
||||
SLOT(currentTraceTimeChanged()));
|
||||
QObject::connect(navigator, SIGNAL(selectedTransactionsChanged()), this,
|
||||
QObject::connect(
|
||||
navigator, SIGNAL(currentTraceTimeChanged()), this, SLOT(currentTraceTimeChanged()));
|
||||
QObject::connect(navigator,
|
||||
SIGNAL(selectedTransactionsChanged()),
|
||||
this,
|
||||
SLOT(selectedTransactionsChanged()));
|
||||
}
|
||||
|
||||
void TracePlot::setUpDrawingProperties()
|
||||
{
|
||||
connect(this, &TracePlot::tracePlotLinesChanged, &drawingProperties, &TraceDrawingProperties::updateLabels);
|
||||
connect(&drawingProperties, &TraceDrawingProperties::labelsUpdated, this, &TracePlot::updateScrollbar);
|
||||
connect(this,
|
||||
&TracePlot::tracePlotLinesChanged,
|
||||
&drawingProperties,
|
||||
&TraceDrawingProperties::updateLabels);
|
||||
connect(&drawingProperties,
|
||||
&TraceDrawingProperties::labelsUpdated,
|
||||
this,
|
||||
&TracePlot::updateScrollbar);
|
||||
|
||||
drawingProperties.init(tracePlotLineDataSource);
|
||||
|
||||
drawingProperties.textColor = palette().text().color();
|
||||
drawingProperties.numberOfRanks = navigator->GeneralTraceInfo().numberOfRanks;
|
||||
drawingProperties.numberOfBankGroups = navigator->GeneralTraceInfo().numberOfBankGroups;
|
||||
drawingProperties.numberOfBanks = navigator->GeneralTraceInfo().numberOfBanks;
|
||||
drawingProperties.numberOfBanks = navigator->GeneralTraceInfo().numberOfBanks;
|
||||
drawingProperties.banksPerRank = navigator->GeneralTraceInfo().banksPerRank;
|
||||
drawingProperties.groupsPerRank = navigator->GeneralTraceInfo().groupsPerRank;
|
||||
drawingProperties.banksPerGroup = navigator->GeneralTraceInfo().banksPerGroup;
|
||||
@@ -321,8 +361,8 @@ void TracePlot::setUpQueryEditor()
|
||||
{
|
||||
queryEditor = new QueryEditor(this);
|
||||
queryEditor->setWindowFlags(Qt::Window);
|
||||
queryEditor->setWindowTitle("Query " + QFileInfo(
|
||||
navigator->TraceFile().getPathToDB()).baseName());
|
||||
queryEditor->setWindowTitle("Query " +
|
||||
QFileInfo(navigator->TraceFile().getPathToDB()).baseName());
|
||||
queryEditor->init(navigator);
|
||||
}
|
||||
|
||||
@@ -336,7 +376,7 @@ void TracePlot::setUpTracePlotItem()
|
||||
void TracePlot::setUpGrid()
|
||||
{
|
||||
unsigned int clk = navigator->GeneralTraceInfo().clkPeriod;
|
||||
QwtPlotGrid *grid = new ClkGrid(clk, GridVisiblityClks * clk);
|
||||
QwtPlotGrid* grid = new ClkGrid(clk, GridVisiblityClks * clk);
|
||||
grid->setZ(0);
|
||||
grid->attach(this);
|
||||
}
|
||||
@@ -345,8 +385,7 @@ void TracePlot::setUpZoom()
|
||||
{
|
||||
minZoomLevel = minZoomClks * navigator->GeneralTraceInfo().clkPeriod;
|
||||
maxZoomLevel = maxZoomClks * navigator->GeneralTraceInfo().clkPeriod;
|
||||
textVisibilityZoomLevel = textVisibilityClks *
|
||||
navigator->GeneralTraceInfo().clkPeriod;
|
||||
textVisibilityZoomLevel = textVisibilityClks * navigator->GeneralTraceInfo().clkPeriod;
|
||||
zoomZone = new QwtPlotZoneItem();
|
||||
zoomZone->setZ(2);
|
||||
zoomZone->attach(this);
|
||||
@@ -435,7 +474,8 @@ ToggleCollapsedAction::CollapsedState TracePlot::getCollapsedState() const
|
||||
if (type != AbstractTracePlotLineModel::RankGroup)
|
||||
continue;
|
||||
|
||||
bool isCollapsed = selectedModel->data(index, AbstractTracePlotLineModel::CollapsedRole).toBool();
|
||||
bool isCollapsed =
|
||||
selectedModel->data(index, AbstractTracePlotLineModel::CollapsedRole).toBool();
|
||||
if (!isCollapsed)
|
||||
{
|
||||
notCollapsedCount++;
|
||||
@@ -486,12 +526,16 @@ void TracePlot::getAndDrawComments()
|
||||
|
||||
for (int row = 0; row < commentModel->rowCount(); row++)
|
||||
{
|
||||
QModelIndex timeIndex = commentModel->index(row, static_cast<int>(CommentModel::Column::Time));
|
||||
QModelIndex textIndex = commentModel->index(row, static_cast<int>(CommentModel::Column::Comment));
|
||||
QModelIndex timeIndex =
|
||||
commentModel->index(row, static_cast<int>(CommentModel::Column::Time));
|
||||
QModelIndex textIndex =
|
||||
commentModel->index(row, static_cast<int>(CommentModel::Column::Comment));
|
||||
|
||||
bool selected = std::find(selectedRows.begin(), selectedRows.end(), commentModel->index(row, 0)) != selectedRows.end();
|
||||
bool selected =
|
||||
std::find(selectedRows.begin(), selectedRows.end(), commentModel->index(row, 0)) !=
|
||||
selectedRows.end();
|
||||
|
||||
QwtPlotMarker *marker = new QwtPlotMarker();
|
||||
QwtPlotMarker* marker = new QwtPlotMarker();
|
||||
marker->setLabel(textIndex.data().toString());
|
||||
marker->setLabelOrientation(Qt::Vertical);
|
||||
marker->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
|
||||
@@ -502,12 +546,12 @@ void TracePlot::getAndDrawComments()
|
||||
}
|
||||
}
|
||||
|
||||
CustomLabelScaleDraw *TracePlot::getCustomLabelScaleDraw() const
|
||||
CustomLabelScaleDraw* TracePlot::getCustomLabelScaleDraw() const
|
||||
{
|
||||
return customLabelScaleDraw;
|
||||
}
|
||||
|
||||
const TraceDrawingProperties &TracePlot::getDrawingProperties() const
|
||||
const TraceDrawingProperties& TracePlot::getDrawingProperties() const
|
||||
{
|
||||
return drawingProperties;
|
||||
}
|
||||
@@ -517,8 +561,7 @@ void TracePlot::enterZoomMode()
|
||||
mouseDownData.mouseIsDownForZooming = true;
|
||||
mouseLabel->setMode(MouseLabelMode::Timedifference);
|
||||
zoomZone->setVisible(true);
|
||||
zoomZone->setInterval(mouseDownData.zoomSpan.Begin(),
|
||||
mouseDownData.zoomSpan.End());
|
||||
zoomZone->setInterval(mouseDownData.zoomSpan.Begin(), mouseDownData.zoomSpan.End());
|
||||
}
|
||||
|
||||
void TracePlot::exitZoomMode()
|
||||
@@ -530,8 +573,7 @@ void TracePlot::exitZoomMode()
|
||||
void TracePlot::zoomIn(traceTime zoomCenter)
|
||||
{
|
||||
setZoomLevel(zoomLevel * zoomFactor);
|
||||
traceTime time = zoomCenter + (GetCurrentTimespan().Middle() - zoomCenter) *
|
||||
zoomFactor;
|
||||
traceTime time = zoomCenter + (GetCurrentTimespan().Middle() - zoomCenter) * zoomFactor;
|
||||
Q_EMIT tracePlotZoomChanged();
|
||||
navigator->navigateToTime(time);
|
||||
}
|
||||
@@ -540,8 +582,8 @@ void TracePlot::zoomOut(traceTime zoomCenter)
|
||||
{
|
||||
setZoomLevel(zoomLevel / zoomFactor);
|
||||
Q_EMIT tracePlotZoomChanged();
|
||||
navigator->navigateToTime(static_cast<traceTime>(zoomCenter +
|
||||
(GetCurrentTimespan().Middle() - zoomCenter) / zoomFactor));
|
||||
navigator->navigateToTime(static_cast<traceTime>(
|
||||
zoomCenter + (GetCurrentTimespan().Middle() - zoomCenter) / zoomFactor));
|
||||
}
|
||||
|
||||
traceTime TracePlot::ZoomLevel() const
|
||||
@@ -581,16 +623,18 @@ void TracePlot::recreateCollapseButtons()
|
||||
|
||||
void TracePlot::currentTraceTimeChanged()
|
||||
{
|
||||
bool drawDependencies = getDrawingProperties().drawDependenciesOption.draw != DependencyOption::Disabled;
|
||||
bool drawDependencies =
|
||||
getDrawingProperties().drawDependenciesOption.draw != DependencyOption::Disabled;
|
||||
|
||||
transactions = navigator->TraceFile().getTransactionsInTimespan(GetCurrentTimespan(), drawDependencies);
|
||||
transactions =
|
||||
navigator->TraceFile().getTransactionsInTimespan(GetCurrentTimespan(), drawDependencies);
|
||||
if (drawDependencies)
|
||||
{
|
||||
navigator->TraceFile().updateDependenciesInTimespan(GetCurrentTimespan());
|
||||
}
|
||||
|
||||
setAxisScale(xBottom, GetCurrentTimespan().Begin(), GetCurrentTimespan().End());
|
||||
|
||||
|
||||
dependenciesSubMenu->setEnabled(navigator->TraceFile().checkDependencyTableExists());
|
||||
|
||||
replot();
|
||||
@@ -684,10 +728,17 @@ void TracePlot::on_goToTransaction()
|
||||
{
|
||||
bool ok;
|
||||
int maxID = navigator->GeneralTraceInfo().numberOfTransactions;
|
||||
int transactionID = QInputDialog::getInt(this, "Go to transaction",
|
||||
"Enter transaction ID (1 - " + QString::number(maxID) + ")", 0, 1, maxID, 1,
|
||||
&ok);
|
||||
if (ok) {
|
||||
int transactionID =
|
||||
QInputDialog::getInt(this,
|
||||
"Go to transaction",
|
||||
"Enter transaction ID (1 - " + QString::number(maxID) + ")",
|
||||
0,
|
||||
1,
|
||||
maxID,
|
||||
1,
|
||||
&ok);
|
||||
if (ok)
|
||||
{
|
||||
navigator->clearSelectedTransactions();
|
||||
navigator->selectTransaction(transactionID);
|
||||
}
|
||||
@@ -697,13 +748,19 @@ void TracePlot::on_goToPhase()
|
||||
{
|
||||
bool ok;
|
||||
int maxID = navigator->GeneralTraceInfo().numberOfPhases;
|
||||
int phaseID = QInputDialog::getInt(this, "Go to phase",
|
||||
"Enter phase ID (1 - " + QString::number(maxID) + ")", 0, 1, maxID, 1, &ok);
|
||||
int phaseID = QInputDialog::getInt(this,
|
||||
"Go to phase",
|
||||
"Enter phase ID (1 - " + QString::number(maxID) + ")",
|
||||
0,
|
||||
1,
|
||||
maxID,
|
||||
1,
|
||||
&ok);
|
||||
|
||||
if (ok) {
|
||||
if (ok)
|
||||
{
|
||||
navigator->clearSelectedTransactions();
|
||||
navigator->selectTransaction(navigator->TraceFile().getTransactionIDFromPhaseID(
|
||||
phaseID));
|
||||
navigator->selectTransaction(navigator->TraceFile().getTransactionIDFromPhaseID(phaseID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +780,8 @@ void TracePlot::on_goToTime()
|
||||
double goToTime;
|
||||
GoToTimeDialog dialog(&goToTime, this);
|
||||
int dialogCode = dialog.exec();
|
||||
if (dialogCode == QDialog::Accepted) {
|
||||
if (dialogCode == QDialog::Accepted)
|
||||
{
|
||||
traceTime time = static_cast<traceTime>(goToTime) * 1000;
|
||||
navigator->navigateToTime(time);
|
||||
}
|
||||
@@ -732,13 +790,13 @@ void TracePlot::on_goToTime()
|
||||
void TracePlot::on_exportToPDF()
|
||||
{
|
||||
QwtPlotRenderer renderer;
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Export to SVG", "",
|
||||
"Portable Document Format(*.svg)");
|
||||
if (filename != "") {
|
||||
QString filename =
|
||||
QFileDialog::getSaveFileName(this, "Export to SVG", "", "Portable Document Format(*.svg)");
|
||||
if (filename != "")
|
||||
{
|
||||
QBrush saved = this->canvasBackground();
|
||||
this->setCanvasBackground(QBrush(Qt::white));
|
||||
renderer.renderDocument(this, filename, "svg", QSizeF(this->widthMM(),
|
||||
this->heightMM()));
|
||||
renderer.renderDocument(this, filename, "svg", QSizeF(this->widthMM(), this->heightMM()));
|
||||
this->setCanvasBackground(QBrush(saved));
|
||||
}
|
||||
}
|
||||
@@ -754,7 +812,7 @@ void TracePlot::on_toggleCollapsedState()
|
||||
*
|
||||
*/
|
||||
|
||||
void TracePlot::keyPressEvent(QKeyEvent *keyPressedEvent)
|
||||
void TracePlot::keyPressEvent(QKeyEvent* keyPressedEvent)
|
||||
{
|
||||
int key = keyPressedEvent->key();
|
||||
if (Qt::Key_Control == key)
|
||||
@@ -765,51 +823,64 @@ void TracePlot::keyPressEvent(QKeyEvent *keyPressedEvent)
|
||||
navigator->selectNextTransaction();
|
||||
else if (Qt::Key_Left == key)
|
||||
navigator->selectPreviousTransaction();
|
||||
else if (Qt::Key_Minus == key) {
|
||||
else if (Qt::Key_Minus == key)
|
||||
{
|
||||
zoomOut(GetCurrentTimespan().Middle());
|
||||
} else if (Qt::Key_Plus == key) {
|
||||
}
|
||||
else if (Qt::Key_Plus == key)
|
||||
{
|
||||
zoomIn(GetCurrentTimespan().Middle());
|
||||
}
|
||||
}
|
||||
|
||||
void TracePlot::keyReleaseEvent(QKeyEvent *keyReleasedEvent)
|
||||
void TracePlot::keyReleaseEvent(QKeyEvent* keyReleasedEvent)
|
||||
{
|
||||
int key = keyReleasedEvent->key();
|
||||
|
||||
if (Qt::Key_Control == key)
|
||||
keyPressData.ctrlPressed = false;
|
||||
else if (Qt::Key_Shift == key) {
|
||||
else if (Qt::Key_Shift == key)
|
||||
{
|
||||
keyPressData.shiftPressed = false;
|
||||
exitZoomMode();
|
||||
replot();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TracePlot::eventFilter(QObject *object, QEvent *event)
|
||||
bool TracePlot::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
if (object == canvas()) {
|
||||
switch (event->type()) {
|
||||
case QEvent::Wheel : {
|
||||
QWheelEvent *wheelEvent = static_cast<QWheelEvent *>(event);
|
||||
traceTime zoomCenter = static_cast<traceTime>(this->invTransform(xBottom,
|
||||
wheelEvent->position().x()));
|
||||
if (object == canvas())
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Wheel:
|
||||
{
|
||||
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
|
||||
traceTime zoomCenter =
|
||||
static_cast<traceTime>(this->invTransform(xBottom, wheelEvent->position().x()));
|
||||
|
||||
(wheelEvent->angleDelta().y() > 0) ? zoomIn(zoomCenter) : zoomOut(zoomCenter);
|
||||
|
||||
return true;
|
||||
}
|
||||
case QEvent::MouseButtonPress: {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
case QEvent::MouseButtonPress:
|
||||
{
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
if (keyPressData.shiftPressed) {
|
||||
mouseDownData.zoomSpan.setBegin(alignToClk(invTransform(xBottom,
|
||||
mouseEvent->x()), navigator->GeneralTraceInfo().clkPeriod));
|
||||
mouseDownData.zoomSpan.setEnd(alignToClk(invTransform(xBottom, mouseEvent->x()),
|
||||
navigator->GeneralTraceInfo().clkPeriod));
|
||||
if (mouseEvent->button() == Qt::LeftButton)
|
||||
{
|
||||
if (keyPressData.shiftPressed)
|
||||
{
|
||||
mouseDownData.zoomSpan.setBegin(
|
||||
alignToClk(invTransform(xBottom, mouseEvent->x()),
|
||||
navigator->GeneralTraceInfo().clkPeriod));
|
||||
mouseDownData.zoomSpan.setEnd(
|
||||
alignToClk(invTransform(xBottom, mouseEvent->x()),
|
||||
navigator->GeneralTraceInfo().clkPeriod));
|
||||
enterZoomMode();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseDownData.mouseDownX = mouseEvent->x();
|
||||
mouseDownData.mouseDownTime = GetCurrentTimespan().Middle();
|
||||
mouseDownData.mouseIsDownForDragging = true;
|
||||
@@ -818,25 +889,31 @@ bool TracePlot::eventFilter(QObject *object, QEvent *event)
|
||||
SelectComment(mouseEvent->x());
|
||||
}
|
||||
return true;
|
||||
} else if (mouseEvent->button() == Qt::RightButton) {
|
||||
}
|
||||
else if (mouseEvent->button() == Qt::RightButton)
|
||||
{
|
||||
// Also select comments to make it more obvious.
|
||||
SelectComment(mouseEvent->x());
|
||||
|
||||
openContextMenu(this->canvas()->mapToGlobal(mouseEvent->pos()),
|
||||
mouseEvent->pos());
|
||||
openContextMenu(this->canvas()->mapToGlobal(mouseEvent->pos()), mouseEvent->pos());
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QEvent::MouseButtonRelease: {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
case QEvent::MouseButtonRelease:
|
||||
{
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
if (mouseDownData.mouseIsDownForDragging) {
|
||||
if (mouseEvent->button() == Qt::LeftButton)
|
||||
{
|
||||
if (mouseDownData.mouseIsDownForDragging)
|
||||
{
|
||||
mouseDownData.mouseIsDownForDragging = false;
|
||||
canvas()->setCursor(Qt::ArrowCursor);
|
||||
return true;
|
||||
} else if (mouseDownData.mouseIsDownForZooming) {
|
||||
}
|
||||
else if (mouseDownData.mouseIsDownForZooming)
|
||||
{
|
||||
exitZoomMode();
|
||||
traceTime newCenter = mouseDownData.zoomSpan.Middle();
|
||||
setZoomLevel(mouseDownData.zoomSpan.timeCovered());
|
||||
@@ -847,15 +924,19 @@ bool TracePlot::eventFilter(QObject *object, QEvent *event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QEvent::MouseMove: {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
case QEvent::MouseMove:
|
||||
{
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
|
||||
if (mouseDownData.mouseIsDownForDragging) {
|
||||
traceTime deltaTime = invTransform(xBottom,
|
||||
mouseDownData.mouseDownX) - invTransform(xBottom, mouseEvent->x());
|
||||
if (mouseDownData.mouseIsDownForDragging)
|
||||
{
|
||||
traceTime deltaTime = invTransform(xBottom, mouseDownData.mouseDownX) -
|
||||
invTransform(xBottom, mouseEvent->x());
|
||||
navigator->navigateToTime(mouseDownData.mouseDownTime + deltaTime);
|
||||
return true;
|
||||
} else if (mouseDownData.mouseIsDownForZooming) {
|
||||
}
|
||||
else if (mouseDownData.mouseIsDownForZooming)
|
||||
{
|
||||
mouseDownData.zoomSpan.setEnd(alignToClk(invTransform(xBottom, mouseEvent->x()),
|
||||
navigator->GeneralTraceInfo().clkPeriod));
|
||||
if (mouseDownData.zoomSpan.Begin() < mouseDownData.zoomSpan.End())
|
||||
@@ -868,7 +949,6 @@ bool TracePlot::eventFilter(QObject *object, QEvent *event)
|
||||
replot();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@@ -902,9 +982,11 @@ void TracePlot::SelectComment(int x) const
|
||||
return;
|
||||
|
||||
if (keyPressData.ctrlPressed)
|
||||
commentModel->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
|
||||
commentModel->selectionModel()->setCurrentIndex(
|
||||
index, QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
|
||||
else
|
||||
commentModel->selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
commentModel->selectionModel()->setCurrentIndex(
|
||||
index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
Timespan TracePlot::hoveredTimespan(int x) const
|
||||
@@ -915,7 +997,7 @@ Timespan TracePlot::hoveredTimespan(int x) const
|
||||
return Timespan(time - offset, time + offset);
|
||||
}
|
||||
|
||||
void TracePlot::openContextMenu(const QPoint &pos, const QPoint &mouseDown)
|
||||
void TracePlot::openContextMenu(const QPoint& pos, const QPoint& mouseDown)
|
||||
{
|
||||
contextMenuMouseDown = mouseDown;
|
||||
Timespan timespan = hoveredTimespan(mouseDown.x());
|
||||
|
||||
Reference in New Issue
Block a user