Clang warnings.

This commit is contained in:
Roman Telezhynskyi 2021-09-24 14:57:30 +03:00
parent b3e52d351e
commit ed7703c60c
10 changed files with 50 additions and 37 deletions

View File

@ -1711,7 +1711,7 @@ void VPMainWindow::ReadSettings()
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
restoreState(settings->GetToolbarsState(), AppVersion());
// Text under tool buton icon
ToolBarStyles();
@ -1737,7 +1737,7 @@ void VPMainWindow::WriteSettings()
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(APP_VERSION));
settings->SetToolbarsState(saveState(AppVersion()));
settings->SetDockWidgetPropertiesActive(ui->dockWidgetProperties->isEnabled());
settings->SetDockWidgetPropertiesContentsActive(ui->dockWidgetPropertiesContents->isEnabled());

View File

@ -3423,7 +3423,7 @@ void TMainWindow::ReadSettings()
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
restoreState(settings->GetToolbarsState(), AppVersion());
// Text under tool buton icon
ToolBarStyles();
@ -3443,7 +3443,7 @@ void TMainWindow::WriteSettings()
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(APP_VERSION));
settings->SetToolbarsState(saveState(AppVersion()));
settings->sync();
if (settings->status() == QSettings::AccessError)

View File

@ -4558,7 +4558,7 @@ void MainWindow::ReadSettings()
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), APP_VERSION);
restoreState(settings->GetToolbarsState(), AppVersion());
ui->dockWidgetGroups->setVisible(settings->IsDockWidgetGroupsActive());
ui->dockWidgetToolOptions->setVisible(settings->IsDockWidgetToolOptionsActive());
@ -4600,7 +4600,7 @@ void MainWindow::WriteSettings()
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(APP_VERSION));
settings->SetToolbarsState(saveState(AppVersion()));
settings->SetDockWidgetGroupsActive(ui->dockWidgetGroups->isEnabled());
settings->SetDockWidgetToolOptionsActive(ui->dockWidgetToolOptions->isEnabled());

View File

@ -532,7 +532,7 @@ bool FvUpdater::VersionIsIgnored(const QString &version)
// 3) A newer version (don't ignore)
// 'version' is not likely to contain an older version in any case.
int decVersion = 0x0;
unsigned decVersion = 0x0;
try
{
decVersion = VAbstractConverter::GetFormatVersion(version);
@ -543,12 +543,12 @@ bool FvUpdater::VersionIsIgnored(const QString &version)
return true; // Ignore invalid version
}
if (decVersion == APP_VERSION)
if (decVersion == AppVersion())
{
return true;
}
const int lastSkippedVersion = VAbstractApplication::VApp()->Settings()->GetLatestSkippedVersion();
const unsigned lastSkippedVersion = VAbstractApplication::VApp()->Settings()->GetLatestSkippedVersion();
if (lastSkippedVersion != 0x0)
{
if (decVersion == lastSkippedVersion)
@ -558,7 +558,7 @@ bool FvUpdater::VersionIsIgnored(const QString &version)
}
}
if (decVersion > APP_VERSION)
if (decVersion > AppVersion())
{
// Newer version - do not skip
return false;
@ -571,7 +571,7 @@ bool FvUpdater::VersionIsIgnored(const QString &version)
//---------------------------------------------------------------------------------------------------------------------
void FvUpdater::IgnoreVersion(const QString &version)
{
int decVersion = 0x0;
unsigned decVersion = 0x0;
try
{
decVersion = VAbstractConverter::GetFormatVersion(version);
@ -582,7 +582,7 @@ void FvUpdater::IgnoreVersion(const QString &version)
return ; // Ignore invalid version
}
if (decVersion == APP_VERSION)
if (decVersion == AppVersion())
{
// Don't ignore the current version
return;

View File

@ -36,11 +36,7 @@
#include <QtGlobal>
#include "vdomdocument.h"
constexpr inline auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned
{
return ((major<<16u)|(minor<<8u)|patch);
}
#include "../vmisc/projectversion.h"
class VAbstractConverter :public VDomDocument
{

View File

@ -43,9 +43,14 @@ enum CustomEventType {
};
//---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wenum-enum-conversion")
// Define undo event identifier
const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::UndoEventType);
QT_WARNING_POP
class UndoEvent : public QEvent
{
public:
@ -57,8 +62,13 @@ public:
};
//---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wenum-enum-conversion")
const QEvent::Type LITE_PARSE_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::LiteParseEventType);
QT_WARNING_POP
class LiteParseEvent : public QEvent
{
public:
@ -70,9 +80,14 @@ public:
};
//---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wenum-enum-conversion")
const QEvent::Type FIT_BEST_CURRENT_EVENT = static_cast<QEvent::Type>(QEvent::User +
CustomEventType::FitBestCurrentEventType);
QT_WARNING_POP
class FitBestCurrentEvent : public QEvent
{
public:
@ -84,9 +99,14 @@ public:
};
//---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wenum-enum-conversion")
const QEvent::Type WARNING_MESSAGE_EVENT = static_cast<QEvent::Type>(QEvent::User +
CustomEventType::WarningMessageEventType);
QT_WARNING_POP
class WarningMessageEvent : public QEvent
{
public:

View File

@ -40,10 +40,6 @@
#include <QSysInfo>
#include <QtGlobal>
extern const int MAJOR_VERSION = 0;
extern const int MINOR_VERSION = 7;
extern const int DEBUG_VERSION = 49;
extern const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION)
.arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE));

View File

@ -31,20 +31,21 @@
class QString;
extern const int MAJOR_VERSION;
extern const int MINOR_VERSION;
extern const int DEBUG_VERSION;
constexpr unsigned MAJOR_VERSION = 0;
constexpr unsigned MINOR_VERSION = 7;
constexpr unsigned DEBUG_VERSION = 49;
extern const QString APP_VERSION_STR;
/*
APP_VERSION is (major << 16) + (minor << 8) + patch.
*/
#define APP_VERSION V_VERSION_CHECK(MAJOR_VERSION, MINOR_VERSION, DEBUG_VERSION)
/*
can be used like #if (APP_VERSION >= V_VERSION_CHECK(0, 7, 0))
*/
#define V_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
constexpr inline auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned
{
return ((major<<16u)|(minor<<8u)|patch);
}
constexpr inline auto AppVersion() -> unsigned
{
return FormatVersion(MAJOR_VERSION, MINOR_VERSION, DEBUG_VERSION);
}
// Change version number in projectversion.cpp too.
// Synchronize valentina.nsi

View File

@ -800,14 +800,14 @@ void VCommonSettings::SetFinalMeasurementsDialogSize(const QSize &sz)
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetLatestSkippedVersion() const
unsigned VCommonSettings::GetLatestSkippedVersion() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingLatestSkippedVersion, 0x0).toInt();
return settings.value(*settingLatestSkippedVersion, 0x0).toUInt();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetLatestSkippedVersion(int value)
void VCommonSettings::SetLatestSkippedVersion(unsigned value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingLatestSkippedVersion, value);

View File

@ -153,8 +153,8 @@ public:
QSize GetFinalMeasurementsDialogSize() const;
void SetFinalMeasurementsDialogSize(const QSize& sz);
int GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(int value);
unsigned GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(unsigned value);
QDate GetDateOfLastRemind() const;
void SetDateOfLastRemind(const QDate &date);