slider for thumbnail size added

preferencesAboutTextFull
Anna Udovichenko 13 years ago
parent 0cf7b075b3
commit 254d1acc9d
  1. 9
      src/board/UBFeaturesController.cpp
  2. 4
      src/board/UBFeaturesController.h
  3. 35
      src/gui/UBFeaturesWidget.cpp
  4. 11
      src/gui/UBFeaturesWidget.h

@ -55,7 +55,7 @@ void UBFeaturesController::initDirectoryTree()
mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ; mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ;
trashDirectoryPath = UBSettings::userTrashDirPath(); trashDirectoryPath = UBSettings::userTrashDirPath();
featuresList = new QVector <UBFeature>(); featuresList = new QList <UBFeature>();
QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools(); QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools();
@ -322,13 +322,6 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
{ {
UBFeature newElement = copyItemToFolder( url, destination ); UBFeature newElement = copyItemToFolder( url, destination );
deleteItem( url ); deleteItem( url );
/*QString sourcePath = url.toLocalFile();
QFile::remove( sourcePath );
QString thumbnailPath = UBFileSystemUtils::thumbnailPath( sourcePath );
if (thumbnailPath.length() && QFileInfo( thumbnailPath ).exists())
{
QFile::remove(thumbnailPath);
}*/
return newElement; return newElement;
} }

@ -53,7 +53,7 @@ public:
UBFeaturesController(QWidget *parentWidget); UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController(); virtual ~UBFeaturesController();
QVector <UBFeature>* getFeatures()const { return featuresList; } QList <UBFeature>* getFeatures()const { return featuresList; }
const QString& getRootPath()const { return rootPath; } const QString& getRootPath()const { return rootPath; }
@ -81,7 +81,7 @@ private:
static UBFeatureElementType fileTypeFromUrl( const QString &path ); static UBFeatureElementType fileTypeFromUrl( const QString &path );
QVector <UBFeature> *featuresList; QList <UBFeature> *featuresList;
UBFeature *rootElement; UBFeature *rootElement;
QString mUserAudioDirectoryPath; QString mUserAudioDirectoryPath;

@ -56,14 +56,14 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
itemDelegate = new UBFeaturesItemDelegate( this, featuresListView ); itemDelegate = new UBFeaturesItemDelegate( this, featuresListView );
featuresListView->setItemDelegate( itemDelegate ); featuresListView->setItemDelegate( itemDelegate );
featuresListView->setIconSize( QSize(40, 40) ); featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) );
featuresListView->setGridSize( QSize(70, 70) ); featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) );
//pathListView->setStyleSheet( QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;") ); //pathListView->setStyleSheet( QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;") );
pathListView->setModel( featuresPathModel ); pathListView->setModel( featuresPathModel );
pathListView->setViewMode( QListView::IconMode ); pathListView->setViewMode( QListView::IconMode );
pathListView->setIconSize( QSize(30, 30) ); pathListView->setIconSize( QSize(defaultThumbnailSize - 10, defaultThumbnailSize - 10) );
pathListView->setGridSize( QSize(50, 30) ); pathListView->setGridSize( QSize(defaultThumbnailSize + 10, defaultThumbnailSize - 10) );
pathListView->setFixedHeight( 60 ); pathListView->setFixedHeight( 60 );
pathItemDelegate = new UBFeaturesPathItemDelegate( this ); pathItemDelegate = new UBFeaturesPathItemDelegate( this );
pathListView->setItemDelegate( pathItemDelegate ); pathListView->setItemDelegate( pathItemDelegate );
@ -89,7 +89,12 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
currentStackedWidget = ID_LISTVIEW; currentStackedWidget = ID_LISTVIEW;
mActionBar = new UBFeaturesActionBar(controller, this); mActionBar = new UBFeaturesActionBar(controller, this);
layout->addWidget(mActionBar); thumbSlider = new QSlider( Qt::Horizontal, this );
thumbSlider->setMinimum( minThumbnailSize );
thumbSlider->setMaximum( maxThumbnailSize );
thumbSlider->setValue( defaultThumbnailSize );
layout->addWidget( thumbSlider );
layout->addWidget( mActionBar );
/*connect(featuresListView->selectionModel(), SIGNAL(currentChanged ( const QModelIndex &, const QModelIndex & )), /*connect(featuresListView->selectionModel(), SIGNAL(currentChanged ( const QModelIndex &, const QModelIndex & )),
this, SLOT(currentSelected(const QModelIndex &)));*/ this, SLOT(currentSelected(const QModelIndex &)));*/
@ -102,6 +107,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) ); connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) );
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 ) ) );
} }
void UBFeaturesWidget::searchStarted( const QString &pattern ) void UBFeaturesWidget::searchStarted( const QString &pattern )
@ -253,6 +259,12 @@ void UBFeaturesWidget::removeFromFavorite( const QMimeData & mimeData )
} }
} }
void UBFeaturesWidget::thumbnailSizeChanged( int value )
{
featuresListView->setIconSize( QSize( value, value ) );
featuresListView->setGridSize( QSize( value * 1.75, value * 1.75 ) );
}
void UBFeaturesWidget::switchToListView() void UBFeaturesWidget::switchToListView()
{ {
stackedWidget->setCurrentIndex(ID_LISTVIEW); stackedWidget->setCurrentIndex(ID_LISTVIEW);
@ -407,7 +419,10 @@ void UBFeatureProperties::showElement( const UBFeature &elem )
void UBFeatureProperties::onAddToPage() void UBFeatureProperties::onAddToPage()
{ {
if ( UBApplication::isFromWeb( mpElement->getUrl() ) ) QWidget *w = parentWidget()->parentWidget();
UBFeaturesWidget* featuresWidget = dynamic_cast<UBFeaturesWidget*>( w );
featuresWidget->getFeaturesController()->addItemToPage( *mpElement );
/*if ( UBApplication::isFromWeb( mpElement->getUrl() ) )
{ {
sDownloadFileDesc desc; sDownloadFileDesc desc;
desc.isBackground = false; desc.isBackground = false;
@ -422,7 +437,7 @@ void UBFeatureProperties::onAddToPage()
QWidget *w = parentWidget()->parentWidget(); QWidget *w = parentWidget()->parentWidget();
UBFeaturesWidget* featuresWidget = dynamic_cast<UBFeaturesWidget*>( w ); UBFeaturesWidget* featuresWidget = dynamic_cast<UBFeaturesWidget*>( w );
featuresWidget->getFeaturesController()->addItemToPage( *mpElement ); featuresWidget->getFeaturesController()->addItemToPage( *mpElement );
} }*/
} }
UBFeatureProperties::~UBFeatureProperties() UBFeatureProperties::~UBFeatureProperties()
@ -562,7 +577,8 @@ bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent
if ( row + count > featuresList->size() ) if ( row + count > featuresList->size() )
return false; return false;
beginRemoveRows( parent, row, row + count - 1 ); beginRemoveRows( parent, row, row + count - 1 );
featuresList->remove( row, count ); //featuresList->remove( row, count );
featuresList->erase( featuresList->begin() + row, featuresList->begin() + row + count );
endRemoveRows(); endRemoveRows();
return true; return true;
} }
@ -574,7 +590,8 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent )
if ( row >= featuresList->size() ) if ( row >= featuresList->size() )
return false; return false;
beginRemoveRows( parent, row, row ); beginRemoveRows( parent, row, row );
featuresList->remove( row ); //featuresList->remove( row );
featuresList->erase( featuresList->begin() + row );
endRemoveRows(); endRemoveRows();
return true; return true;
} }

@ -51,6 +51,10 @@ public:
|| mode == eUBDockPaletteWidget_DESKTOP; || mode == eUBDockPaletteWidget_DESKTOP;
} }
UBFeaturesController * getFeaturesController()const { return controller; }; UBFeaturesController * getFeaturesController()const { return controller; };
static const int minThumbnailSize = 20;
static const int maxThumbnailSize = 100;
static const int defaultThumbnailSize = 40;
private: private:
void switchToListView(); void switchToListView();
void switchToProperties(); void switchToProperties();
@ -67,6 +71,8 @@ private:
UBFeaturesListView *featuresListView; UBFeaturesListView *featuresListView;
UBFeaturesListView *pathListView; UBFeaturesListView *pathListView;
QSlider *thumbSlider;
QVBoxLayout *layout; QVBoxLayout *layout;
//UBFeaturesPathViewer *pathViewer; //UBFeaturesPathViewer *pathViewer;
QGraphicsScene *pathScene; QGraphicsScene *pathScene;
@ -85,6 +91,7 @@ private slots:
void deleteElements( const QMimeData & ); void deleteElements( const QMimeData & );
void addToFavorite( const QMimeData & ); void addToFavorite( const QMimeData & );
void removeFromFavorite( const QMimeData & ); void removeFromFavorite( const QMimeData & );
void thumbnailSizeChanged( int );
}; };
class UBFeaturesListView : public QListView class UBFeaturesListView : public QListView
@ -165,9 +172,9 @@ public:
Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }
void setFeaturesList( QVector <UBFeature> *flist ) { featuresList = flist; } void setFeaturesList( QList <UBFeature> *flist ) { featuresList = flist; }
private: private:
QVector <UBFeature> *featuresList; QList <UBFeature> *featuresList;
}; };
class UBFeaturesProxyModel : public QSortFilterProxyModel class UBFeaturesProxyModel : public QSortFilterProxyModel

Loading…
Cancel
Save