|
|
@ -82,7 +82,6 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
//pathListView->setMovement( QListView::Static );
|
|
|
|
//pathListView->setMovement( QListView::Static );
|
|
|
|
pathListView->setDragDropMode( QAbstractItemView::DropOnly ); |
|
|
|
pathListView->setDragDropMode( QAbstractItemView::DropOnly ); |
|
|
|
|
|
|
|
|
|
|
|
pathScene = new QGraphicsScene(this); |
|
|
|
|
|
|
|
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
|
|
|
|
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
|
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
webView = new UBFeaturesWebView(this); |
|
|
|
webView = new UBFeaturesWebView(this); |
|
|
@ -122,6 +121,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
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( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) ); |
|
|
|
|
|
|
|
connect( mActionBar, SIGNAL( removeElementsFromFavorite() ), this, SLOT ( removeElementsFromFavorite() ) ); |
|
|
|
|
|
|
|
connect( mActionBar, SIGNAL( deleteSelectedElements() ), this, SLOT( deleteSelectedElements() ) ); |
|
|
|
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 ) ) ); |
|
|
@ -131,6 +132,15 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale |
|
|
|
this, SLOT( onAddDownloadedFileToLibrary( bool, QUrl, QString,QByteArray ) ) ); |
|
|
|
this, SLOT( onAddDownloadedFileToLibrary( bool, QUrl, QString,QByteArray ) ) ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWidget::~UBFeaturesWidget() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( thumbSlider != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete thumbSlider; |
|
|
|
|
|
|
|
thumbSlider = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBFeaturesWidget::eventFilter( QObject *target, QEvent *event ) |
|
|
|
bool UBFeaturesWidget::eventFilter( QObject *target, QEvent *event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( target == featuresListView && event->type() == QEvent::Resize ) |
|
|
|
if ( target == featuresListView && event->type() == QEvent::Resize ) |
|
|
@ -277,6 +287,37 @@ void UBFeaturesWidget::deleteElements( const QMimeData & mimeData ) |
|
|
|
model->invalidate(); |
|
|
|
model->invalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::deleteSelectedElements() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); |
|
|
|
|
|
|
|
QList <QUrl> urls; |
|
|
|
|
|
|
|
foreach ( QModelIndex sel, selected ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature feature = sel.data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
|
|
|
|
if ( feature.isDeletable() ) |
|
|
|
|
|
|
|
urls.append( feature.getFullPath() ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (QUrl url, urls) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( controller->isTrash( url ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->deleteItem( url ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature elem = controller->moveItemToFolder( url, controller->getTrashElement() ); |
|
|
|
|
|
|
|
controller->removeFromFavorite( url ); |
|
|
|
|
|
|
|
featuresModel->addItem( elem ); |
|
|
|
|
|
|
|
featuresModel->deleteFavoriteItem( url.toString() ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
featuresModel->deleteItem( url.toString() ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); |
|
|
|
|
|
|
|
model->invalidate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData ) |
|
|
|
void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( !mimeData.hasUrls() ) |
|
|
|
if ( !mimeData.hasUrls() ) |
|
|
@ -335,6 +376,17 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( currentStackedWidget == ID_PROPERTIES ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature feature = featureProperties->getCurrentElement(); |
|
|
|
|
|
|
|
if ( feature != UBFeature() && !UBApplication::isFromWeb( feature.getFullPath().toString() ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature elem = controller->addToFavorite( feature.getFullPath() ); |
|
|
|
|
|
|
|
featuresModel->addItem( elem ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if ( currentStackedWidget == ID_LISTVIEW ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); |
|
|
|
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); |
|
|
|
for ( int i = 0; i < selected.size(); ++i ) |
|
|
|
for ( int i = 0; i < selected.size(); ++i ) |
|
|
@ -344,6 +396,26 @@ void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() ) |
|
|
|
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() ) |
|
|
|
featuresModel->addItem( elem ); |
|
|
|
featuresModel->addItem( elem ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); |
|
|
|
|
|
|
|
model->invalidate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::removeElementsFromFavorite() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); |
|
|
|
|
|
|
|
//qSort( selected.begin(), selected.end(), qGreater<QModelIndex>() );
|
|
|
|
|
|
|
|
QList <QUrl> items; |
|
|
|
|
|
|
|
for ( int i = 0; i < selected.size(); ++i ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
|
|
|
|
items.append( feature.getFullPath() ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach ( QUrl url, items ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controller->removeFromFavorite( url ); |
|
|
|
|
|
|
|
featuresModel->deleteFavoriteItem( url.toString() ); |
|
|
|
|
|
|
|
} |
|
|
|
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); |
|
|
|
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); |
|
|
|
model->invalidate(); |
|
|
|
model->invalidate(); |
|
|
|
} |
|
|
|
} |
|
|
@ -380,9 +452,7 @@ void UBFeaturesWidget::currentPathChanged(const QString &path) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWidget::~UBFeaturesWidget() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
|
|
|
|
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
|
|
|
|
: QListView(parent) |
|
|
|
: QListView(parent) |
|
|
@ -473,15 +543,18 @@ UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget( |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWebView::~UBFeaturesWebView() |
|
|
|
UBFeaturesWebView::~UBFeaturesWebView() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(NULL != mpSankoreAPI){ |
|
|
|
if( NULL != mpSankoreAPI ) |
|
|
|
|
|
|
|
{ |
|
|
|
delete mpSankoreAPI; |
|
|
|
delete mpSankoreAPI; |
|
|
|
mpSankoreAPI = NULL; |
|
|
|
mpSankoreAPI = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
if(NULL != mpView){ |
|
|
|
if( NULL != mpView ) |
|
|
|
|
|
|
|
{ |
|
|
|
delete mpView; |
|
|
|
delete mpView; |
|
|
|
mpView = NULL; |
|
|
|
mpView = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
if(NULL != mpLayout){ |
|
|
|
if( NULL != mpLayout ) |
|
|
|
|
|
|
|
{ |
|
|
|
delete mpLayout; |
|
|
|
delete mpLayout; |
|
|
|
mpLayout = NULL; |
|
|
|
mpLayout = NULL; |
|
|
|
} |
|
|
|
} |
|
|
@ -597,6 +670,55 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : |
|
|
|
connect( mpAddToLibButton, SIGNAL( clicked() ), this, SLOT(onAddToLib() ) ); |
|
|
|
connect( mpAddToLibButton, SIGNAL( clicked() ), this, SLOT(onAddToLib() ) ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeatureProperties::~UBFeatureProperties() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( mpOrigPixmap ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpOrigPixmap; |
|
|
|
|
|
|
|
mpOrigPixmap = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpElement ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpElement; |
|
|
|
|
|
|
|
mpElement = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpThumbnail ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpThumbnail; |
|
|
|
|
|
|
|
mpThumbnail = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpButtonLayout ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpButtonLayout; |
|
|
|
|
|
|
|
mpButtonLayout = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpAddPageButton ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpAddPageButton; |
|
|
|
|
|
|
|
mpAddPageButton = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpSetAsBackgroundButton ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpSetAsBackgroundButton; |
|
|
|
|
|
|
|
mpSetAsBackgroundButton = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpAddToLibButton ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpAddToLibButton; |
|
|
|
|
|
|
|
mpAddToLibButton = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpObjInfoLabel ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpObjInfoLabel; |
|
|
|
|
|
|
|
mpObjInfoLabel = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpObjInfos ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpObjInfos; |
|
|
|
|
|
|
|
mpObjInfos = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::resizeEvent( QResizeEvent *event ) |
|
|
|
void UBFeatureProperties::resizeEvent( QResizeEvent *event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(event); |
|
|
|
Q_UNUSED(event); |
|
|
@ -609,6 +731,13 @@ void UBFeatureProperties::showEvent (QShowEvent *event ) |
|
|
|
adaptSize(); |
|
|
|
adaptSize(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeature UBFeatureProperties::getCurrentElement() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( mpElement ) |
|
|
|
|
|
|
|
return *mpElement; |
|
|
|
|
|
|
|
return UBFeature(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::adaptSize() |
|
|
|
void UBFeatureProperties::adaptSize() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( NULL != mpOrigPixmap ) |
|
|
|
if( NULL != mpOrigPixmap ) |
|
|
@ -716,19 +845,7 @@ void UBFeatureProperties::onSetAsBackground() |
|
|
|
featuresWidget->getFeaturesController()->addItemAsBackground( *mpElement ); |
|
|
|
featuresWidget->getFeaturesController()->addItemAsBackground( *mpElement ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeatureProperties::~UBFeatureProperties() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( mpOrigPixmap ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpOrigPixmap; |
|
|
|
|
|
|
|
mpOrigPixmap = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( mpElement ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mpElement; |
|
|
|
|
|
|
|
mpElement = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent) |
|
|
|
UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -854,7 +971,7 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for ( int i = 0; i < featuresList->size(); ++i ) |
|
|
|
for ( int i = 0; i < featuresList->size(); ++i ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( !QString::compare( featuresList->at(i).getUrl(), path, Qt::CaseInsensitive ) && |
|
|
|
if ( !QString::compare( featuresList->at(i).getFullPath().toString(), path, Qt::CaseInsensitive ) && |
|
|
|
!QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) ) |
|
|
|
!QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
removeRow( i, QModelIndex() ); |
|
|
|
removeRow( i, QModelIndex() ); |
|
|
@ -863,6 +980,18 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesModel::deleteItem( const QString &path ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for ( int i = 0; i < featuresList->size(); ++i ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( !QString::compare( featuresList->at(i).getFullPath().toString(), path, Qt::CaseInsensitive ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
removeRow( i, QModelIndex() ); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent ) |
|
|
|
bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( row < 0 ) |
|
|
|
if ( row < 0 ) |
|
|
@ -889,6 +1018,7 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent ) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const |
|
|
|
Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); |
|
|
|
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); |
|
|
|