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