Improve support for dark theme.

Custom dark theme updated. Added support for native dark mode. Added new icon themes. Scene still needs improvement.
This commit is contained in:
Roman Telezhynskyi 2023-07-24 13:41:42 +03:00
parent 2646a9c6d7
commit ec8a22cc84
20517 changed files with 320092 additions and 2719 deletions

4
.gitignore vendored
View File

@ -166,3 +166,7 @@ $RECYCLE.BIN/
*.udb
__pycache__
# Temporary svg cursor files
/src/app/valentina/share/resources/cursor/svg/light/
/src/app/valentina/share/resources/cursor/svg/dark/

View File

@ -66,7 +66,5 @@
</dict>
</dict>
</array>
<key>NSRequiresAquaSystemAppearance</key>
<true/>
</dict>
</plist>

View File

@ -102,7 +102,5 @@
</dict>
</dict>
</array>
<key>NSRequiresAquaSystemAppearance</key>
<true/>
</dict>
</plist>

View File

@ -160,7 +160,5 @@
</dict>
</dict>
</array>
<key>NSRequiresAquaSystemAppearance</key>
<true/>
</dict>
</plist>

View File

@ -15,19 +15,31 @@
# I have spent hour before understand why i don't see PNG inside SVG in Nautilus.
PATTERN=*@2x.png
TOOLICONPATH=../src/app/valentina/share/resources/toolicon/32x32/ # PNG tool icon should be here
TOOLICONS=`ls $TOOLICONPATH$PATTERN`
OUTPATH=../src/app/valentina/share/resources/cursor/svg # Seek SVG templates here
TOOLICONPATH=../src/app/valentina/share/resources/toolicon/ # PNG tool icon should be here
OUTPATH=../src/app/valentina/share/resources/cursor
COLOR_SCHEMES=("light" "dark")
for var in $TOOLICONS
for scheme in "${COLOR_SCHEMES[@]}"
do
# Create a subdirectory for the current scheme if it doesn't exist
mkdir -p "$OUTPATH/$scheme"
TOOLICONS=`ls $TOOLICONPATH${scheme}/$PATTERN`
for var in $TOOLICONS
do
basename=${var##*/} # remove the path from a path-string
basename=${basename%.png} # remove the extension from a path-string
basename=${basename%@2x} # remove optional @2x suffix
if [ ! -f $basename@2x.png ]; then # always prefere hidpi version
sed "s/<<basename>>/$basename@2x/" $OUTPATH/template_cursor.svg > $OUTPATH/${basename}_cursor.svg
sed "s/<<basename>>/$basename@2x/" $OUTPATH/svg/template_cursor_${scheme}.svg > $OUTPATH/svg/${scheme}/${basename}_cursor.svg
else
sed "s/<<basename>>/$basename/" $OUTPATH/template_cursor.svg > $OUTPATH/${basename}_cursor.svg
sed "s/<<basename>>/$basename/" $OUTPATH/svg/template_cursor_${scheme}.svg > $OUTPATH/svg/${scheme}/${basename}_cursor.svg
fi
# Generate PNG files from the SVGs
inkscape --export-filename "$OUTPATH/$scheme/${basename}_cursor@2x.png" --export-width 64 --export-height 64 "$OUTPATH/svg/$scheme/${basename}_cursor.svg"
inkscape --export-filename "$OUTPATH/$scheme/${basename}_cursor.png" --export-width 32 --export-height 32 "$OUTPATH/svg/$scheme/${basename}_cursor.svg"
done
done

View File

@ -34,6 +34,7 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vganalytics/vganalytics.h"
#include "../vmisc/theme/vtheme.h"
//---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *parent)
@ -49,7 +50,12 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
// Theme
ui->darkModeCheck->setChecked(settings->GetDarkMode());
SetThemeModeComboBox();
int index = ui->comboBoxThemeMode->findData(static_cast<int>(settings->GetThemeMode()));
if (index != -1)
{
ui->comboBoxThemeMode->setCurrentIndex(index);
}
// Native dialogs
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
@ -110,10 +116,11 @@ auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
if (settings->GetDarkMode() != ui->darkModeCheck->isChecked())
auto themeMode = static_cast<VThemeMode>(ui->comboBoxThemeMode->currentData().toInt());
if (settings->GetThemeMode() != themeMode)
{
settings->SetDarkMode(ui->darkModeCheck->isChecked());
preferences.append(tr("dark mode"));
settings->SetThemeMode(themeMode);
VTheme::Instance()->ResetThemeSettings();
}
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
@ -190,3 +197,12 @@ void PuzzlePreferencesConfigurationPage::changeEvent(QEvent *event)
// remember to call base class implementation
QWidget::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void PuzzlePreferencesConfigurationPage::SetThemeModeComboBox()
{
ui->comboBoxThemeMode->clear();
ui->comboBoxThemeMode->addItem(tr("System", "theme"), static_cast<int>(VThemeMode::System));
ui->comboBoxThemeMode->addItem(tr("Dark", "theme"), static_cast<int>(VThemeMode::Dark));
ui->comboBoxThemeMode->addItem(tr("Light", "theme"), static_cast<int>(VThemeMode::Light));
}

View File

@ -57,6 +57,8 @@ private:
Q_DISABLE_COPY_MOVE(PuzzlePreferencesConfigurationPage) // NOLINT
Ui::PuzzlePreferencesConfigurationPage *ui;
bool m_langChanged{false};
void SetThemeModeComboBox();
};
#endif // PUZZLEPREFERENCESCONFIGURATIONPAGE_H

View File

@ -46,7 +46,7 @@
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
@ -87,12 +87,25 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="darkModeCheck">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Activate dark mode</string>
<string>Theme:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxThemeMode"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
<property name="text">
@ -237,8 +250,8 @@ This option will take an affect after restart.</string>
<rect>
<x>0</x>
<y>0</y>
<width>503</width>
<height>627</height>
<width>497</width>
<height>633</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
@ -249,7 +262,7 @@ This option will take an affect after restart.</string>
</property>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
@ -313,7 +326,7 @@ This option will take an affect after restart.</string>
</property>
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
@ -377,7 +390,7 @@ This option will take an affect after restart.</string>
</property>
<layout class="QFormLayout" name="formLayout_5">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_13">

View File

@ -43,7 +43,7 @@
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelLayoutUnit">
@ -327,6 +327,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelSheetPiecesGap">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Pieces gap</string>
</property>
@ -341,6 +347,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Line width:</string>
</property>
@ -429,7 +441,7 @@
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">

View File

@ -27,19 +27,19 @@
*************************************************************************/
#include "dialogpuzzlepreferences.h"
#include "ui_dialogpuzzlepreferences.h"
#include "../vpapplication.h"
#include "configpages/puzzlepreferencesconfigurationpage.h"
#include "configpages/puzzlepreferencespathpage.h"
#include "configpages/puzzlepreferenceslayoutpage.h"
#include "configpages/puzzlepreferencespathpage.h"
#include "ui_dialogpuzzlepreferences.h"
#include <QMessageBox>
#include <QPushButton>
#include <QShowEvent>
//---------------------------------------------------------------------------------------------------------------------
DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent) :
QDialog(parent),
DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogPuzzlePreferences),
m_configurationPage(new PuzzlePreferencesConfigurationPage),
m_layoutPage(new PuzzlePreferencesLayoutPage),
@ -78,8 +78,8 @@ DialogPuzzlePreferences::~DialogPuzzlePreferences()
//---------------------------------------------------------------------------------------------------------------------
void DialogPuzzlePreferences::showEvent(QShowEvent *event)
{
QDialog::showEvent( event );
if ( event->spontaneous() )
QDialog::showEvent(event);
if (event->spontaneous())
{
return;
}
@ -96,7 +96,7 @@ void DialogPuzzlePreferences::showEvent(QShowEvent *event)
resize(sz);
}
m_isInitialized = true;//first show windows are held
m_isInitialized = true; // first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
@ -120,6 +120,24 @@ void DialogPuzzlePreferences::changeEvent(QEvent *event)
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
}
if (event->type() == QEvent::PaletteChange)
{
QStyle *style = QApplication::style();
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
bOk->setIcon(style->standardIcon(QStyle::SP_DialogOkButton));
QPushButton *bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
SCASSERT(bApply != nullptr)
bApply->setIcon(style->standardIcon(QStyle::SP_DialogApplyButton));
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr)
bCancel->setIcon(style->standardIcon(QStyle::SP_DialogCancelButton));
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
@ -135,8 +153,9 @@ void DialogPuzzlePreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
const QString text =
tr("Followed %n option(s) require restart to take effect: %1.", "", static_cast<int>(preferences.size()))
.arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -29,16 +29,16 @@
#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <QTimer>
#include "vpapplication.h"
#include "../vmisc/def.h"
#include "vpapplication.h"
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
# include "../vmisc/backport/qscopeguard.h"
#include "../vmisc/backport/qscopeguard.h"
#else
# include <QScopeGuard>
#include <QScopeGuard>
#endif
# include "../vmisc/appimage.h"
#include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -50,18 +50,22 @@ auto main(int argc, char *argv[]) -> int
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
/* Fix path to ICU_DATA when run AppImage.*/
char *exe_dir = IcuDataPath("/../share/icu");
auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);});
auto FreeMemory = qScopeGuard([exe_dir] { free(exe_dir); });
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
Q_INIT_RESOURCE(puzzleicon); // NOLINT
Q_INIT_RESOURCE(theme); // NOLINT
Q_INIT_RESOURCE(icon); // NOLINT
Q_INIT_RESOURCE(schema); // NOLINT
Q_INIT_RESOURCE(flags); // NOLINT
Q_INIT_RESOURCE(style); // NOLINT
Q_INIT_RESOURCE(breeze); // NOLINT
Q_INIT_RESOURCE(cursor); // NOLINT
#if defined(Q_OS_MACX)
Q_INIT_RESOURCE(mac_theme); // NOLINT
#else
Q_INIT_RESOURCE(win_theme); // NOLINT
#endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations NOLINT
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
@ -69,9 +73,9 @@ auto main(int argc, char *argv[]) -> int
#ifndef Q_OS_MAC // supports natively
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
InitHighDpiScaling(argc, argv);
VAbstractApplication::InitHighDpiScaling(argc, argv);
#endif
#endif //ndef Q_OS_MAC
#endif // ndef Q_OS_MAC
#ifdef Q_OS_MAC
#if MACOS_LAYER_BACKING_AFFECTED
@ -82,7 +86,7 @@ auto main(int argc, char *argv[]) -> int
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
auto Terminate = qScopeGuard([]() { XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
VPApplication app(argc, argv);

View File

@ -27,6 +27,7 @@
*************************************************************************/
#include "vpapplication.h"
#include "../fervor/fvupdater.h"
#include "../ifc/exception/vexceptionbadid.h"
#include "../ifc/exception/vexceptionconversionerror.h"
#include "../ifc/exception/vexceptionemptyparameter.h"
@ -34,6 +35,9 @@
#include "../ifc/exception/vexceptionwrongid.h"
#include "../vganalytics/def.h"
#include "../vganalytics/vganalytics.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h"
#include "../vmisc/theme/vapplicationstyle.h"
#include "../vmisc/theme/vtheme.h"
#include "../vmisc/vsysexits.h"
#include "version.h"
#include "vpmainwindow.h"
@ -42,11 +46,14 @@
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../fervor/fvupdater.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h"
#include <QCommandLineParser>
#include <QFileOpenEvent>
#include <QLocalServer>
#include <QLocalSocket>
#include <QLoggingCategory>
#include <QMessageBox>
#include <QPixmapCache>
#include <QStyleFactory>
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
@ -56,12 +63,6 @@ Q_LOGGING_CATEGORY(pApp, "p.application") // NOLINT
QT_WARNING_POP
#include <QCommandLineParser>
#include <QFileOpenEvent>
#include <QLocalServer>
#include <QLocalSocket>
#include <QPixmapCache>
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
#include <vcsRepoState.h>
#define BUILD_REVISION VCS_REPO_STATE_REVISION
@ -274,12 +275,13 @@ VPApplication::VPApplication(int &argc, char **argv)
// The first inside own bundle where info.plist is works fine, but the second,
// when we run inside Valentina's bundle, require direct setting the icon.
setWindowIcon(QIcon(":/puzzleicon/64x64/logo.png"));
VTheme::Instance()->StoreDefaultThemeName(QIcon::themeName());
}
//---------------------------------------------------------------------------------------------------------------------
VPApplication::~VPApplication()
{
if (IsAppInGUIMode() && settings->IsCollectStatistic())
if (VPApplication::IsAppInGUIMode() && settings->IsCollectStatistic())
{
auto *statistic = VGAnalytics::Instance();
@ -433,16 +435,8 @@ void VPApplication::InitOptions()
CheckSystemLocale();
static const char *GENERIC_ICON_TO_CHECK = "document-open";
if (not QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK))
{
// If there is no default working icon theme then we should
// use an icon theme that we provide via a .qrc file
// This case happens under Windows and Mac OS X
// This does not happen under GNOME or KDE
QIcon::setThemeName(QStringLiteral("win.icon.theme"));
}
ActivateDarkMode();
VTheme::SetIconTheme();
VTheme::InitThemeMode();
auto *statistic = VGAnalytics::Instance();
QString clientID = settings->GetClientID();
@ -480,26 +474,6 @@ auto VPApplication::PuzzleSettings() -> VPSettings *
return qobject_cast<VPSettings *>(settings);
}
//---------------------------------------------------------------------------------------------------------------------
void VPApplication::ActivateDarkMode()
{
VPSettings *settings = PuzzleSettings();
if (settings->GetDarkMode())
{
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
if (!f.exists())
{
qDebug() << "Unable to set stylesheet, file not found\n";
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
VPApplication::VApp()->setStyleSheet(ts.readAll());
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
{
@ -525,6 +499,17 @@ void VPApplication::ParseCommandLine(const SocketConnection &connection, const Q
qCDebug(pApp, "Can't establish connection to the server '%s'", qUtf8Printable(serverName));
StartLocalServer(serverName);
LoadTranslation(PuzzleSettings()->GetLocale());
QString styleOpt = cmd->OptionStyle();
if (styleOpt != QLatin1String("native"))
{
QStyle *style = QStyleFactory::create(styleOpt);
if (style != nullptr)
{
style = new VApplicationStyle(style);
setStyle(style);
}
}
}
ProcessArguments(cmd);

View File

@ -29,29 +29,34 @@
#define VPAPPLICATION_H
#include "../vmisc/def.h"
#include "vpsettings.h"
#include "../vmisc/vabstractapplication.h"
#include "vpcommandline.h"
#include "vpsettings.h"
template <typename T> class QWeakPointer;
class VPMainWindow;
class QLocalServer;
class DialogPuzzlePreferences;
enum class SocketConnection : bool {Client = false, Server = true};
enum class SocketConnection : bool
{
Client = false,
Server = true
};
class VPApplication : public VAbstractApplication
{
Q_OBJECT // NOLINT
public:
VPApplication(int &argc, char **argv);
~VPApplication() override;
auto notify(QObject * receiver, QEvent * event) -> bool override;
auto notify(QObject *receiver, QEvent *event) -> bool override;
auto IsAppInGUIMode() const -> bool override;
auto MainWindow() -> VPMainWindow *;
auto MainWindows() -> QList<VPMainWindow*>;
auto MainWindows() -> QList<VPMainWindow *>;
auto NewMainWindow() -> VPMainWindow *;
auto NewMainWindow(const VPCommandLinePtr &cmd) -> VPMainWindow *;
@ -61,7 +66,6 @@ public:
void OpenSettings() override;
auto PuzzleSettings() -> VPSettings *;
void ActivateDarkMode();
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
void ProcessArguments(const VPCommandLinePtr &cmd);
@ -87,8 +91,8 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VPApplication) //NOLINT
QList<QPointer<VPMainWindow> > m_mainWindows{};
Q_DISABLE_COPY_MOVE(VPApplication) // NOLINT
QList<QPointer<VPMainWindow>> m_mainWindows{};
QLocalServer *m_localServer{nullptr};
QWeakPointer<DialogPuzzlePreferences> m_preferencesDialog{};

View File

@ -26,14 +26,16 @@
**
*************************************************************************/
#include "vpcommandline.h"
#include "vpcommands.h"
#include "../vmisc/vsysexits.h"
#include "../vmisc/literals.h"
#include "../vmisc/vsysexits.h"
#include "vpcommands.h"
#include <QDebug>
std::shared_ptr<VPCommandLine> VPCommandLine::instance = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
std::shared_ptr<VPCommandLine> VPCommandLine::instance =
nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
#define translate(context, source) QCoreApplication::translate((context), source)// NOLINT(cppcoreguidelines-macro-usage)
#define translate(context, source) \
QCoreApplication::translate((context), source) // NOLINT(cppcoreguidelines-macro-usage)
//---------------------------------------------------------------------------------------------------------------------
auto VPCommandLine::OptionRawLayouts() const -> QStringList
@ -65,7 +67,19 @@ void VPCommandLine::ShowHelp(int exitCode)
parser.showHelp(exitCode);
}
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
auto VPCommandLine::OptionStyle() const -> QString
{
QString value = OptionValue(LONG_OPTION_STYLE);
if (value.isEmpty())
{
return QStringLiteral("native");
}
return value;
}
//----------------------------------------------------------------------------------------------------------------------
VPCommandLine::VPCommandLine()
{
parser.setApplicationDescription(translate("Puzzle", "Valentina's manual layout editor."));
@ -96,7 +110,7 @@ void VPCommandLine::ProcessInstance(VPCommandLinePtr &instance, const QStringLis
//-------------------------------------------------------------------------------------------
void VPCommandLine::InitCommandLineOptions()
{
//keep in mind order here - that is how user will see it, so group-up for usability
// keep in mind order here - that is how user will see it, so group-up for usability
//=================================================================================================================
parser.addOptions({
{{SINGLE_OPTION_RAW_LAYOUT, LONG_OPTION_RAW_LAYOUT},
@ -106,6 +120,7 @@ void VPCommandLine::InitCommandLineOptions()
translate("VCommandLine", "Disable high dpi scaling. Call this option if has problem with scaling (by default "
"scaling enabled). Alternatively you can use the %1 environment variable.")
.arg(QStringLiteral("QT_AUTO_SCREEN_SCALE_FACTOR=0"))},
{LONG_OPTION_STYLE, tr("Application style") + QString(" `Fusion`, `Windows`, `native`, ..."), "", "native"},
});
}
@ -126,5 +141,3 @@ auto VPCommandLine::OptionValues(const QString &option) const -> QStringList
{
return parser.values(option);
}

View File

@ -65,6 +65,8 @@ public:
Q_NORETURN void ShowHelp(int exitCode = 0);
auto OptionStyle() const -> QString;
protected:
VPCommandLine();

View File

@ -31,6 +31,7 @@
const QString LONG_OPTION_RAW_LAYOUT = QStringLiteral("rawLayout"); // NOLINT
const QString SINGLE_OPTION_RAW_LAYOUT = QStringLiteral("r"); // NOLINT
const QString LONG_OPTION_STYLE = QStringLiteral("style"); // NOLINT
//---------------------------------------------------------------------------------------------------------------------
/**
@ -39,9 +40,5 @@ const QString SINGLE_OPTION_RAW_LAYOUT = QStringLiteral("r"); // NOLINT
*/
auto AllKeys() -> QStringList
{
return
{
LONG_OPTION_RAW_LAYOUT,
SINGLE_OPTION_RAW_LAYOUT
};
return {LONG_OPTION_RAW_LAYOUT, SINGLE_OPTION_RAW_LAYOUT, LONG_OPTION_STYLE};
}

View File

@ -28,12 +28,14 @@
#ifndef VPCOMMANDS_H
#define VPCOMMANDS_H
#include <QString>
extern const QString LONG_OPTION_RAW_LAYOUT;
extern const QString SINGLE_OPTION_RAW_LAYOUT;
extern const QString LONG_OPTION_STYLE;
extern const QString LONG_OPTION_STYLESHEET;
auto AllKeys() -> QStringList;
#endif // VPCOMMANDS_H

View File

@ -36,6 +36,7 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../qmuparser/qmudef.h"
#include "../vganalytics/vganalytics.h"
#include "../vmisc/theme/vtheme.h"
//---------------------------------------------------------------------------------------------------------------------
TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *parent)
@ -57,7 +58,12 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
ui->osOptionCheck->setChecked(settings->GetOsSeparator());
// Theme
ui->darkModeCheck->setChecked(settings->GetDarkMode());
SetThemeModeComboBox();
int index = ui->comboBoxThemeMode->findData(static_cast<int>(settings->GetThemeMode()));
if (index != -1)
{
ui->comboBoxThemeMode->setCurrentIndex(index);
}
// Native dialogs
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
@ -78,7 +84,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
});
// set default pattern making system
int index = ui->systemCombo->findData(settings->GetPMSystemCode());
index = ui->systemCombo->findData(settings->GetPMSystemCode());
if (index != -1)
{
ui->systemCombo->setCurrentIndex(index);
@ -113,10 +119,11 @@ auto TapePreferencesConfigurationPage::Apply() -> QStringList
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
if (settings->GetDarkMode() != ui->darkModeCheck->isChecked())
auto themeMode = static_cast<VThemeMode>(ui->comboBoxThemeMode->currentData().toInt());
if (settings->GetThemeMode() != themeMode)
{
settings->SetDarkMode(ui->darkModeCheck->isChecked());
preferences.append(tr("dark mode"));
settings->SetThemeMode(themeMode);
VTheme::Instance()->ResetThemeSettings();
}
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
@ -183,3 +190,12 @@ void TapePreferencesConfigurationPage::RetranslateUi()
ui->systemCombo->setCurrentIndex(ui->systemCombo->findData(code));
}
}
//---------------------------------------------------------------------------------------------------------------------
void TapePreferencesConfigurationPage::SetThemeModeComboBox()
{
ui->comboBoxThemeMode->clear();
ui->comboBoxThemeMode->addItem(tr("System", "theme"), static_cast<int>(VThemeMode::System));
ui->comboBoxThemeMode->addItem(tr("Dark", "theme"), static_cast<int>(VThemeMode::Dark));
ui->comboBoxThemeMode->addItem(tr("Light", "theme"), static_cast<int>(VThemeMode::Light));
}

View File

@ -31,6 +31,10 @@
#include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui
{
class TapePreferencesConfigurationPage;
@ -57,6 +61,7 @@ private:
bool m_systemChanged;
void RetranslateUi();
void SetThemeModeComboBox();
};
#endif // TAPEPREFERENCESCONFIGURATIONPAGE_H

View File

@ -46,7 +46,7 @@
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
@ -85,7 +85,7 @@
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
@ -182,12 +182,25 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="darkModeCheck">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Activate dark mode</string>
<string>Theme:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxThemeMode"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
<property name="text">

View File

@ -31,6 +31,10 @@
#include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui
{
class TapePreferencesPathPage;

View File

@ -27,10 +27,10 @@
*************************************************************************/
#include "dialogtapepreferences.h"
#include "ui_dialogtapepreferences.h"
#include "../mapplication.h"
#include "configpages/tapepreferencesconfigurationpage.h"
#include "configpages/tapepreferencespathpage.h"
#include "ui_dialogtapepreferences.h"
#include <QMessageBox>
#include <QPushButton>
@ -38,7 +38,7 @@
//---------------------------------------------------------------------------------------------------------------------
DialogTapePreferences::DialogTapePreferences(QWidget *parent)
:QDialog(parent),
: QDialog(parent),
ui(new Ui::DialogTapePreferences),
m_configurationPage(new TapePreferencesConfigurationPage),
m_pathPage(new TapePreferencesPathPage)
@ -75,8 +75,8 @@ DialogTapePreferences::~DialogTapePreferences()
//---------------------------------------------------------------------------------------------------------------------
void DialogTapePreferences::showEvent(QShowEvent *event)
{
QDialog::showEvent( event );
if ( event->spontaneous() )
QDialog::showEvent(event);
if (event->spontaneous())
{
return;
}
@ -93,7 +93,7 @@ void DialogTapePreferences::showEvent(QShowEvent *event)
resize(sz);
}
m_isInitialized = true;//first show windows are held
m_isInitialized = true; // first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
@ -117,6 +117,24 @@ void DialogTapePreferences::changeEvent(QEvent *event)
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
}
if (event->type() == QEvent::PaletteChange)
{
QStyle *style = QApplication::style();
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
bOk->setIcon(style->standardIcon(QStyle::SP_DialogOkButton));
QPushButton *bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
SCASSERT(bApply != nullptr)
bApply->setIcon(style->standardIcon(QStyle::SP_DialogApplyButton));
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr)
bCancel->setIcon(style->standardIcon(QStyle::SP_DialogCancelButton));
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
@ -131,8 +149,9 @@ void DialogTapePreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
const QString text =
tr("Followed %n option(s) require restart to take effect: %1.", "", static_cast<int>(preferences.size()))
.arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -33,11 +33,11 @@
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
# include "../vmisc/backport/qscopeguard.h"
#include "../vmisc/backport/qscopeguard.h"
#else
# include <QScopeGuard>
#include <QScopeGuard>
#endif
# include "../vmisc/appimage.h"
#include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -49,17 +49,21 @@ auto main(int argc, char *argv[]) -> int
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
/* Fix path to ICU_DATA when run AppImage.*/
char *exe_dir = IcuDataPath("/../share/icu");
auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);});
auto FreeMemory = qScopeGuard([exe_dir] { free(exe_dir); });
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
Q_INIT_RESOURCE(tapeicon); // NOLINT
Q_INIT_RESOURCE(theme); // NOLINT
Q_INIT_RESOURCE(icon); // NOLINT
Q_INIT_RESOURCE(schema); // NOLINT
Q_INIT_RESOURCE(flags); // NOLINT
Q_INIT_RESOURCE(style); // NOLINT
Q_INIT_RESOURCE(breeze); // NOLINT
#if defined(Q_OS_MACX)
Q_INIT_RESOURCE(mac_theme); // NOLINT
#else
Q_INIT_RESOURCE(win_theme); // NOLINT
#endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations NOLINT
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
@ -68,14 +72,14 @@ auto main(int argc, char *argv[]) -> int
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
auto Terminate = qScopeGuard([]() { XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
#ifndef Q_OS_MAC // supports natively
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
InitHighDpiScaling(argc, argv);
VAbstractApplication::InitHighDpiScaling(argc, argv);
#endif
#endif //Q_OS_MAC
#endif // Q_OS_MAC
#ifdef Q_OS_MAC
#if MACOS_LAYER_BACKING_AFFECTED

View File

@ -35,6 +35,8 @@
#include "../vganalytics/def.h"
#include "../vganalytics/vganalytics.h"
#include "../vmisc/projectversion.h"
#include "../vmisc/theme/vapplicationstyle.h"
#include "../vmisc/theme/vtheme.h"
#include "../vmisc/vsysexits.h"
#include "tmainwindow.h"
#include "version.h"
@ -57,6 +59,7 @@
#include <QPointer>
#include <QResource>
#include <QSpacerItem>
#include <QStyleFactory>
#include <QThread>
#include <QTranslator>
#include <iostream>
@ -100,6 +103,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_UNITS, (QChar('u')))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_TEST, (QLatin1String("test"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_STYLE, (QLatin1String("style"))) // NOLINT
QT_WARNING_POP
} // namespace
@ -316,6 +321,7 @@ MApplication::MApplication(int &argc, char **argv)
// The first inside own bundle where info.plist is works fine, but the second,
// when we run inside Valentina's bundle, require direct setting the icon.
setWindowIcon(QIcon(":/tapeicon/64x64/logo.png"));
VTheme::Instance()->StoreDefaultThemeName(QIcon::themeName());
}
//---------------------------------------------------------------------------------------------------------------------
@ -476,16 +482,9 @@ void MApplication::InitOptions()
CheckSystemLocale();
static const char *GENERIC_ICON_TO_CHECK = "document-open";
if (not QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK))
{
// If there is no default working icon theme then we should
// use an icon theme that we provide via a .qrc file
// This case happens under Windows and Mac OS X
// This does not happen under GNOME or KDE
QIcon::setThemeName(QStringLiteral("win.icon.theme"));
}
ActivateDarkMode();
VTheme::SetIconTheme();
VTheme::InitThemeMode();
QResource::registerResource(diagramsPath());
auto *statistic = VGAnalytics::Instance();
@ -503,27 +502,6 @@ void MApplication::InitOptions()
statistic->Enable(settings->IsCollectStatistic());
}
//---------------------------------------------------------------------------------------------------------------------
// Dark mode
void MApplication::ActivateDarkMode()
{
VTapeSettings *settings = TapeSettings();
if (settings->GetDarkMode())
{
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
if (!f.exists())
{
qDebug() << "Unable to set stylesheet, file not found\n";
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll()); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::InitTrVars()
{
@ -710,6 +688,22 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
qCDebug(mApp, "Can't establish connection to the server '%s'", qUtf8Printable(serverName));
StartLocalServer(serverName);
LoadTranslation(TapeSettings()->GetLocale());
QString styleOpt = parser.value(*LONG_OPTION_STYLE);
if (styleOpt.isEmpty())
{
styleOpt = QLatin1String("native");
}
if (styleOpt != QLatin1String("native"))
{
QStyle *style = QStyleFactory::create(styleOpt);
if (style != nullptr)
{
style = new VApplicationStyle(style);
setStyle(style);
}
}
}
const QStringList args = parser.positionalArguments();
@ -822,6 +816,7 @@ void MApplication::InitParserOptions(QCommandLineParser &parser)
tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
"Alternatively you can use the %1 environment variable.")
.arg("QT_AUTO_SCREEN_SCALE_FACTOR=0")},
{*LONG_OPTION_STYLE, tr("Application style") + QString(" `Fusion`, `Windows`, `native`, ..."), "", "native"},
});
}

View File

@ -29,16 +29,20 @@
#ifndef MAPPLICATION_H
#define MAPPLICATION_H
#include "../vpatterndb/vtranslatevars.h"
#include "vtapesettings.h"
#include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/vtranslatevars.h"
#include "dialogs/dialogmdatabase.h"
#include "vtapesettings.h"
class TMainWindow;
class QLocalServer;
class QCommandLineParser;
enum class SocketConnection : bool {Client = false, Server = true};
enum class SocketConnection : bool
{
Client = false,
Server = true
};
class MApplication : public VAbstractApplication
{
@ -48,12 +52,12 @@ public:
MApplication(int &argc, char **argv);
~MApplication() override;
auto notify(QObject * receiver, QEvent * event) -> bool override;
auto notify(QObject *receiver, QEvent *event) -> bool override;
auto IsTestMode() const -> bool;
auto IsAppInGUIMode() const -> bool override;
auto MainWindow() -> TMainWindow *;
auto MainWindows() -> QList<TMainWindow*>;
auto MainWindows() -> QList<TMainWindow *>;
auto NewMainWindow() -> TMainWindow *;
void InitOptions();
@ -62,7 +66,6 @@ public:
void OpenSettings() override;
auto TapeSettings() -> VTapeSettings *;
void ActivateDarkMode();
static auto diagramsPath() -> QString;
@ -90,7 +93,7 @@ private slots:
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(MApplication) // NOLINT
QList<QPointer<TMainWindow> > m_mainWindows{};
QList<QPointer<TMainWindow>> m_mainWindows{};
QLocalServer *m_localServer{nullptr};
VTranslateVars *m_trVars{nullptr};
QPointer<DialogMDataBase> m_dataBase{};
@ -107,7 +110,7 @@ private:
static void ParseDimensionAOption(QCommandLineParser &parser, int &dimensionAValue, bool &flagDimensionA);
static void ParseDimensionBOption(QCommandLineParser &parser, int &dimensionBValue, bool &flagDimensionB);
static void ParseDimensionCOption(QCommandLineParser &parser, int &dimensionCValue, bool &flagDimensionC);
static void ParseUnitsOption(QCommandLineParser &parser, Unit &unit , bool &flagUnits);
static void ParseUnitsOption(QCommandLineParser &parser, Unit &unit, bool &flagUnits);
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -1946,15 +1946,13 @@ void TMainWindow::DeployFormula()
{
ui->plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
// Set icon from theme (internal for Windows system)
ui->pushButtonGrow->setIcon(
QIcon::fromTheme(QStringLiteral("go-next"), QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(m_formulaBaseHeight);
// Set icon from theme (internal for Windows system)
ui->pushButtonGrow->setIcon(
QIcon::fromTheme(QStringLiteral("go-down"), QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down")));
}
// I found that after change size of formula field, it was filed for angle formula, field for formula became black.

View File

@ -39,6 +39,8 @@
#include "../vganalytics/def.h"
#include "../vganalytics/vganalytics.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h"
#include "../vmisc/theme/vapplicationstyle.h"
#include "../vmisc/theme/vtheme.h"
#include "../vmisc/vsysexits.h"
#include "../vmisc/vvalentinasettings.h"
@ -50,12 +52,15 @@
#include <QDir>
#include <QFile>
#include <QIcon>
#include <QLoggingCategory>
#include <QMessageBox>
#include <QProcess>
#include <QStandardPaths>
#include <QStyleFactory>
#include <QTemporaryFile>
#include <QThread>
#include <Qt>
#include <QTimer>
#include <QUuid>
#include <QtDebug>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -378,6 +383,7 @@ VApplication::VApplication(int &argc, char **argv)
setApplicationVersion(APP_VERSION_STR);
// making sure will create new instance...just in case we will ever do 2 objects of VApplication
VCommandLine::Reset();
VTheme::Instance()->StoreDefaultThemeName(QIcon::themeName());
}
//---------------------------------------------------------------------------------------------------------------------
@ -523,26 +529,6 @@ auto VApplication::notify(QObject *receiver, QEvent *event) -> bool
return false;
}
//---------------------------------------------------------------------------------------------------------------------
void VApplication::ActivateDarkMode()
{
VValentinaSettings *settings = ValentinaSettings();
if (settings->GetDarkMode())
{
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
if (!f.exists())
{
qDebug() << "Unable to set stylesheet, file not found\n";
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll()); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
}
}
}
//---------------------------------------------------------------------------------------------------------------------
auto VApplication::TapeFilePath() -> QString
{
@ -696,18 +682,21 @@ void VApplication::InitOptions()
if (VApplication::IsGUIMode()) // By default console version uses system locale
{
LoadTranslation(ValentinaSettings()->GetLocale());
}
static const char *GENERIC_ICON_TO_CHECK = "document-open";
if (not QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK))
VTheme::SetIconTheme();
VTheme::InitThemeMode();
QString styleOpt = VApplication::CommandLine()->OptStyle();
if (styleOpt != QLatin1String("native"))
{
// If there is no default working icon theme then we should
// use an icon theme that we provide via a .qrc file
// This case happens under Windows and Mac OS X
// This does not happen under GNOME or KDE
QIcon::setThemeName(QStringLiteral("win.icon.theme"));
QStyle *style = QStyleFactory::create(styleOpt);
if (style != nullptr)
{
style = new VApplicationStyle(style);
setStyle(style);
}
}
}
ActivateDarkMode();
auto *statistic = VGAnalytics::Instance();
QString clientID = settings->GetClientID();

View File

@ -30,11 +30,11 @@
#define VAPPLICATION_H
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vlockguard.h"
#include "../vpatterndb/vtranslatevars.h"
#include "vcmdexport.h"
#include "../vmisc/vlockguard.h"
class VApplication;// use in define
class VApplication; // use in define
/**
* @brief The VApplication class reimplamentation QApplication class.
@ -42,12 +42,13 @@ class VApplication;// use in define
class VApplication : public VAbstractValApplication
{
Q_OBJECT // NOLINT
public:
VApplication(int &argc, char ** argv);
VApplication(int &argc, char **argv);
~VApplication() override;
static void NewValentina(const QString &fileName = QString());
auto notify(QObject * receiver, QEvent * event) -> bool override;
auto notify(QObject *receiver, QEvent *event) -> bool override;
void InitOptions();
@ -62,7 +63,6 @@ public:
static auto LabelLanguages() -> QStringList;
void StartLogging();
void ActivateDarkMode();
auto LogFile() -> QTextStream *;
auto TrVars() -> const VTranslateVars * override;

View File

@ -30,11 +30,11 @@
#include "../dialogs/dialoglayoutsettings.h"
#include "../dialogs/dialogsavelayout.h"
#include "../ifc/xml/vdomdocument.h"
#include "../vlayout/vlayoutgenerator.h"
#include "../vmisc/commandoptions.h"
#include "../vmisc/dialogs/dialogexporttocsv.h"
#include "../vmisc/vsysexits.h"
#include "../vmisc/vvalentinasettings.h"
#include "../vmisc/dialogs/dialogexporttocsv.h"
#include "../vlayout/vlayoutgenerator.h"
#include <QDebug>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -45,7 +45,8 @@
VCommandLinePtr VCommandLine::instance = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
#define translate(context, source) QCoreApplication::translate((context), (source)) // NOLINT(cppcoreguidelines-macro-usage)
#define translate(context, source) \
QCoreApplication::translate((context), (source)) // NOLINT(cppcoreguidelines-macro-usage)
namespace
{
@ -56,7 +57,7 @@ auto Lo2Px(const QString &src, const DialogLayoutSettings &converter, bool *ok)
}
//---------------------------------------------------------------------------------------------------------------------
auto Pg2Px(const QString& src, const DialogLayoutSettings& converter, bool *ok) -> qreal
auto Pg2Px(const QString &src, const DialogLayoutSettings &converter, bool *ok) -> qreal
{
return converter.PageToPixels(src.toDouble(ok));
}
@ -87,7 +88,7 @@ auto VCommandLine::FormatSize(const QString &key) const -> VAbstractLayoutDialog
//---------------------------------------------------------------------------------------------------------------------
auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
{
//this functions covers all options found into layout setup dialog, nothing to add here, unless dialog extended
// this functions covers all options found into layout setup dialog, nothing to add here, unless dialog extended
VLayoutGeneratorPtr res(new VLayoutGenerator());
DialogLayoutSettings diag(res.get(), nullptr, true);
@ -100,16 +101,16 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
if (!diag.SelectTemplate(OptPaperSize()))
{
qCritical() << translate("VCommandLine", "Unknown page templated selected.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
if (IsOptionSet(LONG_OPTION_PAGEH))
{ //at this point we already sure 3 are set or none
{ // at this point we already sure 3 are set or none
if (!diag.SelectPaperUnit(OptionValue(LONG_OPTION_PAGEUNITS)))
{
qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
bool ok = false;
@ -117,7 +118,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid page height value.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
diag.SetPaperHeight(height);
@ -126,7 +127,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid page width value.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
diag.SetPaperWidth(width);
}
@ -143,7 +144,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
if (!diag.SelectLayoutUnit(OptionValue(LONG_OPTION_SHIFTUNITS)))
{
qCritical() << translate("VCommandLine", "Unsupported layout units.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
}
@ -154,7 +155,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid gap width.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
diag.SetLayoutWidth(width);
}
@ -184,7 +185,7 @@ auto VCommandLine::DefaultGenerator() const -> VLayoutGeneratorPtr
}
//---------------------------------------------------------------------------------------------------------------------
auto VCommandLine::Get(const QCoreApplication& app) -> VCommandLinePtr
auto VCommandLine::Get(const QCoreApplication &app) -> VCommandLinePtr
{
if (instance == nullptr)
{
@ -192,10 +193,9 @@ auto VCommandLine::Get(const QCoreApplication& app) -> VCommandLinePtr
}
instance->parser.process(app);
//fixme: in case of additional options/modes which will need to disable GUI - add it here too
instance->isGuiEnabled = not (instance->IsExportEnabled()
|| instance->IsTestModeEnabled()
|| instance->IsExportFMEnabled());
// fixme: in case of additional options/modes which will need to disable GUI - add it here too
instance->isGuiEnabled =
not(instance->IsExportEnabled() || instance->IsTestModeEnabled() || instance->IsExportFMEnabled());
return instance;
}
@ -213,7 +213,7 @@ auto VCommandLine::IsTestModeEnabled() const -> bool
if (r && parser.positionalArguments().size() != 1)
{
qCritical() << translate("VCommandLine", "Test option can be used with single input file only.") << "/n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
return r;
}
@ -238,7 +238,7 @@ auto VCommandLine::IsExportEnabled() const -> bool
if (r && parser.positionalArguments().size() != 1)
{
qCritical() << translate("VCommandLine", "Export options can be used with single input file only.") << "/n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
return r;
}
@ -250,7 +250,7 @@ auto VCommandLine::IsExportFMEnabled() const -> bool
if (r && parser.positionalArguments().size() != 1)
{
qCritical() << translate("VCommandLine", "Export options can be used with single input file only.") << "/n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
return r;
}
@ -265,7 +265,7 @@ auto VCommandLine::OptPaperSize() const -> VAbstractLayoutDialog::PaperSizeTempl
auto VCommandLine::OptGroup() const -> Cases
{
int r = OptionValue(LONG_OPTION_GROUPPING).toInt();
if ( r < 0 || r >= static_cast<int>(Cases::UnknownCase))
if (r < 0 || r >= static_cast<int>(Cases::UnknownCase))
{
r = 0;
}
@ -276,10 +276,9 @@ auto VCommandLine::OptGroup() const -> Cases
auto VCommandLine::OptMeasurePath() const -> QString
{
QString measure;
if (IsOptionSet(LONG_OPTION_MEASUREFILE)
&& (IsExportEnabled() || IsTestModeEnabled()))
//todo: don't want yet to allow user set measure file for general loading,
//because need to fix multiply opened windows as well
if (IsOptionSet(LONG_OPTION_MEASUREFILE) && (IsExportEnabled() || IsTestModeEnabled()))
// todo: don't want yet to allow user set measure file for general loading,
// because need to fix multiply opened windows as well
{
measure = OptionValue(LONG_OPTION_MEASUREFILE);
}
@ -410,14 +409,14 @@ auto VCommandLine::OptUserMaterials() const -> QMap<int, QString>
{
QMap<int, QString> userMaterials;
const QStringList values = OptionValues(LONG_OPTION_USER_MATERIAL);
for(const auto &value : values)
for (const auto &value : values)
{
const QStringList parts = value.split('@');
if (parts.size() != 2)
{
qCritical() << translate("VCommandLine", "Invalid user material '%1'. Separator is missing.").arg(value)
<< "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
bool ok = false;
@ -427,7 +426,7 @@ auto VCommandLine::OptUserMaterials() const -> QMap<int, QString>
{
qCritical() << translate("VCommandLine", "Invalid user material '%1'. Wrong material number.").arg(value)
<< "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
userMaterials.insert(number, ConstLast<QString>(parts));
@ -473,13 +472,13 @@ auto VCommandLine::OptDimensionA() const -> int
bool ok = false;
int dimensionAValue = value.toInt(&ok);
if(ok && dimensionAValue > 0)
if (ok && dimensionAValue > 0)
{
return dimensionAValue;
}
qCritical() << translate("VCommandLine", "Invalid dimension A value.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
//---------------------------------------------------------------------------------------------------------------------
@ -489,13 +488,13 @@ auto VCommandLine::OptDimensionB() const -> int
bool ok = false;
int dimensionBValue = value.toInt(&ok);
if(ok && dimensionBValue > 0)
if (ok && dimensionBValue > 0)
{
return dimensionBValue;
}
qCritical() << translate("VCommandLine", "Invalid dimension B value.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
//---------------------------------------------------------------------------------------------------------------------
@ -505,13 +504,13 @@ auto VCommandLine::OptDimensionC() const -> int
bool ok = false;
int dimensionCValue = value.toInt(&ok);
if(ok && dimensionCValue > 0)
if (ok && dimensionCValue > 0)
{
return dimensionCValue;
}
qCritical() << translate("VCommandLine", "Invalid dimension C value.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
//---------------------------------------------------------------------------------------------------------------------
@ -528,7 +527,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (not supportedUnits.contains(value))
{
qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
unit = StrToUnits(value);
}
@ -540,7 +539,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page left margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setLeft(margin);
}
@ -552,7 +551,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page right margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setLeft(margin);
}
@ -564,7 +563,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page top margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setLeft(margin);
}
@ -576,7 +575,7 @@ auto VCommandLine::TiledPageMargins() const -> QMarginsF
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid tiled page bottom margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setLeft(margin);
}
@ -597,10 +596,22 @@ auto VCommandLine::OptTiledPageOrientation() const -> PageOrientation
}
//---------------------------------------------------------------------------------------------------------------------
auto VCommandLine::OptStyle() const -> QString
{
QString style = OptionValue(LONG_OPTION_STYLE);
if (style.isEmpty())
{
return QStringLiteral("native");
}
return style;
}
//----------------------------------------------------------------------------------------------------------------------
void VCommandLine::InitCommandLineOptions()
{
//keep in mind order here - that is how user will see it, so group-up for usability
//=================================================================================================================
// keep in mind order here - that is how user will see it, so group-up for usability
//==================================================================================================================
parser.addOptions({
{{SINGLE_OPTION_BASENAME, LONG_OPTION_BASENAME},
translate("VCommandLine", "The base filename of exported layout files. Use it to enable console export mode."),
@ -618,22 +629,25 @@ void VCommandLine::InitCommandLineOptions()
translate("VCommandLine", "Time")},
{LONG_OPTION_EFFICIENCY_COEFFICIENT,
translate("VCommandLine", "Set layout efficiency <coefficient>. Layout efficiency coefficient is the ratio of "
"the area occupied by the pieces to the bounding rect of all pieces. If nesting reaches required level the "
"process stops. If value is 0 no check will be made. Coefficient must be in range from 0 to 100. Default "
"the area occupied by the pieces to the bounding rect of all pieces. If nesting "
"reaches required level "
"the "
"process stops. If value is 0 no check will be made. Coefficient must be in range "
"from 0 to 100. Default "
"value 0."),
translate("VCommandLine", "Coefficient")},
{{SINGLE_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT},
translate("VCommandLine", "Number corresponding to output format (default = 0, export mode):") +
DialogSaveLayout::MakeHelpFormatList(),
translate("VCommandLine", "Format number"), QChar('0')},
translate("VCommandLine", "Format number"),
QChar('0')},
{LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
{LONG_OPTION_NOGRAINLINE, translate("VCommandLine", "Show/hide grainline when export layout.")},
{LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
{LONG_OPTION_EXPORTONLYDETAILS,
translate("VCommandLine", "Export only details. Export details as they positioned in the details mode. Any "
"layout related options will be ignored.")},
{LONG_OPTION_EXPORTSUCHDETAILS,
translate("VCommandLine", "Export only details that match a piece name regex."),
{LONG_OPTION_EXPORTSUCHDETAILS, translate("VCommandLine", "Export only details that match a piece name regex."),
translate("VCommandLine", "The name regex")},
{LONG_OPTION_DIMENSION_A,
@ -650,14 +664,18 @@ void VCommandLine::InitCommandLineOptions()
{LONG_OPTION_USER_MATERIAL,
translate("VCommandLine", "Use this option to override user material defined in pattern. The value must be in "
"form <number>@<user matrial name>. The number should be in range from 1 to %1. For example, 1@Fabric2. The "
"key can be used multiple times. Has no effect in GUI mode.").arg(userMaterialPlaceholdersQuantity),
"form <number>@<user matrial name>. The number should be in range from 1 to %1. For "
"example, "
"1@Fabric2. The "
"key can be used multiple times. Has no effect in GUI mode.")
.arg(userMaterialPlaceholdersQuantity),
translate("VCommandLine", "User material")},
//=================================================================================================================
//==============================================================================================================
{{SINGLE_OPTION_PAGETEMPLATE, LONG_OPTION_PAGETEMPLATE},
translate("VCommandLine", "Number corresponding to layout page template (default = 0, export mode):") +
DialogLayoutSettings::MakeHelpTemplateList(),
translate("VCommandLine", "Template number"), QChar('0')},
translate("VCommandLine", "Template number"),
QChar('0')},
{LONG_OPTION_LANDSCAPE_ORIENTATION,
translate("VCommandLine", "Switch page template orientation to landscape (export mode). This option has "
"effect only for one of predefined page templates.")},
@ -698,26 +716,25 @@ void VCommandLine::InitCommandLineOptions()
{LONG_OPTION_EXPYSCALE,
translate("VCommandLine", "Set vertical scale factor from 0.01 to 3.0 (default = 1.0, export mode)."),
translate("VCommandLine", "Vertical scale")},
//=================================================================================================================
//==============================================================================================================
{LONG_OPTION_FOLLOW_GRAINLINE,
translate("VCommandLine", "Order detail to follow grainline direction (export mode).")},
{LONG_OPTION_MANUAL_PRIORITY,
translate("VCommandLine", "Follow manual priority over priority by square (export mode).")},
{LONG_OPTION_NEST_QUANTITY,
translate("VCommandLine", "Nest quantity copies of each piece (export mode).")},
{LONG_OPTION_NEST_QUANTITY, translate("VCommandLine", "Nest quantity copies of each piece (export mode).")},
{{SINGLE_OPTION_CROP_LENGTH, LONG_OPTION_CROP_LENGTH},
translate("VCommandLine", "Auto crop unused length (export mode).")},
{LONG_OPTION_CROP_WIDTH,
translate("VCommandLine", "Auto crop unused width (export mode).")},
{LONG_OPTION_CROP_WIDTH, translate("VCommandLine", "Auto crop unused width (export mode).")},
{{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE},
translate("VCommandLine", "Unite pages if possible (export mode). Maximum value limited by QImage that "
"supports only a maximum of 32768x32768 px images.")},
{LONG_OPTION_PREFER_ONE_SHEET_SOLUTION,
translate("VCommandLine", "Prefer one sheet layout solution (export mode).")},
//=================================================================================================================
//==============================================================================================================
{{SINGLE_OPTION_SAVELENGTH, LONG_OPTION_SAVELENGTH},
translate("VCommandLine", "Save length of the sheet if set (export mode). The option tells the program to use "
"as much as possible width of sheet. Quality of a layout can be worse when this option was used.")},
"as much as possible width of sheet. Quality of a layout can be worse when this "
"option was used.")},
{{SINGLE_OPTION_SHIFTUNITS, LONG_OPTION_SHIFTUNITS},
translate("VCommandLine", "Layout units (as paper's one except px, export mode). Default units cm."),
translate("VCommandLine", "The unit")},
@ -728,43 +745,56 @@ void VCommandLine::InitCommandLineOptions()
{{SINGLE_OPTION_GROUPPING, LONG_OPTION_GROUPPING},
translate("VCommandLine", "Sets layout groupping cases (export mode): %1.")
.arg(DialogLayoutSettings::MakeGroupsHelp()),
translate("VCommandLine", "Grouping type"), QChar('2')},
translate("VCommandLine", "Grouping type"),
QChar('2')},
{{SINGLE_OPTION_TEST, LONG_OPTION_TEST},
translate("VCommandLine", "Run the program in a test mode. The program in this mode loads a single pattern "
"file and silently quit without showing the main window. The key have priority before key '%1'.")
"file and silently quit without showing the main window. The key have priority "
"before key '%1'.")
.arg(LONG_OPTION_BASENAME)},
{LONG_OPTION_PENDANTIC,
translate("VCommandLine", "Make all parsing warnings into errors. Have effect only in console mode. Use to "
translate("VCommandLine",
"Make all parsing warnings into errors. Have effect only in console mode. Use to "
"force Valentina to immediately terminate if a pattern contains a parsing warning.")},
{LONG_OPTION_NO_HDPI_SCALING,
translate("VCommandLine", "Disable high dpi scaling. Call this option if has problem with scaling (by default "
"scaling enabled). Alternatively you can use the %1 environment variable.")
.arg(QStringLiteral("QT_AUTO_SCREEN_SCALE_FACTOR=0"))},
//=================================================================================================================
{LONG_OPTION_CSVWITHHEADER,
translate("VCommandLine", "Export to csv with header. By default disabled.")},
//==============================================================================================================
{LONG_OPTION_CSVWITHHEADER, translate("VCommandLine", "Export to csv with header. By default disabled.")},
{LONG_OPTION_CSVCODEC,
translate("VCommandLine", "Specify codec that will be used to save data. List of supported codecs provided by "
"Qt. Default value depend from system. On Windows, the codec will be based on a system locale. On Unix "
"systems, the codec will might fall back to using the iconv library if no builtin codec for the locale can be "
"found. Valid values for this installation:") + DialogExportToCSV::MakeHelpCodecsList(),
"Qt. Default value depend from system. On Windows, the codec will be based on a "
"system locale. On Unix "
"systems, the codec will might fall back to using the iconv library if no builtin "
"codec for the locale "
"can be "
"found. Valid values for this installation:") +
DialogExportToCSV::MakeHelpCodecsList(),
translate("VCommandLine", "Codec name"), QString(VTextCodec::codecForLocale()->name())},
{LONG_OPTION_CSVSEPARATOR,
translate("VCommandLine", "Specify csv separator character. Default value is '%1'. Valid characters:")
.arg(VCommonSettings::GetDefCSVSeparator()) + DialogExportToCSV::MakeHelpSeparatorList(),
.arg(VCommonSettings::GetDefCSVSeparator()) +
DialogExportToCSV::MakeHelpSeparatorList(),
translate("VCommandLine", "Separator character"), QString(VCommonSettings::GetDefCSVSeparator())},
{LONG_OPTION_CSVEXPORTFM,
translate("VCommandLine", "Calling this command enable exporting final measurements. Specify path to csv file "
"with final measurements. The path must contain path to directory and name of file. It can be absolute or "
"relatetive. In case of relative path will be used current working directory to calc a destination path."),
translate("VCommandLine",
"Calling this command enable exporting final measurements. Specify path to csv file "
"with final measurements. The path must contain path to directory and name of file. "
"It can be "
"absolute or "
"relatetive. In case of relative path will be used current working directory to calc "
"a destination "
"path."),
translate("VCommandLine", "Path to csv file")},
//=================================================================================================================
//==============================================================================================================
{LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
translate("VCommandLine", "Number corresponding to tiled pdf page template (default = 0, export mode with "
"tiled pdf format):") + DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
"tiled pdf format):") +
DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
translate("VCommandLine", "Template number"), QChar('0')},
{LONG_OPTION_TILED_PDF_LEFT_MARGIN,
translate("VCommandLine","Tiled page left margin in current units like 3.0 (export mode). If not set will be "
translate("VCommandLine", "Tiled page left margin in current units like 3.0 (export mode). If not set will be "
"used default value 1 cm."),
translate("VCommandLine", "The left margin")},
{LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
@ -781,7 +811,10 @@ void VCommandLine::InitCommandLineOptions()
translate("VCommandLine", "The bottom margin")},
{LONG_OPTION_TILED_PDF_LANDSCAPE,
translate("VCommandLine", "Set tiled page orienatation to landscape (export mode). Default value if not set "
"portrait.")}
"portrait.")},
//==============================================================================================================
{LONG_OPTION_STYLE,
translate("VCommandLine", "Application style") + QString(" `Fusion`, `Windows`, `native`, ..."), "", "native"},
});
}
@ -814,9 +847,8 @@ auto VCommandLine::OptNestingTime() const -> int
if (not ok || time < 1 || time > 60)
{
qCritical() << translate("VCommandLine", "Time must be in range from 1 minute to 60 minutes.")
<< "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
qCritical() << translate("VCommandLine", "Time must be in range from 1 minute to 60 minutes.") << "\n";
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
}
@ -834,9 +866,8 @@ auto VCommandLine::OptEfficiencyCoefficient() const -> qreal
if (not ok || coefficient < 0 || coefficient > 100)
{
qCritical() << translate("VCommandLine", "Coefficient must be in range from 0 to 100.")
<< "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
qCritical() << translate("VCommandLine", "Coefficient must be in range from 0 to 100.") << "\n";
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
}
@ -854,15 +885,14 @@ void VCommandLine::TestPageformat() const
if ((a || b) && x)
{
qCritical() << translate("VCommandLine", "Cannot use pageformat and page explicit size together.")
<< "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
qCritical() << translate("VCommandLine", "Cannot use pageformat and page explicit size together.") << "\n";
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
if ((a || b || c) && !(a && b && c))
{
qCritical() << translate("VCommandLine", "Page height, width, units must be used all 3 at once.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
}
@ -875,7 +905,7 @@ void VCommandLine::TestGapWidth() const
if ((a || b) && !(a && b))
{
qCritical() << translate("VCommandLine", "Gap width must be used together with shift units.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
}
@ -890,7 +920,7 @@ void VCommandLine::TestMargins() const
if (a && !(a && b))
{
qCritical() << message << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
};
@ -931,7 +961,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page left margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setLeft(margin);
}
@ -943,7 +973,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page right margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setRight(margin);
}
@ -955,7 +985,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page top margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setTop(margin);
}
@ -967,7 +997,7 @@ auto VCommandLine::ParseMargins(const DialogLayoutSettings &diag) const -> QMarg
if (not ok)
{
qCritical() << translate("VCommandLine", "Invalid layout page bottom margin.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
margins.setBottom(margin);
}

View File

@ -29,11 +29,11 @@
#ifndef VCMDEXPORT_H
#define VCMDEXPORT_H
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QTextStream>
#include <memory>
#include <vector>
#include <QTextStream>
#include <QCoreApplication>
#include <QCommandLineParser>
#include "../dialogs/dialoglayoutsettings.h"
@ -43,7 +43,7 @@ using VLayoutGeneratorPtr = std::shared_ptr<VLayoutGenerator>;
enum class PageOrientation : bool;
//@brief: class used to install export command line options and parse their values
//QCommandLineParser* object must exists until this object alive
// QCommandLineParser* object must exists until this object alive
class VCommandLine
{
public:
@ -52,21 +52,21 @@ public:
//@brief creates object and applies export related options to parser
//@brief tests if user enabled test mode from cmd, throws exception if not exactly 1 input VAL file supplied in
//case test mode enabled
// case test mode enabled
auto IsTestModeEnabled() const -> bool;
//@brief Make all parsing warnings into errors. Have effect only in console mode. Use to force Valentina to
//immediately terminate if a pattern contains a parsing warning.
// immediately terminate if a pattern contains a parsing warning.
auto IsPedantic() const -> bool;
auto IsNoScalingEnabled() const -> bool;
//@brief tests if user enabled export from cmd, throws exception if not exactly 1 input VAL file supplied in case
//export enabled
// export enabled
auto IsExportEnabled() const -> bool;
//@brief tests if user enabled export final measurements from cmd, throws exception if not exactly 1 input VAL
//file supplied in case export enabled
// file supplied in case export enabled
auto IsExportFMEnabled() const -> bool;
//@brief returns path to custom measure file or empty string
@ -76,7 +76,7 @@ public:
auto OptBaseName() const -> QString;
//@brief returns the absolute path to output destination directory or path to application's current directory if
//not set
// not set
auto OptDestinationPath() const -> QString;
//@brief returns export type set, defaults 0 - svg
@ -106,14 +106,14 @@ public:
//@brief returns list of user defined materials
auto OptUserMaterials() const -> QMap<int, QString>;
//generator creation is moved here ... because most options are for it only, so no need to create extra getters...
// generator creation is moved here ... because most options are for it only, so no need to create extra getters...
//@brief creates VLayoutGenerator
auto DefaultGenerator() const -> VLayoutGeneratorPtr;
//@brief gets filenames which should be loaded
auto OptInputFileNames() const -> QStringList;
auto IsGuiEnabled()const -> bool;
auto IsGuiEnabled() const -> bool;
auto IsSetDimensionA() const -> bool;
auto IsSetDimensionB() const -> bool;
@ -127,8 +127,9 @@ public:
auto OptTiledPaperSize() const -> VAbstractLayoutDialog::PaperSizeTemplate;
auto OptTiledPageOrientation() const -> PageOrientation;
protected:
auto OptStyle() const -> QString;
protected:
VCommandLine();
//@brief returns VAbstractLayoutDialog::PaperSizeTemplate
@ -136,11 +137,12 @@ protected:
auto OptGroup() const -> Cases;
//@brief: called in destructor of application, so instance destroyed and new maybe created (never happen scenario though)
//@brief: called in destructor of application, so instance destroyed and new maybe created (never happen scenario
// though)
static void Reset();
//@brief called to create single object, by VApplication only
static auto Get(const QCoreApplication& app) -> VCommandLinePtr;
static auto Get(const QCoreApplication &app) -> VCommandLinePtr;
private:
Q_DISABLE_COPY_MOVE(VCommandLine) // NOLINT

View File

@ -31,7 +31,9 @@
#include "../vmisc/literals.h"
#include "../vmisc/vvalentinasettings.h"
#include "../vpatterndb/pmsystems.h"
#include "theme/vtheme.h"
#include "ui_preferencesconfigurationpage.h"
#include "vcommonsettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
@ -131,7 +133,12 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
ui->toolBarStyleCheck->setChecked(settings->GetToolBarStyle());
// Theme
ui->darkModeCheck->setChecked(settings->GetDarkMode());
SetThemeModeComboBox();
index = ui->comboBoxThemeMode->findData(static_cast<int>(settings->GetThemeMode()));
if (index != -1)
{
ui->comboBoxThemeMode->setCurrentIndex(index);
}
// Native dialogs
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
@ -187,10 +194,11 @@ auto PreferencesConfigurationPage::Apply() -> QStringList
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
if (settings->GetDarkMode() != ui->darkModeCheck->isChecked())
auto themeMode = static_cast<VThemeMode>(ui->comboBoxThemeMode->currentData().toInt());
if (settings->GetThemeMode() != themeMode)
{
settings->SetDarkMode(ui->darkModeCheck->isChecked());
preferences.append(tr("dark mode"));
settings->SetThemeMode(themeMode);
VTheme::Instance()->ResetThemeSettings();
}
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
@ -279,6 +287,15 @@ void PreferencesConfigurationPage::SetLabelComboBox(const QStringList &list)
}
}
//---------------------------------------------------------------------------------------------------------------------
void PreferencesConfigurationPage::SetThemeModeComboBox()
{
ui->comboBoxThemeMode->clear();
ui->comboBoxThemeMode->addItem(tr("System", "theme"), static_cast<int>(VThemeMode::System));
ui->comboBoxThemeMode->addItem(tr("Dark", "theme"), static_cast<int>(VThemeMode::Dark));
ui->comboBoxThemeMode->addItem(tr("Light", "theme"), static_cast<int>(VThemeMode::Light));
}
//---------------------------------------------------------------------------------------------------------------------
void PreferencesConfigurationPage::InitUnits()
{

View File

@ -40,7 +40,8 @@ class PreferencesConfigurationPage : public QWidget
{
Q_OBJECT // NOLINT
public : explicit PreferencesConfigurationPage(QWidget *parent = nullptr);
public:
explicit PreferencesConfigurationPage(QWidget *parent = nullptr);
~PreferencesConfigurationPage() override;
auto Apply() -> QStringList;
@ -59,6 +60,7 @@ private:
bool m_labelLangChanged{false};
void SetLabelComboBox(const QStringList &list);
void SetThemeModeComboBox();
void InitUnits();
void RetranslateUi();
};

View File

@ -33,9 +33,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-70</y>
<width>624</width>
<height>869</height>
<height>873</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -91,7 +91,7 @@
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
@ -101,7 +101,14 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="langCombo"/>
<widget class="QComboBox" name="langCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
@ -160,7 +167,7 @@
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
@ -287,15 +294,29 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QCheckBox" name="darkModeCheck">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>Activate dark mode</string>
</property>
<property name="checked">
<bool>true</bool>
<string>Theme:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxThemeMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
<property name="text">
@ -346,7 +367,7 @@
</property>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
@ -410,7 +431,7 @@
</property>
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
@ -474,7 +495,7 @@
</property>
<layout class="QFormLayout" name="formLayout_5">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_13">

View File

@ -138,7 +138,10 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
InitSingleLineFonts();
const qint32 indexFont = ui->comboBoxSingleLineFont->findData(settings->GetLabelSVGFont());
if (indexFont != -1)
{
ui->comboBoxSingleLineFont->setCurrentIndex(indexFont);
}
ui->checkBoxSingleStrokeOutlineFont->setChecked(settings->GetSingleStrokeOutlineFont());
ui->checkBoxSingleLineFonts->setChecked(settings->GetSingleLineFonts());
@ -252,6 +255,18 @@ void PreferencesPatternPage::changeEvent(QEvent *event)
RetranslateUi();
ui->retranslateUi(this);
}
if (event->type() == QEvent::PaletteChange)
{
QString currentSingleLineFont = ui->comboBoxSingleLineFont->currentData().toString();
InitSingleLineFonts();
const qint32 indexFont = ui->comboBoxSingleLineFont->findData(currentSingleLineFont);
if (indexFont != -1)
{
ui->comboBoxSingleLineFont->setCurrentIndex(indexFont);
}
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
@ -344,6 +359,7 @@ void PreferencesPatternPage::InitSingleLineFonts()
ui->comboBoxSingleLineFont->setIconSize(QSize(previewScaledWidthPixels, previewScaledHeightPixels));
QPen pen(Qt::SolidPattern, 1 * scale, Qt::SolidLine, Qt::RoundCap, Qt::SvgMiterJoin);
pen.setColor(ui->comboBoxSingleLineFont->palette().color(QPalette::Text));
VSvgFontDatabase *db = VAbstractApplication::VApp()->SVGFontDatabase();
QStringList families = db->Families();
@ -362,7 +378,7 @@ void PreferencesPatternPage::InitSingleLineFonts()
engine.SetFontPixelSize(previewScaledHeightPixels);
QPixmap pixmap(previewScaledWidthPixels, previewScaledHeightPixels);
pixmap.fill(Qt::white);
pixmap.fill(ui->comboBoxSingleLineFont->palette().color(QPalette::Base));
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(pen);

View File

@ -23,7 +23,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-62</y>
<width>519</width>
<height>1021</height>
</rect>
@ -61,7 +61,7 @@ This option will take an affect after restart.</string>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -73,6 +73,12 @@ This option will take an affect after restart.</string>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurveApproximation">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Set default curve approximation scale</string>
</property>
@ -90,19 +96,6 @@ This option will take an affect after restart.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -146,19 +139,6 @@ This option will take an affect after restart.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -294,6 +274,12 @@ This option will take an affect after restart.</string>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size:</string>
</property>
@ -302,25 +288,18 @@ This option will take an affect after restart.</string>
<item>
<widget class="QComboBox" name="comboBoxLabelFontSize"/>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Outline font:</string>
</property>
@ -329,25 +308,18 @@ This option will take an affect after restart.</string>
<item>
<widget class="QFontComboBox" name="fontComboBoxLabelFont"/>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Single-line font:</string>
</property>
@ -360,19 +332,6 @@ This option will take an affect after restart.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>

View File

@ -27,13 +27,13 @@
*************************************************************************/
#include "dialogfinalmeasurements.h"
#include "ui_dialogfinalmeasurements.h"
#include "../vmisc/vvalentinasettings.h"
#include "../qmuparser/qmudef.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../qmuparser/qmudef.h"
#include "../vmisc/vvalentinasettings.h"
#include "../vpatterndb/calculator.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
#include "ui_dialogfinalmeasurements.h"
#include <QMenu>
#include <qnumeric.h>
@ -75,7 +75,7 @@ DialogFinalMeasurements::DialogFinalMeasurements(VPattern *doc, QWidget *parent)
connect(m_doc, &VPattern::FullUpdateFromFile, this, &DialogFinalMeasurements::FullUpdateFromFile);
ui->lineEditName->setValidator(
new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^$|")+NameRegExp()), this));
new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^$|") + NameRegExp()), this));
connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, this,
&DialogFinalMeasurements::ShowFinalMeasurementDetails);
@ -162,14 +162,14 @@ auto DialogFinalMeasurements::eventFilter(QObject *object, QEvent *event) -> boo
// pass the event on to the parent class
return QDialog::eventFilter(object, event);
}
return false;// pass the event to the widget // clazy:exclude=base-class-event
return false; // pass the event to the widget // clazy:exclude=base-class-event
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::showEvent(QShowEvent *event)
{
QDialog::showEvent(event);
if ( event->spontaneous() )
if (event->spontaneous())
{
return;
}
@ -186,7 +186,7 @@ void DialogFinalMeasurements::showEvent(QShowEvent *event)
resize(sz);
}
m_isInitialized = true;//first show windows are held
m_isInitialized = true; // first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
@ -237,7 +237,7 @@ void DialogFinalMeasurements::ShowFinalMeasurementDetails()
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::Add()
{
const int currentRow = ui->tableWidget->currentRow()+1;
const int currentRow = ui->tableWidget->currentRow() + 1;
VFinalMeasurement m;
m.name = tr("measurement");
@ -285,10 +285,10 @@ void DialogFinalMeasurements::MoveUp()
return;
}
Move(m_measurements, row, row-1);
Move(m_measurements, row, row - 1);
UpdateTree();
ui->tableWidget->selectRow(row-1);
ui->tableWidget->selectRow(row - 1);
ui->tableWidget->repaint(); // Force repain to fix paint artifacts on Mac OS X
}
@ -297,15 +297,15 @@ void DialogFinalMeasurements::MoveDown()
{
const int row = ui->tableWidget->currentRow();
if (row == -1 || row == ui->tableWidget->rowCount()-1 || row >= m_measurements.size())
if (row == -1 || row == ui->tableWidget->rowCount() - 1 || row >= m_measurements.size())
{
return;
}
Move(m_measurements, row, row+1);
Move(m_measurements, row, row + 1);
UpdateTree();
ui->tableWidget->selectRow(row+1);
ui->tableWidget->selectRow(row + 1);
ui->tableWidget->repaint(); // Force repain to fix paint artifacts on Mac OS X
}
@ -367,15 +367,15 @@ void DialogFinalMeasurements::SaveFormula()
if (formulaField->text() == text)
{
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
// Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) + postfix);
return;
}
if (text.isEmpty())
{
//Show unit in dialog lable (cm, mm or inch)
// Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
return;
@ -388,8 +388,8 @@ void DialogFinalMeasurements::SaveFormula()
try
{
m_measurements[row].formula = VAbstractApplication::VApp()->TrVars()
->FormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
m_measurements[row].formula = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
catch (qmu::QmuParserError &e) // Just in case something bad will happen
{
@ -415,16 +415,14 @@ void DialogFinalMeasurements::DeployFormula()
if (ui->plainTextEditFormula->height() < DIALOG_MAX_FORMULA_HEIGHT)
{
ui->plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next"),
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
// Set icon from theme (internal for Windows system)
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
}
else
{
ui->plainTextEditFormula->setFixedHeight(formulaBaseHeight);
//Set icon from theme (internal for Windows system)
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down"),
QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
// Set icon from theme (internal for Windows system)
ui->pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down")));
}
// I found that after change size of formula field, it was filed for angle formula, field for formula became black.
@ -453,7 +451,7 @@ void DialogFinalMeasurements::Fx()
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
dialog->ShowPieceArea(true);
const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
dialog->setPostfix(postfix); // Show unit in dialog lable (cm, mm or inch)
if (dialog->exec() == QDialog::Accepted)
{
@ -484,7 +482,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(static_cast<int>(m_measurements.size()));
for (int i=0; i < m_measurements.size(); ++i)
for (int i = 0; i < m_measurements.size(); ++i)
{
const VFinalMeasurement &m = m_measurements.at(i);
@ -492,14 +490,12 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
bool ok = true;
const qreal result = EvalFormula(m.formula, ok);
AddCell(VAbstractApplication::VApp()
->LocaleToString(result), i, 1, Qt::AlignHCenter | Qt::AlignVCenter, ok); // calculated value
AddCell(VAbstractApplication::VApp()->LocaleToString(result), i, 1, Qt::AlignHCenter | Qt::AlignVCenter,
ok); // calculated value
const QString formula =
VTranslateVars::TryFormulaFromUser(m.formula,
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
VTranslateVars::TryFormulaFromUser(m.formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
AddCell(formula, i, 2, Qt::AlignVCenter); // formula
}
if (freshCall)
@ -556,7 +552,7 @@ void DialogFinalMeasurements::AddCell(const QString &text, int row, int column,
auto DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromUser) -> bool
{
const QString postfix =
UnitsToStr(VAbstractValApplication::VApp()->patternUnits());//Show unit in dialog lable (cm, mm or inch)
UnitsToStr(VAbstractValApplication::VApp()->patternUnits()); // Show unit in dialog lable (cm, mm or inch)
if (formula.isEmpty())
{
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
@ -570,8 +566,8 @@ auto DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
// Replace line return character with spaces for calc if exist
if (fromUser)
{
f = VAbstractApplication::VApp()->TrVars()
->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
f = VAbstractApplication::VApp()->TrVars()->FormulaFromUser(
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
else
{
@ -588,8 +584,8 @@ auto DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
return false;
}
ui->labelCalculatedValue->setText(
VAbstractApplication::VApp()->LocaleToString(result) + QChar(QChar::Space) + postfix);
ui->labelCalculatedValue->setText(VAbstractApplication::VApp()->LocaleToString(result) + QChar(QChar::Space) +
postfix);
ui->labelCalculatedValue->setToolTip(tr("Value"));
return true;
}
@ -614,7 +610,7 @@ void DialogFinalMeasurements::Controls()
ui->toolButtonUp->setEnabled(false);
ui->toolButtonDown->setEnabled(true);
}
else if (ui->tableWidget->currentRow() == ui->tableWidget->rowCount()-1)
else if (ui->tableWidget->currentRow() == ui->tableWidget->rowCount() - 1)
{
ui->toolButtonUp->setEnabled(true);
ui->toolButtonDown->setEnabled(false);
@ -731,29 +727,35 @@ void DialogFinalMeasurements::InitSearch()
UpdateSearchControlsTooltips();
connect(ui->lineEditFind, &QLineEdit::textEdited, this, [this](const QString &term){m_search->Find(term);});
connect(ui->lineEditFind, &QLineEdit::editingFinished, this, [this]()
connect(ui->lineEditFind, &QLineEdit::textEdited, this, [this](const QString &term) { m_search->Find(term); });
connect(ui->lineEditFind, &QLineEdit::editingFinished, this,
[this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->Find(ui->lineEditFind->text());
});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this]()
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this,
[this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->FindPrevious();
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
});
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this]()
connect(ui->toolButtonFindNext, &QToolButton::clicked, this,
[this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->FindNext();
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
});
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
connect(m_search.data(), &VTableSearch::HasResult, this,
[this](bool state)
{
ui->toolButtonFindPrevious->setEnabled(state);
ui->toolButtonFindNext->setEnabled(state);
@ -761,7 +763,7 @@ void DialogFinalMeasurements::InitSearch()
if (state)
{
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
}
else
{
@ -786,21 +788,24 @@ void DialogFinalMeasurements::InitSearch()
}
});
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this, [this](bool checked)
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetMatchCase(checked);
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this, [this](bool checked)
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetMatchWord(checked);
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonRegexp, &QToolButton::toggled, this, [this](bool checked)
connect(ui->toolButtonRegexp, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetMatchRegexp(checked);
@ -825,7 +830,8 @@ void DialogFinalMeasurements::InitSearch()
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this, [this](bool checked)
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetUseUnicodePreperties(checked);
m_search->Find(ui->lineEditFind->text());
@ -842,11 +848,12 @@ void DialogFinalMeasurements::InitSearchHistory()
QStringList searchHistory =
VAbstractValApplication::VApp()->ValentinaSettings()->GetFinalMeasurementsSearchHistory();
m_searchHistory->clear();
for (const auto& term : searchHistory)
for (const auto &term : searchHistory)
{
QAction *action = m_searchHistory->addAction(term);
action->setData(term);
connect(action, &QAction::triggered, this, [this]()
connect(action, &QAction::triggered, this,
[this]()
{
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)

View File

@ -1818,15 +1818,13 @@ void DialogIncrements::DeployFormula()
{
plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
// Set icon from theme (internal for Windows system)
pushButtonGrow->setIcon(
QIcon::fromTheme(QStringLiteral("go-next"), QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
}
else
{
plainTextEditFormula->setFixedHeight(baseHeight);
// Set icon from theme (internal for Windows system)
pushButtonGrow->setIcon(
QIcon::fromTheme(QStringLiteral("go-down"), QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down")));
}
// I found that after change size of formula field, it was filed for angle formula, field for formula became black.

View File

@ -27,13 +27,14 @@
*************************************************************************/
#include "dialogpreferences.h"
#include "ui_dialogpreferences.h"
#include "configpages/preferencesconfigurationpage.h"
#include "configpages/preferencespatternpage.h"
#include "configpages/preferencespathpage.h"
#include "../vmisc/vvalentinasettings.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vvalentinasettings.h"
#include "configpages/preferencesconfigurationpage.h"
#include "configpages/preferencespathpage.h"
#include "configpages/preferencespatternpage.h"
#include "ui_dialogpreferences.h"
#include <QApplication>
#include <QMessageBox>
#include <QPushButton>
#include <QShowEvent>
@ -79,8 +80,8 @@ DialogPreferences::~DialogPreferences()
//---------------------------------------------------------------------------------------------------------------------
void DialogPreferences::showEvent(QShowEvent *event)
{
QDialog::showEvent( event );
if ( event->spontaneous() )
QDialog::showEvent(event);
if (event->spontaneous())
{
return;
}
@ -97,7 +98,7 @@ void DialogPreferences::showEvent(QShowEvent *event)
resize(sz);
}
m_isInitialized = true;//first show windows are held
m_isInitialized = true; // first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
@ -121,6 +122,24 @@ void DialogPreferences::changeEvent(QEvent *event)
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
}
if (event->type() == QEvent::PaletteChange)
{
QStyle *style = QApplication::style();
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
bOk->setIcon(style->standardIcon(QStyle::SP_DialogOkButton));
QPushButton *bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
SCASSERT(bApply != nullptr)
bApply->setIcon(style->standardIcon(QStyle::SP_DialogApplyButton));
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr)
bCancel->setIcon(style->standardIcon(QStyle::SP_DialogCancelButton));
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
@ -147,12 +166,12 @@ void DialogPreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
const QString text =
tr("Followed %n option(s) require restart to take effect: %1.", "", static_cast<int>(preferences.size()))
.arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}
m_patternPage->InitDefaultSeamAllowance();
VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())

View File

@ -26,21 +26,22 @@
**
*************************************************************************/
#include "mainwindow.h"
#include "core/vapplication.h"
#include "../fervor/fvupdater.h"
#include "../vpatterndb/vpiecenode.h"
#include "core/vapplication.h"
#include "mainwindow.h"
#include "vabstractapplication.h"
#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <QTimer>
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
# include "../vmisc/backport/qscopeguard.h"
#include "../vmisc/backport/qscopeguard.h"
#else
# include <QScopeGuard>
#include <QScopeGuard>
#endif
# include "../vmisc/appimage.h"
#include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -54,19 +55,23 @@ auto main(int argc, char *argv[]) -> int
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
/* Fix path to ICU_DATA when run AppImage.*/
char *exe_dir = IcuDataPath("/../share/icu");
auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);});
auto FreeMemory = qScopeGuard([exe_dir] { free(exe_dir); });
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
Q_INIT_RESOURCE(cursor); // NOLINT
Q_INIT_RESOURCE(icon); // NOLINT
Q_INIT_RESOURCE(schema); // NOLINT
Q_INIT_RESOURCE(theme); // NOLINT
Q_INIT_RESOURCE(flags); // NOLINT
Q_INIT_RESOURCE(icons); // NOLINT
Q_INIT_RESOURCE(toolicon); // NOLINT
Q_INIT_RESOURCE(style); // NOLINT
Q_INIT_RESOURCE(breeze); // NOLINT
#if defined(Q_OS_MACX)
Q_INIT_RESOURCE(mac_theme); // NOLINT
#else
Q_INIT_RESOURCE(win_theme); // NOLINT
#endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations NOLINT
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
#if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole();
@ -79,9 +84,9 @@ auto main(int argc, char *argv[]) -> int
#ifndef Q_OS_MAC // supports natively
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
InitHighDpiScaling(argc, argv);
VAbstractApplication::InitHighDpiScaling(argc, argv);
#endif
#endif //Q_OS_MAC
#endif // Q_OS_MAC
#ifdef Q_OS_MAC
#if MACOS_LAYER_BACKING_AFFECTED
@ -92,7 +97,7 @@ auto main(int argc, char *argv[]) -> int
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
auto Terminate = qScopeGuard([]() { XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
VApplication app(argc, argv);
@ -118,7 +123,7 @@ auto main(int argc, char *argv[]) -> int
app.setMainWindow(&w);
int msec = 0;
//Before we load pattern show window.
// Before we load pattern show window.
if (VApplication::IsGUIMode())
{
w.show();

View File

@ -54,6 +54,7 @@
#include "../vwidgets/vwidgetpopup.h"
#include "core/vapplication.h"
#include "core/vtooloptionspropertybrowser.h"
#include "theme/vtheme.h"
#include "ui_mainwindow.h"
#include "vabstractapplication.h"
#include "vsinglelineoutlinechar.h"
@ -826,7 +827,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
CancelTool();
emit EnableItemMove(false);
m_currentTool = m_lastUsedTool = t;
auto cursorResource = cursor;
auto cursorResource = VTheme::GetResourceName(QStringLiteral("cursor"), cursor);
if (qApp->devicePixelRatio() >= 2) // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
{
// Try to load HiDPI versions of the cursors if availible
@ -1030,7 +1031,7 @@ template <typename DrawTool> void MainWindow::ApplyDetailsDialog()
void MainWindow::ToolEndLine(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLine, QStringLiteral(":/cursor/endline_cursor.png"),
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLine, QStringLiteral("segment_cursor.png"),
tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolEndLine>,
&MainWindow::ApplyDrawDialog<VToolEndLine>);
}
@ -1043,8 +1044,8 @@ void MainWindow::ToolEndLine(bool checked)
void MainWindow::ToolLine(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogLine>(checked, Tool::Line, QStringLiteral(":/cursor/line_cursor.png"),
tr("Select first point"), &MainWindow::ClosedDrawDialogWithApply<VToolLine>,
SetToolButtonWithApply<DialogLine>(checked, Tool::Line, QStringLiteral("line_cursor.png"), tr("Select first point"),
&MainWindow::ClosedDrawDialogWithApply<VToolLine>,
&MainWindow::ApplyDrawDialog<VToolLine>);
}
@ -1056,7 +1057,7 @@ void MainWindow::ToolLine(bool checked)
void MainWindow::ToolAlongLine(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLine, QStringLiteral(":/cursor/alongline_cursor.png"),
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLine, QStringLiteral("along_line_cursor.png"),
tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDrawDialog<VToolAlongLine>);
}
@ -1066,7 +1067,7 @@ void MainWindow::ToolMidpoint(bool checked)
{
ToolSelectPointByRelease();
// Reuse DialogAlongLine and VToolAlongLine but with different cursor
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::Midpoint, QStringLiteral(":/cursor/midpoint_cursor.png"),
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::Midpoint, QStringLiteral("midpoint_cursor.png"),
tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDrawDialog<VToolAlongLine>);
}
@ -1080,7 +1081,7 @@ void MainWindow::ToolShoulderPoint(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogShoulderPoint>(
checked, Tool::ShoulderPoint, QStringLiteral(":/cursor/shoulder_cursor.png"), tr("Select point"),
checked, Tool::ShoulderPoint, QStringLiteral("shoulder_cursor.png"), tr("Select point"),
&MainWindow::ClosedDrawDialogWithApply<VToolShoulderPoint>, &MainWindow::ApplyDrawDialog<VToolShoulderPoint>);
}
@ -1093,7 +1094,7 @@ void MainWindow::ToolNormal(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogNormal>(
checked, Tool::Normal, QStringLiteral(":/cursor/normal_cursor.png"), tr("Select first point of line"),
checked, Tool::Normal, QStringLiteral("normal_cursor.png"), tr("Select first point of line"),
&MainWindow::ClosedDrawDialogWithApply<VToolNormal>, &MainWindow::ApplyDrawDialog<VToolNormal>);
}
@ -1106,7 +1107,7 @@ void MainWindow::ToolBisector(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogBisector>(
checked, Tool::Bisector, QStringLiteral(":/cursor/bisector_cursor.png"), tr("Select first point of angle"),
checked, Tool::Bisector, QStringLiteral("bisector_cursor.png"), tr("Select first point of angle"),
&MainWindow::ClosedDrawDialogWithApply<VToolBisector>, &MainWindow::ApplyDrawDialog<VToolBisector>);
}
@ -1119,9 +1120,8 @@ void MainWindow::ToolLineIntersect(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogLineIntersect>(
checked, Tool::LineIntersect, QStringLiteral(":/cursor/intersect_cursor.png"),
tr("Select first point of first line"), &MainWindow::ClosedDrawDialogWithApply<VToolLineIntersect>,
&MainWindow::ApplyDrawDialog<VToolLineIntersect>);
checked, Tool::LineIntersect, QStringLiteral("intersect_cursor.png"), tr("Select first point of first line"),
&MainWindow::ClosedDrawDialogWithApply<VToolLineIntersect>, &MainWindow::ApplyDrawDialog<VToolLineIntersect>);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1133,7 +1133,7 @@ void MainWindow::ToolSpline(bool checked)
{
ToolSelectPointByPress();
SetToolButtonWithApply<DialogSpline>(
checked, Tool::Spline, QStringLiteral(":/cursor/spline_cursor.png"), tr("Select first point curve"),
checked, Tool::Spline, QStringLiteral("spline_cursor.png"), tr("Select first point curve"),
&MainWindow::ClosedDrawDialogWithApply<VToolSpline>, &MainWindow::ApplyDrawDialog<VToolSpline>);
}
@ -1142,7 +1142,7 @@ void MainWindow::ToolCubicBezier(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogCubicBezier>(
checked, Tool::CubicBezier, QStringLiteral(":/cursor/cubic_bezier_cursor.png"), tr("Select first curve point"),
checked, Tool::CubicBezier, QStringLiteral("cubic_bezier_cursor.png"), tr("Select first curve point"),
&MainWindow::ClosedDrawDialogWithApply<VToolCubicBezier>, &MainWindow::ApplyDrawDialog<VToolCubicBezier>);
}
@ -1155,7 +1155,7 @@ void MainWindow::ToolCutSpline(bool checked)
{
ToolSelectSpline();
SetToolButtonWithApply<DialogCutSpline>(
checked, Tool::CutSpline, QStringLiteral(":/cursor/spline_cut_point_cursor.png"), tr("Select simple curve"),
checked, Tool::CutSpline, QStringLiteral("spline_cut_point_cursor.png"), tr("Select simple curve"),
&MainWindow::ClosedDrawDialogWithApply<VToolCutSpline>, &MainWindow::ApplyDrawDialog<VToolCutSpline>);
}
@ -1168,7 +1168,7 @@ void MainWindow::ToolArc(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogArc>(
checked, Tool::Arc, QStringLiteral(":/cursor/arc_cursor.png"), tr("Select point of center of arc"),
checked, Tool::Arc, QStringLiteral("arc_cursor.png"), tr("Select point of center of arc"),
&MainWindow::ClosedDrawDialogWithApply<VToolArc>, &MainWindow::ApplyDrawDialog<VToolArc>);
}
@ -1180,9 +1180,9 @@ void MainWindow::ToolArc(bool checked)
void MainWindow::ToolEllipticalArc(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogEllipticalArc>(
checked, Tool::EllipticalArc, QStringLiteral(":/cursor/el_arc_cursor.png"),
tr("Select point of center of elliptical arc"), &MainWindow::ClosedDrawDialogWithApply<VToolEllipticalArc>,
SetToolButtonWithApply<DialogEllipticalArc>(checked, Tool::EllipticalArc, QStringLiteral("el_arc_cursor.png"),
tr("Select point of center of elliptical arc"),
&MainWindow::ClosedDrawDialogWithApply<VToolEllipticalArc>,
&MainWindow::ApplyDrawDialog<VToolEllipticalArc>);
}
@ -1195,7 +1195,7 @@ void MainWindow::ToolSplinePath(bool checked)
{
ToolSelectPointByPress();
SetToolButtonWithApply<DialogSplinePath>(
checked, Tool::SplinePath, QStringLiteral(":/cursor/splinepath_cursor.png"), tr("Select point of curve path"),
checked, Tool::SplinePath, QStringLiteral("splinePath_cursor.png"), tr("Select point of curve path"),
&MainWindow::ClosedDrawDialogWithApply<VToolSplinePath>, &MainWindow::ApplyDrawDialog<VToolSplinePath>);
}
@ -1204,7 +1204,7 @@ void MainWindow::ToolCubicBezierPath(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogCubicBezierPath>(
checked, Tool::CubicBezierPath, QStringLiteral(":/cursor/cubic_bezier_path_cursor.png"),
checked, Tool::CubicBezierPath, QStringLiteral("cubic_bezier_path_cursor.png"),
tr("Select point of cubic bezier path"), &MainWindow::ClosedDrawDialogWithApply<VToolCubicBezierPath>,
&MainWindow::ApplyDrawDialog<VToolCubicBezierPath>);
}
@ -1218,9 +1218,8 @@ void MainWindow::ToolCutSplinePath(bool checked)
{
ToolSelectSplinePath();
SetToolButtonWithApply<DialogCutSplinePath>(
checked, Tool::CutSplinePath, QStringLiteral(":/cursor/splinepath_cut_point_cursor.png"),
tr("Select curve path"), &MainWindow::ClosedDrawDialogWithApply<VToolCutSplinePath>,
&MainWindow::ApplyDrawDialog<VToolCutSplinePath>);
checked, Tool::CutSplinePath, QStringLiteral("splinePath_cut_point_cursor.png"), tr("Select curve path"),
&MainWindow::ClosedDrawDialogWithApply<VToolCutSplinePath>, &MainWindow::ApplyDrawDialog<VToolCutSplinePath>);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1232,9 +1231,8 @@ void MainWindow::ToolPointOfContact(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogPointOfContact>(
checked, Tool::PointOfContact, QStringLiteral(":/cursor/pointcontact_cursor.png"),
tr("Select first point of line"), &MainWindow::ClosedDrawDialogWithApply<VToolPointOfContact>,
&MainWindow::ApplyDrawDialog<VToolPointOfContact>);
checked, Tool::PointOfContact, QStringLiteral("point_of_contact_cursor.png"), tr("Select first point of line"),
&MainWindow::ClosedDrawDialogWithApply<VToolPointOfContact>, &MainWindow::ApplyDrawDialog<VToolPointOfContact>);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1245,7 +1243,7 @@ void MainWindow::ToolPointOfContact(bool checked)
void MainWindow::ToolDetail(bool checked)
{
ToolSelectAllDrawObjects();
SetToolButtonWithApply<DialogSeamAllowance>(checked, Tool::Piece, QStringLiteral("://cursor/new_detail_cursor.png"),
SetToolButtonWithApply<DialogSeamAllowance>(checked, Tool::Piece, QStringLiteral("new_detail_cursor.png"),
tr("Select main path objects clockwise."),
&MainWindow::ClosedDetailsDialogWithApply<VToolSeamAllowance>,
&MainWindow::ApplyDetailsDialog<VToolSeamAllowance>);
@ -1256,7 +1254,7 @@ void MainWindow::ToolPiecePath(bool checked)
{
ToolSelectAllDrawObjects();
SetToolButton<DialogPiecePath>(
checked, Tool::PiecePath, QStringLiteral("://cursor/path_cursor.png"),
checked, Tool::PiecePath, QStringLiteral("path_cursor.png"),
tr("Select path objects, <b>%1</b> - reverse direction curve").arg(VModifierKey::Shift()),
&MainWindow::ClosedDialogPiecePath);
}
@ -1265,7 +1263,7 @@ void MainWindow::ToolPiecePath(bool checked)
void MainWindow::ToolPin(bool checked)
{
ToolSelectPointByRelease();
SetToolButton<DialogPin>(checked, Tool::Pin, QStringLiteral("://cursor/pin_cursor.png"), tr("Select pin point"),
SetToolButton<DialogPin>(checked, Tool::Pin, QStringLiteral("pin_cursor.png"), tr("Select pin point"),
&MainWindow::ClosedDialogPin);
}
@ -1273,7 +1271,7 @@ void MainWindow::ToolPin(bool checked)
void MainWindow::ToolPlaceLabel(bool checked)
{
ToolSelectPointByRelease();
SetToolButton<DialogPlaceLabel>(checked, Tool::PlaceLabel, QStringLiteral("://cursor/place_label_cursor.png"),
SetToolButton<DialogPlaceLabel>(checked, Tool::PlaceLabel, QStringLiteral("place_label_cursor.png"),
tr("Select placelabel center point"), &MainWindow::ClosedDialogPlaceLabel);
}
@ -1285,7 +1283,7 @@ void MainWindow::ToolPlaceLabel(bool checked)
void MainWindow::ToolHeight(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogHeight>(checked, Tool::Height, QStringLiteral(":/cursor/height_cursor.png"),
SetToolButtonWithApply<DialogHeight>(checked, Tool::Height, QStringLiteral("height_cursor.png"),
tr("Select base point"), &MainWindow::ClosedDrawDialogWithApply<VToolHeight>,
&MainWindow::ApplyDrawDialog<VToolHeight>);
}
@ -1299,7 +1297,7 @@ void MainWindow::ToolTriangle(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogTriangle>(
checked, Tool::Triangle, QStringLiteral(":/cursor/triangle_cursor.png"), tr("Select first point of axis"),
checked, Tool::Triangle, QStringLiteral("triangle_cursor.png"), tr("Select first point of axis"),
&MainWindow::ClosedDrawDialogWithApply<VToolTriangle>, &MainWindow::ApplyDrawDialog<VToolTriangle>);
}
@ -1312,7 +1310,7 @@ void MainWindow::ToolPointOfIntersection(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogPointOfIntersection>(
checked, Tool::PointOfIntersection, QStringLiteral(":/cursor/pointofintersect_cursor.png"),
checked, Tool::PointOfIntersection, QStringLiteral("point_of_intersection_cursor.png"),
tr("Select point for X value (vertical)"), &MainWindow::ClosedDrawDialogWithApply<VToolPointOfIntersection>,
&MainWindow::ApplyDrawDialog<VToolPointOfIntersection>);
}
@ -1325,7 +1323,7 @@ void MainWindow::ToolPointOfIntersection(bool checked)
void MainWindow::ToolUnionDetails(bool checked)
{
ToolSelectDetail();
SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, QStringLiteral(":/cursor/union_cursor.png"),
SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, QStringLiteral("union_cursor.png"),
tr("Select detail"), &MainWindow::ClosedDialogUnionDetails);
}
@ -1343,9 +1341,8 @@ void MainWindow::ClosedDialogUnionDetails(int result)
void MainWindow::ToolDuplicateDetail(bool checked)
{
ToolSelectDetail();
SetToolButton<DialogDuplicateDetail>(checked, Tool::DuplicateDetail,
QStringLiteral(":/cursor/duplicate_detail_cursor.png"), tr("Select detail"),
&MainWindow::ClosedDialogDuplicateDetail);
SetToolButton<DialogDuplicateDetail>(checked, Tool::DuplicateDetail, QStringLiteral("duplicate_detail_cursor.png"),
tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1371,7 +1368,7 @@ void MainWindow::ToolGroup(bool checked)
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>%2</b> - finish creation")
.arg(VModifierKey::Control(), VModifierKey::EnterKey());
SetToolButton<DialogGroup>(checked, Tool::Group, QStringLiteral(":/cursor/group_plus_cursor.png"), tooltip,
SetToolButton<DialogGroup>(checked, Tool::Group, QStringLiteral("group_plus_cursor.png"), tooltip,
&MainWindow::ClosedDialogGroup);
}
@ -1382,8 +1379,8 @@ void MainWindow::ToolRotation(bool checked)
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>%2</b> - confirm selection")
.arg(VModifierKey::Control(), VModifierKey::EnterKey());
SetToolButtonWithApply<DialogRotation>(checked, Tool::Rotation, QStringLiteral(":/cursor/rotation_cursor.png"),
tooltip, &MainWindow::ClosedDrawDialogWithApply<VToolRotation>,
SetToolButtonWithApply<DialogRotation>(checked, Tool::Rotation, QStringLiteral("rotation_cursor.png"), tooltip,
&MainWindow::ClosedDrawDialogWithApply<VToolRotation>,
&MainWindow::ApplyDrawDialog<VToolRotation>);
}
@ -1395,7 +1392,7 @@ void MainWindow::ToolFlippingByLine(bool checked)
"<b>%2</b> - confirm selection")
.arg(VModifierKey::Control(), VModifierKey::EnterKey());
SetToolButtonWithApply<DialogFlippingByLine>(
checked, Tool::FlippingByLine, QStringLiteral(":/cursor/flipping_line_cursor.png"), tooltip,
checked, Tool::FlippingByLine, QStringLiteral("flipping_line_cursor.png"), tooltip,
&MainWindow::ClosedDrawDialogWithApply<VToolFlippingByLine>, &MainWindow::ApplyDrawDialog<VToolFlippingByLine>);
}
@ -1407,7 +1404,7 @@ void MainWindow::ToolFlippingByAxis(bool checked)
"<b>%2</b> - confirm selection")
.arg(VModifierKey::Control(), VModifierKey::EnterKey());
SetToolButtonWithApply<DialogFlippingByAxis>(
checked, Tool::FlippingByAxis, QStringLiteral(":/cursor/flipping_axis_cursor.png"), tooltip,
checked, Tool::FlippingByAxis, QStringLiteral("flipping_axis_cursor.png"), tooltip,
&MainWindow::ClosedDrawDialogWithApply<VToolFlippingByAxis>, &MainWindow::ApplyDrawDialog<VToolFlippingByAxis>);
}
@ -1418,7 +1415,7 @@ void MainWindow::ToolMove(bool checked)
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>%2</b> - confirm selection")
.arg(VModifierKey::Control(), VModifierKey::EnterKey());
SetToolButtonWithApply<DialogMove>(checked, Tool::Move, QStringLiteral(":/cursor/move_cursor.png"), tooltip,
SetToolButtonWithApply<DialogMove>(checked, Tool::Move, QStringLiteral("move_cursor.png"), tooltip,
&MainWindow::ClosedDrawDialogWithApply<VToolMove>,
&MainWindow::ApplyDrawDialog<VToolMove>);
}
@ -1572,8 +1569,8 @@ void MainWindow::RemoveBackgroundImage(const QUuid &id)
void MainWindow::ToolCutArc(bool checked)
{
ToolSelectArc();
SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArc, QStringLiteral(":/cursor/arc_cut_cursor.png"),
tr("Select arc"), &MainWindow::ClosedDrawDialogWithApply<VToolCutArc>,
SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArc, QStringLiteral("arc_cut_cursor.png"), tr("Select arc"),
&MainWindow::ClosedDrawDialogWithApply<VToolCutArc>,
&MainWindow::ApplyDrawDialog<VToolCutArc>);
}
@ -1582,7 +1579,7 @@ void MainWindow::ToolLineIntersectAxis(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogLineIntersectAxis>(
checked, Tool::LineIntersectAxis, QStringLiteral(":/cursor/line_intersect_axis_cursor.png"),
checked, Tool::LineIntersectAxis, QStringLiteral("line_intersect_axis_cursor.png"),
tr("Select first point of line"), &MainWindow::ClosedDrawDialogWithApply<VToolLineIntersectAxis>,
&MainWindow::ApplyDrawDialog<VToolLineIntersectAxis>);
}
@ -1592,8 +1589,8 @@ void MainWindow::ToolCurveIntersectAxis(bool checked)
{
ToolSelectAllDrawObjects();
SetToolButtonWithApply<DialogCurveIntersectAxis>(
checked, Tool::CurveIntersectAxis, QStringLiteral(":/cursor/curve_intersect_axis_cursor.png"),
tr("Select curve"), &MainWindow::ClosedDrawDialogWithApply<VToolCurveIntersectAxis>,
checked, Tool::CurveIntersectAxis, QStringLiteral("curve_intersect_axis_cursor.png"), tr("Select curve"),
&MainWindow::ClosedDrawDialogWithApply<VToolCurveIntersectAxis>,
&MainWindow::ApplyDrawDialog<VToolCurveIntersectAxis>);
}
@ -1602,8 +1599,8 @@ void MainWindow::ToolArcIntersectAxis(bool checked)
{
ToolSelectAllDrawObjects();
// Reuse ToolCurveIntersectAxis but with different cursor and tool tip
SetToolButtonWithApply<DialogCurveIntersectAxis>(
checked, Tool::ArcIntersectAxis, QStringLiteral(":/cursor/arc_intersect_axis_cursor.png"), tr("Select arc"),
SetToolButtonWithApply<DialogCurveIntersectAxis>(checked, Tool::ArcIntersectAxis,
QStringLiteral("arc_intersect_axis_cursor.png"), tr("Select arc"),
&MainWindow::ClosedDrawDialogWithApply<VToolCurveIntersectAxis>,
&MainWindow::ApplyDrawDialog<VToolCurveIntersectAxis>);
}
@ -1613,7 +1610,7 @@ void MainWindow::ToolPointOfIntersectionArcs(bool checked)
{
ToolSelectArc();
SetToolButtonWithApply<DialogPointOfIntersectionArcs>(
checked, Tool::PointOfIntersectionArcs, QStringLiteral("://cursor/point_of_intersection_arcs.png"),
checked, Tool::PointOfIntersectionArcs, QStringLiteral("point_of_intersection_arcs.png"),
tr("Select first an arc"), &MainWindow::ClosedDrawDialogWithApply<VToolPointOfIntersectionArcs>,
&MainWindow::ApplyDrawDialog<VToolPointOfIntersectionArcs>);
}
@ -1623,7 +1620,7 @@ void MainWindow::ToolPointOfIntersectionCircles(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogPointOfIntersectionCircles>(
checked, Tool::PointOfIntersectionCircles, QStringLiteral("://cursor/point_of_intersection_circles.png"),
checked, Tool::PointOfIntersectionCircles, QStringLiteral("point_of_intersection_circles.png"),
tr("Select first circle center"), &MainWindow::ClosedDrawDialogWithApply<VToolPointOfIntersectionCircles>,
&MainWindow::ApplyDrawDialog<VToolPointOfIntersectionCircles>);
}
@ -1633,7 +1630,7 @@ void MainWindow::ToolPointOfIntersectionCurves(bool checked)
{
ToolSelectCurve();
SetToolButtonWithApply<DialogPointOfIntersectionCurves>(
checked, Tool::PointOfIntersectionCurves, QStringLiteral("://cursor/intersection_curves_cursor.png"),
checked, Tool::PointOfIntersectionCurves, QStringLiteral("intersection_curves_cursor.png"),
tr("Select first curve"), &MainWindow::ClosedDrawDialogWithApply<VToolPointOfIntersectionCurves>,
&MainWindow::ApplyDrawDialog<VToolPointOfIntersectionCurves>);
}
@ -1643,7 +1640,7 @@ void MainWindow::ToolPointFromCircleAndTangent(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogPointFromCircleAndTangent>(
checked, Tool::PointFromCircleAndTangent, QStringLiteral("://cursor/point_from_circle_and_tangent_cursor.png"),
checked, Tool::PointFromCircleAndTangent, QStringLiteral("point_from_circle_and_tangent_cursor.png"),
tr("Select point on tangent"), &MainWindow::ClosedDrawDialogWithApply<VToolPointFromCircleAndTangent>,
&MainWindow::ApplyDrawDialog<VToolPointFromCircleAndTangent>);
}
@ -1653,7 +1650,7 @@ void MainWindow::ToolPointFromArcAndTangent(bool checked)
{
ToolSelectPointArc();
SetToolButtonWithApply<DialogPointFromArcAndTangent>(
checked, Tool::PointFromArcAndTangent, QStringLiteral("://cursor/point_from_arc_and_tangent_cursor.png"),
checked, Tool::PointFromArcAndTangent, QStringLiteral("point_from_arc_and_tangent_cursor.png"),
tr("Select point on tangent"), &MainWindow::ClosedDrawDialogWithApply<VToolPointFromArcAndTangent>,
&MainWindow::ApplyDrawDialog<VToolPointFromArcAndTangent>);
}
@ -1663,7 +1660,7 @@ void MainWindow::ToolArcWithLength(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogArcWithLength>(
checked, Tool::ArcWithLength, QStringLiteral("://cursor/arc_with_length_cursor.png"),
checked, Tool::ArcWithLength, QStringLiteral("arc_with_length_cursor.png"),
tr("Select point of the center of the arc"), &MainWindow::ClosedDrawDialogWithApply<VToolArcWithLength>,
&MainWindow::ApplyDrawDialog<VToolArcWithLength>);
}
@ -1672,10 +1669,9 @@ void MainWindow::ToolArcWithLength(bool checked)
void MainWindow::ToolTrueDarts(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogTrueDarts>(checked, Tool::TrueDarts, QStringLiteral("://cursor/true_darts_cursor.png"),
tr("Select the first base line point"),
&MainWindow::ClosedDrawDialogWithApply<VToolTrueDarts>,
&MainWindow::ApplyDrawDialog<VToolTrueDarts>);
SetToolButtonWithApply<DialogTrueDarts>(
checked, Tool::TrueDarts, QStringLiteral("true_darts_cursor.png"), tr("Select the first base line point"),
&MainWindow::ClosedDrawDialogWithApply<VToolTrueDarts>, &MainWindow::ApplyDrawDialog<VToolTrueDarts>);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1685,8 +1681,8 @@ void MainWindow::ToolInsertNode(bool checked)
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>%2</b> - finish creation")
.arg(VModifierKey::Control(), VModifierKey::EnterKey());
SetToolButton<DialogInsertNode>(checked, Tool::InsertNode, QStringLiteral("://cursor/insert_node_cursor.png"),
tooltip, &MainWindow::ClosedDialogInsertNode);
SetToolButton<DialogInsertNode>(checked, Tool::InsertNode, QStringLiteral("insert_node_cursor.png"), tooltip,
&MainWindow::ClosedDialogInsertNode);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1773,6 +1769,12 @@ void MainWindow::changeEvent(QEvent *event)
UpdateWindowTitle();
emit m_sceneDetails->LanguageChanged();
}
if (event->type() == QEvent::PaletteChange)
{
SetupDrawToolsIcons();
}
// remember to call base class implementation
QMainWindow::changeEvent(event);
}
@ -3040,6 +3042,8 @@ void MainWindow::ToolBarTools()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarDrawTools()
{
SetupDrawToolsIcons();
// Point tools
{
auto *linePointToolMenu = new QMenu(this);
@ -3491,6 +3495,66 @@ void MainWindow::CancelTool()
redoAction->setEnabled(VAbstractApplication::VApp()->getUndoStack()->canRedo());
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetupDrawToolsIcons()
{
const QString resource = QStringLiteral("toolicon");
ui->actionLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("line.png")));
ui->actionEndLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("segment.png")));
ui->actionAlongLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("along_line.png")));
ui->actionMidpointTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("midpoint.png")));
ui->actionNormalTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("normal.png")));
ui->actionBisectorTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("bisector.png")));
ui->actionHeightTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("height.png")));
ui->actionPointOfIntersectionTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("point_of_intersection.png")));
ui->actionLineIntersectTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("intersect.png")));
ui->actionShoulderPointTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("shoulder.png")));
ui->actionTriangleTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("triangle.png")));
ui->actionLineIntersectAxisTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("line_intersect_axis.png")));
ui->actionCurveIntersectAxisTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("curve_intersect_axis.png")));
ui->actionArcIntersectAxisTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("arc_intersect_axis.png")));
ui->actionSplineCutPointTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("spline_cut_point.png")));
ui->actionSplinePathCutPointTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("splinePath_cut_point.png")));
ui->actionArcCutPointTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("arc_cut.png")));
ui->actionIntersectionCurvesTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("intersection_curves.png")));
ui->actionPointOfIntersectionArcsTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("point_of_intersection_arcs.png")));
ui->actionPointOfIntersectionCirclesTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("point_of_intersection_circles.png")));
ui->actionPointFromArcAndTangentTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("point_from_arc_and_tangent.png")));
ui->actionPointFromCircleAndTangentTool->setIcon(
VTheme::GetIconResource(resource, QStringLiteral("point_from_circle_and_tangent.png")));
ui->actionPointOfContactTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("point_of_contact.png")));
ui->actionSplineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("spline.png")));
ui->actionCubicBezierTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("cubic_bezier.png")));
ui->actionSplinePathTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("splinePath.png")));
ui->actionCubicBezierPathTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("cubic_bezier_path.png")));
ui->actionArcTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("arc.png")));
ui->actionArcWithLengthTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("arc_with_length.png")));
ui->actionEllipticalArcTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("el_arc.png")));
ui->actionGroupTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("group_plus.png")));
ui->actionFlippingByAxisTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("flipping_axis.png")));
ui->actionFlippingByLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("flipping_line.png")));
ui->actionRotationTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("rotation.png")));
ui->actionMoveTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("move.png")));
ui->actionTrueDartsTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("true_darts.png")));
ui->actionNewDetailTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("new_detail.png")));
ui->actionUnionDetailsTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("union.png")));
ui->actionDuplicateDetailTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("duplicate_detail.png")));
ui->actionInternalPathTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("path.png")));
ui->actionPinTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("pin.png")));
ui->actionInsertNodeTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("insert_node.png")));
ui->actionPlaceLabelTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("place_label.png")));
}
QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------

View File

@ -352,6 +352,8 @@ private:
void InitToolButtons();
void CancelTool();
void SetupDrawToolsIcons();
void SetEnableWidgets(bool enable);
void SetEnableTool(bool enable);
void SetLayoutModeActions();

View File

@ -418,7 +418,7 @@
<string>Clear all messages</string>
</property>
<property name="text">
<string notr="true">...</string>
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
@ -432,7 +432,7 @@
<string>Auto refresh the list with each parse</string>
</property>
<property name="text">
<string notr="true">...</string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="view-refresh">
@ -474,7 +474,7 @@
<string>Zoom in</string>
</property>
<property name="text">
<string notr="true">...</string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="zoom-in">
@ -488,12 +488,18 @@
<string>Zoom out</string>
</property>
<property name="text">
<string notr="true">...</string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="zoom-out">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
@ -543,6 +549,12 @@
<property name="toolTip">
<string>Tools for creating points</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
@ -554,6 +566,12 @@
<property name="windowTitle">
<string>Selecting tools</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
@ -572,6 +590,12 @@
<property name="toolTip">
<string>Tools for creating segments</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
@ -587,6 +611,12 @@
<property name="toolTip">
<string>Tools for creating curves</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
@ -598,6 +628,12 @@
<property name="windowTitle">
<string>Operation tools</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
@ -612,6 +648,12 @@
<property name="toolTip">
<string>Tools for creating detail</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
@ -626,6 +668,12 @@
<property name="toolTip">
<string/>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
@ -1726,7 +1774,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/segment.png</normaloff>:/toolicon/32x32/segment.png</iconset>
<normaloff>:/toolicon/light/segment.png</normaloff>:/toolicon/light/segment.png</iconset>
</property>
<property name="text">
<string>Point at distance and angle</string>
@ -1744,7 +1792,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/point_of_intersection_arcs.png</normaloff>:/toolicon/32x32/point_of_intersection_arcs.png</iconset>
<normaloff>:/toolicon/light/point_of_intersection_arcs.png</normaloff>:/toolicon/light/point_of_intersection_arcs.png</iconset>
</property>
<property name="text">
<string>Point of intersection arcs</string>
@ -1762,7 +1810,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/arc_intersect_axis.png</normaloff>:/toolicon/32x32/arc_intersect_axis.png</iconset>
<normaloff>:/toolicon/light/arc_intersect_axis.png</normaloff>:/toolicon/light/arc_intersect_axis.png</iconset>
</property>
<property name="text">
<string>Point of intersection arc and axis</string>
@ -1780,7 +1828,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/arc_cut.png</normaloff>:/toolicon/32x32/arc_cut.png</iconset>
<normaloff>:/toolicon/light/arc_cut.png</normaloff>:/toolicon/light/arc_cut.png</iconset>
</property>
<property name="text">
<string>Segment an arc</string>
@ -1798,7 +1846,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/arc.png</normaloff>:/toolicon/32x32/arc.png</iconset>
<normaloff>:/toolicon/light/arc.png</normaloff>:/toolicon/light/arc.png</iconset>
</property>
<property name="text">
<string>Arc</string>
@ -1816,7 +1864,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/curve_intersect_axis.png</normaloff>:/toolicon/32x32/curve_intersect_axis.png</iconset>
<normaloff>:/toolicon/light/curve_intersect_axis.png</normaloff>:/toolicon/light/curve_intersect_axis.png</iconset>
</property>
<property name="text">
<string>Point intersect curve and axis</string>
@ -1834,7 +1882,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/intersection_curves.png</normaloff>:/toolicon/32x32/intersection_curves.png</iconset>
<normaloff>:/toolicon/light/intersection_curves.png</normaloff>:/toolicon/light/intersection_curves.png</iconset>
</property>
<property name="text">
<string>Point intersection curves</string>
@ -1852,7 +1900,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/cubic_bezier_path.png</normaloff>:/toolicon/32x32/cubic_bezier_path.png</iconset>
<normaloff>:/toolicon/light/cubic_bezier_path.png</normaloff>:/toolicon/light/cubic_bezier_path.png</iconset>
</property>
<property name="text">
<string>Curved path tool which uses point as control handle</string>
@ -1870,7 +1918,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/splinePath_cut_point.png</normaloff>:/toolicon/32x32/splinePath_cut_point.png</iconset>
<normaloff>:/toolicon/light/splinePath_cut_point.png</normaloff>:/toolicon/light/splinePath_cut_point.png</iconset>
</property>
<property name="text">
<string>Segment a curved path</string>
@ -1888,7 +1936,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/along_line.png</normaloff>:/toolicon/32x32/along_line.png</iconset>
<normaloff>:/toolicon/light/along_line.png</normaloff>:/toolicon/light/along_line.png</iconset>
</property>
<property name="text">
<string>Point at distance along line</string>
@ -1906,7 +1954,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/normal.png</normaloff>:/toolicon/32x32/normal.png</iconset>
<normaloff>:/toolicon/light/normal.png</normaloff>:/toolicon/light/normal.png</iconset>
</property>
<property name="text">
<string>Point along perpendicular</string>
@ -1924,7 +1972,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/bisector.png</normaloff>:/toolicon/32x32/bisector.png</iconset>
<normaloff>:/toolicon/light/bisector.png</normaloff>:/toolicon/light/bisector.png</iconset>
</property>
<property name="text">
<string>Point along bisector</string>
@ -1942,7 +1990,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/shoulder.png</normaloff>:/toolicon/32x32/shoulder.png</iconset>
<normaloff>:/toolicon/light/shoulder.png</normaloff>:/toolicon/light/shoulder.png</iconset>
</property>
<property name="text">
<string>Special point on shoulder</string>
@ -1960,7 +2008,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/triangle.png</normaloff>:/toolicon/32x32/triangle.png</iconset>
<normaloff>:/toolicon/light/triangle.png</normaloff>:/toolicon/light/triangle.png</iconset>
</property>
<property name="text">
<string>Triangle tool</string>
@ -1978,7 +2026,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/point_of_intersection.png</normaloff>:/toolicon/32x32/point_of_intersection.png</iconset>
<normaloff>:/toolicon/light/point_of_intersection.png</normaloff>:/toolicon/light/point_of_intersection.png</iconset>
</property>
<property name="text">
<string>Point from X and Y of two other points</string>
@ -1996,7 +2044,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/height.png</normaloff>:/toolicon/32x32/height.png</iconset>
<normaloff>:/toolicon/light/height.png</normaloff>:/toolicon/light/height.png</iconset>
</property>
<property name="text">
<string>Perpendicular point along line</string>
@ -2014,7 +2062,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/line_intersect_axis.png</normaloff>:/toolicon/32x32/line_intersect_axis.png</iconset>
<normaloff>:/toolicon/light/line_intersect_axis.png</normaloff>:/toolicon/light/line_intersect_axis.png</iconset>
</property>
<property name="text">
<string>Point intersect line and axis</string>
@ -2032,7 +2080,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/midpoint.png</normaloff>:/toolicon/32x32/midpoint.png</iconset>
<normaloff>:/toolicon/light/midpoint.png</normaloff>:/toolicon/light/midpoint.png</iconset>
</property>
<property name="text">
<string>Midpoint between two points</string>
@ -2050,7 +2098,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/intersect.png</normaloff>:/toolicon/32x32/intersect.png</iconset>
<normaloff>:/toolicon/light/intersect.png</normaloff>:/toolicon/light/intersect.png</iconset>
</property>
<property name="text">
<string>Point at line intersection</string>
@ -2068,7 +2116,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/line.png</normaloff>:/toolicon/32x32/line.png</iconset>
<normaloff>:/toolicon/light/line.png</normaloff>:/toolicon/light/line.png</iconset>
</property>
<property name="text">
<string>Line between points</string>
@ -2086,7 +2134,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/spline.png</normaloff>:/toolicon/32x32/spline.png</iconset>
<normaloff>:/toolicon/light/spline.png</normaloff>:/toolicon/light/spline.png</iconset>
</property>
<property name="text">
<string>Simple curve</string>
@ -2104,7 +2152,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/spline_cut_point.png</normaloff>:/toolicon/32x32/spline_cut_point.png</iconset>
<normaloff>:/toolicon/light/spline_cut_point.png</normaloff>:/toolicon/light/spline_cut_point.png</iconset>
</property>
<property name="text">
<string>Segmenting a simple curve</string>
@ -2122,7 +2170,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/cubic_bezier.png</normaloff>:/toolicon/32x32/cubic_bezier.png</iconset>
<normaloff>:/toolicon/light/cubic_bezier.png</normaloff>:/toolicon/light/cubic_bezier.png</iconset>
</property>
<property name="text">
<string>Curve tool which uses point as control handle</string>
@ -2140,7 +2188,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/splinePath.png</normaloff>:/toolicon/32x32/splinePath.png</iconset>
<normaloff>:/toolicon/light/splinePath.png</normaloff>:/toolicon/light/splinePath.png</iconset>
</property>
<property name="text">
<string>Curved path</string>
@ -2158,7 +2206,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/el_arc.png</normaloff>:/toolicon/32x32/el_arc.png</iconset>
<normaloff>:/toolicon/light/el_arc.png</normaloff>:/toolicon/light/el_arc.png</iconset>
</property>
<property name="text">
<string>Elliptical Arc</string>
@ -2176,7 +2224,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/arc_with_length.png</normaloff>:/toolicon/32x32/arc_with_length.png</iconset>
<normaloff>:/toolicon/light/arc_with_length.png</normaloff>:/toolicon/light/arc_with_length.png</iconset>
</property>
<property name="text">
<string>Arc with given length</string>
@ -2194,7 +2242,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/point_of_intersection_circles.png</normaloff>:/toolicon/32x32/point_of_intersection_circles.png</iconset>
<normaloff>:/toolicon/light/point_of_intersection_circles.png</normaloff>:/toolicon/light/point_of_intersection_circles.png</iconset>
</property>
<property name="text">
<string>Point of intersection circles</string>
@ -2212,7 +2260,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/point_from_arc_and_tangent.png</normaloff>:/toolicon/32x32/point_from_arc_and_tangent.png</iconset>
<normaloff>:/toolicon/light/point_from_arc_and_tangent.png</normaloff>:/toolicon/light/point_from_arc_and_tangent.png</iconset>
</property>
<property name="text">
<string>Point from arc and tangent</string>
@ -2230,7 +2278,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/point_from_circle_and_tangent.png</normaloff>:/toolicon/32x32/point_from_circle_and_tangent.png</iconset>
<normaloff>:/toolicon/light/point_from_circle_and_tangent.png</normaloff>:/toolicon/light/point_from_circle_and_tangent.png</iconset>
</property>
<property name="text">
<string>Point from circle and tangent</string>
@ -2248,7 +2296,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/point_of_contact.png</normaloff>:/toolicon/32x32/point_of_contact.png</iconset>
<normaloff>:/toolicon/light/point_of_contact.png</normaloff>:/toolicon/light/point_of_contact.png</iconset>
</property>
<property name="text">
<string>Point of intersection circle and segment</string>
@ -2266,7 +2314,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/flipping_axis.png</normaloff>:/toolicon/32x32/flipping_axis.png</iconset>
<normaloff>:/toolicon/light/flipping_axis.png</normaloff>:/toolicon/light/flipping_axis.png</iconset>
</property>
<property name="text">
<string>Flipping objects by axis</string>
@ -2284,7 +2332,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/flipping_line.png</normaloff>:/toolicon/32x32/flipping_line.png</iconset>
<normaloff>:/toolicon/light/flipping_line.png</normaloff>:/toolicon/light/flipping_line.png</iconset>
</property>
<property name="text">
<string>Flipping objects by line</string>
@ -2302,7 +2350,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/rotation.png</normaloff>:/toolicon/32x32/rotation.png</iconset>
<normaloff>:/toolicon/light/rotation.png</normaloff>:/toolicon/light/rotation.png</iconset>
</property>
<property name="text">
<string>Rotate objects</string>
@ -2320,7 +2368,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/move.png</normaloff>:/toolicon/32x32/move.png</iconset>
<normaloff>:/toolicon/light/move.png</normaloff>:/toolicon/light/move.png</iconset>
</property>
<property name="text">
<string>Move objects</string>
@ -2338,7 +2386,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/group_plus.png</normaloff>:/toolicon/32x32/group_plus.png</iconset>
<normaloff>:/toolicon/light/group_plus.png</normaloff>:/toolicon/light/group_plus.png</iconset>
</property>
<property name="text">
<string>Visibility group</string>
@ -2356,7 +2404,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/true_darts.png</normaloff>:/toolicon/32x32/true_darts.png</iconset>
<normaloff>:/toolicon/light/true_darts.png</normaloff>:/toolicon/light/true_darts.png</iconset>
</property>
<property name="text">
<string>True darts</string>
@ -2392,7 +2440,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/new_detail.png</normaloff>:/toolicon/32x32/new_detail.png</iconset>
<normaloff>:/toolicon/light/new_detail.png</normaloff>:/toolicon/light/new_detail.png</iconset>
</property>
<property name="text">
<string>Workpiece tool</string>
@ -2410,7 +2458,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/union.png</normaloff>:/toolicon/32x32/union.png</iconset>
<normaloff>:/toolicon/light/union.png</normaloff>:/toolicon/light/union.png</iconset>
</property>
<property name="text">
<string>Union tool</string>
@ -2428,7 +2476,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/duplicate_detail.png</normaloff>:/toolicon/32x32/duplicate_detail.png</iconset>
<normaloff>:/toolicon/light/duplicate_detail.png</normaloff>:/toolicon/light/duplicate_detail.png</iconset>
</property>
<property name="text">
<string>Duplicate detail tool</string>
@ -2446,7 +2494,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/path.png</normaloff>:/toolicon/32x32/path.png</iconset>
<normaloff>:/toolicon/light/path.png</normaloff>:/toolicon/light/path.png</iconset>
</property>
<property name="text">
<string>Internal path tool</string>
@ -2464,7 +2512,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/pin.png</normaloff>:/toolicon/32x32/pin.png</iconset>
<normaloff>:/toolicon/light/pin.png</normaloff>:/toolicon/light/pin.png</iconset>
</property>
<property name="text">
<string>Pin tool</string>
@ -2482,7 +2530,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/insert_node.png</normaloff>:/toolicon/32x32/insert_node.png</iconset>
<normaloff>:/toolicon/light/insert_node.png</normaloff>:/toolicon/light/insert_node.png</iconset>
</property>
<property name="text">
<string>Insert node tool</string>
@ -2500,7 +2548,7 @@
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/place_label.png</normaloff>:/toolicon/32x32/place_label.png</iconset>
<normaloff>:/toolicon/light/place_label.png</normaloff>:/toolicon/light/place_label.png</iconset>
</property>
<property name="text">
<string>Place label tool</string>
@ -2530,6 +2578,11 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>VPlainTextEdit</class>
<extends>QPlainTextEdit</extends>
<header>../vwidgets/vplaintextedit.h</header>
</customwidget>
<customwidget>
<class>VMainGraphicsView</class>
<extends>QGraphicsView</extends>
@ -2540,11 +2593,6 @@
<extends>QLineEdit</extends>
<header>../vwidgets/vlineedit.h</header>
</customwidget>
<customwidget>
<class>VPlainTextEdit</class>
<extends>QPlainTextEdit</extends>
<header>../vwidgets/vplaintextedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="share/resources/toolicon.qrc"/>

View File

@ -1,92 +1,178 @@
<RCC>
<qresource prefix="/">
<file>cursor/endline_cursor.png</file>
<file>cursor/endline_cursor@2x.png</file>
<file>cursor/line_cursor.png</file>
<file>cursor/line_cursor@2x.png</file>
<file>cursor/alongline_cursor.png</file>
<file>cursor/alongline_cursor@2x.png</file>
<file>cursor/shoulder_cursor.png</file>
<file>cursor/shoulder_cursor@2x.png</file>
<file>cursor/normal_cursor.png</file>
<file>cursor/normal_cursor@2x.png</file>
<file>cursor/bisector_cursor.png</file>
<file>cursor/bisector_cursor@2x.png</file>
<file>cursor/intersect_cursor.png</file>
<file>cursor/intersect_cursor@2x.png</file>
<file>cursor/spline_cursor.png</file>
<file>cursor/spline_cursor@2x.png</file>
<file>cursor/arc_cursor.png</file>
<file>cursor/arc_cursor@2x.png</file>
<file>cursor/splinepath_cursor.png</file>
<file>cursor/splinepath_cursor@2x.png</file>
<file>cursor/pointcontact_cursor.png</file>
<file>cursor/pointcontact_cursor@2x.png</file>
<file>cursor/new_detail_cursor.png</file>
<file>cursor/new_detail_cursor@2x.png</file>
<file>cursor/height_cursor.png</file>
<file>cursor/height_cursor@2x.png</file>
<file>cursor/triangle_cursor.png</file>
<file>cursor/triangle_cursor@2x.png</file>
<file>cursor/pointofintersect_cursor.png</file>
<file>cursor/pointofintersect_cursor@2x.png</file>
<file>cursor/spline_cut_point_cursor.png</file>
<file>cursor/spline_cut_point_cursor@2x.png</file>
<file>cursor/splinepath_cut_point_cursor.png</file>
<file>cursor/splinepath_cut_point_cursor@2x.png</file>
<file>cursor/union_cursor.png</file>
<file>cursor/union_cursor@2x.png</file>
<file>cursor/arc_cut_cursor.png</file>
<file>cursor/arc_cut_cursor@2x.png</file>
<file>cursor/cursor-arrow-closehand.png</file>
<file>cursor/cursor-arrow-openhand.png</file>
<file>cursor/line_intersect_axis_cursor.png</file>
<file>cursor/line_intersect_axis_cursor@2x.png</file>
<file>cursor/arc_intersect_axis_cursor.png</file>
<file>cursor/arc_intersect_axis_cursor@2x.png</file>
<file>cursor/curve_intersect_axis_cursor.png</file>
<file>cursor/curve_intersect_axis_cursor@2x.png</file>
<file>cursor/point_of_intersection_arcs.png</file>
<file>cursor/point_of_intersection_arcs@2x.png</file>
<file>cursor/point_of_intersection_circles.png</file>
<file>cursor/point_of_intersection_circles@2x.png</file>
<file>cursor/point_from_circle_and_tangent_cursor.png</file>
<file>cursor/point_from_circle_and_tangent_cursor@2x.png</file>
<file>cursor/point_from_arc_and_tangent_cursor.png</file>
<file>cursor/point_from_arc_and_tangent_cursor@2x.png</file>
<file>cursor/arc_with_length_cursor.png</file>
<file>cursor/arc_with_length_cursor@2x.png</file>
<file>cursor/true_darts_cursor.png</file>
<file>cursor/true_darts_cursor@2x.png</file>
<file>cursor/intersection_curves_cursor.png</file>
<file>cursor/intersection_curves_cursor@2x.png</file>
<file>cursor/cubic_bezier_cursor.png</file>
<file>cursor/cubic_bezier_cursor@2x.png</file>
<file>cursor/cubic_bezier_path_cursor.png</file>
<file>cursor/cubic_bezier_path_cursor@2x.png</file>
<file>cursor/group_plus_cursor.png</file>
<file>cursor/group_plus_cursor@2x.png</file>
<file>cursor/rotation_cursor.png</file>
<file>cursor/rotation_cursor@2x.png</file>
<file>cursor/midpoint_cursor.png</file>
<file>cursor/midpoint_cursor@2x.png</file>
<file>cursor/flipping_line_cursor@2x.png</file>
<file>cursor/flipping_line_cursor.png</file>
<file>cursor/flipping_axis_cursor.png</file>
<file>cursor/flipping_axis_cursor@2x.png</file>
<file>cursor/move_cursor.png</file>
<file>cursor/move_cursor@2x.png</file>
<file>cursor/el_arc_cursor.png</file>
<file>cursor/el_arc_cursor@2x.png</file>
<file>cursor/path_cursor.png</file>
<file>cursor/path_cursor@2x.png</file>
<file>cursor/pin_cursor.png</file>
<file>cursor/pin_cursor@2x.png</file>
<file>cursor/insert_node_cursor.png</file>
<file>cursor/insert_node_cursor@2x.png</file>
<file>cursor/place_label_cursor@2x.png</file>
<file>cursor/place_label_cursor.png</file>
<file>cursor/duplicate_detail_cursor.png</file>
<file>cursor/duplicate_detail_cursor@2x.png</file>
<file>cursor/light/segment_cursor.png</file>
<file>cursor/light/segment_cursor@2x.png</file>
<file>cursor/light/line_cursor.png</file>
<file>cursor/light/line_cursor@2x.png</file>
<file>cursor/light/along_line_cursor.png</file>
<file>cursor/light/along_line_cursor@2x.png</file>
<file>cursor/light/shoulder_cursor.png</file>
<file>cursor/light/shoulder_cursor@2x.png</file>
<file>cursor/light/normal_cursor.png</file>
<file>cursor/light/normal_cursor@2x.png</file>
<file>cursor/light/bisector_cursor.png</file>
<file>cursor/light/bisector_cursor@2x.png</file>
<file>cursor/light/intersect_cursor.png</file>
<file>cursor/light/intersect_cursor@2x.png</file>
<file>cursor/light/spline_cursor.png</file>
<file>cursor/light/spline_cursor@2x.png</file>
<file>cursor/light/arc_cursor.png</file>
<file>cursor/light/arc_cursor@2x.png</file>
<file>cursor/light/splinePath_cursor.png</file>
<file>cursor/light/splinePath_cursor@2x.png</file>
<file>cursor/light/point_of_contact_cursor.png</file>
<file>cursor/light/point_of_contact_cursor@2x.png</file>
<file>cursor/light/new_detail_cursor.png</file>
<file>cursor/light/new_detail_cursor@2x.png</file>
<file>cursor/light/height_cursor.png</file>
<file>cursor/light/height_cursor@2x.png</file>
<file>cursor/light/triangle_cursor.png</file>
<file>cursor/light/triangle_cursor@2x.png</file>
<file>cursor/light/point_of_intersection_cursor.png</file>
<file>cursor/light/point_of_intersection_cursor@2x.png</file>
<file>cursor/light/spline_cut_point_cursor.png</file>
<file>cursor/light/spline_cut_point_cursor@2x.png</file>
<file>cursor/light/splinePath_cut_point_cursor.png</file>
<file>cursor/light/splinePath_cut_point_cursor@2x.png</file>
<file>cursor/light/union_cursor.png</file>
<file>cursor/light/union_cursor@2x.png</file>
<file>cursor/light/arc_cut_cursor.png</file>
<file>cursor/light/arc_cut_cursor@2x.png</file>
<file>cursor/light/line_intersect_axis_cursor.png</file>
<file>cursor/light/line_intersect_axis_cursor@2x.png</file>
<file>cursor/light/arc_intersect_axis_cursor.png</file>
<file>cursor/light/arc_intersect_axis_cursor@2x.png</file>
<file>cursor/light/curve_intersect_axis_cursor.png</file>
<file>cursor/light/curve_intersect_axis_cursor@2x.png</file>
<file>cursor/light/point_of_intersection_arcs_cursor.png</file>
<file>cursor/light/point_of_intersection_arcs_cursor@2x.png</file>
<file>cursor/light/point_of_intersection_circles_cursor.png</file>
<file>cursor/light/point_of_intersection_circles_cursor@2x.png</file>
<file>cursor/light/point_from_circle_and_tangent_cursor.png</file>
<file>cursor/light/point_from_circle_and_tangent_cursor@2x.png</file>
<file>cursor/light/point_from_arc_and_tangent_cursor.png</file>
<file>cursor/light/point_from_arc_and_tangent_cursor@2x.png</file>
<file>cursor/light/arc_with_length_cursor.png</file>
<file>cursor/light/arc_with_length_cursor@2x.png</file>
<file>cursor/light/true_darts_cursor.png</file>
<file>cursor/light/true_darts_cursor@2x.png</file>
<file>cursor/light/intersection_curves_cursor.png</file>
<file>cursor/light/intersection_curves_cursor@2x.png</file>
<file>cursor/light/cubic_bezier_cursor.png</file>
<file>cursor/light/cubic_bezier_cursor@2x.png</file>
<file>cursor/light/cubic_bezier_path_cursor.png</file>
<file>cursor/light/cubic_bezier_path_cursor@2x.png</file>
<file>cursor/light/group_plus_cursor.png</file>
<file>cursor/light/group_plus_cursor@2x.png</file>
<file>cursor/light/rotation_cursor.png</file>
<file>cursor/light/rotation_cursor@2x.png</file>
<file>cursor/light/midpoint_cursor.png</file>
<file>cursor/light/midpoint_cursor@2x.png</file>
<file>cursor/light/flipping_line_cursor@2x.png</file>
<file>cursor/light/flipping_line_cursor.png</file>
<file>cursor/light/flipping_axis_cursor.png</file>
<file>cursor/light/flipping_axis_cursor@2x.png</file>
<file>cursor/light/move_cursor.png</file>
<file>cursor/light/move_cursor@2x.png</file>
<file>cursor/light/el_arc_cursor.png</file>
<file>cursor/light/el_arc_cursor@2x.png</file>
<file>cursor/light/path_cursor.png</file>
<file>cursor/light/path_cursor@2x.png</file>
<file>cursor/light/pin_cursor.png</file>
<file>cursor/light/pin_cursor@2x.png</file>
<file>cursor/light/insert_node_cursor.png</file>
<file>cursor/light/insert_node_cursor@2x.png</file>
<file>cursor/light/place_label_cursor@2x.png</file>
<file>cursor/light/place_label_cursor.png</file>
<file>cursor/light/duplicate_detail_cursor.png</file>
<file>cursor/light/duplicate_detail_cursor@2x.png</file>
<file>cursor/dark/union_cursor.png</file>
<file>cursor/dark/union_cursor@2x.png</file>
<file>cursor/dark/true_darts_cursor.png</file>
<file>cursor/dark/true_darts_cursor@2x.png</file>
<file>cursor/dark/triangle_cursor.png</file>
<file>cursor/dark/triangle_cursor@2x.png</file>
<file>cursor/dark/splinePath_cut_point_cursor.png</file>
<file>cursor/dark/splinePath_cut_point_cursor@2x.png</file>
<file>cursor/dark/splinePath_cursor.png</file>
<file>cursor/dark/splinePath_cursor@2x.png</file>
<file>cursor/dark/spline_cut_point_cursor.png</file>
<file>cursor/dark/spline_cut_point_cursor@2x.png</file>
<file>cursor/dark/spline_cursor.png</file>
<file>cursor/dark/spline_cursor@2x.png</file>
<file>cursor/dark/shoulder_cursor.png</file>
<file>cursor/dark/shoulder_cursor@2x.png</file>
<file>cursor/dark/segment_cursor.png</file>
<file>cursor/dark/segment_cursor@2x.png</file>
<file>cursor/dark/rotation_cursor.png</file>
<file>cursor/dark/rotation_cursor@2x.png</file>
<file>cursor/dark/point_of_intersection_circles_cursor.png</file>
<file>cursor/dark/point_of_intersection_circles_cursor@2x.png</file>
<file>cursor/dark/point_of_intersection_arcs_cursor.png</file>
<file>cursor/dark/point_of_intersection_arcs_cursor@2x.png</file>
<file>cursor/dark/point_of_intersection_cursor.png</file>
<file>cursor/dark/point_of_intersection_cursor@2x.png</file>
<file>cursor/dark/point_of_contact_cursor.png</file>
<file>cursor/dark/point_of_contact_cursor@2x.png</file>
<file>cursor/dark/point_from_circle_and_tangent_cursor.png</file>
<file>cursor/dark/point_from_circle_and_tangent_cursor@2x.png</file>
<file>cursor/dark/point_from_arc_and_tangent_cursor.png</file>
<file>cursor/dark/point_from_arc_and_tangent_cursor@2x.png</file>
<file>cursor/dark/place_label_cursor.png</file>
<file>cursor/dark/place_label_cursor@2x.png</file>
<file>cursor/dark/pin_cursor.png</file>
<file>cursor/dark/pin_cursor@2x.png</file>
<file>cursor/dark/path_cursor.png</file>
<file>cursor/dark/path_cursor@2x.png</file>
<file>cursor/dark/normal_cursor.png</file>
<file>cursor/dark/normal_cursor@2x.png</file>
<file>cursor/dark/new_detail_cursor.png</file>
<file>cursor/dark/new_detail_cursor@2x.png</file>
<file>cursor/dark/move_cursor.png</file>
<file>cursor/dark/move_cursor@2x.png</file>
<file>cursor/dark/midpoint_cursor.png</file>
<file>cursor/dark/midpoint_cursor@2x.png</file>
<file>cursor/dark/line_intersect_axis_cursor.png</file>
<file>cursor/dark/line_intersect_axis_cursor@2x.png</file>
<file>cursor/dark/line_cursor.png</file>
<file>cursor/dark/line_cursor@2x.png</file>
<file>cursor/dark/intersection_curves_cursor.png</file>
<file>cursor/dark/intersection_curves_cursor@2x.png</file>
<file>cursor/dark/intersect_cursor.png</file>
<file>cursor/dark/intersect_cursor@2x.png</file>
<file>cursor/dark/insert_node_cursor.png</file>
<file>cursor/dark/insert_node_cursor@2x.png</file>
<file>cursor/dark/height_cursor.png</file>
<file>cursor/dark/height_cursor@2x.png</file>
<file>cursor/dark/group_plus_cursor.png</file>
<file>cursor/dark/group_plus_cursor@2x.png</file>
<file>cursor/dark/flipping_line_cursor.png</file>
<file>cursor/dark/flipping_line_cursor@2x.png</file>
<file>cursor/dark/flipping_axis_cursor.png</file>
<file>cursor/dark/flipping_axis_cursor@2x.png</file>
<file>cursor/dark/el_arc_cursor.png</file>
<file>cursor/dark/el_arc_cursor@2x.png</file>
<file>cursor/dark/duplicate_detail_cursor.png</file>
<file>cursor/dark/duplicate_detail_cursor@2x.png</file>
<file>cursor/dark/curve_intersect_axis_cursor.png</file>
<file>cursor/dark/curve_intersect_axis_cursor@2x.png</file>
<file>cursor/dark/cubic_bezier_path_cursor.png</file>
<file>cursor/dark/cubic_bezier_path_cursor@2x.png</file>
<file>cursor/dark/cubic_bezier_cursor.png</file>
<file>cursor/dark/cubic_bezier_cursor@2x.png</file>
<file>cursor/dark/bisector_cursor.png</file>
<file>cursor/dark/bisector_cursor@2x.png</file>
<file>cursor/dark/arc_with_length_cursor.png</file>
<file>cursor/dark/arc_with_length_cursor@2x.png</file>
<file>cursor/dark/arc_intersect_axis_cursor.png</file>
<file>cursor/dark/arc_intersect_axis_cursor@2x.png</file>
<file>cursor/dark/arc_cut_cursor.png</file>
<file>cursor/dark/arc_cut_cursor@2x.png</file>
<file>cursor/dark/arc_cursor.png</file>
<file>cursor/dark/arc_cursor@2x.png</file>
<file>cursor/dark/along_line_cursor.png</file>
<file>cursor/dark/along_line_cursor@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Some files were not shown because too many files have changed in this diff Show More