Commit 424f91db authored by Aleksei Kanash's avatar Aleksei Kanash

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

parents e6194ef5 22b68c8a
...@@ -154,6 +154,10 @@ a { ...@@ -154,6 +154,10 @@ a {
vertical-align: top; vertical-align: top;
} }
.imgContainer img{
max-width: 150px;
max-height:150px;
}
.filterContainer{ .filterContainer{
float: left; float: left;
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<script type="text/javascript"> <script type="text/javascript">
var category = "image"; var category = "image";
var thumbnails = true; var thumbnails = true;
var minHeight = 180; var minHeight = 150;
var minWidth = 150; var minWidth = 150;
var currentIndex = 0; var currentIndex = 0;
...@@ -78,12 +78,12 @@ ...@@ -78,12 +78,12 @@
// There is also a result.file property which has the escaped version // There is also a result.file property which has the escaped version
if (thumbnails) { if (thumbnails) {
newImg.src = result.file; newImg.src = result.file;
if(result.height >= result.width) /*if(result.height >= result.width)
newImg.height = minHeight; newImg.height = minHeight;
else{ else{
newImg.width = minWidth; newImg.width = minWidth;
//newImg.style.margin = (120 - result.height)/2 + "px 0"; //newImg.style.margin = (120 - result.height)/2 + "px 0";
} }*/
} else { } else {
newImg.src = "./images/thumbnail_icon.png"; newImg.src = "./images/thumbnail_icon.png";
} }
......
This diff is collapsed.
...@@ -33,7 +33,7 @@ class UBFeaturesComputingThread : public QThread ...@@ -33,7 +33,7 @@ class UBFeaturesComputingThread : public QThread
public: public:
explicit UBFeaturesComputingThread(QObject *parent = 0); explicit UBFeaturesComputingThread(QObject *parent = 0);
virtual ~UBFeaturesComputingThread(); virtual ~UBFeaturesComputingThread();
void compute(const QList<QPair<QUrl, QString> > &pScanningData); void compute(const QList<QPair<QUrl, QString> > &pScanningData, QSet<QUrl> *pFavoritesSet);
protected: protected:
void run(); void run();
...@@ -44,12 +44,14 @@ signals: ...@@ -44,12 +44,14 @@ signals:
void scanStarted(); void scanStarted();
void scanFinished(); void scanFinished();
void maxFilesCountEvaluated(int max); void maxFilesCountEvaluated(int max);
void scanCategory(const QString &str);
void scanPath(const QString &str);
public slots: public slots:
private: private:
void scanFS(const QUrl & currentPath, const QString & currVirtualPath); void scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet);
void scanAll(QList<QPair<QUrl, QString> > pScanningData); void scanAll(QList<QPair<QUrl, QString> > pScanningData, const QSet<QUrl> &pFavoriteSet);
int featuresCount(const QUrl &pPath); int featuresCount(const QUrl &pPath);
int featuresCountAll(QList<QPair<QUrl, QString> > pScanningData); int featuresCountAll(QList<QPair<QUrl, QString> > pScanningData);
...@@ -59,6 +61,7 @@ private: ...@@ -59,6 +61,7 @@ private:
QUrl mScanningPath; QUrl mScanningPath;
QString mScanningVirtualPath; QString mScanningVirtualPath;
QList<QPair<QUrl, QString> > mScanningData; QList<QPair<QUrl, QString> > mScanningData;
QSet<QUrl> mFavoriteSet;
bool restart; bool restart;
bool abort; bool abort;
}; };
...@@ -72,6 +75,9 @@ enum UBFeatureElementType ...@@ -72,6 +75,9 @@ enum UBFeatureElementType
FEATURE_INTERACTIVE, FEATURE_INTERACTIVE,
FEATURE_INTERNAL, FEATURE_INTERNAL,
FEATURE_ITEM, FEATURE_ITEM,
FEATURE_AUDIO,
FEATURE_VIDEO,
FEATURE_IMAGE,
FEATURE_TRASH, FEATURE_TRASH,
FEATURE_FAVORITE, FEATURE_FAVORITE,
FEATURE_SEARCH, FEATURE_SEARCH,
...@@ -107,6 +113,7 @@ public: ...@@ -107,6 +113,7 @@ public:
private: private:
QString virtualDir; QString virtualDir;
QString virtualPath;
QImage mThumbnail; QImage mThumbnail;
QString mName; QString mName;
QUrl mPath; QUrl mPath;
...@@ -167,6 +174,7 @@ public: ...@@ -167,6 +174,7 @@ public:
static QImage 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 ':';}
static QString categoryNameForVirtualPath(const QString &str);
static const QString virtualRootName; static const QString virtualRootName;
...@@ -178,6 +186,8 @@ signals: ...@@ -178,6 +186,8 @@ signals:
void scanStarted(); void scanStarted();
void scanFinished(); void scanFinished();
void featureAddedFromThread(); void featureAddedFromThread();
void scanCategory(const QString &);
void scanPath(const QString &);
private slots: private slots:
void addNewFolder(QString name); void addNewFolder(QString name);
...@@ -233,6 +243,7 @@ private: ...@@ -233,6 +243,7 @@ private:
QString interactPath; QString interactPath;
QString trashPath; QString trashPath;
QString favoritePath; QString favoritePath;
QString webSearchPath;
int mLastItemOffsetIndex; int mLastItemOffsetIndex;
UBFeature currentElement; UBFeature currentElement;
......
...@@ -81,7 +81,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) ...@@ -81,7 +81,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
connect(controller, SIGNAL(scanStarted()), mActionBar, SLOT(lockIt())); connect(controller, SIGNAL(scanStarted()), mActionBar, SLOT(lockIt()));
connect(controller, SIGNAL(scanFinished()), mActionBar, SLOT(unlockIt())); connect(controller, SIGNAL(scanFinished()), mActionBar, SLOT(unlockIt()));
connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int))); connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int)));
connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SLOT(increaseStatusBarValue())); connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SIGNAL(increaseStatusBarValue()));
connect(controller, SIGNAL(scanCategory(QString)), centralWidget, SIGNAL(scanCategory(QString)));
connect(controller, SIGNAL(scanPath(QString)), centralWidget, SIGNAL(scanPath(QString)));
} }
UBFeaturesWidget::~UBFeaturesWidget() UBFeaturesWidget::~UBFeaturesWidget()
...@@ -497,15 +499,14 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare ...@@ -497,15 +499,14 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare
connect(this, SIGNAL(sendFileNameList(QStringList)), dlg, SLOT(setFileNameList(QStringList))); connect(this, SIGNAL(sendFileNameList(QStringList)), dlg, SLOT(setFileNameList(QStringList)));
//Progress bar to show scanning progress //Progress bar to show scanning progress
QProgressBar *progressBar = new QProgressBar(); UBFeaturesProgressInfo *progressBar = new UBFeaturesProgressInfo();
mAdditionalDataContainer->addWidget(progressBar); mAdditionalDataContainer->addWidget(progressBar);
mAdditionalDataContainer->setCurrentIndex(ProgressBarWidget); mAdditionalDataContainer->setCurrentIndex(ProgressBarWidget);
progressBar->setMinimum(0);
progressBar->setValue(0);
progressBar->setMaximum(10000);
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setProgressMax(int)));
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setMaximum(int))); connect(this, SIGNAL(increaseStatusBarValue()), progressBar, SLOT(increaseProgressValue()));
connect(this, SIGNAL(scanCategory(QString)), progressBar, SLOT(setCommmonInfoText(QString)));
connect(this, SIGNAL(scanPath(QString)), progressBar, SLOT(setDetailedInfoText(QString)));
mLayout->addWidget(mStackedWidget, 1); mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mAdditionalDataContainer, 0); mLayout->addWidget(mAdditionalDataContainer, 0);
...@@ -546,6 +547,11 @@ UBFeature UBFeaturesCentralWidget::getCurElementFromProperties() ...@@ -546,6 +547,11 @@ UBFeature UBFeaturesCentralWidget::getCurElementFromProperties()
void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState) void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)
{ {
if (!mAdditionalDataContainer->widget(pWidgetType)) {
qDebug() << "can't find widget specified by UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)";
return;
}
mAdditionalDataContainer->setMaximumHeight(mAdditionalDataContainer->widget(pWidgetType)->sizeHint().height()); mAdditionalDataContainer->setMaximumHeight(mAdditionalDataContainer->widget(pWidgetType)->sizeHint().height());
mAdditionalDataContainer->setCurrentIndex(pWidgetType); mAdditionalDataContainer->setCurrentIndex(pWidgetType);
...@@ -573,46 +579,21 @@ void UBFeaturesCentralWidget::hideAdditionalData() ...@@ -573,46 +579,21 @@ void UBFeaturesCentralWidget::hideAdditionalData()
void UBFeaturesCentralWidget::scanStarted() void UBFeaturesCentralWidget::scanStarted()
{ {
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { showAdditionalData(ProgressBarWidget);
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar && !progressBar->isVisible()) {
showAdditionalData((AddWidget)1);
}
} }
void UBFeaturesCentralWidget::scanFinished() void UBFeaturesCentralWidget::scanFinished()
{ {
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar && progressBar->isVisible()) {
hideAdditionalData(); 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) UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent)
{ {
this->setStyleSheet("background:white;"); this->setStyleSheet("background:white;");
QVBoxLayout *mainLayout = new QVBoxLayout(); QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
QVBoxLayout *labelLayout = new QVBoxLayout(this); QVBoxLayout *labelLayout = new QVBoxLayout();
QLabel *mLabel = new QLabel(labelText, this); QLabel *mLabel = new QLabel(labelText, this);
mLineEdit = new QLineEdit(this); mLineEdit = new QLineEdit(this);
...@@ -622,7 +603,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget( ...@@ -622,7 +603,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
labelLayout->addWidget(mLabel); labelLayout->addWidget(mLabel);
labelLayout->addWidget(mLineEdit); labelLayout->addWidget(mLineEdit);
QHBoxLayout *buttonLayout = new QHBoxLayout(this); QHBoxLayout *buttonLayout = new QHBoxLayout();
acceptButton = new QPushButton(acceptText, this); acceptButton = new QPushButton(acceptText, this);
QPushButton *cancelButton = new QPushButton(cancelText, this); QPushButton *cancelButton = new QPushButton(cancelText, this);
...@@ -676,6 +657,64 @@ void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr) ...@@ -676,6 +657,64 @@ void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr)
} }
} }
UBFeaturesProgressInfo::UBFeaturesProgressInfo(QWidget *parent) :
QWidget(parent),
mProgressBar(0),
mCommonInfoLabel(0),
mDetailedInfoLabel(0)
{
QVBoxLayout *mainLayer = new QVBoxLayout(this);
mProgressBar = new QProgressBar(this);
// setting defaults
mProgressBar->setMinimum(0);
mProgressBar->setMaximum(100000);
mProgressBar->setValue(0);
mProgressBar->setStyleSheet("background:white");
mCommonInfoLabel = new QLabel(this);
mDetailedInfoLabel = new QLabel(this);
mDetailedInfoLabel->setAlignment(Qt::AlignRight);
mCommonInfoLabel->hide();
mDetailedInfoLabel->hide();
mainLayer->addWidget(mCommonInfoLabel);
mainLayer->addWidget(mDetailedInfoLabel);
mainLayer->addWidget(mProgressBar);
}
void UBFeaturesProgressInfo::setCommmonInfoText(const QString &str)
{
mProgressBar->setFormat(str + tr(" load") + "(%p%)");
}
void UBFeaturesProgressInfo::setDetailedInfoText(const QString &str)
{
mDetailedInfoLabel->setText(str);
}
void UBFeaturesProgressInfo::setProgressMax(int pValue)
{
mProgressBar->setMaximum(pValue);
}
void UBFeaturesProgressInfo::setProgressMin(int pValue)
{
mProgressBar->setMinimum(pValue);
}
void UBFeaturesProgressInfo::increaseProgressValue()
{
mProgressBar->setValue(mProgressBar->value() + 1);
}
void UBFeaturesProgressInfo::sendFeature(UBFeature pFeature)
{
Q_UNUSED(pFeature);
}
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)
...@@ -1295,6 +1334,9 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const ...@@ -1295,6 +1334,9 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>(); UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( item.getType() == FEATURE_INTERACTIVE if ( item.getType() == FEATURE_INTERACTIVE
|| item.getType() == FEATURE_ITEM || item.getType() == FEATURE_ITEM
|| item.getType() == FEATURE_AUDIO
|| item.getType() == FEATURE_VIDEO
|| item.getType() == FEATURE_IMAGE
|| item.getType() == FEATURE_INTERNAL || item.getType() == FEATURE_INTERNAL
|| item.getType() == FEATURE_FOLDER) || item.getType() == FEATURE_FOLDER)
...@@ -1340,7 +1382,10 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn ...@@ -1340,7 +1382,10 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFile = feature.getType() == FEATURE_INTERACTIVE bool isFile = feature.getType() == FEATURE_INTERACTIVE
|| feature.getType() == FEATURE_INTERNAL || feature.getType() == FEATURE_INTERNAL
|| feature.getType() == FEATURE_ITEM; || feature.getType() == FEATURE_ITEM
|| feature.getType() == FEATURE_AUDIO
|| feature.getType() == FEATURE_VIDEO
|| feature.getType() == FEATURE_IMAGE;
return isFile && filterRegExp().exactMatch( feature.getName() ); return isFile && filterRegExp().exactMatch( feature.getName() );
} }
......
...@@ -45,6 +45,7 @@ class UBFeaturesNavigatorWidget; ...@@ -45,6 +45,7 @@ class UBFeaturesNavigatorWidget;
class UBFeaturesMimeData; class UBFeaturesMimeData;
class UBFeaturesCentralWidget; class UBFeaturesCentralWidget;
class UBFeaturesNewFolderDialog; class UBFeaturesNewFolderDialog;
class UBFeaturesProgressBar;
class UBFeaturesWidget : public UBDockPaletteWidget class UBFeaturesWidget : public UBDockPaletteWidget
{ {
...@@ -189,7 +190,6 @@ public: ...@@ -189,7 +190,6 @@ public:
void setPropertiesThumbnail(const QPixmap &pix); void setPropertiesThumbnail(const QPixmap &pix);
StackElement currentView() const {return static_cast<StackElement>(mStackedWidget->currentIndex());} StackElement currentView() const {return static_cast<StackElement>(mStackedWidget->currentIndex());}
UBFeature getCurElementFromProperties(); UBFeature getCurElementFromProperties();
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
void setLockedExcludingAdditional(bool pLock); void setLockedExcludingAdditional(bool pLock);
...@@ -207,6 +207,12 @@ signals: ...@@ -207,6 +207,12 @@ signals:
// progressbar widget related signals // progressbar widget related signals
void maxFilesCountEvaluated(int pValue); void maxFilesCountEvaluated(int pValue);
void increaseStatusBarValue();
void scanCategory(const QString &);
void scanPath(const QString &);
public slots:
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
private slots: private slots:
void createNewFolderSlot(QString pStr); void createNewFolderSlot(QString pStr);
...@@ -214,7 +220,6 @@ private slots: ...@@ -214,7 +220,6 @@ private slots:
void scanStarted(); void scanStarted();
void scanFinished(); void scanFinished();
void increaseStatusBarValue();
private: private:
...@@ -252,6 +257,27 @@ private: ...@@ -252,6 +257,27 @@ private:
}; };
class UBFeaturesProgressInfo: public QWidget {
Q_OBJECT
public:
UBFeaturesProgressInfo(QWidget *parent = 0);
private slots:
void setCommmonInfoText(const QString &str);
void setDetailedInfoText(const QString &str);
void setProgressMin(int pValue);
void setProgressMax(int pValue);
void increaseProgressValue();
void sendFeature(UBFeature pFeature);
private:
QProgressBar *mProgressBar;
QLabel *mCommonInfoLabel;
QLabel *mDetailedInfoLabel;
};
class UBFeaturesWebView : public QWidget class UBFeaturesWebView : public QWidget
{ {
Q_OBJECT Q_OBJECT
......
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