aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/qt/color_utils.h6
-rw-r--r--ui/qt/iax2_analysis_dialog.cpp4
-rw-r--r--ui/qt/io_graph_dialog.cpp9
-rw-r--r--ui/qt/io_graph_dialog.h6
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp4
-rw-r--r--ui/qt/rtp_player_dialog.cpp2
6 files changed, 18 insertions, 13 deletions
diff --git a/ui/qt/color_utils.h b/ui/qt/color_utils.h
index 30f8b170fd..8b1051837b 100644
--- a/ui/qt/color_utils.h
+++ b/ui/qt/color_utils.h
@@ -53,11 +53,15 @@ public:
static const QColor expert_color_foreground; /* black */
static const QColor hidden_proto_item; /* gray */
- static const QList<QRgb> graph_colors_;
+ static const QList<QRgb> graphColors() { return graph_colors_; }
+ static QRgb graphColor(int item) { return graph_colors_[item % graph_colors_.size()]; }
+
signals:
public slots:
+private:
+ static const QList<QRgb> graph_colors_;
};
#endif // COLOR_UTILS_H
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp
index a1256903ec..c37b48bee7 100644
--- a/ui/qt/iax2_analysis_dialog.cpp
+++ b/ui/qt/iax2_analysis_dialog.cpp
@@ -260,11 +260,11 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) :
for (int i = 0; i < num_graphs_; i++) {
QCPGraph *graph = ui->streamGraph->addGraph();
- graph->setPen(QPen(ColorUtils::graph_colors_[i]));
+ graph->setPen(QPen(ColorUtils::graphColor(i)));
graph->setName(graph_cbs[i]->text());
graphs_ << graph;
graph_cbs[i]->setChecked(true);
- graph_cbs[i]->setIcon(StockIcon::colorIcon(ColorUtils::graph_colors_[i], QPalette::Text));
+ graph_cbs[i]->setIcon(StockIcon::colorIcon(ColorUtils::graphColor(i), QPalette::Text));
}
ui->streamGraph->xAxis->setLabel("Arrival Time");
ui->streamGraph->yAxis->setLabel("Value (ms)");
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index e4264b774a..acc022a8e9 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -77,10 +77,6 @@ const int yfield_col_ = 5;
const int sma_period_col_ = 6;
const int num_cols_ = 7;
-// Available colors
-// XXX - Add custom
-QList<QRgb> colors_ = ColorUtils::graph_colors_;
-
const qreal graph_line_width_ = 1.0;
// When we drop support for Qt <5 we can initialize these with
@@ -190,7 +186,8 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) :
stat_timer_(NULL),
need_replot_(false),
need_retap_(false),
- auto_axes_(true)
+ auto_axes_(true),
+ colors_(ColorUtils::graphColors())
{
ui->setupUi(this);
setWindowSubtitle(tr("IO Graphs"));
@@ -1718,7 +1715,7 @@ void IOGraph::applyCurrentColor()
if (graph_) {
graph_->setPen(QPen(color_, graph_line_width_));
} else if (bars_) {
- bars_->setPen(QPen(QBrush(colors_[0]), graph_line_width_)); // ...or omit it altogether?
+ bars_->setPen(QPen(QBrush(ColorUtils::graphColor(0)), graph_line_width_)); // ...or omit it altogether?
bars_->setBrush(color_);
}
}
diff --git a/ui/qt/io_graph_dialog.h b/ui/qt/io_graph_dialog.h
index c5d36f3189..55e32f9838 100644
--- a/ui/qt/io_graph_dialog.h
+++ b/ui/qt/io_graph_dialog.h
@@ -85,7 +85,7 @@ public:
double startOffset();
int packetFromTime(double ts);
double getItemValue(int idx, const capture_file *cap_file) const;
- int maxInterval () const { return cur_idx_; };
+ int maxInterval () const { return cur_idx_; }
void clearAllData();
@@ -189,6 +189,10 @@ private:
bool need_recalc_; // Medium weight: recalculate values, then replot
bool need_retap_; // Heavy weight: re-read packet data
bool auto_axes_;
+ // Available colors
+ // XXX - Add custom
+ QList<QRgb> colors_;
+
// void fillGraph();
void zoomAxes(bool in);
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index d4ee753e40..1d112ac029 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -310,11 +310,11 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf, struct _r
for (int i = 0; i < num_graphs_; i++) {
QCPGraph *graph = ui->streamGraph->addGraph();
- graph->setPen(QPen(ColorUtils::graph_colors_[i]));
+ graph->setPen(QPen(ColorUtils::graphColor(i)));
graph->setName(graph_cbs[i]->text());
graphs_ << graph;
graph_cbs[i]->setChecked(true);
- graph_cbs[i]->setIcon(StockIcon::colorIcon(ColorUtils::graph_colors_[i], QPalette::Text));
+ graph_cbs[i]->setIcon(StockIcon::colorIcon(ColorUtils::graphColor(i), QPalette::Text));
}
ui->streamGraph->xAxis->setLabel("Arrival Time");
ui->streamGraph->yAxis->setLabel("Value (ms)");
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp
index 9b26c1fb5a..11ccdb6cbd 100644
--- a/ui/qt/rtp_player_dialog.cpp
+++ b/ui/qt/rtp_player_dialog.cpp
@@ -356,7 +356,7 @@ void RtpPlayerDialog::addRtpStream(struct _rtp_stream_info *rtp_stream)
if (!audio_stream) {
audio_stream = new RtpAudioStream(this, rtp_stream);
- audio_stream->setColor(ColorUtils::graph_colors_[tli_count % ColorUtils::graph_colors_.length()]);
+ audio_stream->setColor(ColorUtils::graphColor(tli_count));
QTreeWidgetItem *ti = new QTreeWidgetItem(ui->streamTreeWidget);
ti->setText(src_addr_col_, address_to_qstring(&rtp_stream->src_addr));