Commit 59b3ecd2 authored by shibakaneki's avatar shibakaneki

Fixed issue Sankore-16

parent fd6dbf74
...@@ -90,6 +90,12 @@ UBBoardPaletteManager::~UBBoardPaletteManager() ...@@ -90,6 +90,12 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
delete mLibPalette; delete mLibPalette;
mLibPalette = NULL; mLibPalette = NULL;
} }
if(NULL != mStylusPalette)
{
delete mStylusPalette;
mStylusPalette = NULL;
}
} }
void UBBoardPaletteManager::initPalettesPosAtStartup() void UBBoardPaletteManager::initPalettesPosAtStartup()
...@@ -641,9 +647,13 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var) ...@@ -641,9 +647,13 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var)
bool bVertical = var.toBool(); bool bVertical = var.toBool();
bool bVisible = mStylusPalette->isVisible(); bool bVisible = mStylusPalette->isVisible();
UBStylusPalette* mOldPalette;
// Clean the old palette // Clean the old palette
disconnect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int))); if(NULL != mStylusPalette)
delete mStylusPalette; {
// TODO : check why this line creates a crash in the application.
delete mStylusPalette;
}
// Create the new palette // Create the new palette
if(bVertical) if(bVertical)
......
...@@ -111,12 +111,12 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) ...@@ -111,12 +111,12 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
UBPlatformUtils::disableShadow(mDesktopMarkerPalette); UBPlatformUtils::disableShadow(mDesktopMarkerPalette);
mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView); mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView);
UBPlatformUtils::disableShadow(mDesktopEraserPalette); UBPlatformUtils::disableShadow(mDesktopEraserPalette);
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{ {
mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView); mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView);
connect(mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); connect(mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
} }
mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor); mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopToolsPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor); mDesktopToolsPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
......
...@@ -43,6 +43,7 @@ void UBActionPalette::init(Qt::Orientation orientation) ...@@ -43,6 +43,7 @@ void UBActionPalette::init(Qt::Orientation orientation)
mAutoClose = false; mAutoClose = false;
mButtonGroup = 0; mButtonGroup = 0;
mToolButtonStyle = Qt::ToolButtonIconOnly; mToolButtonStyle = Qt::ToolButtonIconOnly;
mButtons.clear();
QBoxLayout *layout = 0; QBoxLayout *layout = 0;
...@@ -111,7 +112,8 @@ QList<QAction*> UBActionPalette::actions() ...@@ -111,7 +112,8 @@ QList<QAction*> UBActionPalette::actions()
UBActionPalette::~UBActionPalette() UBActionPalette::~UBActionPalette()
{ {
qDeleteAll(mButtons.begin(), mButtons.end());
mButtons.clear();
} }
...@@ -160,6 +162,7 @@ void UBActionPalette::updateLayout() ...@@ -160,6 +162,7 @@ void UBActionPalette::updateLayout()
{ {
layout()->setContentsMargins (sLayoutContentMargin + border(), sLayoutContentMargin + border() layout()->setContentsMargins (sLayoutContentMargin + border(), sLayoutContentMargin + border()
, sLayoutContentMargin + border(), sLayoutContentMargin + border()); , sLayoutContentMargin + border(), sLayoutContentMargin + border());
} }
update(); update();
} }
...@@ -256,7 +259,7 @@ UBActionPaletteButton::UBActionPaletteButton(QAction* action, QWidget * parent) ...@@ -256,7 +259,7 @@ UBActionPaletteButton::UBActionPaletteButton(QAction* action, QWidget * parent)
UBActionPaletteButton::~UBActionPaletteButton() UBActionPaletteButton::~UBActionPaletteButton()
{ {
// NOOP
} }
......
...@@ -73,7 +73,6 @@ class UBActionPalette : public UBFloatingPalette ...@@ -73,7 +73,6 @@ class UBActionPalette : public UBFloatingPalette
QPoint mMousePos; QPoint mMousePos;
UBActionPaletteButton *createPaletteButton(QAction* action, QWidget *parent); UBActionPaletteButton *createPaletteButton(QAction* action, QWidget *parent);
private slots: private slots:
void buttonClicked(); void buttonClicked();
void actionChanged(); void actionChanged();
...@@ -82,7 +81,7 @@ class UBActionPalette : public UBFloatingPalette ...@@ -82,7 +81,7 @@ class UBActionPalette : public UBFloatingPalette
class UBActionPaletteButton : public QToolButton class UBActionPaletteButton : public QToolButton
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBActionPaletteButton(QAction* action, QWidget * parent = 0); UBActionPaletteButton(QAction* action, QWidget * parent = 0);
......
...@@ -17,7 +17,7 @@ typedef enum ...@@ -17,7 +17,7 @@ typedef enum
class UBFloatingPalette : public QWidget class UBFloatingPalette : public QWidget
{ {
Q_OBJECT; Q_OBJECT
public: public:
......
...@@ -95,7 +95,7 @@ void UBKeyboardButton::sendControlSymbol(int nSymbol) ...@@ -95,7 +95,7 @@ void UBKeyboardButton::sendControlSymbol(int nSymbol)
void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::createCtrlButtons()
{ {
ctrlButtons = new UBKeyboardButton*[7]; ctrlButtons = new UBKeyboardButton*[8];
ctrlButtons[0] = new UBCntrlButton(this, "<-", XK_BackSpace); ctrlButtons[0] = new UBCntrlButton(this, "<-", XK_BackSpace);
ctrlButtons[1] = new UBCntrlButton(this, "<->", XK_Tab); ctrlButtons[1] = new UBCntrlButton(this, "<->", XK_Tab);
......
...@@ -94,6 +94,12 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget() ...@@ -94,6 +94,12 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget()
} }
} }
void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
{
// Forward the mime data to the library widget
}
/** /**
* \brief Update the navigation bar * \brief Update the navigation bar
* @param pElem as the current element * @param pElem as the current element
......
...@@ -16,6 +16,7 @@ class UBLibNavigatorWidget : public QWidget ...@@ -16,6 +16,7 @@ class UBLibNavigatorWidget : public QWidget
public: public:
UBLibNavigatorWidget(QWidget* parent=0, const char* name="UBLibNavigatorWidget"); UBLibNavigatorWidget(QWidget* parent=0, const char* name="UBLibNavigatorWidget");
~UBLibNavigatorWidget(); ~UBLibNavigatorWidget();
void dropMe(const QMimeData* _data);
signals: signals:
void propertiesRequested(UBLibElement* elem); void propertiesRequested(UBLibElement* elem);
......
...@@ -12,6 +12,7 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare ...@@ -12,6 +12,7 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
, mNavigator(NULL) , mNavigator(NULL)
, mProperties(NULL) , mProperties(NULL)
, mActionBar(NULL) , mActionBar(NULL)
, mDropWidget(NULL)
{ {
setOrientation(eUBDockOrientation_Right); setOrientation(eUBDockOrientation_Right);
mIcon = QPixmap(":images/paletteLibrary.png"); mIcon = QPixmap(":images/paletteLibrary.png");
...@@ -31,14 +32,17 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare ...@@ -31,14 +32,17 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
mActionBar = new UBLibActionBar(this); mActionBar = new UBLibActionBar(this);
mNavigator = new UBLibNavigatorWidget(this); mNavigator = new UBLibNavigatorWidget(this);
mProperties = new UBLibItemProperties(this); mProperties = new UBLibItemProperties(this);
//mDropWidget = new UBDropMeWidget(this);
mLayout->addWidget(mStackedWidget, 1); mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mActionBar, 0); mLayout->addWidget(mActionBar, 0);
mStackedWidget->addWidget(mNavigator); mStackedWidget->addWidget(mNavigator);
mStackedWidget->addWidget(mProperties); mStackedWidget->addWidget(mProperties);
//mStackedWidget->addWidget(mDropWidget);
mStackedWidget->setCurrentIndex(ID_NAVIGATOR); mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
miCrntStackWidget = ID_NAVIGATOR;
connect(mNavigator, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(showProperties(UBLibElement*))); connect(mNavigator, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(showProperties(UBLibElement*)));
connect(mProperties, SIGNAL(showFolderContent()), this, SLOT(showFolder())); connect(mProperties, SIGNAL(showFolderContent()), this, SLOT(showFolder()));
...@@ -69,6 +73,11 @@ UBLibPalette::~UBLibPalette() ...@@ -69,6 +73,11 @@ UBLibPalette::~UBLibPalette()
delete mActionBar; delete mActionBar;
mActionBar = NULL; mActionBar = NULL;
} }
if(NULL != mDropWidget)
{
delete mDropWidget;
mDropWidget = NULL;
}
if(NULL != mLayout) if(NULL != mLayout)
{ {
delete mLayout; delete mLayout;
...@@ -93,9 +102,16 @@ void UBLibPalette::updateMaxWidth() ...@@ -93,9 +102,16 @@ void UBLibPalette::updateMaxWidth()
void UBLibPalette::dragEnterEvent(QDragEnterEvent *pEvent) void UBLibPalette::dragEnterEvent(QDragEnterEvent *pEvent)
{ {
setBackgroundRole(QPalette::Highlight); setBackgroundRole(QPalette::Highlight);
//mStackedWidget->setCurrentIndex(ID_DROPME);
pEvent->acceptProposedAction(); pEvent->acceptProposedAction();
} }
void UBLibPalette::dragLeaveEvent(QDragLeaveEvent *pEvent)
{
//mStackedWidget->setCurrentIndex(miCrntStackWidget);
pEvent->accept();
}
/** /**
* \brief Handles the drop event * \brief Handles the drop event
* @param pEvent as the drop event * @param pEvent as the drop event
...@@ -104,6 +120,7 @@ void UBLibPalette::dropEvent(QDropEvent *pEvent) ...@@ -104,6 +120,7 @@ void UBLibPalette::dropEvent(QDropEvent *pEvent)
{ {
processMimeData(pEvent->mimeData()); processMimeData(pEvent->mimeData());
setBackgroundRole(QPalette::Dark); setBackgroundRole(QPalette::Dark);
mStackedWidget->setCurrentIndex(miCrntStackWidget);
pEvent->acceptProposedAction(); pEvent->acceptProposedAction();
} }
...@@ -128,6 +145,7 @@ void UBLibPalette::processMimeData(const QMimeData *pData) ...@@ -128,6 +145,7 @@ void UBLibPalette::processMimeData(const QMimeData *pData)
{ {
qDebug() << "Dropped element format " << i << " = "<< qslFormats.at(i); qDebug() << "Dropped element format " << i << " = "<< qslFormats.at(i);
} }
// mNavigator->dropMe(pData);
} }
...@@ -151,6 +169,7 @@ void UBLibPalette::showProperties(UBLibElement *elem) ...@@ -151,6 +169,7 @@ void UBLibPalette::showProperties(UBLibElement *elem)
// Show the properties of this object // Show the properties of this object
mProperties->showElement(elem); mProperties->showElement(elem);
mStackedWidget->setCurrentIndex(ID_PROPERTIES); mStackedWidget->setCurrentIndex(ID_PROPERTIES);
miCrntStackWidget = ID_PROPERTIES;
} }
} }
...@@ -158,6 +177,7 @@ void UBLibPalette::showFolder() ...@@ -158,6 +177,7 @@ void UBLibPalette::showFolder()
{ {
mActionBar->setButtons(mActionBar->previousButtonSet()); mActionBar->setButtons(mActionBar->previousButtonSet());
mStackedWidget->setCurrentIndex(ID_NAVIGATOR); mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
miCrntStackWidget = ID_NAVIGATOR;
} }
void UBLibPalette::resizeEvent(QResizeEvent *event) void UBLibPalette::resizeEvent(QResizeEvent *event)
...@@ -165,3 +185,30 @@ void UBLibPalette::resizeEvent(QResizeEvent *event) ...@@ -165,3 +185,30 @@ void UBLibPalette::resizeEvent(QResizeEvent *event)
UBDockPalette::resizeEvent(event); UBDockPalette::resizeEvent(event);
UBSettings::settings()->libPaletteWidth->set(width()); UBSettings::settings()->libPaletteWidth->set(width());
} }
// --------------------------------------------------------------------------
UBDropMeWidget::UBDropMeWidget(QWidget *parent, const char *name):QWidget(parent)
, mpLabel(NULL)
, mpLayout(NULL)
{
setObjectName(name);
mpLayout = new QVBoxLayout(this);
setLayout(mpLayout);
mpLabel = new QLabel(tr("Drop here"), this);
mpLayout->addWidget(mpLabel);
}
UBDropMeWidget::~UBDropMeWidget()
{
if(NULL != mpLabel)
{
delete mpLabel;
mpLabel = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
}
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <QMimeData> #include <QMimeData>
#include <QMouseEvent> #include <QMouseEvent>
#include <QResizeEvent> #include <QResizeEvent>
#include <QLabel>
#include "UBDockPalette.h" #include "UBDockPalette.h"
#include "UBLibNavigatorWidget.h" #include "UBLibNavigatorWidget.h"
...@@ -18,6 +19,18 @@ ...@@ -18,6 +19,18 @@
#define ID_NAVIGATOR 0 #define ID_NAVIGATOR 0
#define ID_PROPERTIES 1 #define ID_PROPERTIES 1
#define ID_DROPME 2
class UBDropMeWidget : public QWidget
{
public:
UBDropMeWidget(QWidget* parent=0, const char* name="dropMeWidget");
~UBDropMeWidget();
private:
QLabel* mpLabel;
QVBoxLayout* mpLayout;
};
class UBLibPalette : public UBDockPalette class UBLibPalette : public UBDockPalette
{ {
...@@ -33,6 +46,7 @@ protected: ...@@ -33,6 +46,7 @@ protected:
void dragEnterEvent(QDragEnterEvent* pEvent); void dragEnterEvent(QDragEnterEvent* pEvent);
void dropEvent(QDropEvent *pEvent); void dropEvent(QDropEvent *pEvent);
void dragMoveEvent(QDragMoveEvent* pEvent); void dragMoveEvent(QDragMoveEvent* pEvent);
void dragLeaveEvent(QDragLeaveEvent* pEvent);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
...@@ -53,6 +67,10 @@ private: ...@@ -53,6 +67,10 @@ private:
UBLibItemProperties* mProperties; UBLibItemProperties* mProperties;
/** UBLibActionBar */ /** UBLibActionBar */
UBLibActionBar* mActionBar; UBLibActionBar* mActionBar;
/** The 'drop here' indicator */
UBDropMeWidget* mDropWidget;
/** The current stack widget index*/
int miCrntStackWidget;
}; };
#endif // UBLIBPALETTE_H #endif // UBLIBPALETTE_H
...@@ -283,6 +283,11 @@ void UBLibraryWidget::dragMoveEvent(QDragMoveEvent *event) ...@@ -283,6 +283,11 @@ void UBLibraryWidget::dragMoveEvent(QDragMoveEvent *event)
} }
} }
void UBLibraryWidget::onDropMe(const QMimeData *_data)
{
}
/** /**
* \brief Handles the drop event * \brief Handles the drop event
* @param event as the drop event * @param event as the drop event
......
...@@ -35,7 +35,7 @@ public slots: ...@@ -35,7 +35,7 @@ public slots:
void onElementsDropped(QList<QString> elements, UBLibElement* target); void onElementsDropped(QList<QString> elements, UBLibElement* target);
void onSearchElement(QString elem); void onSearchElement(QString elem);
void onNewFolderToCreate(); void onNewFolderToCreate();
void onDropMe(const QMimeData* _data);
signals: signals:
void navigBarUpdate(UBLibElement* pElem); void navigBarUpdate(UBLibElement* pElem);
void itemsSelected(QList<UBLibElement*> elemList, bool inTrash); void itemsSelected(QList<UBLibElement*> elemList, bool inTrash);
......
...@@ -89,7 +89,7 @@ void UBStylusPalette::initPosition() ...@@ -89,7 +89,7 @@ void UBStylusPalette::initPosition()
UBStylusPalette::~UBStylusPalette() UBStylusPalette::~UBStylusPalette()
{ {
// NOOP
} }
void UBStylusPalette::stylusToolDoubleClicked() void UBStylusPalette::stylusToolDoubleClicked()
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
class UBStylusPalette : public UBActionPalette class UBStylusPalette : public UBActionPalette
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBStylusPalette(QWidget *parent = 0, Qt::Orientation orient = Qt::Vertical); UBStylusPalette(QWidget *parent = 0, Qt::Orientation orient = Qt::Vertical);
......
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