Refactoring.
Code style.
This commit is contained in:
parent
3a7803b78f
commit
b5779ca3e8
|
@ -26,19 +26,20 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
#include "puzzlepreferencespathpage.h"
|
||||
#include "ui_puzzlepreferencespathpage.h"
|
||||
#include "../../vpapplication.h"
|
||||
#include "ui_puzzlepreferencespathpage.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
PuzzlePreferencesPathPage::PuzzlePreferencesPathPage(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::PuzzlePreferencesPathPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
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->setDefault(false);
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PuzzlePreferencesPathPage;
|
||||
|
|
|
@ -27,24 +27,24 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vpapplication.h"
|
||||
#include "version.h"
|
||||
#include "vpmainwindow.h"
|
||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||
#include "../ifc/exception/vexceptionbadid.h"
|
||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||
#include "../ifc/exception/vexceptionwrongid.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
#include "version.h"
|
||||
#include "vpmainwindow.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
|
||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||
#include "../fervor/fvupdater.h"
|
||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMessageBox>
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||
|
@ -55,9 +55,9 @@ Q_LOGGING_CATEGORY(pApp, "p.application") // NOLINT
|
|||
QT_WARNING_POP
|
||||
|
||||
#include <QCommandLineParser>
|
||||
#include <QLocalSocket>
|
||||
#include <QLocalServer>
|
||||
#include <QFileOpenEvent>
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QPixmapCache>
|
||||
|
||||
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
||||
|
@ -66,7 +66,8 @@ QT_WARNING_POP
|
|||
#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
|
||||
// writing a multithreaded application and the error happens on
|
||||
|
@ -77,9 +78,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
if (not isGuiThread)
|
||||
{
|
||||
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);
|
||||
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
|
||||
// sign of a problem
|
||||
// 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"))
|
||||
&& msg.contains(QStringLiteral("Paint device returned engine")))
|
||||
if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin")) &&
|
||||
msg.contains(QStringLiteral("Paint device returned engine")))
|
||||
{
|
||||
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..."
|
||||
// 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.
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event"))
|
||||
&& msg.contains(QStringLiteral("Cowardly refusing")))
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event")) &&
|
||||
msg.contains(QStringLiteral("Cowardly refusing")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
|
@ -289,7 +288,8 @@ auto VPApplication::notify(QObject *receiver, QEvent *event) -> bool
|
|||
}
|
||||
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()));
|
||||
exit(V_EX_DATAERR);
|
||||
}
|
||||
|
@ -326,8 +326,8 @@ auto VPApplication::notify(QObject *receiver, QEvent *event) -> bool
|
|||
}
|
||||
catch (const VException &e)
|
||||
{
|
||||
qCCritical(pApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")),
|
||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||
qCCritical(pApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")), qUtf8Printable(e.ErrorMessage()),
|
||||
qUtf8Printable(e.DetailedInformation()));
|
||||
return true;
|
||||
}
|
||||
catch (std::exception &e)
|
||||
|
@ -536,7 +536,8 @@ auto VPApplication::event(QEvent *e) -> bool
|
|||
// Mac specific).
|
||||
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();
|
||||
if (not macFileOpen.isEmpty())
|
||||
{
|
||||
|
@ -633,16 +634,15 @@ void VPApplication::StartLocalServer(const QString &serverName)
|
|||
connect(m_localServer, &QLocalServer::newConnection, this, &VPApplication::NewLocalSocketConnection);
|
||||
if (not m_localServer->listen(serverName))
|
||||
{
|
||||
qCDebug(pApp, "Can't begin to listen for incoming connections on name '%s'",
|
||||
qUtf8Printable(serverName));
|
||||
qCDebug(pApp, "Can't begin to listen for incoming connections on name '%s'", qUtf8Printable(serverName));
|
||||
if (m_localServer->serverError() == QAbstractSocket::AddressInUseError)
|
||||
{
|
||||
QLocalServer::removeServer(serverName);
|
||||
if (not m_localServer->listen(serverName))
|
||||
{
|
||||
qCWarning(pApp, "%s",
|
||||
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'")
|
||||
.arg(serverName)));
|
||||
qCWarning(
|
||||
pApp, "%s",
|
||||
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'").arg(serverName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
class VPSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VPSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <QXmlStreamReader>
|
||||
#include "../ifc/xml/vabstractconverter.h"
|
||||
#include "../layout/layoutdef.h"
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "tapepreferencespathpage.h"
|
||||
#include "ui_tapepreferencespathpage.h"
|
||||
#include "../../mapplication.h"
|
||||
#include "../../vtapesettings.h"
|
||||
#include "ui_tapepreferencespathpage.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
|
@ -43,7 +43,8 @@ TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
|||
|
||||
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->setDefault(false);
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TapePreferencesPathPage;
|
||||
|
@ -47,11 +45,13 @@ public:
|
|||
~TapePreferencesPathPage() override;
|
||||
|
||||
void Apply();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event) override;
|
||||
private slots:
|
||||
void DefaultPath();
|
||||
void EditPath();
|
||||
|
||||
private:
|
||||
// cppcheck-suppress unknownMacro
|
||||
Q_DISABLE_COPY_MOVE(TapePreferencesPathPage) // NOLINT
|
||||
|
|
|
@ -27,37 +27,37 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "mapplication.h"
|
||||
#include "version.h"
|
||||
#include "tmainwindow.h"
|
||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||
#include "../ifc/exception/vexceptionbadid.h"
|
||||
#include "../ifc/exception/vexceptionconversionerror.h"
|
||||
#include "../ifc/exception/vexceptionemptyparameter.h"
|
||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||
#include "../ifc/exception/vexceptionwrongid.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
#include "../vmisc/projectversion.h"
|
||||
#include "../vmisc/vsysexits.h"
|
||||
#include "tmainwindow.h"
|
||||
#include "version.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#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 "../qmuparser/qmuparsererror.h"
|
||||
#include "../vmisc/qt_dispatch/qt_dispatch.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileOpenEvent>
|
||||
#include <QLocalSocket>
|
||||
#include <QResource>
|
||||
#include <QTranslator>
|
||||
#include <QPointer>
|
||||
#include <QLocalServer>
|
||||
#include <QMessageBox>
|
||||
#include <iostream>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGridLayout>
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QMessageBox>
|
||||
#include <QPointer>
|
||||
#include <QResource>
|
||||
#include <QSpacerItem>
|
||||
#include <QThread>
|
||||
#include <QGlobalStatic>
|
||||
#include <QTranslator>
|
||||
#include <iostream>
|
||||
|
||||
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
||||
#include <vcsRepoState.h>
|
||||
|
@ -107,9 +107,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
if (not isGuiThread)
|
||||
{
|
||||
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);
|
||||
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
|
||||
// sign of a problem
|
||||
// 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"))
|
||||
&& msg.contains(QStringLiteral("Paint device returned engine")))
|
||||
if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin")) &&
|
||||
msg.contains(QStringLiteral("Paint device returned engine")))
|
||||
{
|
||||
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..."
|
||||
// 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.
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event"))
|
||||
&& msg.contains(QStringLiteral("Cowardly refusing")))
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event")) &&
|
||||
msg.contains(QStringLiteral("Cowardly refusing")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
|
@ -332,7 +330,8 @@ auto MApplication::notify(QObject *receiver, QEvent *event) -> bool
|
|||
}
|
||||
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()));
|
||||
exit(V_EX_DATAERR);
|
||||
}
|
||||
|
@ -369,8 +368,8 @@ auto MApplication::notify(QObject *receiver, QEvent *event) -> bool
|
|||
}
|
||||
catch (const VException &e)
|
||||
{
|
||||
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")),
|
||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")), qUtf8Printable(e.ErrorMessage()),
|
||||
qUtf8Printable(e.DetailedInformation()));
|
||||
return true;
|
||||
}
|
||||
catch (const qmu::QmuParserWarning &e)
|
||||
|
@ -481,7 +480,6 @@ void MApplication::ActivateDarkMode()
|
|||
QTextStream ts(&f);
|
||||
qApp->setStyleSheet(ts.readAll()); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +505,8 @@ auto MApplication::event(QEvent *e) -> bool
|
|||
// Mac specific).
|
||||
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();
|
||||
if (not macFileOpen.isEmpty())
|
||||
{
|
||||
|
@ -757,18 +756,21 @@ void MApplication::InitParserOptions(QCommandLineParser &parser)
|
|||
{
|
||||
parser.addPositionalArgument(QStringLiteral("filename"), tr("The measurement file."));
|
||||
|
||||
parser.addOptions(
|
||||
{
|
||||
{{*SINGLE_OPTION_DIMENSION_A, *LONG_OPTION_DIMENSION_A}, tr("Set base for dimension A in the table units."),
|
||||
parser.addOptions({
|
||||
{{*SINGLE_OPTION_DIMENSION_A, *LONG_OPTION_DIMENSION_A},
|
||||
tr("Set base for dimension A in the table units."),
|
||||
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")},
|
||||
|
||||
{{*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")},
|
||||
|
||||
{{*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")},
|
||||
|
||||
{*LONG_OPTION_TEST,
|
||||
|
@ -776,7 +778,8 @@ void MApplication::InitParserOptions(QCommandLineParser &parser)
|
|||
|
||||
{LONG_OPTION_NO_HDPI_SCALING,
|
||||
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);
|
||||
if (not m_localServer->listen(serverName))
|
||||
{
|
||||
qCDebug(mApp, "Can't begin to listen for incoming connections on name '%s'",
|
||||
qUtf8Printable(serverName));
|
||||
qCDebug(mApp, "Can't begin to listen for incoming connections on name '%s'", qUtf8Printable(serverName));
|
||||
if (m_localServer->serverError() == QAbstractSocket::AddressInUseError)
|
||||
{
|
||||
QLocalServer::removeServer(serverName);
|
||||
if (not m_localServer->listen(serverName))
|
||||
{
|
||||
qCWarning(mApp, "%s",
|
||||
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'")
|
||||
.arg(serverName)));
|
||||
qCWarning(
|
||||
mApp, "%s",
|
||||
qUtf8Printable(tr("Can't begin to listen for incoming connections on name '%1'").arg(serverName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "preferencespathpage.h"
|
||||
#include "ui_preferencespathpage.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "ui_preferencespathpage.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
|
@ -43,7 +43,8 @@ PreferencesPathPage::PreferencesPathPage(QWidget *parent)
|
|||
|
||||
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->setDefault(false);
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "../vmisc/defglobal.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PreferencesPathPage;
|
||||
|
|
|
@ -29,14 +29,15 @@
|
|||
#ifndef TESTVAPPLICATION_H
|
||||
#define TESTVAPPLICATION_H
|
||||
|
||||
#include "vabstractvalapplication.h"
|
||||
#include "projectversion.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "projectversion.h"
|
||||
#include "vabstractvalapplication.h"
|
||||
|
||||
class VTestSettings : public VCommonSettings
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VTestSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||
QObject *parent = nullptr)
|
||||
|
@ -49,6 +50,7 @@ public:
|
|||
class TestVApplication final : public VAbstractValApplication
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
TestVApplication(int &argc, char **argv)
|
||||
: VAbstractValApplication(argc, argv),
|
||||
|
@ -72,19 +74,14 @@ public:
|
|||
|
||||
virtual auto IsAppInGUIMode() const -> bool override { return false; }
|
||||
|
||||
virtual void InitTrVars() override
|
||||
{}
|
||||
virtual void InitTrVars() override {}
|
||||
|
||||
void SetTrVars(VTranslateVars *trVars)
|
||||
{
|
||||
m_trVars = trVars;
|
||||
}
|
||||
void SetTrVars(VTranslateVars *trVars) { m_trVars = trVars; }
|
||||
|
||||
static auto VApp() -> TestVApplication * { return static_cast<TestVApplication *>(QCoreApplication::instance()); }
|
||||
|
||||
protected slots:
|
||||
virtual void AboutToQuit() override
|
||||
{}
|
||||
virtual void AboutToQuit() override {}
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY_MOVE(TestVApplication) // NOLINT
|
||||
|
|
|
@ -29,17 +29,21 @@
|
|||
#include "vabstractapplication.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QFuture>
|
||||
#include <QLibraryInfo>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMessageLogger>
|
||||
#include <QStandardPaths>
|
||||
#include <QTranslator>
|
||||
#include <QUndoStack>
|
||||
#include <QWidget>
|
||||
#include <Qt>
|
||||
#include <QtDebug>
|
||||
#include <QWidget>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
#include "compatibility.h"
|
||||
#include "svgfont/vsvgfontdatabase.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "../vmisc/vtextcodec.h"
|
||||
|
@ -185,8 +189,8 @@ auto VAbstractApplication::translationsPath(const QString &locale) -> QString
|
|||
}
|
||||
else
|
||||
{
|
||||
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath + QLatin1String("/")
|
||||
+ locale + QLatin1String(".lproj");
|
||||
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath +
|
||||
QLatin1String("/") + locale + QLatin1String(".lproj");
|
||||
}
|
||||
QDir dirBundle(mainPath);
|
||||
if (dirBundle.exists())
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
#ifndef VABSTRACTAPPLICATION_H
|
||||
#define VABSTRACTAPPLICATION_H
|
||||
|
||||
#include <qcompilerdetection.h>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileDialog>
|
||||
#include <QLocale>
|
||||
#include <QMetaObject>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <QTranslator>
|
||||
#include <QFileDialog>
|
||||
#include <QtGlobal>
|
||||
#include <qcompilerdetection.h>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
|
@ -48,6 +48,8 @@
|
|||
class QUndoStack;
|
||||
class VAbstractApplication; // use in define
|
||||
class VCommonSettings;
|
||||
class VSvgFontDatabase;
|
||||
class QFileSystemWatcher;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
class VTextCodec;
|
||||
|
@ -60,9 +62,10 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
|
|||
class VAbstractApplication : public QApplication
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VAbstractApplication(int &argc, char **argv);
|
||||
virtual ~VAbstractApplication();
|
||||
~VAbstractApplication() override;
|
||||
|
||||
virtual auto TrVars() -> const VTranslateVars * = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user