|
|
@ -8,9 +8,14 @@ |
|
|
|
#include "core/UBDownloadManager.h" |
|
|
|
#include "core/UBDownloadManager.h" |
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
#include "board/UBBoardController.h" |
|
|
|
#include "board/UBBoardController.h" |
|
|
|
|
|
|
|
#include "globals/UBGlobals.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *UBFeaturesWidget::objNamePathList = "PathList"; |
|
|
|
|
|
|
|
const char *UBFeaturesWidget::objNameFeatureList = "FeatureList"; |
|
|
|
|
|
|
|
|
|
|
|
const char *objNamePathList = "PathList"; |
|
|
|
const QString UBFeaturesNewFolderDialog::acceptText = tr("Accept"); |
|
|
|
const char *objNameFeatureList = "FeatureList"; |
|
|
|
const QString UBFeaturesNewFolderDialog::cancelText = tr("Cancel"); |
|
|
|
|
|
|
|
const QString UBFeaturesNewFolderDialog::labelText = tr("Enter a new folder name"); |
|
|
|
|
|
|
|
|
|
|
|
const QMargins FeatureListMargins(0, 0, 0, 30); |
|
|
|
const QMargins FeatureListMargins(0, 0, 0, 30); |
|
|
|
const int FeatureListBorderOffset = 10; |
|
|
|
const int FeatureListBorderOffset = 10; |
|
|
@ -43,39 +48,19 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) |
|
|
|
pathListView = new UBFeaturesListView(this, objNamePathList); |
|
|
|
pathListView = new UBFeaturesListView(this, objNamePathList); |
|
|
|
controller->assignPathListView(pathListView); |
|
|
|
controller->assignPathListView(pathListView); |
|
|
|
|
|
|
|
|
|
|
|
//Maintains the view of the main part of the palette. Consists of
|
|
|
|
centralWidget = new UBFeaturesCentralWidget(this); |
|
|
|
//mNavigator
|
|
|
|
controller->assignFeaturesListVeiw(centralWidget->listView()); |
|
|
|
//featureProperties
|
|
|
|
centralWidget->setSliderPosition(UBSettings::settings()->featureSliderPosition->get().toInt()); |
|
|
|
//webVeiw
|
|
|
|
|
|
|
|
stackedWidget = new QStackedWidget(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Main features icon view with QSlider on the bottom
|
|
|
|
|
|
|
|
mNavigator = new UBFeaturesNavigatorWidget(this); |
|
|
|
|
|
|
|
controller->assignFeaturesListVeiw(mNavigator->listView()); |
|
|
|
|
|
|
|
mNavigator->setSliderPosition(UBSettings::settings()->featureSliderPosition->get().toInt()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Specifies the properties of a standalone element
|
|
|
|
|
|
|
|
featureProperties = new UBFeatureProperties(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Used to show search bar on the search widget
|
|
|
|
|
|
|
|
webView = new UBFeaturesWebView(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//filling stackwidget
|
|
|
|
|
|
|
|
stackedWidget->addWidget(mNavigator); |
|
|
|
|
|
|
|
stackedWidget->addWidget(featureProperties); |
|
|
|
|
|
|
|
stackedWidget->addWidget(webView); |
|
|
|
|
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
|
|
|
|
currentStackedWidget = ID_LISTVIEW; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Bottom actionbar for DnD, quick search etc
|
|
|
|
//Bottom actionbar for DnD, quick search etc
|
|
|
|
mActionBar = new UBFeaturesActionBar(controller, this); |
|
|
|
mActionBar = new UBFeaturesActionBar(controller, this); |
|
|
|
|
|
|
|
|
|
|
|
//Filling main layout
|
|
|
|
//Filling main layout
|
|
|
|
layout->addWidget(pathListView); |
|
|
|
layout->addWidget(pathListView); |
|
|
|
layout->addWidget(stackedWidget); |
|
|
|
layout->addWidget(centralWidget); |
|
|
|
layout->addWidget(mActionBar); |
|
|
|
layout->addWidget(mActionBar); |
|
|
|
|
|
|
|
|
|
|
|
connect(mNavigator->listView(), SIGNAL(clicked(const QModelIndex &)), this, SLOT(currentSelected(const QModelIndex &))); |
|
|
|
connect(centralWidget->listView(), SIGNAL(clicked(const QModelIndex &)), this, SLOT(currentSelected(const QModelIndex &))); |
|
|
|
connect(mActionBar, SIGNAL(searchElement(const QString &)), this, SLOT( searchStarted(const QString &))); |
|
|
|
connect(mActionBar, SIGNAL(searchElement(const QString &)), this, SLOT( searchStarted(const QString &))); |
|
|
|
connect(mActionBar, SIGNAL(newFolderToCreate()), this, SLOT(createNewFolder())); |
|
|
|
connect(mActionBar, SIGNAL(newFolderToCreate()), this, SLOT(createNewFolder())); |
|
|
|
connect(mActionBar, SIGNAL(deleteElements(const UBFeaturesMimeData *)), this, SLOT(deleteElements(const UBFeaturesMimeData *))); |
|
|
|
connect(mActionBar, SIGNAL(deleteElements(const UBFeaturesMimeData *)), this, SLOT(deleteElements(const UBFeaturesMimeData *))); |
|
|
@ -90,6 +75,12 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) |
|
|
|
connect(UBApplication::boardController, SIGNAL(displayMetadata(QMap<QString,QString>)), this, SLOT(onDisplayMetadata( QMap<QString,QString>))); |
|
|
|
connect(UBApplication::boardController, SIGNAL(displayMetadata(QMap<QString,QString>)), this, SLOT(onDisplayMetadata( QMap<QString,QString>))); |
|
|
|
connect(UBDownloadManager::downloadManager(), SIGNAL( addDownloadedFileToLibrary( bool, QUrl, QString, QByteArray)) |
|
|
|
connect(UBDownloadManager::downloadManager(), SIGNAL( addDownloadedFileToLibrary( bool, QUrl, QString, QByteArray)) |
|
|
|
, this, SLOT(onAddDownloadedFileToLibrary(bool, QUrl, QString,QByteArray))); |
|
|
|
, this, SLOT(onAddDownloadedFileToLibrary(bool, QUrl, QString,QByteArray))); |
|
|
|
|
|
|
|
connect(centralWidget, SIGNAL(lockMainWidget(bool)), this, SLOT(lockIt(bool))); |
|
|
|
|
|
|
|
connect(centralWidget, SIGNAL(createNewFolderSignal(QString)), controller, SLOT(addNewFolder(QString))); |
|
|
|
|
|
|
|
connect(controller, SIGNAL(scanStarted()), centralWidget, SLOT(scanStarted())); |
|
|
|
|
|
|
|
connect(controller, SIGNAL(scanFinished()), centralWidget, SLOT(scanFinished())); |
|
|
|
|
|
|
|
connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int))); |
|
|
|
|
|
|
|
connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SLOT(increaseStatusBarValue())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWidget::~UBFeaturesWidget() |
|
|
|
UBFeaturesWidget::~UBFeaturesWidget() |
|
|
@ -100,7 +91,7 @@ UBFeaturesWidget::~UBFeaturesWidget() |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::searchStarted(const QString &pattern) |
|
|
|
void UBFeaturesWidget::searchStarted(const QString &pattern) |
|
|
|
{ |
|
|
|
{ |
|
|
|
controller->searchStarted(pattern, mNavigator->listView()); |
|
|
|
controller->searchStarted(pattern, centralWidget->listView()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
|
void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
@ -110,25 +101,16 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Calling to reset the model for listView. Maybe separate function needed
|
|
|
|
|
|
|
|
controller->searchStarted("", mNavigator->listView()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString objName = sender()->objectName(); |
|
|
|
QString objName = sender()->objectName(); |
|
|
|
|
|
|
|
|
|
|
|
if (objName.isEmpty()) { |
|
|
|
if (objName.isEmpty()) { |
|
|
|
qWarning() << "incorrrect sender"; |
|
|
|
qWarning() << "incorrrect sender"; |
|
|
|
|
|
|
|
} else if (objName == objNamePathList) { |
|
|
|
|
|
|
|
//Calling to reset the model for listView. Maybe separate function needed
|
|
|
|
|
|
|
|
controller->searchStarted("", centralWidget->listView()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QListView *calledList = 0; |
|
|
|
UBFeature feature = controller->getFeature(current, objName); |
|
|
|
if (objName == objNamePathList) { |
|
|
|
|
|
|
|
calledList = pathListView; |
|
|
|
|
|
|
|
} else if (objName == objNameFeatureList) { |
|
|
|
|
|
|
|
calledList = mNavigator->listView(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeature feature = controller->getFeature(current, calledList); |
|
|
|
|
|
|
|
// QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( mNavigator->listView()->model() );
|
|
|
|
|
|
|
|
// UBFeature feature = model->data(current, Qt::UserRole + 1).value<UBFeature>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( feature.isFolder() ) { |
|
|
|
if ( feature.isFolder() ) { |
|
|
|
QString newPath = feature.getFullVirtualPath(); |
|
|
|
QString newPath = feature.getFullVirtualPath(); |
|
|
@ -136,7 +118,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
|
controller->setCurrentElement(feature); |
|
|
|
controller->setCurrentElement(feature); |
|
|
|
controller->siftElements(newPath); |
|
|
|
controller->siftElements(newPath); |
|
|
|
|
|
|
|
|
|
|
|
switchToListView(); |
|
|
|
centralWidget->switchTo(UBFeaturesCentralWidget::MainList); |
|
|
|
|
|
|
|
|
|
|
|
if ( feature.getType() == FEATURE_FAVORITE ) { |
|
|
|
if ( feature.getType() == FEATURE_FAVORITE ) { |
|
|
|
mActionBar->setCurrentState( IN_FAVORITE ); |
|
|
|
mActionBar->setCurrentState( IN_FAVORITE ); |
|
|
@ -145,35 +127,24 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) |
|
|
|
mActionBar->setCurrentState( IN_ROOT ); |
|
|
|
mActionBar->setCurrentState( IN_ROOT ); |
|
|
|
|
|
|
|
|
|
|
|
} else if (feature.getType() == FEATURE_TRASH) { |
|
|
|
} else if (feature.getType() == FEATURE_TRASH) { |
|
|
|
mActionBar->setCurrentState( IN_TRASH ); |
|
|
|
mActionBar->setCurrentState(IN_TRASH); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mActionBar->setCurrentState( IN_FOLDER ); |
|
|
|
mActionBar->setCurrentState(IN_FOLDER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else if ( feature.getType() == FEATURE_SEARCH ) { |
|
|
|
} else if (feature.getType() == FEATURE_SEARCH) { |
|
|
|
webView->showElement( feature ); |
|
|
|
centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturesWebView); |
|
|
|
switchToWebView(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
featureProperties->showElement( feature ); |
|
|
|
centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturePropertiesList); |
|
|
|
switchToProperties(); |
|
|
|
|
|
|
|
mActionBar->setCurrentState( IN_PROPERTIES ); |
|
|
|
mActionBar->setCurrentState( IN_PROPERTIES ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::createNewFolder() |
|
|
|
void UBFeaturesWidget::createNewFolder() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!mkFolderDlg) |
|
|
|
centralWidget->showAdditionalData(UBFeaturesCentralWidget::NewFolderDialog, UBFeaturesCentralWidget::Modal); |
|
|
|
{ |
|
|
|
|
|
|
|
mkFolderDlg = new UBNewFolderDlg(this); |
|
|
|
|
|
|
|
connect (mkFolderDlg, SIGNAL(accepted()), this, SLOT(addFolder())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mkFolderDlg->setWindowFlags(Qt::WindowStaysOnTopHint); |
|
|
|
|
|
|
|
mkFolderDlg->resize(this->size().width()-20 ,80); |
|
|
|
|
|
|
|
mkFolderDlg->move(5,this->size().height()-200); |
|
|
|
|
|
|
|
mkFolderDlg->show(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::addFolder() |
|
|
|
void UBFeaturesWidget::addFolder() |
|
|
@ -203,7 +174,7 @@ void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData ) |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::deleteSelectedElements() |
|
|
|
void UBFeaturesWidget::deleteSelectedElements() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QModelIndexList selected = mNavigator->listView()->selectionModel()->selectedIndexes(); |
|
|
|
QModelIndexList selected = centralWidget->listView()->selectionModel()->selectedIndexes(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ( QModelIndex sel, selected ) |
|
|
|
foreach ( QModelIndex sel, selected ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -224,6 +195,14 @@ void UBFeaturesWidget::rescanModel() |
|
|
|
controller->rescanModel(); |
|
|
|
controller->rescanModel(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::lockIt(bool pLock) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mActionBar->setEnabled(!pLock); |
|
|
|
|
|
|
|
pathListView->setEnabled(!pLock); |
|
|
|
|
|
|
|
centralWidget->setLockedExcludingAdditional(pLock); |
|
|
|
|
|
|
|
// pathListView->setLocked(true);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::addToFavorite( const UBFeaturesMimeData * mimeData ) |
|
|
|
void UBFeaturesWidget::addToFavorite( const UBFeaturesMimeData * mimeData ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( !mimeData->hasUrls() ) |
|
|
|
if ( !mimeData->hasUrls() ) |
|
|
@ -253,7 +232,7 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString previewImageUrl; |
|
|
|
QString previewImageUrl; |
|
|
|
|
|
|
|
|
|
|
|
switch (UBFileSystemUtils::mimeTypeFromUrl(QUrl(metadata["Url"]))) |
|
|
|
switch (static_cast<int>(UBFileSystemUtils::mimeTypeFromUrl(QUrl(metadata["Url"])))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case UBMimeType::RasterImage: |
|
|
|
case UBMimeType::RasterImage: |
|
|
|
case UBMimeType::VectorImage: |
|
|
|
case UBMimeType::VectorImage: |
|
|
@ -282,11 +261,10 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata ) |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeature feature( QString(), QPixmap(previewImageUrl), QString(), metadata["Url"], FEATURE_ITEM ); |
|
|
|
UBFeature feature( QString(), QImage(previewImageUrl), QString(), metadata["Url"], FEATURE_ITEM ); |
|
|
|
feature.setMetadata( metadata ); |
|
|
|
feature.setMetadata( metadata ); |
|
|
|
|
|
|
|
|
|
|
|
featureProperties->showElement( feature ); |
|
|
|
centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturePropertiesList); |
|
|
|
switchToProperties(); |
|
|
|
|
|
|
|
mActionBar->setCurrentState( IN_PROPERTIES ); |
|
|
|
mActionBar->setCurrentState( IN_PROPERTIES ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -298,12 +276,14 @@ void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QS |
|
|
|
Q_UNUSED(isBackground); |
|
|
|
Q_UNUSED(isBackground); |
|
|
|
Q_UNUSED(pSize); |
|
|
|
Q_UNUSED(pSize); |
|
|
|
Q_UNUSED(pPos); |
|
|
|
Q_UNUSED(pPos); |
|
|
|
|
|
|
|
Q_UNUSED(sourceUrl); |
|
|
|
|
|
|
|
Q_UNUSED(pContentTypeHeader) |
|
|
|
|
|
|
|
|
|
|
|
QImage img; |
|
|
|
QImage img; |
|
|
|
img.loadFromData(pData); |
|
|
|
img.loadFromData(pData); |
|
|
|
QPixmap pix = QPixmap::fromImage(img); |
|
|
|
QPixmap pix = QPixmap::fromImage(img); |
|
|
|
featureProperties->setOrigPixmap(pix); |
|
|
|
centralWidget->setPropertiesPixmap(pix); |
|
|
|
featureProperties->setThumbnail(pix); |
|
|
|
centralWidget->setPropertiesThumbnail(pix); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData) |
|
|
|
void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData) |
|
|
@ -318,14 +298,14 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( currentStackedWidget == ID_PROPERTIES ) { |
|
|
|
if ( centralWidget->currentView() == UBFeaturesCentralWidget::FeaturePropertiesList ) { |
|
|
|
UBFeature feature = featureProperties->getCurrentElement(); |
|
|
|
UBFeature feature = centralWidget->getCurElementFromProperties(); |
|
|
|
if ( feature != UBFeature() && !UBApplication::isFromWeb(feature.getFullPath().toString())) { |
|
|
|
if ( feature != UBFeature() && !UBApplication::isFromWeb(feature.getFullPath().toString())) { |
|
|
|
controller->addToFavorite( feature.getFullPath() ); |
|
|
|
controller->addToFavorite( feature.getFullPath() ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else if ( currentStackedWidget == ID_LISTVIEW ) { |
|
|
|
} else if ( centralWidget->currentView() == UBFeaturesCentralWidget::MainList ) { |
|
|
|
QModelIndexList selected = mNavigator->listView()->selectionModel()->selectedIndexes(); |
|
|
|
QModelIndexList selected = centralWidget->listView()->selectionModel()->selectedIndexes(); |
|
|
|
for ( int i = 0; i < selected.size(); ++i ) { |
|
|
|
for ( int i = 0; i < selected.size(); ++i ) { |
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
controller->addToFavorite(feature.getFullPath()); |
|
|
|
controller->addToFavorite(feature.getFullPath()); |
|
|
@ -337,7 +317,7 @@ void UBFeaturesWidget::addElementsToFavorite() |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::removeElementsFromFavorite() |
|
|
|
void UBFeaturesWidget::removeElementsFromFavorite() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QModelIndexList selected = mNavigator->listView()->selectionModel()->selectedIndexes(); |
|
|
|
QModelIndexList selected = centralWidget->listView()->selectionModel()->selectedIndexes(); |
|
|
|
QList <QUrl> items; |
|
|
|
QList <QUrl> items; |
|
|
|
for ( int i = 0; i < selected.size(); ++i ) { |
|
|
|
for ( int i = 0; i < selected.size(); ++i ) { |
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
|
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>(); |
|
|
@ -363,20 +343,20 @@ void UBFeaturesWidget::resizeEvent(QResizeEvent *event) |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToListView() |
|
|
|
void UBFeaturesWidget::switchToListView() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stackedWidget->setCurrentIndex(ID_LISTVIEW); |
|
|
|
// stackedWidget->setCurrentIndex(ID_LISTVIEW);
|
|
|
|
currentStackedWidget = ID_LISTVIEW; |
|
|
|
// currentStackedWidget = ID_LISTVIEW;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToProperties() |
|
|
|
void UBFeaturesWidget::switchToProperties() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stackedWidget->setCurrentIndex(ID_PROPERTIES); |
|
|
|
// stackedWidget->setCurrentIndex(ID_PROPERTIES);
|
|
|
|
currentStackedWidget = ID_PROPERTIES; |
|
|
|
// currentStackedWidget = ID_PROPERTIES;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesWidget::switchToWebView() |
|
|
|
void UBFeaturesWidget::switchToWebView() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stackedWidget->setCurrentIndex(ID_WEBVIEW); |
|
|
|
// stackedWidget->setCurrentIndex(ID_WEBVIEW);
|
|
|
|
currentStackedWidget = ID_WEBVIEW; |
|
|
|
// currentStackedWidget = ID_WEBVIEW;
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList UBFeaturesMimeData::formats() const |
|
|
|
QStringList UBFeaturesMimeData::formats() const |
|
|
@ -390,7 +370,7 @@ void UBFeaturesWidget::importImage(const QImage &image, const QString &fileName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
|
|
|
|
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
|
|
|
|
: QListView(parent) |
|
|
|
: QListView(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
} |
|
|
|
} |
|
|
@ -423,7 +403,7 @@ void UBFeaturesListView::dragMoveEvent( QDragMoveEvent *event ) |
|
|
|
void UBFeaturesListView::dropEvent( QDropEvent *event ) |
|
|
|
void UBFeaturesListView::dropEvent( QDropEvent *event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QWidget *eventSource = event->source(); |
|
|
|
QWidget *eventSource = event->source(); |
|
|
|
if (eventSource && eventSource->objectName() == objNameFeatureList) { |
|
|
|
if (eventSource && eventSource->objectName() == UBFeaturesWidget::objNameFeatureList) { |
|
|
|
event->setDropAction( Qt::MoveAction ); |
|
|
|
event->setDropAction( Qt::MoveAction ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -445,9 +425,9 @@ UBFeaturesNavigatorWidget::UBFeaturesNavigatorWidget(QWidget *parent, const char |
|
|
|
name = "UBFeaturesNavigatorWidget"; |
|
|
|
name = "UBFeaturesNavigatorWidget"; |
|
|
|
|
|
|
|
|
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
SET_STYLE_SHEET() |
|
|
|
// SET_STYLE_SHEET()
|
|
|
|
|
|
|
|
|
|
|
|
mListView = new UBFeaturesListView(this, objNameFeatureList); |
|
|
|
mListView = new UBFeaturesListView(this, UBFeaturesWidget::objNameFeatureList); |
|
|
|
|
|
|
|
|
|
|
|
mListSlder = new QSlider(Qt::Horizontal, this); |
|
|
|
mListSlder = new QSlider(Qt::Horizontal, this); |
|
|
|
|
|
|
|
|
|
|
@ -461,7 +441,7 @@ UBFeaturesNavigatorWidget::UBFeaturesNavigatorWidget(QWidget *parent, const char |
|
|
|
|
|
|
|
|
|
|
|
mainLayer->addWidget(mListView, 1); |
|
|
|
mainLayer->addWidget(mListView, 1); |
|
|
|
mainLayer->addWidget(mListSlder, 0); |
|
|
|
mainLayer->addWidget(mListSlder, 0); |
|
|
|
|
|
|
|
mainLayer->setMargin(0); |
|
|
|
|
|
|
|
|
|
|
|
connect(mListSlder, SIGNAL(valueChanged(int)), mListView, SLOT(thumbnailSizeChanged(int))); |
|
|
|
connect(mListSlder, SIGNAL(valueChanged(int)), mListView, SLOT(thumbnailSizeChanged(int))); |
|
|
|
} |
|
|
|
} |
|
|
@ -471,6 +451,207 @@ void UBFeaturesNavigatorWidget::setSliderPosition(int pValue) |
|
|
|
mListSlder->setValue(pValue); |
|
|
|
mListSlder->setValue(pValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(parent) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
setObjectName("UBFeaturesCentralWidget"); |
|
|
|
|
|
|
|
SET_STYLE_SHEET(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *mLayout = new QVBoxLayout(this); |
|
|
|
|
|
|
|
setLayout(mLayout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Maintains the view of the main part of the palette. Consists of
|
|
|
|
|
|
|
|
//mNavigator
|
|
|
|
|
|
|
|
//featureProperties
|
|
|
|
|
|
|
|
//webVeiw
|
|
|
|
|
|
|
|
mStackedWidget = new QStackedWidget(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Main features icon view with QSlider on the bottom
|
|
|
|
|
|
|
|
mNavigator = new UBFeaturesNavigatorWidget(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Specifies the properties of a standalone element
|
|
|
|
|
|
|
|
mFeatureProperties = new UBFeatureProperties(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Used to show search bar on the search widget
|
|
|
|
|
|
|
|
webView = new UBFeaturesWebView(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//filling stackwidget
|
|
|
|
|
|
|
|
mStackedWidget->addWidget(mNavigator); |
|
|
|
|
|
|
|
mStackedWidget->addWidget(mFeatureProperties); |
|
|
|
|
|
|
|
mStackedWidget->addWidget(webView); |
|
|
|
|
|
|
|
mStackedWidget->setCurrentIndex(MainList); |
|
|
|
|
|
|
|
mStackedWidget->setContentsMargins(0, 0, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mAdditionalDataContainer = new QStackedWidget(this); |
|
|
|
|
|
|
|
mAdditionalDataContainer->setObjectName("mAdditionalDataContainer"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//New folder dialog
|
|
|
|
|
|
|
|
UBFeaturesNewFolderDialog *dlg = new UBFeaturesNewFolderDialog(mAdditionalDataContainer); |
|
|
|
|
|
|
|
mAdditionalDataContainer->addWidget(dlg); |
|
|
|
|
|
|
|
mAdditionalDataContainer->setCurrentIndex(NewFolderDialog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(dlg, SIGNAL(createNewFolder(QString)), this, SLOT(createNewFolderSlot(QString))); |
|
|
|
|
|
|
|
connect(dlg, SIGNAL(closeDialog()), this, SLOT(hideAdditionalData())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Progress bar to show scanning progress
|
|
|
|
|
|
|
|
QProgressBar *progressBar = new QProgressBar(); |
|
|
|
|
|
|
|
mAdditionalDataContainer->addWidget(progressBar); |
|
|
|
|
|
|
|
mAdditionalDataContainer->setCurrentIndex(ProgressBarWidget); |
|
|
|
|
|
|
|
progressBar->setMinimum(0); |
|
|
|
|
|
|
|
progressBar->setValue(0); |
|
|
|
|
|
|
|
progressBar->setMaximum(10000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setMaximum(int))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mLayout->addWidget(mStackedWidget, 1); |
|
|
|
|
|
|
|
mLayout->addWidget(mAdditionalDataContainer, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mAdditionalDataContainer->hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::showElement(const UBFeature &feature, StackElement pView) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (pView == FeaturesWebView) { |
|
|
|
|
|
|
|
webView->showElement(feature); |
|
|
|
|
|
|
|
mStackedWidget->setCurrentIndex(FeaturesWebView); |
|
|
|
|
|
|
|
} else if (pView == FeaturePropertiesList) { |
|
|
|
|
|
|
|
mFeatureProperties->showElement(feature); |
|
|
|
|
|
|
|
mStackedWidget->setCurrentIndex(FeaturePropertiesList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::switchTo(StackElement pView) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mStackedWidget->setCurrentIndex(pView); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::setPropertiesPixmap(const QPixmap &pix) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mFeatureProperties->setOrigPixmap(pix); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::setPropertiesThumbnail(const QPixmap &pix) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mFeatureProperties->setThumbnail(pix); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeature UBFeaturesCentralWidget::getCurElementFromProperties() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return mFeatureProperties->getCurrentElement(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mAdditionalDataContainer->setMaximumHeight(mAdditionalDataContainer->widget(pWidgetType)->sizeHint().height()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mAdditionalDataContainer->setCurrentIndex(pWidgetType); |
|
|
|
|
|
|
|
mAdditionalDataContainer->show(); |
|
|
|
|
|
|
|
emit lockMainWidget(pState == Modal ? true : false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::setLockedExcludingAdditional(bool pLock) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Lock all the members excluding mAdditionalDataContainer
|
|
|
|
|
|
|
|
mStackedWidget->setEnabled(!pLock); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::createNewFolderSlot(QString pStr) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
emit createNewFolderSignal(pStr); |
|
|
|
|
|
|
|
hideAdditionalData(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::hideAdditionalData() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
emit lockMainWidget(false); |
|
|
|
|
|
|
|
mAdditionalDataContainer->hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::scanStarted() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget)); |
|
|
|
|
|
|
|
if (progressBar && !progressBar->isVisible()) { |
|
|
|
|
|
|
|
showAdditionalData((AddWidget)1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::scanFinished() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget)); |
|
|
|
|
|
|
|
if (progressBar && progressBar->isVisible()) { |
|
|
|
|
|
|
|
hideAdditionalData(); |
|
|
|
|
|
|
|
qDebug() << "progressBar max value is " << progressBar->maximum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesCentralWidget::increaseStatusBarValue() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget)); |
|
|
|
|
|
|
|
if (progressBar) { |
|
|
|
|
|
|
|
progressBar->setValue(progressBar->value() + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// SET_STYLE_SHEET()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->setStyleSheet("background:white;"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout(); |
|
|
|
|
|
|
|
setLayout(mainLayout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *labelLayout = new QVBoxLayout(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLabel *mLabel = new QLabel(labelText, this); |
|
|
|
|
|
|
|
mLineEdit = new QLineEdit(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mValidator = new QRegExpValidator(QRegExp("[\^\/\:\?\*\|\<\>\"]{2,}")); |
|
|
|
|
|
|
|
mLineEdit->setValidator(mValidator); |
|
|
|
|
|
|
|
labelLayout->addWidget(mLabel); |
|
|
|
|
|
|
|
labelLayout->addWidget(mLineEdit); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout *buttonLayout = new QHBoxLayout(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPushButton *acceptButton = new QPushButton(acceptText, this); |
|
|
|
|
|
|
|
QPushButton *cancelButton = new QPushButton(cancelText, this); |
|
|
|
|
|
|
|
buttonLayout->addWidget(acceptButton); |
|
|
|
|
|
|
|
buttonLayout->addWidget(cancelButton); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainLayout->addLayout(labelLayout); |
|
|
|
|
|
|
|
mainLayout->addLayout(buttonLayout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(acceptButton, SIGNAL(clicked()), this, SLOT(accept())); |
|
|
|
|
|
|
|
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesNewFolderDialog::setRegexp(const QRegExp pRegExp) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mValidator->setRegExp(pRegExp); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBFeaturesNewFolderDialog::accept() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Setting all the constraints we need
|
|
|
|
|
|
|
|
emit createNewFolder(mLineEdit->text()); |
|
|
|
|
|
|
|
mLineEdit->clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void UBFeaturesNewFolderDialog::reject() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mLineEdit->clear(); |
|
|
|
|
|
|
|
emit closeDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) |
|
|
|
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) |
|
|
|
, mpView(NULL) |
|
|
|
, mpView(NULL) |
|
|
|
, mpWebSettings(NULL) |
|
|
|
, mpWebSettings(NULL) |
|
|
@ -499,6 +680,7 @@ UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget( |
|
|
|
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true); |
|
|
|
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true); |
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addWidget(mpView); |
|
|
|
mpLayout->addWidget(mpView); |
|
|
|
|
|
|
|
mpLayout->setMargin(0); |
|
|
|
|
|
|
|
|
|
|
|
connect(mpView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
|
|
|
connect(mpView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
|
|
|
} |
|
|
|
} |
|
|
@ -578,8 +760,6 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
|
|
SET_STYLE_SHEET(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create the GUI
|
|
|
|
// Create the GUI
|
|
|
|
mpLayout = new QVBoxLayout(this); |
|
|
|
mpLayout = new QVBoxLayout(this); |
|
|
|
setLayout(mpLayout); |
|
|
|
setLayout(mpLayout); |
|
|
@ -625,6 +805,7 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : |
|
|
|
mpObjInfos->setObjectName("DockPaletteWidgetBox"); |
|
|
|
mpObjInfos->setObjectName("DockPaletteWidgetBox"); |
|
|
|
mpObjInfos->setStyleSheet("background:white;"); |
|
|
|
mpObjInfos->setStyleSheet("background:white;"); |
|
|
|
mpLayout->addWidget(mpObjInfos, 1); |
|
|
|
mpLayout->addWidget(mpObjInfos, 1); |
|
|
|
|
|
|
|
mpLayout->setMargin(0); |
|
|
|
|
|
|
|
|
|
|
|
connect( mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()) ); |
|
|
|
connect( mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()) ); |
|
|
|
connect( mpSetAsBackgroundButton, SIGNAL( clicked() ), this, SLOT( onSetAsBackground() ) ); |
|
|
|
connect( mpSetAsBackgroundButton, SIGNAL( clicked() ), this, SLOT( onSetAsBackground() ) ); |
|
|
@ -700,7 +881,7 @@ UBFeature UBFeatureProperties::getCurrentElement() const |
|
|
|
return UBFeature(); |
|
|
|
return UBFeature(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::setOrigPixmap(QPixmap &pix) |
|
|
|
void UBFeatureProperties::setOrigPixmap(const QPixmap &pix) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (mpOrigPixmap) |
|
|
|
if (mpOrigPixmap) |
|
|
@ -709,7 +890,7 @@ void UBFeatureProperties::setOrigPixmap(QPixmap &pix) |
|
|
|
mpOrigPixmap = new QPixmap(pix); |
|
|
|
mpOrigPixmap = new QPixmap(pix); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::setThumbnail(QPixmap &pix) |
|
|
|
void UBFeatureProperties::setThumbnail(const QPixmap &pix) |
|
|
|
{
|
|
|
|
{
|
|
|
|
mpThumbnail->setPixmap(pix.scaledToWidth(THUMBNAIL_WIDTH)); |
|
|
|
mpThumbnail->setPixmap(pix.scaledToWidth(THUMBNAIL_WIDTH)); |
|
|
|
adaptSize(); |
|
|
|
adaptSize(); |
|
|
@ -730,7 +911,7 @@ void UBFeatureProperties::adaptSize() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::showElement( const UBFeature &elem ) |
|
|
|
void UBFeatureProperties::showElement(const UBFeature &elem) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( mpOrigPixmap ) |
|
|
|
if ( mpOrigPixmap ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -742,9 +923,9 @@ void UBFeatureProperties::showElement( const UBFeature &elem ) |
|
|
|
delete mpElement; |
|
|
|
delete mpElement; |
|
|
|
mpElement = NULL; |
|
|
|
mpElement = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
mpElement = new UBFeature( elem ); |
|
|
|
mpElement = new UBFeature(elem); |
|
|
|
mpOrigPixmap = new QPixmap( elem.getThumbnail() ); |
|
|
|
mpOrigPixmap = new QPixmap(QPixmap::fromImage(elem.getThumbnail())); |
|
|
|
mpThumbnail->setPixmap(elem.getThumbnail().scaledToWidth(THUMBNAIL_WIDTH)); |
|
|
|
mpThumbnail->setPixmap(QPixmap::fromImage(elem.getThumbnail()).scaledToWidth(THUMBNAIL_WIDTH)); |
|
|
|
populateMetadata(); |
|
|
|
populateMetadata(); |
|
|
|
|
|
|
|
|
|
|
|
if ( UBApplication::isFromWeb( elem.getFullPath().toString() ) ) |
|
|
|
if ( UBApplication::isFromWeb( elem.getFullPath().toString() ) ) |
|
|
@ -794,8 +975,8 @@ void UBFeatureProperties::populateMetadata() |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::onAddToPage() |
|
|
|
void UBFeatureProperties::onAddToPage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QWidget *w = parentWidget()->parentWidget(); |
|
|
|
QWidget *w = parentWidget()->parentWidget()->parentWidget(); |
|
|
|
UBFeaturesWidget* featuresWidget = dynamic_cast<UBFeaturesWidget*>( w ); |
|
|
|
UBFeaturesWidget* featuresWidget = qobject_cast<UBFeaturesWidget*>( w ); |
|
|
|
if (featuresWidget) |
|
|
|
if (featuresWidget) |
|
|
|
featuresWidget->getFeaturesController()->addItemToPage( *mpElement ); |
|
|
|
featuresWidget->getFeaturesController()->addItemToPage( *mpElement ); |
|
|
|
} |
|
|
|
} |
|
|
@ -818,8 +999,8 @@ void UBFeatureProperties::onAddToLib() |
|
|
|
|
|
|
|
|
|
|
|
void UBFeatureProperties::onSetAsBackground() |
|
|
|
void UBFeatureProperties::onSetAsBackground() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QWidget *w = parentWidget()->parentWidget(); |
|
|
|
QWidget *w = parentWidget()->parentWidget()->parentWidget(); |
|
|
|
UBFeaturesWidget* featuresWidget = dynamic_cast<UBFeaturesWidget*>( w ); |
|
|
|
UBFeaturesWidget* featuresWidget = qobject_cast<UBFeaturesWidget*>( w ); |
|
|
|
featuresWidget->getFeaturesController()->addItemAsBackground( *mpElement ); |
|
|
|
featuresWidget->getFeaturesController()->addItemAsBackground( *mpElement ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -845,7 +1026,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if (role == Qt::DecorationRole) { |
|
|
|
else if (role == Qt::DecorationRole) { |
|
|
|
return QIcon( featuresList->at(index.row()).getThumbnail() ); |
|
|
|
return QIcon( QPixmap::fromImage(featuresList->at(index.row()).getThumbnail())); |
|
|
|
|
|
|
|
|
|
|
|
} else if (role == Qt::UserRole) { |
|
|
|
} else if (role == Qt::UserRole) { |
|
|
|
return featuresList->at(index.row()).getVirtualPath(); |
|
|
|
return featuresList->at(index.row()).getVirtualPath(); |
|
|
@ -1017,7 +1198,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina |
|
|
|
QString sourceVirtualPath = source.getVirtualPath(); |
|
|
|
QString sourceVirtualPath = source.getVirtualPath(); |
|
|
|
|
|
|
|
|
|
|
|
UBFeatureElementType sourceType = source.getType(); |
|
|
|
UBFeatureElementType sourceType = source.getType(); |
|
|
|
QPixmap sourceIcon = source.getThumbnail(); |
|
|
|
QImage sourceIcon = source.getThumbnail(); |
|
|
|
|
|
|
|
|
|
|
|
Q_ASSERT( QFileInfo( sourcePath ).exists() ); |
|
|
|
Q_ASSERT( QFileInfo( sourcePath ).exists() ); |
|
|
|
|
|
|
|
|
|
|
@ -1183,7 +1364,7 @@ void UBFeaturesPathItemDelegate::paint( QPainter *painter, const QStyleOptionVie |
|
|
|
{ |
|
|
|
{ |
|
|
|
painter->drawPixmap( rect.left() - 10, rect.center().y() - 5, *arrowPixmap ); |
|
|
|
painter->drawPixmap( rect.left() - 10, rect.center().y() - 5, *arrowPixmap ); |
|
|
|
} |
|
|
|
} |
|
|
|
painter->drawPixmap( rect.left() + 5, rect.center().y() - 5, feature.getThumbnail().scaledToHeight( 30, Qt::SmoothTransformation ) ); |
|
|
|
painter->drawImage( rect.left() + 5, rect.center().y() - 5, feature.getThumbnail().scaledToHeight( 30, Qt::SmoothTransformation ) ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBFeaturesPathItemDelegate::~UBFeaturesPathItemDelegate() |
|
|
|
UBFeaturesPathItemDelegate::~UBFeaturesPathItemDelegate() |
|
|
|