Commit f043388c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: rename utility classes

Depending whether they are VLC specific or not
parent 377ea495
...@@ -54,7 +54,7 @@ void SelectorActionButton::paintEvent( QPaintEvent *event ) ...@@ -54,7 +54,7 @@ void SelectorActionButton::paintEvent( QPaintEvent *event )
int frame = style()->pixelMetric( QStyle::PM_DefaultFrameWidth, 0, this ); int frame = style()->pixelMetric( QStyle::PM_DefaultFrameWidth, 0, this );
p.drawLine( rect().topLeft() + QPoint( 0, frame ), p.drawLine( rect().topLeft() + QPoint( 0, frame ),
rect().bottomLeft() - QPoint( 0, frame ) ); rect().bottomLeft() - QPoint( 0, frame ) );
QVLCFramelessButton::paintEvent( event ); QFramelessButton::paintEvent( event );
} }
PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text ) PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text )
...@@ -64,7 +64,7 @@ PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text ) ...@@ -64,7 +64,7 @@ PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text )
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0);
layout->addSpacing( 3 ); layout->addSpacing( 3 );
lbl = new QVLCElidingLabel( text ); lbl = new QElidingLabel( text );
layout->addWidget(lbl, 1); layout->addWidget(lbl, 1);
int height = qMax( 22, fontMetrics().height() + 8 ); int height = qMax( 22, fontMetrics().height() + 8 );
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#endif #endif
#include "qt4.hpp" #include "qt4.hpp"
#include "util/customwidgets.hpp" /* QVLCFramelessButton */ #include "util/customwidgets.hpp" /* QFramelessButton */
#include <QTreeWidget> #include <QTreeWidget>
...@@ -68,7 +68,7 @@ enum ItemAction { ...@@ -68,7 +68,7 @@ enum ItemAction {
}; };
class SelectorActionButton : public QVLCFramelessButton class SelectorActionButton : public QFramelessButton
{ {
protected: protected:
virtual void paintEvent( QPaintEvent * ); virtual void paintEvent( QPaintEvent * );
...@@ -101,7 +101,7 @@ private: ...@@ -101,7 +101,7 @@ private:
inline void leaveEvent( QEvent* ){ hideAction(); } inline void leaveEvent( QEvent* ){ hideAction(); }
QTreeWidgetItem* qitem; QTreeWidgetItem* qitem;
QVLCFramelessButton* lblAction; QFramelessButton* lblAction;
QLabel* lbl; QLabel* lbl;
QHBoxLayout* layout; QHBoxLayout* layout;
}; };
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="DebugLevelSpinBox" name="verbosityBox"> <widget class="QVLCDebugLevelSpinBox" name="verbosityBox">
<property name="wrapping"> <property name="wrapping">
<bool>true</bool> <bool>true</bool>
</property> </property>
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>DebugLevelSpinBox</class> <class>QVLCDebugLevelSpinBox</class>
<extends>QSpinBox</extends> <extends>QSpinBox</extends>
<header>util/customwidgets.hpp</header> <header>util/customwidgets.hpp</header>
</customwidget> </customwidget>
......
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
#include <QPixmap> #include <QPixmap>
#include <vlc_keys.h> #include <vlc_keys.h>
QVLCFramelessButton::QVLCFramelessButton( QWidget *parent ) QFramelessButton::QFramelessButton( QWidget *parent )
: QPushButton( parent ) : QPushButton( parent )
{ {
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
} }
void QVLCFramelessButton::paintEvent( QPaintEvent * ) void QFramelessButton::paintEvent( QPaintEvent * )
{ {
QPainter painter( this ); QPainter painter( this );
QPixmap pix = icon().pixmap( size() ); QPixmap pix = icon().pixmap( size() );
...@@ -52,17 +52,17 @@ void QVLCFramelessButton::paintEvent( QPaintEvent * ) ...@@ -52,17 +52,17 @@ void QVLCFramelessButton::paintEvent( QPaintEvent * )
painter.drawPixmap( QRect( pos.x(), pos.y(), pix.width(), pix.height() ), pix ); painter.drawPixmap( QRect( pos.x(), pos.y(), pix.width(), pix.height() ), pix );
} }
QVLCElidingLabel::QVLCElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent ) QElidingLabel::QElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent )
: elideMode( mode ), QLabel( s, parent ) : elideMode( mode ), QLabel( s, parent )
{ } { }
void QVLCElidingLabel::setElideMode( Qt::TextElideMode mode ) void QElidingLabel::setElideMode( Qt::TextElideMode mode )
{ {
elideMode = mode; elideMode = mode;
repaint(); repaint();
} }
void QVLCElidingLabel::paintEvent( QPaintEvent * event ) void QElidingLabel::paintEvent( QPaintEvent * event )
{ {
QPainter p( this ); QPainter p( this );
int space = frameWidth() + margin(); int space = frameWidth() + margin();
...@@ -70,7 +70,7 @@ void QVLCElidingLabel::paintEvent( QPaintEvent * event ) ...@@ -70,7 +70,7 @@ void QVLCElidingLabel::paintEvent( QPaintEvent * event )
p.drawText( r, fontMetrics().elidedText( text(), elideMode, r.width() ), alignment() ); p.drawText( r, fontMetrics().elidedText( text(), elideMode, r.width() ), alignment() );
} }
QString DebugLevelSpinBox::textFromValue( int v ) const QString QVLCDebugLevelSpinBox::textFromValue( int v ) const
{ {
QString const texts[] = { QString const texts[] = {
/* Note that min level 0 is 'errors' in Qt Ui /* Note that min level 0 is 'errors' in Qt Ui
......
...@@ -36,21 +36,21 @@ ...@@ -36,21 +36,21 @@
#include <QTimer> #include <QTimer>
class QPixmap; class QPixmap;
class QVLCFramelessButton : public QPushButton class QFramelessButton : public QPushButton
{ {
Q_OBJECT Q_OBJECT
public: public:
QVLCFramelessButton( QWidget *parent = NULL ); QFramelessButton( QWidget *parent = NULL );
virtual QSize sizeHint() const { return iconSize(); } virtual QSize sizeHint() const { return iconSize(); }
protected: protected:
virtual void paintEvent( QPaintEvent * event ); virtual void paintEvent( QPaintEvent * event );
}; };
class QVLCElidingLabel : public QLabel class QElidingLabel : public QLabel
{ {
public: public:
QVLCElidingLabel( const QString &s = QString(), QElidingLabel( const QString &s = QString(),
Qt::TextElideMode mode = Qt::ElideRight, Qt::TextElideMode mode = Qt::ElideRight,
QWidget * parent = NULL ); QWidget * parent = NULL );
void setElideMode( Qt::TextElideMode ); void setElideMode( Qt::TextElideMode );
...@@ -71,14 +71,14 @@ public: ...@@ -71,14 +71,14 @@ public:
} }
}; };
class DebugLevelSpinBox : public QSpinBox class QVLCDebugLevelSpinBox : public QSpinBox
{ {
Q_OBJECT Q_OBJECT
public: public:
DebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { }; QVLCDebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { };
protected: protected:
virtual QString textFromValue( int ) const; virtual QString textFromValue( int ) const;
/* DebugLevelSpinBox is read-only */ /* QVLCDebugLevelSpinBox is read-only */
virtual int valueFromText( const QString& ) const { return -1; } virtual int valueFromText( const QString& ) const { return -1; }
}; };
......
...@@ -106,7 +106,7 @@ void ClickLineEdit::focusOutEvent( QFocusEvent *ev ) ...@@ -106,7 +106,7 @@ void ClickLineEdit::focusOutEvent( QFocusEvent *ev )
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
SearchLineEdit::SearchLineEdit( QWidget *parent ) : QLineEdit( parent ) SearchLineEdit::SearchLineEdit( QWidget *parent ) : QLineEdit( parent )
{ {
clearButton = new QVLCFramelessButton( this ); clearButton = new QFramelessButton( this );
clearButton->setIcon( QIcon( ":/toolbar/clear" ) ); clearButton->setIcon( QIcon( ":/toolbar/clear" ) );
clearButton->setIconSize( QSize( 16, 16 ) ); clearButton->setIconSize( QSize( 16, 16 ) );
clearButton->setCursor( Qt::ArrowCursor ); clearButton->setCursor( Qt::ArrowCursor );
......
...@@ -69,7 +69,7 @@ private: ...@@ -69,7 +69,7 @@ private:
#endif #endif
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
class QVLCFramelessButton; class QFramelessButton;
class SearchLineEdit : public QLineEdit class SearchLineEdit : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
...@@ -82,7 +82,7 @@ private: ...@@ -82,7 +82,7 @@ private:
void focusOutEvent( QFocusEvent *event ); void focusOutEvent( QFocusEvent *event );
void paintEvent( QPaintEvent *event ); void paintEvent( QPaintEvent *event );
void setMessageVisible( bool on ); void setMessageVisible( bool on );
QVLCFramelessButton *clearButton; QFramelessButton *clearButton;
bool message; bool message;
public slots: public slots:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment