Refactoring.
Code style.
This commit is contained in:
parent
3a7803b78f
commit
b5779ca3e8
|
@ -26,19 +26,20 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#include "puzzlepreferencespathpage.h"
|
#include "puzzlepreferencespathpage.h"
|
||||||
#include "ui_puzzlepreferencespathpage.h"
|
|
||||||
#include "../../vpapplication.h"
|
#include "../../vpapplication.h"
|
||||||
|
#include "ui_puzzlepreferencespathpage.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent) :
|
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
|
||||||
QWidget(parent),
|
: QWidget(parent),
|
||||||
ui(new Ui::PuzzlePreferencesPathPage)
|
ui(new Ui::PuzzlePreferencesPathPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
|
|
||||||
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
ui->defaultButton->setDefault(false);
|
ui->defaultButton->setDefault(false);
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vmisc/defglobal.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class PuzzlePreferencesPathPage;
|
class PuzzlePreferencesPathPage;
|
||||||
|
|
|
@ -27,24 +27,24 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vpapplication.h"
|
#include "vpapplication.h"
|
||||||
#include "version.h"
|
|
||||||
#include "vpmainwindow.h"
|
|
||||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
|
||||||
#include "../ifc/exception/vexceptionbadid.h"
|
#include "../ifc/exception/vexceptionbadid.h"
|
||||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||||
|
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||||
#include "../ifc/exception/vexceptionwrongid.h"
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../vmisc/vsysexits.h"
|
#include "../vmisc/vsysexits.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "vpmainwindow.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
|
||||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
|
||||||
#include "../fervor/fvupdater.h"
|
#include "../fervor/fvupdater.h"
|
||||||
|
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||||
|
@ -55,9 +55,9 @@ Q_LOGGING_CATEGORY(pApp, "p.application") // NOLINT
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QLocalSocket>
|
|
||||||
#include <QLocalServer>
|
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
|
#include <QLocalServer>
|
||||||
|
#include <QLocalSocket>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
|
||||||
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
||||||
|
@ -66,7 +66,8 @@ QT_WARNING_POP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) // NOLINT(readability-function-cognitive-complexity)
|
inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context,
|
||||||
|
const QString &msg) // NOLINT(readability-function-cognitive-complexity)
|
||||||
{
|
{
|
||||||
// only the GUI thread should display message boxes. If you are
|
// only the GUI thread should display message boxes. If you are
|
||||||
// writing a multithreaded application and the error happens on
|
// writing a multithreaded application and the error happens on
|
||||||
|
@ -77,9 +78,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
if (not isGuiThread)
|
if (not isGuiThread)
|
||||||
{
|
{
|
||||||
auto Handler = [](QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
auto Handler = [](QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
{
|
{ noisyFailureMsgHandler(type, context, msg); };
|
||||||
noisyFailureMsgHandler(type, context, msg);
|
|
||||||
};
|
|
||||||
|
|
||||||
q_dispatch_async_main(Handler, type, context, msg);
|
q_dispatch_async_main(Handler, type, context, msg);
|
||||||
return;
|
return;
|
||||||
|
@ -141,8 +140,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
// this is another one that doesn't make sense as just a debug message. pretty serious
|
// this is another one that doesn't make sense as just a debug message. pretty serious
|
||||||
// sign of a problem
|
// sign of a problem
|
||||||
// http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue)
|
// http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue)
|
||||||
if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin"))
|
if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin")) &&
|
||||||
&& msg.contains(QStringLiteral("Paint device returned engine")))
|
msg.contains(QStringLiteral("Paint device returned engine")))
|
||||||
{
|
{
|
||||||
type = QtWarningMsg;
|
type = QtWarningMsg;
|
||||||
}
|
}
|
||||||
|
@ -150,8 +149,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
// This qWarning about "Cowardly refusing to send clipboard message to hung application..."
|
// This qWarning about "Cowardly refusing to send clipboard message to hung application..."
|
||||||
// is something that can easily happen if you are debugging and the application is paused.
|
// is something that can easily happen if you are debugging and the application is paused.
|
||||||
// As it is so common, not worth popping up a dialog.
|
// As it is so common, not worth popping up a dialog.
|
||||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event"))
|
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event")) &&
|
||||||
&& msg.contains(QStringLiteral("Cowardly refusing")))
|
msg.contains(QStringLiteral("Cowardly refusing")))
|
||||||
{
|
{
|
||||||
type = QtDebugMsg;
|
type = QtDebugMsg;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +288,8 @@ auto VPApplication::notify(QObject *receiver, QEvent *event) -> bool
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
qCCritical(pApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807
|
qCCritical(pApp, "%s\n\n%s\n\n%s",
|
||||||
|
qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
exit(V_EX_DATAERR);
|
exit(V_EX_DATAERR);
|
||||||
}
|
}
|
||||||
|
@ -326,8 +326,8 @@ auto VPApplication::notify(QObject *receiver, QEvent *event) -> bool
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
qCCritical(pApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")),
|
qCCritical(pApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
|
@ -536,7 +536,8 @@ auto VPApplication::event(QEvent *e) -> bool
|
||||||
// Mac specific).
|
// Mac specific).
|
||||||
case QEvent::FileOpen:
|
case QEvent::FileOpen:
|
||||||
{
|
{
|
||||||
auto *fileOpenEvent = static_cast<QFileOpenEvent *>(e); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
auto *fileOpenEvent =
|
||||||
|
static_cast<QFileOpenEvent *>(e); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||||
const QString macFileOpen = fileOpenEvent->file();
|
const QString macFileOpen = fileOpenEvent->file();
|
||||||
if (not macFileOpen.isEmpty())
|
if (not macFileOpen.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -633,16 +634,15 @@ void VPApplication::StartLocalServer(const QString &serverName)
|
||||||
connect(m_localServer, &QLocalServer::newConnection, this, &VPApplication::NewLocalSocketConnection);
|
connect(m_localServer, &QLocalServer::newConnection, this, &VPApplication::NewLocalSocketConnection);
|
||||||
if (not m_localServer->listen(serverName))
|
if (not m_localServer->listen(serverName))
|
||||||
{
|
{
|
||||||
qCDebug(pApp, "Can't begin to listen for incoming connections on name '%s'",
|
qCDebug(pApp, "Can't begin to listen for incoming connections on name '%s'", qUtf8Printable(serverName));
|
||||||
qUtf8Printable(serverName));
|
|
||||||
if (m_localServer->serverError() == QAbstractSocket::AddressInUseError)
|
if (m_localServer->serverError() == QAbstractSocket::AddressInUseError)
|
||||||
{
|
{
|
||||||
QLocalServer::removeServer(serverName);
|
QLocalServer::removeServer(serverName);
|
||||||
if (not m_localServer->listen(serverName))
|
if (not m_localServer->listen(serverName))
|
||||||
{
|
{
|
||||||
qCWarning(pApp, "%s",
|
qCWarning(
|
||||||
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'")
|
pApp, "%s",
|
||||||
.arg(serverName)));
|
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'").arg(serverName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
class VPSettings : public VCommonSettings
|
class VPSettings : public VCommonSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VPSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VPSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include "../ifc/xml/vabstractconverter.h"
|
#include "../ifc/xml/vabstractconverter.h"
|
||||||
#include "../layout/layoutdef.h"
|
#include "../layout/layoutdef.h"
|
||||||
#include "../vmisc/defglobal.h"
|
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "tapepreferencespathpage.h"
|
#include "tapepreferencespathpage.h"
|
||||||
#include "ui_tapepreferencespathpage.h"
|
|
||||||
#include "../../mapplication.h"
|
#include "../../mapplication.h"
|
||||||
#include "../../vtapesettings.h"
|
#include "../../vtapesettings.h"
|
||||||
|
#include "ui_tapepreferencespathpage.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -43,7 +43,8 @@ TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
|
|
||||||
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
ui->defaultButton->setDefault(false);
|
ui->defaultButton->setDefault(false);
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vmisc/defglobal.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class TapePreferencesPathPage;
|
class TapePreferencesPathPage;
|
||||||
|
@ -47,11 +45,13 @@ public:
|
||||||
~TapePreferencesPathPage() override;
|
~TapePreferencesPathPage() override;
|
||||||
|
|
||||||
void Apply();
|
void Apply();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
void DefaultPath();
|
void DefaultPath();
|
||||||
void EditPath();
|
void EditPath();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
|
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
|
||||||
|
|
|
@ -27,37 +27,37 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "mapplication.h"
|
#include "mapplication.h"
|
||||||
#include "version.h"
|
|
||||||
#include "tmainwindow.h"
|
|
||||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
|
||||||
#include "../ifc/exception/vexceptionbadid.h"
|
#include "../ifc/exception/vexceptionbadid.h"
|
||||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||||
|
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||||
#include "../ifc/exception/vexceptionwrongid.h"
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../vmisc/vsysexits.h"
|
|
||||||
#include "../vmisc/projectversion.h"
|
#include "../vmisc/projectversion.h"
|
||||||
|
#include "../vmisc/vsysexits.h"
|
||||||
|
#include "tmainwindow.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
|
||||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
|
||||||
#include "../fervor/fvupdater.h"
|
#include "../fervor/fvupdater.h"
|
||||||
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
|
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
#include <QLocalSocket>
|
#include <QGlobalStatic>
|
||||||
#include <QResource>
|
|
||||||
#include <QTranslator>
|
|
||||||
#include <QPointer>
|
|
||||||
#include <QLocalServer>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <iostream>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
#include <QLocalServer>
|
||||||
|
#include <QLocalSocket>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QResource>
|
||||||
#include <QSpacerItem>
|
#include <QSpacerItem>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QGlobalStatic>
|
#include <QTranslator>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
||||||
#include <vcsRepoState.h>
|
#include <vcsRepoState.h>
|
||||||
|
@ -107,9 +107,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
if (not isGuiThread)
|
if (not isGuiThread)
|
||||||
{
|
{
|
||||||
auto Handler = [](QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
auto Handler = [](QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
{
|
{ noisyFailureMsgHandler(type, context, msg); };
|
||||||
noisyFailureMsgHandler(type, context, msg);
|
|
||||||
};
|
|
||||||
|
|
||||||
q_dispatch_async_main(Handler, type, context, msg);
|
q_dispatch_async_main(Handler, type, context, msg);
|
||||||
return;
|
return;
|
||||||
|
@ -171,8 +169,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
// this is another one that doesn't make sense as just a debug message. pretty serious
|
// this is another one that doesn't make sense as just a debug message. pretty serious
|
||||||
// sign of a problem
|
// sign of a problem
|
||||||
// http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue)
|
// http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue)
|
||||||
if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin"))
|
if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin")) &&
|
||||||
&& msg.contains(QStringLiteral("Paint device returned engine")))
|
msg.contains(QStringLiteral("Paint device returned engine")))
|
||||||
{
|
{
|
||||||
type = QtWarningMsg;
|
type = QtWarningMsg;
|
||||||
}
|
}
|
||||||
|
@ -180,8 +178,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
// This qWarning about "Cowardly refusing to send clipboard message to hung application..."
|
// This qWarning about "Cowardly refusing to send clipboard message to hung application..."
|
||||||
// is something that can easily happen if you are debugging and the application is paused.
|
// is something that can easily happen if you are debugging and the application is paused.
|
||||||
// As it is so common, not worth popping up a dialog.
|
// As it is so common, not worth popping up a dialog.
|
||||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event"))
|
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event")) &&
|
||||||
&& msg.contains(QStringLiteral("Cowardly refusing")))
|
msg.contains(QStringLiteral("Cowardly refusing")))
|
||||||
{
|
{
|
||||||
type = QtDebugMsg;
|
type = QtDebugMsg;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +330,8 @@ auto MApplication::notify(QObject *receiver, QEvent *event) -> bool
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807
|
qCCritical(mApp, "%s\n\n%s\n\n%s",
|
||||||
|
qUtf8Printable(tr("Error parsing file. Program will be terminated.")), //-V807
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
exit(V_EX_DATAERR);
|
exit(V_EX_DATAERR);
|
||||||
}
|
}
|
||||||
|
@ -369,8 +368,8 @@ auto MApplication::notify(QObject *receiver, QEvent *event) -> bool
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")),
|
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")), qUtf8Printable(e.ErrorMessage()),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.DetailedInformation()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (const qmu::QmuParserWarning &e)
|
catch (const qmu::QmuParserWarning &e)
|
||||||
|
@ -481,7 +480,6 @@ void MApplication::ActivateDarkMode()
|
||||||
QTextStream ts(&f);
|
QTextStream ts(&f);
|
||||||
qApp->setStyleSheet(ts.readAll()); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
qApp->setStyleSheet(ts.readAll()); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +505,8 @@ auto MApplication::event(QEvent *e) -> bool
|
||||||
// Mac specific).
|
// Mac specific).
|
||||||
case QEvent::FileOpen:
|
case QEvent::FileOpen:
|
||||||
{
|
{
|
||||||
auto *fileOpenEvent = static_cast<QFileOpenEvent *>(e); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
auto *fileOpenEvent =
|
||||||
|
static_cast<QFileOpenEvent *>(e); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||||
const QString macFileOpen = fileOpenEvent->file();
|
const QString macFileOpen = fileOpenEvent->file();
|
||||||
if (not macFileOpen.isEmpty())
|
if (not macFileOpen.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -757,18 +756,21 @@ void MApplication::InitParserOptions(QCommandLineParser &parser)
|
||||||
{
|
{
|
||||||
parser.addPositionalArgument(QStringLiteral("filename"), tr("The measurement file."));
|
parser.addPositionalArgument(QStringLiteral("filename"), tr("The measurement file."));
|
||||||
|
|
||||||
parser.addOptions(
|
parser.addOptions({
|
||||||
{
|
{{*SINGLE_OPTION_DIMENSION_A, *LONG_OPTION_DIMENSION_A},
|
||||||
{{*SINGLE_OPTION_DIMENSION_A, *LONG_OPTION_DIMENSION_A}, tr("Set base for dimension A in the table units."),
|
tr("Set base for dimension A in the table units."),
|
||||||
tr("The dimension A base")},
|
tr("The dimension A base")},
|
||||||
|
|
||||||
{{*SINGLE_OPTION_DIMENSION_B, *LONG_OPTION_DIMENSION_B}, tr("Set base for dimension B in the table units."),
|
{{*SINGLE_OPTION_DIMENSION_B, *LONG_OPTION_DIMENSION_B},
|
||||||
|
tr("Set base for dimension B in the table units."),
|
||||||
tr("The dimension B base")},
|
tr("The dimension B base")},
|
||||||
|
|
||||||
{{*SINGLE_OPTION_DIMENSION_C, *LONG_OPTION_DIMENSION_C}, tr("Set base for dimension C in the table units."),
|
{{*SINGLE_OPTION_DIMENSION_C, *LONG_OPTION_DIMENSION_C},
|
||||||
|
tr("Set base for dimension C in the table units."),
|
||||||
tr("The dimension C base")},
|
tr("The dimension C base")},
|
||||||
|
|
||||||
{{*SINGLE_OPTION_UNITS, *LONG_OPTION_UNITS}, tr("Set pattern file units: cm, mm, inch."),
|
{{*SINGLE_OPTION_UNITS, *LONG_OPTION_UNITS},
|
||||||
|
tr("Set pattern file units: cm, mm, inch."),
|
||||||
tr("The pattern units")},
|
tr("The pattern units")},
|
||||||
|
|
||||||
{*LONG_OPTION_TEST,
|
{*LONG_OPTION_TEST,
|
||||||
|
@ -776,7 +778,8 @@ void MApplication::InitParserOptions(QCommandLineParser &parser)
|
||||||
|
|
||||||
{LONG_OPTION_NO_HDPI_SCALING,
|
{LONG_OPTION_NO_HDPI_SCALING,
|
||||||
tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
|
tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
|
||||||
"Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0")},
|
"Alternatively you can use the %1 environment variable.")
|
||||||
|
.arg("QT_AUTO_SCREEN_SCALE_FACTOR=0")},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,16 +790,15 @@ void MApplication::StartLocalServer(const QString &serverName)
|
||||||
connect(m_localServer, &QLocalServer::newConnection, this, &MApplication::NewLocalSocketConnection);
|
connect(m_localServer, &QLocalServer::newConnection, this, &MApplication::NewLocalSocketConnection);
|
||||||
if (not m_localServer->listen(serverName))
|
if (not m_localServer->listen(serverName))
|
||||||
{
|
{
|
||||||
qCDebug(mApp, "Can't begin to listen for incoming connections on name '%s'",
|
qCDebug(mApp, "Can't begin to listen for incoming connections on name '%s'", qUtf8Printable(serverName));
|
||||||
qUtf8Printable(serverName));
|
|
||||||
if (m_localServer->serverError() == QAbstractSocket::AddressInUseError)
|
if (m_localServer->serverError() == QAbstractSocket::AddressInUseError)
|
||||||
{
|
{
|
||||||
QLocalServer::removeServer(serverName);
|
QLocalServer::removeServer(serverName);
|
||||||
if (not m_localServer->listen(serverName))
|
if (not m_localServer->listen(serverName))
|
||||||
{
|
{
|
||||||
qCWarning(mApp, "%s",
|
qCWarning(
|
||||||
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'")
|
mApp, "%s",
|
||||||
.arg(serverName)));
|
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'").arg(serverName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "preferencespathpage.h"
|
#include "preferencespathpage.h"
|
||||||
#include "ui_preferencespathpage.h"
|
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
|
#include "ui_preferencespathpage.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -43,7 +43,8 @@ PreferencesPathPage::PreferencesPathPage(QWidget *parent)
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
|
|
||||||
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
ui->defaultButton->setDefault(false);
|
ui->defaultButton->setDefault(false);
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vmisc/defglobal.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class PreferencesPathPage;
|
class PreferencesPathPage;
|
||||||
|
|
|
@ -29,14 +29,15 @@
|
||||||
#ifndef TESTVAPPLICATION_H
|
#ifndef TESTVAPPLICATION_H
|
||||||
#define TESTVAPPLICATION_H
|
#define TESTVAPPLICATION_H
|
||||||
|
|
||||||
#include "vabstractvalapplication.h"
|
|
||||||
#include "projectversion.h"
|
|
||||||
#include "../vmisc/vcommonsettings.h"
|
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
|
#include "../vmisc/vcommonsettings.h"
|
||||||
|
#include "projectversion.h"
|
||||||
|
#include "vabstractvalapplication.h"
|
||||||
|
|
||||||
class VTestSettings : public VCommonSettings
|
class VTestSettings : public VCommonSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTestSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VTestSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = nullptr)
|
QObject *parent = nullptr)
|
||||||
|
@ -49,6 +50,7 @@ public:
|
||||||
class TestVApplication final : public VAbstractValApplication
|
class TestVApplication final : public VAbstractValApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TestVApplication(int &argc, char **argv)
|
TestVApplication(int &argc, char **argv)
|
||||||
: VAbstractValApplication(argc, argv),
|
: VAbstractValApplication(argc, argv),
|
||||||
|
@ -72,19 +74,14 @@ public:
|
||||||
|
|
||||||
virtual auto IsAppInGUIMode() const -> bool override { return false; }
|
virtual auto IsAppInGUIMode() const -> bool override { return false; }
|
||||||
|
|
||||||
virtual void InitTrVars() override
|
virtual void InitTrVars() override {}
|
||||||
{}
|
|
||||||
|
|
||||||
void SetTrVars(VTranslateVars *trVars)
|
void SetTrVars(VTranslateVars *trVars) { m_trVars = trVars; }
|
||||||
{
|
|
||||||
m_trVars = trVars;
|
|
||||||
}
|
|
||||||
|
|
||||||
static auto VApp() -> TestVApplication * { return static_cast<TestVApplication *>(QCoreApplication::instance()); }
|
static auto VApp() -> TestVApplication * { return static_cast<TestVApplication *>(QCoreApplication::instance()); }
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void AboutToQuit() override
|
virtual void AboutToQuit() override {}
|
||||||
{}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TestVApplication) // NOLINT
|
Q_DISABLE_COPY_MOVE(TestVApplication) // NOLINT
|
||||||
|
|
|
@ -29,17 +29,21 @@
|
||||||
#include "vabstractapplication.h"
|
#include "vabstractapplication.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFileSystemWatcher>
|
||||||
|
#include <QFuture>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMessageLogger>
|
#include <QMessageLogger>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
#include <QWidget>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QWidget>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
|
|
||||||
|
#include "QtConcurrent/qtconcurrentrun.h"
|
||||||
#include "compatibility.h"
|
#include "compatibility.h"
|
||||||
|
#include "svgfont/vsvgfontdatabase.h"
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
#include "../vmisc/vtextcodec.h"
|
#include "../vmisc/vtextcodec.h"
|
||||||
|
@ -185,8 +189,8 @@ auto VAbstractApplication::translationsPath(const QString &locale) -> QString
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath + QLatin1String("/")
|
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath +
|
||||||
+ locale + QLatin1String(".lproj");
|
QLatin1String("/") + locale + QLatin1String(".lproj");
|
||||||
}
|
}
|
||||||
QDir dirBundle(mainPath);
|
QDir dirBundle(mainPath);
|
||||||
if (dirBundle.exists())
|
if (dirBundle.exists())
|
||||||
|
|
|
@ -29,17 +29,17 @@
|
||||||
#ifndef VABSTRACTAPPLICATION_H
|
#ifndef VABSTRACTAPPLICATION_H
|
||||||
#define VABSTRACTAPPLICATION_H
|
#define VABSTRACTAPPLICATION_H
|
||||||
|
|
||||||
#include <qcompilerdetection.h>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QFileDialog>
|
#include <QtGlobal>
|
||||||
|
#include <qcompilerdetection.h>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vpatterndb/vtranslatevars.h"
|
#include "../vpatterndb/vtranslatevars.h"
|
||||||
|
@ -48,6 +48,8 @@
|
||||||
class QUndoStack;
|
class QUndoStack;
|
||||||
class VAbstractApplication; // use in define
|
class VAbstractApplication; // use in define
|
||||||
class VCommonSettings;
|
class VCommonSettings;
|
||||||
|
class VSvgFontDatabase;
|
||||||
|
class QFileSystemWatcher;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
class VTextCodec;
|
class VTextCodec;
|
||||||
|
@ -60,9 +62,10 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
|
||||||
class VAbstractApplication : public QApplication
|
class VAbstractApplication : public QApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VAbstractApplication(int &argc, char **argv);
|
VAbstractApplication(int &argc, char **argv);
|
||||||
virtual ~VAbstractApplication();
|
~VAbstractApplication() override;
|
||||||
|
|
||||||
virtual auto TrVars() -> const VTranslateVars * = 0;
|
virtual auto TrVars() -> const VTranslateVars * = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user