Commit 59b3ecd2 authored by shibakaneki's avatar shibakaneki

Fixed issue Sankore-16

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