Added the persistence of the dockpalettes width.

preferencesAboutTextFull
shibakaneki 14 years ago
parent e179d9ee0a
commit 162e257b96
  1. 3
      src/core/UBSettings.cpp
  2. 8
      src/core/UBSettings.h
  3. 9
      src/gui/UBLibPalette.cpp
  4. 2
      src/gui/UBLibPalette.h
  5. 5
      src/gui/UBNavigatorPalette.cpp

@ -168,6 +168,9 @@ void UBSettings::init()
appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true);
appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true);
appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", true);
navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 300);
libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 300);
appIsInSoftwareUpdateProcess = new UBSetting(this, "App", "IsInSoftwareUpdateProcess", false);
appLastSessionDocumentUUID = new UBSetting(this, "App", "LastSessionDocumentUUID", "");

@ -310,6 +310,14 @@ class UBSettings : public QObject
UBSetting* gipThumbnailWidth;
UBSetting* soundThumbnailWidth;
UBSetting* navigPaletteWidth;
UBSetting* libPaletteWidth;
/*
static int navigPaletteWidth;
static int libPaletteWidth;
*/
public slots:
void setPenWidthIndex(int index);

@ -17,9 +17,10 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
mIcon = QPixmap(":images/paletteLibrary.png");
setAcceptDrops(true);
resize(300, height());
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), height());
setContentsMargins(border(), 0, 0, 0);
mCollapseWidth = 180;
mLastWidth = 300;
mLayout = new QVBoxLayout(this);
mLayout->setMargin(3);
@ -158,3 +159,9 @@ void UBLibPalette::showFolder()
mActionBar->setButtons(mActionBar->previousButtonSet());
mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
}
void UBLibPalette::resizeEvent(QResizeEvent *event)
{
UBDockPalette::resizeEvent(event);
UBSettings::settings()->libPaletteWidth->set(width());
}

@ -9,6 +9,7 @@
#include <QDragMoveEvent>
#include <QMimeData>
#include <QMouseEvent>
#include <QResizeEvent>
#include "UBDockPalette.h"
#include "UBLibNavigatorWidget.h"
@ -33,6 +34,7 @@ protected:
void dropEvent(QDropEvent *pEvent);
void dragMoveEvent(QDragMoveEvent* pEvent);
void mouseMoveEvent(QMouseEvent *event);
void resizeEvent(QResizeEvent *event);
private slots:
void showProperties(UBLibElement* elem);

@ -17,8 +17,8 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):UBDock
setOrientation(eUBDockOrientation_Left);
setMaximumWidth(300);
mIcon = QPixmap(":images/paletteNavigator.png");
resize(maximumWidth(), height());
resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), height());
mLastWidth = 300;
setContentsMargins(0, 0, border(), 0);
// Build the gui
@ -135,6 +135,7 @@ void UBNavigatorPalette::resizeEvent(QResizeEvent *event)
{
mNavigator->setMinimumHeight(height() - 2*border());
}
UBSettings::settings()->navigPaletteWidth->set(width());
}
void UBNavigatorPalette::timerEvent(QTimerEvent *event)

Loading…
Cancel
Save