Qt: Add more version and packaging information to the main window.

Add a "flavor" (for lack of a better word) banner, which can be set at
build time via WIRESHARK_VERSION_FLAVOR / VERSION_FLAVOR. Set it to
"Development Build" by default. This effectively migrates the
"DEVELOPMENT VERSION" logo image text from the GTK+ UI.

Add full release and automatic update information at the bottom.

Remove the short version from the welcome banner (top left).

To do:

- Add back support for gui_version_placement.

- Move the version and repository branch to the flavor label?

- Add update links as appropriate to the bottom.

- Clean up layout and spacing.

Change-Id: I28af33e6c2beb855f803a2dfedef49f3e8389057
Reviewed-on: https://code.wireshark.org/review/7071
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-02-10 13:48:48 -08:00
parent c200f1e90b
commit 999bbc9b70
8 changed files with 108 additions and 11 deletions

View File

@ -98,6 +98,13 @@ set(PROJECT_PATCH_VERSION 3)
set(PROJECT_VERSION_EXTENSION "$ENV{WIRESHARK_VERSION_EXTRA}")
set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION})
# Banner shown at top right of Qt welcome screen.
if(DEFINED ENV{WIRESHARK_VERSION_FLAVOR})
set(VERSION_FLAVOR "$ENV{WIRESHARK_VERSION_FLAVOR}")
else()
set(VERSION_FLAVOR "Development Build")
endif()
# These are required in .rc files and manifests
set(VERSION_MAJOR ${PROJECT_MAJOR_VERSION})
set(VERSION_MINOR ${PROJECT_MINOR_VERSION})

View File

@ -439,6 +439,7 @@ config.h : config.h.win32 config.nmake
-e s/@VERSION_MAJOR@/$(VERSION_MAJOR)/ \
-e s/@VERSION_MINOR@/$(VERSION_MINOR)/ \
-e s/@VERSION_MICRO@/$(VERSION_MICRO)/ \
-e "s/@VERSION_FLAVOR@/$(VERSION_FLAVOR)/" \
-e "s/@HAVE_C_ARES@/$(C_ARES_CONFIG)/" \
-e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \
-e "s/@HAVE_KFW@/$(KFW_CONFIG)/" \

View File

@ -13,6 +13,8 @@
#define VERSION_MINOR ${PROJECT_MINOR_VERSION}
#define VERSION_MICRO ${PROJECT_PATCH_VERSION}
#define VERSION_FLAVOR "${VERSION_FLAVOR}"
/* FIXME: Move the path stuff to the CMakeInstallDirs.cmake file */
/* Directory for data */
#define DATAFILE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}"

View File

@ -249,6 +249,8 @@
#define VERSION_MINOR @VERSION_MINOR@
#define VERSION_MICRO @VERSION_MICRO@
#define VERSION_FLAVOR "@VERSION_FLAVOR@"
/* We shouldn't need this under Windows but we'll define it anyway. */
#define HTML_VIEWER "mozilla"

View File

@ -44,6 +44,13 @@ VERSION_BUILD=$(VCS_REVISION)
VERSION_EXTRA=$(WIRESHARK_VERSION_EXTRA)
# Banner shown at top right of Qt welcome screen.
!IFDEF WIRESHARK_VERSION_FLAVOR
VERSION_FLAVOR=$(WIRESHARK_VERSION_FLAVOR)
!ELSE
VERSION_FLAVOR="Development Build"
!ENDIF
# The version of the wiretap library. Recommended: Leave unchanged.
WTAP_VERSION_MAJOR=$(VERSION_MAJOR)
WTAP_VERSION_MINOR=$(VERSION_MINOR)

View File

@ -52,6 +52,8 @@ AC_DEFINE(VERSION_MAJOR, version_major, [Wireshark's major version])
AC_DEFINE(VERSION_MINOR, version_minor, [Wireshark's minor version])
AC_DEFINE(VERSION_MICRO, version_micro, [Wireshark's micro version])
AC_DEFINE(VERSION_FLAVOR, "Development Build", [Wireshark's package flavor])
AM_DISABLE_STATIC
#

View File

@ -23,6 +23,8 @@
#include "config.h"
#include "version.h"
#include <epan/prefs.h>
#include "wsutil/ws_version_info.h"
@ -51,7 +53,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
{
welcome_ui_->setupUi(this);
welcome_ui_->mainWelcomeBanner->setText("Welcome to Wireshark " VERSION "");
welcome_ui_->mainWelcomeBanner->setText(tr("Welcome to Wireshark."));
recent_files_ = welcome_ui_->recentList;
setStyleSheet(QString(
@ -89,10 +91,55 @@ MainWelcome::MainWelcome(QWidget *parent) :
"}"
)
.arg(tango_aluminium_4, 6, 16, QChar('0')); // Text color
// XXX Is there a better term than "flavor"? Provider? Admonition (a la DocBook)?
// Release_source?
// Typical use cases are automated builds from wireshark.org and private,
// not-for-redistribution packages.
QString flavor = VERSION_FLAVOR;
if (flavor.isEmpty()) {
welcome_ui_->flavorBanner->hide();
} else {
// If needed there are a couple of ways we can make this customizable.
// - Add one or more classes, e.g. "note" or "warning" similar to
// SyntaxLineEdit, which we can then expose vi #defines.
// - Just expose direct color values via #defines.
QString flavor_ss = QString(
"QLabel {"
" border-radius: 0.25em;"
" color: %1;"
" background-color: %2;"
" padding: 0.25em;"
"}"
)
.arg("white") // Text color
.arg("#2c4bc4"); // Background color. Matches capture start button.
// .arg(tango_butter_5, 6, 16, QChar('0')); // "Warning" background
welcome_ui_->flavorBanner->setText(flavor);
welcome_ui_->flavorBanner->setStyleSheet(flavor_ss);
}
welcome_ui_->captureLabel->setStyleSheet(title_ss);
welcome_ui_->recentLabel->setStyleSheet(title_ss);
welcome_ui_->helpLabel->setStyleSheet(title_ss);
// XXX Add a "check for updates" link?
QString full_release = tr("You are running Wireshark ");
full_release += get_ws_vcs_version_info();
full_release += ".";
#ifdef HAVE_SOFTWARE_UPDATE
if (prefs.gui_update_enabled) {
full_release += tr(" You receive automatic updates.");
} else {
full_release += tr(" You have disabled automatic updates.");
}
#else
// XXX Is there a way to tell if the user installed Wireshark via an
// external package manager? If so we could say so here. We could
// also add a link to the download page.
#endif
welcome_ui_->fullReleaseLabel->setText(full_release);
#ifdef Q_OS_MAC
recent_files_->setAttribute(Qt::WA_MacShowFocusRect, false);
welcome_ui_->interfaceTree->setAttribute(Qt::WA_MacShowFocusRect, false);

View File

@ -37,22 +37,44 @@
<widget class="QWidget" name="childContainer" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="mainWelcomeBanner">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="bannerLayout" native="true">
<property name="minimumSize">
<size>
<width>650</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Welcome to Wireshark.</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="mainWelcomeBanner">
<property name="text">
<string>Welcome to Wireshark.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="flavorBanner">
<property name="text">
<string>s</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
@ -238,6 +260,13 @@ a:hover {
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fullReleaseLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>