From afd70ddc6254a208165c65ac901d9e4b29d9baa1 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 2 Aug 2012 11:51:23 +0300 Subject: [PATCH 1/2] Fixed SANKORE-536 Show desktop: "Add folder" make sankore freezes after virtual keyboard was opened --- src/board/UBFeaturesController.cpp | 5 +++++ src/gui/UBFeaturesWidget.cpp | 34 +++++++++++++++++++++++++----- src/gui/UBFeaturesWidget.h | 4 ++++ src/gui/UBLibraryWidget.cpp | 16 +++++--------- src/gui/UBLibraryWidget.h | 1 - 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index 3ba4f644..c45ebffd 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -424,6 +424,11 @@ void UBFeaturesController::addNewFolder(const QString &name) { QString path = currentElement.getFullPath().toLocalFile() + "/" + name; + if ("/root" == currentElement.getFullVirtualPath()) + { + return; + } + if(!QFileInfo(path).exists()) { QDir().mkpath(path); } diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 1fb0ac08..f43584f2 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -3,7 +3,6 @@ #include "UBFeaturesWidget.h" #include "domain/UBAbstractWidget.h" #include "gui/UBThumbnailWidget.h" -#include "gui/UBLibraryWidget.h" #include "frameworks/UBFileSystemUtils.h" #include "core/UBApplication.h" #include "core/UBDownloadManager.h" @@ -18,7 +17,10 @@ const int FeatureListBorderOffset = 10; const char featureTypeSplitter = ':'; static const QString mimeSankoreFeatureTypes = "Sankore/featureTypes"; -UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent), imageGatherer(NULL) +UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) + : UBDockPaletteWidget(parent) + , imageGatherer(NULL) + , mkFolderDlg(NULL) { setObjectName(name); @@ -162,10 +164,22 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) void UBFeaturesWidget::createNewFolder() { - UBNewFolderDlg dlg; - if(QDialog::Accepted == dlg.exec()) { - controller->addNewFolder(dlg.folderName()); + if (!mkFolderDlg) + { + 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() +{ + if (mkFolderDlg) + controller->addNewFolder(mkFolderDlg->folderName()); } void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData ) @@ -337,6 +351,16 @@ void UBFeaturesWidget::removeElementsFromFavorite() controller->refreshModels(); } +void UBFeaturesWidget::resizeEvent(QResizeEvent *event) +{ + UBDockPaletteWidget::resizeEvent(event); + if (mkFolderDlg) + { + mkFolderDlg->resize(this->size().width()-20 ,80); + mkFolderDlg->move(5,this->size().height()-200); + } +} + void UBFeaturesWidget::switchToListView() { stackedWidget->setCurrentIndex(ID_LISTVIEW); diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index 0587f908..65c34db7 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -21,6 +21,7 @@ #include "api/UBWidgetUniboardAPI.h" #include "UBFeaturesActionBar.h" #include "UBRubberBand.h" +#include "gui/UBLibraryWidget.h" #define THUMBNAIL_WIDTH 400 #define ID_LISTVIEW 0 @@ -71,6 +72,7 @@ private slots: void currentSelected( const QModelIndex & ); void searchStarted( const QString & ); void createNewFolder(); + void addFolder(); void deleteElements( const UBFeaturesMimeData * ); void addToFavorite( const UBFeaturesMimeData *); void removeFromFavorite( const UBFeaturesMimeData * ); @@ -82,6 +84,7 @@ private slots: void rescanModel(); private: + void resizeEvent(QResizeEvent *event); void switchToListView(); void switchToProperties(); void switchToWebView(); @@ -97,6 +100,7 @@ private: QStackedWidget *stackedWidget; int currentStackedWidget; UBDownloadHttpFile* imageGatherer; + UBNewFolderDlg *mkFolderDlg; }; diff --git a/src/gui/UBLibraryWidget.cpp b/src/gui/UBLibraryWidget.cpp index 197b812e..6501a488 100644 --- a/src/gui/UBLibraryWidget.cpp +++ b/src/gui/UBLibraryWidget.cpp @@ -547,7 +547,6 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent , mpAddButton(NULL) , mpCancelButton(NULL) , mpLayout(NULL) - , mpHLayout(NULL) { setObjectName(name); setWindowTitle(tr("Add new folder")); @@ -562,15 +561,14 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent mpButtons = new QDialogButtonBox(Qt::Horizontal, this); mpLayout = new QVBoxLayout(this); - mpHLayout = new QHBoxLayout(0); setLayout(mpLayout); - mpLayout->addLayout(mpHLayout, 0); - mpHLayout->addWidget(mpLabel, 0); - mpHLayout->addWidget(mpLineEdit, 1); + + mpLayout->addWidget(mpLabel, 1); + mpLayout->addWidget(mpLineEdit); mpButtons->addButton(mpAddButton,QDialogButtonBox::ActionRole); mpButtons->addButton(mpCancelButton,QDialogButtonBox::ActionRole); - mpLayout->addWidget(mpButtons); + mpLayout->addWidget(mpButtons, 1,Qt::AlignJustify); connect(mpAddButton, SIGNAL(clicked()), this, SLOT(accept())); connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject())); @@ -612,11 +610,7 @@ UBNewFolderDlg::~UBNewFolderDlg() delete mpLabel; mpLabel = NULL; } - if(NULL != mpHLayout) - { - delete mpHLayout; - mpHLayout = NULL; - } + if(NULL != mpLayout) { delete mpLayout; diff --git a/src/gui/UBLibraryWidget.h b/src/gui/UBLibraryWidget.h index 915829a9..bb655317 100644 --- a/src/gui/UBLibraryWidget.h +++ b/src/gui/UBLibraryWidget.h @@ -119,7 +119,6 @@ private: QPushButton* mpAddButton; QPushButton* mpCancelButton; QVBoxLayout* mpLayout; - QHBoxLayout* mpHLayout; }; #endif // UBLIBRARYWIDGET_H From e5b8f058e84221399fe10d3528db09a65adf627e Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 2 Aug 2012 15:41:33 +0200 Subject: [PATCH 2/2] removed accents on file name --- ...rand noir.png => quadrille grand noir.png} | Bin ...png => quadrille grand noir.thumbnail.png} | Bin ...rand vert.png => quadrille grand vert.png} | Bin ...png => quadrille grand vert.thumbnail.png} | Bin ...etit bleu.png => quadrille petit bleu.png} | Bin ...png => quadrille petit bleu.thumbnail.png} | Bin .../jaune.png | Bin .../jaune.thumbnail.png | Bin .../jaune_pale.png | Bin .../jaune_pale.thumbnail.png | Bin .../rouge.png | Bin .../rouge.thumbnail.png | Bin .../rouge_pale.png | Bin .../rouge_pale.thumbnail.png | Bin .../vert.png | Bin .../vert.thumbnail.png | Bin .../vert_pale.png | Bin .../vert_pale.thumbnail.png | Bin .../violet.png | Bin .../violet.thumbnail.png | Bin .../violet_pale.png | Bin .../violet_pale.thumbnail.png | Bin .../{clé de sol.png => cle de sol.png} | Bin ...thumbnail.png => cle de sol.thumbnail.png} | Bin .../{jeu d'échelle.jpg => jeu d'echelle.jpg} | Bin ...mbnail.png => jeu d'echelle.thumbnail.png} | Bin src/frameworks/UBPlatformUtils_mac.mm | 28 ------------------ 27 files changed, 28 deletions(-) rename resources/library/pictures/Fonds/Carroyage et lignes/{quadrillé grand noir.png => quadrille grand noir.png} (100%) rename resources/library/pictures/Fonds/Carroyage et lignes/{quadrillé grand noir.thumbnail.png => quadrille grand noir.thumbnail.png} (100%) rename resources/library/pictures/Fonds/Carroyage et lignes/{quadrillé grand vert.png => quadrille grand vert.png} (100%) rename resources/library/pictures/Fonds/Carroyage et lignes/{quadrillé grand vert.thumbnail.png => quadrille grand vert.thumbnail.png} (100%) rename resources/library/pictures/Fonds/Carroyage et lignes/{quadrillé petit bleu.png => quadrille petit bleu.png} (100%) rename resources/library/pictures/Fonds/Carroyage et lignes/{quadrillé petit bleu.thumbnail.png => quadrille petit bleu.thumbnail.png} (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/jaune.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/jaune.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/jaune_pale.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/jaune_pale.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/rouge.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/rouge.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/rouge_pale.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/rouge_pale.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/vert.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/vert.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/vert_pale.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/vert_pale.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/violet.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/violet.thumbnail.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/violet_pale.png (100%) rename resources/library/pictures/Fonds/{Fonds colorés => Fonds colorees}/violet_pale.thumbnail.png (100%) rename resources/library/pictures/Fonds/Musique/{clé de sol.png => cle de sol.png} (100%) rename resources/library/pictures/Fonds/Musique/{clé de sol.thumbnail.png => cle de sol.thumbnail.png} (100%) rename resources/library/pictures/Fonds/Plateaux jeux/{jeu d'échelle.jpg => jeu d'echelle.jpg} (100%) rename resources/library/pictures/Fonds/Plateaux jeux/{jeu d'échelle.thumbnail.png => jeu d'echelle.thumbnail.png} (100%) diff --git a/resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand noir.png b/resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand noir.png similarity index 100% rename from resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand noir.png rename to resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand noir.png diff --git a/resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand noir.thumbnail.png b/resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand noir.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand noir.thumbnail.png rename to resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand noir.thumbnail.png diff --git a/resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand vert.png b/resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand vert.png similarity index 100% rename from resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand vert.png rename to resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand vert.png diff --git a/resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand vert.thumbnail.png b/resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand vert.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Carroyage et lignes/quadrillé grand vert.thumbnail.png rename to resources/library/pictures/Fonds/Carroyage et lignes/quadrille grand vert.thumbnail.png diff --git a/resources/library/pictures/Fonds/Carroyage et lignes/quadrillé petit bleu.png b/resources/library/pictures/Fonds/Carroyage et lignes/quadrille petit bleu.png similarity index 100% rename from resources/library/pictures/Fonds/Carroyage et lignes/quadrillé petit bleu.png rename to resources/library/pictures/Fonds/Carroyage et lignes/quadrille petit bleu.png diff --git a/resources/library/pictures/Fonds/Carroyage et lignes/quadrillé petit bleu.thumbnail.png b/resources/library/pictures/Fonds/Carroyage et lignes/quadrille petit bleu.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Carroyage et lignes/quadrillé petit bleu.thumbnail.png rename to resources/library/pictures/Fonds/Carroyage et lignes/quadrille petit bleu.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/jaune.png b/resources/library/pictures/Fonds/Fonds colorees/jaune.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/jaune.png rename to resources/library/pictures/Fonds/Fonds colorees/jaune.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/jaune.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/jaune.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/jaune.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/jaune.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/jaune_pale.png b/resources/library/pictures/Fonds/Fonds colorees/jaune_pale.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/jaune_pale.png rename to resources/library/pictures/Fonds/Fonds colorees/jaune_pale.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/jaune_pale.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/jaune_pale.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/jaune_pale.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/jaune_pale.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/rouge.png b/resources/library/pictures/Fonds/Fonds colorees/rouge.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/rouge.png rename to resources/library/pictures/Fonds/Fonds colorees/rouge.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/rouge.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/rouge.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/rouge.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/rouge.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/rouge_pale.png b/resources/library/pictures/Fonds/Fonds colorees/rouge_pale.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/rouge_pale.png rename to resources/library/pictures/Fonds/Fonds colorees/rouge_pale.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/rouge_pale.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/rouge_pale.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/rouge_pale.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/rouge_pale.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/vert.png b/resources/library/pictures/Fonds/Fonds colorees/vert.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/vert.png rename to resources/library/pictures/Fonds/Fonds colorees/vert.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/vert.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/vert.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/vert.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/vert.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/vert_pale.png b/resources/library/pictures/Fonds/Fonds colorees/vert_pale.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/vert_pale.png rename to resources/library/pictures/Fonds/Fonds colorees/vert_pale.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/vert_pale.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/vert_pale.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/vert_pale.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/vert_pale.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/violet.png b/resources/library/pictures/Fonds/Fonds colorees/violet.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/violet.png rename to resources/library/pictures/Fonds/Fonds colorees/violet.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/violet.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/violet.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/violet.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/violet.thumbnail.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/violet_pale.png b/resources/library/pictures/Fonds/Fonds colorees/violet_pale.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/violet_pale.png rename to resources/library/pictures/Fonds/Fonds colorees/violet_pale.png diff --git a/resources/library/pictures/Fonds/Fonds colorés/violet_pale.thumbnail.png b/resources/library/pictures/Fonds/Fonds colorees/violet_pale.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Fonds colorés/violet_pale.thumbnail.png rename to resources/library/pictures/Fonds/Fonds colorees/violet_pale.thumbnail.png diff --git a/resources/library/pictures/Fonds/Musique/clé de sol.png b/resources/library/pictures/Fonds/Musique/cle de sol.png similarity index 100% rename from resources/library/pictures/Fonds/Musique/clé de sol.png rename to resources/library/pictures/Fonds/Musique/cle de sol.png diff --git a/resources/library/pictures/Fonds/Musique/clé de sol.thumbnail.png b/resources/library/pictures/Fonds/Musique/cle de sol.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Musique/clé de sol.thumbnail.png rename to resources/library/pictures/Fonds/Musique/cle de sol.thumbnail.png diff --git a/resources/library/pictures/Fonds/Plateaux jeux/jeu d'échelle.jpg b/resources/library/pictures/Fonds/Plateaux jeux/jeu d'echelle.jpg similarity index 100% rename from resources/library/pictures/Fonds/Plateaux jeux/jeu d'échelle.jpg rename to resources/library/pictures/Fonds/Plateaux jeux/jeu d'echelle.jpg diff --git a/resources/library/pictures/Fonds/Plateaux jeux/jeu d'échelle.thumbnail.png b/resources/library/pictures/Fonds/Plateaux jeux/jeu d'echelle.thumbnail.png similarity index 100% rename from resources/library/pictures/Fonds/Plateaux jeux/jeu d'échelle.thumbnail.png rename to resources/library/pictures/Fonds/Plateaux jeux/jeu d'echelle.thumbnail.png diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 7f420e8e..66191a95 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -184,34 +184,6 @@ void UBPlatformUtils::fadeDisplayIn() } } - -//QString UBPlatformUtils::preferredTranslation(QString pFilePrefix) -//{ -// QString qmPath; -// NSString* filePrefix = [[NSString alloc] initWithUTF8String:(const char*)(pFilePrefix.toUtf8())]; - -// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - -// NSString *lprojPath = [[[NSBundle mainBundle] pathForResource:@"Localizable" ofType:@"strings"] stringByDeletingLastPathComponent]; -// if (lprojPath) -// { -// NSString *lang = [[lprojPath lastPathComponent] stringByDeletingPathExtension]; -// NSString *translationFilePath = [lprojPath stringByAppendingPathComponent:[[filePrefix stringByAppendingString:lang] stringByAppendingPathExtension:@"qm"]]; -// qmPath = QString::fromUtf8([translationFilePath UTF8String], strlen([translationFilePath UTF8String])); -// } - -// [pool drain]; -// return qmPath; -//} - -//QString UBPlatformUtils::preferredLanguage() -//{ -// QFileInfo qmFileInfo = QFileInfo(preferredTranslation("sankore_")); -// QDir lprojPath = qmFileInfo.dir(); -// QFileInfo lprojFileInfo = QFileInfo(lprojPath.absolutePath()); -// return lprojFileInfo.baseName(); -//} - QStringList UBPlatformUtils::availableTranslations() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];