Qt: Make "Learn" on the welcome screen clickable.

Make the "Learn" header a ClickableLabel to match "Open" and "Capture".
Link to the docs page for now. Adjust its stylesheet and properties to
match ast well.

Change-Id: Id9c7c05269de8134af28f0f9c1e2820a60442236
Reviewed-on: https://code.wireshark.org/review/18358
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:
Gerald Combs 2016-10-20 14:35:20 -07:00 committed by Anders Broman
parent 528894e72f
commit a63b5eb711
5 changed files with 28 additions and 11 deletions

View File

@ -76,6 +76,9 @@ topic_online_url(topic_action_e action)
case(ONLINEPAGE_DOWNLOAD):
return "https://www.wireshark.org/download.html";
break;
case(ONLINEPAGE_DOCS):
return "https://www.wireshark.org/docs/";
break;
case(ONLINEPAGE_USERGUIDE):
return "https://www.wireshark.org/docs/wsug_html_chunked/";
break;

View File

@ -42,6 +42,7 @@ typedef enum {
ONLINEPAGE_USERGUIDE,
ONLINEPAGE_FAQ,
ONLINEPAGE_DOWNLOAD,
ONLINEPAGE_DOCS,
ONLINEPAGE_SAMPLE_FILES,
ONLINEPAGE_CAPTURE_SETUP,
ONLINEPAGE_NETWORK_MEDIA,

View File

@ -26,6 +26,7 @@
#include <epan/prefs.h>
#include "ui/capture_globals.h"
#include "ui/help_url.h"
#include "ws_version_info.h"
@ -37,6 +38,7 @@
#include "wireshark_application.h"
#include <QClipboard>
#include <QDesktopServices>
#include <QDir>
#include <QListWidget>
#include <QMenu>
@ -97,17 +99,16 @@ MainWelcome::MainWelcome(QWidget *parent) :
.arg(tango_sky_blue_2, 6, 16, QChar('0')); // Background color
welcome_ui_->mainWelcomeBanner->setStyleSheet(welcome_ss);
QString title_ss = QString(
"QLabel {"
" color: #%1;"
"}"
)
.arg(tango_aluminium_4, 6, 16, QChar('0')); // Text color
QString title_button_ss = title_ss + QString(
"QLabel::hover {"
QString title_button_ss = QString(
"QLabel {"
" color: #%1;"
"}"
).arg(tango_sky_blue_4, 6, 16, QChar('0'));
"QLabel::hover {"
" color: #%2;"
"}"
)
.arg(tango_aluminium_4, 6, 16, QChar('0')) // Text color
.arg(tango_sky_blue_4, 6, 16, QChar('0')); // Hover color
// XXX Is there a better term than "flavor"? Provider? Admonition (a la DocBook)?
// Release_source?
@ -138,7 +139,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
}
welcome_ui_->captureLabel->setStyleSheet(title_button_ss);
welcome_ui_->recentLabel->setStyleSheet(title_button_ss);
welcome_ui_->helpLabel->setStyleSheet(title_ss);
welcome_ui_->helpLabel->setStyleSheet(title_button_ss);
#ifdef Q_OS_MAC
recent_files_->setAttribute(Qt::WA_MacShowFocusRect, false);
@ -503,6 +504,11 @@ void MainWelcome::on_captureLabel_clicked()
wsApp->doTriggerMenuItem(WiresharkApplication::CaptureOptionsDialog);
}
void MainWelcome::on_helpLabel_clicked()
{
QDesktopServices::openUrl(QUrl(topic_online_url(ONLINEPAGE_DOCS)));
}
void MainWelcome::on_recentLabel_clicked()
{
wsApp->doTriggerMenuItem(WiresharkApplication::FileOpenDialog);

View File

@ -55,6 +55,7 @@ protected:
protected slots:
void on_recentLabel_clicked();
void on_captureLabel_clicked();
void on_helpLabel_clicked();
private:
Ui::MainWelcome *welcome_ui_;

View File

@ -236,7 +236,13 @@
</widget>
</item>
<item>
<widget class="QLabel" name="helpLabel">
<widget class="ClickableLabel" name="helpLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;h2&gt;Learn&lt;/h2&gt;</string>
</property>