Commit 5a7c3501 authored by Claudio Valerio's avatar Claudio Valerio

Merge branch 'master' of github.com:Sankore/Sankore-3.1

parents c9252aca 48a43154
...@@ -5,15 +5,21 @@ QWidget#UBLibNavigatorWidget, ...@@ -5,15 +5,21 @@ QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties, QWidget#UBLibItemProperties,
QWidget#UBDownloadWidget, QWidget#UBDownloadWidget,
QWidget#UBTeacherGuideWidget, QWidget#UBTeacherGuideWidget,
QWidget#UBFeatureProperties,
QWidget#UBFeaturesNavigatorWidget, QWidget#UBFeaturesNavigatorWidget,
QWidget#PathList QWidget#PathList,
QWidget#UBFeaturesCentralWidget
{ {
background: #EEEEEE; background: #EEEEEE;
border-radius: 10px; border-radius: 10px;
border: 2px solid #999999; border: 2px solid #999999;
} }
QWidget#mAdditionalDataContainer
{
border-radius: 10px;
border: 2px solid #999999;
}
QWidget#UBMediaVideoContainer QWidget#UBMediaVideoContainer
{ {
background: #000000; background: #000000;
...@@ -33,12 +39,9 @@ QListView ...@@ -33,12 +39,9 @@ QListView
border: 0px; border: 0px;
} }
QWidget#UBFeatureProperties
QWidget#UBFeaturesWebView
{ {
background: #EEEEEE; border: 2px;
border-radius : 10px;
border: 2px solid #999999;
} }
QWebView#SearchEngineView QWebView#SearchEngineView
......
This diff is collapsed.
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
#include <QUrl> #include <QUrl>
#include <QByteArray> #include <QByteArray>
#include <QtGui> #include <QtGui>
#include <QImage>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
class UBFeaturesModel; class UBFeaturesModel;
class UBFeaturesItemDelegate; class UBFeaturesItemDelegate;
...@@ -20,8 +24,45 @@ class UBFeaturesProxyModel; ...@@ -20,8 +24,45 @@ class UBFeaturesProxyModel;
class UBFeaturesSearchProxyModel; class UBFeaturesSearchProxyModel;
class UBFeaturesPathProxyModel; class UBFeaturesPathProxyModel;
class UBFeaturesListView; class UBFeaturesListView;
class UBFeature;
class UBFeaturesComputingThread : public QThread
{
Q_OBJECT
public:
explicit UBFeaturesComputingThread(QObject *parent = 0);
virtual ~UBFeaturesComputingThread();
void compute(const QList<QPair<QUrl, QString> > &pScanningData);
protected:
void run();
signals:
void sendFeature(UBFeature pFeature);
void featureSent();
void scanStarted();
void scanFinished();
void maxFilesCountEvaluated(int max);
public slots:
private:
void scanFS(const QUrl & currentPath, const QString & currVirtualPath);
void scanAll(QList<QPair<QUrl, QString> > pScanningData);
int featuresCount(const QUrl &pPath);
int featuresCountAll(QList<QPair<QUrl, QString> > pScanningData);
private:
QMutex mMutex;
QWaitCondition mWaitCondition;
QUrl mScanningPath;
QString mScanningVirtualPath;
QList<QPair<QUrl, QString> > mScanningData;
bool restart;
bool abort;
};
//#include "UBDockPaletteWidget.h"
enum UBFeatureElementType enum UBFeatureElementType
{ {
...@@ -41,12 +82,12 @@ class UBFeature ...@@ -41,12 +82,12 @@ class UBFeature
{ {
public: public:
UBFeature() {;} UBFeature() {;}
//UBFeature(const UBFeature &f); // UBFeature(const UBFeature &f);
UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QUrl &realPath, UBFeatureElementType type = FEATURE_CATEGORY); UBFeature(const QString &url, const QImage &icon, const QString &name, const QUrl &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
// UBFeature(); // UBFeature();
virtual ~UBFeature(); virtual ~UBFeature();
QString getName() const { return mName; } QString getName() const { return mName; }
QPixmap getThumbnail() const {return mThumbnail;} QImage getThumbnail() const {return mThumbnail;}
QString getVirtualPath() const { return virtualDir; } QString getVirtualPath() const { return virtualDir; }
//QString getPath() const { return mPath; }; //QString getPath() const { return mPath; };
QUrl getFullPath() const { return mPath; } QUrl getFullPath() const { return mPath; }
...@@ -64,20 +105,13 @@ public: ...@@ -64,20 +105,13 @@ public:
const QMap<QString,QString> & getMetadata() const { return metadata; } const QMap<QString,QString> & getMetadata() const { return metadata; }
void setMetadata( const QMap<QString,QString> &data ) { metadata = data; } void setMetadata( const QMap<QString,QString> &data ) { metadata = data; }
bool hasChildren() const {return mChildren.count();}
bool hasParents() const {return mParents.count();}
bool hasRelationships() const {return mChildren.count() && mParents.count();}
private: private:
QString virtualDir; QString virtualDir;
QPixmap mThumbnail; QImage mThumbnail;
QString mName; QString mName;
QUrl mPath; QUrl mPath;
UBFeatureElementType elementType; UBFeatureElementType elementType;
QMap<QString,QString> metadata; QMap<QString,QString> metadata;
QList<UBFeature*> mChildren;
QList<UBFeature*> mParents;
}; };
Q_DECLARE_METATYPE( UBFeature ) Q_DECLARE_METATYPE( UBFeature )
...@@ -111,7 +145,7 @@ public: ...@@ -111,7 +145,7 @@ public:
void rescanModel(); void rescanModel();
void siftElements(const QString &pSiftValue); void siftElements(const QString &pSiftValue);
//TODO make less complicated for betteer maintainence //TODO make less complicated for betteer maintainence
UBFeature getFeature(const QModelIndex &index, QListView *pOnView); UBFeature getFeature(const QModelIndex &index, const QString &listName);
void searchStarted(const QString &pattern, QListView *pOnView); void searchStarted(const QString &pattern, QListView *pOnView);
void refreshModels(); void refreshModels();
...@@ -119,18 +153,17 @@ public: ...@@ -119,18 +153,17 @@ public:
void deleteItem(const UBFeature &pFeature); void deleteItem(const UBFeature &pFeature);
bool isTrash( const QUrl &url ); bool isTrash( const QUrl &url );
void moveToTrash(UBFeature feature, bool deleteManualy = false); void moveToTrash(UBFeature feature, bool deleteManualy = false);
void addNewFolder(const QString &name);
void addToFavorite( const QUrl &path ); void addToFavorite( const QUrl &path );
void removeFromFavorite(const QUrl &path, bool deleteManualy = false); void removeFromFavorite(const QUrl &path, bool deleteManualy = false);
void importImage(const QImage &image, const QString &fileName = QString()); void importImage(const QImage &image, const QString &fileName = QString());
void importImage( const QImage &image, const UBFeature &destination, const QString &fileName = QString() ); void importImage( const QImage &image, const UBFeature &destination, const QString &fileName = QString() );
void fileSystemScan(const QUrl &currPath, const QString & currVirtualPath); void fileSystemScan(const QUrl &currPath, const QString & currVirtualPath);
int featuresCount(const QUrl &currPath);
static UBFeatureElementType fileTypeFromUrl( const QString &path ); static UBFeatureElementType fileTypeFromUrl( const QString &path );
static QString fileNameFromUrl( const QUrl &url ); static QString fileNameFromUrl( const QUrl &url );
static QPixmap getIcon( const QString &path, UBFeatureElementType pFType ); static QImage getIcon( const QString &path, UBFeatureElementType pFType );
static bool isDeletable( const QUrl &url ); static bool isDeletable( const QUrl &url );
static char featureTypeSplitter() {return ':';} static char featureTypeSplitter() {return ':';}
...@@ -139,6 +172,16 @@ public: ...@@ -139,6 +172,16 @@ public:
void assignFeaturesListVeiw(UBFeaturesListView *pList); void assignFeaturesListVeiw(UBFeaturesListView *pList);
void assignPathListView(UBFeaturesListView *pList); void assignPathListView(UBFeaturesListView *pList);
signals:
void maxFilesCountEvaluated(int pLimit);
void scanStarted();
void scanFinished();
void featureAddedFromThread();
private slots:
void addNewFolder(QString name);
void startThread();
private: private:
UBFeaturesItemDelegate *itemDelegate; UBFeaturesItemDelegate *itemDelegate;
...@@ -149,16 +192,16 @@ private: ...@@ -149,16 +192,16 @@ private:
UBFeaturesSearchProxyModel *featuresSearchModel; UBFeaturesSearchProxyModel *featuresSearchModel;
UBFeaturesPathProxyModel *featuresPathModel; UBFeaturesPathProxyModel *featuresPathModel;
QAbstractItemModel *curListModel;
UBFeaturesComputingThread mCThread;
private: private:
static QPixmap createThumbnail(const QString &path); static QImage createThumbnail(const QString &path);
//void addImageToCurrentPage( const QString &path ); //void addImageToCurrentPage( const QString &path );
void loadFavoriteList(); void loadFavoriteList();
void saveFavoriteList(); void saveFavoriteList();
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
QUrl mUserAudioDirectoryPath; QUrl mUserAudioDirectoryPath;
......
...@@ -53,6 +53,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid ...@@ -53,6 +53,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
//mpSearchBtn = new UBActionButton(this, mpSearchAction); //mpSearchBtn = new UBActionButton(this, mpSearchAction);
mpRescanModelBtn = new UBActionButton(this, mpRescanModelAction); mpRescanModelBtn = new UBActionButton(this, mpRescanModelAction);
mpRescanModelBtn->hide();
mpDeleteBtn = new UBActionButton(this, mpDeleteAction); mpDeleteBtn = new UBActionButton(this, mpDeleteAction);
mpCloseBtn = new UBActionButton(this, mpCloseAction); mpCloseBtn = new UBActionButton(this, mpCloseAction);
...@@ -124,7 +125,7 @@ void UBFeaturesActionBar::setButtons() ...@@ -124,7 +125,7 @@ void UBFeaturesActionBar::setButtons()
mpNewFolderBtn->show(); mpNewFolderBtn->show();
mpNewFolderBtn->setEnabled(true); mpNewFolderBtn->setEnabled(true);
mpDeleteBtn->setEnabled(true); mpDeleteBtn->setEnabled(true);
mpRescanModelBtn->show(); // mpRescanModelBtn->show();
break; break;
case IN_ROOT: case IN_ROOT:
mpFavoriteBtn->show(); mpFavoriteBtn->show();
...@@ -136,7 +137,7 @@ void UBFeaturesActionBar::setButtons() ...@@ -136,7 +137,7 @@ void UBFeaturesActionBar::setButtons()
mpNewFolderBtn->show(); mpNewFolderBtn->show();
mpNewFolderBtn->setEnabled(false); mpNewFolderBtn->setEnabled(false);
mpDeleteBtn->setEnabled(false); mpDeleteBtn->setEnabled(false);
mpRescanModelBtn->show(); // mpRescanModelBtn->show();
break; break;
case IN_PROPERTIES: case IN_PROPERTIES:
mpFavoriteBtn->show(); mpFavoriteBtn->show();
...@@ -147,7 +148,7 @@ void UBFeaturesActionBar::setButtons() ...@@ -147,7 +148,7 @@ void UBFeaturesActionBar::setButtons()
mpCloseBtn->hide(); mpCloseBtn->hide();
mpRemoveFavoriteBtn->hide(); mpRemoveFavoriteBtn->hide();
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
case IN_FAVORITE: case IN_FAVORITE:
mpFavoriteBtn->hide(); mpFavoriteBtn->hide();
...@@ -158,7 +159,7 @@ void UBFeaturesActionBar::setButtons() ...@@ -158,7 +159,7 @@ void UBFeaturesActionBar::setButtons()
mpCloseBtn->hide(); mpCloseBtn->hide();
mpRemoveFavoriteBtn->show(); mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
case IN_TRASH: case IN_TRASH:
mpFavoriteBtn->hide(); mpFavoriteBtn->hide();
...@@ -171,7 +172,7 @@ void UBFeaturesActionBar::setButtons() ...@@ -171,7 +172,7 @@ void UBFeaturesActionBar::setButtons()
mpCloseBtn->hide(); mpCloseBtn->hide();
//mpRemoveFavoriteBtn->show(); //mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
mpRescanModelBtn->hide(); // mpRescanModelBtn->hide();
break; break;
default: default:
break; break;
......
This diff is collapsed.
...@@ -43,6 +43,8 @@ class UBFeaturesListView; ...@@ -43,6 +43,8 @@ class UBFeaturesListView;
class UBFeaturesWebView; class UBFeaturesWebView;
class UBFeaturesNavigatorWidget; class UBFeaturesNavigatorWidget;
class UBFeaturesMimeData; class UBFeaturesMimeData;
class UBFeaturesCentralWidget;
class UBFeaturesNewFolderDialog;
class UBFeaturesWidget : public UBDockPaletteWidget class UBFeaturesWidget : public UBDockPaletteWidget
{ {
...@@ -63,6 +65,9 @@ public: ...@@ -63,6 +65,9 @@ public:
static const int maxThumbnailSize = 100; static const int maxThumbnailSize = 100;
static const int defaultThumbnailSize = 40; static const int defaultThumbnailSize = 40;
static const char *objNamePathList;
static const char *objNameFeatureList;
public: public:
int scrollbarHorisontalPadding() const { return 10;} int scrollbarHorisontalPadding() const { return 10;}
int scrollbarVerticalIndent() const { return 0;} int scrollbarVerticalIndent() const { return 0;}
...@@ -82,6 +87,7 @@ private slots: ...@@ -82,6 +87,7 @@ private slots:
void removeElementsFromFavorite(); void removeElementsFromFavorite();
void deleteSelectedElements(); void deleteSelectedElements();
void rescanModel(); void rescanModel();
void lockIt(bool pLock);
private: private:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
...@@ -91,17 +97,12 @@ private: ...@@ -91,17 +97,12 @@ private:
private: private:
UBFeaturesController *controller; UBFeaturesController *controller;
UBFeaturesNavigatorWidget *mNavigator;
UBFeaturesListView *pathListView; UBFeaturesListView *pathListView;
QVBoxLayout *layout; QVBoxLayout *layout;
UBFeaturesActionBar *mActionBar; UBFeaturesActionBar *mActionBar;
UBFeatureProperties *featureProperties;
UBFeaturesWebView *webView;
QStackedWidget *stackedWidget;
int currentStackedWidget;
UBDownloadHttpFile* imageGatherer; UBDownloadHttpFile* imageGatherer;
UBNewFolderDlg *mkFolderDlg; UBNewFolderDlg *mkFolderDlg;
UBFeaturesCentralWidget *centralWidget;
}; };
...@@ -134,6 +135,7 @@ protected: ...@@ -134,6 +135,7 @@ protected:
private slots: private slots:
void thumbnailSizeChanged(int); void thumbnailSizeChanged(int);
}; };
...@@ -153,6 +155,93 @@ private: ...@@ -153,6 +155,93 @@ private:
}; };
class UBFeaturesCentralWidget : public QWidget
{
Q_OBJECT
public:
enum StackElement{
MainList = 0,
FeaturePropertiesList,
FeaturesWebView
};
enum AddWidget {
NewFolderDialog = 0,
ProgressBarWidget
};
enum AddWidgetState {
NonModal = 0,
Modal
};
UBFeaturesCentralWidget(QWidget *parent = 0);
void setSliderPosition(int pValue) {mNavigator->setSliderPosition(pValue);}
UBFeaturesListView *listView() {return mNavigator->listView();}
void showElement(const UBFeature &feature, StackElement pView);
void switchTo(StackElement pView);
void setPropertiesPixmap(const QPixmap &pix);
void setPropertiesThumbnail(const QPixmap &pix);
StackElement currentView() const {return static_cast<StackElement>(mStackedWidget->currentIndex());}
UBFeature getCurElementFromProperties();
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
void setLockedExcludingAdditional(bool pLock);
QStackedWidget *mStackedWidget;
UBFeaturesNavigatorWidget *mNavigator;
UBFeatureProperties *mFeatureProperties;
UBFeaturesWebView *webView;
QStackedWidget *mAdditionalDataContainer;
signals:
void lockMainWidget(bool pLock);
void createNewFolderSignal(QString pStr);
// progressbar widget related signals
void maxFilesCountEvaluated(int pValue);
private slots:
void createNewFolderSlot(QString pStr);
void hideAdditionalData();
void scanStarted();
void scanFinished();
void increaseStatusBarValue();
private:
};
class UBFeaturesNewFolderDialog : public QWidget
{
Q_OBJECT
public:
static const QString acceptText;
static const QString cancelText;
static const QString labelText;
UBFeaturesNewFolderDialog(QWidget *parent = 0);
void setRegexp(const QRegExp pRegExp);
signals:
void createNewFolder(QString str);
void closeDialog();
private slots:
void accept();
void reject();
private:
QLineEdit *mLineEdit;
QRegExpValidator *mValidator;
};
class UBFeaturesWebView : public QWidget class UBFeaturesWebView : public QWidget
{ {
...@@ -182,8 +271,8 @@ public: ...@@ -182,8 +271,8 @@ public:
void showElement(const UBFeature &elem); void showElement(const UBFeature &elem);
UBFeature getCurrentElement() const; UBFeature getCurrentElement() const;
void setOrigPixmap(QPixmap &pix); void setOrigPixmap(const QPixmap &pix);
void setThumbnail(QPixmap &pix); void setThumbnail(const QPixmap &pix);
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
...@@ -231,7 +320,6 @@ public: ...@@ -231,7 +320,6 @@ public:
UBFeaturesModel(QList<UBFeature> *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;} UBFeaturesModel(QList<UBFeature> *pFeaturesList, QObject *parent = 0) : QAbstractListModel(parent), featuresList(pFeaturesList) {;}
virtual ~UBFeaturesModel(){;} virtual ~UBFeaturesModel(){;}
void addItem( const UBFeature &item );
void deleteFavoriteItem( const QString &path ); void deleteFavoriteItem( const QString &path );
void deleteItem( const QString &path ); void deleteItem( const QString &path );
void deleteItem(const UBFeature &feature); void deleteItem(const UBFeature &feature);
...@@ -251,6 +339,9 @@ public: ...@@ -251,6 +339,9 @@ public:
Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }
// void setFeaturesList(QList <UBFeature> *flist ) { featuresList = flist; } // void setFeaturesList(QList <UBFeature> *flist ) { featuresList = flist; }
public slots:
void addItem( const UBFeature &item );
private: private:
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
}; };
...@@ -314,4 +405,5 @@ private: ...@@ -314,4 +405,5 @@ private:
QPixmap *arrowPixmap; QPixmap *arrowPixmap;
}; };
#endif // UBFEATURESWIDGET_H #endif // UBFEATURESWIDGET_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment