Resolved missing icon for Favorite

preferencesAboutTextFull
Claudio Valerio 14 years ago
parent a37bcd583e
commit 6c742be862
  1. 7
      src/board/UBLibraryController.cpp
  2. 6
      src/tools/UBToolsManager.cpp
  3. 3
      src/tools/UBToolsManager.h

@ -262,6 +262,9 @@ QImage* UBLibraryController::createThumbnail(UBLibElement* pElement)
QImage* UBLibraryController::thumbnailForFile(UBLibElement* pElement) QImage* UBLibraryController::thumbnailForFile(UBLibElement* pElement)
{ {
if (pElement->path().toString().contains("uniboardTool://"))
return &UBToolsManager::manager()->iconFromToolId(pElement->path().toString()).toImage();
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(pElement->path().toLocalFile()); QString thumbnailPath = UBFileSystemUtils::thumbnailPath(pElement->path().toLocalFile());
if (!thumbnailPath.length()) if (!thumbnailPath.length())
@ -490,7 +493,7 @@ void UBLibraryController::persistFavoriteList()
foreach(UBLibElement* eachElement, mFavoriteList) foreach(UBLibElement* eachElement, mFavoriteList)
{ {
out << (quint32)eachElement->type(); out << (quint32)eachElement->type();
out << eachElement->path(); out << eachElement->path().toString();
out << eachElement->information(); out << eachElement->information();
out << eachElement->name(); out << eachElement->name();
out << eachElement->extension(); out << eachElement->extension();
@ -517,7 +520,7 @@ void UBLibraryController::readFavoriteList()
in >> type >> path >> info >> name >> extension; in >> type >> path >> info >> name >> extension;
UBLibElement* eachElement = new UBLibElement((eUBLibElementType)type, path, name); UBLibElement* eachElement = new UBLibElement((eUBLibElementType)type, QUrl(path), name);
eachElement->setInformation(info); eachElement->setInformation(info);
eachElement->setExtension(extension); eachElement->setExtension(extension);
eachElement->setThumbnail(thumbnailForFile(eachElement)); eachElement->setThumbnail(thumbnailForFile(eachElement));

@ -17,24 +17,28 @@ UBToolsManager::UBToolsManager(QObject *parent)
mask.icon = QPixmap(":/images/toolPalette/maskTool.png"); mask.icon = QPixmap(":/images/toolPalette/maskTool.png");
mask.label = tr("Mask"); mask.label = tr("Mask");
mask.version = "1.0"; mask.version = "1.0";
mToolsIcon.insert(mask.id, mask.icon);
mDescriptors << mask; mDescriptors << mask;
ruler.id = "uniboardTool://uniboard.mnemis.com/ruler"; ruler.id = "uniboardTool://uniboard.mnemis.com/ruler";
ruler.icon = QPixmap(":/images/toolPalette/rulerTool.png"); ruler.icon = QPixmap(":/images/toolPalette/rulerTool.png");
ruler.label = tr("Ruler"); ruler.label = tr("Ruler");
ruler.version = "1.0"; ruler.version = "1.0";
mToolsIcon.insert(ruler.id, ruler.icon);
mDescriptors << ruler; mDescriptors << ruler;
compass.id = "uniboardTool://uniboard.mnemis.com/compass"; compass.id = "uniboardTool://uniboard.mnemis.com/compass";
compass.icon = QPixmap(":/images/toolPalette/compassTool.png"); compass.icon = QPixmap(":/images/toolPalette/compassTool.png");
compass.label = tr("Compass"); compass.label = tr("Compass");
compass.version = "1.0"; compass.version = "1.0";
mToolsIcon.insert(compass.id, compass.icon);
mDescriptors << compass; mDescriptors << compass;
protractor.id = "uniboardTool://uniboard.mnemis.com/protractor"; protractor.id = "uniboardTool://uniboard.mnemis.com/protractor";
protractor.icon = QPixmap(":/images/toolPalette/protractorTool.png"); protractor.icon = QPixmap(":/images/toolPalette/protractorTool.png");
protractor.label = tr("Protractor"); protractor.label = tr("Protractor");
protractor.version = "1.0"; protractor.version = "1.0";
mToolsIcon.insert(protractor.id, protractor.icon);
mDescriptors << protractor; mDescriptors << protractor;
} }
@ -42,4 +46,4 @@ UBToolsManager::UBToolsManager(QObject *parent)
UBToolsManager::~UBToolsManager() UBToolsManager::~UBToolsManager()
{ {
// NOOP // NOOP
} }

@ -70,6 +70,7 @@ class UBToolsManager : public QObject
UBToolDescriptor compass; UBToolDescriptor compass;
UBToolDescriptor mask; UBToolDescriptor mask;
QPixmap iconFromToolId(QString id) { return mToolsIcon.value(id);}
private: private:
UBToolsManager(QObject *parent = 0); UBToolsManager(QObject *parent = 0);
@ -79,6 +80,8 @@ class UBToolsManager : public QObject
QList<UBToolDescriptor> mDescriptors; QList<UBToolDescriptor> mDescriptors;
QMap<QString ,QPixmap> mToolsIcon;
}; };
#endif /* UBTOOLSMANAGER_H_ */ #endif /* UBTOOLSMANAGER_H_ */

Loading…
Cancel
Save