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

preferencesAboutTextFull
shibakaneki 13 years ago
commit 775c9b9e65
  1. 6
      Sankore 3.1.iss
  2. 2
      release.win7.vc9.64.bat
  3. 2
      release.win7.vc9.bat
  4. 19
      src/gui/UBFeaturesActionBar.cpp
  5. 4
      src/gui/UBFeaturesActionBar.h
  6. 94
      src/gui/UBFeaturesWidget.cpp
  7. 8
      src/gui/UBFeaturesWidget.h

@ -45,7 +45,10 @@ Type: files ; Name: "{app}\*.dll"
[Files] [Files]
Source: "..\Sankore-ThirdParty\microsoft\vcredist_x86.exe"; DestDir:"{tmp}" Source: "..\Sankore-ThirdParty\microsoft\vcredist_x86.exe"; DestDir:"{tmp}"
Source: ".\build\win32\release\product\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "build\win32\release\product\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
;Sankore plugins
Source: "plugins\cffadaptor\build\win32\release\lib\CFF_Adaptor.dll"; DestDir: "{app}"; Flags: ignoreversion
;OpenSSL ;OpenSSL
Source: "..\Sankore-ThirdParty\openssl\win32\libeay32.dll"; DestDir:"{app}"; Flags: ignoreversion Source: "..\Sankore-ThirdParty\openssl\win32\libeay32.dll"; DestDir:"{app}"; Flags: ignoreversion
@ -60,6 +63,7 @@ Source: "..\Qt-sankore3.1\lib\QtWebKit4.dll"; DestDir: "{app}"; Flags: ignorever
Source: "..\Qt-sankore3.1\lib\phonon4.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\Qt-sankore3.1\lib\phonon4.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Qt-sankore3.1\lib\QtNetwork4.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\Qt-sankore3.1\lib\QtNetwork4.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Qt-sankore3.1\lib\QtSvg4.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\Qt-sankore3.1\lib\QtSvg4.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Qt-sankore3.1\lib\QtOpenGL4.dll"; DestDir: "{app}"; Flags: ignoreversion
;Qt plugins ;Qt plugins
Source: "..\Qt-sankore3.1\plugins\accessible\qtaccessiblecompatwidgets4.dll"; DestDir: "{app}\accessible"; Flags: ignoreversion Source: "..\Qt-sankore3.1\plugins\accessible\qtaccessiblecompatwidgets4.dll"; DestDir: "{app}\accessible"; Flags: ignoreversion

@ -62,7 +62,7 @@ nmake release-install
copy %BASE_QT_TRANSLATIONS_DIRECTORY%\qt_*.qm build\win32\release\product\i18n\ copy %BASE_QT_TRANSLATIONS_DIRECTORY%\qt_*.qm build\win32\release\product\i18n\
del build\win32\release\product\i18n\qt_help* del build\win32\release\product\i18n\qt_help*
del ".\build\win32\release\product\Sankore.pdb" del "build\win32\release\product\Sankore.pdb"
set INSTALLER_NAME=Open-Sankore set INSTALLER_NAME=Open-Sankore

@ -66,7 +66,7 @@ copy resources\customizations build\win32\release\product\
del build\win32\release\product\i18n\qt_help* del build\win32\release\product\i18n\qt_help*
del ".\build\win32\release\product\Sankore.pdb" del "build\win32\release\product\Sankore.pdb"
set INSTALLER_NAME=Open-Sankore set INSTALLER_NAME=Open-Sankore

@ -66,8 +66,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
mButtonGroup->addButton(mpRemoveFavoriteBtn); mButtonGroup->addButton(mpRemoveFavoriteBtn);
mButtonGroup->addButton(mpNewFolderBtn); mButtonGroup->addButton(mpNewFolderBtn);
// Connect signals & slots // Connect signals & slots
connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite())); /*connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
/*connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial())); connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
connect(mpSearchAction,SIGNAL(triggered()), this, SLOT(onActionSearch())); connect(mpSearchAction,SIGNAL(triggered()), this, SLOT(onActionSearch()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash())); connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
connect(mpCloseAction, SIGNAL(triggered()), this, SLOT(onActionClose())); connect(mpCloseAction, SIGNAL(triggered()), this, SLOT(onActionClose()));
@ -75,8 +75,11 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString)));
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/ connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/
connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString)));
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder())); connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));
connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
// Build the default toolbar // Build the default toolbar
mLayout->addWidget(mpFavoriteBtn); mLayout->addWidget(mpFavoriteBtn);
@ -148,6 +151,8 @@ void UBFeaturesActionBar::setButtons()
mpFavoriteBtn->hide(); mpFavoriteBtn->hide();
mpSocialBtn->hide(); mpSocialBtn->hide();
mSearchBar->show(); mSearchBar->show();
mpDeleteBtn->show();
mpDeleteBtn->setEnabled(true);
//mpSearchBtn->show(); //mpSearchBtn->show();
//mpDeleteBtn->hide(); //mpDeleteBtn->hide();
mpCloseBtn->hide(); mpCloseBtn->hide();
@ -175,6 +180,16 @@ void UBFeaturesActionBar::onActionFavorite()
emit addElementsToFavorite(); emit addElementsToFavorite();
} }
void UBFeaturesActionBar::onActionRemoveFavorite()
{
emit removeElementsFromFavorite();
}
void UBFeaturesActionBar::onActionTrash()
{
emit deleteSelectedElements();
}
/* /*
void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event) void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
{ {

@ -31,10 +31,14 @@ signals:
void addToFavorite( const QMimeData &data ); void addToFavorite( const QMimeData &data );
void removeFromFavorite( const QMimeData &data ); void removeFromFavorite( const QMimeData &data );
void addElementsToFavorite(); void addElementsToFavorite();
void removeElementsFromFavorite();
void deleteSelectedElements();
private slots: private slots:
void onSearchTextChanged(QString txt); void onSearchTextChanged(QString txt);
void onActionNewFolder(); void onActionNewFolder();
void onActionFavorite(); void onActionFavorite();
void onActionRemoveFavorite();
void onActionTrash();
protected: protected:
//void dragMoveEvent(QDragMoveEvent *event); //void dragMoveEvent(QDragMoveEvent *event);
void dragEnterEvent( QDragEnterEvent *event ); void dragEnterEvent( QDragEnterEvent *event );

@ -121,7 +121,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) ); connect( mActionBar, SIGNAL( deleteElements(const QMimeData &) ), this, SLOT( deleteElements(const QMimeData &) ) );
connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) ); connect( mActionBar, SIGNAL( addToFavorite(const QMimeData &) ), this, SLOT( addToFavorite(const QMimeData &) ) );
connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) ); connect( mActionBar, SIGNAL( removeFromFavorite(const QMimeData &) ), this, SLOT( removeFromFavorite(const QMimeData &) ) );
connect ( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) ); connect( mActionBar, SIGNAL( addElementsToFavorite() ), this, SLOT ( addElementsToFavorite() ) );
connect( mActionBar, SIGNAL( removeElementsFromFavorite() ), this, SLOT ( removeElementsFromFavorite() ) );
connect( mActionBar, SIGNAL( deleteSelectedElements() ), this, SLOT( deleteSelectedElements() ) );
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 ) ) ); connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) );
@ -277,6 +279,37 @@ void UBFeaturesWidget::deleteElements( const QMimeData & mimeData )
model->invalidate(); model->invalidate();
} }
void UBFeaturesWidget::deleteSelectedElements()
{
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
QList <QUrl> urls;
foreach ( QModelIndex sel, selected )
{
UBFeature feature = sel.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( feature.isDeletable() )
urls.append( feature.getFullPath() );
}
foreach (QUrl url, urls)
{
if ( controller->isTrash( url ) )
{
controller->deleteItem( url );
}
else
{
UBFeature elem = controller->moveItemToFolder( url, controller->getTrashElement() );
controller->removeFromFavorite( url );
featuresModel->addItem( elem );
featuresModel->deleteFavoriteItem( url.toString() );
}
featuresModel->deleteItem( url.toString() );
}
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
model->invalidate();
}
void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData ) void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData )
{ {
if ( !mimeData.hasUrls() ) if ( !mimeData.hasUrls() )
@ -335,14 +368,45 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr
} }
void UBFeaturesWidget::addElementsToFavorite() void UBFeaturesWidget::addElementsToFavorite()
{
if ( currentStackedWidget == ID_PROPERTIES )
{
UBFeature feature = featureProperties->getCurrentElement();
if ( feature != UBFeature() && !UBApplication::isFromWeb( feature.getFullPath().toString() ) )
{
UBFeature elem = controller->addToFavorite( feature.getFullPath() );
featuresModel->addItem( elem );
}
}
else if ( currentStackedWidget == ID_LISTVIEW )
{
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
for ( int i = 0; i < selected.size(); ++i )
{
UBFeature feature = selected.at(i).data( Qt::UserRole + 1 ).value<UBFeature>();
UBFeature elem = controller->addToFavorite( feature.getFullPath() );
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() )
featuresModel->addItem( elem );
}
}
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
model->invalidate();
}
void UBFeaturesWidget::removeElementsFromFavorite()
{ {
QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes(); QModelIndexList selected = featuresListView->selectionModel()->selectedIndexes();
//qSort( selected.begin(), selected.end(), qGreater<QModelIndex>() );
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>();
UBFeature elem = controller->addToFavorite( feature.getFullPath() ); items.append( feature.getFullPath() );
if ( !elem.getVirtualPath().isEmpty() && !elem.getVirtualPath().isNull() ) }
featuresModel->addItem( elem ); foreach ( QUrl url, items )
{
controller->removeFromFavorite( url );
featuresModel->deleteFavoriteItem( url.toString() );
} }
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() ); QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
model->invalidate(); model->invalidate();
@ -609,6 +673,13 @@ void UBFeatureProperties::showEvent (QShowEvent *event )
adaptSize(); adaptSize();
} }
UBFeature UBFeatureProperties::getCurrentElement() const
{
if ( mpElement )
return *mpElement;
return UBFeature();
}
void UBFeatureProperties::adaptSize() void UBFeatureProperties::adaptSize()
{ {
if( NULL != mpOrigPixmap ) if( NULL != mpOrigPixmap )
@ -854,7 +925,7 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
{ {
for ( int i = 0; i < featuresList->size(); ++i ) for ( int i = 0; i < featuresList->size(); ++i )
{ {
if ( !QString::compare( featuresList->at(i).getUrl(), path, Qt::CaseInsensitive ) && if ( !QString::compare( featuresList->at(i).getFullPath().toString(), path, Qt::CaseInsensitive ) &&
!QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) ) !QString::compare( featuresList->at(i).getVirtualPath(), "/root/favorites", Qt::CaseInsensitive ) )
{ {
removeRow( i, QModelIndex() ); removeRow( i, QModelIndex() );
@ -863,6 +934,18 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
} }
} }
void UBFeaturesModel::deleteItem( const QString &path )
{
for ( int i = 0; i < featuresList->size(); ++i )
{
if ( !QString::compare( featuresList->at(i).getFullPath().toString(), path, Qt::CaseInsensitive ) )
{
removeRow( i, QModelIndex() );
return;
}
}
}
bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent ) bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent )
{ {
if ( row < 0 ) if ( row < 0 )
@ -889,6 +972,7 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent )
return true; return true;
} }
Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
{ {
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index);

@ -102,6 +102,8 @@ private slots:
void onDisplayMetadata( QMap<QString,QString> ); void onDisplayMetadata( QMap<QString,QString> );
void onAddDownloadedFileToLibrary(bool, QUrl, QString, QByteArray); void onAddDownloadedFileToLibrary(bool, QUrl, QString, QByteArray);
void addElementsToFavorite(); void addElementsToFavorite();
void removeElementsFromFavorite();
void deleteSelectedElements();
protected: protected:
bool eventFilter(QObject *target, QEvent *event); bool eventFilter(QObject *target, QEvent *event);
}; };
@ -151,8 +153,7 @@ public:
~UBFeatureProperties(); ~UBFeatureProperties();
void showElement(const UBFeature &elem); void showElement(const UBFeature &elem);
UBFeature getCurrentElement() const;
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);
@ -200,6 +201,7 @@ public:
void addItem( const UBFeature &item ); void addItem( const UBFeature &item );
void deleteFavoriteItem( const QString &path ); void deleteFavoriteItem( const QString &path );
void deleteItem( const QString &path );
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
QMimeData *mimeData( const QModelIndexList &indexes ) const; QMimeData *mimeData( const QModelIndexList &indexes ) const;
@ -209,6 +211,8 @@ public:
bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent); bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent);
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, const QModelIndex &parent = QModelIndex()); bool removeRow(int row, const QModelIndex &parent = QModelIndex());
//bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
//bool insertRow(int row, const QModelIndex &parent = QModelIndex());
Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }

Loading…
Cancel
Save