diff --git a/src/UserInterface/Button/push_button.cpp b/src/UserInterface/Button/push_button.cpp deleted file mode 100644 index cff465a..0000000 --- a/src/UserInterface/Button/push_button.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "push_button.h" - -PushButton::PushButton(QWidget *parent) : QPushButton(parent) -{ - m_btnLayout = new QHBoxLayout(this); - this->setLayout(m_btnLayout); - m_label = new IconLabel(this); - m_btnLayout->addWidget(m_label); - - m_label->setAlignment(Qt::AlignCenter); - m_btnLayout->setAlignment(Qt::AlignCenter); -} - -void PushButton::setLabel(QPixmap pixmap, int size) -{ - m_label->setFixedSize(size, size); - m_label->setIcon(pixmap); -} - -PushButton::~PushButton() -{ - -} - -void PushButton::paintEvent(QPaintEvent *e) -{ - Q_UNUSED(e); - QStylePainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - QStyleOptionButton option; - initStyleOption(&option); - - if (option.state & QStyle::State_Sunken) { - painter.save(); - painter.setPen(Qt::NoPen); - painter.setBrush(Qt::white); - if (g_curStyle == "ukui-dark" || g_isFullScreen) { - painter.setOpacity(0.25); - } else { - painter.setOpacity(0.65); - } - - painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); - painter.restore(); - } - - if (option.state & QStyle::State_MouseOver) { - painter.save(); - painter.setPen(Qt::NoPen); - painter.setBrush(Qt::white); - if (g_curStyle == "ukui-dark" || g_isFullScreen) { - painter.setOpacity(0.1); - } else { - painter.setOpacity(0.35); - } - - painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); - painter.restore(); - } - - if (option.state & QStyle::State_On) { - painter.save(); - painter.setPen(Qt::NoPen); - painter.setBrush(Qt::white); - if (g_curStyle == "ukui-dark" || g_isFullScreen) { - painter.setOpacity(0.2); - } else { - painter.setOpacity(0.5); - } - - painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); - painter.restore(); - } - - if (option.state & QStyle::State_HasFocus) { - painter.save(); - QStyleOption opt; - QColor color = opt.palette.color(QPalette::Highlight); - painter.setPen(QPen(color, 2)); - painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); - painter.restore(); - } -} - -IconLabel::IconLabel(QWidget *parent) - : QLabel(parent) -{ - this->setContentsMargins(0, 0, 0, 0); -} - -void IconLabel::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - painter.setRenderHints(QPainter::SmoothPixmapTransform, true); - painter.drawPixmap(0, 0, m_pixmap); - return QLabel::paintEvent(event); -} - -void IconLabel::setIcon(const QPixmap &pixmap) -{ - m_pixmap = pixmap; -} - - diff --git a/src/UserInterface/Button/push_button.h b/src/UserInterface/Button/push_button.h deleted file mode 100644 index 5c044ba..0000000 --- a/src/UserInterface/Button/push_button.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PUSHBUTTON_H -#define PUSHBUTTON_H - -#include -#include -#include -#include -#include -#include -#include "utility.h" - -class IconLabel : public QLabel -{ - Q_OBJECT -public: - IconLabel(QWidget *parent = nullptr); - void setIcon(const QPixmap &pixmap); -protected: - void paintEvent(QPaintEvent *event) override; - -private: - QPixmap m_pixmap; -}; - -class PushButton : public QPushButton -{ - Q_OBJECT -public: - explicit PushButton(QWidget *parent = nullptr); - ~PushButton(); - - void setLabel(QPixmap pixmap, int size); - -protected: - void paintEvent(QPaintEvent *e) override; - -private: - QHBoxLayout *m_btnLayout = nullptr; - IconLabel *m_label = nullptr; - -Q_SIGNALS: - -}; -#endif // PUSHBUTTON_H diff --git a/src/UserInterface/Button/textlabel.cpp b/src/UserInterface/Button/textlabel.cpp deleted file mode 100644 index 90e4722..0000000 --- a/src/UserInterface/Button/textlabel.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "textlabel.h" -#include - -TextLabel::TextLabel(QWidget *parent) : QLabel(parent) -{ - -} - -void TextLabel::checkState(bool isChecked) -{ - m_isChecked = isChecked; -} - -void TextLabel::paintEvent(QPaintEvent *event) -{ - if (m_isChecked) { - return QLabel::paintEvent(event); - } - - QStylePainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - QStyleOptionFrame option; - initStyleOption(&option); - - if (option.state & QStyle::State_HasFocus) { - painter.save(); - QStyleOption opt; - QColor color = opt.palette.color(QPalette::Highlight); - painter.setPen(QPen(color, 2)); - painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); - painter.restore(); - } - QLabel::paintEvent(event); -} diff --git a/src/UserInterface/Button/textlabel.h b/src/UserInterface/Button/textlabel.h deleted file mode 100644 index 18eb961..0000000 --- a/src/UserInterface/Button/textlabel.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef TEXTLABEL_H -#define TEXTLABEL_H - -#include -#include -#include -#include -#include - -class TextLabel : public QLabel -{ - Q_OBJECT -public: - explicit TextLabel(QWidget *parent = nullptr); - - void checkState(bool isChecked); - -private: - void paintEvent(QPaintEvent *event) override; - - bool m_isChecked = false; - -Q_SIGNALS: - -}; - -#endif // TEXTLABEL_H diff --git a/src/menu/menu-manager.cpp b/src/menu/menu-manager.cpp index 7073646..8aad0e0 100644 --- a/src/menu/menu-manager.cpp +++ b/src/menu/menu-manager.cpp @@ -174,6 +174,7 @@ public: MenuManager::MenuManager() : d(new MenuManagerPrivate) { + registerMenuProvider(new AppMenuProvider); loadMenus(); }