|
|
@ -121,6 +121,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) );
|
|
|
|
connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) );
|
|
|
|
connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) ); |
|
|
|
connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) ); |
|
|
|
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) ); |
|
|
|
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) ); |
|
|
|
|
|
|
|
connect ( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) );
|
|
|
|
connect( pathListView, SIGNAL(clicked( const QModelIndex & ) ), |
|
|
|
connect( pathListView, SIGNAL(clicked( const QModelIndex & ) ), |
|
|
|
this, SLOT( currentPathChanged( const QModelIndex & ) ) ); |
|
|
|
this, SLOT( currentPathChanged( const QModelIndex & ) ) ); |
|
|
|
connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) ); |
|
|
|
connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) ); |
|
|
@ -333,6 +334,20 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); |
|
|
|
|
|
|
|
for ( int i = 0; i < selected.size(); ++i ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
|
|
|
|
UBFeature elem = controller->addToFavorite( feature.getFullPath() ); |
|
|
|
|
|
|
|
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() ) |
|
|
|
|
|
|
|
featuresModel->addItem( elem ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); |
|
|
|
|
|
|
|
model->invalidate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToListView() |
|
|
|
void UBFeaturesWidget::switchToListView() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
@ -404,13 +419,19 @@ void UBFeaturesListView::mouseReleaseEvent( QMouseEvent *event ) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event ) |
|
|
|
void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( event->mimeData()->hasUrls() ) |
|
|
|
if ( event->mimeData()->hasUrls() || event->mimeData()->hasImage() ) |
|
|
|
|
|
|
|
event->acceptProposedAction(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesListView::dragMoveEvent( QDragMoveEvent *event ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( event->mimeData()->hasUrls() || event->mimeData()->hasImage() ) |
|
|
|
event->acceptProposedAction(); |
|
|
|
event->acceptProposedAction(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesListView::dropEvent( QDropEvent *event ) |
|
|
|
void UBFeaturesListView::dropEvent( QDropEvent *event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( event->source() || dynamic_cast<UBFeaturesListView *>( event->source() ) ) |
|
|
|
if( event->source() && dynamic_cast<UBFeaturesListView *>( event->source() ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
event->setDropAction( Qt::MoveAction ); |
|
|
|
event->setDropAction( Qt::MoveAction ); |
|
|
|
} |
|
|
|
} |
|
|
@ -775,7 +796,7 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(row) |
|
|
|
Q_UNUSED(row) |
|
|
|
|
|
|
|
|
|
|
|
if ( !mimeData->hasUrls() ) |
|
|
|
if ( !mimeData->hasUrls() && !mimeData->hasImage() ) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
if ( action == Qt::IgnoreAction ) |
|
|
|
if ( action == Qt::IgnoreAction ) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -794,6 +815,8 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act |
|
|
|
parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>(); |
|
|
|
parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( mimeData->hasUrls() ) |
|
|
|
|
|
|
|
{ |
|
|
|
QList<QUrl> urls = mimeData->urls(); |
|
|
|
QList<QUrl> urls = mimeData->urls(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ( QUrl url, urls ) |
|
|
|
foreach ( QUrl url, urls ) |
|
|
@ -810,13 +833,20 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act |
|
|
|
} |
|
|
|
} |
|
|
|
addItem( element ); |
|
|
|
addItem( element ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if ( mimeData->hasImage() ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QImage image = qvariant_cast<QImage>( mimeData->imageData() ); |
|
|
|
|
|
|
|
UBFeature element = dynamic_cast<UBFeaturesWidget *>(QObject::parent())->getFeaturesController()->importImage( image, parentFeature ); |
|
|
|
|
|
|
|
addItem( element ); |
|
|
|
|
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesModel::addItem( const UBFeature &item ) |
|
|
|
void UBFeaturesModel::addItem( const UBFeature &item ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
beginInsertRows( QModelIndex(), featuresList->size(), featuresList->size() ); |
|
|
|
beginInsertRows( QModelIndex(), featuresList->size(), featuresList->size() ); |
|
|
|
featuresList->push_back( item ); |
|
|
|
featuresList->append( item ); |
|
|
|
endInsertRows(); |
|
|
|
endInsertRows(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -897,7 +927,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const |
|
|
|
QStringList UBFeaturesModel::mimeTypes() const |
|
|
|
QStringList UBFeaturesModel::mimeTypes() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
QStringList types; |
|
|
|
QStringList types; |
|
|
|
types << "text/uri-list"; |
|
|
|
types << "text/uri-list" << "image/png" << "image/tiff" << "image/gif" << "image/jpeg"; |
|
|
|
return types; |
|
|
|
return types; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|