Add an expert level indicator. Move a bunch of resources to image/.

svn path=/trunk/; revision=44165
This commit is contained in:
Gerald Combs 2012-07-31 20:00:25 +00:00
parent d229d813d0
commit d44f940aaf
22 changed files with 80 additions and 8 deletions

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 985 B

After

Width:  |  Height:  |  Size: 985 B

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 294 B

View File

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 286 B

View File

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 553 B

View File

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 562 B

View File

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 564 B

View File

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 231 B

View File

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 362 B

View File

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 377 B

View File

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

View File

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

9
image/status.qrc Normal file
View File

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/expert">
<file>expert_chat.png</file>
<file>expert_error.png</file>
<file>expert_none.png</file>
<file>expert_note.png</file>
<file>expert_warn.png</file>
</qresource>
</RCC>

View File

@ -299,9 +299,10 @@ win32 {
}
RESOURCES += \
toolbar.qrc \
../../image/display_filter.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
welcome.qrc \
display_filter.qrc \
i18n.qrc
TRANSLATIONS = \
@ -311,6 +312,3 @@ TRANSLATIONS = \
ICON = ../../packaging/macosx/Resources/Wireshark.icns
win32: QMAKE_CLEAN += *.pdb

View File

@ -33,6 +33,8 @@
#include "globals.h"
#include "epan/expert.h"
#include "ui/main_statusbar.h"
#include <QSplitter>
@ -132,7 +134,13 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
QWidget *infoProgress = new QWidget(this);
QHBoxLayout *infoProgressHB = new QHBoxLayout(infoProgress);
m_expertStatus.setTextFormat(Qt::RichText);
m_expertStatus.hide();
// XXX Add the comment icon
infoProgressHB->setMargin(0);
infoProgressHB->setSpacing(0);
infoProgressHB->setContentsMargins(0, 0, 0, 0);
m_progressBar.setStyleSheet(QString(
"ProgressBar {"
@ -140,10 +148,10 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
" min-height: 0.8em;"
" max-height: 1em;"
"}"));
// XXX - Add the expert level icon
m_infoStatus.setTemporaryContext(STATUS_CTX_TEMPORARY);
infoProgressHB->addWidget(&m_expertStatus);
infoProgressHB->addWidget(&m_infoStatus);
infoProgressHB->addWidget(&m_progressBar);
infoProgressHB->addStretch(10);
@ -164,6 +172,50 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
packets_bar_update();
}
void MainStatusBar::showExpert() {
expertUpdate();
}
void MainStatusBar::hideExpert() {
m_expertStatus.hide();
}
void MainStatusBar::expertUpdate() {
QString imgText = "<img src=\":/expert/expert_";
QString ttText = " is the highest expert info level";
switch(expert_get_highest_severity()) {
case(PI_ERROR):
imgText.append("error");
ttText.prepend("ERROR");
break;
case(PI_WARN):
imgText.append("warn");
ttText.prepend("WARNING");
break;
case(PI_NOTE):
imgText.append("note");
ttText.prepend("NOTE");
break;
case(PI_CHAT):
imgText.append("chat");
ttText.prepend("CHAT");
break;
// case(PI_COMMENT):
// m_expertStatus.setText("<img src=\":/expert/expert_comment.png\"></img>");
// break;
default:
imgText.append("none");
ttText = "No expert info";
break;
}
imgText.append(".png\"></img>");
m_expertStatus.setText(imgText);
m_expertStatus.setToolTip(ttText);
m_expertStatus.show();
}
void MainStatusBar::pushTemporaryStatus(QString &message) {
m_infoStatus.pushText(message, STATUS_CTX_TEMPORARY);
}
@ -174,6 +226,7 @@ void MainStatusBar::popTemporaryStatus() {
void MainStatusBar::pushFileStatus(QString &message) {
m_infoStatus.pushText(message, STATUS_CTX_FILE);
expertUpdate();
}
void MainStatusBar::popFileStatus() {
@ -190,6 +243,7 @@ void MainStatusBar::popFieldStatus() {
void MainStatusBar::pushFilterStatus(QString &message) {
m_infoStatus.pushText(message, STATUS_CTX_FILTER);
expertUpdate();
}
void MainStatusBar::popFilterStatus() {

View File

@ -28,19 +28,25 @@
#include "progress_bar.h"
#include <QStatusBar>
#include <QLabel>
class MainStatusBar : public QStatusBar
{
Q_OBJECT
public:
explicit MainStatusBar(QWidget *parent = 0);
void showExpert();
void hideExpert();
private:
QLabel m_expertStatus;
LabelStack m_infoStatus;
ProgressBar m_progressBar;
LabelStack m_packetStatus;
LabelStack m_profileStatus;
void expertUpdate();
signals:
public slots:

View File

@ -186,8 +186,8 @@ void MainWindow::captureFileReadFinished(const capture_file *cf) {
void MainWindow::captureFileClosing(const capture_file *cf) {
if (cf != capFile) return;
/* reset expert info indicator */
// status_expert_hide();
// Reset expert info indicator
ui->statusBar->hideExpert();
// gtk_widget_show(expert_info_none);
}
@ -226,6 +226,9 @@ void MainWindow::captureFileClosed(const capture_file *cf) {
if (cf != capFile) return;
packets_bar_update();
// Reset expert info indicator
ui->statusBar->hideExpert();
ui->statusBar->popFileStatus();
capFile = NULL;
}
@ -307,6 +310,8 @@ void MainWindow::openCaptureFile(QString &cfPath)
// get_dirname overwrites its path. Hopefully this isn't a problem.
set_last_open_dir(get_dirname(cfPath.toUtf8().data()));
dfComboBox->setEditText(displayFilter);
ui->statusBar->showExpert();
}
void MainWindow::recentActionTriggered() {