Compare commits

...

5 commits

Author SHA1 Message Date
Roman Telezhynskyi 24fc530899 Fix build on macos. 2024-07-07 20:09:13 +03:00
Roman Telezhynskyi 2f86684d24 Add missing header. 2024-07-07 20:08:21 +03:00
Roman Telezhynskyi b27ad3016e Fix path to log file. 2024-07-07 18:49:37 +03:00
Roman Telezhynskyi f3329fb130 Calculate image size according to screen scale factor. 2024-07-07 16:43:01 +03:00
Roman Telezhynskyi 5b80eb38db Since Python 3.11 we cannot use global space to install packages. Use a virtual environment instead. 2024-07-07 11:47:37 +03:00
11 changed files with 67 additions and 41 deletions

View file

@ -620,7 +620,10 @@ for:
) 2>&1 | sed 's/^/CACHE: /' &
fi
- pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests
- mkdir ~/.venv
- python3 -m venv ~/.venv
- source ~/.venv/bin/activate
- pip3 install --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests
- export QTDIR=$(brew --prefix qt6)
- export PATH="$PATH:`python3 -m site --user-base`/bin:$QTDIR/bin"
- echo $PATH
@ -821,8 +824,11 @@ for:
) 2>&1 | sed 's/^/CACHE: /' &
fi
- mkdir ~/.venv
- python3 -m venv ~/.venv
- source ~/.venv/bin/activate
- sudo python3 -m pip install --upgrade pip
- pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests
- pip3 install --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests
- export PATH="`brew --prefix qbs`/bin:$PATH"
- echo $PATH
- clang --version

View file

@ -87,7 +87,7 @@ auto main(int argc, char *argv[]) -> int
Q_INIT_RESOURCE(win_dark_theme); // NOLINT
#ifdef CRASH_REPORTING
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR).toLower());
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR));
#endif
#if defined(Q_OS_WIN)

View file

@ -86,7 +86,7 @@ auto main(int argc, char *argv[]) -> int
Q_INIT_RESOURCE(win_dark_theme); // NOLINT
#ifdef CRASH_REPORTING
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR).toLower());
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR));
#endif
#if defined(Q_OS_WIN)

View file

@ -94,7 +94,7 @@ auto main(int argc, char *argv[]) -> int
Q_INIT_RESOURCE(win_dark_theme); // NOLINT
#ifdef CRASH_REPORTING
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR).toLower());
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR));
#endif
#if defined(Q_OS_WIN)

View file

@ -7890,7 +7890,7 @@ void MainWindow::PrintPatternMessage(QEvent *event)
ui->plainTextEditPatternMessages->appendPlainText(message);
if (not m_unreadPatternMessage.isNull())
{
m_unreadPatternMessage->setText(DialogWarningIcon() + tr("Pattern messages"));
m_unreadPatternMessage->setText(DialogWarningIcon(m_unreadPatternMessage) + tr("Pattern messages"));
}
}

View file

@ -165,7 +165,7 @@ auto GetExecutableDir() -> QString
//---------------------------------------------------------------------------------------------------------------------
auto InitializeCrashpad(const QString &appName) -> bool
{
QScopedPointer<VCommonSettings> const appSettings(AppSettings(appName));
QScopedPointer<VCommonSettings> const appSettings(AppSettings(appName.toLower()));
if (!appSettings->IsSendCrashReport())
{
@ -231,7 +231,7 @@ auto InitializeCrashpad(const QString &appName) -> bool
QMap<std::string, std::string> annotations;
annotations["format"] = "minidump"; // Required: Crashpad setting to save crash as a
annotations["database"] = dbName.toStdString(); // Required: BugSplat database
annotations["product"] = appName.toStdString(); // Required: BugSplat appName
annotations["product"] = appName.toLower().toStdString(); // Required: BugSplat appName
annotations["version"] = AppCrashVersion().toStdString(); // Required: BugSplat appVersion
QString clientID = appSettings->GetClientID();

View file

@ -45,7 +45,7 @@ auto LogDirPath(const QString &appName) -> QString
{
const auto logs = QStringLiteral("Logs");
QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
QString const logDirPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
if (logDirPath.isEmpty())
{
#if defined(Q_OS_WINDOWS)
@ -55,7 +55,7 @@ auto LogDirPath(const QString &appName) -> QString
#endif
}
#if defined(Q_OS_WINDOWS)
auto path = QStringList{logDirPath, logs}.join(QDir::separator());
auto path = QStringList{logDirPath, VER_COMPANYNAME_STR, appName, logs}.join(QDir::separator());
#else
auto path = QStringList{logDirPath, VER_COMPANYNAME_STR, logs, appName}.join(QDir::separator());
#endif
@ -72,9 +72,12 @@ VCrashPaths::VCrashPaths(QString exeDir)
//---------------------------------------------------------------------------------------------------------------------
auto VCrashPaths::GetAttachmentPath(const QString &appName) -> QString
{
return QStringLiteral("%1/%2-pid%3.log")
.arg(LogDirPath(appName), appName.toLower())
.arg(QCoreApplication::applicationPid());
QString path = QStringLiteral("%1/%2-pid%3.log")
.arg(LogDirPath(appName), appName.toLower())
.arg(QCoreApplication::applicationPid());
path = QDir::toNativeSeparators(path);
qDebug() << "Crashpad attachment path:" << path;
return path;
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -56,6 +56,7 @@
#include <QPlainTextEdit>
#include <QPushButton>
#include <QRegularExpression>
#include <QScreen>
#include <QTextCursor>
#include <QTimer>
#include <qnumeric.h>
@ -608,11 +609,20 @@ auto EachPointLabelIsUnique(QListWidget *listWidget) -> bool
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogWarningIcon() -> QString
auto DialogWarningIcon(QWidget *w) -> QString
{
const QIcon icon = FromTheme(VThemeIcon::DialogWarning);
const QPixmap pixmap = icon.pixmap(QSize(16, 16));
qreal scaleFactor = 1;
if (w != nullptr)
{
if (QScreen *wScreen = w->screen())
{
scaleFactor = wScreen->devicePixelRatio();
}
}
const QPixmap pixmap = icon.pixmap(QSize(qRound(16 / scaleFactor), qRound(16 / scaleFactor)));
QByteArray byteArray;
QBuffer buffer(&byteArray);
pixmap.save(&buffer, "PNG");

View file

@ -92,7 +92,7 @@ auto DoublePoints(QListWidget *listWidget, const VContainer *data, QString &erro
auto DoubleCurves(QListWidget *listWidget, const VContainer *data, QString &error) -> bool;
auto EachPointLabelIsUnique(QListWidget *listWidget) -> bool;
auto InvalidSegment(QListWidget *listWidget, const VContainer *data, QString &error) -> bool;
auto DialogWarningIcon() -> QString;
auto DialogWarningIcon(QWidget* w) -> QString;
auto NodeFont(QFont font, bool nodeExcluded = false) -> QFont;
void CurrentCurveLength(vidtype curveId, VContainer *data);
void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar = 4);

View file

@ -1842,7 +1842,7 @@ auto DialogPiecePath::PathIsValid() const -> bool
{
if (CreatePath().PathPoints(data).count() < 2)
{
ui->helpLabel->setText(DialogWarningIcon() + tr("You need more points!"));
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) + tr("You need more points!"));
return false;
}
@ -1850,8 +1850,8 @@ auto DialogPiecePath::PathIsValid() const -> bool
if (GetType() == PiecePathType::CustomSeamAllowance && FirstPointEqualLast(ui->listWidget, data, error))
{
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
DialogWarningIcon(), tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"),
error));
DialogWarningIcon(ui->helpLabel),
tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"), error));
return false;
}
@ -1859,41 +1859,42 @@ auto DialogPiecePath::PathIsValid() const -> bool
if (DoublePoints(ui->listWidget, data, error))
{
ui->helpLabel->setText(
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(ui->helpLabel), tr("You have double points!"), error));
return false;
}
error.clear();
if (DoubleCurves(ui->listWidget, data, error))
{
ui->helpLabel->setText(
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(ui->helpLabel),
tr("The same curve repeats twice!"), error));
return false;
}
if (GetType() == PiecePathType::CustomSeamAllowance && not EachPointLabelIsUnique(ui->listWidget))
{
ui->helpLabel->setText(DialogWarningIcon() +
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) +
tr("Each point in the <b>custom seam allowance</b> path must be unique!"));
return false;
}
if (not m_showMode && ui->comboBoxPiece->count() <= 0)
{
ui->helpLabel->setText(DialogWarningIcon() + tr("List of details is empty!"));
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) + tr("List of details is empty!"));
return false;
}
if (not m_showMode && ui->comboBoxPiece->currentIndex() == -1)
{
ui->helpLabel->setText(DialogWarningIcon() + tr("Please, select a detail to insert into!"));
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) + tr("Please, select a detail to insert into!"));
return false;
}
error.clear();
if (InvalidSegment(ui->listWidget, data, error))
{
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
ui->helpLabel->setText(
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(ui->helpLabel), tr("Invalid segment!"), error));
return false;
}

View file

@ -3388,13 +3388,14 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
{
if (CreatePiece().MainPathPoints(data).count() < 3)
{
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("You need more points!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) + tr("You need more points!"));
return false;
}
if (not MainPathIsClockwise())
{
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("You have to choose points in a clockwise direction!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
tr("You have to choose points in a clockwise direction!"));
return false;
}
@ -3402,29 +3403,30 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath, data, error))
{
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
DialogWarningIcon(), tr("First point cannot be equal to the last point!"), error));
DialogWarningIcon(uiTabPaths->helpLabel), tr("First point cannot be equal to the last point!"), error));
return false;
}
error.clear();
if (DoublePoints(uiTabPaths->listWidgetMainPath, data, error))
{
uiTabPaths->helpLabel->setText(
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(uiTabPaths->helpLabel),
tr("You have double points!"), error));
return false;
}
error.clear();
if (DoubleCurves(uiTabPaths->listWidgetMainPath, data, error))
{
uiTabPaths->helpLabel->setText(
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(uiTabPaths->helpLabel),
tr("The same curve repeats twice!"), error));
return false;
}
if (not EachPointLabelIsUnique(uiTabPaths->listWidgetMainPath))
{
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Each point in the path must be unique!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
tr("Each point in the path must be unique!"));
return false;
}
@ -3432,7 +3434,7 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
if (InvalidSegment(uiTabPaths->listWidgetMainPath, data, error))
{
uiTabPaths->helpLabel->setText(
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(uiTabPaths->helpLabel), tr("Invalid segment!"), error));
return false;
}
@ -3456,14 +3458,15 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
if (startPoint == NULL_ID && endPoint != NULL_ID)
{
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line start point!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
tr("Invalid mirror line start point!"));
return false;
}
if (startPoint != NULL_ID && endPoint == NULL_ID)
{
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line end point!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) + tr("Invalid mirror line end point!"));
return false;
}
@ -3471,7 +3474,8 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
{
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Start and end mirror line points must be unique!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
tr("Start and end mirror line points must be unique!"));
return false;
}
@ -3490,14 +3494,15 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
if (!uniquePoints.contains(startPoint))
{
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line start point!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
tr("Invalid mirror line start point!"));
return false;
}
if (!uniquePoints.contains(endPoint))
{
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line end point!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) + tr("Invalid mirror line end point!"));
return false;
}
@ -3505,7 +3510,8 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
{
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Mirror points must be neighbors!"));
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
tr("Mirror points must be neighbors!"));
return false;
}