Qt: Revert back to an all-in-one main window.

Switch back to having everything on the main window similar to GTK+.
It's more cluttered but this way but you don't have to navigate the task
selector to get to the recent files and help links.

Retain the "Capture", "Open", and "Learn" imperative text. Move "Open"
to the top as suggested by Michal.

Change-Id: Iaf7d93f9caf686b5cbeb640e5e5f95ecb46f7f2d
Reviewed-on: https://code.wireshark.org/review/5896
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2014-12-19 16:27:57 -08:00
parent 2b621e2209
commit 8b24471e62
3 changed files with 203 additions and 236 deletions

View File

@ -46,15 +46,9 @@ MainWelcome::MainWelcome(QWidget *parent) :
splash_overlay_(NULL)
{
// QGridLayout *grid = new QGridLayout(this);
// QVBoxLayout *column;
// QLabel *heading;
welcome_ui_->setupUi(this);
welcome_ui_->mainWelcomeBanner->setText("Wireshark<br><small>" VERSION "</small>");
task_list_ = welcome_ui_->taskList;
welcome_ui_->mainWelcomeBanner->setText("Welcome to Wireshark " VERSION "");
recent_files_ = welcome_ui_->recentList;
setStyleSheet(QString(
@ -67,11 +61,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
" }"
"QListWidget {"
" border: 0;"
// " border: 1px dotted blue;"
"}"
// "QListWidget::focus {"
// " border: 1px dotted palette(mid);"
// "}"
"QListWidget::item::hover {"
" background-color: #%3;"
" color: #%4;"
@ -82,45 +72,29 @@ MainWelcome::MainWelcome(QWidget *parent) :
"}"
"QTreeWidget {"
" border: 0;"
// " border: 1px dotted green;"
"}"
// "QTreeWidget::focus {"
// " border: 1px dotted palette(mid);"
// " background-color: palette(midlight);"
// "}"
)
.arg(tango_aluminium_6, 6, 16, QChar('0')) // Text color
.arg(tango_sky_blue_4, 6, 16, QChar('0')) // Selected background
.arg(tango_sky_blue_1, 6, 16, QChar('0')) // Hover background
.arg(tango_sky_blue_1, 6, 16, QChar('0')) // Hover background
.arg(tango_aluminium_6, 6, 16, QChar('0')) // Hover foreground
);
QString title_ss = QString(
"QLabel {"
" color: #%1;"
"}"
)
.arg(tango_aluminium_4, 6, 16, QChar('0')); // Text color
welcome_ui_->captureLabel->setStyleSheet(title_ss);
welcome_ui_->recentLabel->setStyleSheet(title_ss);
welcome_ui_->helpLabel->setStyleSheet(title_ss);
#ifdef Q_OS_MAC
recent_files_->setAttribute(Qt::WA_MacShowFocusRect, false);
welcome_ui_->taskList->setAttribute(Qt::WA_MacShowFocusRect, false);
welcome_ui_->interfaceTree->setAttribute(Qt::WA_MacShowFocusRect, false);
#endif
task_list_->setMinimumWidth((task_list_->fontMetrics().height() * 7) // 2 + 1.5 + 1.5 + <mystery_width/> em
+ task_list_->fontMetrics().width(QString("live packets from your network")));
task_list_->setStyleSheet(QString(
"QListWidget {"
" margin-right: 2em;"
"}"
"QListWidget::item {"
" padding: 1.5em;"
" margin-bottom: 1em;"
" border-radius: 0.5em;"
" border: 1px solid #%1;"
"}"
"QListWidget::item::selected {"
" border: 1px solid #%2;"
"}"
)
.arg(tango_sky_blue_4, 6, 16, QChar('0')) // Default border
.arg(tango_sky_blue_4, 6, 16, QChar('0')) // Selected border
);
recent_files_->setStyleSheet(
"QListWidget::item {"
" padding-top: 0.2em;"
@ -137,7 +111,6 @@ MainWelcome::MainWelcome(QWidget *parent) :
connect(wsApp, SIGNAL(updateRecentItemStatus(const QString &, qint64, bool)), this, SLOT(updateRecentFiles()));
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(destroySplashOverlay()));
connect(task_list_, SIGNAL(itemSelectionChanged()), this, SLOT(showTask()));
connect(welcome_ui_->interfaceTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(interfaceDoubleClicked(QTreeWidgetItem*,int)));
connect(welcome_ui_->interfaceTree, SIGNAL(interfaceUpdated(const char*,bool)),
@ -153,8 +126,6 @@ MainWelcome::MainWelcome(QWidget *parent) :
connect(recent_files_, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(openRecentItem(QListWidgetItem *)));
updateRecentFiles();
task_list_->setCurrentRow(0);
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
// This crashes with Qt 4.8.3 on OS X.
QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(welcome_ui_->childContainer);
@ -179,10 +150,6 @@ void MainWelcome::destroySplashOverlay()
splash_overlay_ = NULL;
}
void MainWelcome::showTask() {
welcome_ui_->taskStack->setCurrentIndex(task_list_->currentRow());
}
void MainWelcome::interfaceDoubleClicked(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column);
@ -232,6 +199,8 @@ void MainWelcome::updateRecentFiles() {
while (recent_files_->count() > (int) prefs.gui_recent_files_count_max) {
recent_files_->takeItem(recent_files_->count());
}
welcome_ui_->recentLabel->setVisible(recent_files_->count() > 0);
welcome_ui_->recentList->setVisible(recent_files_->count() > 0);
}
void MainWelcome::openRecentItem(QListWidgetItem *item) {

View File

@ -49,7 +49,6 @@ private:
SplashOverlay *splash_overlay_;
// QListWidget doesn't activate items when the return or enter keys are pressed on OS X.
// We may want to subclass it at some point.
QListWidget *task_list_;
QListWidget *recent_files_;
// MWOverlay *overlay;
@ -63,7 +62,6 @@ signals:
private slots:
void destroySplashOverlay();
void showTask();
void interfaceDoubleClicked(QTreeWidgetItem *item, int column);
void updateRecentFiles();
void openRecentItem(QListWidgetItem *item);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>811</width>
<height>533</height>
<height>663</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,209 +19,208 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="10,80,10">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>44</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="childContainer" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="1" column="1">
<widget class="QStackedWidget" name="taskStack">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="captureContainer">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="captureFilterLayout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Capture filter:</string>
</property>
</widget>
</item>
<item>
<widget class="CaptureFilterCombo" name="captureFilterComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="InterfaceTree" name="interfaceTree">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
<widget class="QLabel" name="mainWelcomeBanner">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>650</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Welcome to Wireshark.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="recentLabel">
<property name="text">
<string>&lt;h2&gt;Open&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="recentList">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="captureLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Capture live packets from your network.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&lt;h2&gt;Capture&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="captureFilterLayout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>…using this filter:</string>
</property>
</widget>
<widget class="QListWidget" name="recentList">
</item>
<item>
<widget class="CaptureFilterCombo" name="captureFilterComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
<widget class="QLabel" name="helpLinks">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;
&lt;body&gt;
&lt;h2&gt;&lt;a href=&quot;http://www.wireshark.org/docs/wsug_html_chunked/&quot;&gt;User's Guide&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;
How to install Wireshark and how to use each of its features.&lt;br/&gt;
Other formats and command-line man pages can be found on&lt;br/&gt;
the &lt;a href=&quot;http://www.wireshark.org/docs/&quot;&gt;documentation page&lt;/a&gt;.
&lt;/p&gt;
&lt;h2&gt;&lt;a href=&quot;http://wiki.wireshark.org/&quot;&gt;The Wireshark Wiki&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;
User-contributed pages on different aspects of using Wireshark.&lt;br/&gt;
Capturing in different environments, filtering, specific protocols,&lt;br/&gt;
and a variety of other information.
&lt;/p&gt;
&lt;h2&gt;&lt;a href=&quot;http://ask.wireshark.org/&quot;&gt;Wireshark Q&amp;amp;A&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;
Question and answer site for Wireshark and protocol analysis.
&lt;/p&gt;
&lt;h2&gt;&lt;a href=&quot;http://www.wireshark.org/lists/&quot;&gt;Mailing Lists&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;
In-depth discussions about Wireshark and protocol analysis.
&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="openExternalLinks">
<property name="editable">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QListWidget" name="taskList">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<item>
<property name="text">
<string>Capture
live packets from your network</string>
</property>
</item>
<item>
<property name="text">
<string>Open
a recent capture file</string>
</property>
</item>
<item>
<property name="text">
<string>Learn
more about Wireshark</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="mainWelcomeBanner">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="InterfaceTree" name="interfaceTree">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="helpLabel">
<property name="text">
<string>&lt;h2&gt;Learn&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="helpLinks">
<property name="text">
<string>&lt;html&gt;&lt;head&gt;
&lt;style&gt;
a:link {
color: inherit;
text-decoration: none;
}
a:hover {
color: inherit;
text-decoration: underline;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;&lt;tr&gt;
&lt;th&gt;&lt;a href=&quot;http://www.wireshark.org/docs/wsug_html_chunked/&quot;&gt;User's Guide&lt;/a&gt;&lt;/th&gt;
&lt;td style=&quot;padding-left: 8px; padding-right: 8px;&quot;&gt;·&lt;/td&gt;
&lt;th&gt;&lt;a href=&quot;http://wiki.wireshark.org/&quot;&gt;Wiki&lt;/a&gt;&lt;/th&gt;
&lt;td style=&quot;padding-left: 8px; padding-right: 8px;&quot;&gt;·&lt;/td&gt;
&lt;th&gt;&lt;a href=&quot;http://ask.wireshark.org/&quot;&gt;Questions and Answers&lt;/a&gt;&lt;/th&gt;
&lt;td style=&quot;padding-left: 8px; padding-right: 8px;&quot;&gt;·&lt;/td&gt;
&lt;th&gt;&lt;a href=&quot;http://www.wireshark.org/lists/&quot;&gt;Mailing Lists&lt;/a&gt;&lt;/th&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>43</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
@ -236,5 +235,6 @@ more about Wireshark</string>
<header>capture_filter_combo.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>