diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-10-15 15:22:03 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-10-15 15:22:03 +0000 |
commit | 720de303c74bae305cd980cf475b15b86a9c57c6 (patch) | |
tree | 1ab38f2ed9cccef667943053cf5f0af2e9b761a6 /ui | |
parent | 156659e308cd83aa0e13ed73650eb9d155d7506a (diff) |
Add some missing parenthesis. Make sure we set our font in the right place.
Make the ColorUtils::fromColorT() convenience function a little more
convenient. Use it.
svn path=/trunk/; revision=52620
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/color_utils.cpp | 5 | ||||
-rw-r--r-- | ui/qt/color_utils.h | 1 | ||||
-rw-r--r-- | ui/qt/follow_stream_dialog.cpp | 26 |
3 files changed, 14 insertions, 18 deletions
diff --git a/ui/qt/color_utils.cpp b/ui/qt/color_utils.cpp index 02f9c56f4b..298c34e1b6 100644 --- a/ui/qt/color_utils.cpp +++ b/ui/qt/color_utils.cpp @@ -57,6 +57,11 @@ QColor ColorUtils::fromColorT (color_t *color) { return QColor(color->red >> 8, color->green >> 8, color->blue >> 8); } +QColor ColorUtils::fromColorT(color_t color) +{ + return fromColorT(&color); +} + /* * Editor modelines * diff --git a/ui/qt/color_utils.h b/ui/qt/color_utils.h index d1d7b09cb4..8342caa9ab 100644 --- a/ui/qt/color_utils.h +++ b/ui/qt/color_utils.h @@ -40,6 +40,7 @@ public: explicit ColorUtils(QObject *parent = 0); static QColor fromColorT(color_t *color); + static QColor fromColorT(color_t color); signals: diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index 34141886a9..0992e220e0 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -43,6 +43,7 @@ #include "wsutil/file_util.h" #include "ws_symbol_export.h" +#include "color_utils.h" #include "qt_ui_utils.h" #include "wireshark_application.h" @@ -71,7 +72,6 @@ FollowStreamDialog::FollowStreamDialog(QWidget *parent) : follow_info = NULL; ui->setupUi(this); - ui->teStreamContent->setFont(wsApp->monospaceFont()); ui->teStreamContent->installEventFilter(this); connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(HelpButton())); @@ -432,19 +432,11 @@ void FollowStreamDialog::add_text(char *buffer, size_t nchars, gboolean is_from_ return; } - QColor tagserver_fg = QColor(prefs.st_server_fg.red>>8, - prefs.st_server_fg.green>>8, - prefs.st_server_fg.blue>>8); - QColor tagserver_bg = QColor(prefs.st_server_bg.red>>8, - prefs.st_server_bg.green>>8, - prefs.st_server_bg.blue>>8); + QColor tagserver_fg = ColorUtils::fromColorT(prefs.st_server_fg); + QColor tagserver_bg = ColorUtils::fromColorT(prefs.st_server_bg); - QColor tagclient_fg = QColor(prefs.st_client_fg.red>>8, - prefs.st_client_fg.green>>8, - prefs.st_client_fg.blue>>8); - QColor tagclient_bg = QColor(prefs.st_client_bg.red>>8, - prefs.st_client_bg.green>>8, - prefs.st_client_bg.blue>>8); + QColor tagclient_fg = ColorUtils::fromColorT(prefs.st_client_fg); + QColor tagclient_bg = ColorUtils::fromColorT(prefs.st_client_bg); for (i = 0; i < nchars; i++) { if (buffer[i] == '\n' || buffer[i] == '\r') @@ -454,8 +446,6 @@ void FollowStreamDialog::add_text(char *buffer, size_t nchars, gboolean is_from_ } } - - /* convert unterminated char array to a zero terminated string */ str = (char *)g_malloc(nchars + 1); memcpy(str, buffer, nchars); @@ -463,8 +453,8 @@ void FollowStreamDialog::add_text(char *buffer, size_t nchars, gboolean is_from_ buf = QString(str); g_free(str); - - + ui->teStreamContent->moveCursor(QTextCursor::End); + ui->teStreamContent->setCurrentFont(wsApp->monospaceFont()); if (is_from_server) { ui->teStreamContent->setTextColor(tagserver_fg); @@ -516,7 +506,7 @@ void FollowStreamDialog::keyPressEvent(QKeyEvent *event) return; } - if (event->key() == Qt::Key_F3 || event->key() == Qt::Key_N && event->modifiers() & Qt::ControlModifier) { + if (event->key() == Qt::Key_F3 || event->key() == Qt::Key_N && (event->modifiers() & Qt::ControlModifier)) { FindText(); return; } |