summaryrefslogtreecommitdiff
path: root/ui/qt/syntax_line_edit.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-10-08 20:01:59 +0000
committerGerald Combs <gerald@wireshark.org>2012-10-08 20:01:59 +0000
commit445148ac0e6eddf177c30e81811da90b7e2267aa (patch)
treef87bcf0a462aa11e92a3d1f697c197589a12c7d6 /ui/qt/syntax_line_edit.cpp
parent693ed306d3ac7e606f9e977c824b79f7a5ec4614 (diff)
downloadwireshark-445148ac0e6eddf177c30e81811da90b7e2267aa.tar.gz
Add a PacketRangeGroupBox widget. Use it to implement "Export Selected
Packets". Not yet tested on Windows. "Ignore Packet" hasn't been implemented so we can't test that either. Create a SyntaxLineEdit widget from the QLineEdit code in DisplayFilterEdit. Use it in the file import and export dialogs and the PacketRangeGroupBox widget. This lets us provide instant feedback instead of popping up an error dialog. Expand the Tango color list based on http://emilis.info/other/extended_tango . Rearrange QtShark.pro to (hopefully) work better with Qt Creator. svn path=/trunk/; revision=45405
Diffstat (limited to 'ui/qt/syntax_line_edit.cpp')
-rw-r--r--ui/qt/syntax_line_edit.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/ui/qt/syntax_line_edit.cpp b/ui/qt/syntax_line_edit.cpp
new file mode 100644
index 0000000000..24e59ff617
--- /dev/null
+++ b/ui/qt/syntax_line_edit.cpp
@@ -0,0 +1,49 @@
+#include "syntax_line_edit.h"
+
+#include "tango_colors.h"
+#include <QDebug>
+
+SyntaxLineEdit::SyntaxLineEdit(QWidget *parent) :
+ QLineEdit(parent)
+{
+ state_style_sheet_ = QString(
+ "SyntaxLineEdit[syntaxState=\"%1\"] {"
+ " color: #%4;"
+ " background-color: #%5;"
+ "}"
+
+ "SyntaxLineEdit[syntaxState=\"%2\"] {"
+ " color: #%4;"
+ " background-color: #%6;"
+ "}"
+
+ "SyntaxLineEdit[syntaxState=\"%3\"] {"
+ " color: #%4;"
+ " background-color: #%7;"
+ "}"
+ )
+ .arg(Invalid)
+ .arg(Deprecated)
+ .arg(Valid)
+ .arg(tango_aluminium_6, 6, 16, QChar('0')) // Foreground
+ .arg(tango_scarlet_red_1, 6, 16, QChar('0')) // Invalid
+ .arg(tango_butter_1, 6, 16, QChar('0')) // Deprecated
+ .arg(tango_chameleon_1, 6, 16, QChar('0')) // Valid
+ ;
+ setStyleSheet(tr(""));
+ setSyntaxState();
+}
+
+void SyntaxLineEdit::setSyntaxState(SyntaxState state) {
+ syntax_state_ = state;
+ setStyleSheet(style_sheet_);
+}
+
+QString SyntaxLineEdit::styleSheet() const {
+ return style_sheet_;
+}
+
+void SyntaxLineEdit::setStyleSheet(const QString &style_sheet) {
+ style_sheet_ = style_sheet;
+ QLineEdit::setStyleSheet(style_sheet_ + state_style_sheet_);
+}