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

preferencesAboutTextFull
bmagnin 12 years ago
commit f50aa58ee9
  1. 24
      Sankore_3.1.pro
  2. 16
      plugins/cffadaptor/src/UBCFFAdaptor.cpp
  3. 7
      plugins/cffadaptor/src/UBCFFAdaptor.h
  4. 1
      plugins/cffadaptor/src/UBCFFConstants.h
  5. 11
      src/adaptors/UBExportAdaptor.cpp
  6. 2
      src/adaptors/UBExportAdaptor.h
  7. 1
      src/adaptors/UBExportCFF.cpp
  8. 2
      src/board/UBBoardController.cpp
  9. 10
      src/board/UBBoardPaletteManager.cpp
  10. 30
      src/board/UBBoardView.cpp
  11. 2
      src/board/UBBoardView.h
  12. 5
      src/board/UBDrawingController.cpp
  13. 22
      src/board/UBFeaturesController.cpp
  14. 26
      src/domain/UBGraphicsMediaItem.cpp
  15. 11
      src/domain/UBGraphicsMediaItem.h
  16. 3
      src/domain/UBGraphicsScene.cpp
  17. 23
      src/gui/UBFeaturesWidget.cpp
  18. 1
      src/gui/UBFeaturesWidget.h
  19. 56
      src/gui/UBMessagesDialog.cpp
  20. 37
      src/gui/UBMessagesDialog.h
  21. 1
      src/gui/UBZoomPalette.cpp
  22. 6
      src/gui/gui.pri

@ -327,6 +327,25 @@ macx {
TRANSLATION_ca.path = "$$RESOURCES_DIR/ca.lproj" TRANSLATION_ca.path = "$$RESOURCES_DIR/ca.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_ca QMAKE_BUNDLE_DATA += TRANSLATION_ca
} }
exists(resources/i18n/sankore_el.qm) {
TRANSLATION_el.files = resources/i18n/sankore_el.qm \
resources/i18n/Localizable.strings
TRANSLATION_el.path = "$$RESOURCES_DIR/el.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_el
}
exists(resources/i18n/sankore_tr.qm) {
TRANSLATION_tr.files = resources/i18n/sankore_tr.qm \
resources/i18n/Localizable.strings
TRANSLATION_tr.path = "$$RESOURCES_DIR/tr.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_tr
}
exists(resources/i18n/sankore_cs.qm) {
TRANSLATION_cs.files = resources/i18n/sankore_cs.qm \
resources/i18n/Localizable.strings
TRANSLATION_cs.path = "$$RESOURCES_DIR/cs.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_cs
}
QMAKE_BUNDLE_DATA += UB_ETC \ QMAKE_BUNDLE_DATA += UB_ETC \
UB_LIBRARY \ UB_LIBRARY \
@ -391,7 +410,10 @@ TRANSLATIONS = resources/i18n/sankore_en.ts \
resources/i18n/sankore_pt.ts \ resources/i18n/sankore_pt.ts \
resources/i18n/sankore_sk.ts \ resources/i18n/sankore_sk.ts \
resources/i18n/sankore_bg.ts \ resources/i18n/sankore_bg.ts \
resources/i18n/sankore_ca.ts resources/i18n/sankore_ca.ts \
resources/i18n/sankore_el.ts \
resources/i18n/sankore_tr.ts \
resources/i18n/sankore_cs.ts
INSTALLS = UB_ETC \ INSTALLS = UB_ETC \
UB_I18N \ UB_I18N \

@ -47,7 +47,12 @@ bool UBCFFAdaptor::convertUBZToIWB(const QString &from, const QString &to)
qDebug() << "The convertrer class is invalid, stopping conversion. Error message" << tmpConvertrer.lastErrStr(); qDebug() << "The convertrer class is invalid, stopping conversion. Error message" << tmpConvertrer.lastErrStr();
return false; return false;
} }
if (!tmpConvertrer.parse()) {
bool bParceRes = tmpConvertrer.parse();
mConversionMessages << tmpConvertrer.getMessages();
if (!bParceRes) {
return false; return false;
} }
@ -299,6 +304,12 @@ bool UBCFFAdaptor::deleteDir(const QString& pDirPath) const
return dir.rmdir(pDirPath); return dir.rmdir(pDirPath);
} }
QList<QString> UBCFFAdaptor::getConversionMessages()
{
return mConversionMessages;
}
bool UBCFFAdaptor::freeDir(const QString &dir) bool UBCFFAdaptor::freeDir(const QString &dir)
{ {
bool result = true; bool result = true;
@ -1110,6 +1121,9 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle
} }
}else }else
{ {
addLastExportError(QObject::tr("Element ID = ") + QString("%1 \r\n").arg(ubzElement.attribute(aUBZUuid))
+ QString("Source file = ") + QString("%1 \r\n").arg(ubzElement.attribute(aUBZSource))
+ QObject::tr("Content is not supported in destination format."));
bRet = false; bRet = false;
} }

@ -20,6 +20,7 @@ public:
bool convertUBZToIWB(const QString &from, const QString &to); bool convertUBZToIWB(const QString &from, const QString &to);
bool deleteDir(const QString& pDirPath) const; bool deleteDir(const QString& pDirPath) const;
QList<QString> getConversionMessages();
private: private:
QString uncompressZip(const QString &zipFile); QString uncompressZip(const QString &zipFile);
@ -33,6 +34,7 @@ private:
private: private:
QStringList tmpDirs; QStringList tmpDirs;
QList<QString> mConversionMessages;
private: private:
@ -46,8 +48,12 @@ private:
bool isValid() const; bool isValid() const;
QString lastErrStr() const {return errorStr;} QString lastErrStr() const {return errorStr;}
bool parse(); bool parse();
QList<QString> getMessages() {return mExportErrorList;}
private: private:
void addLastExportError(QString error) {mExportErrorList.append(error);}
void fillNamespaces(); void fillNamespaces();
bool parseMetadata(); bool parseMetadata();
@ -119,6 +125,7 @@ private:
QString contentIWBFileName() const; QString contentIWBFileName() const;
private: private:
QList<QString> mExportErrorList;
QMap<QString, QString> iwbSVGItemsAttributes; QMap<QString, QString> iwbSVGItemsAttributes;
QDomDocument *mDataModel; //model for reading indata QDomDocument *mDataModel; //model for reading indata
QXmlStreamWriter *mIWBContentWriter; //stream to write outdata QXmlStreamWriter *mIWBContentWriter; //stream to write outdata

@ -74,6 +74,7 @@ const QString aRef = "ref"; // as reference for applying additional attributes
const QString aSVGHref = "xlink:href"; // reference to file const QString aSVGHref = "xlink:href"; // reference to file
const QString aIWBHref = "ref"; // reference to element ID const QString aIWBHref = "ref"; // reference to element ID
const QString aUBZHref = "href"; const QString aUBZHref = "href";
const QString aUBZSource = "source";
const QString aSrc = "src"; const QString aSrc = "src";
const QString aSVGRequiredExtension = "requiredExtensions"; const QString aSVGRequiredExtension = "requiredExtensions";

@ -24,6 +24,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "gui/UBMessagesDialog.h"
#include "core/memcheck.h" #include "core/memcheck.h"
@ -103,3 +104,13 @@ QString UBExportAdaptor::askForDirName(UBDocumentProxy* pDocument, const QString
return dirname; return dirname;
} }
void UBExportAdaptor::showErrorsList(QList<QString> errorsList)
{
if (errorsList.count())
{
UBMessagesDialog *dialog = new UBMessagesDialog(tr("Warnings during export was appeared"), UBApplication::mainWindow);
dialog->setMessages(errorsList);
dialog->show();
}
}

@ -46,6 +46,8 @@ class UBExportAdaptor : public QObject
QString askForFileName(UBDocumentProxy* pDocument, const QString& pDialogTitle); QString askForFileName(UBDocumentProxy* pDocument, const QString& pDialogTitle);
QString askForDirName(UBDocumentProxy* pDocument, const QString& pDialogTitle); QString askForDirName(UBDocumentProxy* pDocument, const QString& pDialogTitle);
void showErrorsList(QList<QString> errorsList);
bool mIsVerbose; bool mIsVerbose;
}; };

@ -52,6 +52,7 @@ void UBExportCFF::persist(UBDocumentProxy* pDocument)
if (mIsVerbose) if (mIsVerbose)
UBApplication::showMessage(tr("Export failed.")); UBApplication::showMessage(tr("Export failed."));
showErrorsList(toIWBExporter.getConversionMessages());
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();

@ -1102,7 +1102,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
QUuid uuid = QUuid::createUuid(); QUuid uuid = QUuid::createUuid();
QUrl url = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager() QUrl url = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager()
->addVideoFileToDocument(selectedDocument(), sourceUrl, pData, uuid)); ->addAudioFileToDocument(selectedDocument(), sourceUrl, pData, uuid));
audioMediaItem = mActiveScene->addMedia(url, false, pPos); audioMediaItem = mActiveScene->addMedia(url, false, pPos);

@ -269,6 +269,8 @@ void UBBoardPaletteManager::setupPalettes()
mZoomPalette = new UBZoomPalette(mContainer); mZoomPalette = new UBZoomPalette(mContainer);
mStylusPalette->stackUnder(mZoomPalette);
QList<QAction*> backgroundsActions; QList<QAction*> backgroundsActions;
backgroundsActions << UBApplication::mainWindow->actionPlainLightBackground; backgroundsActions << UBApplication::mainWindow->actionPlainLightBackground;
@ -677,6 +679,10 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{ {
case eUBDockPaletteWidget_BOARD: case eUBDockPaletteWidget_BOARD:
{ {
// On Application start up the mAddItemPalette isn't initialized yet
if(mAddItemPalette){
mAddItemPalette->setParent(UBApplication::boardController->controlContainer());
}
mLeftPalette->assignParent(mContainer); mLeftPalette->assignParent(mContainer);
mRightPalette->assignParent(mContainer); mRightPalette->assignParent(mContainer);
mRightPalette->stackUnder(mStylusPalette); mRightPalette->stackUnder(mStylusPalette);
@ -710,6 +716,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
case eUBDockPaletteWidget_DESKTOP: case eUBDockPaletteWidget_DESKTOP:
{ {
mAddItemPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mLeftPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mLeftPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mRightPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mRightPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mRightPalette->lower(); mRightPalette->lower();
@ -745,7 +752,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mRightPalette->setAdditionalVOffset(30); mRightPalette->setAdditionalVOffset(30);
#endif #endif
if( !isInit ) if(!isInit)
UBApplication::applicationController->uninotesController()->TransparentWidgetResized(); UBApplication::applicationController->uninotesController()->TransparentWidgetResized();
if (mWebToolsCurrentPalette) if (mWebToolsCurrentPalette)
@ -755,6 +762,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
case eUBDockPaletteWidget_WEB: case eUBDockPaletteWidget_WEB:
{ {
mAddItemPalette->setParent(UBApplication::mainWindow);
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{ {
// tmp variable? // tmp variable?

@ -106,8 +106,7 @@ UBBoardView::~UBBoardView () {
delete suspendedMousePressEvent; delete suspendedMousePressEvent;
} }
void void UBBoardView::init ()
UBBoardView::init ()
{ {
connect (UBSettings::settings ()->boardPenPressureSensitive, SIGNAL (changed (QVariant)), connect (UBSettings::settings ()->boardPenPressureSensitive, SIGNAL (changed (QVariant)),
this, SLOT (settingChanged (QVariant))); this, SLOT (settingChanged (QVariant)));
@ -144,8 +143,6 @@ UBBoardView::init ()
movingItem = NULL; movingItem = NULL;
mWidgetMoved = false; mWidgetMoved = false;
connectToStylusPalette();
} }
UBGraphicsScene* UBGraphicsScene*
@ -1441,28 +1438,3 @@ UBBoardView::setToolCursor (int tool)
controlViewport->setCursor (UBResources::resources ()->penCursor); controlViewport->setCursor (UBResources::resources ()->penCursor);
} }
} }
void UBBoardView::connectToStylusPalette()
{
connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
}
void UBBoardView::onTriggeredAction(bool checked)
{
Q_UNUSED(checked);
QList<QGraphicsItem*> it = scene()->selectedItems();
foreach(QGraphicsItem* i, it){
i->setSelected(false);
}
}

@ -94,7 +94,6 @@ class UBBoardView : public QGraphicsView
private: private:
void init(); void init();
void connectToStylusPalette();
inline bool shouldDisplayItem(QGraphicsItem *item) inline bool shouldDisplayItem(QGraphicsItem *item)
{ {
@ -152,7 +151,6 @@ class UBBoardView : public QGraphicsView
private slots: private slots:
void settingChanged(QVariant newValue); void settingChanged(QVariant newValue);
void onTriggeredAction(bool checked);
public slots: public slots:

@ -18,8 +18,10 @@
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "gui/UBMainWindow.h" #include "domain/UBGraphicsScene.h"
#include "board/UBBoardController.h"
#include "gui/UBMainWindow.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBDrawingController* UBDrawingController::sDrawingController = 0; UBDrawingController* UBDrawingController::sDrawingController = 0;
@ -87,6 +89,7 @@ void UBDrawingController::setStylusTool(int tool)
{ {
if (tool != mStylusTool) if (tool != mStylusTool)
{ {
UBApplication::boardController->activeScene()->deselectAllItems();
if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker
|| mStylusTool == UBStylusTool::Line) || mStylusTool == UBStylusTool::Line)
{ {

@ -263,17 +263,17 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
trashDirectoryPath = QUrl::fromLocalFile(UBSettings::userTrashDirPath()); trashDirectoryPath = QUrl::fromLocalFile(UBSettings::userTrashDirPath());
rootElement = UBFeature(QString(), QImage( ":images/libpalette/home.png" ), "root", QUrl()); rootElement = UBFeature(QString(), QImage( ":images/libpalette/home.png" ), "root", QUrl());
audiosElement = UBFeature( rootPath, QImage(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath, FEATURE_CATEGORY); audiosElement = UBFeature( rootPath, QImage(":images/libpalette/AudiosCategory.svg"), tr("Audios") , mUserAudioDirectoryPath, FEATURE_CATEGORY);
moviesElement = UBFeature( rootPath, QImage(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath, FEATURE_CATEGORY); moviesElement = UBFeature( rootPath, QImage(":images/libpalette/MoviesCategory.svg"), tr("Movies") , mUserVideoDirectoryPath, FEATURE_CATEGORY);
picturesElement = UBFeature( rootPath, QImage(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath, FEATURE_CATEGORY); picturesElement = UBFeature( rootPath, QImage(":images/libpalette/PicturesCategory.svg"), tr("Pictures") , mUserPicturesDirectoryPath, FEATURE_CATEGORY);
flashElement = UBFeature( rootPath, QImage(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath, FEATURE_CATEGORY); flashElement = UBFeature( rootPath, QImage(":images/libpalette/FlashCategory.svg"), tr("Animations") , mUserAnimationDirectoryPath, FEATURE_CATEGORY);
interactElement = UBFeature( rootPath, QImage(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath, FEATURE_CATEGORY); interactElement = UBFeature( rootPath, QImage(":images/libpalette/InteractivesCategory.svg"), tr("Interactivities") , mLibInteractiveDirectoryPath, FEATURE_CATEGORY);
applicationsElement = UBFeature( rootPath, QImage(":images/libpalette/ApplicationsCategory.svg"), "Applications" , mUserInteractiveDirectoryPath, FEATURE_CATEGORY); applicationsElement = UBFeature( rootPath, QImage(":images/libpalette/ApplicationsCategory.svg"), tr("Applications") , mUserInteractiveDirectoryPath, FEATURE_CATEGORY);
shapesElement = UBFeature( rootPath, QImage(":images/libpalette/ShapesCategory.svg"), "Shapes" , mLibShapesDirectoryPath, FEATURE_CATEGORY ); shapesElement = UBFeature( rootPath, QImage(":images/libpalette/ShapesCategory.svg"), tr("Shapes") , mLibShapesDirectoryPath, FEATURE_CATEGORY );
favoriteElement = UBFeature( rootPath, QImage(":images/libpalette/FavoritesCategory.svg"), "Favorites", QUrl("favorites"), FEATURE_FAVORITE ); favoriteElement = UBFeature( rootPath, QImage(":images/libpalette/FavoritesCategory.svg"), tr("Favorites"), QUrl("favorites"), FEATURE_FAVORITE );
webSearchElement = UBFeature( rootPath, QImage(":images/libpalette/WebSearchCategory.svg"), "Web search", mLibSearchDirectoryPath, FEATURE_CATEGORY); webSearchElement = UBFeature( rootPath, QImage(":images/libpalette/WebSearchCategory.svg"), tr("Web search"), mLibSearchDirectoryPath, FEATURE_CATEGORY);
trashElement = UBFeature( rootPath, QImage(":images/libpalette/TrashCategory.svg"), "Trash", trashDirectoryPath, FEATURE_TRASH ); trashElement = UBFeature( rootPath, QImage(":images/libpalette/TrashCategory.svg"), tr("Trash"), trashDirectoryPath, FEATURE_TRASH );
featuresList = new QList <UBFeature>(); featuresList = new QList <UBFeature>();

@ -36,15 +36,13 @@ void UBAudioPresentationWidget::paintEvent(QPaintEvent *event)
{ {
QPainter painter(this); QPainter painter(this);
painter.fillRect(rect(), QBrush(Qt::white)); painter.fillRect(rect(), QBrush(Qt::white));
painter.drawRoundedRect(1,1, width()-2, height()-2, height()/5, height()/5);
QPen borderPen;
QImage mask_img(size(), QImage::Format_Mono); borderPen.setWidth(2);
mask_img.fill(0xff); borderPen.setColor(QColor(Qt::black));
QPainter mask_painter(&mask_img);
mask_painter.setBrush(QBrush( QColor(0, 0, 0)));
mask_painter.drawRoundedRect(1,1, width()-3, height()-3, height()/5, height()/5);
setMask(QBitmap::fromImage(mask_img)); painter.setPen(borderPen);
painter.drawRect(0,0, width(), height());
if (QString() != mTitle) if (QString() != mTitle)
{ {
@ -178,6 +176,18 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
return UBGraphicsProxyWidget::itemChange(change, value); return UBGraphicsProxyWidget::itemChange(change, value);
} }
void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
{
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toString()));
}
UBItem::setSourceUrl(pSourceUrl);
}
void UBGraphicsMediaItem::clearSource() void UBGraphicsMediaItem::clearSource()
{ {
QString path = mediaFileUrl().toLocalFile(); QString path = mediaFileUrl().toLocalFile();

@ -97,16 +97,7 @@ public:
virtual void copyItemParameters(UBItem *copy) const; virtual void copyItemParameters(UBItem *copy) const;
virtual void setSourceUrl(const QUrl &pSourceUrl) virtual void setSourceUrl(const QUrl &pSourceUrl);
{
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toLocalFile()));
}
UBItem::setSourceUrl(pSourceUrl);
}
public slots: public slots:

@ -1270,7 +1270,7 @@ void UBGraphicsScene::clearAnnotations()
while (itItems.hasNext()) while (itItems.hasNext())
{ {
QGraphicsItem* item = itItems.next(); QGraphicsItem* item = itItems.next();
UBGraphicsPolygonItem* pi = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); UBGraphicsStrokesGroup* pi = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item);
if (pi) if (pi)
{ {
removeItem(item); removeItem(item);
@ -2351,6 +2351,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
default: default:
{ {
item->setSelected(false);
UBGraphicsItem *ubgi = dynamic_cast<UBGraphicsItem*>(item); UBGraphicsItem *ubgi = dynamic_cast<UBGraphicsItem*>(item);
if (0 != ubgi) if (0 != ubgi)
ubgi->remove(); ubgi->remove();

@ -107,7 +107,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
QString objName = sender()->objectName(); QString objName = sender()->objectName();
if (objName.isEmpty()) { if (objName.isEmpty()) {
qWarning() << "incorrrect sender"; qWarning() << "incorrect sender";
} else if (objName == objNamePathList) { } else if (objName == objNamePathList) {
//Calling to reset the model for listView. Maybe separate function needed //Calling to reset the model for listView. Maybe separate function needed
controller->searchStarted("", centralWidget->listView()); controller->searchStarted("", centralWidget->listView());
@ -478,12 +478,12 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare
//Used to show search bar on the search widget //Used to show search bar on the search widget
webView = new UBFeaturesWebView(this); webView = new UBFeaturesWebView(this);
//filling stackwidget //filling stackwidget
mStackedWidget->addWidget(mNavigator); mStackedWidget->addWidget(mNavigator);
mStackedWidget->addWidget(mFeatureProperties); mStackedWidget->addWidget(mFeatureProperties);
mStackedWidget->addWidget(webView); mStackedWidget->addWidget(webView);
mStackedWidget->setCurrentIndex(MainList); mStackedWidget->setCurrentIndex(MainList);
mStackedWidget->setContentsMargins(0, 0, 0, 0); mStackedWidget->setContentsMargins(0, 0, 0, 0);
mAdditionalDataContainer = new QStackedWidget(this); mAdditionalDataContainer = new QStackedWidget(this);
@ -542,7 +542,7 @@ void UBFeaturesCentralWidget::setPropertiesThumbnail(const QPixmap &pix)
UBFeature UBFeaturesCentralWidget::getCurElementFromProperties() UBFeature UBFeaturesCentralWidget::getCurElementFromProperties()
{ {
return mFeatureProperties->getCurrentElement(); return mFeatureProperties->getCurrentElement();
} }
void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState) void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)
@ -732,7 +732,7 @@ UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(
mpView->setObjectName("SearchEngineView"); mpView->setObjectName("SearchEngineView");
mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene()); mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene());
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI); mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI);
connect(mpView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared()));
mpWebSettings = QWebSettings::globalSettings(); mpWebSettings = QWebSettings::globalSettings();
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true); mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true); mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true);
@ -767,6 +767,11 @@ UBFeaturesWebView::~UBFeaturesWebView()
} }
} }
void UBFeaturesWebView::javaScriptWindowObjectCleared()
{
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI);
}
void UBFeaturesWebView::showElement(const UBFeature &elem) void UBFeaturesWebView::showElement(const UBFeature &elem)
{ {
QString qsWidgetName; QString qsWidgetName;

@ -288,6 +288,7 @@ public:
private slots: private slots:
void onLoadFinished(bool ok); void onLoadFinished(bool ok);
void javaScriptWindowObjectCleared();
private: private:
QWebView* mpView; QWebView* mpView;

@ -0,0 +1,56 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBMessagesDialog.h"
UBMessagesDialog::UBMessagesDialog(QString windowTitle, QWidget *parent)
: QWidget(parent)
{
resize(400, 0);
setWindowTitle(windowTitle);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
}
void UBMessagesDialog::setMessages(const QList<QString> messages)
{
mMessages = messages;
if (mMessages.count())
{
QVBoxLayout *messagesLayout = new QVBoxLayout(this);
foreach (QString message, mMessages)
{
QTextEdit *messageBox = new QTextEdit(this);
messageBox->setMinimumHeight(55);
messageBox->setReadOnly(true);
messageBox->setFocusPolicy(Qt::NoFocus);
messageBox->setText(message);
messagesLayout->addWidget(messageBox);
}
QPushButton *closeButton = new QPushButton(tr("Close"), this);
connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(dispose()));
messagesLayout->addWidget(closeButton);
setLayout(messagesLayout);
}
}
void UBMessagesDialog::dispose()
{
delete this;
}

@ -0,0 +1,37 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UB_MESSAGES_DIALOG_H_
#define UB_MESSAGES_DIALOG_H_
#include <QtGui>
class UBMessagesDialog : public QWidget
{
Q_OBJECT
public:
UBMessagesDialog(QString windowTitle, QWidget *parent = NULL);
void setMessages(const QList<QString> messages);
private slots:
void dispose();
private:
QList<QString> mMessages;
int mMessagesFontSize;
};
#endif UB_MESSAGES_DIALOG_H_

@ -109,5 +109,6 @@ void UBZoomPalette::refreshPalette()
else else
{ {
show(); show();
raise();
} }
} }

@ -50,7 +50,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBFeaturesActionBar.h \ src/gui/UBFeaturesActionBar.h \
src/gui/UBDockTeacherGuideWidget.h \ src/gui/UBDockTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidget.h \ src/gui/UBTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidgetsTools.h src/gui/UBTeacherGuideWidgetsTools.h \
src/gui/UBMessagesDialog.h
SOURCES += src/gui/UBThumbnailView.cpp \ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \ src/gui/UBFloatingPalette.cpp \
@ -103,7 +104,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFeaturesActionBar.cpp \ src/gui/UBFeaturesActionBar.cpp \
src/gui/UBDockTeacherGuideWidget.cpp \ src/gui/UBDockTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidget.cpp \ src/gui/UBTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidgetsTools.cpp src/gui/UBTeacherGuideWidgetsTools.cpp \
src/gui/UBMessagesDialog.cpp
win32 { win32 {

Loading…
Cancel
Save