mirror of
https://github.com/leozide/leocad
synced 2024-12-26 21:58:44 +01:00
Fixed /w4 warnings.
This commit is contained in:
parent
ec720a6c04
commit
602dfeb8b6
16 changed files with 88 additions and 96 deletions
|
@ -120,11 +120,11 @@ public:
|
||||||
mGrow = Grow;
|
mGrow = Grow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllocGrow(int Grow)
|
void AllocGrow(size_t Grow)
|
||||||
{
|
{
|
||||||
if ((mLength + Grow) > mAlloc)
|
if ((mLength + Grow) > mAlloc)
|
||||||
{
|
{
|
||||||
int NewSize = ((mLength + Grow + mGrow - 1) / mGrow) * mGrow;
|
size_t NewSize = ((mLength + Grow + mGrow - 1) / mGrow) * mGrow;
|
||||||
T* NewData = new T[NewSize];
|
T* NewData = new T[NewSize];
|
||||||
|
|
||||||
for (int i = 0; i < mLength; i++)
|
for (int i = 0; i < mLength; i++)
|
||||||
|
@ -263,7 +263,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
T* mData;
|
T* mData;
|
||||||
int mLength;
|
int mLength;
|
||||||
int mAlloc;
|
size_t mAlloc;
|
||||||
int mGrow;
|
int mGrow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ lcMemFile::~lcMemFile()
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMemFile::Seek(long Offset, int From)
|
void lcMemFile::Seek(qint64 Offset, int From)
|
||||||
{
|
{
|
||||||
if (From == SEEK_SET)
|
if (From == SEEK_SET)
|
||||||
mPosition = Offset;
|
mPosition = Offset;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual long GetPosition() const = 0;
|
virtual long GetPosition() const = 0;
|
||||||
virtual void Seek(long Offset, int From) = 0;
|
virtual void Seek(qint64 Offset, int From) = 0;
|
||||||
virtual size_t GetLength() const = 0;
|
virtual size_t GetLength() const = 0;
|
||||||
|
|
||||||
virtual void Close() = 0;
|
virtual void Close() = 0;
|
||||||
|
@ -457,7 +457,7 @@ public:
|
||||||
virtual ~lcMemFile();
|
virtual ~lcMemFile();
|
||||||
|
|
||||||
long GetPosition() const override;
|
long GetPosition() const override;
|
||||||
void Seek(long Offset, int From) override;
|
void Seek(qint64 Offset, int From) override;
|
||||||
void SetLength(size_t NewLength);
|
void SetLength(size_t NewLength);
|
||||||
size_t GetLength() const override;
|
size_t GetLength() const override;
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ public:
|
||||||
return mFile.pos();
|
return mFile.pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seek(long Offset, int From) override
|
void Seek(qint64 Offset, int From) override
|
||||||
{
|
{
|
||||||
switch (From)
|
switch (From)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,8 +18,7 @@ void lcHttpReply::run()
|
||||||
HINTERNET Session = nullptr;
|
HINTERNET Session = nullptr;
|
||||||
HINTERNET Request = nullptr;
|
HINTERNET Request = nullptr;
|
||||||
|
|
||||||
if (sizeof(wchar_t) != sizeof(QChar))
|
static_assert(sizeof(wchar_t) == sizeof(QChar), "Character size mismatch");
|
||||||
return;
|
|
||||||
|
|
||||||
Session = InternetOpen(L"LeoCAD", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
|
Session = InternetOpen(L"LeoCAD", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
|
||||||
if (!Session)
|
if (!Session)
|
||||||
|
|
|
@ -783,7 +783,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
ProgressDialog->setWindowFlags(ProgressDialog->windowFlags() & ~Qt::WindowCloseButtonHint);
|
ProgressDialog->setWindowFlags(ProgressDialog->windowFlags() & ~Qt::WindowCloseButtonHint);
|
||||||
ProgressDialog->setWindowTitle(tr("Initializing"));
|
ProgressDialog->setWindowTitle(tr("Initializing"));
|
||||||
ProgressDialog->setLabelText(tr("Loading Parts Library"));
|
ProgressDialog->setLabelText(tr("Loading Parts Library"));
|
||||||
ProgressDialog->setMaximum(mPieces.size());
|
ProgressDialog->setMaximum((int)mPieces.size());
|
||||||
ProgressDialog->setMinimum(0);
|
ProgressDialog->setMinimum(0);
|
||||||
ProgressDialog->setValue(0);
|
ProgressDialog->setValue(0);
|
||||||
ProgressDialog->setCancelButton(nullptr);
|
ProgressDialog->setCancelButton(nullptr);
|
||||||
|
@ -814,11 +814,11 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
|
|
||||||
if (Modified)
|
if (Modified)
|
||||||
{
|
{
|
||||||
lcMemFile IndexFile;
|
lcMemFile NewIndexFile;
|
||||||
|
|
||||||
IndexFile.WriteQString(mLibraryDir.absolutePath());
|
NewIndexFile.WriteQString(mLibraryDir.absolutePath());
|
||||||
|
|
||||||
IndexFile.WriteU32(mPieces.size());
|
NewIndexFile.WriteU32((quint32)mPieces.size());
|
||||||
|
|
||||||
std::vector<PieceInfo*> SortedPieces;
|
std::vector<PieceInfo*> SortedPieces;
|
||||||
SortedPieces.reserve(mPieces.size());
|
SortedPieces.reserve(mPieces.size());
|
||||||
|
@ -834,14 +834,14 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
|
|
||||||
for (const PieceInfo* Info : SortedPieces)
|
for (const PieceInfo* Info : SortedPieces)
|
||||||
{
|
{
|
||||||
if (IndexFile.WriteBuffer(Info->mFileName, strlen(Info->mFileName) + 1) == 0)
|
if (NewIndexFile.WriteBuffer(Info->mFileName, strlen(Info->mFileName) + 1) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IndexFile.WriteBuffer(Info->m_strDescription, strlen(Info->m_strDescription) + 1) == 0)
|
if (NewIndexFile.WriteBuffer(Info->m_strDescription, strlen(Info->m_strDescription) + 1) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IndexFile.WriteU32(Info->mFlags);
|
NewIndexFile.WriteU32(Info->mFlags);
|
||||||
IndexFile.WriteU8(Info->mFolderType);
|
NewIndexFile.WriteU8(Info->mFolderType);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
||||||
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toMSecsSinceEpoch();
|
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toMSecsSinceEpoch();
|
||||||
|
@ -849,10 +849,10 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t();
|
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IndexFile.WriteU64(FileTime);
|
NewIndexFile.WriteU64(FileTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteDirectoryCacheFile(IndexFileName, IndexFile);
|
WriteDirectoryCacheFile(IndexFileName, NewIndexFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1062,7 +1062,7 @@ bool lcPiecesLibrary::WriteDirectoryCacheFile(const QString& FileName, lcMemFile
|
||||||
if (File.write((char*)&UncompressedSize, sizeof(UncompressedSize)) == -1)
|
if (File.write((char*)&UncompressedSize, sizeof(UncompressedSize)) == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
File.write(qCompress(CacheFile.mBuffer, CacheFile.GetLength()));
|
File.write(qCompress(CacheFile.mBuffer, (int)CacheFile.GetLength()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1100,7 @@ bool lcPiecesLibrary::SaveArchiveCacheIndex(const QString& FileName)
|
||||||
{
|
{
|
||||||
lcMemFile IndexFile;
|
lcMemFile IndexFile;
|
||||||
|
|
||||||
quint32 NumFiles = mPieces.size();
|
quint32 NumFiles = (quint32)mPieces.size();
|
||||||
|
|
||||||
if (IndexFile.WriteBuffer((char*)&NumFiles, sizeof(NumFiles)) == 0)
|
if (IndexFile.WriteBuffer((char*)&NumFiles, sizeof(NumFiles)) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1192,8 +1192,8 @@ void lcMainWindow::SetSelectionMode(lcSelectionMode SelectionMode)
|
||||||
|
|
||||||
QByteArray lcMainWindow::GetTabLayout()
|
QByteArray lcMainWindow::GetTabLayout()
|
||||||
{
|
{
|
||||||
QByteArray TabLayout;
|
QByteArray TabLayoutData;
|
||||||
QDataStream DataStream(&TabLayout, QIODevice::WriteOnly);
|
QDataStream DataStream(&TabLayoutData, QIODevice::WriteOnly);
|
||||||
|
|
||||||
DataStream << (quint32)LC_TAB_LAYOUT_VERSION;
|
DataStream << (quint32)LC_TAB_LAYOUT_VERSION;
|
||||||
qint32 NumTabs = mModelTabWidget->count();
|
qint32 NumTabs = mModelTabWidget->count();
|
||||||
|
@ -1249,7 +1249,7 @@ QByteArray lcMainWindow::GetTabLayout()
|
||||||
SaveWidget(TabLayout->itemAt(0)->widget());
|
SaveWidget(TabLayout->itemAt(0)->widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
return TabLayout;
|
return TabLayoutData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::RestoreTabLayout(const QByteArray& TabLayout)
|
void lcMainWindow::RestoreTabLayout(const QByteArray& TabLayout)
|
||||||
|
|
|
@ -179,18 +179,18 @@ bool lcMouseShortcuts::Save(QStringList& Shortcuts)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcMouseShortcuts::Load(const QStringList& Shortcuts)
|
bool lcMouseShortcuts::Load(const QStringList& FullShortcuts)
|
||||||
{
|
{
|
||||||
memset(mShortcuts, 0, sizeof(mShortcuts));
|
memset(mShortcuts, 0, sizeof(mShortcuts));
|
||||||
|
|
||||||
for (const QString& Shortcut : Shortcuts)
|
for (const QString& FullShortcut : FullShortcuts)
|
||||||
{
|
{
|
||||||
int Equals = Shortcut.indexOf('=');
|
int Equals = FullShortcut.indexOf('=');
|
||||||
|
|
||||||
if (Equals == -1)
|
if (Equals == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString Key = Shortcut.left(Equals);
|
QString Key = FullShortcut.left(Equals);
|
||||||
|
|
||||||
int ToolIdx;
|
int ToolIdx;
|
||||||
for (ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
|
for (ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
|
||||||
|
@ -200,7 +200,7 @@ bool lcMouseShortcuts::Load(const QStringList& Shortcuts)
|
||||||
if (ToolIdx == LC_NUM_TOOLS)
|
if (ToolIdx == LC_NUM_TOOLS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QStringList Shortcuts = Shortcut.mid(Equals + 1).split(',');
|
QStringList Shortcuts = FullShortcut.mid(Equals + 1).split(',');
|
||||||
bool AddedShortcut = false;
|
bool AddedShortcut = false;
|
||||||
|
|
||||||
for (const QString& Shortcut : Shortcuts)
|
for (const QString& Shortcut : Shortcuts)
|
||||||
|
|
|
@ -18,6 +18,8 @@ lcStringCache::~lcStringCache()
|
||||||
|
|
||||||
void lcStringCache::AddRef(lcContext* Context)
|
void lcStringCache::AddRef(lcContext* Context)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(Context);
|
||||||
|
|
||||||
mRefCount++;
|
mRefCount++;
|
||||||
|
|
||||||
if (mRefCount == 1)
|
if (mRefCount == 1)
|
||||||
|
|
|
@ -328,11 +328,11 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const
|
||||||
{
|
{
|
||||||
for (int Axis1Idx = 0; Axis1Idx < 6; Axis1Idx++)
|
for (int Axis1Idx = 0; Axis1Idx < 6; Axis1Idx++)
|
||||||
{
|
{
|
||||||
lcVector3 Point(0.0f, 0.0f, 0.0f);
|
lcVector3 Point1(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
Point[Axis1Idx / 2] = Axis1Idx % 2 ? -1.0f : 1.0f;
|
Point1[Axis1Idx / 2] = Axis1Idx % 2 ? -1.0f : 1.0f;
|
||||||
|
|
||||||
if (lcLengthSquared(Point - Intersection) < mHighlightRadius * mHighlightRadius)
|
if (lcLengthSquared(Point1 - Intersection) < mHighlightRadius * mHighlightRadius)
|
||||||
{
|
{
|
||||||
IntersectionFlags.set(Axis1Idx);
|
IntersectionFlags.set(Axis1Idx);
|
||||||
return;
|
return;
|
||||||
|
@ -343,11 +343,11 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const
|
||||||
if (Axis1Idx / 2 == Axis2Idx / 2)
|
if (Axis1Idx / 2 == Axis2Idx / 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcVector3 Point(0.0f, 0.0f, 0.0f);
|
lcVector3 Point2(0.0f, 0.0f, 0.0f);
|
||||||
Point[Axis1Idx / 2] = Axis1Idx % 2 ? -0.70710678118f : 0.70710678118f;
|
Point2[Axis1Idx / 2] = Axis1Idx % 2 ? -0.70710678118f : 0.70710678118f;
|
||||||
Point[Axis2Idx / 2] = Axis2Idx % 2 ? -0.70710678118f : 0.70710678118f;
|
Point2[Axis2Idx / 2] = Axis2Idx % 2 ? -0.70710678118f : 0.70710678118f;
|
||||||
|
|
||||||
if (lcLengthSquared(Point - Intersection) < mHighlightRadius * mHighlightRadius)
|
if (lcLengthSquared(Point2 - Intersection) < mHighlightRadius * mHighlightRadius)
|
||||||
{
|
{
|
||||||
IntersectionFlags.set(Axis1Idx);
|
IntersectionFlags.set(Axis1Idx);
|
||||||
IntersectionFlags.set(Axis2Idx);
|
IntersectionFlags.set(Axis2Idx);
|
||||||
|
@ -359,12 +359,12 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const
|
||||||
if (Axis1Idx / 2 == Axis3Idx / 2 || Axis2Idx / 2 == Axis3Idx / 2)
|
if (Axis1Idx / 2 == Axis3Idx / 2 || Axis2Idx / 2 == Axis3Idx / 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcVector3 Point(0.0f, 0.0f, 0.0f);
|
lcVector3 Point3(0.0f, 0.0f, 0.0f);
|
||||||
Point[Axis1Idx / 2] = Axis1Idx % 2 ? -0.57735026919f : 0.57735026919f;
|
Point3[Axis1Idx / 2] = Axis1Idx % 2 ? -0.57735026919f : 0.57735026919f;
|
||||||
Point[Axis2Idx / 2] = Axis2Idx % 2 ? -0.57735026919f : 0.57735026919f;
|
Point3[Axis2Idx / 2] = Axis2Idx % 2 ? -0.57735026919f : 0.57735026919f;
|
||||||
Point[Axis3Idx / 2] = Axis3Idx % 2 ? -0.57735026919f : 0.57735026919f;
|
Point3[Axis3Idx / 2] = Axis3Idx % 2 ? -0.57735026919f : 0.57735026919f;
|
||||||
|
|
||||||
if (lcLengthSquared(Point - Intersection) < mHighlightRadius * mHighlightRadius)
|
if (lcLengthSquared(Point3 - Intersection) < mHighlightRadius * mHighlightRadius)
|
||||||
{
|
{
|
||||||
IntersectionFlags.set(Axis1Idx);
|
IntersectionFlags.set(Axis1Idx);
|
||||||
IntersectionFlags.set(Axis2Idx);
|
IntersectionFlags.set(Axis2Idx);
|
||||||
|
|
|
@ -93,7 +93,7 @@ quint64 lcZipFile::SearchCentralDir()
|
||||||
ReadPos = SizeFile - BackRead;
|
ReadPos = SizeFile - BackRead;
|
||||||
|
|
||||||
ReadSize = ((CommentBufferSize + 4) < (SizeFile - ReadPos)) ? (CommentBufferSize + 4) : (SizeFile - ReadPos);
|
ReadSize = ((CommentBufferSize + 4) < (SizeFile - ReadPos)) ? (CommentBufferSize + 4) : (SizeFile - ReadPos);
|
||||||
mFile->Seek((long)ReadPos, SEEK_SET);
|
mFile->Seek(ReadPos, SEEK_SET);
|
||||||
|
|
||||||
if (mFile->ReadBuffer(buf, (long)ReadSize) != ReadSize)
|
if (mFile->ReadBuffer(buf, (long)ReadSize) != ReadSize)
|
||||||
break;
|
break;
|
||||||
|
@ -136,7 +136,7 @@ quint64 lcZipFile::SearchCentralDir64()
|
||||||
ReadPos = SizeFile - BackRead;
|
ReadPos = SizeFile - BackRead;
|
||||||
|
|
||||||
ReadSize = ((CommentBufferSize + 4) < (SizeFile - ReadPos)) ? (CommentBufferSize + 4) : (SizeFile - ReadPos);
|
ReadSize = ((CommentBufferSize + 4) < (SizeFile - ReadPos)) ? (CommentBufferSize + 4) : (SizeFile - ReadPos);
|
||||||
mFile->Seek((long)ReadPos, SEEK_SET);
|
mFile->Seek(ReadPos, SEEK_SET);
|
||||||
|
|
||||||
if (mFile->ReadBuffer(buf, (long)ReadSize) != ReadSize)
|
if (mFile->ReadBuffer(buf, (long)ReadSize) != ReadSize)
|
||||||
break;
|
break;
|
||||||
|
@ -157,7 +157,7 @@ quint64 lcZipFile::SearchCentralDir64()
|
||||||
if (PosFound == 0)
|
if (PosFound == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mFile->Seek((long)PosFound, SEEK_SET);
|
mFile->Seek(PosFound, SEEK_SET);
|
||||||
|
|
||||||
quint32 Number;
|
quint32 Number;
|
||||||
quint64 RelativeOffset;
|
quint64 RelativeOffset;
|
||||||
|
@ -185,7 +185,7 @@ quint64 lcZipFile::SearchCentralDir64()
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Go to end of central directory record.
|
// Go to end of central directory record.
|
||||||
mFile->Seek((long)RelativeOffset, SEEK_SET);
|
mFile->Seek(RelativeOffset, SEEK_SET);
|
||||||
|
|
||||||
// The signature.
|
// The signature.
|
||||||
if (mFile->ReadU32(&Number, 1) != 1)
|
if (mFile->ReadU32(&Number, 1) != 1)
|
||||||
|
@ -208,7 +208,7 @@ bool lcZipFile::CheckFileCoherencyHeader(int FileIndex, quint32* SizeVar, quint6
|
||||||
*OffsetLocalExtraField = 0;
|
*OffsetLocalExtraField = 0;
|
||||||
*SizeLocalExtraField = 0;
|
*SizeLocalExtraField = 0;
|
||||||
|
|
||||||
mFile->Seek((long)(FileInfo.offset_curfile + mBytesBeforeZipFile), SEEK_SET);
|
mFile->Seek(FileInfo.offset_curfile + mBytesBeforeZipFile, SEEK_SET);
|
||||||
|
|
||||||
if (mFile->ReadU32(&Magic, 1) != 1 || Magic != 0x04034b50)
|
if (mFile->ReadU32(&Magic, 1) != 1 || Magic != 0x04034b50)
|
||||||
return false;
|
return false;
|
||||||
|
@ -266,7 +266,7 @@ bool lcZipFile::Open()
|
||||||
mZip64 = true;
|
mZip64 = true;
|
||||||
|
|
||||||
// Skip signature, size and versions.
|
// Skip signature, size and versions.
|
||||||
mFile->Seek((long)CentralPos + 4 + 8 + 2 + 2, SEEK_SET);
|
mFile->Seek(CentralPos + 4 + 8 + 2 + 2, SEEK_SET);
|
||||||
|
|
||||||
// Number of this disk.
|
// Number of this disk.
|
||||||
if (mFile->ReadU32(&NumberDisk, 1) != 1)
|
if (mFile->ReadU32(&NumberDisk, 1) != 1)
|
||||||
|
@ -310,7 +310,7 @@ bool lcZipFile::Open()
|
||||||
mZip64 = false;
|
mZip64 = false;
|
||||||
|
|
||||||
// Skip signature.
|
// Skip signature.
|
||||||
mFile->Seek((long)CentralPos + 4, SEEK_SET);
|
mFile->Seek(CentralPos + 4, SEEK_SET);
|
||||||
|
|
||||||
// Number of this disk.
|
// Number of this disk.
|
||||||
if (mFile->ReadU16(&NumberDisk, 1) != 1)
|
if (mFile->ReadU16(&NumberDisk, 1) != 1)
|
||||||
|
@ -361,7 +361,7 @@ bool lcZipFile::ReadCentralDir()
|
||||||
{
|
{
|
||||||
quint64 PosInCentralDir = mCentralDirOffset;
|
quint64 PosInCentralDir = mCentralDirOffset;
|
||||||
|
|
||||||
mFile->Seek((long)(PosInCentralDir + mBytesBeforeZipFile), SEEK_SET);
|
mFile->Seek(PosInCentralDir + mBytesBeforeZipFile, SEEK_SET);
|
||||||
mFiles.AllocGrow((int)mNumEntries);
|
mFiles.AllocGrow((int)mNumEntries);
|
||||||
|
|
||||||
for (quint64 FileNum = 0; FileNum < mNumEntries; FileNum++)
|
for (quint64 FileNum = 0; FileNum < mNumEntries; FileNum++)
|
||||||
|
@ -636,6 +636,7 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, quint32 MaxLength)
|
||||||
File.SetLength(Length);
|
File.SetLength(Length);
|
||||||
File.Seek(0, SEEK_SET);
|
File.Seek(0, SEEK_SET);
|
||||||
|
|
||||||
|
Stream.next_in = (Bytef*)ReadBuffer;
|
||||||
Stream.next_out = (Bytef*)File.mBuffer;
|
Stream.next_out = (Bytef*)File.mBuffer;
|
||||||
Stream.avail_out = Length;
|
Stream.avail_out = Length;
|
||||||
|
|
||||||
|
@ -653,7 +654,7 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, quint32 MaxLength)
|
||||||
if (ReadThis == 0)
|
if (ReadThis == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mFile->Seek((long)(PosInZipfile + mBytesBeforeZipFile), SEEK_SET);
|
mFile->Seek(PosInZipfile + mBytesBeforeZipFile, SEEK_SET);
|
||||||
if (mFile->ReadBuffer(ReadBuffer, ReadThis) != ReadThis)
|
if (mFile->ReadBuffer(ReadBuffer, ReadThis) != ReadThis)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -596,17 +596,17 @@ void lcPiece::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
||||||
float Verts[8 * 3];
|
float Verts[8 * 3];
|
||||||
float* CurVert = Verts;
|
float* CurVert = Verts;
|
||||||
|
|
||||||
lcVector3 Min(-LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE);
|
lcVector3 CubeMin(-LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE, -LC_PIECE_CONTROL_POINT_SIZE);
|
||||||
lcVector3 Max(LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE);
|
lcVector3 CubeMax(LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE, LC_PIECE_CONTROL_POINT_SIZE);
|
||||||
|
|
||||||
*CurVert++ = Min[0]; *CurVert++ = Min[1]; *CurVert++ = Min[2];
|
*CurVert++ = CubeMin[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMin[2];
|
||||||
*CurVert++ = Min[0]; *CurVert++ = Max[1]; *CurVert++ = Min[2];
|
*CurVert++ = CubeMin[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMin[2];
|
||||||
*CurVert++ = Max[0]; *CurVert++ = Max[1]; *CurVert++ = Min[2];
|
*CurVert++ = CubeMax[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMin[2];
|
||||||
*CurVert++ = Max[0]; *CurVert++ = Min[1]; *CurVert++ = Min[2];
|
*CurVert++ = CubeMax[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMin[2];
|
||||||
*CurVert++ = Min[0]; *CurVert++ = Min[1]; *CurVert++ = Max[2];
|
*CurVert++ = CubeMin[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMax[2];
|
||||||
*CurVert++ = Min[0]; *CurVert++ = Max[1]; *CurVert++ = Max[2];
|
*CurVert++ = CubeMin[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMax[2];
|
||||||
*CurVert++ = Max[0]; *CurVert++ = Max[1]; *CurVert++ = Max[2];
|
*CurVert++ = CubeMax[0]; *CurVert++ = CubeMax[1]; *CurVert++ = CubeMax[2];
|
||||||
*CurVert++ = Max[0]; *CurVert++ = Min[1]; *CurVert++ = Max[2];
|
*CurVert++ = CubeMax[0]; *CurVert++ = CubeMin[1]; *CurVert++ = CubeMax[2];
|
||||||
|
|
||||||
const GLushort Indices[36] =
|
const GLushort Indices[36] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -192,11 +192,11 @@ QString Project::GetNewModelName(QWidget* ParentWidget, const QString& DialogTit
|
||||||
|
|
||||||
for (int ModelIdx = 0; ModelIdx < ExistingModels.size(); ModelIdx++)
|
for (int ModelIdx = 0; ModelIdx < ExistingModels.size(); ModelIdx++)
|
||||||
{
|
{
|
||||||
const QString& Name = ExistingModels[ModelIdx];
|
const QString& ExistingName = ExistingModels[ModelIdx];
|
||||||
|
|
||||||
if (Name.startsWith(Prefix))
|
if (ExistingName.startsWith(Prefix))
|
||||||
{
|
{
|
||||||
QString NumberString = Name.mid(Prefix.length());
|
QString NumberString = ExistingName.mid(Prefix.length());
|
||||||
QTextStream Stream(&NumberString);
|
QTextStream Stream(&NumberString);
|
||||||
int Number;
|
int Number;
|
||||||
Stream >> Number;
|
Stream >> Number;
|
||||||
|
@ -552,19 +552,14 @@ bool Project::ImportLDD(const QString& FileName)
|
||||||
Model->SetSaved();
|
Model->SetSaved();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete Model;
|
|
||||||
|
|
||||||
if (mModels.IsEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mModels.GetSize() == 1)
|
|
||||||
{
|
{
|
||||||
lcModel* Model = mModels[0];
|
delete Model;
|
||||||
|
return false;
|
||||||
if (Model->GetProperties().mName.isEmpty())
|
|
||||||
Model->SetName(QFileInfo(FileName).completeBaseName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Model->GetProperties().mName.isEmpty())
|
||||||
|
Model->SetName(QFileInfo(FileName).completeBaseName());
|
||||||
|
|
||||||
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
|
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
|
||||||
mModels[ModelIdx]->CreatePieceInfo(this);
|
mModels[ModelIdx]->CreatePieceInfo(this);
|
||||||
|
|
||||||
|
@ -593,19 +588,14 @@ bool Project::ImportInventory(const QByteArray& Inventory, const QString& Name,
|
||||||
Model->SetSaved();
|
Model->SetSaved();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete Model;
|
|
||||||
|
|
||||||
if (mModels.IsEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mModels.GetSize() == 1)
|
|
||||||
{
|
{
|
||||||
lcModel* Model = mModels[0];
|
delete Model;
|
||||||
|
return false;
|
||||||
Model->SetName(Name);
|
|
||||||
Model->SetDescription(Description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Model->SetName(Name);
|
||||||
|
Model->SetDescription(Description);
|
||||||
|
|
||||||
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
|
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
|
||||||
mModels[ModelIdx]->CreatePieceInfo(this);
|
mModels[ModelIdx]->CreatePieceInfo(this);
|
||||||
|
|
||||||
|
@ -1670,10 +1660,10 @@ QImage Project::CreatePartsListImage(lcModel* Model, lcStep Step)
|
||||||
CurrentHeight += NextHeightIncrease;
|
CurrentHeight += NextHeightIncrease;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Image(MaxWidth + 40, CurrentHeight + 40, QImage::Format_ARGB32);
|
QImage PainterImage(MaxWidth + 40, CurrentHeight + 40, QImage::Format_ARGB32);
|
||||||
Image.fill(QColor(255, 255, 255, 0));
|
PainterImage.fill(QColor(255, 255, 255, 0));
|
||||||
|
|
||||||
QPainter Painter(&Image);
|
QPainter Painter(&PainterImage);
|
||||||
Painter.setFont(Font);
|
Painter.setFont(Font);
|
||||||
|
|
||||||
for (lcPartsListImage& Image : Images)
|
for (lcPartsListImage& Image : Images)
|
||||||
|
@ -1685,7 +1675,7 @@ QImage Project::CreatePartsListImage(lcModel* Model, lcStep Step)
|
||||||
|
|
||||||
Painter.end();
|
Painter.end();
|
||||||
|
|
||||||
return Image;
|
return PainterImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::CreateHTMLPieceList(QTextStream& Stream, lcModel* Model, lcStep Step, bool Images)
|
void Project::CreateHTMLPieceList(QTextStream& Stream, lcModel* Model, lcStep Step, bool Images)
|
||||||
|
|
|
@ -690,7 +690,7 @@ lcArray<lcObject*> View::FindObjectsInBox(float x1, float y1, float x2, float y2
|
||||||
lcVector3(Right, Bottom, 1)
|
lcVector3(Right, Bottom, 1)
|
||||||
}};
|
}};
|
||||||
|
|
||||||
UnprojectPoints(Corners.data(), Corners.size());
|
UnprojectPoints(Corners.data(), (int)Corners.size());
|
||||||
|
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ win32 {
|
||||||
}
|
}
|
||||||
win32-msvc* {
|
win32-msvc* {
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -wd4100
|
QMAKE_CXXFLAGS_WARN_ON += -wd4100
|
||||||
|
QMAKE_CXXFLAGS *= /MP /W4
|
||||||
PRECOMPILED_HEADER = common/lc_global.h
|
PRECOMPILED_HEADER = common/lc_global.h
|
||||||
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||||
|
|
||||||
QTableWidget *table = ui->partsTable;
|
QTableWidget *table = ui->partsTable;
|
||||||
table->setColumnCount(NumColors + 2);
|
table->setColumnCount(NumColors + 2);
|
||||||
table->setRowCount(PartsList.size() + 1);
|
table->setRowCount((int)PartsList.size() + 1);
|
||||||
table->setHorizontalHeaderLabels(horizontalLabels);
|
table->setHorizontalHeaderLabels(horizontalLabels);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||||
|
@ -80,8 +80,8 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||||
table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QVector<int> InfoTotals(PartsList.size());
|
std::vector<int> InfoTotals(PartsList.size());
|
||||||
QVector<int> ColorTotals(NumColors);
|
std::vector<int> ColorTotals(NumColors);
|
||||||
int Row = 0, Total = 0;
|
int Row = 0, Total = 0;
|
||||||
|
|
||||||
for (const auto& PartIt : PartsList)
|
for (const auto& PartIt : PartsList)
|
||||||
|
@ -105,7 +105,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||||
Row++;
|
Row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->setItem(InfoTotals.size(), 0, new QTableWidgetItem(tr("Total")));
|
table->setItem((int)InfoTotals.size(), 0, new QTableWidgetItem(tr("Total")));
|
||||||
|
|
||||||
for (Row = 0; Row < InfoTotals.size(); Row++)
|
for (Row = 0; Row < InfoTotals.size(); Row++)
|
||||||
{
|
{
|
||||||
|
@ -118,12 +118,12 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString::number(ColorTotals[colorIdx]));
|
QTableWidgetItem *item = new QTableWidgetItem(QString::number(ColorTotals[colorIdx]));
|
||||||
item->setTextAlignment(Qt::AlignCenter);
|
item->setTextAlignment(Qt::AlignCenter);
|
||||||
table->setItem(InfoTotals.size(), colorIdx + 1, item);
|
table->setItem((int)InfoTotals.size(), colorIdx + 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString::number(Total));
|
QTableWidgetItem *item = new QTableWidgetItem(QString::number(Total));
|
||||||
item->setTextAlignment(Qt::AlignCenter);
|
item->setTextAlignment(Qt::AlignCenter);
|
||||||
table->setItem(InfoTotals.size(), NumColors + 1, item);
|
table->setItem((int)InfoTotals.size(), NumColors + 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcQPropertiesDialog::~lcQPropertiesDialog()
|
lcQPropertiesDialog::~lcQPropertiesDialog()
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
char* strcasestr(const char *s, const char *find)
|
char* strcasestr(const char *s, const char *find)
|
||||||
{
|
{
|
||||||
char c, sc;
|
char c, sc;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if ((c = *find++) != 0)
|
if ((c = *find++) != 0)
|
||||||
{
|
{
|
||||||
c = tolower((unsigned char)c);
|
c = tolower((unsigned char)c);
|
||||||
len = strlen(find);
|
int len = (int)strlen(find);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in a new issue