Allow dismissing new notifications
This commit is contained in:
parent
1797c865c2
commit
0ecb26a4cf
|
@ -107,6 +107,12 @@ TrayWidget::TrayWidget(TrayMenu *parent) :
|
|||
m_ui->connectionsPushButton->setText(Settings::values().connection.primary.label);
|
||||
m_ui->connectionsPushButton->setMenu(m_connectionsMenu);
|
||||
|
||||
// setup notifications menu
|
||||
m_notificationsMenu = new QMenu(tr("New notifications"), this);
|
||||
m_notificationsMenu->addAction(m_ui->actionShowNotifications);
|
||||
m_notificationsMenu->addAction(m_ui->actionDismissNotifications);
|
||||
m_ui->notificationsPushButton->setMenu(m_notificationsMenu);
|
||||
|
||||
// apply settings, this also establishes the connection to Syncthing (according to settings)
|
||||
applySettings();
|
||||
|
||||
|
@ -134,6 +140,8 @@ TrayWidget::TrayWidget(TrayMenu *parent) :
|
|||
connect(m_ui->notificationsPushButton, &QPushButton::clicked, this, &TrayWidget::showNotifications);
|
||||
connect(restartButton, &QPushButton::clicked, this, &TrayWidget::restartSyncthing);
|
||||
connect(m_connectionsActionGroup, &QActionGroup::triggered, this, &TrayWidget::handleConnectionSelected);
|
||||
connect(m_ui->actionShowNotifications, &QAction::triggered, this, &TrayWidget::showNotifications);
|
||||
connect(m_ui->actionDismissNotifications, &QAction::triggered, this, &TrayWidget::dismissNotifications);
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||
const SyncthingService &service = syncthingService();
|
||||
connect(m_ui->startStopPushButton, &QPushButton::clicked, &service, &SyncthingService::toggleRunning);
|
||||
|
|
|
@ -96,6 +96,7 @@ private:
|
|||
QMenu *m_connectionsMenu;
|
||||
QActionGroup *m_connectionsActionGroup;
|
||||
Data::SyncthingConnectionSettings *m_selectedConnection;
|
||||
QMenu *m_notificationsMenu;
|
||||
std::vector<Data::SyncthingLogEntry> m_notifications;
|
||||
static std::vector<TrayWidget *> m_instances;
|
||||
};
|
||||
|
|
|
@ -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>300</width>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Syncthing Tray</string>
|
||||
</property>
|
||||
|
@ -468,6 +460,25 @@ For <i>all</i> notifications, checkout the log</string>
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionShowNotifications">
|
||||
<property name="icon">
|
||||
<iconset theme="text-x-generic" resource="../resources/icons.qrc">
|
||||
<normaloff>:/icons/hicolor/scalable/mimetypes/text-x-generic.svg</normaloff>:/icons/hicolor/scalable/mimetypes/text-x-generic.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDismissNotifications">
|
||||
<property name="icon">
|
||||
<iconset theme="window-close">
|
||||
<disabledoff>:/icons/hicolor/scalable/actions/window-close.svg</disabledoff>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dismiss</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Reference in New Issue