Known measurements editor.
This commit is contained in:
parent
c7620ef60c
commit
32c10a4b39
|
@ -64,6 +64,7 @@ void PuzzlePreferencesPathPage::Apply()
|
||||||
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
settings->SetPathSVGFonts(ui->pathTable->item(0, 1)->text());
|
settings->SetPathSVGFonts(ui->pathTable->item(0, 1)->text());
|
||||||
settings->SetPathFontCorrections(ui->pathTable->item(1, 1)->text());
|
settings->SetPathFontCorrections(ui->pathTable->item(1, 1)->text());
|
||||||
|
settings->SetPathKnownMeasurements(ui->pathTable->item(1, 1)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -95,6 +96,9 @@ void PuzzlePreferencesPathPage::DefaultPath()
|
||||||
case 1: // font corrections
|
case 1: // font corrections
|
||||||
path = VCommonSettings::GetDefPathFontCorrections();
|
path = VCommonSettings::GetDefPathFontCorrections();
|
||||||
break;
|
break;
|
||||||
|
case 2: // known measurements
|
||||||
|
path = VCommonSettings::GetDefPathKnownMeasurements();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +123,9 @@ void PuzzlePreferencesPathPage::EditPath()
|
||||||
case 1: // font corrections
|
case 1: // font corrections
|
||||||
path = VPApplication::VApp()->PuzzleSettings()->GetPathFontCorrections();
|
path = VPApplication::VApp()->PuzzleSettings()->GetPathFontCorrections();
|
||||||
break;
|
break;
|
||||||
|
case 2: // known measurements
|
||||||
|
path = VPApplication::VApp()->PuzzleSettings()->GetDefPathKnownMeasurements();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +159,7 @@ void PuzzlePreferencesPathPage::EditPath()
|
||||||
void PuzzlePreferencesPathPage::InitTable()
|
void PuzzlePreferencesPathPage::InitTable()
|
||||||
{
|
{
|
||||||
ui->pathTable->clearContents();
|
ui->pathTable->clearContents();
|
||||||
ui->pathTable->setRowCount(2);
|
ui->pathTable->setRowCount(3);
|
||||||
ui->pathTable->setColumnCount(2);
|
ui->pathTable->setColumnCount(2);
|
||||||
|
|
||||||
const VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
const VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
|
||||||
|
@ -171,6 +178,13 @@ void PuzzlePreferencesPathPage::InitTable()
|
||||||
ui->pathTable->setItem(1, 1, item);
|
ui->pathTable->setItem(1, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->pathTable->setItem(2, 0, new QTableWidgetItem(tr("My known measurements")));
|
||||||
|
auto *item = new QTableWidgetItem(settings->GetPathKnownMeasurements());
|
||||||
|
item->setToolTip(settings->GetPathKnownMeasurements());
|
||||||
|
ui->pathTable->setItem(2, 1, item);
|
||||||
|
}
|
||||||
|
|
||||||
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
||||||
ui->pathTable->resizeColumnsToContents();
|
ui->pathTable->resizeColumnsToContents();
|
||||||
ui->pathTable->resizeRowsToContents();
|
ui->pathTable->resizeRowsToContents();
|
||||||
|
|
|
@ -1636,7 +1636,7 @@ void VPMainWindow::UpdateWindowTitle()
|
||||||
QString showName;
|
QString showName;
|
||||||
if (not curFile.isEmpty())
|
if (not curFile.isEmpty())
|
||||||
{
|
{
|
||||||
showName = StrippedName(curFile);
|
showName = QFileInfo(curFile).fileName();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,22 +162,22 @@ auto TapePreferencesConfigurationPage::Apply() -> QStringList
|
||||||
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());
|
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_langChanged || m_systemChanged)
|
if (m_systemChanged)
|
||||||
|
{
|
||||||
|
const auto id = ui->comboBoxKnownMeasurements->currentData().toUuid();
|
||||||
|
settings->SetKnownMeasurementsId(id);
|
||||||
|
m_systemChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_langChanged)
|
||||||
{
|
{
|
||||||
const auto locale = qvariant_cast<QString>(ui->langCombo->currentData());
|
const auto locale = qvariant_cast<QString>(ui->langCombo->currentData());
|
||||||
settings->SetLocale(locale);
|
settings->SetLocale(locale);
|
||||||
VGAnalytics::Instance()->SetGUILanguage(settings->GetLocale());
|
VGAnalytics::Instance()->SetGUILanguage(settings->GetLocale());
|
||||||
m_langChanged = false;
|
m_langChanged = false;
|
||||||
|
|
||||||
const auto id = ui->comboBoxKnownMeasurements->currentData().toUuid();
|
|
||||||
settings->SetKnownMeasurementsId(id);
|
|
||||||
m_systemChanged = false;
|
|
||||||
|
|
||||||
VAbstractApplication::VApp()->LoadTranslation(locale);
|
VAbstractApplication::VApp()->LoadTranslation(locale);
|
||||||
QCoreApplication::processEvents(); // force to call changeEvent
|
QCoreApplication::processEvents(); // force to call changeEvent
|
||||||
|
|
||||||
// Part about measurments will not be updated automatically
|
|
||||||
MApplication::VApp()->RetranslateTables();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->IsAutomaticallyCheckUpdates() != ui->checkBoxAutomaticallyCheckUpdates->isChecked())
|
if (settings->IsAutomaticallyCheckUpdates() != ui->checkBoxAutomaticallyCheckUpdates->isChecked())
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>96</width>
|
<width>96</width>
|
||||||
<height>84</height>
|
<height>96</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="textElideMode">
|
<property name="textElideMode">
|
||||||
|
|
|
@ -41,7 +41,9 @@
|
||||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||||
#include "../vmisc/theme/vtheme.h"
|
#include "../vmisc/theme/vtheme.h"
|
||||||
#include "../vmisc/vsysexits.h"
|
#include "../vmisc/vsysexits.h"
|
||||||
#include "qtpreprocessorsupport.h"
|
#include "dialogs/dialogtapepreferences.h"
|
||||||
|
#include "qfuturewatcher.h"
|
||||||
|
#include "tkmmainwindow.h"
|
||||||
#include "tmainwindow.h"
|
#include "tmainwindow.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "vtapeshortcutmanager.h"
|
#include "vtapeshortcutmanager.h"
|
||||||
|
@ -106,6 +108,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_C, ('c'_L1))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_UNITS, ("units"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_UNITS, ("units"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_UNITS, ('u'_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_UNITS, ('u'_L1)) // NOLINT
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_KNOWN, ("known"_L1)) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_KNOWN, ('k'_L1)) // NOLINT
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_TEST, ("test"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_TEST, ("test"_L1)) // NOLINT
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -308,7 +313,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
MApplication::MApplication(int &argc, char **argv)
|
MApplication::MApplication(int &argc, char **argv)
|
||||||
: VAbstractApplication(argc, argv)
|
: VAbstractApplication(argc, argv),
|
||||||
|
m_knownMeasurementsRepopulateWatcher(new QFutureWatcher<void>(this))
|
||||||
{
|
{
|
||||||
setApplicationDisplayName(QStringLiteral(VER_PRODUCTNAME_STR));
|
setApplicationDisplayName(QStringLiteral(VER_PRODUCTNAME_STR));
|
||||||
setApplicationName(QStringLiteral(VER_INTERNALNAME_STR));
|
setApplicationName(QStringLiteral(VER_INTERNALNAME_STR));
|
||||||
|
@ -338,6 +344,7 @@ MApplication::~MApplication()
|
||||||
}
|
}
|
||||||
|
|
||||||
qDeleteAll(m_mainWindows);
|
qDeleteAll(m_mainWindows);
|
||||||
|
qDeleteAll(m_kmMainWindows);
|
||||||
|
|
||||||
delete m_trVars;
|
delete m_trVars;
|
||||||
if (not m_dataBase.isNull())
|
if (not m_dataBase.isNull())
|
||||||
|
@ -440,20 +447,20 @@ auto MApplication::IsAppInGUIMode() const -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto MApplication::MainWindow() -> TMainWindow *
|
auto MApplication::MainTapeWindow() -> TMainWindow *
|
||||||
{
|
{
|
||||||
Clean();
|
CleanTapeWindows();
|
||||||
if (m_mainWindows.isEmpty())
|
if (m_mainWindows.isEmpty())
|
||||||
{
|
{
|
||||||
NewMainWindow();
|
NewMainTapeWindow();
|
||||||
}
|
}
|
||||||
return m_mainWindows[0];
|
return m_mainWindows.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto MApplication::MainWindows() -> QList<TMainWindow *>
|
auto MApplication::MainTapeWindows() -> QList<TMainWindow *>
|
||||||
{
|
{
|
||||||
Clean();
|
CleanTapeWindows();
|
||||||
QList<TMainWindow *> list;
|
QList<TMainWindow *> list;
|
||||||
list.reserve(m_mainWindows.size());
|
list.reserve(m_mainWindows.size());
|
||||||
for (auto &w : m_mainWindows)
|
for (auto &w : m_mainWindows)
|
||||||
|
@ -539,7 +546,7 @@ auto MApplication::event(QEvent *e) -> bool
|
||||||
const QString macFileOpen = fileOpenEvent->file();
|
const QString macFileOpen = fileOpenEvent->file();
|
||||||
if (not macFileOpen.isEmpty())
|
if (not macFileOpen.isEmpty())
|
||||||
{
|
{
|
||||||
TMainWindow *mw = MainWindow();
|
TMainWindow *mw = MainTapeWindow();
|
||||||
if (mw)
|
if (mw)
|
||||||
{
|
{
|
||||||
mw->LoadFile(macFileOpen); // open file in existing window
|
mw->LoadFile(macFileOpen); // open file in existing window
|
||||||
|
@ -591,16 +598,6 @@ auto MApplication::TapeSettings() -> VTapeSettings *
|
||||||
return qobject_cast<VTapeSettings *>(settings);
|
return qobject_cast<VTapeSettings *>(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void MApplication::RetranslateTables()
|
|
||||||
{
|
|
||||||
const QList<TMainWindow *> list = MainWindows();
|
|
||||||
for (auto *w : list)
|
|
||||||
{
|
|
||||||
w->RetranslateTable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
|
void MApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
|
||||||
{
|
{
|
||||||
|
@ -614,6 +611,7 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
|
||||||
parser.process(arguments);
|
parser.process(arguments);
|
||||||
|
|
||||||
m_testMode = parser.isSet(*LONG_OPTION_TEST);
|
m_testMode = parser.isSet(*LONG_OPTION_TEST);
|
||||||
|
m_knownMeasurementsMode = parser.isSet(*LONG_OPTION_KNOWN);
|
||||||
|
|
||||||
if (not m_testMode && connection == SocketConnection::Client)
|
if (not m_testMode && connection == SocketConnection::Client)
|
||||||
{
|
{
|
||||||
|
@ -674,6 +672,52 @@ auto MApplication::KnownMeasurementsDatabase() -> VKnownMeasurementsDatabase *
|
||||||
return m_knownMeasurementsDatabase;
|
return m_knownMeasurementsDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MApplication::Preferences(QWidget *parent)
|
||||||
|
{
|
||||||
|
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
||||||
|
static QPointer<DialogTapePreferences> guard; // Prevent any second run
|
||||||
|
if (guard.isNull())
|
||||||
|
{
|
||||||
|
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
|
auto *preferences = new DialogTapePreferences(parent);
|
||||||
|
// QScopedPointer needs to be sure any exception will never block guard
|
||||||
|
QScopedPointer<DialogTapePreferences> dlg(preferences);
|
||||||
|
guard = preferences;
|
||||||
|
// Must be first
|
||||||
|
|
||||||
|
for (const auto &w : m_mainWindows)
|
||||||
|
{
|
||||||
|
if (!w.isNull())
|
||||||
|
{
|
||||||
|
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, w, &TMainWindow::WindowsLocale,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, w, &TMainWindow::ToolBarStyles,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &w : m_kmMainWindows)
|
||||||
|
{
|
||||||
|
if (!w.isNull())
|
||||||
|
{
|
||||||
|
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, w, &TKMMainWindow::WindowsLocale,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, w, &TKMMainWindow::ToolBarStyles,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QGuiApplication::restoreOverrideCursor();
|
||||||
|
dlg->exec();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
guard->raise();
|
||||||
|
guard->activateWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MApplication::RestartKnownMeasurementsDatabaseWatcher()
|
void MApplication::RestartKnownMeasurementsDatabaseWatcher()
|
||||||
{
|
{
|
||||||
|
@ -687,7 +731,7 @@ void MApplication::RestartKnownMeasurementsDatabaseWatcher()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto MApplication::NewMainWindow() -> TMainWindow *
|
auto MApplication::NewMainTapeWindow() -> TMainWindow *
|
||||||
{
|
{
|
||||||
auto *tape = new TMainWindow();
|
auto *tape = new TMainWindow();
|
||||||
m_mainWindows.prepend(tape);
|
m_mainWindows.prepend(tape);
|
||||||
|
@ -699,6 +743,43 @@ auto MApplication::NewMainWindow() -> TMainWindow *
|
||||||
return tape;
|
return tape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto MApplication::MainKMWindow() -> TKMMainWindow *
|
||||||
|
{
|
||||||
|
CleanKMWindows();
|
||||||
|
if (m_kmMainWindows.isEmpty())
|
||||||
|
{
|
||||||
|
NewMainKMWindow();
|
||||||
|
}
|
||||||
|
return m_kmMainWindows.first();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto MApplication::MainKMWindows() -> QList<TKMMainWindow *>
|
||||||
|
{
|
||||||
|
CleanKMWindows();
|
||||||
|
QList<TKMMainWindow *> list;
|
||||||
|
list.reserve(m_kmMainWindows.size());
|
||||||
|
for (auto &w : m_kmMainWindows)
|
||||||
|
{
|
||||||
|
list.append(w);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto MApplication::NewMainKMWindow() -> TKMMainWindow *
|
||||||
|
{
|
||||||
|
auto *known = new TKMMainWindow();
|
||||||
|
m_kmMainWindows.prepend(known);
|
||||||
|
if (not MApplication::VApp()->IsTestMode())
|
||||||
|
{
|
||||||
|
known->show();
|
||||||
|
known->UpdateWindowTitle();
|
||||||
|
}
|
||||||
|
return known;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MApplication::ProcessCMD()
|
void MApplication::ProcessCMD()
|
||||||
{
|
{
|
||||||
|
@ -730,8 +811,8 @@ void MApplication::NewLocalSocketConnection()
|
||||||
ParseCommandLine(SocketConnection::Server, arg.split(QStringLiteral(";;")));
|
ParseCommandLine(SocketConnection::Server, arg.split(QStringLiteral(";;")));
|
||||||
}
|
}
|
||||||
delete socket;
|
delete socket;
|
||||||
MainWindow()->raise();
|
MainTapeWindow()->raise();
|
||||||
MainWindow()->activateWindow();
|
MainTapeWindow()->activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -740,8 +821,10 @@ void MApplication::RepopulateMeasurementsDatabase(const QString &path)
|
||||||
Q_UNUSED(path)
|
Q_UNUSED(path)
|
||||||
if (m_knownMeasurementsDatabase != nullptr)
|
if (m_knownMeasurementsDatabase != nullptr)
|
||||||
{
|
{
|
||||||
QFuture<void> future =
|
m_knownMeasurementsRepopulateWatcher->setFuture(
|
||||||
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); });
|
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
|
||||||
|
QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher<void>::finished, this,
|
||||||
|
&MApplication::SyncKnownMeasurements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +842,19 @@ void MApplication::KnownMeasurementsPathChanged(const QString &oldPath, const QS
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MApplication::Clean()
|
void MApplication::SyncKnownMeasurements()
|
||||||
|
{
|
||||||
|
for (const auto &w : m_mainWindows)
|
||||||
|
{
|
||||||
|
if (!w.isNull())
|
||||||
|
{
|
||||||
|
w->SyncKnownMeasurements();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MApplication::CleanTapeWindows()
|
||||||
{
|
{
|
||||||
// cleanup any deleted main windows first
|
// cleanup any deleted main windows first
|
||||||
for (vsizetype i = m_mainWindows.count() - 1; i >= 0; --i)
|
for (vsizetype i = m_mainWindows.count() - 1; i >= 0; --i)
|
||||||
|
@ -771,6 +866,19 @@ void MApplication::Clean()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MApplication::CleanKMWindows()
|
||||||
|
{
|
||||||
|
// cleanup any deleted main windows first
|
||||||
|
for (vsizetype i = m_kmMainWindows.count() - 1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
if (m_kmMainWindows.at(i).isNull())
|
||||||
|
{
|
||||||
|
m_kmMainWindows.removeAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MApplication::InitParserOptions(QCommandLineParser &parser)
|
void MApplication::InitParserOptions(QCommandLineParser &parser)
|
||||||
{
|
{
|
||||||
|
@ -793,6 +901,8 @@ void MApplication::InitParserOptions(QCommandLineParser &parser)
|
||||||
tr("Set pattern file units: cm, mm, inch."),
|
tr("Set pattern file units: cm, mm, inch."),
|
||||||
tr("The pattern units")},
|
tr("The pattern units")},
|
||||||
|
|
||||||
|
{{*SINGLE_OPTION_KNOWN, *LONG_OPTION_KNOWN}, tr("Activate known measurements mode.")},
|
||||||
|
|
||||||
{*LONG_OPTION_TEST,
|
{*LONG_OPTION_TEST,
|
||||||
tr("Use for unit testing. Run the program and open a file without showing the main window.")},
|
tr("Use for unit testing. Run the program and open a file without showing the main window.")},
|
||||||
|
|
||||||
|
@ -840,6 +950,19 @@ auto MApplication::StartWithFiles(QCommandLineParser &parser) -> bool
|
||||||
parser.showHelp(V_EX_USAGE);
|
parser.showHelp(V_EX_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_knownMeasurementsMode)
|
||||||
|
{
|
||||||
|
return StartWithMeasurementFiles(parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
return StartWithKnownMeasurementFiles(parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto MApplication::StartWithMeasurementFiles(QCommandLineParser &parser) -> bool
|
||||||
|
{
|
||||||
|
const QStringList args = parser.positionalArguments();
|
||||||
|
|
||||||
bool flagDimensionA = false;
|
bool flagDimensionA = false;
|
||||||
bool flagDimensionB = false;
|
bool flagDimensionB = false;
|
||||||
bool flagDimensionC = false;
|
bool flagDimensionC = false;
|
||||||
|
@ -855,41 +978,57 @@ auto MApplication::StartWithFiles(QCommandLineParser &parser) -> bool
|
||||||
ParseDimensionCOption(parser, dimensionCValue, flagDimensionC);
|
ParseDimensionCOption(parser, dimensionCValue, flagDimensionC);
|
||||||
ParseUnitsOption(parser, unit, flagUnits);
|
ParseUnitsOption(parser, unit, flagUnits);
|
||||||
|
|
||||||
for (const auto &arg : args)
|
return std::all_of(args.begin(), args.end(),
|
||||||
|
[&](const auto &arg)
|
||||||
{
|
{
|
||||||
NewMainWindow();
|
NewMainTapeWindow();
|
||||||
if (not MainWindow()->LoadFile(arg))
|
if (not MainTapeWindow()->LoadFile(arg))
|
||||||
{
|
{
|
||||||
if (m_testMode)
|
delete MainTapeWindow();
|
||||||
{
|
return !m_testMode;
|
||||||
return false; // process only one input file
|
|
||||||
}
|
|
||||||
delete MainWindow();
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flagDimensionA)
|
if (flagDimensionA)
|
||||||
{
|
{
|
||||||
MainWindow()->SetDimensionABase(dimensionAValue);
|
MainTapeWindow()->SetDimensionABase(dimensionAValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flagDimensionB)
|
if (flagDimensionB)
|
||||||
{
|
{
|
||||||
MainWindow()->SetDimensionBBase(dimensionBValue);
|
MainTapeWindow()->SetDimensionBBase(dimensionBValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flagDimensionC)
|
if (flagDimensionC)
|
||||||
{
|
{
|
||||||
MainWindow()->SetDimensionCBase(dimensionCValue);
|
MainTapeWindow()->SetDimensionCBase(dimensionCValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flagUnits)
|
if (flagUnits)
|
||||||
{
|
{
|
||||||
MainWindow()->SetPUnit(unit);
|
MainTapeWindow()->SetPUnit(unit);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto MApplication::StartWithKnownMeasurementFiles(QCommandLineParser &parser) -> bool
|
||||||
|
{
|
||||||
|
const QStringList args = parser.positionalArguments();
|
||||||
|
|
||||||
|
return std::all_of(args.begin(), args.end(),
|
||||||
|
[&](const auto &arg)
|
||||||
|
{
|
||||||
|
NewMainKMWindow();
|
||||||
|
if (not MainKMWindow()->LoadFile(arg))
|
||||||
|
{
|
||||||
|
delete MainKMWindow();
|
||||||
|
return !m_testMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -897,7 +1036,14 @@ auto MApplication::SingleStart(QCommandLineParser &parser) -> bool
|
||||||
{
|
{
|
||||||
if (not m_testMode)
|
if (not m_testMode)
|
||||||
{
|
{
|
||||||
NewMainWindow();
|
if (!m_knownMeasurementsMode)
|
||||||
|
{
|
||||||
|
NewMainTapeWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NewMainKMWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,10 @@
|
||||||
#include "dialogs/dialogmdatabase.h"
|
#include "dialogs/dialogmdatabase.h"
|
||||||
#include "vtapesettings.h"
|
#include "vtapesettings.h"
|
||||||
|
|
||||||
|
#include <QFutureWatcher>
|
||||||
|
|
||||||
class TMainWindow;
|
class TMainWindow;
|
||||||
|
class TKMMainWindow;
|
||||||
class QLocalServer;
|
class QLocalServer;
|
||||||
class QCommandLineParser;
|
class QCommandLineParser;
|
||||||
class VKnownMeasurementsDatabase;
|
class VKnownMeasurementsDatabase;
|
||||||
|
@ -57,9 +60,14 @@ public:
|
||||||
|
|
||||||
auto IsTestMode() const -> bool;
|
auto IsTestMode() const -> bool;
|
||||||
auto IsAppInGUIMode() const -> bool override;
|
auto IsAppInGUIMode() const -> bool override;
|
||||||
auto MainWindow() -> TMainWindow *;
|
|
||||||
auto MainWindows() -> QList<TMainWindow *>;
|
auto MainTapeWindow() -> TMainWindow *;
|
||||||
auto NewMainWindow() -> TMainWindow *;
|
auto MainTapeWindows() -> QList<TMainWindow *>;
|
||||||
|
auto NewMainTapeWindow() -> TMainWindow *;
|
||||||
|
|
||||||
|
auto MainKMWindow() -> TKMMainWindow *;
|
||||||
|
auto MainKMWindows() -> QList<TKMMainWindow *>;
|
||||||
|
auto NewMainKMWindow() -> TKMMainWindow *;
|
||||||
|
|
||||||
void InitOptions();
|
void InitOptions();
|
||||||
|
|
||||||
|
@ -68,14 +76,14 @@ public:
|
||||||
void OpenSettings() override;
|
void OpenSettings() override;
|
||||||
auto TapeSettings() -> VTapeSettings *;
|
auto TapeSettings() -> VTapeSettings *;
|
||||||
|
|
||||||
void RetranslateTables();
|
|
||||||
|
|
||||||
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
|
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
|
||||||
|
|
||||||
static auto VApp() -> MApplication *;
|
static auto VApp() -> MApplication *;
|
||||||
|
|
||||||
auto KnownMeasurementsDatabase() -> VKnownMeasurementsDatabase * override;
|
auto KnownMeasurementsDatabase() -> VKnownMeasurementsDatabase * override;
|
||||||
|
|
||||||
|
void Preferences(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ProcessCMD();
|
void ProcessCMD();
|
||||||
|
|
||||||
|
@ -90,24 +98,31 @@ private slots:
|
||||||
void NewLocalSocketConnection();
|
void NewLocalSocketConnection();
|
||||||
void RepopulateMeasurementsDatabase(const QString &path);
|
void RepopulateMeasurementsDatabase(const QString &path);
|
||||||
void KnownMeasurementsPathChanged(const QString &oldPath, const QString &newPath);
|
void KnownMeasurementsPathChanged(const QString &oldPath, const QString &newPath);
|
||||||
|
void SyncKnownMeasurements();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(MApplication) // NOLINT
|
Q_DISABLE_COPY_MOVE(MApplication) // NOLINT
|
||||||
QList<QPointer<TMainWindow>> m_mainWindows{};
|
QList<QPointer<TMainWindow>> m_mainWindows{};
|
||||||
|
QList<QPointer<TKMMainWindow>> m_kmMainWindows{};
|
||||||
QLocalServer *m_localServer{nullptr};
|
QLocalServer *m_localServer{nullptr};
|
||||||
VTranslateVars *m_trVars{nullptr};
|
VTranslateVars *m_trVars{nullptr};
|
||||||
QPointer<DialogMDataBase> m_dataBase{};
|
QPointer<DialogMDataBase> m_dataBase{};
|
||||||
bool m_testMode{false};
|
bool m_testMode{false};
|
||||||
|
bool m_knownMeasurementsMode{false};
|
||||||
VKnownMeasurementsDatabase *m_knownMeasurementsDatabase{nullptr};
|
VKnownMeasurementsDatabase *m_knownMeasurementsDatabase{nullptr};
|
||||||
QFileSystemWatcher *m_knownMeasurementsDatabaseWatcher{nullptr};
|
QFileSystemWatcher *m_knownMeasurementsDatabaseWatcher{nullptr};
|
||||||
|
QFutureWatcher<void> *m_knownMeasurementsRepopulateWatcher;
|
||||||
|
|
||||||
void Clean();
|
void CleanTapeWindows();
|
||||||
|
void CleanKMWindows();
|
||||||
|
|
||||||
static void InitParserOptions(QCommandLineParser &parser);
|
static void InitParserOptions(QCommandLineParser &parser);
|
||||||
void StartLocalServer(const QString &serverName);
|
void StartLocalServer(const QString &serverName);
|
||||||
|
|
||||||
auto StartWithFiles(QCommandLineParser &parser) -> bool;
|
auto StartWithFiles(QCommandLineParser &parser) -> bool;
|
||||||
|
auto StartWithMeasurementFiles(QCommandLineParser &parser) -> bool;
|
||||||
|
auto StartWithKnownMeasurementFiles(QCommandLineParser &parser) -> bool;
|
||||||
auto SingleStart(QCommandLineParser &parser) -> bool;
|
auto SingleStart(QCommandLineParser &parser) -> bool;
|
||||||
|
|
||||||
static void ParseDimensionAOption(QCommandLineParser &parser, qreal &dimensionAValue, bool &flagDimensionA);
|
static void ParseDimensionAOption(QCommandLineParser &parser, qreal &dimensionAValue, bool &flagDimensionA);
|
||||||
|
|
|
@ -18,7 +18,8 @@ SOURCES += \
|
||||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp \
|
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp \
|
||||||
$$PWD/vtapesettings.cpp \
|
$$PWD/vtapesettings.cpp \
|
||||||
$$PWD/dialogs/dialogsetupmultisize.cpp \
|
$$PWD/dialogs/dialogsetupmultisize.cpp \
|
||||||
$$PWD/vtapeshortcutmanager.cpp
|
$$PWD/vtapeshortcutmanager.cpp \
|
||||||
|
$$PWD/tkmmainwindow.cpp
|
||||||
|
|
||||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
||||||
|
@ -40,7 +41,8 @@ HEADERS += \
|
||||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h \
|
$$PWD/dialogs/configpages/tapepreferencespathpage.h \
|
||||||
$$PWD/vtapesettings.h \
|
$$PWD/vtapesettings.h \
|
||||||
$$PWD/dialogs/dialogsetupmultisize.h \
|
$$PWD/dialogs/dialogsetupmultisize.h \
|
||||||
$$PWD/vtapeshortcutmanager.h
|
$$PWD/vtapeshortcutmanager.h \
|
||||||
|
$$PWD/tkmmainwindow.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/dialogs/dialogdimensioncustomnames.ui \
|
$$PWD/dialogs/dialogdimensioncustomnames.ui \
|
||||||
|
@ -54,4 +56,6 @@ FORMS += \
|
||||||
$$PWD/dialogs/dialogtapepreferences.ui \
|
$$PWD/dialogs/dialogtapepreferences.ui \
|
||||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \
|
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \
|
||||||
$$PWD/dialogs/configpages/tapepreferencespathpage.ui \
|
$$PWD/dialogs/configpages/tapepreferencespathpage.ui \
|
||||||
$$PWD/dialogs/dialogsetupmultisize.ui
|
$$PWD/dialogs/dialogsetupmultisize.ui \
|
||||||
|
$$PWD/tkmmainwindow.ui
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@ VToolApp {
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
"main.cpp",
|
"main.cpp",
|
||||||
|
"tkmmainwindow.cpp",
|
||||||
|
"tkmmainwindow.h",
|
||||||
|
"tkmmainwindow.ui",
|
||||||
"tmainwindow.cpp",
|
"tmainwindow.cpp",
|
||||||
"mapplication.cpp",
|
"mapplication.cpp",
|
||||||
"vlitepattern.cpp",
|
"vlitepattern.cpp",
|
||||||
|
|
2431
src/app/tape/tkmmainwindow.cpp
Normal file
2431
src/app/tape/tkmmainwindow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
186
src/app/tape/tkmmainwindow.h
Normal file
186
src/app/tape/tkmmainwindow.h
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file tkmmainwindow.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 31 10, 2023
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2023 Valentina project
|
||||||
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#ifndef TKMMAINWINDOW_H
|
||||||
|
#define TKMMAINWINDOW_H
|
||||||
|
|
||||||
|
#include "../vformat/knownmeasurements/vknownmeasurements.h"
|
||||||
|
#include "../vmisc/vabstractshortcutmanager.h"
|
||||||
|
#include "../vmisc/vlockguard.h"
|
||||||
|
#include "../vmisc/vtablesearch.h"
|
||||||
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class TKMMainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VKnownMeasurementsDocument;
|
||||||
|
class VPatternImage;
|
||||||
|
class QCompleter;
|
||||||
|
|
||||||
|
class TKMMainWindow : public VAbstractMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TKMMainWindow(QWidget *parent = nullptr);
|
||||||
|
~TKMMainWindow() override;
|
||||||
|
|
||||||
|
auto CurrentFile() const -> QString;
|
||||||
|
|
||||||
|
auto LoadFile(const QString &path) -> bool;
|
||||||
|
|
||||||
|
void UpdateWindowTitle();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ToolBarStyles();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
void changeEvent(QEvent *event) override;
|
||||||
|
auto eventFilter(QObject *object, QEvent *event) -> bool override;
|
||||||
|
void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) final;
|
||||||
|
auto RecentFileList() const -> QStringList override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void FileNew();
|
||||||
|
void OpenKnownMeasurements();
|
||||||
|
|
||||||
|
bool FileSave(); // NOLINT(modernize-use-trailing-return-type)
|
||||||
|
bool FileSaveAs(); // NOLINT(modernize-use-trailing-return-type)
|
||||||
|
void AboutToShowWindowMenu();
|
||||||
|
void ShowWindow() const;
|
||||||
|
void ImportDataFromCSV();
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
void OpenAt(QAction *where);
|
||||||
|
#endif // defined(Q_OS_MAC)
|
||||||
|
|
||||||
|
void SaveKnownMeasurementsName();
|
||||||
|
void SaveKnownMeasurementsDescription();
|
||||||
|
|
||||||
|
void RemoveMeasurement();
|
||||||
|
void MoveTop();
|
||||||
|
void MoveUp();
|
||||||
|
void MoveDown();
|
||||||
|
void MoveBottom();
|
||||||
|
|
||||||
|
void AddImage();
|
||||||
|
void RemoveImage();
|
||||||
|
void SaveImage();
|
||||||
|
void ShowImage();
|
||||||
|
|
||||||
|
void AddKnown();
|
||||||
|
|
||||||
|
void ShowMData();
|
||||||
|
void ShowImageData();
|
||||||
|
|
||||||
|
void DeployFormula();
|
||||||
|
|
||||||
|
void SaveMName();
|
||||||
|
void SaveMFormula();
|
||||||
|
void SaveMDescription();
|
||||||
|
void SaveMFullName();
|
||||||
|
void SaveMUnits();
|
||||||
|
void SaveMGroup();
|
||||||
|
void SaveMDiagram();
|
||||||
|
|
||||||
|
void SaveImageTitle();
|
||||||
|
|
||||||
|
void AskDefaultSettings();
|
||||||
|
|
||||||
|
void UpdateShortcuts();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// cppcheck-suppress unknownMacro
|
||||||
|
Q_DISABLE_COPY_MOVE(TKMMainWindow) // NOLINT
|
||||||
|
Ui::TKMMainWindow *ui;
|
||||||
|
QString m_curFile{};
|
||||||
|
bool m_isInitialized{false};
|
||||||
|
bool m_mIsReadOnly{false};
|
||||||
|
QMenu *m_searchHistory;
|
||||||
|
QSharedPointer<VLockGuard<char>> m_lock{nullptr};
|
||||||
|
QSharedPointer<VTableSearch> m_search{};
|
||||||
|
VKnownMeasurementsDocument *m_m{nullptr};
|
||||||
|
int m_formulaBaseHeight{0};
|
||||||
|
|
||||||
|
QMultiHash<VShortcutAction, QAction *> m_actionShortcuts{};
|
||||||
|
QMultiHash<VShortcutAction, QAbstractButton *> m_buttonShortcuts{};
|
||||||
|
QHash<QAbstractButton *, QString> m_serachButtonTooltips{};
|
||||||
|
|
||||||
|
QPointer<QTemporaryFile> m_tmpImage{};
|
||||||
|
|
||||||
|
VKnownMeasurements m_known{};
|
||||||
|
|
||||||
|
QCompleter *m_groupCompleter{};
|
||||||
|
|
||||||
|
void SetupMenu();
|
||||||
|
void InitWindow();
|
||||||
|
void InitSearch();
|
||||||
|
|
||||||
|
void MeasurementsWereSaved(bool saved);
|
||||||
|
void SetCurrentFile(const QString &fileName);
|
||||||
|
auto SaveKnownMeasurements(const QString &fileName, QString &error) -> bool;
|
||||||
|
|
||||||
|
auto MaybeSave() -> bool;
|
||||||
|
void UpdatePadlock(bool ro);
|
||||||
|
auto AddCell(const QString &text, int row, int column, int aligment) -> QTableWidgetItem *;
|
||||||
|
|
||||||
|
void ReadSettings();
|
||||||
|
void WriteSettings();
|
||||||
|
|
||||||
|
void InitIcons();
|
||||||
|
|
||||||
|
void InitSearchHistory();
|
||||||
|
void SaveSearchRequest();
|
||||||
|
void UpdateSearchControlsTooltips();
|
||||||
|
|
||||||
|
static auto UnknownMeasurementImage() -> QString;
|
||||||
|
|
||||||
|
void CreateWindowMenu(QMenu *menu);
|
||||||
|
|
||||||
|
void RefreshTable();
|
||||||
|
void RefreshImages();
|
||||||
|
|
||||||
|
void ShowMDiagram(const VPatternImage &image);
|
||||||
|
|
||||||
|
auto Open(const QString &pathTo, const QString &filter) -> QString;
|
||||||
|
void Controls();
|
||||||
|
void MFields(bool enabled);
|
||||||
|
void ImageFields(bool enabled);
|
||||||
|
|
||||||
|
auto GenerateMeasurementName() const -> QString;
|
||||||
|
|
||||||
|
void InitMeasurementUnits();
|
||||||
|
void InitMeasurementDiagramList();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TKMMAINWINDOW_H
|
1255
src/app/tape/tkmmainwindow.ui
Normal file
1255
src/app/tape/tkmmainwindow.ui
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -58,10 +58,8 @@
|
||||||
#include "dialogs/dialognewmeasurements.h"
|
#include "dialogs/dialognewmeasurements.h"
|
||||||
#include "dialogs/dialogrestrictdimension.h"
|
#include "dialogs/dialogrestrictdimension.h"
|
||||||
#include "dialogs/dialogsetupmultisize.h"
|
#include "dialogs/dialogsetupmultisize.h"
|
||||||
#include "dialogs/dialogtapepreferences.h"
|
|
||||||
#include "mapplication.h" // Should be last because of definning qApp
|
#include "mapplication.h" // Should be last because of definning qApp
|
||||||
#include "qcursor.h"
|
#include "tkmmainwindow.h"
|
||||||
#include "quuid.h"
|
|
||||||
#include "ui_tmainwindow.h"
|
#include "ui_tmainwindow.h"
|
||||||
#include "vlitepattern.h"
|
#include "vlitepattern.h"
|
||||||
#include "vtapesettings.h"
|
#include "vtapesettings.h"
|
||||||
|
@ -83,6 +81,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QCursor>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
@ -91,6 +90,7 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QUuid>
|
||||||
#include <QtNumeric>
|
#include <QtNumeric>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
@ -247,7 +247,6 @@ void SetIndividualMeasurementDescription(int i, const QString &name, const QxtCs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// We need this enum in case we will add or delete a column. And also make code more readable.
|
// We need this enum in case we will add or delete a column. And also make code more readable.
|
||||||
enum
|
enum
|
||||||
|
@ -262,12 +261,12 @@ enum
|
||||||
ColumnShiftC = 7,
|
ColumnShiftC = 7,
|
||||||
ColumnCorrection = 8
|
ColumnCorrection = 8
|
||||||
};
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TMainWindow::TMainWindow(QWidget *parent)
|
TMainWindow::TMainWindow(QWidget *parent)
|
||||||
: VAbstractMainWindow(parent),
|
: VAbstractMainWindow(parent),
|
||||||
ui(new Ui::TMainWindow),
|
ui(new Ui::TMainWindow),
|
||||||
m_formulaBaseHeight(0),
|
|
||||||
m_gradation(new QTimer(this)),
|
m_gradation(new QTimer(this)),
|
||||||
m_searchHistory(new QMenu(this))
|
m_searchHistory(new QMenu(this))
|
||||||
{
|
{
|
||||||
|
@ -279,11 +278,6 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
|
|
||||||
ui->labelDiagram->setText(UnknownMeasurementImage());
|
ui->labelDiagram->setText(UnknownMeasurementImage());
|
||||||
|
|
||||||
ui->lineEditName->setClearButtonEnabled(true);
|
|
||||||
ui->lineEditFullName->setClearButtonEnabled(true);
|
|
||||||
ui->lineEditCustomerName->setClearButtonEnabled(true);
|
|
||||||
ui->lineEditEmail->setClearButtonEnabled(true);
|
|
||||||
|
|
||||||
ui->lineEditFind->installEventFilter(this);
|
ui->lineEditFind->installEventFilter(this);
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -350,18 +344,6 @@ auto TMainWindow::CurrentFile() const -> QString
|
||||||
return m_curFile;
|
return m_curFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TMainWindow::RetranslateTable()
|
|
||||||
{
|
|
||||||
if (m_m != nullptr)
|
|
||||||
{
|
|
||||||
const int row = ui->tableWidget->currentRow();
|
|
||||||
RefreshTable();
|
|
||||||
ui->tableWidget->selectRow(row);
|
|
||||||
m_search->RefreshList(ui->lineEditFind->text());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::SetDimensionABase(qreal base)
|
void TMainWindow::SetDimensionABase(qreal base)
|
||||||
{
|
{
|
||||||
|
@ -447,7 +429,7 @@ auto TMainWindow::LoadFile(const QString &path) -> bool
|
||||||
{
|
{
|
||||||
if (m_m != nullptr)
|
if (m_m != nullptr)
|
||||||
{
|
{
|
||||||
return MApplication::VApp()->NewMainWindow()->LoadFile(path);
|
return MApplication::VApp()->NewMainTapeWindow()->LoadFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not QFileInfo::exists(path))
|
if (not QFileInfo::exists(path))
|
||||||
|
@ -461,7 +443,7 @@ auto TMainWindow::LoadFile(const QString &path) -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if file already opened
|
// Check if file already opened
|
||||||
const QList<TMainWindow *> list = MApplication::VApp()->MainWindows();
|
const QList<TMainWindow *> list = MApplication::VApp()->MainTapeWindows();
|
||||||
auto w =
|
auto w =
|
||||||
std::find_if(list.begin(), list.end(), [path](TMainWindow *window) { return window->CurrentFile() == path; });
|
std::find_if(list.begin(), list.end(), [path](TMainWindow *window) { return window->CurrentFile() == path; });
|
||||||
if (w != list.end())
|
if (w != list.end())
|
||||||
|
@ -602,8 +584,12 @@ auto TMainWindow::LoadFile(const QString &path) -> bool
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::FileNew()
|
void TMainWindow::FileNew()
|
||||||
{
|
{
|
||||||
if (m_m == nullptr)
|
if (m_m != nullptr)
|
||||||
{
|
{
|
||||||
|
MApplication::VApp()->NewMainTapeWindow()->FileNew();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DialogNewMeasurements measurements(this);
|
DialogNewMeasurements measurements(this);
|
||||||
if (measurements.exec() == QDialog::Rejected)
|
if (measurements.exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
|
@ -643,6 +629,8 @@ void TMainWindow::FileNew()
|
||||||
m_curFileFormatVersionStr = VVITConverter::MeasurementMaxVerStr;
|
m_curFileFormatVersionStr = VVITConverter::MeasurementMaxVerStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_m->SetKnownMeasurements(MApplication::VApp()->TapeSettings()->GetKnownMeasurementsId());
|
||||||
|
|
||||||
m_mIsReadOnly = m_m->IsReadOnly();
|
m_mIsReadOnly = m_m->IsReadOnly();
|
||||||
UpdatePadlock(m_mIsReadOnly);
|
UpdatePadlock(m_mIsReadOnly);
|
||||||
|
|
||||||
|
@ -655,17 +643,12 @@ void TMainWindow::FileNew()
|
||||||
|
|
||||||
ui->actionImportFromCSV->setEnabled(true);
|
ui->actionImportFromCSV->setEnabled(true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
MApplication::VApp()->NewMainWindow()->FileNew();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::OpenIndividual()
|
void TMainWindow::OpenIndividual()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") + tr("Multisize measurements") +
|
const QString filter = tr("Individual measurements") + " (*.vit);;"_L1 + tr("Multisize measurements") +
|
||||||
QStringLiteral(" (*.vst);;") + tr("All files") + QStringLiteral(" (*.*)");
|
" (*.vst);;"_L1 + tr("All files") + " (*.*)"_L1;
|
||||||
// Use standard path to individual measurements
|
// Use standard path to individual measurements
|
||||||
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
|
@ -731,31 +714,11 @@ void TMainWindow::CreateFromExisting()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MApplication::VApp()->NewMainWindow()->CreateFromExisting();
|
MApplication::VApp()->NewMainTapeWindow()->CreateFromExisting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TMainWindow::Preferences()
|
|
||||||
{
|
|
||||||
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
|
||||||
static QPointer<DialogTapePreferences> guard; // Prevent any second run
|
|
||||||
if (guard.isNull())
|
|
||||||
{
|
|
||||||
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
|
||||||
auto *preferences = new DialogTapePreferences(this);
|
|
||||||
// QScopedPointer needs to be sure any exception will never block guard
|
|
||||||
QScopedPointer<DialogTapePreferences> dlg(preferences);
|
|
||||||
guard = preferences;
|
|
||||||
// Must be first
|
|
||||||
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, this, &TMainWindow::WindowsLocale);
|
|
||||||
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, this, &TMainWindow::ToolBarStyles);
|
|
||||||
QGuiApplication::restoreOverrideCursor();
|
|
||||||
dlg->exec();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::ToolBarStyles()
|
void TMainWindow::ToolBarStyles()
|
||||||
{
|
{
|
||||||
|
@ -1050,7 +1013,7 @@ auto TMainWindow::FileSaveAs() -> bool
|
||||||
|
|
||||||
if (not m_curFile.isEmpty())
|
if (not m_curFile.isEmpty())
|
||||||
{
|
{
|
||||||
fName = StrippedName(m_curFile);
|
fName = QFileInfo(m_curFile).fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + fName, filters, nullptr,
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + fName, filters, nullptr,
|
||||||
|
@ -1156,7 +1119,7 @@ void TMainWindow::ShowWindow() const
|
||||||
if (v.canConvert<int>())
|
if (v.canConvert<int>())
|
||||||
{
|
{
|
||||||
const int offset = qvariant_cast<int>(v);
|
const int offset = qvariant_cast<int>(v);
|
||||||
const QList<TMainWindow *> windows = MApplication::VApp()->MainWindows();
|
const QList<TMainWindow *> windows = MApplication::VApp()->MainTapeWindows();
|
||||||
windows.at(offset)->raise();
|
windows.at(offset)->raise();
|
||||||
windows.at(offset)->activateWindow();
|
windows.at(offset)->activateWindow();
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1214,7 @@ void TMainWindow::AboutToShowDockMenu()
|
||||||
|
|
||||||
QAction *actionPreferences = menu->addAction(tr("Preferences"));
|
QAction *actionPreferences = menu->addAction(tr("Preferences"));
|
||||||
actionPreferences->setMenuRole(QAction::NoRole);
|
actionPreferences->setMenuRole(QAction::NoRole);
|
||||||
connect(actionPreferences, &QAction::triggered, this, &TMainWindow::Preferences);
|
connect(actionPreferences, &QAction::triggered, this, [this]() { MApplication::VApp()->Preferences(this); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1325,11 +1288,13 @@ void TMainWindow::SaveKnownMeasurements(int index)
|
||||||
{
|
{
|
||||||
QUuid known = ui->comboBoxKnownMeasurements->itemData(index).toUuid();
|
QUuid known = ui->comboBoxKnownMeasurements->itemData(index).toUuid();
|
||||||
|
|
||||||
|
ui->actionEditCurrentKnownMeasurements->setEnabled(KnownMeasurementsRegistred(known));
|
||||||
|
|
||||||
if (m_m->KnownMeasurements() != known)
|
if (m_m->KnownMeasurements() != known)
|
||||||
{
|
{
|
||||||
m_m->SetKnownMeasurements(known);
|
m_m->SetKnownMeasurements(known);
|
||||||
MeasurementsWereSaved(false);
|
MeasurementsWereSaved(false);
|
||||||
InitKnownMeasurementsDescription();
|
SyncKnownMeasurements();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1694,7 +1659,6 @@ void TMainWindow::ShowImage()
|
||||||
|
|
||||||
if (row == -1)
|
if (row == -1)
|
||||||
{
|
{
|
||||||
ui->toolButtonSaveImage->setDisabled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1723,7 +1687,7 @@ void TMainWindow::ShowImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeType mime = image.MimeTypeFromData();
|
QMimeType mime = image.MimeTypeFromData();
|
||||||
QString name = QDir::tempPath() + QDir::separator() + QStringLiteral("image.XXXXXX");
|
QString name = QDir::tempPath() + QDir::separator() + "image.XXXXXX"_L1;
|
||||||
|
|
||||||
QStringList suffixes = mime.suffixes();
|
QStringList suffixes = mime.suffixes();
|
||||||
if (not suffixes.isEmpty())
|
if (not suffixes.isEmpty())
|
||||||
|
@ -2825,8 +2789,11 @@ void TMainWindow::DimensionCustomNames()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::AskDefaultSettings()
|
void TMainWindow::AskDefaultSettings()
|
||||||
{
|
{
|
||||||
if (MApplication::VApp()->IsAppInGUIMode())
|
if (!MApplication::VApp()->IsAppInGUIMode())
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||||
if (not settings->IsLocaleSelected())
|
if (not settings->IsLocaleSelected())
|
||||||
{
|
{
|
||||||
|
@ -2874,7 +2841,6 @@ void TMainWindow::AskDefaultSettings()
|
||||||
freshID ? statistic->SendAppFreshInstallEvent(uptime) : statistic->SendAppStartEvent(uptime);
|
freshID ? statistic->SendAppFreshInstallEvent(uptime) : statistic->SendAppStartEvent(uptime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::UpdateShortcuts()
|
void TMainWindow::UpdateShortcuts()
|
||||||
|
@ -2925,7 +2891,7 @@ void TMainWindow::SetupMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(ui->actionPreferences, &QAction::triggered, this, &TMainWindow::Preferences);
|
connect(ui->actionPreferences, &QAction::triggered, this, [this]() { MApplication::VApp()->Preferences(this); });
|
||||||
|
|
||||||
for (auto &recentFileAct : m_recentFileActs)
|
for (auto &recentFileAct : m_recentFileActs)
|
||||||
{
|
{
|
||||||
|
@ -2962,6 +2928,31 @@ void TMainWindow::SetupMenu()
|
||||||
|
|
||||||
connect(ui->actionImportFromPattern, &QAction::triggered, this, &TMainWindow::ImportFromPattern);
|
connect(ui->actionImportFromPattern, &QAction::triggered, this, &TMainWindow::ImportFromPattern);
|
||||||
|
|
||||||
|
connect(ui->actionCreateKnownMeasurements, &QAction::triggered, this,
|
||||||
|
[]() { MApplication::VApp()->NewMainKMWindow(); });
|
||||||
|
|
||||||
|
connect(ui->actionEditCurrentKnownMeasurements, &QAction::triggered, this,
|
||||||
|
[this]()
|
||||||
|
{
|
||||||
|
QUuid id = m_m->KnownMeasurements();
|
||||||
|
if (id.isNull())
|
||||||
|
{
|
||||||
|
ui->actionEditCurrentKnownMeasurements->setDisabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
||||||
|
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
|
||||||
|
if (!known.contains(id))
|
||||||
|
{
|
||||||
|
qCritical() << tr("Unknown known measurements: %1").arg(id.toString());
|
||||||
|
ui->actionEditCurrentKnownMeasurements->setDisabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MApplication::VApp()->MainKMWindow()->LoadFile(known.value(id).path);
|
||||||
|
});
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
connect(ui->menuWindow, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowWindowMenu);
|
connect(ui->menuWindow, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowWindowMenu);
|
||||||
AboutToShowWindowMenu();
|
AboutToShowWindowMenu();
|
||||||
|
@ -3097,6 +3088,7 @@ void TMainWindow::InitWindow()
|
||||||
&TMainWindow::SaveMDimension);
|
&TMainWindow::SaveMDimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->actionEditCurrentKnownMeasurements->setEnabled(!m_m->KnownMeasurements().isNull());
|
||||||
ui->comboBoxKnownMeasurements->setEnabled(true);
|
ui->comboBoxKnownMeasurements->setEnabled(true);
|
||||||
ui->comboBoxKnownMeasurements->clear();
|
ui->comboBoxKnownMeasurements->clear();
|
||||||
InitKnownMeasurements(ui->comboBoxKnownMeasurements);
|
InitKnownMeasurements(ui->comboBoxKnownMeasurements);
|
||||||
|
@ -3117,8 +3109,7 @@ void TMainWindow::InitWindow()
|
||||||
ui->actionImportFromPattern->setEnabled(true);
|
ui->actionImportFromPattern->setEnabled(true);
|
||||||
ui->actionSaveAs->setEnabled(true);
|
ui->actionSaveAs->setEnabled(true);
|
||||||
|
|
||||||
ui->lineEditName->setValidator(
|
ui->lineEditName->setValidator(new QRegularExpressionValidator(QRegularExpression("^$|"_L1 + NameRegExp()), this));
|
||||||
new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^$|") + NameRegExp()), this));
|
|
||||||
|
|
||||||
connect(ui->toolButtonRemove, &QToolButton::clicked, this, &TMainWindow::Remove);
|
connect(ui->toolButtonRemove, &QToolButton::clicked, this, &TMainWindow::Remove);
|
||||||
connect(ui->toolButtonTop, &QToolButton::clicked, this, &TMainWindow::MoveTop);
|
connect(ui->toolButtonTop, &QToolButton::clicked, this, &TMainWindow::MoveTop);
|
||||||
|
@ -3486,8 +3477,11 @@ auto TMainWindow::SaveMeasurements(const QString &fileName, QString &error) -> b
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto TMainWindow::MaybeSave() -> bool
|
auto TMainWindow::MaybeSave() -> bool
|
||||||
{
|
{
|
||||||
if (this->isWindowModified())
|
if (!isWindowModified())
|
||||||
{
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_curFile.isEmpty() && ui->tableWidget->rowCount() == 0)
|
if (m_curFile.isEmpty() && ui->tableWidget->rowCount() == 0)
|
||||||
{
|
{
|
||||||
return true; // Don't ask if file was created without modifications.
|
return true; // Don't ask if file was created without modifications.
|
||||||
|
@ -3532,7 +3526,7 @@ auto TMainWindow::MaybeSave() -> bool
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3654,7 +3648,7 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddCell(known.description, currentRow, ColumnFullName, Qt::AlignVCenter);
|
AddCell(known.fullName, currentRow, ColumnFullName, Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString calculatedValue;
|
QString calculatedValue;
|
||||||
|
@ -3686,7 +3680,7 @@ void TMainWindow::RefreshMeasurementData(const QSharedPointer<VMeasurement> &mea
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddCell(known.description, currentRow, ColumnFullName, Qt::AlignVCenter);
|
AddCell(known.fullName, currentRow, ColumnFullName, Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString calculatedValue;
|
QString calculatedValue;
|
||||||
|
@ -3832,11 +3826,11 @@ void TMainWindow::UpdateWindowTitle()
|
||||||
// #ifdef Q_OS_WIN32
|
// #ifdef Q_OS_WIN32
|
||||||
// qt_ntfs_permission_lookup--; // turn it off again
|
// qt_ntfs_permission_lookup--; // turn it off again
|
||||||
// #endif /*Q_OS_WIN32*/
|
// #endif /*Q_OS_WIN32*/
|
||||||
showName = StrippedName(m_curFile);
|
showName = QFileInfo(m_curFile).fileName();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto index = MApplication::VApp()->MainWindows().indexOf(this);
|
auto index = MApplication::VApp()->MainTapeWindows().indexOf(this);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
showName = tr("untitled %1").arg(index + 1);
|
showName = tr("untitled %1").arg(index + 1);
|
||||||
|
@ -3852,7 +3846,7 @@ void TMainWindow::UpdateWindowTitle()
|
||||||
|
|
||||||
if (m_mIsReadOnly || not isFileWritable)
|
if (m_mIsReadOnly || not isFileWritable)
|
||||||
{
|
{
|
||||||
showName += QStringLiteral(" (") + tr("read only") + ')'_L1;
|
showName += " ("_L1 + tr("read only") + ')'_L1;
|
||||||
}
|
}
|
||||||
|
|
||||||
setWindowTitle(showName);
|
setWindowTitle(showName);
|
||||||
|
@ -3882,6 +3876,64 @@ void TMainWindow::UpdateWindowTitle()
|
||||||
#endif // defined(Q_OS_MAC)
|
#endif // defined(Q_OS_MAC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TMainWindow::SyncKnownMeasurements()
|
||||||
|
{
|
||||||
|
ui->comboBoxKnownMeasurements->blockSignals(true);
|
||||||
|
ui->comboBoxKnownMeasurements->clear();
|
||||||
|
InitKnownMeasurements(ui->comboBoxKnownMeasurements);
|
||||||
|
const qint32 index = ui->comboBoxKnownMeasurements->findData(m_m->KnownMeasurements());
|
||||||
|
ui->comboBoxKnownMeasurements->setCurrentIndex(index);
|
||||||
|
ui->comboBoxKnownMeasurements->blockSignals(false);
|
||||||
|
|
||||||
|
InitKnownMeasurementsDescription();
|
||||||
|
|
||||||
|
const int row = ui->tableWidget->currentRow();
|
||||||
|
|
||||||
|
if (row != -1)
|
||||||
|
{
|
||||||
|
RefreshTable(false);
|
||||||
|
|
||||||
|
ui->tableWidget->blockSignals(true);
|
||||||
|
ui->tableWidget->selectRow(row);
|
||||||
|
ui->tableWidget->blockSignals(false);
|
||||||
|
|
||||||
|
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); // name
|
||||||
|
SCASSERT(nameField != nullptr)
|
||||||
|
QSharedPointer<VMeasurement> meash;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Translate to internal look.
|
||||||
|
meash = m_data->GetVariable<VMeasurement>(nameField->data(Qt::UserRole).toString());
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (meash->IsCustom())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowMDiagram(meash);
|
||||||
|
|
||||||
|
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
||||||
|
VKnownMeasurements knownDB = db->KnownMeasurements(m_m->KnownMeasurements());
|
||||||
|
VKnownMeasurement known = knownDB.Measurement(meash->GetName());
|
||||||
|
|
||||||
|
ui->plainTextEditDescription->blockSignals(true);
|
||||||
|
ui->plainTextEditDescription->setPlainText(known.description);
|
||||||
|
ui->plainTextEditDescription->blockSignals(false);
|
||||||
|
|
||||||
|
ui->lineEditFullName->blockSignals(true);
|
||||||
|
ui->lineEditFullName->setText(known.fullName);
|
||||||
|
ui->lineEditFullName->blockSignals(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto TMainWindow::ClearCustomName(const QString &name) -> QString
|
auto TMainWindow::ClearCustomName(const QString &name) -> QString
|
||||||
{
|
{
|
||||||
|
@ -3961,7 +4013,7 @@ auto TMainWindow::Open(const QString &pathTo, const QString &filter) -> QString
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MApplication::VApp()->NewMainWindow()->LoadFile(mPath);
|
MApplication::VApp()->NewMainTapeWindow()->LoadFile(mPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4065,7 +4117,7 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
|
||||||
{
|
{
|
||||||
if (m_m != nullptr)
|
if (m_m != nullptr)
|
||||||
{
|
{
|
||||||
return MApplication::VApp()->NewMainWindow()->LoadFile(path);
|
return MApplication::VApp()->NewMainTapeWindow()->LoadFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not QFileInfo::exists(path))
|
if (not QFileInfo::exists(path))
|
||||||
|
@ -4079,7 +4131,7 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if file already opened
|
// Check if file already opened
|
||||||
const QList<TMainWindow *> list = MApplication::VApp()->MainWindows();
|
const QList<TMainWindow *> list = MApplication::VApp()->MainTapeWindows();
|
||||||
auto w =
|
auto w =
|
||||||
std::find_if(list.begin(), list.end(), [path](TMainWindow *window) { return window->CurrentFile() == path; });
|
std::find_if(list.begin(), list.end(), [path](TMainWindow *window) { return window->CurrentFile() == path; });
|
||||||
if (w != list.end())
|
if (w != list.end())
|
||||||
|
@ -4121,6 +4173,8 @@ auto TMainWindow::LoadFromExistingFile(const QString &path) -> bool
|
||||||
m_curFileFormatVersionStr = converter->GetFormatVersionStr();
|
m_curFileFormatVersionStr = converter->GetFormatVersionStr();
|
||||||
m_m->setXMLContent(converter->Convert()); // Read again after conversion
|
m_m->setXMLContent(converter->Convert()); // Read again after conversion
|
||||||
|
|
||||||
|
m_m->SetKnownMeasurements(MApplication::VApp()->TapeSettings()->GetKnownMeasurementsId());
|
||||||
|
|
||||||
m_mUnit = m_m->Units();
|
m_mUnit = m_m->Units();
|
||||||
m_pUnit = m_mUnit;
|
m_pUnit = m_mUnit;
|
||||||
|
|
||||||
|
@ -4176,11 +4230,11 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
|
||||||
SCASSERT(menu != nullptr)
|
SCASSERT(menu != nullptr)
|
||||||
|
|
||||||
QAction *action = menu->addAction(tr("&New Window"));
|
QAction *action = menu->addAction(tr("&New Window"));
|
||||||
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainWindow()->activateWindow(); });
|
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainTapeWindow()->activateWindow(); });
|
||||||
action->setMenuRole(QAction::NoRole);
|
action->setMenuRole(QAction::NoRole);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
const QList<TMainWindow *> windows = MApplication::VApp()->MainWindows();
|
const QList<TMainWindow *> windows = MApplication::VApp()->MainTapeWindows();
|
||||||
for (int i = 0; i < windows.count(); ++i)
|
for (int i = 0; i < windows.count(); ++i)
|
||||||
{
|
{
|
||||||
TMainWindow *window = windows.at(i);
|
TMainWindow *window = windows.at(i);
|
||||||
|
@ -4728,6 +4782,11 @@ void TMainWindow::InitKnownMeasurements(QComboBox *combo)
|
||||||
SCASSERT(combo != nullptr)
|
SCASSERT(combo != nullptr)
|
||||||
combo->addItem(tr("None"), QUuid());
|
combo->addItem(tr("None"), QUuid());
|
||||||
|
|
||||||
|
if (!known.contains(m_m->KnownMeasurements()))
|
||||||
|
{
|
||||||
|
combo->addItem(tr("Invalid link"), m_m->KnownMeasurements());
|
||||||
|
}
|
||||||
|
|
||||||
int index = 1;
|
int index = 1;
|
||||||
auto i = known.constBegin();
|
auto i = known.constBegin();
|
||||||
while (i != known.constEnd())
|
while (i != known.constEnd())
|
||||||
|
@ -4751,14 +4810,27 @@ void TMainWindow::InitKnownMeasurementsDescription()
|
||||||
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
||||||
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
|
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
|
||||||
|
|
||||||
ui->labelKnownMeasurementsDescription->clear();
|
ui->plainTextEditKnownMeasurementsDescription->clear();
|
||||||
QUuid id = m_m->KnownMeasurements();
|
QUuid id = m_m->KnownMeasurements();
|
||||||
if (!id.isNull() && known.contains(id))
|
if (!id.isNull() && known.contains(id))
|
||||||
{
|
{
|
||||||
ui->labelKnownMeasurementsDescription->setText(known.value(id).description);
|
ui->plainTextEditKnownMeasurementsDescription->setPlainText(known.value(id).description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto TMainWindow::KnownMeasurementsRegistred(const QUuid &id) -> bool
|
||||||
|
{
|
||||||
|
if (id.isNull())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
VKnownMeasurementsDatabase *db = MApplication::VApp()->KnownMeasurementsDatabase();
|
||||||
|
QHash<QUuid, VKnownMeasurementsHeader> known = db->AllKnownMeasurements();
|
||||||
|
return known.contains(id);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::SetDecimals()
|
void TMainWindow::SetDecimals()
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@ class QLabel;
|
||||||
class QxtCsvModel;
|
class QxtCsvModel;
|
||||||
class VMeasurement;
|
class VMeasurement;
|
||||||
class QAbstractButton;
|
class QAbstractButton;
|
||||||
|
class QUuid;
|
||||||
|
|
||||||
class TMainWindow : public VAbstractMainWindow
|
class TMainWindow : public VAbstractMainWindow
|
||||||
{
|
{
|
||||||
|
@ -60,8 +61,6 @@ public:
|
||||||
|
|
||||||
auto CurrentFile() const -> QString;
|
auto CurrentFile() const -> QString;
|
||||||
|
|
||||||
void RetranslateTable();
|
|
||||||
|
|
||||||
void SetDimensionABase(qreal base);
|
void SetDimensionABase(qreal base);
|
||||||
void SetDimensionBBase(qreal base);
|
void SetDimensionBBase(qreal base);
|
||||||
void SetDimensionCBase(qreal base);
|
void SetDimensionCBase(qreal base);
|
||||||
|
@ -71,6 +70,11 @@ public:
|
||||||
|
|
||||||
void UpdateWindowTitle();
|
void UpdateWindowTitle();
|
||||||
|
|
||||||
|
void SyncKnownMeasurements();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ToolBarStyles();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
@ -84,8 +88,6 @@ private slots:
|
||||||
void OpenMultisize();
|
void OpenMultisize();
|
||||||
void OpenTemplate();
|
void OpenTemplate();
|
||||||
void CreateFromExisting();
|
void CreateFromExisting();
|
||||||
void Preferences();
|
|
||||||
void ToolBarStyles();
|
|
||||||
|
|
||||||
bool FileSave(); // NOLINT(modernize-use-trailing-return-type)
|
bool FileSave(); // NOLINT(modernize-use-trailing-return-type)
|
||||||
bool FileSaveAs(); // NOLINT(modernize-use-trailing-return-type)
|
bool FileSaveAs(); // NOLINT(modernize-use-trailing-return-type)
|
||||||
|
@ -176,7 +178,7 @@ private:
|
||||||
QComboBox *m_gradationDimensionB{nullptr};
|
QComboBox *m_gradationDimensionB{nullptr};
|
||||||
QComboBox *m_gradationDimensionC{nullptr};
|
QComboBox *m_gradationDimensionC{nullptr};
|
||||||
QComboBox *m_comboBoxUnits{nullptr};
|
QComboBox *m_comboBoxUnits{nullptr};
|
||||||
int m_formulaBaseHeight;
|
int m_formulaBaseHeight{0};
|
||||||
QSharedPointer<VLockGuard<char>> m_lock{nullptr};
|
QSharedPointer<VLockGuard<char>> m_lock{nullptr};
|
||||||
QSharedPointer<VTableSearch> m_search{};
|
QSharedPointer<VTableSearch> m_search{};
|
||||||
QLabel *m_labelGradationDimensionA{nullptr};
|
QLabel *m_labelGradationDimensionA{nullptr};
|
||||||
|
@ -302,6 +304,8 @@ private:
|
||||||
|
|
||||||
void InitKnownMeasurements(QComboBox *combo);
|
void InitKnownMeasurements(QComboBox *combo);
|
||||||
void InitKnownMeasurementsDescription();
|
void InitKnownMeasurementsDescription();
|
||||||
|
|
||||||
|
static auto KnownMeasurementsRegistred(const QUuid &id) -> bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TMAINWINDOW_H
|
#endif // TMAINWINDOW_H
|
||||||
|
|
|
@ -532,6 +532,9 @@
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Measurement's name in a formula.</string>
|
<string>Measurement's name in a formula.</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
|
@ -763,6 +766,9 @@
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Measurement's human-readable name.</string>
|
<string>Measurement's human-readable name.</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0">
|
<item row="11" column="0">
|
||||||
|
@ -926,32 +932,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="5" column="0">
|
||||||
<widget class="QFrame" name="frame">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelKnownMeasurementsDescription">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="labelBaseValues">
|
<widget class="QLabel" name="labelBaseValues">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
@ -967,7 +948,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QFrame" name="frameBaseValue">
|
<widget class="QFrame" name="frameBaseValue">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::Box</enum>
|
<enum>QFrame::Box</enum>
|
||||||
|
@ -1024,14 +1005,14 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="labelCustomerName">
|
<widget class="QLabel" name="labelCustomerName">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Customer name:</string>
|
<string>Customer name:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QLineEdit" name="lineEditCustomerName">
|
<widget class="QLineEdit" name="lineEditCustomerName">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -1045,16 +1026,19 @@
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Customer's name</string>
|
<string>Customer's name</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="labelBirthDate">
|
<widget class="QLabel" name="labelBirthDate">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Birth date:</string>
|
<string>Birth date:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QDateEdit" name="dateEditBirthDate">
|
<widget class="QDateEdit" name="dateEditBirthDate">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -1089,14 +1073,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="labelGender">
|
<widget class="QLabel" name="labelGender">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gender:</string>
|
<string>Gender:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxGender">
|
<widget class="QComboBox" name="comboBoxGender">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -1109,14 +1093,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="labelEmail">
|
<widget class="QLabel" name="labelEmail">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Email:</string>
|
<string>Email:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="QLineEdit" name="lineEditEmail">
|
<widget class="QLineEdit" name="lineEditEmail">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -1130,16 +1114,19 @@
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Customer's email address</string>
|
<string>Customer's email address</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QLabel" name="labelNotes">
|
<widget class="QLabel" name="labelNotes">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Notes:</string>
|
<string>Notes:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="VPlainTextEdit" name="plainTextEditNotes">
|
<widget class="VPlainTextEdit" name="plainTextEditNotes">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -1152,6 +1139,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEditKnownMeasurementsDescription"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1217,6 +1207,9 @@
|
||||||
<addaction name="actionRestrictThirdDimension"/>
|
<addaction name="actionRestrictThirdDimension"/>
|
||||||
<addaction name="actionDimensionLabels"/>
|
<addaction name="actionDimensionLabels"/>
|
||||||
<addaction name="actionDimensionCustomNames"/>
|
<addaction name="actionDimensionCustomNames"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionCreateKnownMeasurements"/>
|
||||||
|
<addaction name="actionEditCurrentKnownMeasurements"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuMeasurements"/>
|
<addaction name="menuMeasurements"/>
|
||||||
|
@ -1720,6 +1713,19 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCreateKnownMeasurements">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create Known Measurements</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionEditCurrentKnownMeasurements">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit current Known Measurements</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -43,20 +43,33 @@ namespace
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingKnownMeasurementsRecentFileList, ("kmRecentFileList"_L1)) // NOLINT
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, ("paths/templates"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, ("paths/templates"_L1)) // NOLINT
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, ("database/geometry"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, ("database/geometry"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryTape, ("searchHistory/tape"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryTape, ("searchHistory/tape"_L1)) // NOLINT
|
||||||
|
// NOLINTNEXTLINE
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryKnownMeasurments, ("searchHistory/knownMeasurements"_L1))
|
||||||
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeUseUnicodeProperties,
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeUseUnicodeProperties,
|
||||||
("searchOptions/tapeUseUnicodeProperties"_L1))
|
("searchOptions/tapeUseUnicodeProperties"_L1))
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMUseUnicodeProperties,
|
||||||
|
("searchOptions/kmUseUnicodeProperties"_L1))
|
||||||
|
// NOLINTNEXTLINE
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord, ("searchOptions/tapeWholeWord"_L1))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord, ("searchOptions/tapeWholeWord"_L1))
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMWholeWord, ("searchOptions/kmWholeWord"_L1))
|
||||||
|
// NOLINTNEXTLINE
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, ("searchOptions/tapeRegexp"_L1))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, ("searchOptions/tapeRegexp"_L1))
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMRegexp, ("searchOptions/kmRegexp"_L1))
|
||||||
|
// NOLINTNEXTLINE
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase, ("searchOptions/tapeMatchCase"_L1))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase, ("searchOptions/tapeMatchCase"_L1))
|
||||||
|
// NOLINTNEXTLINE
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsKMMatchCase, ("searchOptions/kmMatchCase"_L1))
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -103,6 +116,18 @@ void VTapeSettings::SetTapeSearchHistory(const QStringList &history)
|
||||||
setValue(*settingSearchHistoryTape, history);
|
setValue(*settingSearchHistoryTape, history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VTapeSettings::GetKMSearchHistory() const -> QStringList
|
||||||
|
{
|
||||||
|
return value(*settingSearchHistoryKnownMeasurments).toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTapeSettings::SetKMSearchHistory(const QStringList &history)
|
||||||
|
{
|
||||||
|
setValue(*settingSearchHistoryKnownMeasurments, history);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VTapeSettings::GetTapeSearchOptionUseUnicodeProperties() const -> bool
|
auto VTapeSettings::GetTapeSearchOptionUseUnicodeProperties() const -> bool
|
||||||
{
|
{
|
||||||
|
@ -115,6 +140,18 @@ void VTapeSettings::SetTapeSearchOptionUseUnicodeProperties(bool value)
|
||||||
setValue(*settingSearchOptionsTapeUseUnicodeProperties, value);
|
setValue(*settingSearchOptionsTapeUseUnicodeProperties, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VTapeSettings::GetKMSearchOptionUseUnicodeProperties() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingSearchOptionsKMUseUnicodeProperties, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTapeSettings::SetKMSearchOptionUseUnicodeProperties(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingSearchOptionsKMUseUnicodeProperties, value);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VTapeSettings::GetTapeSearchOptionWholeWord() const -> bool
|
auto VTapeSettings::GetTapeSearchOptionWholeWord() const -> bool
|
||||||
{
|
{
|
||||||
|
@ -127,6 +164,18 @@ void VTapeSettings::SetTapeSearchOptionWholeWord(bool value)
|
||||||
setValue(*settingSearchOptionsTapeWholeWord, value);
|
setValue(*settingSearchOptionsTapeWholeWord, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VTapeSettings::GetKMSearchOptionWholeWord() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingSearchOptionsKMWholeWord, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTapeSettings::SetKMSearchOptionWholeWord(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingSearchOptionsKMWholeWord, value);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VTapeSettings::GetTapeSearchOptionRegexp() const -> bool
|
auto VTapeSettings::GetTapeSearchOptionRegexp() const -> bool
|
||||||
{
|
{
|
||||||
|
@ -139,6 +188,18 @@ void VTapeSettings::SetTapeSearchOptionRegexp(bool value)
|
||||||
setValue(*settingSearchOptionsTapeRegexp, value);
|
setValue(*settingSearchOptionsTapeRegexp, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VTapeSettings::GetKMSearchOptionRegexp() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingSearchOptionsKMRegexp, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTapeSettings::SetKMSearchOptionRegexp(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingSearchOptionsKMRegexp, value);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VTapeSettings::GetTapeSearchOptionMatchCase() const -> bool
|
auto VTapeSettings::GetTapeSearchOptionMatchCase() const -> bool
|
||||||
{
|
{
|
||||||
|
@ -150,3 +211,38 @@ void VTapeSettings::SetTapeSearchOptionMatchCase(bool value)
|
||||||
{
|
{
|
||||||
setValue(*settingSearchOptionsTapeMatchCase, value);
|
setValue(*settingSearchOptionsTapeMatchCase, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VTapeSettings::GetKMSearchOptionMatchCase() const -> bool
|
||||||
|
{
|
||||||
|
return value(*settingSearchOptionsKMMatchCase, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTapeSettings::SetKMSearchOptionMatchCase(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingSearchOptionsKMMatchCase, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VTapeSettings::GetRecentKMFileList() const -> QStringList
|
||||||
|
{
|
||||||
|
const QStringList files = value(*settingKnownMeasurementsRecentFileList).toStringList();
|
||||||
|
QStringList cleared;
|
||||||
|
|
||||||
|
for (const auto &f : files)
|
||||||
|
{
|
||||||
|
if (QFileInfo::exists(f))
|
||||||
|
{
|
||||||
|
cleared.append(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cleared;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VTapeSettings::SetRecentKMFileList(const QStringList &value)
|
||||||
|
{
|
||||||
|
setValue(*settingKnownMeasurementsRecentFileList, value);
|
||||||
|
}
|
||||||
|
|
|
@ -57,18 +57,36 @@ public:
|
||||||
auto GetTapeSearchHistory() const -> QStringList;
|
auto GetTapeSearchHistory() const -> QStringList;
|
||||||
void SetTapeSearchHistory(const QStringList &history);
|
void SetTapeSearchHistory(const QStringList &history);
|
||||||
|
|
||||||
|
auto GetKMSearchHistory() const -> QStringList;
|
||||||
|
void SetKMSearchHistory(const QStringList &history);
|
||||||
|
|
||||||
auto GetTapeSearchOptionUseUnicodeProperties() const -> bool;
|
auto GetTapeSearchOptionUseUnicodeProperties() const -> bool;
|
||||||
void SetTapeSearchOptionUseUnicodeProperties(bool value);
|
void SetTapeSearchOptionUseUnicodeProperties(bool value);
|
||||||
|
|
||||||
|
auto GetKMSearchOptionUseUnicodeProperties() const -> bool;
|
||||||
|
void SetKMSearchOptionUseUnicodeProperties(bool value);
|
||||||
|
|
||||||
auto GetTapeSearchOptionWholeWord() const -> bool;
|
auto GetTapeSearchOptionWholeWord() const -> bool;
|
||||||
void SetTapeSearchOptionWholeWord(bool value);
|
void SetTapeSearchOptionWholeWord(bool value);
|
||||||
|
|
||||||
|
auto GetKMSearchOptionWholeWord() const -> bool;
|
||||||
|
void SetKMSearchOptionWholeWord(bool value);
|
||||||
|
|
||||||
auto GetTapeSearchOptionRegexp() const -> bool;
|
auto GetTapeSearchOptionRegexp() const -> bool;
|
||||||
void SetTapeSearchOptionRegexp(bool value);
|
void SetTapeSearchOptionRegexp(bool value);
|
||||||
|
|
||||||
|
auto GetKMSearchOptionRegexp() const -> bool;
|
||||||
|
void SetKMSearchOptionRegexp(bool value);
|
||||||
|
|
||||||
auto GetTapeSearchOptionMatchCase() const -> bool;
|
auto GetTapeSearchOptionMatchCase() const -> bool;
|
||||||
void SetTapeSearchOptionMatchCase(bool value);
|
void SetTapeSearchOptionMatchCase(bool value);
|
||||||
|
|
||||||
|
auto GetKMSearchOptionMatchCase() const -> bool;
|
||||||
|
void SetKMSearchOptionMatchCase(bool value);
|
||||||
|
|
||||||
|
auto GetRecentKMFileList() const -> QStringList;
|
||||||
|
void SetRecentKMFileList(const QStringList &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VTapeSettings) // NOLINT
|
Q_DISABLE_COPY_MOVE(VTapeSettings) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -736,7 +736,7 @@ void VApplication::StartDetachedProcess(const QString &program, const QStringLis
|
||||||
const QString workingDirectory = QFileInfo(program).absoluteDir().absolutePath();
|
const QString workingDirectory = QFileInfo(program).absoluteDir().absolutePath();
|
||||||
QProcess::startDetached(program, arguments, workingDirectory);
|
QProcess::startDetached(program, arguments, workingDirectory);
|
||||||
#else
|
#else
|
||||||
if (not program.endsWith(".app"))
|
if (not program.endsWith(".app"_L1))
|
||||||
{
|
{
|
||||||
const QString workingDirectory = QFileInfo(program).absoluteDir().absolutePath();
|
const QString workingDirectory = QFileInfo(program).absoluteDir().absolutePath();
|
||||||
QProcess::startDetached(program, arguments, workingDirectory);
|
QProcess::startDetached(program, arguments, workingDirectory);
|
||||||
|
@ -746,11 +746,11 @@ void VApplication::StartDetachedProcess(const QString &program, const QStringLis
|
||||||
QStringList openArguments{"-n", QStringLiteral("/Applications/%1").arg(program)};
|
QStringList openArguments{"-n", QStringLiteral("/Applications/%1").arg(program)};
|
||||||
if (not arguments.isEmpty())
|
if (not arguments.isEmpty())
|
||||||
{
|
{
|
||||||
openArguments.append("--args");
|
openArguments.append("--args"_L1);
|
||||||
openArguments += arguments;
|
openArguments += arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcess::startDetached("open", openArguments);
|
QProcess::startDetached("open"_L1, openArguments);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -2165,33 +2165,33 @@ void MainWindow::ShowMeasurements()
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments.append(absoluteMPath);
|
arguments.append(absoluteMPath);
|
||||||
arguments.append(QStringLiteral("-u"));
|
arguments.append("-u"_L1);
|
||||||
arguments.append(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
arguments.append(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
|
|
||||||
if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
|
if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
if (m_currentDimensionA > 0)
|
if (m_currentDimensionA > 0)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("-a"));
|
arguments.append("-a"_L1);
|
||||||
arguments.append(QString::number(m_currentDimensionA));
|
arguments.append(QString::number(m_currentDimensionA));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentDimensionB > 0)
|
if (m_currentDimensionB > 0)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("-b"));
|
arguments.append("-b"_L1);
|
||||||
arguments.append(QString::number(m_currentDimensionB));
|
arguments.append(QString::number(m_currentDimensionB));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentDimensionC > 0)
|
if (m_currentDimensionC > 0)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("-c"));
|
arguments.append("-c"_L1);
|
||||||
arguments.append(QString::number(m_currentDimensionC));
|
arguments.append(QString::number(m_currentDimensionC));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNoScaling)
|
if (isNoScaling)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("--") + LONG_OPTION_NO_HDPI_SCALING);
|
arguments.append("--"_L1 + LONG_OPTION_NO_HDPI_SCALING);
|
||||||
}
|
}
|
||||||
|
|
||||||
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
||||||
|
@ -4079,7 +4079,7 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
|
||||||
QString newFileName = tr("pattern") + QStringLiteral(".val");
|
QString newFileName = tr("pattern") + QStringLiteral(".val");
|
||||||
if (not patternPath.isEmpty())
|
if (not patternPath.isEmpty())
|
||||||
{
|
{
|
||||||
newFileName = StrippedName(patternPath);
|
newFileName = QFileInfo(patternPath).fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filters(tr("Pattern files") + QStringLiteral("(*.val)"));
|
QString filters(tr("Pattern files") + QStringLiteral("(*.val)"));
|
||||||
|
@ -5186,7 +5186,7 @@ void MainWindow::ActionOpenTape_triggered()
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
if (isNoScaling)
|
if (isNoScaling)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("--") + LONG_OPTION_NO_HDPI_SCALING);
|
arguments.append("--"_L1 + LONG_OPTION_NO_HDPI_SCALING);
|
||||||
}
|
}
|
||||||
|
|
||||||
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
||||||
|
@ -6282,7 +6282,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileName.endsWith(QStringLiteral(".vit")) || fileName.endsWith(QStringLiteral(".vst")))
|
if (fileName.endsWith(".vit"_L1) || fileName.endsWith(".vst"_L1))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -6296,7 +6296,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
|
||||||
QStringList arguments{fileName};
|
QStringList arguments{fileName};
|
||||||
if (isNoScaling)
|
if (isNoScaling)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("--") + LONG_OPTION_NO_HDPI_SCALING);
|
arguments.append("--"_L1 + LONG_OPTION_NO_HDPI_SCALING);
|
||||||
}
|
}
|
||||||
|
|
||||||
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
||||||
|
@ -6317,14 +6317,30 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileName.endsWith(QStringLiteral(".vlt")))
|
if (fileName.endsWith(".vkm"_L1))
|
||||||
{
|
{
|
||||||
// Here comes undocumented Valentina's feature.
|
// Here comes undocumented Valentina's feature.
|
||||||
// Because app bundle in Mac OS X doesn't allow setup assosiation for Puzzle we must do this through Valentina
|
// Because app bundle in Mac OS X doesn't allow setup assosiation for Puzzle we must do this through Valentina
|
||||||
QStringList arguments{fileName};
|
QStringList arguments{fileName};
|
||||||
if (isNoScaling)
|
if (isNoScaling)
|
||||||
{
|
{
|
||||||
arguments.append(QStringLiteral("--") + LONG_OPTION_NO_HDPI_SCALING);
|
arguments.append("--"_L1 + LONG_OPTION_NO_HDPI_SCALING);
|
||||||
|
arguments.append("--known"_L1);
|
||||||
|
}
|
||||||
|
|
||||||
|
VApplication::StartDetachedProcess(VApplication::TapeFilePath(), arguments);
|
||||||
|
QCoreApplication::exit(V_EX_OK);
|
||||||
|
return false; // stop continue processing
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName.endsWith(".vlt"_L1))
|
||||||
|
{
|
||||||
|
// Here comes undocumented Valentina's feature.
|
||||||
|
// Because app bundle in Mac OS X doesn't allow setup assosiation for Puzzle we must do this through Valentina
|
||||||
|
QStringList arguments{fileName};
|
||||||
|
if (isNoScaling)
|
||||||
|
{
|
||||||
|
arguments.append("--"_L1 + LONG_OPTION_NO_HDPI_SCALING);
|
||||||
}
|
}
|
||||||
|
|
||||||
VApplication::StartDetachedProcess(VApplication::PuzzleFilePath(), arguments);
|
VApplication::StartDetachedProcess(VApplication::PuzzleFilePath(), arguments);
|
||||||
|
@ -7451,7 +7467,7 @@ auto MainWindow::GetPatternFileName() -> QString
|
||||||
QString shownName = tr("untitled.val");
|
QString shownName = tr("untitled.val");
|
||||||
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
|
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
|
||||||
{
|
{
|
||||||
shownName = StrippedName(VAbstractValApplication::VApp()->GetPatternPath());
|
shownName = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).fileName();
|
||||||
}
|
}
|
||||||
shownName += "[*]"_L1;
|
shownName += "[*]"_L1;
|
||||||
return shownName;
|
return shownName;
|
||||||
|
@ -7466,7 +7482,7 @@ auto MainWindow::GetMeasurementFileName() -> QString
|
||||||
}
|
}
|
||||||
|
|
||||||
QString shownName = QStringLiteral(" [");
|
QString shownName = QStringLiteral(" [");
|
||||||
shownName += StrippedName(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
|
shownName += QFileInfo(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath())).fileName();
|
||||||
|
|
||||||
if (m_mChanges)
|
if (m_mChanges)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,4 +98,9 @@
|
||||||
<xs:pattern value="image/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
|
<xs:pattern value="image/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="uuid">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="|\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<xs:element name="measurements">
|
<xs:element name="measurements">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="m" maxOccurs="unbounded" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="m" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:simpleContent>
|
<xs:simpleContent>
|
||||||
<xs:extension base="xs:string">
|
<xs:extension base="xs:string">
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<xs:attribute type="xs:string" name="full_name" use="optional"/>
|
<xs:attribute type="xs:string" name="full_name" use="optional"/>
|
||||||
<xs:attribute type="shortName" name="name" use="required"/>
|
<xs:attribute type="shortName" name="name" use="required"/>
|
||||||
<xs:attribute type="xs:string" name="formula" use="optional"/>
|
<xs:attribute type="xs:string" name="formula" use="optional"/>
|
||||||
<xs:attribute type="uid" name="diagram" use="optional"/>
|
<xs:attribute type="uuid" name="diagram" use="optional"/>
|
||||||
<xs:attribute name="specialUnits" type="xs:boolean" use="optional"/>
|
<xs:attribute name="specialUnits" type="xs:boolean" use="optional"/>
|
||||||
<xs:attribute name="group" type="xs:string" use="optional"/>
|
<xs:attribute name="group" type="xs:string" use="optional"/>
|
||||||
</xs:extension>
|
</xs:extension>
|
||||||
|
@ -73,4 +73,9 @@
|
||||||
<xs:pattern value="image/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
|
<xs:pattern value="image/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="uuid">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="|\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
|
|
|
@ -151,4 +151,9 @@
|
||||||
<xs:pattern value="image/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
|
<xs:pattern value="image/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="uuid">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="|\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
|
|
|
@ -160,6 +160,12 @@ auto VPatternImage::GetPixmap() const -> QPixmap
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPatternImage::GetPixmap(int width, int height) const -> QPixmap
|
auto VPatternImage::GetPixmap(int width, int height) const -> QPixmap
|
||||||
|
{
|
||||||
|
return GetPixmap(QSize(width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPatternImage::GetPixmap(const QSize &size) const -> QPixmap
|
||||||
{
|
{
|
||||||
if (not IsValid())
|
if (not IsValid())
|
||||||
{
|
{
|
||||||
|
@ -171,7 +177,7 @@ auto VPatternImage::GetPixmap(int width, int height) const -> QPixmap
|
||||||
buffer.open(QIODevice::ReadOnly);
|
buffer.open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
QImageReader imageReader(&buffer);
|
QImageReader imageReader(&buffer);
|
||||||
imageReader.setScaledSize(QSize(width, height));
|
imageReader.setScaledSize(size);
|
||||||
|
|
||||||
QImage image = imageReader.read();
|
QImage image = imageReader.read();
|
||||||
if (image.isNull())
|
if (image.isNull())
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
|
|
||||||
auto GetPixmap() const -> QPixmap;
|
auto GetPixmap() const -> QPixmap;
|
||||||
auto GetPixmap(int width, int height) const -> QPixmap;
|
auto GetPixmap(int width, int height) const -> QPixmap;
|
||||||
|
auto GetPixmap(const QSize &size) const -> QPixmap;
|
||||||
|
|
||||||
auto ErrorString() const -> const QString &;
|
auto ErrorString() const -> const QString &;
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,7 @@ static auto EatWhiteSpace(const QString &formula, int &index) -> QChar
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c = GetChar(formula, index);
|
c = GetChar(formula, index);
|
||||||
}
|
} while (c != QmuEOF && c.isSpace());
|
||||||
while ( c != QmuEOF && c.isSpace() );
|
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -181,23 +180,8 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC
|
||||||
Q_UNUSED(decimalPoint)
|
Q_UNUSED(decimalPoint)
|
||||||
Q_UNUSED(groupSeparator)
|
Q_UNUSED(groupSeparator)
|
||||||
|
|
||||||
QSet<QChar> reserved
|
QSet<QChar> reserved{positiveSign, negativeSign, sign0, sign1, sign2, sign3, sign4,
|
||||||
{
|
sign5, sign6, sign7, sign8, sign9, expUpper, expLower};
|
||||||
positiveSign,
|
|
||||||
negativeSign,
|
|
||||||
sign0,
|
|
||||||
sign1,
|
|
||||||
sign2,
|
|
||||||
sign3,
|
|
||||||
sign4,
|
|
||||||
sign5,
|
|
||||||
sign6,
|
|
||||||
sign7,
|
|
||||||
sign8,
|
|
||||||
sign9,
|
|
||||||
expUpper,
|
|
||||||
expLower
|
|
||||||
};
|
|
||||||
|
|
||||||
if (reserved.contains(decimal) || reserved.contains(thousand))
|
if (reserved.contains(decimal) || reserved.contains(thousand))
|
||||||
{
|
{
|
||||||
|
@ -206,17 +190,72 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC
|
||||||
}
|
}
|
||||||
|
|
||||||
// row - current state, column - new state
|
// row - current state, column - new state
|
||||||
static uchar table[9][6] =
|
static uchar table[9][6] = {
|
||||||
{
|
|
||||||
/* None InputSign InputThousand InputDigit InputDot InputExp */
|
/* None InputSign InputThousand InputDigit InputDot InputExp */
|
||||||
{ 0, State::Sign, 0, State::Mantissa, State::Dot, 0, }, // Init
|
{
|
||||||
{ 0, 0, 0, State::Mantissa, State::Dot, 0, }, // Sign
|
0,
|
||||||
{ 0, 0, 0, State::Mantissa, 0, 0, }, // Thousand
|
State::Sign,
|
||||||
{ State::Done, State::Done, State::Thousand, State::Mantissa, State::Dot, State::ExpMark,}, // Mantissa
|
0,
|
||||||
{ 0, 0, 0, State::Abscissa, 0, 0, }, // Dot
|
State::Mantissa,
|
||||||
{ State::Done, State::Done, 0, State::Abscissa, 0, State::ExpMark,}, // Abscissa
|
State::Dot,
|
||||||
{ 0, State::ExpSign, 0, State::Exponent, 0, 0, }, // ExpMark
|
0,
|
||||||
{ 0, 0, 0, State::Exponent, 0, 0, }, // ExpSign
|
}, // Init
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
State::Mantissa,
|
||||||
|
State::Dot,
|
||||||
|
0,
|
||||||
|
}, // Sign
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
State::Mantissa,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
}, // Thousand
|
||||||
|
{
|
||||||
|
State::Done,
|
||||||
|
State::Done,
|
||||||
|
State::Thousand,
|
||||||
|
State::Mantissa,
|
||||||
|
State::Dot,
|
||||||
|
State::ExpMark,
|
||||||
|
}, // Mantissa
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
State::Abscissa,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
}, // Dot
|
||||||
|
{
|
||||||
|
State::Done,
|
||||||
|
State::Done,
|
||||||
|
0,
|
||||||
|
State::Abscissa,
|
||||||
|
0,
|
||||||
|
State::ExpMark,
|
||||||
|
}, // Abscissa
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
State::ExpSign,
|
||||||
|
0,
|
||||||
|
State::Exponent,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
}, // ExpMark
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
State::Exponent,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
}, // ExpSign
|
||||||
{State::Done, 0, 0, State::Exponent, 0, State::Done} // Exponent
|
{State::Done, 0, 0, State::Exponent, 0, State::Done} // Exponent
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -279,7 +318,7 @@ auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QC
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto NameRegExp() -> QString
|
auto NameRegExp(VariableRegex type) -> QString
|
||||||
{
|
{
|
||||||
static QString regex;
|
static QString regex;
|
||||||
|
|
||||||
|
@ -325,9 +364,22 @@ auto NameRegExp() -> QString
|
||||||
// Here we use permanent start of string and end of string anchors \A and \z to match whole pattern as one
|
// Here we use permanent start of string and end of string anchors \A and \z to match whole pattern as one
|
||||||
// string. In some cases, a user may pass multiline or line that ends with a new line. To cover case with a new
|
// string. In some cases, a user may pass multiline or line that ends with a new line. To cover case with a new
|
||||||
// line at the end of string use /z anchor.
|
// line at the end of string use /z anchor.
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case VariableRegex::Variable:
|
||||||
regex = QString("\\A([^\\p{Nd}\\p{Zs}*\\/&|!<>^\\n\\()%1%2%3%4=?:;'\"]){1,1}"
|
regex = QString("\\A([^\\p{Nd}\\p{Zs}*\\/&|!<>^\\n\\()%1%2%3%4=?:;'\"]){1,1}"
|
||||||
"([^\\p{Zs}*\\/&|!<>^\\n\\()%1%2%3%4=?:;\"]){0,}\\z")
|
"([^\\p{Zs}*\\/&|!<>^\\n\\()%1%2%3%4=?:;\"]){0,}\\z")
|
||||||
.arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators);
|
.arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators);
|
||||||
|
break;
|
||||||
|
case VariableRegex::KnownMeasurement:
|
||||||
|
regex = QString("\\A([^@\\p{Nd}\\p{Zs}*\\/&|!<>^\\n\\()%1%2%3%4=?:;'\"]){1,1}"
|
||||||
|
"([^\\p{Zs}*\\/&|!<>^\\n\\()%1%2%3%4=?:;\"]){0,}\\z")
|
||||||
|
.arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return regex;
|
return regex;
|
||||||
|
@ -356,21 +408,11 @@ auto FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos
|
||||||
auto SupportedLocale(const QLocale &locale) -> bool
|
auto SupportedLocale(const QLocale &locale) -> bool
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
return locale.positiveSign().size() == 1 &&
|
return locale.positiveSign().size() == 1 && locale.negativeSign().size() == 1 && locale.toString(0).size() == 1 &&
|
||||||
locale.negativeSign().size() == 1 &&
|
locale.toString(1).size() == 1 && locale.toString(2).size() == 1 && locale.toString(3).size() == 1 &&
|
||||||
locale.toString(0).size() == 1 &&
|
locale.toString(4).size() == 1 && locale.toString(5).size() == 1 && locale.toString(6).size() == 1 &&
|
||||||
locale.toString(1).size() == 1 &&
|
locale.toString(7).size() == 1 && locale.toString(8).size() == 1 && locale.toString(9).size() == 1 &&
|
||||||
locale.toString(2).size() == 1 &&
|
locale.exponential().size() == 1 && locale.decimalPoint().size() == 1 && locale.groupSeparator().size() == 1;
|
||||||
locale.toString(3).size() == 1 &&
|
|
||||||
locale.toString(4).size() == 1 &&
|
|
||||||
locale.toString(5).size() == 1 &&
|
|
||||||
locale.toString(6).size() == 1 &&
|
|
||||||
locale.toString(7).size() == 1 &&
|
|
||||||
locale.toString(8).size() == 1 &&
|
|
||||||
locale.toString(9).size() == 1 &&
|
|
||||||
locale.exponential().size() == 1 &&
|
|
||||||
locale.decimalPoint().size() == 1 &&
|
|
||||||
locale.groupSeparator().size() == 1;
|
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(locale)
|
Q_UNUSED(locale)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -92,7 +92,13 @@ QMUPARSERSHARED_EXPORT auto LocaleGroupSeparator(const QLocale &locale) -> QChar
|
||||||
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
|
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
|
||||||
const QChar groupSeparator = LocaleGroupSeparator((locale));
|
const QChar groupSeparator = LocaleGroupSeparator((locale));
|
||||||
|
|
||||||
QMUPARSERSHARED_EXPORT auto NameRegExp() -> QString;
|
enum class VariableRegex
|
||||||
|
{
|
||||||
|
Variable,
|
||||||
|
KnownMeasurement
|
||||||
|
};
|
||||||
|
|
||||||
|
QMUPARSERSHARED_EXPORT auto NameRegExp(VariableRegex type = VariableRegex::Variable) -> QString;
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ auto VKnownMeasurements::OrderedGroupMeasurments(const QString &group) const ->
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VKnownMeasurements::Images() const -> QHash<QUuid, VPatternImage>
|
auto VKnownMeasurements::Images() const -> QMap<QUuid, VPatternImage>
|
||||||
{
|
{
|
||||||
return d->m_images;
|
return d->m_images;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
auto Measurments() const -> QHash<QString, VKnownMeasurement>;
|
auto Measurments() const -> QHash<QString, VKnownMeasurement>;
|
||||||
auto OrderedMeasurments() const -> QMap<int, VKnownMeasurement>;
|
auto OrderedMeasurments() const -> QMap<int, VKnownMeasurement>;
|
||||||
auto OrderedGroupMeasurments(const QString &group) const -> QMap<int, VKnownMeasurement>;
|
auto OrderedGroupMeasurments(const QString &group) const -> QMap<int, VKnownMeasurement>;
|
||||||
auto Images() const -> QHash<QUuid, VPatternImage>;
|
auto Images() const -> QMap<QUuid, VPatternImage>;
|
||||||
auto Groups() const -> QStringList;
|
auto Groups() const -> QStringList;
|
||||||
|
|
||||||
auto Measurement(const QString &name) const -> VKnownMeasurement;
|
auto Measurement(const QString &name) const -> VKnownMeasurement;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
QString m_description{}; // NOLINT (misc-non-private-member-variables-in-classes)
|
QString m_description{}; // NOLINT (misc-non-private-member-variables-in-classes)
|
||||||
bool m_readOnly{false}; // NOLINT (misc-non-private-member-variables-in-classes)
|
bool m_readOnly{false}; // NOLINT (misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QHash<QUuid, VPatternImage> m_images{}; // NOLINT (misc-non-private-member-variables-in-classes)
|
QMap<QUuid, VPatternImage> m_images{}; // NOLINT (misc-non-private-member-variables-in-classes)
|
||||||
QHash<QString, VKnownMeasurement> m_measurements{}; // NOLINT (misc-non-private-member-variables-in-classes)
|
QHash<QString, VKnownMeasurement> m_measurements{}; // NOLINT (misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -82,6 +82,11 @@ auto VKnownMeasurementsDatabase::AllKnownMeasurements() const -> QHash<QUuid, VK
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VKnownMeasurementsDatabase::KnownMeasurements(const QUuid &id) const -> VKnownMeasurements
|
auto VKnownMeasurementsDatabase::KnownMeasurements(const QUuid &id) const -> VKnownMeasurements
|
||||||
{
|
{
|
||||||
|
if (id.isNull())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
if (m_measurementsCache.contains(id))
|
if (m_measurementsCache.contains(id))
|
||||||
{
|
{
|
||||||
return {*m_measurementsCache.object(id)};
|
return {*m_measurementsCache.object(id)};
|
||||||
|
|
|
@ -54,7 +54,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagKnownMeasurements, ("known-measureme
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagMeasurements, ("measurements"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagMeasurements, ("measurements"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagMeasurement, ("m"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagMeasurement, ("m"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagDiagrams, ("diagrams"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagDiagrams, ("diagrams"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagImage, ("tagImage"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagImage, ("image"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagName, ("name"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagName, ("name"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagDescription, ("description"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagDescription, ("description"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagInfo, ("info"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, tagInfo, ("info"_L1)) // NOLINT
|
||||||
|
@ -169,8 +169,10 @@ void VKnownMeasurementsDocument::RemoveMeasurement(const QString &name)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VKnownMeasurementsDocument::RemoveImage(const QUuid &id)
|
void VKnownMeasurementsDocument::RemoveImage(const QUuid &id)
|
||||||
{
|
{
|
||||||
const QDomNodeList list = elementsByTagName(*tagMeasurements);
|
const QDomNodeList list = elementsByTagName(*tagDiagrams);
|
||||||
list.at(0).removeChild(FindImage(id));
|
list.at(0).removeChild(FindImage(id));
|
||||||
|
|
||||||
|
UpdateDiagramId(id, QUuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -250,7 +252,7 @@ void VKnownMeasurementsDocument::MoveBottom(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QUuid VKnownMeasurementsDocument::GetUId() const
|
auto VKnownMeasurementsDocument::GetUId() const -> QUuid
|
||||||
{
|
{
|
||||||
QDomNode root = documentElement();
|
QDomNode root = documentElement();
|
||||||
if (not root.isNull() && root.isElement())
|
if (not root.isNull() && root.isElement())
|
||||||
|
@ -258,7 +260,7 @@ QUuid VKnownMeasurementsDocument::GetUId() const
|
||||||
const QDomElement rootElement = root.toElement();
|
const QDomElement rootElement = root.toElement();
|
||||||
if (not rootElement.isNull())
|
if (not rootElement.isNull())
|
||||||
{
|
{
|
||||||
return QUuid(GetParametrEmptyString(rootElement, AttrKMVersion));
|
return QUuid(GetParametrEmptyString(rootElement, *attrUId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
@ -283,7 +285,7 @@ void VKnownMeasurementsDocument::SetUId(const QUuid &id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VKnownMeasurementsDocument::Name() const
|
auto VKnownMeasurementsDocument::Name() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(*tagName, QString());
|
return UniqueTagText(*tagName, QString());
|
||||||
}
|
}
|
||||||
|
@ -295,7 +297,7 @@ void VKnownMeasurementsDocument::SetName(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VKnownMeasurementsDocument::Description() const
|
auto VKnownMeasurementsDocument::Description() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(*tagDescription, QString());
|
return UniqueTagText(*tagDescription, QString());
|
||||||
}
|
}
|
||||||
|
@ -307,7 +309,7 @@ void VKnownMeasurementsDocument::SetDescription(const QString &desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VKnownMeasurementsDocument::IsReadOnly() const
|
auto VKnownMeasurementsDocument::IsReadOnly() const -> bool
|
||||||
{
|
{
|
||||||
QDomNode root = documentElement();
|
QDomNode root = documentElement();
|
||||||
if (not root.isNull() && root.isElement())
|
if (not root.isNull() && root.isElement())
|
||||||
|
@ -487,7 +489,23 @@ void VKnownMeasurementsDocument::SetImageTitle(const QUuid &id, const QString &t
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VKnownMeasurementsDocument::MakeEmptyMeasurement(const QString &name)
|
void VKnownMeasurementsDocument::SetImageId(const QUuid &id, const QUuid &newId)
|
||||||
|
{
|
||||||
|
QDomElement node = FindImage(id);
|
||||||
|
if (not node.isNull())
|
||||||
|
{
|
||||||
|
SetAttribute<QUuid>(node, *attrUId, newId);
|
||||||
|
|
||||||
|
UpdateDiagramId(id, newId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << tr("Can't find image by id '%1'").arg(id.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VKnownMeasurementsDocument::MakeEmptyMeasurement(const QString &name) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement element = createElement(*tagMeasurement);
|
QDomElement element = createElement(*tagMeasurement);
|
||||||
SetAttribute(element, *attrName, name);
|
SetAttribute(element, *attrName, name);
|
||||||
|
@ -524,7 +542,7 @@ auto VKnownMeasurementsDocument::FindM(const QString &name) const -> QDomElement
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VKnownMeasurementsDocument::MakeEmptyImage(const VPatternImage &image)
|
auto VKnownMeasurementsDocument::MakeEmptyImage(const VPatternImage &image) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement element = createElement(*tagImage);
|
QDomElement element = createElement(*tagImage);
|
||||||
|
|
||||||
|
@ -538,7 +556,7 @@ QDomElement VKnownMeasurementsDocument::MakeEmptyImage(const VPatternImage &imag
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VKnownMeasurementsDocument::FindImage(const QUuid &id) const
|
auto VKnownMeasurementsDocument::FindImage(const QUuid &id) const -> QDomElement
|
||||||
{
|
{
|
||||||
if (id.isNull())
|
if (id.isNull())
|
||||||
{
|
{
|
||||||
|
@ -615,3 +633,23 @@ void VKnownMeasurementsDocument::ReadMeasurements(VKnownMeasurements &known) con
|
||||||
known.AddMeasurement(m);
|
known.AddMeasurement(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VKnownMeasurementsDocument::UpdateDiagramId(const QUuid &oldId, const QUuid &newId)
|
||||||
|
{
|
||||||
|
QDomNodeList list = elementsByTagName(*tagMeasurement);
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
QDomElement domElement = list.at(i).toElement();
|
||||||
|
if (domElement.isNull())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QUuid(GetParametrEmptyString(domElement, *attrDiagram)) == oldId)
|
||||||
|
{
|
||||||
|
SetAttribute(domElement, *attrDiagram, newId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
class VKnownMeasurements;
|
class VKnownMeasurements;
|
||||||
class VPatternImage;
|
class VPatternImage;
|
||||||
|
class QUuid;
|
||||||
|
|
||||||
class VKnownMeasurementsDocument : public VDomDocument
|
class VKnownMeasurementsDocument : public VDomDocument
|
||||||
{
|
{
|
||||||
|
@ -83,6 +84,7 @@ public:
|
||||||
|
|
||||||
void SetImageContent(const QUuid &id, const VPatternImage &image);
|
void SetImageContent(const QUuid &id, const VPatternImage &image);
|
||||||
void SetImageTitle(const QUuid &id, const QString &text);
|
void SetImageTitle(const QUuid &id, const QString &text);
|
||||||
|
void SetImageId(const QUuid &id, const QUuid &newId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VKnownMeasurementsDocument) // NOLINT
|
Q_DISABLE_COPY_MOVE(VKnownMeasurementsDocument) // NOLINT
|
||||||
|
@ -94,6 +96,8 @@ private:
|
||||||
|
|
||||||
void ReadImages(VKnownMeasurements &known) const;
|
void ReadImages(VKnownMeasurements &known) const;
|
||||||
void ReadMeasurements(VKnownMeasurements &known) const;
|
void ReadMeasurements(VKnownMeasurements &known) const;
|
||||||
|
|
||||||
|
void UpdateDiagramId(const QUuid &oldId, const QUuid &newId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VKNOWNMEASUREMENTSDOCUMENT_H
|
#endif // VKNOWNMEASUREMENTSDOCUMENT_H
|
||||||
|
|
|
@ -587,7 +587,7 @@ auto WatermarkWindow::GetWatermarkFileName() -> QString
|
||||||
QString shownName = tr("untitled.vwm");
|
QString shownName = tr("untitled.vwm");
|
||||||
if (not m_curFile.isEmpty())
|
if (not m_curFile.isEmpty())
|
||||||
{
|
{
|
||||||
shownName = StrippedName(m_curFile);
|
shownName = QFileInfo(m_curFile).fileName();
|
||||||
}
|
}
|
||||||
shownName += "[*]"_L1;
|
shownName += "[*]"_L1;
|
||||||
return shownName;
|
return shownName;
|
||||||
|
|
|
@ -172,17 +172,6 @@ auto SupportedLocales() -> QStringList
|
||||||
"fi_FI", "en_US", "en_CA", "en_IN", "ro_RO", "zh_CN", "pt_BR", "el_GR", "pl_PL"};
|
"fi_FI", "en_US", "en_CA", "en_IN", "ro_RO", "zh_CN", "pt_BR", "el_GR", "pl_PL"};
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief strippedName the function call around curFile to exclude the path to the file.
|
|
||||||
* @param fullFileName full path to the file.
|
|
||||||
* @return file name.
|
|
||||||
*/
|
|
||||||
auto StrippedName(const QString &fullFileName) -> QString
|
|
||||||
{
|
|
||||||
return QFileInfo(fullFileName).fileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto RelativeMPath(const QString &patternPath, const QString &absoluteMPath) -> QString
|
auto RelativeMPath(const QString &patternPath, const QString &absoluteMPath) -> QString
|
||||||
{
|
{
|
||||||
|
|
|
@ -739,7 +739,6 @@ void InitLanguages(QComboBox *combobox);
|
||||||
void InitPieceLabelLanguages(QComboBox *combobox);
|
void InitPieceLabelLanguages(QComboBox *combobox);
|
||||||
Q_REQUIRED_RESULT auto SupportedLocales() -> QStringList;
|
Q_REQUIRED_RESULT auto SupportedLocales() -> QStringList;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT auto StrippedName(const QString &fullFileName) -> QString;
|
|
||||||
Q_REQUIRED_RESULT auto RelativeMPath(const QString &patternPath, const QString &absoluteMPath) -> QString;
|
Q_REQUIRED_RESULT auto RelativeMPath(const QString &patternPath, const QString &absoluteMPath) -> QString;
|
||||||
Q_REQUIRED_RESULT auto AbsoluteMPath(const QString &patternPath, const QString &relativeMPath) -> QString;
|
Q_REQUIRED_RESULT auto AbsoluteMPath(const QString &patternPath, const QString &relativeMPath) -> QString;
|
||||||
|
|
||||||
|
|
|
@ -209,5 +209,9 @@
|
||||||
<file>icon/dark/16x16/remove-image.png</file>
|
<file>icon/dark/16x16/remove-image.png</file>
|
||||||
<file>icon/dark/16x16/insert-image@2x.png</file>
|
<file>icon/dark/16x16/insert-image@2x.png</file>
|
||||||
<file>icon/dark/16x16/insert-image.png</file>
|
<file>icon/dark/16x16/insert-image.png</file>
|
||||||
|
<file>icon/light/16x16/viewimage@2x.png</file>
|
||||||
|
<file>icon/light/16x16/viewimage.png</file>
|
||||||
|
<file>icon/dark/16x16/viewimage.png</file>
|
||||||
|
<file>icon/dark/16x16/viewimage@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/libs/vmisc/share/resources/icon/dark/16x16/viewimage.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/dark/16x16/viewimage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 357 B |
BIN
src/libs/vmisc/share/resources/icon/dark/16x16/viewimage@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/dark/16x16/viewimage@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 685 B |
BIN
src/libs/vmisc/share/resources/icon/light/16x16/viewimage.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/light/16x16/viewimage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 B |
BIN
src/libs/vmisc/share/resources/icon/light/16x16/viewimage@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/light/16x16/viewimage@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 653 B |
44
src/libs/vmisc/share/resources/icon/svg/dark/viewimage.svg
Normal file
44
src/libs/vmisc/share/resources/icon/svg/dark/viewimage.svg
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
id="svg1"
|
||||||
|
sodipodi:docname="viewimage.svg"
|
||||||
|
inkscape:export-filename="viewimage.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
inkscape:version="1.3 (1:1.3+202307231459+0e150ed6c4)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="70.625"
|
||||||
|
inkscape:cx="8"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1372"
|
||||||
|
inkscape:window-x="1920"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg1" />
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<style
|
||||||
|
id="current-color-scheme"
|
||||||
|
type="text/css">.ColorScheme-Text { color:#dedede; }</style>
|
||||||
|
</defs>
|
||||||
|
<path
|
||||||
|
class="ColorScheme-Text"
|
||||||
|
d="m2 2c-1.108 0-2 0.892-2 2v9c0 1.108 0.892 2 2 2h12c1.108 0 2-0.892 2-2v-9c0-1.108-0.892-2-2-2zm0 1h12c0.554 0 1 0.446 1 1v9l-5-5-3.4794 4-2.5206-2-3 3v-9c0-0.554 0.446-1 1-1zm2.5 2c-0.82843 0-1.5 0.67157-1.5 1.5s0.67157 1.5 1.5 1.5 1.5-0.67157 1.5-1.5-0.67157-1.5-1.5-1.5z"
|
||||||
|
fill="currentColor"
|
||||||
|
id="path1" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
44
src/libs/vmisc/share/resources/icon/svg/light/viewimage.svg
Normal file
44
src/libs/vmisc/share/resources/icon/svg/light/viewimage.svg
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
id="svg1"
|
||||||
|
sodipodi:docname="viewimage.svg"
|
||||||
|
inkscape:export-filename="viewimage@2x.png"
|
||||||
|
inkscape:export-xdpi="192"
|
||||||
|
inkscape:export-ydpi="192"
|
||||||
|
inkscape:version="1.3 (1:1.3+202307231459+0e150ed6c4)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="70.625"
|
||||||
|
inkscape:cx="8"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1372"
|
||||||
|
inkscape:window-x="1920"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg1" />
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<style
|
||||||
|
id="current-color-scheme"
|
||||||
|
type="text/css">.ColorScheme-Text { color:#363636; }</style>
|
||||||
|
</defs>
|
||||||
|
<path
|
||||||
|
class="ColorScheme-Text"
|
||||||
|
d="m2 2c-1.108 0-2 0.892-2 2v9c0 1.108 0.892 2 2 2h12c1.108 0 2-0.892 2-2v-9c0-1.108-0.892-2-2-2zm0 1h12c0.554 0 1 0.446 1 1v9l-5-5-3.4794 4-2.5206-2-3 3v-9c0-0.554 0.446-1 1-1zm2.5 2c-0.82843 0-1.5 0.67157-1.5 1.5s0.67157 1.5 1.5 1.5 1.5-0.67157 1.5-1.5-0.67157-1.5-1.5-1.5z"
|
||||||
|
fill="currentColor"
|
||||||
|
id="path1" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -72,6 +72,12 @@ using namespace bpstd::literals::chrono_literals;
|
||||||
#include "vapplicationstyle.h"
|
#include "vapplicationstyle.h"
|
||||||
#include "vscenestylesheet.h"
|
#include "vscenestylesheet.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||||
|
#include "../vmisc/compatibility.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||||
|
@ -282,7 +288,7 @@ void ActivateDefaultTheme()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto GetResourceName(const QString &root, const QString &iconName, bool dark) -> QString
|
auto GetResourceName(const QString &root, const QString &iconName, bool dark) -> QString
|
||||||
{
|
{
|
||||||
return QStringLiteral(":/%1/%2/%3").arg(root, dark ? "dark" : "light", iconName);
|
return QStringLiteral(":/%1/%2/%3").arg(root, dark ? "dark"_L1 : "light"_L1, iconName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -160,7 +160,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsPatternTranslateFormula, ("patt
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, ("recentFileList"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, ("recentFileList"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, ("restoreFileList"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, ("restoreFileList"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, ("geometry"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, ("geometry"_L1)) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralKMGeometry, ("kmGeometry"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, ("toolbarsState"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, ("toolbarsState"_L1)) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralKMToolbarsState, ("kmToolbarsState"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationThemeMode, ("configuration/themeMode"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationThemeMode, ("configuration/themeMode"_L1)) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, ("preferenceDialogSize"_L1)) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, ("preferenceDialogSize"_L1)) // NOLINT
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
|
@ -704,6 +706,18 @@ void VCommonSettings::SetGeometry(const QByteArray &value)
|
||||||
setValue(*settingGeneralGeometry, value);
|
setValue(*settingGeneralGeometry, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VCommonSettings::GetKMGeometry() const -> QByteArray
|
||||||
|
{
|
||||||
|
return value(*settingGeneralKMGeometry).toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetKMGeometry(const QByteArray &value)
|
||||||
|
{
|
||||||
|
setValue(*settingGeneralKMGeometry, value);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VCommonSettings::GetToolbarsState() const -> QByteArray
|
auto VCommonSettings::GetToolbarsState() const -> QByteArray
|
||||||
{
|
{
|
||||||
|
@ -716,6 +730,18 @@ void VCommonSettings::SetToolbarsState(const QByteArray &value)
|
||||||
setValue(*settingGeneralToolbarsState, value);
|
setValue(*settingGeneralToolbarsState, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VCommonSettings::GetKMToolbarsState() const -> QByteArray
|
||||||
|
{
|
||||||
|
return value(*settingGeneralKMToolbarsState).toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetKMToolbarsState(const QByteArray &value)
|
||||||
|
{
|
||||||
|
setValue(*settingGeneralKMToolbarsState, value);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VCommonSettings::GetPreferenceDialogSize() const -> QSize
|
auto VCommonSettings::GetPreferenceDialogSize() const -> QSize
|
||||||
{
|
{
|
||||||
|
|
|
@ -152,9 +152,15 @@ public:
|
||||||
auto GetGeometry() const -> QByteArray;
|
auto GetGeometry() const -> QByteArray;
|
||||||
void SetGeometry(const QByteArray &value);
|
void SetGeometry(const QByteArray &value);
|
||||||
|
|
||||||
|
auto GetKMGeometry() const -> QByteArray;
|
||||||
|
void SetKMGeometry(const QByteArray &value);
|
||||||
|
|
||||||
auto GetToolbarsState() const -> QByteArray;
|
auto GetToolbarsState() const -> QByteArray;
|
||||||
void SetToolbarsState(const QByteArray &value);
|
void SetToolbarsState(const QByteArray &value);
|
||||||
|
|
||||||
|
auto GetKMToolbarsState() const -> QByteArray;
|
||||||
|
void SetKMToolbarsState(const QByteArray &value);
|
||||||
|
|
||||||
auto GetPreferenceDialogSize() const -> QSize;
|
auto GetPreferenceDialogSize() const -> QSize;
|
||||||
void SetPreferenceDialogSize(const QSize &sz);
|
void SetPreferenceDialogSize(const QSize &sz);
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,26 @@ void DialogEditWrongFormula::ValChanged(int row)
|
||||||
if (ui->radioButtonStandardTable->isChecked())
|
if (ui->radioButtonStandardTable->isChecked())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VMeasurement> stable = m_data->GetVariable<VMeasurement>(name);
|
const QSharedPointer<VMeasurement> stable = m_data->GetVariable<VMeasurement>(name);
|
||||||
SetDescription(item->text(), *stable->GetValue(), stable->IsSpecialUnits(), stable->GetGuiText());
|
|
||||||
|
QString description;
|
||||||
|
|
||||||
|
if (!stable->IsCustom())
|
||||||
|
{
|
||||||
|
if (VKnownMeasurementsDatabase *db = VAbstractApplication::VApp()->KnownMeasurementsDatabase())
|
||||||
|
{
|
||||||
|
VKnownMeasurements known = db->KnownMeasurements(stable->GetKnownMeasurementsId());
|
||||||
|
if (known.IsValid())
|
||||||
|
{
|
||||||
|
description = known.Measurement(stable->GetName()).description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
description = stable->GetDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDescription(item->text(), *stable->GetValue(), stable->IsSpecialUnits(), description);
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonIncrements->isChecked() || ui->radioButtonPC->isChecked())
|
else if (ui->radioButtonIncrements->isChecked() || ui->radioButtonPC->isChecked())
|
||||||
{
|
{
|
||||||
|
@ -716,7 +735,7 @@ void DialogEditWrongFormula::ShowMeasurements(const QList<QSharedPointer<VMeasur
|
||||||
VKnownMeasurements known = db->KnownMeasurements(var->GetKnownMeasurementsId());
|
VKnownMeasurements known = db->KnownMeasurements(var->GetKnownMeasurementsId());
|
||||||
if (known.IsValid())
|
if (known.IsValid())
|
||||||
{
|
{
|
||||||
itemFullName->setText(known.Measurement(var->GetName()).description);
|
itemFullName->setText(known.Measurement(var->GetName()).fullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ void VAbstractMainWindow::UpdateRecentFileActions()
|
||||||
|
|
||||||
for (int i = 0; i < numRecentFiles; ++i)
|
for (int i = 0; i < numRecentFiles; ++i)
|
||||||
{
|
{
|
||||||
QString recent = recentFiles.at(i);
|
const QString& recent = recentFiles.at(i);
|
||||||
if (not recent.isEmpty())
|
if (not recent.isEmpty())
|
||||||
{
|
{
|
||||||
const QString text = QStringLiteral("&%1. %2").arg(i + 1).arg(recentFiles.at(i));
|
const QString text = QStringLiteral("&%1. %2").arg(i + 1).arg(recentFiles.at(i));
|
||||||
|
|
|
@ -57,9 +57,9 @@ public slots:
|
||||||
virtual void UpdateVisibilityGroups();
|
virtual void UpdateVisibilityGroups();
|
||||||
virtual void UpdateDetailsList();
|
virtual void UpdateDetailsList();
|
||||||
virtual void ZoomFitBestCurrent();
|
virtual void ZoomFitBestCurrent();
|
||||||
|
void WindowsLocale();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void WindowsLocale();
|
|
||||||
void ExportDataToCSV();
|
void ExportDataToCSV();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -11,6 +11,7 @@ VTestApp {
|
||||||
Depends { name: "VFormatLib" }
|
Depends { name: "VFormatLib" }
|
||||||
Depends { name: "ebr" }
|
Depends { name: "ebr" }
|
||||||
Depends { name: "autotest" }
|
Depends { name: "autotest" }
|
||||||
|
Depends { name: "QMUParserLib" }
|
||||||
|
|
||||||
Depends {
|
Depends {
|
||||||
name: "Qt.xmlpatterns"
|
name: "Qt.xmlpatterns"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user