mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 07:07:05 +02:00
Make JobStatusItems clickable
This commit is contained in:
@@ -33,6 +33,12 @@ JobStatusItem::~JobStatusItem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobStatusItem::activated()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
JobStatusItem::allowMultiLine() const
|
JobStatusItem::allowMultiLine() const
|
||||||
{
|
{
|
||||||
|
@@ -53,6 +53,8 @@ public:
|
|||||||
virtual QString mainText() const = 0;
|
virtual QString mainText() const = 0;
|
||||||
virtual QString rightColumnText() const { return QString(); };
|
virtual QString rightColumnText() const { return QString(); };
|
||||||
|
|
||||||
|
virtual void activated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If collapse item is true, sending multiple items of the same type will "collapse" them into one
|
* If collapse item is true, sending multiple items of the same type will "collapse" them into one
|
||||||
* instead of showing each individually. In this case, the right column from the item will be ignored
|
* instead of showing each individually. In this case, the right column from the item will be ignored
|
||||||
|
@@ -118,6 +118,7 @@ JobStatusView::setModel( JobStatusSortModel* m )
|
|||||||
connect( m_view->model(), SIGNAL( customDelegateJobInserted( int, JobStatusItem* ) ), this, SLOT( customDelegateJobInserted( int, JobStatusItem* ) ) );
|
connect( m_view->model(), SIGNAL( customDelegateJobInserted( int, JobStatusItem* ) ), this, SLOT( customDelegateJobInserted( int, JobStatusItem* ) ) );
|
||||||
connect( m_view->model(), SIGNAL( customDelegateJobRemoved( int ) ), this, SLOT( customDelegateJobRemoved( int ) ) );
|
connect( m_view->model(), SIGNAL( customDelegateJobRemoved( int ) ), this, SLOT( customDelegateJobRemoved( int ) ) );
|
||||||
connect( m_view->model(), SIGNAL( refreshDelegates() ), this, SLOT( refreshDelegates() ) );
|
connect( m_view->model(), SIGNAL( refreshDelegates() ), this, SLOT( refreshDelegates() ) );
|
||||||
|
connect( m_view, SIGNAL( activated( QModelIndex ) ), this, SLOT( onItemActivated( QModelIndex ) ) );
|
||||||
|
|
||||||
foreach ( const QPointer<JobStatusItem> item, s_jobItems )
|
foreach ( const QPointer<JobStatusItem> item, s_jobItems )
|
||||||
{
|
{
|
||||||
@@ -184,6 +185,21 @@ JobStatusView::refreshDelegates()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JobStatusView::onItemActivated( const QModelIndex& index )
|
||||||
|
{
|
||||||
|
QVariant itemVar = index.data( JobStatusModel::JobDataRole );
|
||||||
|
if ( !itemVar.canConvert< JobStatusItem* >() || !itemVar.value< JobStatusItem* >() )
|
||||||
|
{
|
||||||
|
tLog() << Q_FUNC_INFO << "unable to fetch JobStatusItem*";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JobStatusItem* item = itemVar.value< JobStatusItem* >();
|
||||||
|
item->activated();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobStatusView::checkCount()
|
JobStatusView::checkCount()
|
||||||
{
|
{
|
||||||
|
@@ -59,6 +59,7 @@ private slots:
|
|||||||
void customDelegateJobInserted( int row, JobStatusItem* item );
|
void customDelegateJobInserted( int row, JobStatusItem* item );
|
||||||
void customDelegateJobRemoved( int row );
|
void customDelegateJobRemoved( int row );
|
||||||
void refreshDelegates();
|
void refreshDelegates();
|
||||||
|
void onItemActivated( const QModelIndex& index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QListView* m_view;
|
QListView* m_view;
|
||||||
|
Reference in New Issue
Block a user