added a 'reset background grid size' button in the background palette

preferencesAboutTextFull
Clément Fauconnier 7 years ago
parent 2b7d01ad15
commit 012e838491
  1. 1
      resources/OpenBoard.qrc
  2. 12
      resources/forms/mainWindow.ui
  3. 21
      resources/images/backgroundPalette/resetDefaultGridSize.svg
  4. 1
      src/core/UBSettings.cpp
  5. 1
      src/core/UBSettings.h
  6. 15
      src/gui/UBBackgroundPalette.cpp
  7. 2
      src/gui/UBBackgroundPalette.h

@ -359,5 +359,6 @@
<file>images/groupItems.svg</file> <file>images/groupItems.svg</file>
<file>images/ungroupItems.svg</file> <file>images/ungroupItems.svg</file>
<file>images/setAsBackground.svg</file> <file>images/setAsBackground.svg</file>
<file>images/backgroundPalette/resetDefaultGridSize.svg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -1647,6 +1647,18 @@
<string>Open the tutorial web page</string> <string>Open the tutorial web page</string>
</property> </property>
</action> </action>
<action name="actionDefaultGridSize">
<property name="icon">
<iconset resource="../OpenBoard.qrc">
<normaloff>:/images/backgroundPalette/resetDefaultGridSize.svg</normaloff>:/images/backgroundPalette/resetDefaultGridSize.svg</iconset>
</property>
<property name="text">
<string>Default Grid Size</string>
</property>
<property name="toolTip">
<string>return to Default Grid Size</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../OpenBoard.qrc"/> <include location="../OpenBoard.qrc"/>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="26.724px" height="22.304px" viewBox="2.233 3.234 26.724 22.304" enable-background="new 2.233 3.234 26.724 22.304"
xml:space="preserve">
<g>
<path fill="#333333" stroke="#CECECD" stroke-miterlimit="3.8637" d="M20.228,3.732c4.545,0,8.229,3.687,8.229,8.232v4.838
c0,4.547-3.686,8.231-8.229,8.231h-9.246c-4.547,0-8.231-3.687-8.231-8.231v-4.838c0-4.547,3.687-8.232,8.231-8.232H20.228z"/>
<path fill="#FFFFFF" d="M14.28,10.516c-1.023-0.006-2.032,0.475-2.663,1.376c-1.021,1.457-0.663,3.459,0.798,4.48
c0.061,0.043,0.106,0.09,0.145,0.139l0.108-2.099c0.021-0.402,0.335-0.733,0.726-0.714c0.391,0.021,0.667,0.383,0.646,0.784
l-0.148,2.812l-0.071,1.369l-1.367-0.072L9.64,18.446c-0.401-0.021-0.732-0.335-0.714-0.725c0.021-0.39,0.384-0.668,0.785-0.646
l1.875,0.1c-1.822-1.416-2.241-4.021-0.899-5.938c0.863-1.234,2.253-1.886,3.61-1.869c0.183,0.002,0.358,0.023,0.537,0.049
c0.376,0.05,0.524,0.371,0.488,0.64c-0.035,0.27-0.266,0.538-0.641,0.488c-0.158-0.021-0.317-0.031-0.479-0.028H14.28z
M16.999,17.831c1.022,0.006,2.032-0.475,2.663-1.375c1.021-1.458,0.662-3.459-0.797-4.482c-0.061-0.041-0.107-0.088-0.146-0.138
l-0.107,2.099c-0.021,0.402-0.336,0.734-0.725,0.714c-0.392-0.02-0.668-0.383-0.646-0.784l0.148-2.812l0.071-1.369l1.367,0.072
L21.64,9.9c0.399,0.021,0.731,0.335,0.713,0.726c-0.021,0.389-0.383,0.667-0.785,0.646l-1.875-0.1
c1.822,1.416,2.24,4.021,0.899,5.937c-0.864,1.234-2.254,1.886-3.612,1.869c-0.182-0.002-0.357-0.022-0.537-0.048
c-0.375-0.052-0.523-0.371-0.487-0.64c0.036-0.271,0.266-0.539,0.642-0.488c0.157,0.021,0.316,0.029,0.479,0.027h-0.077V17.831z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -47,6 +47,7 @@ QPointer<UBSettings> UBSettings::sSingleton = 0;
int UBSettings::pointerDiameter = 40; int UBSettings::pointerDiameter = 40;
int UBSettings::crossSize = 24; int UBSettings::crossSize = 24;
int UBSettings::defaultCrossSize = 24;
int UBSettings::minCrossSize = 12; int UBSettings::minCrossSize = 12;
int UBSettings::maxCrossSize = 96; //TODO: user-settable? int UBSettings::maxCrossSize = 96; //TODO: user-settable?
int UBSettings::colorPaletteSize = 5; int UBSettings::colorPaletteSize = 5;

@ -188,6 +188,7 @@ class UBSettings : public QObject
// Background grid // Background grid
static int crossSize; static int crossSize;
static int defaultCrossSize;
static int minCrossSize; static int minCrossSize;
static int maxCrossSize; static int maxCrossSize;

@ -1,5 +1,7 @@
#include "UBBackgroundPalette.h" #include "UBBackgroundPalette.h"
#include "gui/UBMainWindow.h"
UBBackgroundPalette::UBBackgroundPalette(QList<QAction*> actions, QWidget * parent) UBBackgroundPalette::UBBackgroundPalette(QList<QAction*> actions, QWidget * parent)
: UBActionPalette(parent) : UBActionPalette(parent)
{ {
@ -47,9 +49,16 @@ void UBBackgroundPalette::init()
mSliderLabel = new QLabel(tr("Grid size")); mSliderLabel = new QLabel(tr("Grid size"));
mResetDefaultGridSizeButton = createPaletteButton(UBApplication::mainWindow->actionDefaultGridSize, this);
mResetDefaultGridSizeButton->setFixedSize(24,24);
mActions << UBApplication::mainWindow->actionDefaultGridSize;
connect(UBApplication::mainWindow->actionDefaultGridSize, SIGNAL(triggered()), this, SLOT(defaultBackgroundGridSize()));
mBottomLayout->addSpacing(16); mBottomLayout->addSpacing(16);
mBottomLayout->addWidget(mSliderLabel); mBottomLayout->addWidget(mSliderLabel);
mBottomLayout->addWidget(mSlider); mBottomLayout->addWidget(mSlider);
mBottomLayout->addWidget(mResetDefaultGridSizeButton);
mBottomLayout->addSpacing(16); mBottomLayout->addSpacing(16);
updateLayout(); updateLayout();
@ -137,6 +146,12 @@ void UBBackgroundPalette::sliderValueChanged(int value)
UBSettings::settings()->crossSize = value; // since this function is called (indirectly, by refresh) when we switch scenes, the settings will always have the current scene's cross size. UBSettings::settings()->crossSize = value; // since this function is called (indirectly, by refresh) when we switch scenes, the settings will always have the current scene's cross size.
} }
void UBBackgroundPalette::defaultBackgroundGridSize()
{
mSlider->setValue(UBSettings::settings()->defaultCrossSize);
sliderValueChanged(UBSettings::settings()->defaultCrossSize);
}
void UBBackgroundPalette::backgroundChanged() void UBBackgroundPalette::backgroundChanged()
{ {
bool dark = UBApplication::boardController->activeScene()->isDarkBackground(); bool dark = UBApplication::boardController->activeScene()->isDarkBackground();

@ -27,6 +27,7 @@ class UBBackgroundPalette : public UBActionPalette
protected slots: protected slots:
void sliderValueChanged(int value); void sliderValueChanged(int value);
void defaultBackgroundGridSize();
protected: protected:
virtual void updateLayout(); virtual void updateLayout();
@ -39,6 +40,7 @@ class UBBackgroundPalette : public UBActionPalette
QSlider* mSlider; QSlider* mSlider;
QLabel* mSliderLabel; QLabel* mSliderLabel;
UBActionPaletteButton* mResetDefaultGridSizeButton;
}; };

Loading…
Cancel
Save