Commit 0055bf39 authored by shibakaneki's avatar shibakaneki

Put the stylus palette horizontal and centered down the screen.

parent e2fab2e0
......@@ -118,6 +118,7 @@ void UBBoardController::init()
UBDocumentProxy* doc = UBPersistenceManager::persistenceManager()->createDocument();
setActiveDocumentScene(doc);
undoRedoStateChange(true);
}
......
......@@ -92,6 +92,10 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
}
}
void UBBoardPaletteManager::initPalettesPosAtStartup()
{
mStylusPalette->initPosition();
}
void UBBoardPaletteManager::setupLayout()
{
......@@ -342,6 +346,7 @@ void UBBoardPaletteManager::containerResized()
mStylusPalette->move(userLeft, userTop);
mStylusPalette->adjustSizeAndPosition();
mStylusPalette->initPosition();
mZoomPalette->move(userLeft + userWidth - mZoomPalette->width()
, userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette->height());
......
......@@ -37,6 +37,7 @@ class UBBoardPaletteManager : public QObject
void setupLayout();
UBNavigatorPalette* navigatorPalette(){return mNavigPalette;}
void showVirtualKeyboard(bool show = true);
void initPalettesPosAtStartup();
public slots:
......
......@@ -167,7 +167,7 @@ void UBSettings::init()
appToolBarDisplayText = new UBSetting(this, "App", "ToolBarDisplayText", true);
appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true);
appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true);
appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", true);
appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", false);
navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 300);
libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 300);
......
......@@ -57,16 +57,16 @@ class UBFloatingPalette : public QWidget
bool mbGrip;
static const int sLayoutContentMargin = 12;
static const int sLayoutSpacing = 15;
void moveInsideParent(const QPoint &position);
bool mCustomPosition;
private:
void moveInsideParent(const QPoint &position);
void removeAllAssociatedPalette();
void minimizePalette(const QPoint& pos);
QList<UBFloatingPalette*> mAssociatedPalette;
QPoint mDragPosition;
bool mIsMoving;
bool mCustomPosition;
bool mCanBeMinimized;
eMinimizedLocation mMinimizedLocation;
Qt::Corner mDefaultPosition;
......
......@@ -57,6 +57,8 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
adjustSizeAndPosition();
initPosition();
foreach(const UBActionPaletteButton* button, mButtons)
{
connect(button, SIGNAL(doubleClicked()), this, SLOT(stylusToolDoubleClicked()));
......@@ -64,6 +66,26 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
}
void UBStylusPalette::initPosition()
{
if(!UBSettings::settings()->appToolBarOrientationVertical->get().toBool())
{
QWidget* pParentW = parentWidget();
if(NULL != pParentW)
{
mCustomPosition = true;
QPoint pos;
int parentWidth = pParentW->width();
int parentHeight = pParentW->height();
int posX = (parentWidth / 2) - (width() / 2);
int posY = parentHeight - border() - height();
pos.setX(posX);
pos.setY(posY);
moveInsideParent(pos);
}
}
}
UBStylusPalette::~UBStylusPalette()
{
......
......@@ -12,9 +12,11 @@ class UBStylusPalette : public UBActionPalette
Q_OBJECT;
public:
UBStylusPalette(QWidget *parent = 0, Qt::Orientation orient = Qt::Vertical);
UBStylusPalette(QWidget *parent = 0, Qt::Orientation orient = Qt::Vertical);
virtual ~UBStylusPalette();
void initPosition();
private slots:
void stylusToolDoubleClicked();
......
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