From: Flavio Tordini Date: Thu, 13 Aug 2009 17:17:39 +0000 (+0200) Subject: Removed THAction class, use plain QAction X-Git-Tag: 0.6~60 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=02e105c389ae98962e034d8aba4e68924b5e15a5;p=minitube Removed THAction class, use plain QAction --- diff --git a/src/thlibrary/thaction.cpp b/src/thlibrary/thaction.cpp deleted file mode 100644 index 6a1406d..0000000 --- a/src/thlibrary/thaction.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "thaction.h" - -/* ============================================================================ - * PRIVATE Class - */ -class THAction::Private { - public: - bool isHovered; - bool isChecked; - QString text; - QIcon icon; -}; - -/* ============================================================================ - * PUBLIC Constructor/Destructors - */ -THAction::THAction (QObject *parent) - : QObject(parent), d(new THAction::Private) -{ - d->isHovered = false; - d->isChecked = false; -} - -THAction::THAction (const QString& text, QObject *parent) - : QObject(parent), d(new THAction::Private) -{ - d->isHovered = false; - d->isChecked = false; - d->text = text; -} - -THAction::THAction (const QIcon& icon, const QString& text, QObject *parent) - : QObject(parent), d(new THAction::Private) -{ - d->isHovered = false; - d->isChecked = false; - d->icon = icon; - d->text = text; -} - -THAction::~THAction() { - delete d; -} - -/* ============================================================================ - * PUBLIC Properties - */ -bool THAction::isChecked (void) const { - return(d->isChecked); -} - -bool THAction::isHovered (void) const { - return(d->isHovered); -} - -QIcon THAction::icon (void) const { - return(d->icon); -} - -void THAction::setIcon (const QIcon& icon) { - d->icon = icon; -} - - -QString THAction::text (void) const { - return(d->text); -} - -void THAction::setText (const QString& text) { - d->text = text; -} - -/* ============================================================================ - * PUBLIC SLOTS - */ -void THAction::hover (bool isHovered) { - d->isHovered = isHovered; - if (d->isHovered) emit hovered(); -} - -void THAction::toggle (void) { - emit toggled(d->isChecked); -} - -void THAction::trigger (void) { - emit triggered(d->isChecked); -} - -void THAction::setChecked (bool checked) { - d->isChecked = checked; -} diff --git a/src/thlibrary/thaction.h b/src/thlibrary/thaction.h deleted file mode 100644 index cde6034..0000000 --- a/src/thlibrary/thaction.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _THACTION_H_ -#define _THACTION_H_ - -#include -#include - -class THAction : public QObject { - Q_OBJECT - - Q_PROPERTY(QIcon icon READ icon WRITE setIcon) - Q_PROPERTY(QString text READ text WRITE setText) - - public: - THAction (QObject *parent = 0); - THAction (const QString& text, QObject *parent = 0); - THAction (const QIcon& icon, const QString& text, QObject *parent = 0); - ~THAction(); - - signals: - void triggered (bool checked = false); - void toggled (bool checked); - void hovered (void); - - public: - bool isChecked (void) const; - bool isHovered (void) const; - - QIcon icon (void) const; - void setIcon (const QIcon& icon); - - QString text (void) const; - void setText (const QString& text); - - public slots: - void toggle (void); - void trigger (void); - void hover (bool isHovered = false); - void setChecked (bool checked); - - private: - class Private; - Private *d; -}; - -#endif /* !_THACTION_H_ */ - diff --git a/src/thlibrary/thactiongroup.cpp b/src/thlibrary/thactiongroup.cpp deleted file mode 100644 index 33d1bfc..0000000 --- a/src/thlibrary/thactiongroup.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include - -#include "thactiongroup.h" -#include "thaction.h" - -/* ============================================================================ - * PRIVATE Class - */ -class THActionGroup::Private { - public: - QList actionList; - QString name; -}; - -/* ============================================================================ - * PUBLIC Constructor/Destructors - */ -THActionGroup::THActionGroup (QObject *parent) - : QObject(parent), d(new THActionGroup::Private) -{ -} - -THActionGroup::THActionGroup (const QString& name, QObject *parent) - : QObject(parent), d(new THActionGroup::Private) -{ - d->name = name; -} - -THActionGroup::~THActionGroup() { - delete d; -} - -/* ============================================================================ - * PUBLIC Methods - */ -THAction *THActionGroup::addAction (THAction *action) { - d->actionList.append(action); - return(action); -} - -THAction *THActionGroup::addAction (const QString& text) { - THAction *action = new THAction(text, this); - d->actionList.append(action); - return(action); -} - -THAction *THActionGroup::addAction (const QIcon& icon, const QString& text) { - THAction *action = new THAction(icon, text, this); - d->actionList.append(action); - return(action); -} - -/* ============================================================================ - * PUBLIC Properties - */ -QString THActionGroup::name (void) const { - return(d->name); -} - -void THActionGroup::setName (const QString& name) { - d->name = name; -} - diff --git a/src/thlibrary/thactiongroup.h b/src/thlibrary/thactiongroup.h deleted file mode 100644 index 4f391c0..0000000 --- a/src/thlibrary/thactiongroup.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _THACTIONGROUP_H_ -#define _THACTIONGROUP_H_ - -#include -#include -class THAction; - -class THActionGroup : public QObject { - Q_OBJECT - - public: - THActionGroup (QObject *parent = 0); - THActionGroup (const QString& name, QObject *parent = 0); - ~THActionGroup(); - - public: - THAction *addAction (THAction *action); - THAction *addAction (const QString& text); - THAction *addAction (const QIcon& icon, const QString& text); - - QString name (void) const; - void setName (const QString& name); - - private: - class Private; - Private *d; -}; - -#endif /* !_THACTIONGROUP_H_ */ -