forgotten files

This commit is contained in:
Martin Rotter 2023-09-12 09:02:31 +02:00
parent 31612e90b2
commit 63f454af24
3 changed files with 155 additions and 0 deletions

View File

@ -0,0 +1,25 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "gui/notifications/toastnotification.h"
#include "miscellaneous/iconfactory.h"
#ifdef Q_OS_MAC
#include <Carbon/Carbon.h>
#endif
ToastNotification::ToastNotification(Notification::Event event,
const GuiMessage& msg,
const GuiAction& action,
QWidget* parent)
: BaseToastNotification(parent) {
m_ui.setupUi(this);
setupCloseButton(m_ui.m_btnClose);
loadNotification(event, msg, action);
}
void ToastNotification::loadNotification(Notification::Event event, const GuiMessage& msg, const GuiAction& action) {
m_ui.m_lblTitle->setText(msg.m_title);
m_ui.m_lblBody->setText(msg.m_message);
}

View File

@ -0,0 +1,28 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef TOASTNOTIFICATION_H
#define TOASTNOTIFICATION_H
#include "gui/notifications/basetoastnotification.h"
#include "miscellaneous/application.h"
#include "ui_toastnotification.h"
class ToastNotification : public BaseToastNotification {
Q_OBJECT
public:
explicit ToastNotification(Notification::Event event,
const GuiMessage& msg,
const GuiAction& action,
QWidget* parent = nullptr);
private:
void loadNotification(Notification::Event event, const GuiMessage& msg, const GuiAction& action);
private:
Ui::ToastNotification m_ui;
};
#endif // TOASTNOTIFICATION_H

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ToastNotification</class>
<widget class="QDialog" name="ToastNotification">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>321</width>
<height>143</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="m_lblTitle">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="PlainToolButton" name="m_btnClose">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>11</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_lblBody">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="m_btnAction">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PlainToolButton</class>
<extends>QToolButton</extends>
<header>plaintoolbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>