splitter->setChildrenCollapsible(false);
sortBar = new THBlackBar(this);
- mostRelevantAction = new THAction(tr("Most relevant"), this);
+ mostRelevantAction = new QAction(tr("Most relevant"), this);
connect(mostRelevantAction, SIGNAL(triggered()), this, SLOT(searchMostRelevant()), Qt::QueuedConnection);
sortBar->addAction(mostRelevantAction);
- mostRecentAction = new THAction(tr("Most recent"), this);
+ mostRecentAction = new QAction(tr("Most recent"), this);
connect(mostRecentAction, SIGNAL(triggered()), this, SLOT(searchMostRecent()), Qt::QueuedConnection);
sortBar->addAction(mostRecentAction);
- mostViewedAction = new THAction(tr("Most viewed"), this);
+ mostViewedAction = new QAction(tr("Most viewed"), this);
connect(mostViewedAction, SIGNAL(triggered()), this, SLOT(searchMostViewed()), Qt::QueuedConnection);
sortBar->addAction(mostViewedAction);
case Phonon::ErrorState:
qDebug() << "Phonon error:" << mediaObject->errorString() << mediaObject->errorType();
+ videoAreaWidget->showError(mediaObject->errorString());
// recover from errors by skipping to the next video
skip();
break;
#include <phonon/videowidget.h>
#include "View.h"
#include "ListModel.h"
-#include "thaction.h"
#include "thblackbar.h"
#include "searchparams.h"
#include "playlistwidget.h"
// sortBar
THBlackBar *sortBar;
- THAction *mostRelevantAction;
- THAction *mostRecentAction;
- THAction *mostViewedAction;
+ QAction *mostRelevantAction;
+ QAction *mostRecentAction;
+ QAction *mostViewedAction;
// phonon
Phonon::MediaObject *mediaObject;
#include <QList>
#include "thblackbar.h"
-#include "thaction.h"
/* ============================================================================
* PRIVATE Class
*/
class THBlackBar::Private {
public:
- QList<THAction *> actionList;
- THAction *checkedAction;
- THAction *hoveredAction;
+ QList<QAction *> actionList;
+ QAction *checkedAction;
+ QAction *hoveredAction;
};
/* ============================================================================
/* ============================================================================
* PUBLIC Methods
*/
-THAction *THBlackBar::addAction (THAction *action) {
+QAction *THBlackBar::addAction (QAction *action) {
+ action->setCheckable(true);
d->actionList.append(action);
return(action);
}
-THAction *THBlackBar::addAction (const QString& text) {
- THAction *action = new THAction(text, this);
+QAction *THBlackBar::addAction (const QString& text) {
+ QAction *action = new QAction(text, this);
d->actionList.append(action);
return(action);
}
// Draw Buttons
// p.translate(0, 4);
QRect rect(buttonsX, 0, buttonWidth, height);
- foreach (THAction *action, d->actionList) {
+ foreach (QAction *action, d->actionList) {
drawButton(&p, rect, action);
rect.moveLeft(rect.x() + rect.width());
}
void THBlackBar::mouseMoveEvent (QMouseEvent *event) {
QWidget::mouseMoveEvent(event);
- THAction *action = hoveredAction(event->pos());
+ QAction *action = hoveredAction(event->pos());
+
if (action == NULL && d->hoveredAction != NULL) {
- d->hoveredAction->hover(false);
+ // d->hoveredAction->hover(false);
d->hoveredAction = NULL;
update();
} else if (action != NULL) {
d->hoveredAction = action;
- action->hover(true);
+ action->hover();
update();
}
}
}
}
-THAction *THBlackBar::hoveredAction (const QPoint& pos) const {
+QAction *THBlackBar::hoveredAction (const QPoint& pos) const {
if (pos.y() <= 0 || pos.y() >= height())
return(NULL);
smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85);
QFontMetrics fontMetrics(smallerBoldFont);
int tmpItemWidth, itemWidth = 0;
- foreach (THAction *action, d->actionList) {
+ foreach (QAction *action, d->actionList) {
tmpItemWidth = fontMetrics.width(action->text());
if (itemWidth < tmpItemWidth) itemWidth = tmpItemWidth;
}
*/
void THBlackBar::drawUnselectedButton ( QPainter *painter,
const QRect& rect,
- const THAction *action)
+ const QAction *action)
{
QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, rect.height() / 2));
linearGrad.setColorAt(0, QColor(0x8e, 0x8e, 0x8e));
void THBlackBar::drawSelectedButton ( QPainter *painter,
const QRect& rect,
- const THAction *action)
+ const QAction *action)
{
QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, rect.height() / 2));
linearGrad.setColorAt(0, QColor(0x6d, 0x6d, 0x6d));
void THBlackBar::drawButton ( QPainter *painter,
const QRect& rect,
- const THAction *action)
+ const QAction *action)
{
if (action->isChecked())
drawSelectedButton(painter, rect, action);
const QRect& rect,
const QLinearGradient& gradient,
const QColor& color,
- const THAction *action)
+ const QAction *action)
{
painter->save();
#define _THBLACKBAR_H_
#include <QWidget>
-class THAction;
+#include <QAction>
class THBlackBar : public QWidget {
- Q_OBJECT
-
- public:
- THBlackBar (QWidget *parent = 0);
- ~THBlackBar();
-
- public:
- THAction *addAction (THAction *action);
- THAction *addAction (const QString& text);
- void setCheckedAction(int index);
-
- QSize minimumSizeHint (void) const;
-
- protected:
- void paintEvent (QPaintEvent *event);
-
- void mouseMoveEvent (QMouseEvent *event);
- void mousePressEvent (QMouseEvent *event);
-
- private:
- void drawUnselectedButton ( QPainter *painter,
- const QRect& rect,
- const THAction *action);
- void drawSelectedButton ( QPainter *painter,
- const QRect& rect,
- const THAction *action);
- void drawButton ( QPainter *painter,
- const QRect& rect,
- const THAction *action);
- void drawButton ( QPainter *painter,
- const QRect& rect,
- const QLinearGradient& gradient,
- const QColor& color,
- const THAction *action);
-
- THAction *hoveredAction (const QPoint& pos) const;
- int calculateButtonWidth (void) const;
-
- private:
- class Private;
- Private *d;
+
+ Q_OBJECT
+
+ public:
+ THBlackBar (QWidget *parent = 0);
+ ~THBlackBar();
+
+ public:
+ QAction *addAction (QAction *action);
+ QAction *addAction (const QString& text);
+ void setCheckedAction(int index);
+
+ QSize minimumSizeHint (void) const;
+
+ protected:
+ void paintEvent (QPaintEvent *event);
+
+ void mouseMoveEvent (QMouseEvent *event);
+ void mousePressEvent (QMouseEvent *event);
+
+ private:
+ void drawUnselectedButton ( QPainter *painter,
+ const QRect& rect,
+ const QAction *action);
+ void drawSelectedButton ( QPainter *painter,
+ const QRect& rect,
+ const QAction *action);
+ void drawButton ( QPainter *painter,
+ const QRect& rect,
+ const QAction *action);
+ void drawButton ( QPainter *painter,
+ const QRect& rect,
+ const QLinearGradient& gradient,
+ const QColor& color,
+ const QAction *action);
+
+ QAction *hoveredAction (const QPoint& pos) const;
+ int calculateButtonWidth (void) const;
+
+ private:
+ class Private;
+ Private *d;
};
#endif /* !_THBLACKBAR_H_ */
DEPENDPATH += $$PWD
INCLUDEPATH += $$PWD
-
-HEADERS += thaction.h \
- thactiongroup.h \
- thblackbar.h
-SOURCES += thaction.cpp \
- thactiongroup.cpp \
- thblackbar.cpp
+HEADERS += thblackbar.h
+SOURCES += thblackbar.cpp