forked from osmocom/wireshark
Qt: Main Welcome behavior tweaks.
Update the recent item list and interface tree style sheets so that hovered items have a different background color. This should make it more obvious that they can be clicked. Select the default interface (or failing that, the first interface) at application startup and focus on the interface tree. This should make it less likely that the user will start typing in a capture filter with the wrong (or no) interface selected. Note that we should probably track selected interfaces in the recent file instead of forcing the user to select one via the preferences. This should hopefully address some of the issues in bug 12636 and do so without changing the layout (which we can do in another commit). Change-Id: I96a417973f4270a70f41d04c40c4947a09613bdc Ping-Bug: 12636 Reviewed-on: https://code.wireshark.org/review/22627 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
76efb096d4
commit
e036f4a282
|
@ -168,6 +168,11 @@ int InterfaceFrame::interfacesPresent()
|
|||
return sourceModel->rowCount() - proxyModel->interfacesHidden();
|
||||
}
|
||||
|
||||
void InterfaceFrame::setTreeFocus()
|
||||
{
|
||||
ui->interfaceTree->setFocus();
|
||||
}
|
||||
|
||||
void InterfaceFrame::hideEvent(QHideEvent *) {
|
||||
#ifdef HAVE_LIBPCAP
|
||||
if (stat_timer_)
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
|
||||
QMenu * getSelectionMenu();
|
||||
int interfacesPresent();
|
||||
void setTreeFocus();
|
||||
|
||||
Q_SIGNALS:
|
||||
void showExtcapOptions(QString device_name);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <ui_main_welcome.h>
|
||||
#include "tango_colors.h"
|
||||
|
||||
#include "color_utils.h"
|
||||
#include "qt_ui_utils.h"
|
||||
#include "wireshark_application.h"
|
||||
|
||||
|
@ -47,7 +48,7 @@
|
|||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
#include <QGraphicsBlurEffect>
|
||||
#endif
|
||||
|
||||
|
@ -77,6 +78,8 @@ MainWelcome::MainWelcome(QWidget *parent) :
|
|||
|
||||
welcome_ui_->captureFilterComboBox->setEnabled(false);
|
||||
|
||||
QColor hover_color = ColorUtils::alphaBlend(palette().window(), palette().highlight(), 0.5);
|
||||
|
||||
setStyleSheet(QString(
|
||||
"MainWelcome {"
|
||||
" padding: 1em;"
|
||||
|
@ -85,37 +88,38 @@ MainWelcome::MainWelcome(QWidget *parent) :
|
|||
" background-color: palette(base);"
|
||||
" color: palette(text);"
|
||||
" }"
|
||||
"QListWidget {"
|
||||
"QAbstractItemView {"
|
||||
" border: 0;"
|
||||
"}"
|
||||
"QTreeWidget {"
|
||||
" border: 0;"
|
||||
"QAbstractItemView:item:hover {"
|
||||
" background-color: %1;"
|
||||
"}"
|
||||
)
|
||||
.arg(hover_color.name())
|
||||
);
|
||||
|
||||
QString welcome_ss = QString(
|
||||
"QLabel {"
|
||||
" border-radius: 0.33em;"
|
||||
" color: #%1;"
|
||||
" background-color: #%2;"
|
||||
" color: %1;"
|
||||
" background-color: %2;"
|
||||
" padding: 0.33em;"
|
||||
"}"
|
||||
)
|
||||
.arg(tango_aluminium_6, 6, 16, QChar('0')) // Text color
|
||||
.arg(tango_sky_blue_2, 6, 16, QChar('0')); // Background color
|
||||
.arg(QColor(tango_aluminium_6).name()) // Text color
|
||||
.arg(QColor(tango_sky_blue_2).name()); // Background color
|
||||
welcome_ui_->mainWelcomeBanner->setStyleSheet(welcome_ss);
|
||||
|
||||
QString title_button_ss = QString(
|
||||
"QLabel {"
|
||||
" color: #%1;"
|
||||
" color: %1;"
|
||||
"}"
|
||||
"QLabel::hover {"
|
||||
" color: #%2;"
|
||||
" color: %2;"
|
||||
"}"
|
||||
)
|
||||
.arg(tango_aluminium_4, 6, 16, QChar('0')) // Text color
|
||||
.arg(tango_sky_blue_4, 6, 16, QChar('0')); // Hover color
|
||||
.arg(QColor(tango_aluminium_4).name()) // Text color
|
||||
.arg(QColor(tango_sky_blue_4).name()); // Hover color
|
||||
|
||||
// XXX Is there a better term than "flavor"? Provider? Admonition (a la DocBook)?
|
||||
// Release_source?
|
||||
|
@ -138,7 +142,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
|
|||
)
|
||||
.arg("white") // Text color
|
||||
.arg("#2c4bc4"); // Background color. Matches capture start button.
|
||||
// .arg(tango_butter_5, 6, 16, QChar('0')); // "Warning" background
|
||||
// .arg(QColor(tango_butter_5).name()); // "Warning" background
|
||||
|
||||
welcome_ui_->flavorBanner->setText(flavor_);
|
||||
welcome_ui_->flavorBanner->setStyleSheet(flavor_ss);
|
||||
|
@ -192,8 +196,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
|
|||
connect(recent_files_, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(openRecentItem(QListWidgetItem *)));
|
||||
updateRecentCaptures();
|
||||
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
// This crashes with Qt 4.8.3 on macOS.
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(welcome_ui_->childContainer);
|
||||
blur->setBlurRadius(2);
|
||||
welcome_ui_->childContainer->setGraphicsEffect(blur);
|
||||
|
@ -256,7 +259,7 @@ void MainWelcome::appInitialized()
|
|||
#endif
|
||||
welcome_ui_->fullReleaseLabel->setText(full_release);
|
||||
|
||||
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
||||
welcome_ui_->childContainer->setGraphicsEffect(NULL);
|
||||
#endif
|
||||
|
||||
|
@ -266,8 +269,17 @@ void MainWelcome::appInitialized()
|
|||
|
||||
welcome_ui_->captureFilterComboBox->setEnabled(true);
|
||||
|
||||
QString capture_device = prefs.capture_device;
|
||||
if (!capture_device.isEmpty()) {
|
||||
capture_opts_default_iface_if_necessary(&global_capture_opts, prefs.capture_device);
|
||||
}
|
||||
|
||||
interfaceListChanged();
|
||||
|
||||
if (global_capture_opts.num_selected > 0) {
|
||||
welcome_ui_->interfaceFrame->setTreeFocus();
|
||||
}
|
||||
|
||||
delete splash_overlay_;
|
||||
splash_overlay_ = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue