mirror of
https://github.com/leozide/leocad
synced 2024-12-25 21:58:23 +01:00
Require Qt5.
This commit is contained in:
parent
e6397a98ac
commit
b70fab3059
27 changed files with 38 additions and 232 deletions
16
.travis.yml
16
.travis.yml
|
@ -2,22 +2,6 @@ language: cpp
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
|
||||||
name: Qt 4.8
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- sourceline: "ppa:beineri/opt-qt487-trusty"
|
|
||||||
packages:
|
|
||||||
- opt-qt4-qmake opt-qt4-dev-tools opt-libqt4-dev opt-libqt4-dev-bin opt-libqt4-opengl-dev
|
|
||||||
compiler: gcc
|
|
||||||
script:
|
|
||||||
- source /opt/qt*/bin/qt*-env.sh
|
|
||||||
- qmake PREFIX=/usr -v
|
|
||||||
- qmake PREFIX=/usr
|
|
||||||
- make -j$(nproc)
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
name: Linux amd64
|
name: Linux amd64
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
|
@ -126,11 +126,7 @@ void lcCamera::CreateName(const lcArray<lcCamera*>& Cameras)
|
||||||
if (CameraName.startsWith(Prefix))
|
if (CameraName.startsWith(Prefix))
|
||||||
{
|
{
|
||||||
bool Ok = false;
|
bool Ok = false;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
int CameraNumber = CameraName.midRef(Prefix.size()).toInt(&Ok);
|
int CameraNumber = CameraName.midRef(Prefix.size()).toInt(&Ok);
|
||||||
#else
|
|
||||||
int CameraNumber = CameraName.mid((int)strlen(Prefix.latin1())).toInt(&Ok);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Ok && CameraNumber > MaxCameraNumber)
|
if (Ok && CameraNumber > MaxCameraNumber)
|
||||||
MaxCameraNumber = CameraNumber;
|
MaxCameraNumber = CameraNumber;
|
||||||
|
|
|
@ -140,10 +140,7 @@ void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
|
||||||
lcApplication::lcApplication(int& Argc, char** Argv)
|
lcApplication::lcApplication(int& Argc, char** Argv)
|
||||||
: QApplication(Argc, Argv)
|
: QApplication(Argc, Argv)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
setApplicationDisplayName("LeoCAD");
|
setApplicationDisplayName("LeoCAD");
|
||||||
#endif
|
|
||||||
|
|
||||||
setOrganizationDomain("leocad.org");
|
setOrganizationDomain("leocad.org");
|
||||||
setOrganizationName("LeoCAD Software");
|
setOrganizationName("LeoCAD Software");
|
||||||
setApplicationName("LeoCAD");
|
setApplicationName("LeoCAD");
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
#include <QtConcurrent>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
|
@ -16,9 +16,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MAX_MEM_LEVEL >= 8
|
#if MAX_MEM_LEVEL >= 8
|
||||||
# define DEF_MEM_LEVEL 8
|
# define DEF_MEM_LEVEL 8
|
||||||
|
@ -33,12 +31,8 @@
|
||||||
lcPiecesLibrary::lcPiecesLibrary()
|
lcPiecesLibrary::lcPiecesLibrary()
|
||||||
: mLoadMutex(QMutex::Recursive)
|
: mLoadMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QStringList cachePathList = QStandardPaths::standardLocations(QStandardPaths::CacheLocation);
|
QStringList cachePathList = QStandardPaths::standardLocations(QStandardPaths::CacheLocation);
|
||||||
mCachePath = cachePathList.first();
|
mCachePath = cachePathList.first();
|
||||||
#else
|
|
||||||
mCachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QDir Dir;
|
QDir Dir;
|
||||||
Dir.mkpath(mCachePath);
|
Dir.mkpath(mCachePath);
|
||||||
|
@ -426,19 +420,12 @@ void lcPiecesLibrary::ReadArchiveDescriptions(const QString& OfficialFileName, c
|
||||||
QFileInfo UnofficialInfo(UnofficialFileName);
|
QFileInfo UnofficialInfo(UnofficialFileName);
|
||||||
|
|
||||||
mArchiveCheckSum[0] = OfficialInfo.size();
|
mArchiveCheckSum[0] = OfficialInfo.size();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
mArchiveCheckSum[1] = OfficialInfo.lastModified().toMSecsSinceEpoch();
|
mArchiveCheckSum[1] = OfficialInfo.lastModified().toMSecsSinceEpoch();
|
||||||
#else
|
|
||||||
mArchiveCheckSum[1] = OfficialInfo.lastModified().toTime_t();
|
|
||||||
#endif
|
|
||||||
if (!UnofficialFileName.isEmpty())
|
if (!UnofficialFileName.isEmpty())
|
||||||
{
|
{
|
||||||
mArchiveCheckSum[2] = UnofficialInfo.size();
|
mArchiveCheckSum[2] = UnofficialInfo.size();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
mArchiveCheckSum[3] = UnofficialInfo.lastModified().toMSecsSinceEpoch();
|
mArchiveCheckSum[3] = UnofficialInfo.lastModified().toMSecsSinceEpoch();
|
||||||
#else
|
|
||||||
mArchiveCheckSum[3] = UnofficialInfo.lastModified().toTime_t();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -692,11 +679,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
const char* Description = FileName + strlen(FileName) + 1;
|
const char* Description = FileName + strlen(FileName) + 1;
|
||||||
const uint64_t CachedFileTime = *(uint64_t*)(Description + strlen(Description) + 1 + 4 + 1);
|
const uint64_t CachedFileTime = *(uint64_t*)(Description + strlen(Description) + 1 + 4 + 1);
|
||||||
|
|
||||||
#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();
|
||||||
#else
|
|
||||||
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (FileTime == CachedFileTime)
|
if (FileTime == CachedFileTime)
|
||||||
{
|
{
|
||||||
|
@ -746,7 +729,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
|
|
||||||
while (!LoadFuture.isFinished())
|
while (!LoadFuture.isFinished())
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) || QT_VERSION < QT_VERSION_CHECK(5, 0, 0) )
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||||
ProgressDialog->setValue(FilesLoaded);
|
ProgressDialog->setValue(FilesLoaded);
|
||||||
#else
|
#else
|
||||||
ProgressDialog->setValue(FilesLoaded.load());
|
ProgressDialog->setValue(FilesLoaded.load());
|
||||||
|
@ -754,7 +737,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) || QT_VERSION < QT_VERSION_CHECK(5, 0, 0) )
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||||
ProgressDialog->setValue(FilesLoaded);
|
ProgressDialog->setValue(FilesLoaded);
|
||||||
#else
|
#else
|
||||||
ProgressDialog->setValue(FilesLoaded.load());
|
ProgressDialog->setValue(FilesLoaded.load());
|
||||||
|
@ -793,11 +776,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
|
|
||||||
NewIndexFile.WriteU8(Info->mFolderType);
|
NewIndexFile.WriteU8(Info->mFolderType);
|
||||||
|
|
||||||
#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();
|
||||||
#else
|
|
||||||
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NewIndexFile.WriteU64(FileTime);
|
NewIndexFile.WriteU64(FileTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,6 @@ void lcTabBar::mouseReleaseEvent(QMouseEvent* Event)
|
||||||
QTabBar::mouseReleaseEvent(Event);
|
QTabBar::mouseReleaseEvent(Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcTabWidget::lcTabWidget()
|
|
||||||
: QTabWidget()
|
|
||||||
{
|
|
||||||
lcTabBar* TabBar = new lcTabBar(this);
|
|
||||||
setTabBar(TabBar);
|
|
||||||
TabBar->setDrawBase(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcModelTabWidget::ResetLayout()
|
void lcModelTabWidget::ResetLayout()
|
||||||
{
|
{
|
||||||
QLayout* TabLayout = layout();
|
QLayout* TabLayout = layout();
|
||||||
|
@ -147,19 +139,14 @@ void lcMainWindow::CreateWidgets()
|
||||||
CreateMenus();
|
CreateMenus();
|
||||||
CreateStatusBar();
|
CreateStatusBar();
|
||||||
|
|
||||||
mModelTabWidget = new lcTabWidget();
|
mModelTabWidget = new QTabWidget();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
mModelTabWidget->tabBar()->setMovable(true);
|
mModelTabWidget->tabBar()->setMovable(true);
|
||||||
mModelTabWidget->tabBar()->setTabsClosable(true);
|
mModelTabWidget->tabBar()->setTabsClosable(true);
|
||||||
mModelTabWidget->tabBar()->setContextMenuPolicy(Qt::CustomContextMenu);
|
mModelTabWidget->tabBar()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
setCentralWidget(mModelTabWidget);
|
||||||
|
|
||||||
connect(mModelTabWidget->tabBar(), SIGNAL(tabCloseRequested(int)), this, SLOT(ModelTabClosed(int)));
|
connect(mModelTabWidget->tabBar(), SIGNAL(tabCloseRequested(int)), this, SLOT(ModelTabClosed(int)));
|
||||||
connect(mModelTabWidget->tabBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ModelTabContextMenuRequested(const QPoint&)));
|
connect(mModelTabWidget->tabBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ModelTabContextMenuRequested(const QPoint&)));
|
||||||
#else
|
|
||||||
mModelTabWidget->setMovable(true);
|
|
||||||
mModelTabWidget->setTabsClosable(true);
|
|
||||||
connect(mModelTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(ModelTabClosed(int)));
|
|
||||||
#endif
|
|
||||||
setCentralWidget(mModelTabWidget);
|
|
||||||
connect(mModelTabWidget, SIGNAL(currentChanged(int)), this, SLOT(ModelTabChanged(int)));
|
connect(mModelTabWidget, SIGNAL(currentChanged(int)), this, SLOT(ModelTabChanged(int)));
|
||||||
|
|
||||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipboardChanged()));
|
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipboardChanged()));
|
||||||
|
@ -463,9 +450,7 @@ void lcMainWindow::CreateMenus()
|
||||||
FileMenu->addAction(mActions[LC_FILE_SAVE_IMAGE]);
|
FileMenu->addAction(mActions[LC_FILE_SAVE_IMAGE]);
|
||||||
QMenu* ImportMenu = FileMenu->addMenu(tr("&Import"));
|
QMenu* ImportMenu = FileMenu->addMenu(tr("&Import"));
|
||||||
ImportMenu->addAction(mActions[LC_FILE_IMPORT_LDD]);
|
ImportMenu->addAction(mActions[LC_FILE_IMPORT_LDD]);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
ImportMenu->addAction(mActions[LC_FILE_IMPORT_INVENTORY]);
|
ImportMenu->addAction(mActions[LC_FILE_IMPORT_INVENTORY]);
|
||||||
#endif
|
|
||||||
QMenu* ExportMenu = FileMenu->addMenu(tr("&Export"));
|
QMenu* ExportMenu = FileMenu->addMenu(tr("&Export"));
|
||||||
ExportMenu->addAction(mActions[LC_FILE_EXPORT_3DS]);
|
ExportMenu->addAction(mActions[LC_FILE_EXPORT_3DS]);
|
||||||
ExportMenu->addAction(mActions[LC_FILE_EXPORT_BRICKLINK]);
|
ExportMenu->addAction(mActions[LC_FILE_EXPORT_BRICKLINK]);
|
||||||
|
@ -1150,15 +1135,11 @@ void lcMainWindow::Print(QPrinter* Printer)
|
||||||
if (Printer->collateCopies())
|
if (Printer->collateCopies())
|
||||||
{
|
{
|
||||||
DocCopies = 1;
|
DocCopies = 1;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
PageCopies = Printer->supportsMultipleCopies() ? 1 : Printer->copyCount();
|
PageCopies = Printer->supportsMultipleCopies() ? 1 : Printer->copyCount();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
DocCopies = Printer->supportsMultipleCopies() ? 1 : Printer->copyCount();
|
DocCopies = Printer->supportsMultipleCopies() ? 1 : Printer->copyCount();
|
||||||
#endif
|
|
||||||
PageCopies = 1;
|
PageCopies = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,19 +46,6 @@ protected:
|
||||||
int mMousePressTab;
|
int mMousePressTab;
|
||||||
};
|
};
|
||||||
|
|
||||||
class lcTabWidget : public QTabWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
lcTabWidget();
|
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QTabBar* tabBar()
|
|
||||||
{
|
|
||||||
return QTabWidget::tabBar();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
class lcModelTabWidget : public QWidget
|
class lcModelTabWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -431,7 +418,7 @@ protected:
|
||||||
|
|
||||||
QAction* mActionFileRecentSeparator;
|
QAction* mActionFileRecentSeparator;
|
||||||
|
|
||||||
lcTabWidget* mModelTabWidget;
|
QTabWidget* mModelTabWidget;
|
||||||
QToolBar* mStandardToolBar;
|
QToolBar* mStandardToolBar;
|
||||||
QToolBar* mToolsToolBar;
|
QToolBar* mToolsToolBar;
|
||||||
QToolBar* mTimeToolBar;
|
QToolBar* mTimeToolBar;
|
||||||
|
|
|
@ -48,11 +48,7 @@ enum
|
||||||
LC_NUM_MESH_LODS
|
LC_NUM_MESH_LODS
|
||||||
};
|
};
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
enum class lcMeshFlag
|
enum class lcMeshFlag
|
||||||
#else
|
|
||||||
enum lcMeshFlag
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
HasDefault = 0x01, // Mesh has triangles using the default color
|
HasDefault = 0x01, // Mesh has triangles using the default color
|
||||||
HasSolid = 0x02, // Mesh has triangles using a solid color
|
HasSolid = 0x02, // Mesh has triangles using a solid color
|
||||||
|
|
|
@ -88,10 +88,6 @@ lcMinifigDialog::lcMinifigDialog(QWidget* Parent)
|
||||||
ColorPicker->blockSignals(false);
|
ColorPicker->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
ui->TemplateGroup->hide();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UpdateTemplateCombo();
|
UpdateTemplateCombo();
|
||||||
|
|
||||||
mMinifigWizard->Calculate();
|
mMinifigWizard->Calculate();
|
||||||
|
@ -116,7 +112,6 @@ void lcMinifigDialog::UpdateTemplateCombo()
|
||||||
|
|
||||||
void lcMinifigDialog::on_TemplateComboBox_currentIndexChanged(const QString& TemplateName)
|
void lcMinifigDialog::on_TemplateComboBox_currentIndexChanged(const QString& TemplateName)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
const auto& Templates = mMinifigWizard->GetTemplates();
|
const auto& Templates = mMinifigWizard->GetTemplates();
|
||||||
const auto& Position = Templates.find(TemplateName);
|
const auto& Position = Templates.find(TemplateName);
|
||||||
if (Position == Templates.end())
|
if (Position == Templates.end())
|
||||||
|
@ -155,12 +150,10 @@ void lcMinifigDialog::on_TemplateComboBox_currentIndexChanged(const QString& Tem
|
||||||
}
|
}
|
||||||
|
|
||||||
mMinifigWizard->Calculate();
|
mMinifigWizard->Calculate();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMinifigDialog::on_TemplateSaveButton_clicked()
|
void lcMinifigDialog::on_TemplateSaveButton_clicked()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QString CurrentName = ui->TemplateComboBox->currentText();
|
QString CurrentName = ui->TemplateComboBox->currentText();
|
||||||
bool Ok;
|
bool Ok;
|
||||||
QString TemplateName = QInputDialog::getText(this, tr("Save Template"), tr("Template Name:"), QLineEdit::Normal, CurrentName, &Ok);
|
QString TemplateName = QInputDialog::getText(this, tr("Save Template"), tr("Template Name:"), QLineEdit::Normal, CurrentName, &Ok);
|
||||||
|
@ -197,7 +190,6 @@ void lcMinifigDialog::on_TemplateSaveButton_clicked()
|
||||||
UpdateTemplateCombo();
|
UpdateTemplateCombo();
|
||||||
ui->TemplateComboBox->setCurrentText(TemplateName);
|
ui->TemplateComboBox->setCurrentText(TemplateName);
|
||||||
ui->TemplateComboBox->blockSignals(false);
|
ui->TemplateComboBox->blockSignals(false);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMinifigDialog::on_TemplateDeleteButton_clicked()
|
void lcMinifigDialog::on_TemplateDeleteButton_clicked()
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
#include "lc_qutils.h"
|
#include "lc_qutils.h"
|
||||||
#include "lc_lxf.h"
|
#include "lc_lxf.h"
|
||||||
#include "lc_previewwidget.h"
|
#include "lc_previewwidget.h"
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
#include <QtConcurrent>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void lcModelProperties::LoadDefaults()
|
void lcModelProperties::LoadDefaults()
|
||||||
{
|
{
|
||||||
|
@ -974,7 +971,6 @@ bool lcModel::LoadLDD(const QString& FileData)
|
||||||
|
|
||||||
bool lcModel::LoadInventory(const QByteArray& Inventory)
|
bool lcModel::LoadInventory(const QByteArray& Inventory)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QJsonDocument Document = QJsonDocument::fromJson(Inventory);
|
QJsonDocument Document = QJsonDocument::fromJson(Inventory);
|
||||||
QJsonObject Root = Document.object();
|
QJsonObject Root = Document.object();
|
||||||
QJsonArray Parts = Root["results"].toArray();
|
QJsonArray Parts = Root["results"].toArray();
|
||||||
|
@ -1048,9 +1044,6 @@ bool lcModel::LoadInventory(const QByteArray& Inventory)
|
||||||
CalculateStep(mCurrentStep);
|
CalculateStep(mCurrentStep);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::Merge(lcModel* Other)
|
void lcModel::Merge(lcModel* Other)
|
||||||
|
|
|
@ -9,10 +9,6 @@ lcPartPaletteDialog::lcPartPaletteDialog(QWidget* Parent, std::vector<lcPartPale
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
ui->ImportButton->hide();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (const lcPartPalette& Palette : PartPalettes)
|
for (const lcPartPalette& Palette : PartPalettes)
|
||||||
{
|
{
|
||||||
QListWidgetItem* Item = new QListWidgetItem(Palette.Name);
|
QListWidgetItem* Item = new QListWidgetItem(Palette.Name);
|
||||||
|
@ -128,7 +124,6 @@ void lcPartPaletteDialog::on_ImportButton_clicked()
|
||||||
Palette->Name = Dialog.GetSetDescription();
|
Palette->Name = Dialog.GetSetDescription();
|
||||||
mImportedPalettes.push_back(Palette);
|
mImportedPalettes.push_back(Palette);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QByteArray Inventory = Dialog.GetSetInventory();
|
QByteArray Inventory = Dialog.GetSetInventory();
|
||||||
QJsonDocument Document = QJsonDocument::fromJson(Inventory);
|
QJsonDocument Document = QJsonDocument::fromJson(Inventory);
|
||||||
QJsonObject Root = Document.object();
|
QJsonObject Root = Document.object();
|
||||||
|
@ -144,7 +139,6 @@ void lcPartPaletteDialog::on_ImportButton_clicked()
|
||||||
|
|
||||||
Palette->Parts.push_back(PartID.toUpper().toStdString() + ".DAT");
|
Palette->Parts.push_back(PartID.toUpper().toStdString() + ".DAT");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QListWidgetItem* Item = new QListWidgetItem(Palette->Name);
|
QListWidgetItem* Item = new QListWidgetItem(Palette->Name);
|
||||||
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>(reinterpret_cast<uintptr_t>(Palette)));
|
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>(reinterpret_cast<uintptr_t>(Palette)));
|
||||||
|
|
|
@ -550,9 +550,7 @@ lcPartSelectionListView::lcPartSelectionListView(QWidget* Parent, lcPartSelectio
|
||||||
lcPartSelectionItemDelegate* ItemDelegate = new lcPartSelectionItemDelegate(this, mListModel);
|
lcPartSelectionItemDelegate* ItemDelegate = new lcPartSelectionItemDelegate(this, mListModel);
|
||||||
setItemDelegate(ItemDelegate);
|
setItemDelegate(ItemDelegate);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(CustomContextMenuRequested(QPoint)));
|
connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(CustomContextMenuRequested(QPoint)));
|
||||||
#endif
|
|
||||||
|
|
||||||
SetIconSize(lcGetProfileInt(LC_PROFILE_PARTS_LIST_ICONS));
|
SetIconSize(lcGetProfileInt(LC_PROFILE_PARTS_LIST_ICONS));
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1011,6 @@ void lcPartSelectionWidget::SetDefaultPart()
|
||||||
|
|
||||||
void lcPartSelectionWidget::LoadPartPalettes()
|
void lcPartSelectionWidget::LoadPartPalettes()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QByteArray Buffer = lcGetProfileBuffer(LC_PROFILE_PART_PALETTES);
|
QByteArray Buffer = lcGetProfileBuffer(LC_PROFILE_PART_PALETTES);
|
||||||
QJsonDocument Document = QJsonDocument::fromJson(Buffer);
|
QJsonDocument Document = QJsonDocument::fromJson(Buffer);
|
||||||
|
|
||||||
|
@ -1044,12 +1041,10 @@ void lcPartSelectionWidget::LoadPartPalettes()
|
||||||
|
|
||||||
mPartPalettes.emplace_back(std::move(Palette));
|
mPartPalettes.emplace_back(std::move(Palette));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPartSelectionWidget::SavePartPalettes()
|
void lcPartSelectionWidget::SavePartPalettes()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QJsonObject RootObject;
|
QJsonObject RootObject;
|
||||||
|
|
||||||
RootObject["Version"] = 1;
|
RootObject["Version"] = 1;
|
||||||
|
@ -1069,7 +1064,6 @@ void lcPartSelectionWidget::SavePartPalettes()
|
||||||
|
|
||||||
QByteArray Buffer = QJsonDocument(RootObject).toJson();
|
QByteArray Buffer = QJsonDocument(RootObject).toJson();
|
||||||
lcSetProfileBuffer(LC_PROFILE_PART_PALETTES, Buffer);
|
lcSetProfileBuffer(LC_PROFILE_PART_PALETTES, Buffer);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPartSelectionWidget::AddToPalette()
|
void lcPartSelectionWidget::AddToPalette()
|
||||||
|
|
|
@ -139,15 +139,10 @@ void lcMouseShortcuts::Reset()
|
||||||
RotateViewShortcut.Button2 = Qt::RightButton;
|
RotateViewShortcut.Button2 = Qt::RightButton;
|
||||||
|
|
||||||
lcToolShortcut& PanShortcut = mShortcuts[static_cast<int>(lcTool::Pan)];
|
lcToolShortcut& PanShortcut = mShortcuts[static_cast<int>(lcTool::Pan)];
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
PanShortcut.Modifiers1 = Qt::AltModifier;
|
PanShortcut.Modifiers1 = Qt::AltModifier;
|
||||||
PanShortcut.Button1 = Qt::MiddleButton;
|
PanShortcut.Button1 = Qt::MiddleButton;
|
||||||
PanShortcut.Modifiers2 = Qt::ShiftModifier;
|
PanShortcut.Modifiers2 = Qt::ShiftModifier;
|
||||||
PanShortcut.Button2 = Qt::RightButton;
|
PanShortcut.Button2 = Qt::RightButton;
|
||||||
#else
|
|
||||||
PanShortcut.Modifiers1 = Qt::ShiftModifier;
|
|
||||||
PanShortcut.Button1 = Qt::RightButton;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcToolShortcut& ZoomShortcut = mShortcuts[static_cast<int>(lcTool::Zoom)];
|
lcToolShortcut& ZoomShortcut = mShortcuts[static_cast<int>(lcTool::Zoom)];
|
||||||
ZoomShortcut.Modifiers1 = Qt::AltModifier;
|
ZoomShortcut.Modifiers1 = Qt::AltModifier;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
{
|
{
|
||||||
mRefCount.ref();
|
mRefCount.ref();
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) || QT_VERSION < QT_VERSION_CHECK(5, 0, 0) )
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||||
if (mRefCount == 1)
|
if (mRefCount == 1)
|
||||||
#else
|
#else
|
||||||
if (mRefCount.load() == 1)
|
if (mRefCount.load() == 1)
|
||||||
|
|
|
@ -3333,7 +3333,6 @@ void lcView::OnMiddleButtonDown()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::MiddleButton);
|
lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::MiddleButton);
|
||||||
|
|
||||||
if (OverrideTool != lcTrackTool::None)
|
if (OverrideTool != lcTrackTool::None)
|
||||||
|
@ -3341,7 +3340,7 @@ void lcView::OnMiddleButtonDown()
|
||||||
mTrackTool = OverrideTool;
|
mTrackTool = OverrideTool;
|
||||||
UpdateCursor();
|
UpdateCursor();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
OnButtonDown(lcTrackButton::Middle);
|
OnButtonDown(lcTrackButton::Middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,6 @@ void lcViewWidget::mousePressEvent(QMouseEvent* MouseEvent)
|
||||||
mView->OnRightButtonDown();
|
mView->OnRightButtonDown();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
case Qt::BackButton:
|
case Qt::BackButton:
|
||||||
mView->OnBackButtonDown();
|
mView->OnBackButtonDown();
|
||||||
break;
|
break;
|
||||||
|
@ -153,7 +152,6 @@ void lcViewWidget::mousePressEvent(QMouseEvent* MouseEvent)
|
||||||
case Qt::ForwardButton:
|
case Qt::ForwardButton:
|
||||||
mView->OnForwardButtonDown();
|
mView->OnForwardButtonDown();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -181,7 +179,6 @@ void lcViewWidget::mouseReleaseEvent(QMouseEvent* MouseEvent)
|
||||||
mView->OnRightButtonUp();
|
mView->OnRightButtonUp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
case Qt::BackButton:
|
case Qt::BackButton:
|
||||||
mView->OnBackButtonUp();
|
mView->OnBackButtonUp();
|
||||||
break;
|
break;
|
||||||
|
@ -189,7 +186,6 @@ void lcViewWidget::mouseReleaseEvent(QMouseEvent* MouseEvent)
|
||||||
case Qt::ForwardButton:
|
case Qt::ForwardButton:
|
||||||
mView->OnForwardButtonUp();
|
mView->OnForwardButtonUp();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -28,10 +28,8 @@ protected:
|
||||||
{
|
{
|
||||||
#ifdef LC_USE_QOPENGLWIDGET
|
#ifdef LC_USE_QOPENGLWIDGET
|
||||||
return devicePixelRatio();
|
return devicePixelRatio();
|
||||||
#elif (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
return windowHandle()->devicePixelRatio();
|
|
||||||
#else
|
#else
|
||||||
return 1.0f;
|
return windowHandle()->devicePixelRatio();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,11 +81,7 @@ void lcLight::CreateName(const lcArray<lcLight*>& Lights)
|
||||||
if (LightName.startsWith(Prefix))
|
if (LightName.startsWith(Prefix))
|
||||||
{
|
{
|
||||||
bool Ok = false;
|
bool Ok = false;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
int LightNumber = LightName.midRef(Prefix.size()).toInt(&Ok);
|
int LightNumber = LightName.midRef(Prefix.size()).toInt(&Ok);
|
||||||
#else
|
|
||||||
int LightNumber = LightName.mid((int)strlen(Prefix.latin1())).toInt(&Ok);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Ok && LightNumber > MaxLightNumber)
|
if (Ok && LightNumber > MaxLightNumber)
|
||||||
MaxLightNumber = LightNumber;
|
MaxLightNumber = LightNumber;
|
||||||
|
|
|
@ -204,7 +204,6 @@ void MinifigWizard::DeleteTemplate(const QString& TemplateName)
|
||||||
|
|
||||||
void MinifigWizard::AddTemplatesJson(const QByteArray& TemplateData)
|
void MinifigWizard::AddTemplatesJson(const QByteArray& TemplateData)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QJsonDocument Document = QJsonDocument::fromJson(TemplateData);
|
QJsonDocument Document = QJsonDocument::fromJson(TemplateData);
|
||||||
QJsonObject RootObject = Document.object();
|
QJsonObject RootObject = Document.object();
|
||||||
|
|
||||||
|
@ -235,17 +234,10 @@ void MinifigWizard::AddTemplatesJson(const QByteArray& TemplateData)
|
||||||
|
|
||||||
mTemplates.emplace(ElementIt.key(), std::move(Template));
|
mTemplates.emplace(ElementIt.key(), std::move(Template));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray MinifigWizard::GetTemplatesJson() const
|
QByteArray MinifigWizard::GetTemplatesJson() const
|
||||||
{
|
{
|
||||||
QByteArray TemplateData;
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QJsonObject RootObject;
|
|
||||||
|
|
||||||
RootObject["Version"] = 1;
|
|
||||||
QJsonObject TemplatesObject;
|
QJsonObject TemplatesObject;
|
||||||
|
|
||||||
for (const auto& TemplateEntry : mTemplates)
|
for (const auto& TemplateEntry : mTemplates)
|
||||||
|
@ -267,11 +259,11 @@ QByteArray MinifigWizard::GetTemplatesJson() const
|
||||||
TemplatesObject[TemplateEntry.first] = TemplateObject;
|
TemplatesObject[TemplateEntry.first] = TemplateObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QJsonObject RootObject;
|
||||||
RootObject["Templates"] = TemplatesObject;
|
RootObject["Templates"] = TemplatesObject;
|
||||||
TemplateData = QJsonDocument(RootObject).toJson();
|
RootObject["Version"] = 1;
|
||||||
#endif
|
|
||||||
|
|
||||||
return TemplateData;
|
return QJsonDocument(RootObject).toJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinifigWizard::LoadTemplates()
|
void MinifigWizard::LoadTemplates()
|
||||||
|
@ -287,11 +279,9 @@ void MinifigWizard::LoadTemplates()
|
||||||
|
|
||||||
void MinifigWizard::SaveTemplates()
|
void MinifigWizard::SaveTemplates()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QSettings Settings;
|
QSettings Settings;
|
||||||
Settings.beginGroup("Minifig");
|
Settings.beginGroup("Minifig");
|
||||||
Settings.setValue("Templates", GetTemplatesJson());
|
Settings.setValue("Templates", GetTemplatesJson());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinifigWizard::Calculate()
|
void MinifigWizard::Calculate()
|
||||||
|
|
|
@ -124,12 +124,8 @@ QString Project::GetImageFileName(bool AllowCurrentFolder) const
|
||||||
FileName = QLatin1String("image");
|
FileName = QLatin1String("image");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
QStringList CachePathList = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
||||||
QStringList cachePathList = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
FileName = CachePathList.first();
|
||||||
FileName = cachePathList.first();
|
|
||||||
#else
|
|
||||||
FileName = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
|
||||||
#endif
|
|
||||||
FileName = QDir(FileName).absoluteFilePath(QLatin1String("image"));
|
FileName = QDir(FileName).absoluteFilePath(QLatin1String("image"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
leocad.pro
33
leocad.pro
|
@ -1,16 +1,14 @@
|
||||||
QT += core gui opengl network xml
|
QT += core gui opengl network xml concurrent
|
||||||
|
QT *= printsupport
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
lessThan(QT_MAJOR_VERSION, 5) {
|
||||||
QT *= printsupport
|
error("LeoCAD requires Qt5 or later.")
|
||||||
QT += concurrent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
equals(QT_MAJOR_VERSION, 5) {
|
qtHaveModule(gamepad) {
|
||||||
qtHaveModule(gamepad) {
|
|
||||||
QT += gamepad
|
QT += gamepad
|
||||||
DEFINES += LC_ENABLE_GAMEPAD
|
DEFINES += LC_ENABLE_GAMEPAD
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDEPATH += qt common
|
INCLUDEPATH += qt common
|
||||||
|
@ -32,14 +30,10 @@ win32-msvc* {
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -wd4100
|
QMAKE_CXXFLAGS_WARN_ON += -wd4100
|
||||||
QMAKE_CXXFLAGS *= /MP /W4
|
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
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
|
||||||
INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtZlib
|
|
||||||
} else {
|
|
||||||
INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib
|
|
||||||
}
|
|
||||||
QMAKE_LFLAGS += /INCREMENTAL
|
|
||||||
PRECOMPILED_SOURCE = common/lc_global.cpp
|
PRECOMPILED_SOURCE = common/lc_global.cpp
|
||||||
|
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
||||||
|
INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtZlib
|
||||||
|
QMAKE_LFLAGS += /INCREMENTAL
|
||||||
LIBS += -ladvapi32 -lshell32 -lopengl32 -luser32
|
LIBS += -ladvapi32 -lshell32 -lopengl32 -luser32
|
||||||
} else {
|
} else {
|
||||||
PRECOMPILED_HEADER = common/lc_global.h
|
PRECOMPILED_HEADER = common/lc_global.h
|
||||||
|
@ -47,17 +41,6 @@ win32-msvc* {
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
lessThan(QT_MAJOR_VERSION, 5) {
|
|
||||||
unix {
|
|
||||||
GCC_VERSION = $$system(g++ -dumpversion)
|
|
||||||
greaterThan(GCC_VERSION, 4.6) {
|
|
||||||
QMAKE_CXXFLAGS += -std=c++11
|
|
||||||
} else {
|
|
||||||
QMAKE_CXXFLAGS += -std=c++0x
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmpty(QMAKE_LRELEASE) {
|
isEmpty(QMAKE_LRELEASE) {
|
||||||
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
|
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
|
||||||
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
|
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
|
||||||
|
|
|
@ -229,15 +229,9 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
||||||
commandChanged(nullptr);
|
commandChanged(nullptr);
|
||||||
|
|
||||||
UpdateMouseTree();
|
UpdateMouseTree();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
ui->mouseTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
|
ui->mouseTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||||
ui->mouseTree->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
ui->mouseTree->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
ui->mouseTree->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
ui->mouseTree->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
ui->mouseTree->header()->setResizeMode(0, QHeaderView::Stretch);
|
|
||||||
ui->mouseTree->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
|
||||||
ui->mouseTree->header()->setResizeMode(2, QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
MouseTreeItemChanged(nullptr);
|
MouseTreeItemChanged(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,11 +1062,9 @@ void lcQPreferencesDialog::UpdateMouseTreeItem(int ItemIndex)
|
||||||
Shortcut += tr("Left Button");
|
Shortcut += tr("Left Button");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
case Qt::MiddleButton:
|
case Qt::MiddleButton:
|
||||||
Shortcut += tr("Middle Button");
|
Shortcut += tr("Middle Button");
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case Qt::RightButton:
|
case Qt::RightButton:
|
||||||
Shortcut += tr("Right Button");
|
Shortcut += tr("Right Button");
|
||||||
|
@ -1117,11 +1109,9 @@ void lcQPreferencesDialog::on_mouseAssign_clicked()
|
||||||
Button = Qt::LeftButton;
|
Button = Qt::LeftButton;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
case 2:
|
case 2:
|
||||||
Button = Qt::MiddleButton;
|
Button = Qt::MiddleButton;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
Button = Qt::RightButton;
|
Button = Qt::RightButton;
|
||||||
|
@ -1262,11 +1252,9 @@ void lcQPreferencesDialog::MouseTreeItemChanged(QTreeWidgetItem* Current)
|
||||||
ui->mouseButton->setCurrentIndex(1);
|
ui->mouseButton->setCurrentIndex(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
case Qt::MiddleButton:
|
case Qt::MiddleButton:
|
||||||
ui->mouseButton->setCurrentIndex(2);
|
ui->mouseButton->setCurrentIndex(2);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case Qt::RightButton:
|
case Qt::RightButton:
|
||||||
ui->mouseButton->setCurrentIndex(3);
|
ui->mouseButton->setCurrentIndex(3);
|
||||||
|
|
|
@ -76,12 +76,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget* Parent, lcPropertiesDialogOpti
|
||||||
table->setColumnCount(NumColors + 2);
|
table->setColumnCount(NumColors + 2);
|
||||||
table->setRowCount((int)PartsList.size() + 1);
|
table->setRowCount((int)PartsList.size() + 1);
|
||||||
table->setHorizontalHeaderLabels(horizontalLabels);
|
table->setHorizontalHeaderLabels(horizontalLabels);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::vector<int> InfoTotals(PartsList.size());
|
std::vector<int> InfoTotals(PartsList.size());
|
||||||
std::vector<int> ColorTotals(NumColors);
|
std::vector<int> ColorTotals(NumColors);
|
||||||
|
|
|
@ -211,13 +211,8 @@ lcQPropertiesTree::lcQPropertiesTree(QWidget *parent) :
|
||||||
labels.append(tr("Property"));
|
labels.append(tr("Property"));
|
||||||
labels.append(tr("Value"));
|
labels.append(tr("Value"));
|
||||||
setHeaderLabels(labels);
|
setHeaderLabels(labels);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
header()->setSectionsMovable(false);
|
header()->setSectionsMovable(false);
|
||||||
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
header()->setMovable(false);
|
|
||||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
header()->setVisible(false);
|
header()->setVisible(false);
|
||||||
setAlternatingRowColors(true);
|
setAlternatingRowColors(true);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
|
|
|
@ -20,11 +20,7 @@ void lcDoInitialUpdateCheck()
|
||||||
{
|
{
|
||||||
QDateTime NextCheckTime = CheckTime.addDays(updateFrequency == 1 ? 1 : 7);
|
QDateTime NextCheckTime = CheckTime.addDays(updateFrequency == 1 ? 1 : 7);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
if (NextCheckTime > QDateTime::currentDateTimeUtc())
|
if (NextCheckTime > QDateTime::currentDateTimeUtc())
|
||||||
#else
|
|
||||||
if (NextCheckTime > QDateTime::currentDateTime())
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,11 +132,7 @@ void lcQUpdateDialog::DownloadFinished(lcHttpReply *reply)
|
||||||
else
|
else
|
||||||
ui->status->setText(tr("Error parsing update information."));
|
ui->status->setText(tr("Error parsing update information."));
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
settings.setValue("Updates/LastCheck", QDateTime::currentDateTimeUtc());
|
settings.setValue("Updates/LastCheck", QDateTime::currentDateTimeUtc());
|
||||||
#else
|
|
||||||
settings.setValue("Updates/LastCheck", QDateTime::currentDateTime());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ui->status->setText(tr("Error connecting to the update server."));
|
ui->status->setText(tr("Error connecting to the update server."));
|
||||||
|
|
|
@ -60,36 +60,27 @@ bool lcQTreeWidgetColumnStretcher::eventFilter(QObject *obj, QEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->type() == QEvent::Show)
|
if (ev->type() == QEvent::Show)
|
||||||
{
|
{
|
||||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
QHeaderView* HeaderView = qobject_cast<QHeaderView*>(obj);
|
||||||
for (int i = 0; i < hv->count(); ++i)
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
for (int i = 0; i < HeaderView->count(); ++i)
|
||||||
hv->setSectionResizeMode(i, QHeaderView::Interactive);
|
HeaderView->setSectionResizeMode(i, QHeaderView::Interactive);
|
||||||
#else
|
|
||||||
hv->setResizeMode(i, QHeaderView::Interactive);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (ev->type() == QEvent::Hide)
|
else if (ev->type() == QEvent::Hide)
|
||||||
{
|
{
|
||||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
QHeaderView* HeaderView = qobject_cast<QHeaderView*>(obj);
|
||||||
for (int i = 0; i < hv->count(); ++i)
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
for (int i = 0; i < HeaderView->count(); ++i)
|
||||||
hv->setSectionResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
HeaderView->setSectionResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
hv->setResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (ev->type() == QEvent::Resize)
|
else if (ev->type() == QEvent::Resize)
|
||||||
{
|
{
|
||||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
QHeaderView* HeaderView = qobject_cast<QHeaderView*>(obj);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive)
|
if (HeaderView->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive)
|
||||||
#else
|
|
||||||
if (hv->resizeMode(m_columnToStretch) == QHeaderView::Interactive)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QResizeEvent *re = static_cast<QResizeEvent*>(ev);
|
QResizeEvent *re = static_cast<QResizeEvent*>(ev);
|
||||||
int diff = re->size().width() - re->oldSize().width() ;
|
int diff = re->size().width() - re->oldSize().width() ;
|
||||||
hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(1) + diff));
|
HeaderView->resizeSection(m_columnToStretch, qMax(32, HeaderView->sectionSize(1) + diff));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,6 @@ void lcSetsDatabaseDialog::on_SearchButton_clicked()
|
||||||
|
|
||||||
void lcSetsDatabaseDialog::DownloadFinished(lcHttpReply* Reply)
|
void lcSetsDatabaseDialog::DownloadFinished(lcHttpReply* Reply)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
if (Reply == mKeyListReply)
|
if (Reply == mKeyListReply)
|
||||||
{
|
{
|
||||||
if (!Reply->error())
|
if (!Reply->error())
|
||||||
|
@ -227,7 +226,6 @@ void lcSetsDatabaseDialog::DownloadFinished(lcHttpReply* Reply)
|
||||||
|
|
||||||
mInventoryReply = nullptr;
|
mInventoryReply = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Reply->deleteLater();
|
Reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue