Default layout settings.
This commit is contained in:
parent
087d0855dd
commit
4646b6c1fb
|
@ -30,6 +30,7 @@
|
||||||
#define VPMIMEDATAPIECE_H
|
#define VPMIMEDATAPIECE_H
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
|
||||||
#include "../layout/layoutdef.h"
|
#include "../layout/layoutdef.h"
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPMimeDataPiece)
|
Q_DISABLE_COPY(VPMimeDataPiece)
|
||||||
|
|
||||||
VPPiecePtr m_piece{};
|
VPPieceWeakPtr m_piece{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPMIMEDATAPIECE_H
|
#endif // VPMIMEDATAPIECE_H
|
||||||
|
|
|
@ -43,14 +43,44 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
|
||||||
m_langChanged = true;
|
m_langChanged = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
|
||||||
// Theme
|
// Theme
|
||||||
ui->darkModeCheck->setChecked(VPApplication::VApp()->PuzzleSettings()->GetDarkMode());
|
ui->darkModeCheck->setChecked(settings->GetDarkMode());
|
||||||
|
|
||||||
// Native dialogs
|
// Native dialogs
|
||||||
ui->checkBoxDontUseNativeDialog->setChecked(VPApplication::VApp()->PuzzleSettings()->IsDontUseNativeDialog());
|
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
|
||||||
|
|
||||||
//----------------------- Toolbar
|
//----------------------- Toolbar
|
||||||
ui->toolBarStyleCheck->setChecked(VPApplication::VApp()->PuzzleSettings()->GetToolBarStyle());
|
ui->toolBarStyleCheck->setChecked(settings->GetToolBarStyle());
|
||||||
|
|
||||||
|
// Undo
|
||||||
|
ui->undoCount->setValue(settings->GetUndoCount());
|
||||||
|
|
||||||
|
//Graphical output
|
||||||
|
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
|
||||||
|
ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender());
|
||||||
|
|
||||||
|
// Tab Scrolling
|
||||||
|
ui->spinBoxDuration->setMinimum(VCommonSettings::scrollingDurationMin);
|
||||||
|
ui->spinBoxDuration->setMaximum(VCommonSettings::scrollingDurationMax);
|
||||||
|
ui->spinBoxDuration->setValue(settings->GetScrollingDuration());
|
||||||
|
|
||||||
|
ui->spinBoxUpdateInterval->setMinimum(VCommonSettings::scrollingUpdateIntervalMin);
|
||||||
|
ui->spinBoxUpdateInterval->setMaximum(VCommonSettings::scrollingUpdateIntervalMax);
|
||||||
|
ui->spinBoxUpdateInterval->setValue(settings->GetScrollingUpdateInterval());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSensor->setMinimum(VCommonSettings::sensorMouseScaleMin);
|
||||||
|
ui->doubleSpinBoxSensor->setMaximum(VCommonSettings::sensorMouseScaleMax);
|
||||||
|
ui->doubleSpinBoxSensor->setValue(settings->GetSensorMouseScale());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxWheel->setMinimum(VCommonSettings::wheelMouseScaleMin);
|
||||||
|
ui->doubleSpinBoxWheel->setMaximum(VCommonSettings::wheelMouseScaleMax);
|
||||||
|
ui->doubleSpinBoxWheel->setValue(settings->GetWheelMouseScale());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxAcceleration->setMinimum(VCommonSettings::scrollingAccelerationMin);
|
||||||
|
ui->doubleSpinBoxAcceleration->setMaximum(VCommonSettings::scrollingAccelerationMax);
|
||||||
|
ui->doubleSpinBoxAcceleration->setValue(settings->GetScrollingAcceleration());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -60,7 +90,7 @@ PuzzlePreferencesConfigurationPage::~PuzzlePreferencesConfigurationPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList PuzzlePreferencesConfigurationPage::Apply()
|
auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList
|
||||||
{
|
{
|
||||||
QStringList preferences;
|
QStringList preferences;
|
||||||
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
@ -88,6 +118,35 @@ QStringList PuzzlePreferencesConfigurationPage::Apply()
|
||||||
qApp->processEvents();// force to call changeEvent
|
qApp->processEvents();// force to call changeEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
||||||
|
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
||||||
|
* prints a warning and does nothing.*/
|
||||||
|
if (settings->GetUndoCount() != ui->undoCount->value())
|
||||||
|
{
|
||||||
|
preferences.append(tr("undo limit"));
|
||||||
|
settings->SetUndoCount(ui->undoCount->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scene antialiasing
|
||||||
|
if (settings->GetGraphicalOutput() != ui->graphOutputCheck->isChecked())
|
||||||
|
{
|
||||||
|
preferences.append(tr("antialiasing"));
|
||||||
|
settings->SetGraphicalOutput(ui->graphOutputCheck->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings->IsOpenGLRender() != ui->checkBoxOpenGLRender->isChecked())
|
||||||
|
{
|
||||||
|
preferences.append(tr("scene render"));
|
||||||
|
settings->SetOpenGLRender(ui->checkBoxOpenGLRender->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tab Scrolling
|
||||||
|
settings->SetScrollingDuration(ui->spinBoxDuration->value());
|
||||||
|
settings->SetScrollingUpdateInterval(ui->spinBoxUpdateInterval->value());
|
||||||
|
settings->SetSensorMouseScale(ui->doubleSpinBoxSensor->value());
|
||||||
|
settings->SetWheelMouseScale(ui->doubleSpinBoxWheel->value());
|
||||||
|
settings->SetScrollingAcceleration(ui->doubleSpinBoxAcceleration->value());
|
||||||
|
|
||||||
return preferences;
|
return preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>505</width>
|
<width>702</width>
|
||||||
<height>548</height>
|
<height>741</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -15,97 +15,365 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="widgetResizable">
|
<property name="currentIndex">
|
||||||
<bool>true</bool>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
<widget class="QWidget" name="tabGeneral">
|
||||||
<property name="geometry">
|
<attribute name="title">
|
||||||
<rect>
|
<string>General</string>
|
||||||
<x>0</x>
|
</attribute>
|
||||||
<y>0</y>
|
|
||||||
<width>494</width>
|
|
||||||
<height>514</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="title">
|
<property name="widgetResizable">
|
||||||
<string>Language</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="geometry">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>660</width>
|
||||||
|
<height>672</height>
|
||||||
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<widget class="QLabel" name="label_2">
|
<item>
|
||||||
<property name="text">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<string>GUI language:</string>
|
<property name="title">
|
||||||
</property>
|
<string>Language</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="1">
|
<property name="fieldGrowthPolicy">
|
||||||
<widget class="QComboBox" name="langCombo"/>
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>GUI language:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="langCombo"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>Toolbar</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toolBarStyleCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string>The text appears under the icon (recommended for beginners).</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
<property name="title">
|
||||||
|
<string>User Interface</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="darkModeCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string>Activate dark mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
|
||||||
|
<property name="text">
|
||||||
|
<string>Don't use the native file dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Graphical output</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="graphOutputCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use antialiasing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxOpenGLRender">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Use OpenGL to render a scene.
|
||||||
|
This option will take an affect after restart.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Use OpenGL render</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Undo</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Count steps (0 - no limit):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="undoCount"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabScrolling">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Scrolling</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_6">
|
<widget class="QScrollArea" name="scrollArea_2">
|
||||||
<property name="title">
|
<property name="widgetResizable">
|
||||||
<string>Toolbar</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
||||||
<item>
|
<property name="geometry">
|
||||||
<widget class="QCheckBox" name="toolBarStyleCheck">
|
<rect>
|
||||||
<property name="text">
|
<x>0</x>
|
||||||
<string>The text appears under the icon (recommended for beginners).</string>
|
<y>0</y>
|
||||||
</property>
|
<width>660</width>
|
||||||
<property name="checked">
|
<height>672</height>
|
||||||
<bool>true</bool>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
</item>
|
<item>
|
||||||
</layout>
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Animation</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Duration:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBoxDuration">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Scrolling animation duration</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string comment="milliseconds">ms</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>Update interval:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBoxUpdateInterval">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Time in milliseconds between each animation update</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string comment="milliseconds">ms</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
|
<property name="title">
|
||||||
|
<string>Mouse scale</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_4">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="sensor mouse">Sensor:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSensor">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Scale scrolling sensitivity for mouse with sensor</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>2.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="mouse wheel">Wheel:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxWheel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Scale scrolling sensitivity for mouse with wheel</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>45.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="title">
|
||||||
|
<string>Scrolling</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_5">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Acceleration:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxAcceleration">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.300000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>359</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
|
||||||
<property name="title">
|
|
||||||
<string>User Interface</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="darkModeCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>Activate dark mode</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
|
|
||||||
<property name="text">
|
|
||||||
<string>Don't use the native file dialog</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -0,0 +1,657 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file puzzlepreferenceslayoutpage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 20 8, 2021
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2021 Valentina project
|
||||||
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#include "puzzlepreferenceslayoutpage.h"
|
||||||
|
#include "ui_puzzlepreferenceslayoutpage.h"
|
||||||
|
#include "vpapplication.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::PuzzlePreferencesLayoutPage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
VPApplication::VApp()->PuzzleSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
|
||||||
|
InitLayoutUnits();
|
||||||
|
VAbstractLayoutDialog::InitTemplates(ui->comboBoxSheetTemplates);
|
||||||
|
VAbstractLayoutDialog::InitTemplates(ui->comboBoxTileTemplates);
|
||||||
|
MinimumSheetPaperSize();
|
||||||
|
MinimumTilePaperSize();
|
||||||
|
|
||||||
|
ReadSettings();
|
||||||
|
|
||||||
|
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::ConvertPaperSize);
|
||||||
|
|
||||||
|
connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
this, [this]{SheetSize(SheetTemplate());});
|
||||||
|
connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
this, [this]{TileSize(TileTemplate());});
|
||||||
|
|
||||||
|
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
|
||||||
|
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
|
||||||
|
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
|
||||||
|
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
|
||||||
|
|
||||||
|
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::FindSheetTemplate);
|
||||||
|
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::FindSheetTemplate);
|
||||||
|
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::FindTileTemplate);
|
||||||
|
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::FindTileTemplate);
|
||||||
|
|
||||||
|
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||||
|
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||||
|
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||||
|
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||||
|
|
||||||
|
connect(ui->checkBoxLayoutIgnoreFileds, &QCheckBox::stateChanged, this,
|
||||||
|
&PuzzlePreferencesLayoutPage::LayoutSheetIgnoreMargins);
|
||||||
|
connect(ui->checkBoxTileIgnoreFileds, &QCheckBox::stateChanged, this,
|
||||||
|
&PuzzlePreferencesLayoutPage::LayoutTileIgnoreMargins);
|
||||||
|
|
||||||
|
connect(ui->toolButtonSheetPortraitOritation, &QToolButton::toggled, this,
|
||||||
|
&PuzzlePreferencesLayoutPage::SwapSheetOrientation);
|
||||||
|
connect(ui->toolButtonSheetLandscapeOrientation, &QToolButton::toggled, this,
|
||||||
|
&PuzzlePreferencesLayoutPage::SwapSheetOrientation);
|
||||||
|
connect(ui->toolButtonTilePortraitOrientation, &QToolButton::toggled, this,
|
||||||
|
&PuzzlePreferencesLayoutPage::SwapTileOrientation);
|
||||||
|
connect(ui->toolButtonTileLandscapeOrientation, &QToolButton::toggled, this,
|
||||||
|
&PuzzlePreferencesLayoutPage::SwapTileOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PuzzlePreferencesLayoutPage::~PuzzlePreferencesLayoutPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
|
||||||
|
{
|
||||||
|
QStringList preferences;
|
||||||
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
|
||||||
|
settings->SetLayoutUnit(LayoutUnit());
|
||||||
|
|
||||||
|
settings->SetLayoutSheetPaperHeight(
|
||||||
|
UnitConvertor(ui->doubleSpinBoxSheetPaperHeight->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
settings->SetLayoutSheetPaperWidth(
|
||||||
|
UnitConvertor(ui->doubleSpinBoxSheetPaperWidth->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
|
||||||
|
settings->SetLayoutSheetIgnoreMargins(ui->checkBoxLayoutIgnoreFileds->isChecked());
|
||||||
|
settings->SetLayoutSheetMargins(GetSheetMargins());
|
||||||
|
|
||||||
|
settings->SetLayoutTileShowTiles(ui->checkBoxTileShowTiles->isChecked());
|
||||||
|
|
||||||
|
settings->SetLayoutTilePaperHeight(
|
||||||
|
UnitConvertor(ui->doubleSpinBoxTilePaperHeight->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
settings->SetLayoutTilePaperWidth(
|
||||||
|
UnitConvertor(ui->doubleSpinBoxTilePaperWidth->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
|
||||||
|
settings->SetLayoutTileIgnoreMargins(ui->checkBoxTileIgnoreFileds->isChecked());
|
||||||
|
settings->SetLayoutTileMargins(GetTileMargins());
|
||||||
|
|
||||||
|
settings->SetLayoutPieceGap(UnitConvertor(ui->doubleSpinBoxPiecesGap->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
|
||||||
|
settings->SetLayoutWarningPiecesSuperposition(ui->checkBoxWarningPiecesSuperposition->isChecked());
|
||||||
|
settings->SetLayoutStickyEdges(ui->checkBoxStickyEdges->isChecked());
|
||||||
|
settings->SetLayoutWarningPiecesOutOfBound(ui->checkBoxWarningPiecesOutOfBound->isChecked());
|
||||||
|
settings->SetLayoutFollowGrainline(ui->checkBoxFollowGrainline->isChecked());
|
||||||
|
|
||||||
|
preferences.append(tr("default layout settings"));
|
||||||
|
return preferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::ConvertPaperSize()
|
||||||
|
{
|
||||||
|
const Unit layoutUnit = LayoutUnit();
|
||||||
|
|
||||||
|
const qreal sheetWidth = ui->doubleSpinBoxSheetPaperWidth->value();
|
||||||
|
const qreal sheetHeight = ui->doubleSpinBoxSheetPaperHeight->value();
|
||||||
|
|
||||||
|
const qreal sheetLeftMargin = ui->doubleSpinBoxSheetMarginLeft->value();
|
||||||
|
const qreal sheetRightMargin = ui->doubleSpinBoxSheetMarginRight->value();
|
||||||
|
const qreal sheetTopMargin = ui->doubleSpinBoxSheetMarginTop->value();
|
||||||
|
const qreal sheetBottomMargin = ui->doubleSpinBoxSheetMarginBottom->value();
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, layoutUnit));
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, layoutUnit));
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->blockSignals(false);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->blockSignals(false);
|
||||||
|
|
||||||
|
const qreal newSheetWidth = UnitConvertor(sheetWidth, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newSheetHeight = UnitConvertor(sheetHeight, m_oldLayoutUnit, layoutUnit);
|
||||||
|
|
||||||
|
const qreal newSheetLeftMargin = UnitConvertor(sheetLeftMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newSheetRightMargin = UnitConvertor(sheetRightMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newSheetTopMargin = UnitConvertor(sheetTopMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newSheetBottomMargin = UnitConvertor(sheetBottomMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
|
||||||
|
const qreal tileWidth = ui->doubleSpinBoxTilePaperWidth->value();
|
||||||
|
const qreal tileHeight = ui->doubleSpinBoxTilePaperHeight->value();
|
||||||
|
|
||||||
|
const qreal tileLeftMargin = ui->doubleSpinBoxTileMarginLeft->value();
|
||||||
|
const qreal tileRightMargin = ui->doubleSpinBoxTileMarginRight->value();
|
||||||
|
const qreal tileTopMargin = ui->doubleSpinBoxTileMarginTop->value();
|
||||||
|
const qreal tileBottomMargin = ui->doubleSpinBoxTileMarginBottom->value();
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setMaximum(FromPixel(QIMAGE_MAX, layoutUnit));
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setMaximum(FromPixel(QIMAGE_MAX, layoutUnit));
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->blockSignals(false);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->blockSignals(false);
|
||||||
|
|
||||||
|
const qreal newTileWidth = UnitConvertor(tileWidth, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newTileHeight = UnitConvertor(tileHeight, m_oldLayoutUnit, layoutUnit);
|
||||||
|
|
||||||
|
const qreal newTileLeftMargin = UnitConvertor(tileLeftMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newTileRightMargin = UnitConvertor(tileRightMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newTileTopMargin = UnitConvertor(tileTopMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
const qreal newTileBottomMargin = UnitConvertor(tileBottomMargin, m_oldLayoutUnit, layoutUnit);
|
||||||
|
|
||||||
|
qreal newGap = UnitConvertor(ui->doubleSpinBoxPiecesGap->value(), m_oldLayoutUnit, layoutUnit);
|
||||||
|
|
||||||
|
m_oldLayoutUnit = layoutUnit;
|
||||||
|
CorrectPaperDecimals();
|
||||||
|
MinimumSheetPaperSize();
|
||||||
|
MinimumTilePaperSize();
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setValue(newSheetWidth);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setValue(newSheetHeight);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetMarginLeft->setValue(newSheetLeftMargin);
|
||||||
|
ui->doubleSpinBoxSheetMarginRight->setValue(newSheetRightMargin);
|
||||||
|
ui->doubleSpinBoxSheetMarginTop->setValue(newSheetTopMargin);
|
||||||
|
ui->doubleSpinBoxSheetMarginBottom->setValue(newSheetBottomMargin);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setValue(newTileWidth);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setValue(newTileHeight);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTileMarginLeft->setValue(newTileLeftMargin);
|
||||||
|
ui->doubleSpinBoxTileMarginRight->setValue(newTileRightMargin);
|
||||||
|
ui->doubleSpinBoxTileMarginTop->setValue(newTileTopMargin);
|
||||||
|
ui->doubleSpinBoxTileMarginBottom->setValue(newTileBottomMargin);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(50, Unit::Cm, layoutUnit));
|
||||||
|
ui->doubleSpinBoxPiecesGap->setValue(newGap);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::LayoutSheetIgnoreMargins(int state)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxSheetMarginLeft->setDisabled(state != 0);
|
||||||
|
ui->doubleSpinBoxSheetMarginRight->setDisabled(state != 0);
|
||||||
|
ui->doubleSpinBoxSheetMarginTop->setDisabled(state != 0);
|
||||||
|
ui->doubleSpinBoxSheetMarginBottom->setDisabled(state != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::LayoutTileIgnoreMargins(int state)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxTileMarginLeft->setDisabled(state != 0);
|
||||||
|
ui->doubleSpinBoxTileMarginRight->setDisabled(state != 0);
|
||||||
|
ui->doubleSpinBoxTileMarginTop->setDisabled(state != 0);
|
||||||
|
ui->doubleSpinBoxTileMarginBottom->setDisabled(state != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::FindSheetTemplate()
|
||||||
|
{
|
||||||
|
const qreal width = ui->doubleSpinBoxSheetPaperWidth->value();
|
||||||
|
const qreal height = ui->doubleSpinBoxSheetPaperHeight->value();
|
||||||
|
FindTemplate(ui->comboBoxSheetTemplates, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::FindTileTemplate()
|
||||||
|
{
|
||||||
|
const qreal width = ui->doubleSpinBoxTilePaperWidth->value();
|
||||||
|
const qreal height = ui->doubleSpinBoxTilePaperHeight->value();
|
||||||
|
FindTemplate(ui->comboBoxTileTemplates, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::CorrectMaxMargins()
|
||||||
|
{
|
||||||
|
const qreal sheetWidth = ui->doubleSpinBoxSheetPaperWidth->value();
|
||||||
|
const qreal sheetHeight = ui->doubleSpinBoxSheetPaperHeight->value();
|
||||||
|
|
||||||
|
// 80%/2 of paper size for each field
|
||||||
|
const qreal sheetWidthMargin = (sheetWidth*80.0/100.0)/2.0;
|
||||||
|
const qreal sheetHeightMargin = (sheetHeight*80.0/100.0)/2.0;
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetMarginLeft->setMaximum(sheetWidthMargin);
|
||||||
|
ui->doubleSpinBoxSheetMarginRight->setMaximum(sheetWidthMargin);
|
||||||
|
ui->doubleSpinBoxSheetMarginTop->setMaximum(sheetHeightMargin);
|
||||||
|
ui->doubleSpinBoxSheetMarginBottom->setMaximum(sheetHeightMargin);
|
||||||
|
|
||||||
|
const qreal tileWidth = ui->doubleSpinBoxTilePaperWidth->value();
|
||||||
|
const qreal tileHeight = ui->doubleSpinBoxTilePaperHeight->value();
|
||||||
|
|
||||||
|
// 80%/2 of paper size for each field
|
||||||
|
const qreal tileWidthMargin = (tileWidth*80.0/100.0)/2.0;
|
||||||
|
const qreal tileHeightMargin = (tileHeight*80.0/100.0)/2.0;
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTileMarginLeft->setMaximum(tileWidthMargin);
|
||||||
|
ui->doubleSpinBoxTileMarginRight->setMaximum(tileWidthMargin);
|
||||||
|
ui->doubleSpinBoxTileMarginTop->setMaximum(tileHeightMargin);
|
||||||
|
ui->doubleSpinBoxTileMarginBottom->setMaximum(tileHeightMargin);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SwapSheetOrientation(bool checked)
|
||||||
|
{
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
const qreal width = ui->doubleSpinBoxSheetPaperWidth->value();
|
||||||
|
const qreal height = ui->doubleSpinBoxSheetPaperHeight->value();
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setValue(height);
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->blockSignals(false);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setValue(width);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->blockSignals(false);
|
||||||
|
|
||||||
|
SheetPaperSizeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SwapTileOrientation(bool checked)
|
||||||
|
{
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
const qreal width = ui->doubleSpinBoxTilePaperWidth->value();
|
||||||
|
const qreal height = ui->doubleSpinBoxTilePaperHeight->value();
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setValue(height);
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->blockSignals(false);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->blockSignals(true);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setValue(width);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->blockSignals(false);
|
||||||
|
|
||||||
|
TilePaperSizeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::InitLayoutUnits()
|
||||||
|
{
|
||||||
|
ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm)));
|
||||||
|
ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm)));
|
||||||
|
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
|
||||||
|
ui->comboBoxLayoutUnit->addItem(tr("Pixels"), QVariant(UnitsToStr(Unit::Px)));
|
||||||
|
|
||||||
|
// set default unit
|
||||||
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
m_oldLayoutUnit = StrToUnits(settings->GetUnit());
|
||||||
|
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(settings->GetUnit());
|
||||||
|
if (indexUnit != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QSizeF PuzzlePreferencesLayoutPage::Template(VAbstractLayoutDialog::PaperSizeTemplate t) const
|
||||||
|
{
|
||||||
|
const Unit layoutUnit = LayoutUnit();
|
||||||
|
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::A0:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::A1:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::A2:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::A3:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::A4:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Letter:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Legal:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Tabloid:
|
||||||
|
return VAbstractLayoutDialog::GetTemplateSize(t, layoutUnit);
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll24in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll30in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll36in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll42in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll44in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll48in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll62in:
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Roll72in:
|
||||||
|
return VAbstractLayoutDialog::GetTemplateSize(t, layoutUnit);
|
||||||
|
case VAbstractLayoutDialog::PaperSizeTemplate::Custom:
|
||||||
|
return VAbstractLayoutDialog::GetTemplateSize(t, layoutUnit);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QSizeF();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PuzzlePreferencesLayoutPage::SheetTemplate() const -> QSizeF
|
||||||
|
{
|
||||||
|
auto t = static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(ui->comboBoxSheetTemplates->currentData().toInt());
|
||||||
|
return Template(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PuzzlePreferencesLayoutPage::TileTemplate() const -> QSizeF
|
||||||
|
{
|
||||||
|
auto t = static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(ui->comboBoxTileTemplates->currentData().toInt());
|
||||||
|
return Template(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::MinimumSheetPaperSize()
|
||||||
|
{
|
||||||
|
const qreal value = UnitConvertor(1, Unit::Px, m_oldLayoutUnit);
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setMinimum(value);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setMinimum(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::MinimumTilePaperSize()
|
||||||
|
{
|
||||||
|
const qreal value = UnitConvertor(1, Unit::Px, m_oldLayoutUnit);
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setMinimum(value);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setMinimum(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PuzzlePreferencesLayoutPage::LayoutUnit() const -> Unit
|
||||||
|
{
|
||||||
|
return StrToUnits(ui->comboBoxLayoutUnit->currentData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SetLayoutUnit(Unit unit)
|
||||||
|
{
|
||||||
|
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(UnitsToStr(unit));
|
||||||
|
if (indexUnit != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SheetSize(const QSizeF &size)
|
||||||
|
{
|
||||||
|
m_oldLayoutUnit = LayoutUnit();
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, m_oldLayoutUnit));
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, m_oldLayoutUnit));
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setValue(size.width());
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setValue(size.height());
|
||||||
|
|
||||||
|
CorrectPaperDecimals();
|
||||||
|
SheetPaperSizeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::TileSize(const QSizeF &size)
|
||||||
|
{
|
||||||
|
m_oldLayoutUnit = LayoutUnit();
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setMaximum(FromPixel(QIMAGE_MAX, m_oldLayoutUnit));
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setMaximum(FromPixel(QIMAGE_MAX, m_oldLayoutUnit));
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setValue(size.width());
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setValue(size.height());
|
||||||
|
|
||||||
|
CorrectPaperDecimals();
|
||||||
|
TilePaperSizeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::CorrectPaperDecimals()
|
||||||
|
{
|
||||||
|
switch (m_oldLayoutUnit)
|
||||||
|
{
|
||||||
|
case Unit::Cm:
|
||||||
|
case Unit::Mm:
|
||||||
|
case Unit::Px:
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setDecimals(2);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setDecimals(2);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setDecimals(2);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setDecimals(2);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetMarginLeft->setDecimals(4);
|
||||||
|
ui->doubleSpinBoxSheetMarginRight->setDecimals(4);
|
||||||
|
ui->doubleSpinBoxSheetMarginTop->setDecimals(4);
|
||||||
|
ui->doubleSpinBoxSheetMarginBottom->setDecimals(4);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTileMarginLeft->setDecimals(4);
|
||||||
|
ui->doubleSpinBoxTileMarginRight->setDecimals(4);
|
||||||
|
ui->doubleSpinBoxTileMarginTop->setDecimals(4);
|
||||||
|
ui->doubleSpinBoxTileMarginBottom->setDecimals(4);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxPiecesGap->setDecimals(2);
|
||||||
|
break;
|
||||||
|
case Unit::Inch:
|
||||||
|
ui->doubleSpinBoxSheetPaperWidth->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxSheetPaperHeight->setDecimals(5);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTilePaperWidth->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxTilePaperHeight->setDecimals(5);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSheetMarginLeft->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxSheetMarginRight->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxSheetMarginTop->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxSheetMarginBottom->setDecimals(5);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxTileMarginLeft->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxTileMarginRight->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxTileMarginTop->setDecimals(5);
|
||||||
|
ui->doubleSpinBoxTileMarginBottom->setDecimals(5);
|
||||||
|
|
||||||
|
ui->doubleSpinBoxPiecesGap->setDecimals(5);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SheetPaperSizeChanged()
|
||||||
|
{
|
||||||
|
bool portrait = ui->doubleSpinBoxSheetPaperHeight->value() > ui->doubleSpinBoxSheetPaperWidth->value();
|
||||||
|
|
||||||
|
ui->toolButtonSheetPortraitOritation->blockSignals(true);
|
||||||
|
ui->toolButtonSheetPortraitOritation->setChecked(portrait);
|
||||||
|
ui->toolButtonSheetPortraitOritation->blockSignals(false);
|
||||||
|
|
||||||
|
ui->toolButtonSheetLandscapeOrientation->blockSignals(true);
|
||||||
|
ui->toolButtonSheetLandscapeOrientation->setChecked(not portrait);
|
||||||
|
ui->toolButtonSheetLandscapeOrientation->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::TilePaperSizeChanged()
|
||||||
|
{
|
||||||
|
bool portrait = ui->doubleSpinBoxTilePaperHeight->value() > ui->doubleSpinBoxTilePaperWidth->value();
|
||||||
|
|
||||||
|
ui->toolButtonTilePortraitOrientation->blockSignals(true);
|
||||||
|
ui->toolButtonTilePortraitOrientation->setChecked(portrait);
|
||||||
|
ui->toolButtonTilePortraitOrientation->blockSignals(false);
|
||||||
|
|
||||||
|
ui->toolButtonTileLandscapeOrientation->blockSignals(true);
|
||||||
|
ui->toolButtonTileLandscapeOrientation->setChecked(not portrait);
|
||||||
|
ui->toolButtonTileLandscapeOrientation->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PuzzlePreferencesLayoutPage::GetSheetMargins() const -> QMarginsF
|
||||||
|
{
|
||||||
|
QMarginsF fields;
|
||||||
|
fields.setLeft(UnitConvertor(ui->doubleSpinBoxSheetMarginLeft->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
fields.setRight(UnitConvertor(ui->doubleSpinBoxSheetMarginRight->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
fields.setTop(UnitConvertor(ui->doubleSpinBoxSheetMarginTop->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
fields.setBottom(UnitConvertor(ui->doubleSpinBoxSheetMarginBottom->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SetSheetMargins(const QMarginsF &value)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxSheetMarginLeft->setValue(UnitConvertor(value.left(), Unit::Px, LayoutUnit()));
|
||||||
|
ui->doubleSpinBoxSheetMarginRight->setValue(UnitConvertor(value.right(), Unit::Px, LayoutUnit()));
|
||||||
|
ui->doubleSpinBoxSheetMarginTop->setValue(UnitConvertor(value.top(), Unit::Px, LayoutUnit()));
|
||||||
|
ui->doubleSpinBoxSheetMarginBottom->setValue(UnitConvertor(value.bottom(), Unit::Px, LayoutUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PuzzlePreferencesLayoutPage::GetTileMargins() const -> QMarginsF
|
||||||
|
{
|
||||||
|
QMarginsF fields;
|
||||||
|
fields.setLeft(UnitConvertor(ui->doubleSpinBoxTileMarginLeft->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
fields.setRight(UnitConvertor(ui->doubleSpinBoxTileMarginRight->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
fields.setTop(UnitConvertor(ui->doubleSpinBoxTileMarginTop->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
fields.setBottom(UnitConvertor(ui->doubleSpinBoxTileMarginBottom->value(), m_oldLayoutUnit, Unit::Px));
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SetTileMargins(const QMarginsF &value)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxTileMarginLeft->setValue(UnitConvertor(value.left(), Unit::Px, LayoutUnit()));
|
||||||
|
ui->doubleSpinBoxTileMarginRight->setValue(UnitConvertor(value.right(), Unit::Px, LayoutUnit()));
|
||||||
|
ui->doubleSpinBoxTileMarginTop->setValue(UnitConvertor(value.top(), Unit::Px, LayoutUnit()));
|
||||||
|
ui->doubleSpinBoxTileMarginBottom->setValue(UnitConvertor(value.bottom(), Unit::Px, LayoutUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::SetPieceGap(qreal gap)
|
||||||
|
{
|
||||||
|
qreal value = UnitConvertor(gap, Unit::Px, LayoutUnit());
|
||||||
|
ui->doubleSpinBoxPiecesGap->setValue(value);
|
||||||
|
CorrectPaperDecimals();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::ReadSettings()
|
||||||
|
{
|
||||||
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
|
||||||
|
SetLayoutUnit(settings->LayoutUnit());
|
||||||
|
m_oldLayoutUnit = LayoutUnit();
|
||||||
|
|
||||||
|
const qreal sheetWidth = UnitConvertor(settings->GetLayoutSheetPaperWidth(), Unit::Px, LayoutUnit());
|
||||||
|
const qreal sheetHeight = UnitConvertor(settings->GetLayoutSheetPaperHeight(), Unit::Px, LayoutUnit());
|
||||||
|
SheetSize(QSizeF(sheetWidth, sheetHeight));
|
||||||
|
|
||||||
|
ui->checkBoxLayoutIgnoreFileds->setChecked(settings->GetLayoutSheetIgnoreMargins());
|
||||||
|
SetSheetMargins(settings->GetLayoutSheetMargins());
|
||||||
|
|
||||||
|
const qreal tileWidth = UnitConvertor(settings->GetLayoutTilePaperWidth(), Unit::Px, LayoutUnit());
|
||||||
|
const qreal tileHeight = UnitConvertor(settings->GetLayoutTilePaperHeight(), Unit::Px, LayoutUnit());
|
||||||
|
TileSize(QSizeF(tileWidth, tileHeight));
|
||||||
|
|
||||||
|
ui->checkBoxTileShowTiles->setChecked(settings->GetLayoutTileShowTiles());
|
||||||
|
ui->checkBoxTileIgnoreFileds->setChecked(settings->GetLayoutTileIgnoreMargins());
|
||||||
|
SetTileMargins(settings->GetLayoutSheetMargins());
|
||||||
|
|
||||||
|
ui->checkBoxWarningPiecesSuperposition->setChecked(settings->GetLayoutWarningPiecesSuperposition());
|
||||||
|
ui->checkBoxStickyEdges->setChecked(settings->GetLayoutStickyEdges());
|
||||||
|
ui->checkBoxWarningPiecesOutOfBound->setChecked(settings->GetLayoutWarningPiecesOutOfBound());
|
||||||
|
ui->checkBoxFollowGrainline->setChecked(settings->GetLayoutFollowGrainline());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(50, Unit::Cm, LayoutUnit()));
|
||||||
|
SetPieceGap(settings->GetLayoutPieceGap());
|
||||||
|
|
||||||
|
FindSheetTemplate();
|
||||||
|
FindTileTemplate();
|
||||||
|
|
||||||
|
SheetPaperSizeChanged();
|
||||||
|
TilePaperSizeChanged();
|
||||||
|
|
||||||
|
LayoutSheetIgnoreMargins(static_cast<int>(ui->checkBoxLayoutIgnoreFileds->isChecked()));
|
||||||
|
LayoutTileIgnoreMargins(static_cast<int>(ui->checkBoxTileIgnoreFileds->isChecked()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qreal height)
|
||||||
|
{
|
||||||
|
SCASSERT(box != nullptr)
|
||||||
|
const Unit paperUnit = LayoutUnit();
|
||||||
|
|
||||||
|
const int max = static_cast<int>(VAbstractLayoutDialog::PaperSizeTemplate::Custom);
|
||||||
|
for (int i=0; i < max; ++i)
|
||||||
|
{
|
||||||
|
const QSizeF tmplSize = VAbstractLayoutDialog::GetTemplateSize(
|
||||||
|
static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
||||||
|
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
|
||||||
|
{
|
||||||
|
box->blockSignals(true);
|
||||||
|
const int index = ui->comboBoxTileTemplates->findData(i);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
box->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
box->blockSignals(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
box->blockSignals(true);
|
||||||
|
const int index = box->findData(max);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
box->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
box->blockSignals(false);
|
||||||
|
}
|
102
src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.h
Normal file
102
src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.h
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file puzzlepreferenceslayoutpage.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 20 8, 2021
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2021 Valentina project
|
||||||
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#ifndef PUZZLEPREFERENCESLAYOUTPAGE_H
|
||||||
|
#define PUZZLEPREFERENCESLAYOUTPAGE_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class PuzzlePreferencesLayoutPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PuzzlePreferencesLayoutPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PuzzlePreferencesLayoutPage(QWidget *parent = nullptr);
|
||||||
|
~PuzzlePreferencesLayoutPage();
|
||||||
|
|
||||||
|
QStringList Apply();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void changeEvent(QEvent* event) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ConvertPaperSize();
|
||||||
|
void LayoutSheetIgnoreMargins(int state);
|
||||||
|
void LayoutTileIgnoreMargins(int state);
|
||||||
|
void FindSheetTemplate();
|
||||||
|
void FindTileTemplate();
|
||||||
|
void CorrectMaxMargins();
|
||||||
|
void SwapSheetOrientation(bool checked);
|
||||||
|
void SwapTileOrientation(bool checked);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(PuzzlePreferencesLayoutPage)
|
||||||
|
Ui::PuzzlePreferencesLayoutPage *ui;
|
||||||
|
Unit m_oldLayoutUnit{Unit::Mm};
|
||||||
|
|
||||||
|
void InitLayoutUnits();
|
||||||
|
|
||||||
|
QSizeF Template(VAbstractLayoutDialog::PaperSizeTemplate t) const;
|
||||||
|
QSizeF SheetTemplate() const;
|
||||||
|
QSizeF TileTemplate() const;
|
||||||
|
|
||||||
|
void MinimumSheetPaperSize();
|
||||||
|
void MinimumTilePaperSize();
|
||||||
|
|
||||||
|
Unit LayoutUnit() const;
|
||||||
|
void SetLayoutUnit(Unit unit);
|
||||||
|
|
||||||
|
void SheetSize(const QSizeF &size);
|
||||||
|
void TileSize(const QSizeF &size);
|
||||||
|
|
||||||
|
void CorrectPaperDecimals();
|
||||||
|
|
||||||
|
void SheetPaperSizeChanged();
|
||||||
|
void TilePaperSizeChanged();
|
||||||
|
|
||||||
|
QMarginsF GetSheetMargins() const;
|
||||||
|
void SetSheetMargins(const QMarginsF &value);
|
||||||
|
|
||||||
|
QMarginsF GetTileMargins() const;
|
||||||
|
void SetTileMargins(const QMarginsF &value);
|
||||||
|
|
||||||
|
void SetPieceGap(qreal gap);
|
||||||
|
|
||||||
|
void ReadSettings();
|
||||||
|
|
||||||
|
void FindTemplate(QComboBox *box, qreal width, qreal height);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PUZZLEPREFERENCESLAYOUTPAGE_H
|
|
@ -0,0 +1,653 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PuzzlePreferencesLayoutPage</class>
|
||||||
|
<widget class="QWidget" name="PuzzlePreferencesLayoutPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>616</width>
|
||||||
|
<height>668</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Sheet</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxPaperFormat">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Format</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelLayoutUnit">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unit:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxLayoutUnit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Templates:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxSheetTemplates"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonSheetPortraitOritation">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/portrait.png</normaloff>:/icon/16x16/portrait.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonSheetLandscapeOrientation">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/landscape.png</normaloff>:/icon/16x16/landscape.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelHeight">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Height:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetPaperHeight">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>94</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetPaperWidth">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>94</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.990000000005239</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxSheetMargin">
|
||||||
|
<property name="title">
|
||||||
|
<string>Margins</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginRight">
|
||||||
|
<property name="text">
|
||||||
|
<string>Right:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetMarginTop">
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Top:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetMarginLeft">
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetMarginRight">
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginLeft">
|
||||||
|
<property name="text">
|
||||||
|
<string>Left:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginBottom">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bottom:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetMarginBottom">
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxLayoutIgnoreFileds">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ignore margins</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxLayoutControl">
|
||||||
|
<property name="title">
|
||||||
|
<string>Control</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxWarningPiecesSuperposition">
|
||||||
|
<property name="text">
|
||||||
|
<string>Warning superposition of pieces</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxWarningPiecesOutOfBound">
|
||||||
|
<property name="text">
|
||||||
|
<string>Warning pieces out of bound</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxStickyEdges">
|
||||||
|
<property name="text">
|
||||||
|
<string>Sticky edges</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxFollowGrainline">
|
||||||
|
<property name="text">
|
||||||
|
<string>Follow grainline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelSheetPiecesGap">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pieces gap</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxPiecesGap"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Tiles</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxTileShowTiles">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show Tiles on sheet</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxPaperFormat_2">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Format</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Templates:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxTileTemplates"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonTilePortraitOrientation">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/portrait.png</normaloff>:/icon/16x16/portrait.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonTileLandscapeOrientation">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/landscape.png</normaloff>:/icon/16x16/landscape.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelWidth_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelHeight_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Height:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxTilePaperHeight">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>94</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxTilePaperWidth">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>94</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.990000000005239</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxSheetMargin_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Margins</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginRight_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Right:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxTileMarginTop">
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginTop_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Top:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxTileMarginLeft">
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxTileMarginRight">
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginLeft_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Left:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="labelSheetMarginBottom_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bottom:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxTileMarginBottom">
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxTileIgnoreFileds">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ignore margins</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../../../libs/vmisc/share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -31,6 +31,7 @@
|
||||||
#include "../vpapplication.h"
|
#include "../vpapplication.h"
|
||||||
#include "configpages/puzzlepreferencesconfigurationpage.h"
|
#include "configpages/puzzlepreferencesconfigurationpage.h"
|
||||||
#include "configpages/puzzlepreferencespathpage.h"
|
#include "configpages/puzzlepreferencespathpage.h"
|
||||||
|
#include "configpages/puzzlepreferenceslayoutpage.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -41,6 +42,7 @@ DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::DialogPuzzlePreferences),
|
ui(new Ui::DialogPuzzlePreferences),
|
||||||
m_configurationPage(new PuzzlePreferencesConfigurationPage),
|
m_configurationPage(new PuzzlePreferencesConfigurationPage),
|
||||||
|
m_layoutPage(new PuzzlePreferencesLayoutPage),
|
||||||
m_pathPage(new PuzzlePreferencesPathPage)
|
m_pathPage(new PuzzlePreferencesPathPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -60,7 +62,8 @@ DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent) :
|
||||||
connect(bApply, &QPushButton::clicked, this, &DialogPuzzlePreferences::Apply);
|
connect(bApply, &QPushButton::clicked, this, &DialogPuzzlePreferences::Apply);
|
||||||
|
|
||||||
ui->pagesWidget->insertWidget(0, m_configurationPage);
|
ui->pagesWidget->insertWidget(0, m_configurationPage);
|
||||||
ui->pagesWidget->insertWidget(1, m_pathPage);
|
ui->pagesWidget->insertWidget(1, m_layoutPage);
|
||||||
|
ui->pagesWidget->insertWidget(2, m_pathPage);
|
||||||
|
|
||||||
connect(ui->contentsWidget, &QListWidget::currentItemChanged, this, &DialogPuzzlePreferences::PageChanged);
|
connect(ui->contentsWidget, &QListWidget::currentItemChanged, this, &DialogPuzzlePreferences::PageChanged);
|
||||||
ui->pagesWidget->setCurrentIndex(0);
|
ui->pagesWidget->setCurrentIndex(0);
|
||||||
|
@ -127,6 +130,7 @@ void DialogPuzzlePreferences::Apply()
|
||||||
QStringList preferences;
|
QStringList preferences;
|
||||||
|
|
||||||
preferences += m_configurationPage->Apply();
|
preferences += m_configurationPage->Apply();
|
||||||
|
preferences += m_layoutPage->Apply();
|
||||||
m_pathPage->Apply();
|
m_pathPage->Apply();
|
||||||
|
|
||||||
if (not preferences.isEmpty())
|
if (not preferences.isEmpty())
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace Ui
|
||||||
class PuzzlePreferencesConfigurationPage;
|
class PuzzlePreferencesConfigurationPage;
|
||||||
class PuzzlePreferencesPathPage;
|
class PuzzlePreferencesPathPage;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
|
class PuzzlePreferencesLayoutPage;
|
||||||
|
|
||||||
class DialogPuzzlePreferences : public QDialog
|
class DialogPuzzlePreferences : public QDialog
|
||||||
{
|
{
|
||||||
|
@ -65,6 +66,7 @@ private:
|
||||||
Ui::DialogPuzzlePreferences *ui;
|
Ui::DialogPuzzlePreferences *ui;
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
PuzzlePreferencesConfigurationPage *m_configurationPage;
|
PuzzlePreferencesConfigurationPage *m_configurationPage;
|
||||||
|
PuzzlePreferencesLayoutPage *m_layoutPage;
|
||||||
PuzzlePreferencesPathPage *m_pathPage;
|
PuzzlePreferencesPathPage *m_pathPage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<enum>QListView::IconMode</enum>
|
<enum>QListView::IconMode</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentRow">
|
<property name="currentRow">
|
||||||
<number>0</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -70,6 +70,18 @@
|
||||||
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
|
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Layout</string>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/layout.png</normaloff>:/icon/layout.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Paths</string>
|
<string>Paths</string>
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
#define LAYOUTDEF_H
|
#define LAYOUTDEF_H
|
||||||
|
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QSharedPointer>
|
|
||||||
|
template <typename T> class QSharedPointer;
|
||||||
|
template <typename T> class QWeakPointer;
|
||||||
|
|
||||||
class VPLayout;
|
class VPLayout;
|
||||||
using VPLayoutPtr = QSharedPointer<VPLayout>;
|
using VPLayoutPtr = QSharedPointer<VPLayout>;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "vplayout.h"
|
#include "vplayout.h"
|
||||||
#include "vppiece.h"
|
#include "vppiece.h"
|
||||||
#include "vpsheet.h"
|
#include "vpsheet.h"
|
||||||
|
#include "../vpapplication.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
@ -56,6 +57,32 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
||||||
layout->AddSheet(sheet);
|
layout->AddSheet(sheet);
|
||||||
layout->SetFocusedSheet(sheet);
|
layout->SetFocusedSheet(sheet);
|
||||||
|
|
||||||
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
|
||||||
|
layout->LayoutSettings().SetUnit(settings->LayoutUnit());
|
||||||
|
|
||||||
|
layout->LayoutSettings().SetShowTiles(settings->GetLayoutTileShowTiles());
|
||||||
|
layout->LayoutSettings().SetTilesSize(QSizeF(settings->GetLayoutTilePaperWidth(),
|
||||||
|
settings->GetLayoutTilePaperHeight()));
|
||||||
|
layout->LayoutSettings().SetIgnoreTilesMargins(settings->GetLayoutTileIgnoreMargins());
|
||||||
|
layout->LayoutSettings().SetTilesMargins(settings->GetLayoutTileMargins());
|
||||||
|
|
||||||
|
layout->LayoutSettings().SetIgnoreMargins(settings->GetLayoutSheetIgnoreMargins());
|
||||||
|
layout->LayoutSettings().SetSheetMargins(settings->GetLayoutSheetMargins());
|
||||||
|
layout->LayoutSettings().SetSheetSize(QSizeF(settings->GetLayoutSheetPaperWidth(),
|
||||||
|
settings->GetLayoutSheetPaperHeight()));
|
||||||
|
|
||||||
|
layout->LayoutSettings().SetWarningSuperpositionOfPieces(settings->GetLayoutWarningPiecesSuperposition());
|
||||||
|
layout->LayoutSettings().SetWarningPiecesOutOfBound(settings->GetLayoutWarningPiecesOutOfBound());
|
||||||
|
layout->LayoutSettings().SetFollowGrainline(settings->GetLayoutFollowGrainline());
|
||||||
|
layout->LayoutSettings().SetStickyEdges(settings->GetLayoutStickyEdges());
|
||||||
|
layout->LayoutSettings().SetPiecesGap(settings->GetLayoutPieceGap());
|
||||||
|
|
||||||
|
// ----- for test purposes, to be removed------------------
|
||||||
|
layout->LayoutSettings().SetTitle(QString("My Test Layout"));
|
||||||
|
layout->LayoutSettings().SetDescription(QString("Description of my Layout"));
|
||||||
|
// --------------------------------------------------------
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,16 +145,7 @@ auto VPLayoutSettings::GetTilesSizeConverted() const -> QSizeF
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPLayoutSettings::GetTilesOrientation() -> PageOrientation
|
auto VPLayoutSettings::GetTilesOrientation() -> PageOrientation
|
||||||
{
|
{
|
||||||
return m_tilesOrientation;
|
return m_tilesSize.height() >= m_tilesSize.width() ? PageOrientation::Portrait : PageOrientation::Landscape;
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VPLayoutSettings::SetTilesOrientation(PageOrientation orientation)
|
|
||||||
{
|
|
||||||
if(orientation != m_tilesOrientation)
|
|
||||||
{
|
|
||||||
m_tilesOrientation = orientation;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -563,13 +554,13 @@ auto VPLayoutSettings::GetSheetMarginsConverted() const -> QMarginsF
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPLayoutSettings::SetFollowGrainline(FollowGrainline state)
|
void VPLayoutSettings::SetFollowGrainline(bool state)
|
||||||
{
|
{
|
||||||
m_followGrainLine = state;
|
m_followGrainLine = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPLayoutSettings::GetFollowGrainline() const -> FollowGrainline
|
auto VPLayoutSettings::GetFollowGrainline() const -> bool
|
||||||
{
|
{
|
||||||
return m_followGrainLine;
|
return m_followGrainLine;
|
||||||
}
|
}
|
||||||
|
@ -670,3 +661,27 @@ void VPLayoutSettings::SetGridRowHeightConverted(qreal value)
|
||||||
{
|
{
|
||||||
m_gridRowHeight = UnitConvertor(value, m_unit, Unit::Px);
|
m_gridRowHeight = UnitConvertor(value, m_unit, Unit::Px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPLayoutSettings::IgnoreTilesMargins() const -> bool
|
||||||
|
{
|
||||||
|
return m_ignoreTilesMargins;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPLayoutSettings::SetIgnoreTilesMargins(bool newIgnoreTilesMargins)
|
||||||
|
{
|
||||||
|
m_ignoreTilesMargins = newIgnoreTilesMargins;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPLayoutSettings::IgnoreMargins() const -> bool
|
||||||
|
{
|
||||||
|
return m_ignoreMargins;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPLayoutSettings::SetIgnoreMargins(bool newIgnoreMargins)
|
||||||
|
{
|
||||||
|
m_ignoreMargins = newIgnoreMargins;
|
||||||
|
}
|
||||||
|
|
|
@ -35,12 +35,6 @@
|
||||||
|
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
|
||||||
enum class FollowGrainline : qint8 {
|
|
||||||
No = 0,
|
|
||||||
Follow90 = 1,
|
|
||||||
Follow180 = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class PaperSizeTemplate : qint8 {
|
enum class PaperSizeTemplate : qint8 {
|
||||||
A0 = 0,
|
A0 = 0,
|
||||||
A1,
|
A1,
|
||||||
|
@ -67,6 +61,8 @@ class VPLayoutSettings
|
||||||
public:
|
public:
|
||||||
VPLayoutSettings() = default;
|
VPLayoutSettings() = default;
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetUnit Sets the unit of the layout to the given unit
|
* @brief SetUnit Sets the unit of the layout to the given unit
|
||||||
* @param unit the new unit
|
* @param unit the new unit
|
||||||
|
@ -79,12 +75,6 @@ public:
|
||||||
*/
|
*/
|
||||||
auto GetUnit() const -> Unit;
|
auto GetUnit() const -> Unit;
|
||||||
|
|
||||||
void SetWarningSuperpositionOfPieces(bool state);
|
|
||||||
auto GetWarningSuperpositionOfPieces() const -> bool;
|
|
||||||
|
|
||||||
void SetWarningPiecesOutOfBound(bool state);
|
|
||||||
auto GetWarningPiecesOutOfBound() const -> bool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetTitle Sets the title of the layout to the given value
|
* @brief SetTitle Sets the title of the layout to the given value
|
||||||
* @param title the title of the layout
|
* @param title the title of the layout
|
||||||
|
@ -109,6 +99,55 @@ public:
|
||||||
*/
|
*/
|
||||||
auto GetDescription() const -> QString;
|
auto GetDescription() const -> QString;
|
||||||
|
|
||||||
|
void SetStickyEdges(bool state);
|
||||||
|
auto GetStickyEdges() const -> bool;
|
||||||
|
|
||||||
|
// Piece
|
||||||
|
|
||||||
|
void SetWarningSuperpositionOfPieces(bool state);
|
||||||
|
auto GetWarningSuperpositionOfPieces() const -> bool;
|
||||||
|
|
||||||
|
void SetWarningPiecesOutOfBound(bool state);
|
||||||
|
auto GetWarningPiecesOutOfBound() const -> bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SetFollowGrainline Sets the type of grainline for the pieces to follow
|
||||||
|
* @param state the type of grainline
|
||||||
|
*/
|
||||||
|
void SetFollowGrainline(bool state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GetFollowGrainline Returns if the sheet's pieces follow a grainline or not
|
||||||
|
* @return wether the pieces follow a grainline and if so, which grainline
|
||||||
|
*/
|
||||||
|
auto GetFollowGrainline() const -> bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SetPiecesGap sets the pieces gap to the given value, the unit has to be in Unit::Px
|
||||||
|
* @param value pieces gap
|
||||||
|
*/
|
||||||
|
void SetPiecesGap(qreal value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SetPiecesGapConverted sets the pieces gap to the given value, the unit has to be in the layout's unit
|
||||||
|
* @param value pieces gap
|
||||||
|
*/
|
||||||
|
void SetPiecesGapConverted(qreal value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GetPiecesGap returns the pieces gap in Unit::Px
|
||||||
|
* @return the pieces gap in Unit::Px
|
||||||
|
*/
|
||||||
|
auto GetPiecesGap() const -> qreal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GetPiecesGapConverted returns the pieces gap in the layout's unit
|
||||||
|
* @return the pieces gap in the layout's unit
|
||||||
|
*/
|
||||||
|
auto GetPiecesGapConverted() const -> qreal;
|
||||||
|
|
||||||
|
// Tiles
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetTilesSize sets the size of the tiles, the values have to be in Unit::Px
|
* @brief SetTilesSize sets the size of the tiles, the values have to be in Unit::Px
|
||||||
* @param width tiles width
|
* @param width tiles width
|
||||||
|
@ -158,12 +197,6 @@ public:
|
||||||
*/
|
*/
|
||||||
auto GetTilesOrientation() -> PageOrientation;
|
auto GetTilesOrientation() -> PageOrientation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetOrientation Sets the orientation of the tiles to the given value
|
|
||||||
* @param orientation the new tiles orientation
|
|
||||||
*/
|
|
||||||
void SetTilesOrientation(PageOrientation orientation);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetTilesMargins, set the margins of the tiles, the values have to be in Unit::Px
|
* @brief SetTilesMargins, set the margins of the tiles, the values have to be in Unit::Px
|
||||||
* @param left in Unit::Px
|
* @param left in Unit::Px
|
||||||
|
@ -260,6 +293,8 @@ public:
|
||||||
*/
|
*/
|
||||||
static auto isRollTemplate(PaperSizeTemplate tmpl) -> bool;
|
static auto isRollTemplate(PaperSizeTemplate tmpl) -> bool;
|
||||||
|
|
||||||
|
// Sheet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SetSheetSize sets the size of the sheet, the values have to be in Unit::Px
|
* @brief SetSheetSize sets the size of the sheet, the values have to be in Unit::Px
|
||||||
* @param width sheet width
|
* @param width sheet width
|
||||||
|
@ -351,42 +386,6 @@ public:
|
||||||
*/
|
*/
|
||||||
auto GetSheetMarginsConverted() const -> QMarginsF;
|
auto GetSheetMarginsConverted() const -> QMarginsF;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetFollowGrainline Sets the type of grainline for the pieces to follow
|
|
||||||
* @param state the type of grainline
|
|
||||||
*/
|
|
||||||
void SetFollowGrainline(FollowGrainline state);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GetFollowGrainline Returns if the sheet's pieces follow a grainline or not
|
|
||||||
* @return wether the pieces follow a grainline and if so, which grainline
|
|
||||||
*/
|
|
||||||
auto GetFollowGrainline() const -> FollowGrainline;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetPiecesGap sets the pieces gap to the given value, the unit has to be in Unit::Px
|
|
||||||
* @param value pieces gap
|
|
||||||
*/
|
|
||||||
void SetPiecesGap(qreal value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SetPiecesGapConverted sets the pieces gap to the given value, the unit has to be in the layout's unit
|
|
||||||
* @param value pieces gap
|
|
||||||
*/
|
|
||||||
void SetPiecesGapConverted(qreal value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GetPiecesGap returns the pieces gap in Unit::Px
|
|
||||||
* @return the pieces gap in Unit::Px
|
|
||||||
*/
|
|
||||||
auto GetPiecesGap() const -> qreal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GetPiecesGapConverted returns the pieces gap in the layout's unit
|
|
||||||
* @return the pieces gap in the layout's unit
|
|
||||||
*/
|
|
||||||
auto GetPiecesGapConverted() const -> qreal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetShowGrid Returns true if the placement grid has to be shown on the current sheet
|
* @brief GetShowGrid Returns true if the placement grid has to be shown on the current sheet
|
||||||
* @return true if the placement grid has to be shown on the current sheet
|
* @return true if the placement grid has to be shown on the current sheet
|
||||||
|
@ -449,8 +448,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetGridRowHeightConverted(qreal value);
|
void SetGridRowHeightConverted(qreal value);
|
||||||
|
|
||||||
void SetStickyEdges(bool state);
|
auto IgnoreTilesMargins() const -> bool;
|
||||||
auto GetStickyEdges() const -> bool;
|
void SetIgnoreTilesMargins(bool newIgnoreTilesMargins);
|
||||||
|
|
||||||
|
auto IgnoreMargins() const -> bool;
|
||||||
|
void SetIgnoreMargins(bool newIgnoreMargins);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Unit m_unit{Unit::Cm};
|
Unit m_unit{Unit::Cm};
|
||||||
|
@ -477,6 +479,8 @@ private:
|
||||||
*/
|
*/
|
||||||
QMarginsF m_tilesMargins{};
|
QMarginsF m_tilesMargins{};
|
||||||
|
|
||||||
|
bool m_ignoreTilesMargins{false};
|
||||||
|
|
||||||
bool m_showTiles{false};
|
bool m_showTiles{false};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -495,8 +499,10 @@ private:
|
||||||
*/
|
*/
|
||||||
QMarginsF m_margins{};
|
QMarginsF m_margins{};
|
||||||
|
|
||||||
|
bool m_ignoreMargins{false};
|
||||||
|
|
||||||
// control
|
// control
|
||||||
FollowGrainline m_followGrainLine{FollowGrainline::No};
|
bool m_followGrainLine{false};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief m_piecesGap the pieces gap in Unit::Px
|
* @brief m_piecesGap the pieces gap in Unit::Px
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/dialogs/configpages/puzzlepreferencesconfigurationpage.cpp \
|
$$PWD/dialogs/configpages/puzzlepreferencesconfigurationpage.cpp \
|
||||||
$$PWD/dialogs/configpages/puzzlepreferencespathpage.cpp \
|
$$PWD/dialogs/configpages/puzzlepreferencespathpage.cpp \
|
||||||
|
$$PWD/dialogs/configpages/puzzlepreferenceslayoutpage.cpp \
|
||||||
$$PWD/dialogs/dialogpuzzlepreferences.cpp \
|
$$PWD/dialogs/dialogpuzzlepreferences.cpp \
|
||||||
$$PWD/dialogs/vpdialogabout.cpp \
|
$$PWD/dialogs/vpdialogabout.cpp \
|
||||||
$$PWD/main.cpp \
|
$$PWD/main.cpp \
|
||||||
|
@ -43,6 +44,7 @@ SOURCES += \
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/dialogs/configpages/puzzlepreferencesconfigurationpage.h \
|
$$PWD/dialogs/configpages/puzzlepreferencesconfigurationpage.h \
|
||||||
$$PWD/dialogs/configpages/puzzlepreferencespathpage.h \
|
$$PWD/dialogs/configpages/puzzlepreferencespathpage.h \
|
||||||
|
$$PWD/dialogs/configpages/puzzlepreferenceslayoutpage.h \
|
||||||
$$PWD/dialogs/dialogpuzzlepreferences.h \
|
$$PWD/dialogs/dialogpuzzlepreferences.h \
|
||||||
$$PWD/dialogs/vpdialogabout.h \
|
$$PWD/dialogs/vpdialogabout.h \
|
||||||
$$PWD/layout/layoutdef.h \
|
$$PWD/layout/layoutdef.h \
|
||||||
|
@ -82,6 +84,7 @@ HEADERS += \
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/dialogs/configpages/puzzlepreferencesconfigurationpage.ui \
|
$$PWD/dialogs/configpages/puzzlepreferencesconfigurationpage.ui \
|
||||||
$$PWD/dialogs/configpages/puzzlepreferencespathpage.ui \
|
$$PWD/dialogs/configpages/puzzlepreferencespathpage.ui \
|
||||||
|
$$PWD/dialogs/configpages/puzzlepreferenceslayoutpage.ui \
|
||||||
$$PWD/dialogs/dialogpuzzlepreferences.ui \
|
$$PWD/dialogs/dialogpuzzlepreferences.ui \
|
||||||
$$PWD/dialogs/vpdialogabout.ui \
|
$$PWD/dialogs/vpdialogabout.ui \
|
||||||
$$PWD/carousel/vpcarrousel.ui \
|
$$PWD/carousel/vpcarrousel.ui \
|
||||||
|
|
|
@ -638,6 +638,18 @@ void VPApplication::NewLocalSocketConnection()
|
||||||
MainWindow()->activateWindow();
|
MainWindow()->activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPApplication::PreferencesDialog() const -> QSharedPointer<DialogPuzzlePreferences>
|
||||||
|
{
|
||||||
|
return m_preferencesDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPApplication::SetPreferencesDialog(const QSharedPointer<DialogPuzzlePreferences> &newPreferencesDialog)
|
||||||
|
{
|
||||||
|
m_preferencesDialog = newPreferencesDialog;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPApplication::Clean()
|
void VPApplication::Clean()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "vpcommandline.h"
|
#include "vpcommandline.h"
|
||||||
|
|
||||||
#include <memory>
|
template <typename T> class QWeakPointer;
|
||||||
|
|
||||||
class VPMainWindow;
|
class VPMainWindow;
|
||||||
class QLocalServer;
|
class QLocalServer;
|
||||||
|
class DialogPuzzlePreferences;
|
||||||
|
|
||||||
enum class SocketConnection : bool {Client = false, Server = true};
|
enum class SocketConnection : bool {Client = false, Server = true};
|
||||||
|
|
||||||
|
@ -68,6 +68,10 @@ public:
|
||||||
|
|
||||||
static VPCommandLinePtr CommandLine();
|
static VPCommandLinePtr CommandLine();
|
||||||
static VPApplication *VApp();
|
static VPApplication *VApp();
|
||||||
|
|
||||||
|
auto PreferencesDialog() const -> QSharedPointer<DialogPuzzlePreferences>;
|
||||||
|
void SetPreferencesDialog(const QSharedPointer<DialogPuzzlePreferences> &newPreferencesDialog);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ProcessCMD();
|
void ProcessCMD();
|
||||||
|
|
||||||
|
@ -85,6 +89,7 @@ private:
|
||||||
Q_DISABLE_COPY(VPApplication)
|
Q_DISABLE_COPY(VPApplication)
|
||||||
QList<QPointer<VPMainWindow> > mainWindows{};
|
QList<QPointer<VPMainWindow> > mainWindows{};
|
||||||
QLocalServer *localServer{nullptr};
|
QLocalServer *localServer{nullptr};
|
||||||
|
QWeakPointer<DialogPuzzlePreferences> m_preferencesDialog{};
|
||||||
|
|
||||||
void Clean();
|
void Clean();
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,23 +78,6 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
// ----- for test purposes, to be removed------------------
|
|
||||||
m_layout->LayoutSettings().SetUnit(Unit::Cm);
|
|
||||||
m_layout->LayoutSettings().SetWarningSuperpositionOfPieces(true);
|
|
||||||
m_layout->LayoutSettings().SetTitle(QString("My Test Layout"));
|
|
||||||
m_layout->LayoutSettings().SetDescription(QString("Description of my Layout"));
|
|
||||||
|
|
||||||
m_layout->LayoutSettings().SetTilesSizeConverted(21, 29.7);
|
|
||||||
m_layout->LayoutSettings().SetTilesOrientation(PageOrientation::Portrait);
|
|
||||||
m_layout->LayoutSettings().SetTilesMarginsConverted(1, 1, 1, 1);
|
|
||||||
m_layout->LayoutSettings().SetShowTiles(true);
|
|
||||||
|
|
||||||
m_layout->LayoutSettings().SetSheetMarginsConverted(1, 1, 1, 1);
|
|
||||||
m_layout->LayoutSettings().SetSheetSizeConverted(84.1, 118.9);
|
|
||||||
m_layout->LayoutSettings().SetPiecesGapConverted(1);
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
// init the tile factory
|
// init the tile factory
|
||||||
m_tileFactory = new VPTileFactory(m_layout, VPApplication::VApp()->Settings());
|
m_tileFactory = new VPTileFactory(m_layout, VPApplication::VApp()->Settings());
|
||||||
m_tileFactory->refreshTileInfos();
|
m_tileFactory->refreshTileInfos();
|
||||||
|
@ -228,6 +211,7 @@ auto VPMainWindow::LoadFile(QString path) -> bool
|
||||||
m_carrousel->Refresh();
|
m_carrousel->Refresh();
|
||||||
m_graphicsView->RefreshLayout();
|
m_graphicsView->RefreshLayout();
|
||||||
m_graphicsView->RefreshPieces();
|
m_graphicsView->RefreshPieces();
|
||||||
|
m_tileFactory->refreshTileInfos();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -940,7 +924,7 @@ void VPMainWindow::ReadSettings()
|
||||||
m_graphicsView->SetAntialiasing(settings->GetGraphicalOutput());
|
m_graphicsView->SetAntialiasing(settings->GetGraphicalOutput());
|
||||||
|
|
||||||
// Stack limit
|
// Stack limit
|
||||||
// qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
m_undoStack->setUndoLimit(settings->GetUndoCount());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1148,6 +1132,14 @@ auto VPMainWindow::IsLayoutReadOnly() const -> bool
|
||||||
return not fileWritable;
|
return not fileWritable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPMainWindow::ConnectToPreferences(const QSharedPointer<DialogPuzzlePreferences> &preferences)
|
||||||
|
{
|
||||||
|
// Must be first
|
||||||
|
connect(preferences.get(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::WindowsLocale);
|
||||||
|
connect(preferences.get(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::ToolBarStyles);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPMainWindow::on_actionNew_triggered()
|
void VPMainWindow::on_actionNew_triggered()
|
||||||
{
|
{
|
||||||
|
@ -1612,14 +1604,6 @@ void VPMainWindow::on_TilesSizeChanged(bool changedViaSizeCombobox)
|
||||||
void VPMainWindow::on_TilesOrientationChanged()
|
void VPMainWindow::on_TilesOrientationChanged()
|
||||||
{
|
{
|
||||||
// Updates the orientation
|
// Updates the orientation
|
||||||
if(ui->radioButtonTilesPortrait->isChecked())
|
|
||||||
{
|
|
||||||
m_layout->LayoutSettings().SetTilesOrientation(PageOrientation::Portrait);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_layout->LayoutSettings().SetTilesOrientation(PageOrientation::Landscape);
|
|
||||||
}
|
|
||||||
m_tileFactory->refreshTileInfos();
|
m_tileFactory->refreshTileInfos();
|
||||||
|
|
||||||
// TODO Undo / Redo
|
// TODO Undo / Redo
|
||||||
|
@ -1909,19 +1893,33 @@ void VPMainWindow::ShowWindow() const
|
||||||
void VPMainWindow::on_actionPreferences_triggered()
|
void VPMainWindow::on_actionPreferences_triggered()
|
||||||
{
|
{
|
||||||
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
||||||
static QPointer<DialogPuzzlePreferences> guard;// Prevent any second run
|
QSharedPointer<DialogPuzzlePreferences> preferences = VPApplication::VApp()->PreferencesDialog();
|
||||||
if (guard.isNull())
|
if (preferences.isNull())
|
||||||
{
|
{
|
||||||
|
auto CleanAfterDialog = qScopeGuard([&preferences]()
|
||||||
|
{
|
||||||
|
preferences.clear();
|
||||||
|
});
|
||||||
|
|
||||||
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
auto *preferences = new DialogPuzzlePreferences(this);
|
|
||||||
// QScopedPointer needs to be sure any exception will never block guard
|
preferences.reset(new DialogPuzzlePreferences());
|
||||||
QScopedPointer<DialogPuzzlePreferences> dlg(preferences);
|
preferences->setWindowModality(Qt::ApplicationModal);
|
||||||
guard = preferences;
|
VPApplication::VApp()->SetPreferencesDialog(preferences);
|
||||||
// Must be first
|
|
||||||
connect(dlg.data(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::WindowsLocale);
|
const QList<VPMainWindow*> windows = VPApplication::VApp()->MainWindows();
|
||||||
connect(dlg.data(), &DialogPuzzlePreferences::UpdateProperties, this, &VPMainWindow::ToolBarStyles);
|
for (auto *window : windows)
|
||||||
|
{
|
||||||
|
window->ConnectToPreferences(preferences);
|
||||||
|
}
|
||||||
|
|
||||||
QGuiApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
dlg->exec();
|
|
||||||
|
preferences->exec();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
preferences->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ namespace Ui
|
||||||
}
|
}
|
||||||
|
|
||||||
class QFileSystemWatcher;
|
class QFileSystemWatcher;
|
||||||
|
template <typename T> class QSharedPointer;
|
||||||
|
class DialogPuzzlePreferences;
|
||||||
|
|
||||||
class VPMainWindow : public VAbstractMainWindow
|
class VPMainWindow : public VAbstractMainWindow
|
||||||
{
|
{
|
||||||
|
@ -563,6 +565,8 @@ private:
|
||||||
void CreateWindowMenu(QMenu *menu);
|
void CreateWindowMenu(QMenu *menu);
|
||||||
|
|
||||||
auto IsLayoutReadOnly() const -> bool;
|
auto IsLayoutReadOnly() const -> bool;
|
||||||
|
|
||||||
|
void ConnectToPreferences(const QSharedPointer<DialogPuzzlePreferences> &preferences);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPMAINWINDOW_H
|
#endif // VPMAINWINDOW_H
|
||||||
|
|
|
@ -195,7 +195,7 @@
|
||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -669,7 +669,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-170</y>
|
||||||
<width>342</width>
|
<width>342</width>
|
||||||
<height>870</height>
|
<height>870</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
|
|
@ -27,31 +27,56 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#include "vpsettings.h"
|
#include "vpsettings.h"
|
||||||
|
|
||||||
|
#include <QMarginsF>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, (QLatin1String("dockWidget/properties")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, (QLatin1String("dockWidget/properties")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, (QLatin1String("dockWidget/contents")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, (QLatin1String("dockWidget/contents")))
|
||||||
}
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnit, (QLatin1String("layout/unit")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperWidth, (QLatin1String("layout/sheetPaperWidth")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperHeight, (QLatin1String("layout/sheetPaperHeight")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperWidth, (QLatin1String("layout/tilePaperWidth")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperHeight, (QLatin1String("layout/tilePaperHeight")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetMargins, (QLatin1String("layout/sheetMargins")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileMargins, (QLatin1String("layout/tileMargins")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetIgnoreMargins, (QLatin1String("layout/sheetIgnoreMargins")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileIgnoreMargins, (QLatin1String("layout/tileIgnoreMargins")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowTiles, (QLatin1String("layout/tileShowTiles")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesSuperposition,
|
||||||
|
(QLatin1String("layout/warningPiecesSuperposition")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutStickyEdges, (QLatin1String("layout/stickyEdges")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound,
|
||||||
|
(QLatin1String("layout/warningPiecesOutOfBound")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, (QLatin1String("layout/pieceGap")))
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QMarginsF)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPSettings::VPSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
VPSettings::VPSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
: VCommonSettings(format, scope, organization, application, parent)
|
: VCommonSettings(format, scope, organization, application, parent)
|
||||||
{}
|
{
|
||||||
|
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPSettings::VPSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
VPSettings::VPSettings(const QString &fileName, QSettings::Format format, QObject *parent)
|
||||||
: VCommonSettings(fileName, format, parent)
|
: VCommonSettings(fileName, format, parent)
|
||||||
{}
|
{
|
||||||
|
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPSettings::IsDockWidgetPropertiesActive() const
|
auto VPSettings::IsDockWidgetPropertiesActive() const -> bool
|
||||||
{
|
{
|
||||||
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPSettings::GetDefDockWidgetPropertiesActive()
|
auto VPSettings::GetDefDockWidgetPropertiesActive() -> bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -63,13 +88,13 @@ void VPSettings::SetDockWidgetPropertiesActive(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPSettings::IsDockWidgetPropertiesContentsActive() const
|
auto VPSettings::IsDockWidgetPropertiesContentsActive() const -> bool
|
||||||
{
|
{
|
||||||
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
return value(*settingDockWidgetPropertiesActive, GetDefDockWidgetPropertiesActive()).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPSettings::GetDefDockWidgetPropertiesContentsActive()
|
auto VPSettings::GetDefDockWidgetPropertiesContentsActive() -> bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -79,3 +104,182 @@ void VPSettings::SetDockWidgetPropertiesContentsActive(bool value)
|
||||||
{
|
{
|
||||||
setValue(*settingDockPropertiesContentsActive, value);
|
setValue(*settingDockPropertiesContentsActive, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutUnit(Unit unit)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutUnit, UnitsToStr(unit));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::LayoutUnit() const -> Unit
|
||||||
|
{
|
||||||
|
return StrToUnits(value(*settingLayoutUnit, QString()).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutSheetPaperWidth(qreal width)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutSheetPaperWidth, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutSheetPaperWidth() const -> qreal
|
||||||
|
{
|
||||||
|
return ValueOrDef<qreal>(*this, *settingLayoutSheetPaperWidth, UnitConvertor(841/*A0*/, Unit::Mm, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutSheetPaperHeight(qreal height)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutSheetPaperHeight, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutSheetPaperHeight() const -> qreal
|
||||||
|
{
|
||||||
|
return ValueOrDef<qreal>(*this, *settingLayoutSheetPaperHeight, UnitConvertor(1189/*A0*/, Unit::Mm, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutTilePaperWidth(qreal width)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutTilePaperWidth, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutTilePaperWidth() const -> qreal
|
||||||
|
{
|
||||||
|
return ValueOrDef<qreal>(*this, *settingLayoutTilePaperWidth, UnitConvertor(210/*A4*/, Unit::Mm, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutTilePaperHeight(qreal height)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutTilePaperHeight, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutTilePaperHeight() const -> qreal
|
||||||
|
{
|
||||||
|
return ValueOrDef<qreal>(*this, *settingLayoutTilePaperHeight, UnitConvertor(297/*A4*/, Unit::Mm, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutSheetMargins(const QMarginsF &margins)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutSheetMargins, QVariant::fromValue(margins));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutSheetMargins() const -> QMarginsF
|
||||||
|
{
|
||||||
|
return ValueOrDef<QMarginsF>(*this, *settingLayoutSheetMargins, QMarginsF());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutTileMargins(const QMarginsF &margins)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutTileMargins, QVariant::fromValue(margins));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutTileMargins() const -> QMarginsF
|
||||||
|
{
|
||||||
|
return ValueOrDef<QMarginsF>(*this, *settingLayoutTileMargins, QMarginsF());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutSheetIgnoreMargins(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutSheetIgnoreMargins, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutSheetIgnoreMargins() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutSheetIgnoreMargins, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutTileIgnoreMargins(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutTileIgnoreMargins, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutTileIgnoreMargins() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutTileIgnoreMargins, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutTileShowTiles(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutTileShowTiles, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutTileShowTiles() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutTileShowTiles, true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutWarningPiecesSuperposition(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutWarningPiecesSuperposition, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutWarningPiecesSuperposition() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutWarningPiecesSuperposition, true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutStickyEdges(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutStickyEdges, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutStickyEdges() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutStickyEdges, true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutWarningPiecesOutOfBound(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutWarningPiecesOutOfBound, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutWarningPiecesOutOfBound() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutWarningPiecesOutOfBound, true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSettings::SetLayoutFollowGrainline(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutFollowGrainline, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutFollowGrainline() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingLayoutFollowGrainline, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VPSettings::SetLayoutPieceGap(qreal value)
|
||||||
|
{
|
||||||
|
setValue(*settingLayoutPieceGap, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPSettings::GetLayoutPieceGap() const -> qreal
|
||||||
|
{
|
||||||
|
return ValueOrDef<qreal>(*this, *settingLayoutPieceGap, UnitConvertor(5, Unit::Mm, Unit::Px));
|
||||||
|
}
|
||||||
|
|
|
@ -40,14 +40,59 @@ public:
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
VPSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
VPSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||||
|
|
||||||
bool IsDockWidgetPropertiesActive() const;
|
auto IsDockWidgetPropertiesActive() const -> bool;
|
||||||
static bool GetDefDockWidgetPropertiesActive();
|
static auto GetDefDockWidgetPropertiesActive() -> bool;
|
||||||
void SetDockWidgetPropertiesActive(bool value);
|
void SetDockWidgetPropertiesActive(bool value);
|
||||||
|
|
||||||
bool IsDockWidgetPropertiesContentsActive() const;
|
auto IsDockWidgetPropertiesContentsActive() const -> bool;
|
||||||
static bool GetDefDockWidgetPropertiesContentsActive();
|
static auto GetDefDockWidgetPropertiesContentsActive() -> bool;
|
||||||
void SetDockWidgetPropertiesContentsActive(bool value);
|
void SetDockWidgetPropertiesContentsActive(bool value);
|
||||||
|
|
||||||
|
void SetLayoutUnit(Unit unit);
|
||||||
|
auto LayoutUnit() const -> Unit;
|
||||||
|
|
||||||
|
void SetLayoutSheetPaperWidth(qreal width);
|
||||||
|
auto GetLayoutSheetPaperWidth() const -> qreal;
|
||||||
|
|
||||||
|
void SetLayoutSheetPaperHeight(qreal height);
|
||||||
|
auto GetLayoutSheetPaperHeight() const -> qreal;
|
||||||
|
|
||||||
|
void SetLayoutTilePaperWidth(qreal width);
|
||||||
|
auto GetLayoutTilePaperWidth() const -> qreal;
|
||||||
|
|
||||||
|
void SetLayoutTilePaperHeight(qreal height);
|
||||||
|
auto GetLayoutTilePaperHeight() const -> qreal;
|
||||||
|
|
||||||
|
void SetLayoutSheetMargins(const QMarginsF &margins);
|
||||||
|
auto GetLayoutSheetMargins() const -> QMarginsF;
|
||||||
|
|
||||||
|
void SetLayoutTileMargins(const QMarginsF &margins);
|
||||||
|
auto GetLayoutTileMargins() const -> QMarginsF;
|
||||||
|
|
||||||
|
void SetLayoutSheetIgnoreMargins(bool value);
|
||||||
|
auto GetLayoutSheetIgnoreMargins() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutTileIgnoreMargins(bool value);
|
||||||
|
auto GetLayoutTileIgnoreMargins() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutTileShowTiles(bool value);
|
||||||
|
auto GetLayoutTileShowTiles() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutWarningPiecesSuperposition(bool value);
|
||||||
|
auto GetLayoutWarningPiecesSuperposition() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutStickyEdges(bool value);
|
||||||
|
auto GetLayoutStickyEdges() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutWarningPiecesOutOfBound(bool value);
|
||||||
|
auto GetLayoutWarningPiecesOutOfBound() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutFollowGrainline(bool value);
|
||||||
|
auto GetLayoutFollowGrainline() const -> bool;
|
||||||
|
|
||||||
|
void SetLayoutPieceGap(qreal value);
|
||||||
|
auto GetLayoutPieceGap() const -> qreal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPSettings)
|
Q_DISABLE_COPY(VPSettings)
|
||||||
};
|
};
|
||||||
|
|
|
@ -136,24 +136,24 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
|
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
|
||||||
|
|
||||||
// Tab Scrolling
|
// Tab Scrolling
|
||||||
ui->spinBoxDuration->setMinimum(VValentinaSettings::scrollingDurationMin);
|
ui->spinBoxDuration->setMinimum(VCommonSettings::scrollingDurationMin);
|
||||||
ui->spinBoxDuration->setMaximum(VValentinaSettings::scrollingDurationMax);
|
ui->spinBoxDuration->setMaximum(VCommonSettings::scrollingDurationMax);
|
||||||
ui->spinBoxDuration->setValue(settings->GetScrollingDuration());
|
ui->spinBoxDuration->setValue(settings->GetScrollingDuration());
|
||||||
|
|
||||||
ui->spinBoxUpdateInterval->setMinimum(VValentinaSettings::scrollingUpdateIntervalMin);
|
ui->spinBoxUpdateInterval->setMinimum(VCommonSettings::scrollingUpdateIntervalMin);
|
||||||
ui->spinBoxUpdateInterval->setMaximum(VValentinaSettings::scrollingUpdateIntervalMax);
|
ui->spinBoxUpdateInterval->setMaximum(VCommonSettings::scrollingUpdateIntervalMax);
|
||||||
ui->spinBoxUpdateInterval->setValue(settings->GetScrollingUpdateInterval());
|
ui->spinBoxUpdateInterval->setValue(settings->GetScrollingUpdateInterval());
|
||||||
|
|
||||||
ui->doubleSpinBoxSensor->setMinimum(VValentinaSettings::sensorMouseScaleMin);
|
ui->doubleSpinBoxSensor->setMinimum(VCommonSettings::sensorMouseScaleMin);
|
||||||
ui->doubleSpinBoxSensor->setMaximum(VValentinaSettings::sensorMouseScaleMax);
|
ui->doubleSpinBoxSensor->setMaximum(VCommonSettings::sensorMouseScaleMax);
|
||||||
ui->doubleSpinBoxSensor->setValue(settings->GetSensorMouseScale());
|
ui->doubleSpinBoxSensor->setValue(settings->GetSensorMouseScale());
|
||||||
|
|
||||||
ui->doubleSpinBoxWheel->setMinimum(VValentinaSettings::wheelMouseScaleMin);
|
ui->doubleSpinBoxWheel->setMinimum(VCommonSettings::wheelMouseScaleMin);
|
||||||
ui->doubleSpinBoxWheel->setMaximum(VValentinaSettings::wheelMouseScaleMax);
|
ui->doubleSpinBoxWheel->setMaximum(VCommonSettings::wheelMouseScaleMax);
|
||||||
ui->doubleSpinBoxWheel->setValue(settings->GetWheelMouseScale());
|
ui->doubleSpinBoxWheel->setValue(settings->GetWheelMouseScale());
|
||||||
|
|
||||||
ui->doubleSpinBoxAcceleration->setMinimum(VValentinaSettings::scrollingAccelerationMin);
|
ui->doubleSpinBoxAcceleration->setMinimum(VCommonSettings::scrollingAccelerationMin);
|
||||||
ui->doubleSpinBoxAcceleration->setMaximum(VValentinaSettings::scrollingAccelerationMax);
|
ui->doubleSpinBoxAcceleration->setMaximum(VCommonSettings::scrollingAccelerationMax);
|
||||||
ui->doubleSpinBoxAcceleration->setValue(settings->GetScrollingAcceleration());
|
ui->doubleSpinBoxAcceleration->setValue(settings->GetScrollingAcceleration());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-189</y>
|
<y>0</y>
|
||||||
<width>624</width>
|
<width>624</width>
|
||||||
<height>745</height>
|
<height>765</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
|
|
@ -61,6 +61,8 @@ public:
|
||||||
|
|
||||||
static auto GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF;
|
static auto GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF;
|
||||||
|
|
||||||
|
static void InitTemplates(QComboBox *comboBoxTemplates);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef QStringList FormatsVector;
|
typedef QStringList FormatsVector;
|
||||||
const static FormatsVector pageFormatNames;
|
const static FormatsVector pageFormatNames;
|
||||||
|
@ -68,7 +70,7 @@ protected:
|
||||||
|
|
||||||
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;
|
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;
|
||||||
|
|
||||||
static void InitTemplates(QComboBox *comboBoxTemplates);
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractLayoutDialog)
|
Q_DISABLE_COPY(VAbstractLayoutDialog)
|
||||||
};
|
};
|
||||||
|
|
|
@ -525,7 +525,7 @@ Q_DECL_RELAXED_CONSTEXPR inline qreal UnitConvertor(qreal value, const Unit &fro
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
return value / 10.0;
|
return value / 10.0;
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
return value / 25.4;
|
return value / 10.0 / 2.54;
|
||||||
case Unit::Px:
|
case Unit::Px:
|
||||||
return (value / 25.4) * PrintDPI;
|
return (value / 25.4) * PrintDPI;
|
||||||
default:
|
default:
|
||||||
|
@ -551,7 +551,7 @@ Q_DECL_RELAXED_CONSTEXPR inline qreal UnitConvertor(qreal value, const Unit &fro
|
||||||
switch (to)
|
switch (to)
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
return value * 25.4;
|
return value * 2.54 * 10.0;
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
return value * 2.54;
|
return value * 2.54;
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
|
|
|
@ -93,5 +93,6 @@
|
||||||
<file>icon/24x24/star@2x.png</file>
|
<file>icon/24x24/star@2x.png</file>
|
||||||
<file>icon/24x24/close.png</file>
|
<file>icon/24x24/close.png</file>
|
||||||
<file>icon/24x24/close@2x.png</file>
|
<file>icon/24x24/close@2x.png</file>
|
||||||
|
<file>icon/layout.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/libs/vmisc/share/resources/icon/layout.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/layout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -41,6 +41,7 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QGlobalStatic>
|
#include <QGlobalStatic>
|
||||||
|
#include <QMarginsF>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user