Sankore 942 Trap flash content

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent 38d759fd4a
commit 021617ee3e
  1. 26
      src/board/UBBoardController.cpp
  2. 7
      src/board/UBBoardController.h
  3. 17
      src/board/UBFeaturesController.cpp
  4. 2
      src/board/UBFeaturesController.h
  5. 5
      src/gui/UBFeaturesWidget.cpp
  6. 5
      src/gui/UBFeaturesWidget.h

@ -53,6 +53,8 @@
#include "domain/UBPageSizeUndoCommand.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBItem.h"
#include "board/UBFeaturesController.h"
#include "gui/UBFeaturesWidget.h"
#include "tools/UBToolsManager.h"
@ -897,7 +899,7 @@ void UBBoardController::groupButtonClicked()
}
}
void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const QSize& pSize, bool isBackground)
void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const QSize& pSize, bool isBackground, bool internalData)
{
qDebug() << "something has been dropped on the board! Url is: " << url.toString();
QString sUrl = url.toString();
@ -922,7 +924,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
if (shouldLoadFileData)
file.open(QIODevice::ReadOnly);
downloadFinished(true, url, contentType, file.readAll(), pPos, pSize, isBackground);
downloadFinished(true, url, contentType, file.readAll(), pPos, pSize, isBackground, internalData);
if (shouldLoadFileData)
file.close();
@ -945,7 +947,9 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
}
UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground)
UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader,
QByteArray pData, QPointF pPos, QSize pSize,
bool isBackground, bool internalData)
{
QString mimeType = pContentTypeHeader;
@ -1155,7 +1159,10 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
else
size = mActiveScene->nominalSize() * .8;
Q_UNUSED(internalData)
QString widgetUrl = UBGraphicsW3CWidgetItem::createNPAPIWrapper(sUrl, mimeType, size);
emit npapiWidgetCreated(widgetUrl);
if (widgetUrl.length() > 0)
{
@ -1339,7 +1346,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
mActiveSceneIndex = index;
setDocument(pDocumentProxy, forceReload);
updateSystemScaleFactor();
mControlView->setScene(mActiveScene);
@ -1668,13 +1674,11 @@ void UBBoardController::hide()
UBApplication::mainWindow->actionLibrary->setChecked(false);
}
void UBBoardController::show()
{
UBApplication::mainWindow->actionLibrary->setChecked(false);
}
void UBBoardController::persistCurrentScene()
{
if(UBPersistenceManager::persistenceManager()
@ -1689,7 +1693,6 @@ void UBBoardController::persistCurrentScene()
}
}
void UBBoardController::updateSystemScaleFactor()
{
qreal newScaleFactor = 1.0;
@ -2100,9 +2103,16 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
int index = 0;
const UBFeaturesMimeData *internalMimeData = qobject_cast<const UBFeaturesMimeData*>(pMimeData);
bool internalData = false;
if (internalMimeData) {
internalData = true;
}
foreach(const QUrl url, urls){
QPointF pos(pPos + QPointF(index * 15, index * 15));
downloadURL(url, pos);
downloadURL(url, pos, QSize(), false, internalData);
index++;
}

@ -189,8 +189,10 @@ class UBBoardController : public UBDocumentContainer
void firstScene();
void lastScene();
void groupButtonClicked();
void downloadURL(const QUrl& url, const QPointF& pPos = QPointF(0.0, 0.0), const QSize& pSize = QSize(), bool isBackground = false);
UBItem *downloadFinished(bool pSuccess, QUrl sourceUrl, QString pHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground = false);
void downloadURL(const QUrl& url, const QPointF& pPos = QPointF(0.0, 0.0), const QSize& pSize = QSize(), bool isBackground = false, bool internalData = false);
UBItem *downloadFinished(bool pSuccess, QUrl sourceUrl, QString pHeader,
QByteArray pData, QPointF pPos, QSize pSize,
bool isBackground = false, bool internalData = false);
void changeBackground(bool isDark, bool isCrossed);
void setToolCursor(int tool);
void showMessage(const QString& message, bool showSpinningWheel = false);
@ -236,6 +238,7 @@ class UBBoardController : public UBDocumentContainer
void documentReorganized(int index);
void displayMetadata(QMap<QString, QString> metadata);
void pageSelectionChanged(int index);
void npapiWidgetCreated(const QString &Url);
protected:
void setupViews();

@ -154,7 +154,9 @@ void UBFeaturesComputingThread::run()
emit maxFilesCountEvaluated(fsCnt);
emit scanStarted();
curTime = QTime::currentTime();
scanAll(searchData, favoriteSet);
qDebug() << "Time on finishing" << curTime.msecsTo(QTime::currentTime());
emit scanFinished();
mMutex.lock();
@ -303,6 +305,7 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
connect(&mCThread, SIGNAL(maxFilesCountEvaluated(int)), this, SIGNAL(maxFilesCountEvaluated(int)));
connect(&mCThread, SIGNAL(scanCategory(QString)), this, SIGNAL(scanCategory(QString)));
connect(&mCThread, SIGNAL(scanPath(QString)), this, SIGNAL(scanPath(QString)));
connect(UBApplication::boardController, SIGNAL(npapiWidgetCreated(QString)), this, SLOT(createNpApiFeature(QString)));
QTimer::singleShot(0, this, SLOT(startThread()));
}
@ -331,6 +334,15 @@ void UBFeaturesController::startThread()
mCThread.compute(computingData, favoriteSet);
}
void UBFeaturesController::createNpApiFeature(const QString &str)
{
Q_ASSERT(QFileInfo(str).exists() && QFileInfo(str).isDir());
QString widgetName = QFileInfo(str).fileName();
featuresModel->addItem(UBFeature(QString(appPath+"/Web"), QImage(UBGraphicsWidgetItem::iconFilePath(QUrl::fromLocalFile(str))), widgetName, QUrl::fromLocalFile(str), FEATURE_INTERACTIVE));
}
void UBFeaturesController::scanFS()
{
featuresList->clear();
@ -502,6 +514,8 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path)
if ( mimeString.contains("application")) {
if (mimeString.contains("application/search")) {
fileType = FEATURE_SEARCH;
} else if (mimeString.contains("application/x-shockwave-flash")) {
fileType = FEATURE_FLASH;
} else {
fileType = FEATURE_INTERACTIVE;
}
@ -530,6 +544,8 @@ QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType p
return QImage(UBGraphicsWidgetItem::iconFilePath(QUrl::fromLocalFile(path)));
} else if (pFType == FEATURE_INTERNAL) {
return QImage(UBToolsManager::manager()->iconFromToolId(path));
} else if (pFType == FEATURE_FLASH) {
return QImage(":images/libpalette/FlashIcon.svg");
} else if (pFType == FEATURE_AUDIO) {
return QImage(":images/libpalette/soundIcon.svg");
} else if (pFType == FEATURE_VIDEO) {
@ -802,6 +818,7 @@ void UBFeaturesController::searchStarted(const QString &pattern, QListView *pOnV
curListModel = featuresProxyModel;
} else if ( pattern.size() > 1 ) {
// featuresSearchModel->setFilterPrefix(currentElement.getFullVirtualPath());
featuresSearchModel->setFilterWildcard( "*" + pattern + "*" );
pOnView->setModel(featuresSearchModel );
featuresSearchModel->invalidate();

@ -78,6 +78,7 @@ enum UBFeatureElementType
FEATURE_AUDIO,
FEATURE_VIDEO,
FEATURE_IMAGE,
FEATURE_FLASH,
FEATURE_TRASH,
FEATURE_FAVORITE,
FEATURE_SEARCH,
@ -192,6 +193,7 @@ signals:
private slots:
void addNewFolder(QString name);
void startThread();
void createNpApiFeature(const QString &str);
private:

@ -1337,6 +1337,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
|| item.getType() == FEATURE_AUDIO
|| item.getType() == FEATURE_VIDEO
|| item.getType() == FEATURE_IMAGE
|| item.getType() == FEATURE_FLASH
|| item.getType() == FEATURE_INTERNAL
|| item.getType() == FEATURE_FOLDER)
@ -1387,7 +1388,9 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
|| feature.getType() == FEATURE_VIDEO
|| feature.getType() == FEATURE_IMAGE;
return isFile && filterRegExp().exactMatch( feature.getName() );
return isFile
&& feature.getFullVirtualPath().contains(mFilterPrefix)
&& filterRegExp().exactMatch( feature.getName() );
}
bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex & sourceParent )const

@ -394,10 +394,13 @@ class UBFeaturesSearchProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), mFilterPrefix() {;}
virtual ~UBFeaturesSearchProxyModel() {}
void setFilterPrefix(const QString &newPrefix) {mFilterPrefix = newPrefix;}
protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
private:
QString mFilterPrefix;
};
class UBFeaturesPathProxyModel : public QSortFilterProxyModel

Loading…
Cancel
Save