New option: Pointer mode.
This commit is contained in:
parent
4f2fb335fa
commit
e29ab9c7d9
|
@ -36,6 +36,7 @@
|
||||||
- Increased requirement for minimal Qt version.
|
- Increased requirement for minimal Qt version.
|
||||||
- Support for Dark mode.
|
- Support for Dark mode.
|
||||||
- Fix issue with passing incorrect number of dimension to Tape.
|
- Fix issue with passing incorrect number of dimension to Tape.
|
||||||
|
- New option: Pointer mode.
|
||||||
|
|
||||||
# Valentina 0.7.52 September 12, 2022
|
# Valentina 0.7.52 September 12, 2022
|
||||||
- Fix crash when default locale is ru.
|
- Fix crash when default locale is ru.
|
||||||
|
|
|
@ -143,6 +143,14 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
ui->comboBoxThemeMode->setCurrentIndex(index);
|
ui->comboBoxThemeMode->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pointer mode
|
||||||
|
SetPointerModeComboBox();
|
||||||
|
index = ui->comboBoxPointerMode->findData(static_cast<int>(settings->GetPointerMode()));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxPointerMode->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
// Native dialogs
|
// Native dialogs
|
||||||
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
|
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
|
||||||
|
|
||||||
|
@ -224,6 +232,8 @@ auto PreferencesConfigurationPage::Apply() -> QStringList
|
||||||
QGuiApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings->SetPointerMode(static_cast<VToolPointerMode>(ui->comboBoxPointerMode->currentData().toInt()));
|
||||||
|
|
||||||
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
|
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
|
||||||
{
|
{
|
||||||
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());
|
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());
|
||||||
|
@ -319,6 +329,14 @@ void PreferencesConfigurationPage::SetThemeModeComboBox()
|
||||||
ui->comboBoxThemeMode->addItem(tr("Light", "theme"), static_cast<int>(VThemeMode::Light));
|
ui->comboBoxThemeMode->addItem(tr("Light", "theme"), static_cast<int>(VThemeMode::Light));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PreferencesConfigurationPage::SetPointerModeComboBox()
|
||||||
|
{
|
||||||
|
ui->comboBoxPointerMode->clear();
|
||||||
|
ui->comboBoxPointerMode->addItem(tr("Tool icon cursor"), static_cast<int>(VToolPointerMode::ToolIcon));
|
||||||
|
ui->comboBoxPointerMode->addItem(tr("Arrow cursor"), static_cast<int>(VToolPointerMode::Arrow));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesConfigurationPage::InitUnits()
|
void PreferencesConfigurationPage::InitUnits()
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,7 @@ private:
|
||||||
|
|
||||||
void SetLabelComboBox(const QStringList &list);
|
void SetLabelComboBox(const QStringList &list);
|
||||||
void SetThemeModeComboBox();
|
void SetThemeModeComboBox();
|
||||||
|
void SetPointerModeComboBox();
|
||||||
void InitUnits();
|
void InitUnits();
|
||||||
void RetranslateUi();
|
void RetranslateUi();
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-101</y>
|
||||||
<width>624</width>
|
<width>624</width>
|
||||||
<height>904</height>
|
<height>937</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -364,6 +364,27 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pointer mode:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxPointerMode">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
|
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
#include "../vmisc/dialogs/dialogselectlanguage.h"
|
#include "../vmisc/dialogs/dialogselectlanguage.h"
|
||||||
#include "../vmisc/qxtcsvmodel.h"
|
#include "../vmisc/qxtcsvmodel.h"
|
||||||
#include "../vmisc/theme/vtheme.h"
|
#include "../vmisc/theme/vtheme.h"
|
||||||
|
#include "../vmisc/vcommonsettings.h"
|
||||||
#include "../vmisc/vmodifierkey.h"
|
#include "../vmisc/vmodifierkey.h"
|
||||||
#include "../vmisc/vsysexits.h"
|
#include "../vmisc/vsysexits.h"
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
|
@ -813,22 +814,28 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
CancelTool();
|
CancelTool();
|
||||||
emit EnableItemMove(false);
|
emit EnableItemMove(false);
|
||||||
m_currentTool = m_lastUsedTool = t;
|
m_currentTool = m_lastUsedTool = t;
|
||||||
const QString resource = QStringLiteral("toolcursor");
|
|
||||||
auto cursorResource = VTheme::GetResourceName(resource, cursor);
|
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
if (qApp->devicePixelRatio() >= 2) // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
if (settings->GetPointerMode() == VToolPointerMode::ToolIcon)
|
||||||
{
|
{
|
||||||
// Try to load HiDPI versions of the cursors if availible
|
const QString resource = QStringLiteral("toolcursor");
|
||||||
auto hiDPICursor = QString(cursor).replace(QLatin1String(".png"), QLatin1String("@2x.png"));
|
auto cursorResource = VTheme::GetResourceName(resource, cursor);
|
||||||
auto cursorHiDPIResource = VTheme::GetResourceName(resource, hiDPICursor);
|
if (qApp->devicePixelRatio() >= 2) // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||||
if (QFileInfo::exists(cursorHiDPIResource))
|
|
||||||
{
|
{
|
||||||
cursorResource = cursorHiDPIResource;
|
// Try to load HiDPI versions of the cursors if availible
|
||||||
|
auto hiDPICursor = QString(cursor).replace(QLatin1String(".png"), QLatin1String("@2x.png"));
|
||||||
|
auto cursorHiDPIResource = VTheme::GetResourceName(resource, hiDPICursor);
|
||||||
|
if (QFileInfo::exists(cursorHiDPIResource))
|
||||||
|
{
|
||||||
|
cursorResource = cursorHiDPIResource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
QPixmap pixmap(cursorResource);
|
||||||
|
QCursor cur(pixmap, 2, 2);
|
||||||
|
ui->view->viewport()->setCursor(cur);
|
||||||
|
ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor
|
||||||
}
|
}
|
||||||
QPixmap pixmap(cursorResource);
|
|
||||||
QCursor cur(pixmap, 2, 2);
|
|
||||||
ui->view->viewport()->setCursor(cur);
|
|
||||||
ui->view->setCurrentCursorShape(); // Hack to fix problem with a cursor
|
|
||||||
m_statusLabel->setText(toolTip);
|
m_statusLabel->setText(toolTip);
|
||||||
ui->view->setShowToolOptions(false);
|
ui->view->setShowToolOptions(false);
|
||||||
m_dialogTool = new Dialog(pattern, 0, this);
|
m_dialogTool = new Dialog(pattern, 0, this);
|
||||||
|
|
|
@ -56,6 +56,9 @@ QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
||||||
(QLatin1String("configuration/label_language")))
|
(QLatin1String("configuration/label_language")))
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolPointerMode,
|
||||||
|
(QLatin1String("configuration/toolPointerMode")))
|
||||||
|
// NOLINTNEXTLINE
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
|
||||||
(QLatin1String("configuration/autoRefreshPatternMessage")))
|
(QLatin1String("configuration/autoRefreshPatternMessage")))
|
||||||
|
|
||||||
|
@ -1034,6 +1037,25 @@ void VValentinaSettings::SetShowGrainline(bool value)
|
||||||
setValue(*settingLayoutShowGrainline, value);
|
setValue(*settingLayoutShowGrainline, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VValentinaSettings::GetPointerMode() const -> VToolPointerMode
|
||||||
|
{
|
||||||
|
int val = value(*settingConfigurationToolPointerMode, static_cast<int>(VToolPointerMode::ToolIcon)).toInt();
|
||||||
|
|
||||||
|
if (val < 0 || val > 2)
|
||||||
|
{
|
||||||
|
val = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return static_cast<VToolPointerMode>(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VValentinaSettings::SetPointerMode(VToolPointerMode mode)
|
||||||
|
{
|
||||||
|
setValue(*settingConfigurationToolPointerMode, static_cast<int>(mode));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
auto VValentinaSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const -> T
|
auto VValentinaSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const -> T
|
||||||
|
|
|
@ -37,6 +37,12 @@
|
||||||
|
|
||||||
#include "vcommonsettings.h"
|
#include "vcommonsettings.h"
|
||||||
|
|
||||||
|
enum class VToolPointerMode
|
||||||
|
{
|
||||||
|
ToolIcon = 0,
|
||||||
|
Arrow = 1
|
||||||
|
};
|
||||||
|
|
||||||
class VValentinaSettings : public VCommonSettings
|
class VValentinaSettings : public VCommonSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
@ -242,6 +248,9 @@ public:
|
||||||
auto GetShowGrainline() const -> bool;
|
auto GetShowGrainline() const -> bool;
|
||||||
void SetShowGrainline(bool value);
|
void SetShowGrainline(bool value);
|
||||||
|
|
||||||
|
auto GetPointerMode() const -> VToolPointerMode;
|
||||||
|
void SetPointerMode(VToolPointerMode mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VValentinaSettings) // NOLINT
|
Q_DISABLE_COPY_MOVE(VValentinaSettings) // NOLINT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user