Center 'New notifications' button

This commit is contained in:
Martchus 2016-12-10 11:55:08 +01:00
parent d2d80adfe7
commit 230377dabe
2 changed files with 196 additions and 153 deletions

View File

@ -102,7 +102,7 @@ TrayWidget::TrayWidget(TrayMenu *parent) :
m_ui->connectionsPushButton->setText(Settings::values().connection.primary.label);
m_ui->connectionsPushButton->setMenu(m_connectionsMenu);
// apply settings, this also establishes the connection to Syncthing
// apply settings, this also establishes the connection to Syncthing (according to settings)
applySettings();
// setup other widgets
@ -348,6 +348,7 @@ void TrayWidget::applySettings()
// update visual appearance
instance->m_ui->trafficFormWidget->setVisible(settings.appearance.showTraffic);
instance->m_ui->trafficIconLabel->setVisible(settings.appearance.showTraffic);
instance->m_ui->trafficHorizontalSpacer->changeSize(0, 20, settings.appearance.showTraffic ? QSizePolicy::Expanding : QSizePolicy::Ignored, QSizePolicy::Minimum);
if(settings.appearance.showTraffic) {
instance->updateTraffic();
}

View File

@ -2,14 +2,6 @@
<ui version="4.0">
<class>QtGui::TrayWidget</class>
<widget class="QWidget" name="QtGui::TrayWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Syncthing Tray</string>
</property>
@ -159,150 +151,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="infoFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>3</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="trafficIconLabel">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Traffic</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="trafficFormWidget" native="true">
<layout class="QFormLayout" name="formLayout">
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="trafficInTextLabel">
<property name="text">
<string>In</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="inTrafficLabel">
<property name="toolTip">
<string>Incoming traffic</string>
</property>
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="trafficOutTextLabel">
<property name="text">
<string>Out</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="outTrafficLabel">
<property name="toolTip">
<string>Outgoing traffic</string>
</property>
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="notificationsPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>Click to show &lt;i&gt;new&lt;/i&gt; notifications&lt;br&gt;
For &lt;i&gt;all&lt;/i&gt; notifications, checkout the log</string>
</property>
<property name="text">
<string>New notifications</string>
</property>
<property name="icon">
<iconset theme="dialog-warning"/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="connectionsPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="icon">
<iconset theme="network-connect" resource="../resources/icons.qrc">
<normaloff>:/icons/hicolor/scalable/actions/network-connect.svg</normaloff>:/icons/hicolor/scalable/actions/network-connect.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
@ -338,6 +186,200 @@ For &lt;i&gt;all&lt;/i&gt; notifications, checkout the log</string>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="infoFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="trafficHorizontalLayout">
<item>
<widget class="QLabel" name="trafficIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Traffic</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="trafficFormWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="verticalSpacing">
<number>2</number>
</property>
<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 row="0" column="0">
<widget class="QLabel" name="trafficInTextLabel">
<property name="text">
<string>In</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="inTrafficLabel">
<property name="toolTip">
<string>Incoming traffic</string>
</property>
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="trafficOutTextLabel">
<property name="text">
<string>Out</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="outTrafficLabel">
<property name="toolTip">
<string>Outgoing traffic</string>
</property>
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="trafficHorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="notificationsPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>Click to show &lt;i&gt;new&lt;/i&gt; notifications&lt;br&gt;
For &lt;i&gt;all&lt;/i&gt; notifications, checkout the log</string>
</property>
<property name="text">
<string>New notifications</string>
</property>
<property name="icon">
<iconset theme="dialog-warning">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="connectionHorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="connectionsPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="icon">
<iconset theme="network-connect" resource="../resources/icons.qrc">
<normaloff>:/icons/hicolor/scalable/actions/network-connect.svg</normaloff>:/icons/hicolor/scalable/actions/network-connect.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QtGui::DirView" name="dirsTreeView"/>
</item>