Formats minimally release source files based on former clang-format
This commit is contained in:
387 files changed
+37323
-38074
No files matched your search
@@ -9,56 +9,58 @@
|
||||
namespace LtsNotification
|
||||
{
|
||||
|
||||
LtsNotification::LtsNotification(LtsNotificationController* ctl) : QObject(), m_controller(ctl)
|
||||
{
|
||||
LtsNotification::LtsNotification(LtsNotificationController *ctl)
|
||||
: QObject()
|
||||
, m_controller(ctl)
|
||||
{
|
||||
connect(ctl, &LtsNotificationController::destroyed, this, &LtsNotification::slotCtlDestroyed);
|
||||
}
|
||||
}
|
||||
|
||||
LtsNotification::~LtsNotification()
|
||||
{
|
||||
LtsNotification::~LtsNotification()
|
||||
{
|
||||
delete m_controller;
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::setIcon(const QIcon& icon)
|
||||
{
|
||||
void LtsNotification::setIcon(const QIcon &icon)
|
||||
{
|
||||
m_controller->setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::setAction(const std::function<void(void)>& action)
|
||||
{
|
||||
void LtsNotification::setAction(const std::function<void(void)> &action)
|
||||
{
|
||||
m_controller->setAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::setToolTip(const QString& toolTip)
|
||||
{
|
||||
void LtsNotification::setToolTip(const QString &toolTip)
|
||||
{
|
||||
m_controller->setToolTip(toolTip);
|
||||
}
|
||||
}
|
||||
|
||||
const QString& LtsNotification::tooltip() const
|
||||
{
|
||||
const QString &LtsNotification::tooltip() const
|
||||
{
|
||||
return m_controller->tooltip();
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::setCount(const int count)
|
||||
{
|
||||
void LtsNotification::setCount(const int count)
|
||||
{
|
||||
m_controller->setCount(count);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::setEnabled(bool enable)
|
||||
{
|
||||
void LtsNotification::setEnabled(bool enable)
|
||||
{
|
||||
m_controller->setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::setBackground(const int r, const int g, const int b)
|
||||
{
|
||||
void LtsNotification::setBackground(const int r, const int g, const int b)
|
||||
{
|
||||
m_controller->setBackground(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotification::slotCtlDestroyed(QObject* obj)
|
||||
{
|
||||
void LtsNotification::slotCtlDestroyed(QObject *obj)
|
||||
{
|
||||
(void)obj;
|
||||
|
||||
m_controller = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LtsNotification
|
||||
@@ -11,35 +11,35 @@
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace LtsNotification
|
||||
{
|
||||
class LtsNotificationController;
|
||||
class LtsNotificationController;
|
||||
|
||||
class LTSNOTIFICATION_EXPORT LtsNotification : public QObject
|
||||
{
|
||||
class LTSNOTIFICATION_EXPORT LtsNotification : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LtsNotification(LtsNotificationController* ctl);
|
||||
explicit LtsNotification(LtsNotificationController *ctl);
|
||||
~LtsNotification();
|
||||
|
||||
void setIcon(const QIcon& icon);
|
||||
void setAction(const std::function<void(void)>& action);
|
||||
void setToolTip(const QString& toolTip);
|
||||
void setIcon(const QIcon &icon);
|
||||
void setAction(const std::function<void(void)> &action);
|
||||
void setToolTip(const QString &toolTip);
|
||||
void setCount(const int count);
|
||||
void setEnabled(bool enable);
|
||||
void setBackground(const int r, const int g, const int b);
|
||||
|
||||
const QString& tooltip() const;
|
||||
const QString &tooltip() const;
|
||||
|
||||
private:
|
||||
LtsNotificationController* m_controller;
|
||||
LtsNotificationController *m_controller;
|
||||
|
||||
private slots:
|
||||
void slotCtlDestroyed(QObject* obj);
|
||||
};
|
||||
void slotCtlDestroyed(QObject *obj);
|
||||
};
|
||||
|
||||
} // namespace LtsNotification
|
||||
+67
-62
@@ -13,94 +13,95 @@
|
||||
namespace LtsNotification
|
||||
{
|
||||
|
||||
LtsNotificationController::LtsNotificationController(const QString& identifier)
|
||||
: QObject(), m_count(0), m_identifier(QStringLiteral("LtsNotification%1").arg(identifier))
|
||||
{
|
||||
}
|
||||
LtsNotificationController::LtsNotificationController(const QString &identifier)
|
||||
: QObject()
|
||||
, m_count(0)
|
||||
, m_identifier(QStringLiteral("LtsNotification%1").arg(identifier))
|
||||
{
|
||||
}
|
||||
|
||||
LtsNotificationController::~LtsNotificationController()
|
||||
{
|
||||
LtsNotificationController::~LtsNotificationController()
|
||||
{
|
||||
qDeleteAll(m_notiList);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setIcon(const QIcon& icon)
|
||||
{
|
||||
void LtsNotificationController::setIcon(const QIcon &icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
|
||||
setAllIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setCount(const int count)
|
||||
{
|
||||
void LtsNotificationController::setCount(const int count)
|
||||
{
|
||||
m_count = count;
|
||||
|
||||
setAllIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setBackground(const int r, const int g, const int b)
|
||||
{
|
||||
void LtsNotificationController::setBackground(const int r, const int g, const int b)
|
||||
{
|
||||
|
||||
for (QToolButton* tb : std::as_const(m_notiList))
|
||||
for (QToolButton *tb : std::as_const(m_notiList))
|
||||
{
|
||||
|
||||
QString stylesheet;
|
||||
QString stylesheet;
|
||||
|
||||
if (r == -1 && g == -1 && b == -1)
|
||||
stylesheet = QStringLiteral("");
|
||||
else
|
||||
stylesheet = QStringLiteral("QToolButton {background-color: rgb(") + QString::number(r) +
|
||||
QStringLiteral(",") + QString::number(g) + QStringLiteral(",") + QString::number(b) +
|
||||
QStringLiteral(");}");
|
||||
if (r == -1 && g == -1 && b == -1)
|
||||
stylesheet = QStringLiteral("");
|
||||
else
|
||||
stylesheet = QStringLiteral("QToolButton {background-color: rgb(") + QString::number(r) + QStringLiteral(",") + QString::number(g) + QStringLiteral(",") +
|
||||
QString::number(b) + QStringLiteral(");}");
|
||||
|
||||
tb->setStyleSheet(stylesheet);
|
||||
tb->setStyleSheet(stylesheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setEnabled(bool enable)
|
||||
{
|
||||
void LtsNotificationController::setEnabled(bool enable)
|
||||
{
|
||||
m_enable = enable;
|
||||
|
||||
setAllIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setAction(const std::function<void(void)>& action)
|
||||
{
|
||||
void LtsNotificationController::setAction(const std::function<void(void)> &action)
|
||||
{
|
||||
m_action = action;
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setToolTip(const QString& toolTip)
|
||||
{
|
||||
void LtsNotificationController::setToolTip(const QString &toolTip)
|
||||
{
|
||||
m_toolTip = toolTip;
|
||||
|
||||
for (QToolButton* tb : std::as_const(m_notiList))
|
||||
for (QToolButton *tb : std::as_const(m_notiList))
|
||||
{
|
||||
tb->setToolTip(toolTip);
|
||||
tb->setIconSize(QSize(30, 30));
|
||||
tb->setToolTip(toolTip);
|
||||
tb->setIconSize(QSize(30, 30));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::setAllIcons()
|
||||
{
|
||||
void LtsNotificationController::setAllIcons()
|
||||
{
|
||||
if (m_icon.isNull())
|
||||
return;
|
||||
return;
|
||||
|
||||
QIcon icon = modifyIcon(m_icon);
|
||||
|
||||
for (QToolButton* tb : std::as_const(m_notiList))
|
||||
for (QToolButton *tb : std::as_const(m_notiList))
|
||||
{
|
||||
tb->setIcon(icon);
|
||||
tb->setIconSize(QSize(30, 30));
|
||||
tb->setEnabled(m_enable);
|
||||
tb->setIcon(icon);
|
||||
tb->setIconSize(QSize(30, 30));
|
||||
tb->setEnabled(m_enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define SIZE 40
|
||||
|
||||
QIcon LtsNotificationController::modifyIcon(const QIcon& icon)
|
||||
{
|
||||
QIcon LtsNotificationController::modifyIcon(const QIcon &icon)
|
||||
{
|
||||
|
||||
if (m_count < 1)
|
||||
return icon;
|
||||
return icon;
|
||||
|
||||
QPixmap iconImage(icon.pixmap(SIZE * 8 / 10, SIZE * 8 / 10));
|
||||
QPainter painter(&iconImage);
|
||||
@@ -121,11 +122,11 @@ QIcon LtsNotificationController::modifyIcon(const QIcon& icon)
|
||||
painter.restore();
|
||||
|
||||
return iconImage;
|
||||
}
|
||||
}
|
||||
|
||||
QToolButton* LtsNotificationController::createWidget()
|
||||
{
|
||||
QToolButton* b = new QToolButton();
|
||||
QToolButton *LtsNotificationController::createWidget()
|
||||
{
|
||||
QToolButton *b = new QToolButton();
|
||||
b->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
b->setObjectName(m_identifier);
|
||||
|
||||
@@ -133,23 +134,27 @@ QToolButton* LtsNotificationController::createWidget()
|
||||
b->setMaximumSize(SIZE, SIZE);
|
||||
|
||||
connect(b, &QToolButton::destroyed, this, &LtsNotificationController::slotNotiWidgetDestroyed);
|
||||
connect(b, &QToolButton::clicked, this, [this]() {
|
||||
if (m_action)
|
||||
m_action();
|
||||
});
|
||||
connect(b,
|
||||
&QToolButton::clicked,
|
||||
this,
|
||||
[this]()
|
||||
{
|
||||
if (m_action)
|
||||
m_action();
|
||||
});
|
||||
|
||||
if (!m_icon.isNull())
|
||||
b->setIcon(modifyIcon(m_icon));
|
||||
b->setIcon(modifyIcon(m_icon));
|
||||
|
||||
b->setToolTip(m_toolTip);
|
||||
|
||||
m_notiList.append(b);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
void LtsNotificationController::slotNotiWidgetDestroyed(QObject* obj)
|
||||
{
|
||||
m_notiList.removeAll(static_cast<QToolButton*>(obj));
|
||||
}
|
||||
void LtsNotificationController::slotNotiWidgetDestroyed(QObject *obj)
|
||||
{
|
||||
m_notiList.removeAll(static_cast<QToolButton *>(obj));
|
||||
}
|
||||
|
||||
} // namespace LtsNotification
|
||||
@@ -14,43 +14,37 @@ class QToolButton;
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace LtsNotification
|
||||
{
|
||||
class LtsNotificationWidget;
|
||||
class LtsNotificationWidget;
|
||||
|
||||
class LTSNOTIFICATION_EXPORT LtsNotificationController : public QObject
|
||||
{
|
||||
class LTSNOTIFICATION_EXPORT LtsNotificationController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LtsNotificationController(const QString& identifier);
|
||||
explicit LtsNotificationController(const QString &identifier);
|
||||
~LtsNotificationController();
|
||||
|
||||
QToolButton* createWidget();
|
||||
QToolButton *createWidget();
|
||||
|
||||
void setIcon(const QIcon& icon);
|
||||
void setAction(const std::function<void(void)>& action);
|
||||
void setToolTip(const QString& toolTip);
|
||||
void setIcon(const QIcon &icon);
|
||||
void setAction(const std::function<void(void)> &action);
|
||||
void setToolTip(const QString &toolTip);
|
||||
void setCount(const int count);
|
||||
void setBackground(const int r, const int g, const int b);
|
||||
|
||||
const QString& identifier() const
|
||||
{
|
||||
return m_identifier;
|
||||
}
|
||||
const QString &identifier() const { return m_identifier; }
|
||||
|
||||
const QString& tooltip() const
|
||||
{
|
||||
return m_toolTip;
|
||||
}
|
||||
const QString &tooltip() const { return m_toolTip; }
|
||||
|
||||
void setEnabled(bool enable);
|
||||
|
||||
private:
|
||||
QList<QToolButton*> m_notiList;
|
||||
QList<QToolButton *> m_notiList;
|
||||
|
||||
QIcon m_icon;
|
||||
std::function<void(void)> m_action;
|
||||
@@ -60,10 +54,10 @@ class LTSNOTIFICATION_EXPORT LtsNotificationController : public QObject
|
||||
QString m_identifier;
|
||||
|
||||
void setAllIcons();
|
||||
QIcon modifyIcon(const QIcon& icon);
|
||||
QIcon modifyIcon(const QIcon &icon);
|
||||
|
||||
private slots:
|
||||
void slotNotiWidgetDestroyed(QObject* obj);
|
||||
};
|
||||
void slotNotiWidgetDestroyed(QObject *obj);
|
||||
};
|
||||
|
||||
} // namespace LtsNotification
|
||||
Reference in new issue
Block a user