mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Add stud logo preference and command line option (#387)
* Add stud logo preference and command line option * Support add stud logo when using disk library
This commit is contained in:
parent
23eb88df4f
commit
5adcfb4027
9 changed files with 190 additions and 63 deletions
|
@ -75,8 +75,8 @@ lcApplication::lcApplication(int& Argc, char** Argv)
|
||||||
|
|
||||||
lcApplication::~lcApplication()
|
lcApplication::~lcApplication()
|
||||||
{
|
{
|
||||||
delete mProject;
|
delete mProject;
|
||||||
delete mLibrary;
|
delete mLibrary;
|
||||||
gApplication = nullptr;
|
gApplication = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +189,7 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
|
||||||
bool ImageHighlight = false;
|
bool ImageHighlight = false;
|
||||||
int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
|
int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
|
||||||
int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
|
int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
|
||||||
|
int StudLogo = lcGetProfileInt(LC_PROFILE_STUD_LOGO);
|
||||||
int ImageStart = 0;
|
int ImageStart = 0;
|
||||||
int ImageEnd = 0;
|
int ImageEnd = 0;
|
||||||
int PartImagesWidth = -1;
|
int PartImagesWidth = -1;
|
||||||
|
@ -343,6 +344,11 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
|
||||||
}
|
}
|
||||||
else if (Param == QLatin1String("--line-width"))
|
else if (Param == QLatin1String("--line-width"))
|
||||||
ParseFloat(mPreferences.mLineWidth);
|
ParseFloat(mPreferences.mLineWidth);
|
||||||
|
else if (Param == QLatin1String("-sl") || Param == QLatin1String("--stud-logo"))
|
||||||
|
{
|
||||||
|
ParseInteger(StudLogo);
|
||||||
|
lcSetProfileInt(LC_PROFILE_STUD_LOGO, StudLogo);
|
||||||
|
}
|
||||||
else if (Param == QLatin1String("-obj") || Param == QLatin1String("--export-wavefront"))
|
else if (Param == QLatin1String("-obj") || Param == QLatin1String("--export-wavefront"))
|
||||||
{
|
{
|
||||||
SaveWavefront = true;
|
SaveWavefront = true;
|
||||||
|
@ -392,6 +398,7 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
|
||||||
printf(" -t, --to <time>: Set the last step to save pictures.\n");
|
printf(" -t, --to <time>: Set the last step to save pictures.\n");
|
||||||
printf(" -s, --submodel <submodel>: Set the active submodel.\n");
|
printf(" -s, --submodel <submodel>: Set the active submodel.\n");
|
||||||
printf(" -c, --camera <camera>: Set the active camera.\n");
|
printf(" -c, --camera <camera>: Set the active camera.\n");
|
||||||
|
printf(" -sl --stud-logo <type>: Set the stud logo type 0 - 5, 0 is no logo.\n");
|
||||||
printf(" --viewpoint <front|back|left|right|top|bottom|home>: Set the viewpoint.\n");
|
printf(" --viewpoint <front|back|left|right|top|bottom|home>: Set the viewpoint.\n");
|
||||||
printf(" --camera-angles <latitude> <longitude>: Set the camera angles in degrees around the model.\n");
|
printf(" --camera-angles <latitude> <longitude>: Set the camera angles in degrees around the model.\n");
|
||||||
printf(" --orthographic: Make the view orthographic.\n");
|
printf(" --orthographic: Make the view orthographic.\n");
|
||||||
|
@ -647,6 +654,7 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
{
|
{
|
||||||
lcPreferencesDialogOptions Options;
|
lcPreferencesDialogOptions Options;
|
||||||
int CurrentAASamples = lcGetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES);
|
int CurrentAASamples = lcGetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES);
|
||||||
|
int CurrentStudLogo = lcGetProfileInt(LC_PROFILE_STUD_LOGO);
|
||||||
|
|
||||||
Options.Preferences = mPreferences;
|
Options.Preferences = mPreferences;
|
||||||
|
|
||||||
|
@ -659,6 +667,7 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
Options.CheckForUpdates = lcGetProfileInt(LC_PROFILE_CHECK_UPDATES);
|
Options.CheckForUpdates = lcGetProfileInt(LC_PROFILE_CHECK_UPDATES);
|
||||||
|
|
||||||
Options.AASamples = CurrentAASamples;
|
Options.AASamples = CurrentAASamples;
|
||||||
|
Options.StudLogo = CurrentStudLogo;
|
||||||
|
|
||||||
Options.Categories = gCategories;
|
Options.Categories = gCategories;
|
||||||
Options.CategoriesModified = false;
|
Options.CategoriesModified = false;
|
||||||
|
@ -678,6 +687,7 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
bool LibraryChanged = Options.LibraryPath != lcGetProfileString(LC_PROFILE_PARTS_LIBRARY);
|
bool LibraryChanged = Options.LibraryPath != lcGetProfileString(LC_PROFILE_PARTS_LIBRARY);
|
||||||
bool ColorsChanged = Options.ColorConfigPath != lcGetProfileString(LC_PROFILE_COLOR_CONFIG);
|
bool ColorsChanged = Options.ColorConfigPath != lcGetProfileString(LC_PROFILE_COLOR_CONFIG);
|
||||||
bool AAChanged = CurrentAASamples != Options.AASamples;
|
bool AAChanged = CurrentAASamples != Options.AASamples;
|
||||||
|
bool StudLogoChanged = CurrentStudLogo != Options.StudLogo;
|
||||||
|
|
||||||
mPreferences = Options.Preferences;
|
mPreferences = Options.Preferences;
|
||||||
|
|
||||||
|
@ -691,8 +701,9 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, Options.LGEOPath);
|
lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, Options.LGEOPath);
|
||||||
lcSetProfileInt(LC_PROFILE_CHECK_UPDATES, Options.CheckForUpdates);
|
lcSetProfileInt(LC_PROFILE_CHECK_UPDATES, Options.CheckForUpdates);
|
||||||
lcSetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES, Options.AASamples);
|
lcSetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES, Options.AASamples);
|
||||||
|
lcSetProfileInt(LC_PROFILE_STUD_LOGO, Options.StudLogo);
|
||||||
|
|
||||||
if (LibraryChanged || ColorsChanged || AAChanged)
|
if (LibraryChanged || ColorsChanged || AAChanged || StudLogoChanged)
|
||||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Some changes will only take effect the next time you start LeoCAD."));
|
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Some changes will only take effect the next time you start LeoCAD."));
|
||||||
|
|
||||||
if (Options.CategoriesModified)
|
if (Options.CategoriesModified)
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct lcPreferencesDialogOptions
|
||||||
int CheckForUpdates;
|
int CheckForUpdates;
|
||||||
|
|
||||||
int AASamples;
|
int AASamples;
|
||||||
|
int StudLogo;
|
||||||
|
|
||||||
lcArray<lcLibraryCategory> Categories;
|
lcArray<lcLibraryCategory> Categories;
|
||||||
bool CategoriesModified;
|
bool CategoriesModified;
|
||||||
|
|
|
@ -366,7 +366,7 @@ bool lcPiecesLibrary::OpenArchive(lcFile* File, const QString& FileName, lcZipFi
|
||||||
if (!memcmp(Dst, ".PNG", 4))
|
if (!memcmp(Dst, ".PNG", 4))
|
||||||
{
|
{
|
||||||
if ((ZipFileType == LC_ZIPFILE_OFFICIAL && !memcmp(Name, "LDRAW/PARTS/TEXTURES/", 21)) ||
|
if ((ZipFileType == LC_ZIPFILE_OFFICIAL && !memcmp(Name, "LDRAW/PARTS/TEXTURES/", 21)) ||
|
||||||
(ZipFileType == LC_ZIPFILE_UNOFFICIAL && !memcmp(Name, "PARTS/TEXTURES/", 15)))
|
(ZipFileType == LC_ZIPFILE_UNOFFICIAL && !memcmp(Name, "PARTS/TEXTURES/", 15)))
|
||||||
{
|
{
|
||||||
lcTexture* Texture = new lcTexture();
|
lcTexture* Texture = new lcTexture();
|
||||||
mTextures.push_back(Texture);
|
mTextures.push_back(Texture);
|
||||||
|
@ -629,7 +629,7 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
const char* FileName = (const char*)IndexFile.mBuffer + IndexFile.GetPosition();
|
const char* FileName = (const char*)IndexFile.mBuffer + IndexFile.GetPosition();
|
||||||
CachedDescriptions.push_back(FileName);
|
CachedDescriptions.push_back(FileName);
|
||||||
IndexFile.Seek(strlen(FileName) + 1, SEEK_CUR);
|
IndexFile.Seek(strlen(FileName) + 1, SEEK_CUR);
|
||||||
const char* Description = (const char*)IndexFile.mBuffer + IndexFile.GetPosition();
|
const char* Description = (const char*)IndexFile.mBuffer + IndexFile.GetPosition();
|
||||||
IndexFile.Seek(strlen(Description) + 1, SEEK_CUR);
|
IndexFile.Seek(strlen(Description) + 1, SEEK_CUR);
|
||||||
IndexFile.Seek(4 + 1 + 8, SEEK_CUR);
|
IndexFile.Seek(4 + 1 + 8, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
@ -823,7 +823,7 @@ bool lcPiecesLibrary::ReadArchiveCacheFile(const QString& FileName, lcMemFile& C
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
quint32 CacheVersion, CacheFlags;
|
quint32 CacheVersion, CacheFlags;
|
||||||
|
|
||||||
if (File.read((char*)&CacheVersion, sizeof(CacheVersion)) == -1 || CacheVersion != LC_LIBRARY_CACHE_VERSION)
|
if (File.read((char*)&CacheVersion, sizeof(CacheVersion)) == -1 || CacheVersion != LC_LIBRARY_CACHE_VERSION)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ bool lcPiecesLibrary::ReadArchiveCacheFile(const QString& FileName, lcMemFile& C
|
||||||
} while (ret != Z_STREAM_END);
|
} while (ret != Z_STREAM_END);
|
||||||
|
|
||||||
(void)inflateEnd(&strm);
|
(void)inflateEnd(&strm);
|
||||||
|
|
||||||
CacheFile.Seek(0, SEEK_SET);
|
CacheFile.Seek(0, SEEK_SET);
|
||||||
|
|
||||||
return ret == Z_STREAM_END;
|
return ret == Z_STREAM_END;
|
||||||
|
@ -914,7 +914,7 @@ bool lcPiecesLibrary::WriteArchiveCacheFile(const QString& FileName, lcMemFile&
|
||||||
|
|
||||||
quint32 CacheVersion = LC_LIBRARY_CACHE_VERSION;
|
quint32 CacheVersion = LC_LIBRARY_CACHE_VERSION;
|
||||||
quint32 CacheFlags = LC_LIBRARY_CACHE_ARCHIVE;
|
quint32 CacheFlags = LC_LIBRARY_CACHE_ARCHIVE;
|
||||||
|
|
||||||
if (File.write((char*)&CacheVersion, sizeof(CacheVersion)) == -1)
|
if (File.write((char*)&CacheVersion, sizeof(CacheVersion)) == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ bool lcPiecesLibrary::WriteArchiveCacheFile(const QString& FileName, lcMemFile&
|
||||||
} while (Stream.avail_out == 0);
|
} while (Stream.avail_out == 0);
|
||||||
} while (FlushMode != Z_FINISH);
|
} while (FlushMode != Z_FINISH);
|
||||||
|
|
||||||
deflateEnd(&Stream);
|
deflateEnd(&Stream);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1246,7 +1246,7 @@ bool lcPiecesLibrary::LoadPieceData(PieceInfo* Info)
|
||||||
Loaded = MeshLoader.LoadMesh(PieceFile, LC_MESHDATA_SHARED);
|
Loaded = MeshLoader.LoadMesh(PieceFile, LC_MESHDATA_SHARED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Loaded || mCancelLoading)
|
if (!Loaded || mCancelLoading)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1549,6 +1549,33 @@ void lcPiecesLibrary::UploadTextures(lcContext* Context)
|
||||||
mTextureUploads.clear();
|
mTextureUploads.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool lcPiecesLibrary::GetStudLogo(lcMemFile& PrimFile, int StudLogo, bool OpenStud)
|
||||||
|
{
|
||||||
|
// validate logo choice and unofficial lib available
|
||||||
|
if (!StudLogo || (!mZipFiles[LC_ZIPFILE_UNOFFICIAL] && !mHasUnofficial))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// construct logo reference line
|
||||||
|
QString Logo = QString("%1").arg(StudLogo);
|
||||||
|
QString LogoRefLine = QString("1 16 0 0 0 1 0 0 0 1 0 0 0 1 ");
|
||||||
|
LogoRefLine += (OpenStud ? QString("stud2-logo%1.dat").arg(StudLogo > 1 ? Logo : ""):
|
||||||
|
QString("stud-logo%1.dat").arg(StudLogo > 1 ? Logo : ""));
|
||||||
|
|
||||||
|
// construct primitive file
|
||||||
|
QByteArray FileData;
|
||||||
|
QTextStream out(&FileData);
|
||||||
|
out << (OpenStud ? "0 Stud Open" : "0 Stud") << endl;
|
||||||
|
out << (OpenStud ? "0 Name: stud2.dat" : "0 Name: stud.dat") << endl;
|
||||||
|
out << "0 Author: James Jessiman" << endl;
|
||||||
|
out << "0 !LDRAW_ORG Primitive" << endl;
|
||||||
|
out << "0 BFC CERTIFY CCW" << endl;
|
||||||
|
out << LogoRefLine << endl;
|
||||||
|
|
||||||
|
PrimFile.WriteBuffer(FileData.constData(), size_t(FileData.size()));
|
||||||
|
PrimFile.Seek(0, SEEK_SET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive)
|
bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive)
|
||||||
{
|
{
|
||||||
mLoadMutex.lock();
|
mLoadMutex.lock();
|
||||||
|
@ -1569,22 +1596,37 @@ bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive)
|
||||||
|
|
||||||
lcMeshLoader MeshLoader(Primitive->mMeshData, true, nullptr, false);
|
lcMeshLoader MeshLoader(Primitive->mMeshData, true, nullptr, false);
|
||||||
|
|
||||||
|
bool SetStudLogo = false;
|
||||||
|
int StudLogo = lcGetProfileInt(LC_PROFILE_STUD_LOGO);
|
||||||
|
|
||||||
if (mZipFiles[LC_ZIPFILE_OFFICIAL])
|
if (mZipFiles[LC_ZIPFILE_OFFICIAL])
|
||||||
{
|
{
|
||||||
lcLibraryPrimitive* LowPrimitive = nullptr;
|
lcLibraryPrimitive* LowPrimitive = nullptr;
|
||||||
|
|
||||||
if (Primitive->mStud && strncmp(Primitive->mName, "8/", 2)) // todo: this is currently the only place that uses mName so use mFileName instead. this should also be done for the loose file libraries.
|
|
||||||
{
|
|
||||||
char Name[LC_PIECE_NAME_LEN];
|
|
||||||
strcpy(Name, "8/");
|
|
||||||
strcat(Name, Primitive->mName);
|
|
||||||
|
|
||||||
LowPrimitive = FindPrimitive(Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
lcMemFile PrimFile;
|
lcMemFile PrimFile;
|
||||||
|
|
||||||
if (!mZipFiles[Primitive->mZipFileType]->ExtractFile(Primitive->mZipFileIndex, PrimFile))
|
if (Primitive->mStud)
|
||||||
|
{
|
||||||
|
if (strncmp(Primitive->mName, "8/", 2)) // todo: this is currently the only place that uses mName so use mFileName instead. this should also be done for the loose file libraries.
|
||||||
|
{
|
||||||
|
char Name[LC_PIECE_NAME_LEN];
|
||||||
|
strcpy(Name, "8/");
|
||||||
|
strcat(Name, Primitive->mName);
|
||||||
|
|
||||||
|
LowPrimitive = FindPrimitive(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StudLogo)
|
||||||
|
{
|
||||||
|
bool OpenStud = !strcmp(Primitive->mName,"stud2.dat");
|
||||||
|
if ((SetStudLogo = (OpenStud || !strcmp(Primitive->mName,"stud.dat"))))
|
||||||
|
{
|
||||||
|
SetStudLogo = GetStudLogo(PrimFile,StudLogo,OpenStud);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SetStudLogo && !mZipFiles[Primitive->mZipFileType]->ExtractFile(Primitive->mZipFileIndex, PrimFile))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!LowPrimitive)
|
if (!LowPrimitive)
|
||||||
|
@ -1606,10 +1648,25 @@ bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcDiskFile PrimFile(Primitive->mFileName);
|
if (StudLogo && Primitive->mStud)
|
||||||
|
{
|
||||||
|
lcMemFile PrimFile;
|
||||||
|
|
||||||
if (!PrimFile.Open(QIODevice::ReadOnly) || !MeshLoader.LoadMesh(PrimFile, LC_MESHDATA_SHARED)) // todo: LOD like the zip files
|
bool OpenStud = !strcmp(Primitive->mName,"stud2.dat");
|
||||||
return false;
|
if ((SetStudLogo = (OpenStud || !strcmp(Primitive->mName,"stud.dat"))))
|
||||||
|
{
|
||||||
|
if ((SetStudLogo = GetStudLogo(PrimFile,StudLogo,OpenStud)))
|
||||||
|
SetStudLogo = MeshLoader.LoadMesh(PrimFile, LC_MESHDATA_SHARED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SetStudLogo)
|
||||||
|
{
|
||||||
|
lcDiskFile PrimFile(Primitive->mFileName);
|
||||||
|
|
||||||
|
if (!PrimFile.Open(QIODevice::ReadOnly) || !MeshLoader.LoadMesh(PrimFile, LC_MESHDATA_SHARED)) // todo: LOD like the zip files
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mLoadMutex.lock();
|
mLoadMutex.lock();
|
||||||
|
|
|
@ -113,6 +113,8 @@ public:
|
||||||
|
|
||||||
bool LoadPrimitive(lcLibraryPrimitive* Primitive);
|
bool LoadPrimitive(lcLibraryPrimitive* Primitive);
|
||||||
|
|
||||||
|
bool GetStudLogo(lcMemFile& PrimFile, int StudLogo, bool OpenStud = false);
|
||||||
|
|
||||||
void SetOfficialPieces()
|
void SetOfficialPieces()
|
||||||
{
|
{
|
||||||
if (mZipFiles[LC_ZIPFILE_OFFICIAL])
|
if (mZipFiles[LC_ZIPFILE_OFFICIAL])
|
||||||
|
|
|
@ -98,6 +98,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
|
lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
|
||||||
lcProfileEntry("Settings", "PartsListAliases", 1), // LC_PROFILE_PARTS_LIST_ALIASES
|
lcProfileEntry("Settings", "PartsListAliases", 1), // LC_PROFILE_PARTS_LIST_ALIASES
|
||||||
lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
|
lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
|
||||||
|
lcProfileEntry("Settings", "StudLogo", 0), // LC_PROFILE_STUD_LOGO
|
||||||
|
|
||||||
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
||||||
lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
|
lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
|
||||||
|
|
|
@ -46,6 +46,7 @@ enum LC_PROFILE_KEY
|
||||||
LC_PROFILE_PARTS_LIST_DECORATED,
|
LC_PROFILE_PARTS_LIST_DECORATED,
|
||||||
LC_PROFILE_PARTS_LIST_ALIASES,
|
LC_PROFILE_PARTS_LIST_ALIASES,
|
||||||
LC_PROFILE_PARTS_LIST_LISTMODE,
|
LC_PROFILE_PARTS_LIST_LISTMODE,
|
||||||
|
LC_PROFILE_STUD_LOGO,
|
||||||
|
|
||||||
// Defaults for new projects.
|
// Defaults for new projects.
|
||||||
LC_PROFILE_DEFAULT_AUTHOR_NAME,
|
LC_PROFILE_DEFAULT_AUTHOR_NAME,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogOptions* Options)
|
lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogOptions* Options)
|
||||||
: QDialog(Parent), mOptions(Options), ui(new Ui::lcQPreferencesDialog)
|
: QDialog(Parent), mOptions(Options), ui(new Ui::lcQPreferencesDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
ui->povrayLabel->hide();
|
ui->povrayLabel->hide();
|
||||||
|
@ -77,6 +77,12 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->studLogo->setChecked(mOptions->StudLogo);
|
||||||
|
if (ui->studLogo->isChecked())
|
||||||
|
ui->studLogoCombo->setCurrentIndex(mOptions->StudLogo - 1);
|
||||||
|
else
|
||||||
|
ui->studLogoCombo->setCurrentIndex(mOptions->StudLogo);
|
||||||
|
|
||||||
if (!gSupportsShaderObjects)
|
if (!gSupportsShaderObjects)
|
||||||
ui->ShadingMode->removeItem(LC_SHADING_DEFAULT_LIGHTS);
|
ui->ShadingMode->removeItem(LC_SHADING_DEFAULT_LIGHTS);
|
||||||
ui->ShadingMode->setCurrentIndex(mOptions->Preferences.mShadingMode);
|
ui->ShadingMode->setCurrentIndex(mOptions->Preferences.mShadingMode);
|
||||||
|
@ -98,6 +104,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
||||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereHighlightColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereHighlightColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereHighlightColor)));
|
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereHighlightColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereHighlightColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereHighlightColor)));
|
||||||
ui->ViewSphereHighlightColorButton->setIcon(pix);
|
ui->ViewSphereHighlightColorButton->setIcon(pix);
|
||||||
|
|
||||||
|
on_studLogo_toggled();
|
||||||
on_antiAliasing_toggled();
|
on_antiAliasing_toggled();
|
||||||
on_edgeLines_toggled();
|
on_edgeLines_toggled();
|
||||||
on_gridStuds_toggled();
|
on_gridStuds_toggled();
|
||||||
|
@ -126,7 +133,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
||||||
|
|
||||||
lcQPreferencesDialog::~lcQPreferencesDialog()
|
lcQPreferencesDialog::~lcQPreferencesDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQPreferencesDialog::accept()
|
void lcQPreferencesDialog::accept()
|
||||||
|
@ -186,6 +193,11 @@ void lcQPreferencesDialog::accept()
|
||||||
|
|
||||||
mOptions->Preferences.mShadingMode = (lcShadingMode)ui->ShadingMode->currentIndex();
|
mOptions->Preferences.mShadingMode = (lcShadingMode)ui->ShadingMode->currentIndex();
|
||||||
|
|
||||||
|
if (ui->studLogoCombo->isEnabled())
|
||||||
|
mOptions->StudLogo = ui->studLogoCombo->currentIndex() + 1;
|
||||||
|
else
|
||||||
|
mOptions->StudLogo = 0;
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +309,11 @@ void lcQPreferencesDialog::ColorButtonClicked()
|
||||||
((QToolButton*)button)->setIcon(pix);
|
((QToolButton*)button)->setIcon(pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::on_studLogo_toggled()
|
||||||
|
{
|
||||||
|
ui->studLogoCombo->setEnabled(ui->studLogo->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void lcQPreferencesDialog::on_antiAliasing_toggled()
|
void lcQPreferencesDialog::on_antiAliasing_toggled()
|
||||||
{
|
{
|
||||||
ui->antiAliasingSamples->setEnabled(ui->antiAliasing->isChecked());
|
ui->antiAliasingSamples->setEnabled(ui->antiAliasing->isChecked());
|
||||||
|
@ -682,7 +699,7 @@ void lcQPreferencesDialog::on_KeyboardFilterEdit_textEdited(const QString& Text)
|
||||||
|
|
||||||
void lcQPreferencesDialog::on_shortcutAssign_clicked()
|
void lcQPreferencesDialog::on_shortcutAssign_clicked()
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *current = ui->commandList->currentItem();
|
QTreeWidgetItem *current = ui->commandList->currentItem();
|
||||||
|
|
||||||
if (!current || !current->data(0, Qt::UserRole).isValid())
|
if (!current || !current->data(0, Qt::UserRole).isValid())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,7 +10,7 @@ class lcQPreferencesDialog;
|
||||||
class lcQPreferencesDialog : public QDialog
|
class lcQPreferencesDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogOptions* Options);
|
lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogOptions* Options);
|
||||||
~lcQPreferencesDialog();
|
~lcQPreferencesDialog();
|
||||||
|
@ -55,6 +55,7 @@ public slots:
|
||||||
void on_mouseAssign_clicked();
|
void on_mouseAssign_clicked();
|
||||||
void on_mouseRemove_clicked();
|
void on_mouseRemove_clicked();
|
||||||
void on_mouseReset_clicked();
|
void on_mouseReset_clicked();
|
||||||
|
void on_studLogo_toggled();
|
||||||
void MouseTreeItemChanged(QTreeWidgetItem* Current);
|
void MouseTreeItemChanged(QTreeWidgetItem* Current);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabGeneral">
|
<widget class="QWidget" name="tabGeneral">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -225,13 +225,49 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="edgeLines">
|
<widget class="QCheckBox" name="axisIcon">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edge lines</string>
|
<string>Axis icon</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Shading Mode:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineWidth">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="ShadingMode">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wireframe</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Flat Shading</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Default Lights</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="antiAliasingSamples">
|
<widget class="QComboBox" name="antiAliasingSamples">
|
||||||
<item>
|
<item>
|
||||||
|
@ -251,23 +287,6 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineWidth">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>75</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QCheckBox" name="axisIcon">
|
|
||||||
<property name="text">
|
|
||||||
<string>Axis icon</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
<item row="0" column="3">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -281,6 +300,20 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>width</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="edgeLines">
|
||||||
|
<property name="text">
|
||||||
|
<string>Edge lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="antiAliasing">
|
<widget class="QCheckBox" name="antiAliasing">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -288,35 +321,38 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QCheckBox" name="studLogo">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>width</string>
|
<string>Stud Logo</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QComboBox" name="studLogoCombo">
|
||||||
<property name="text">
|
|
||||||
<string>Shading Mode:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1" colspan="2">
|
|
||||||
<widget class="QComboBox" name="ShadingMode">
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Wireframe</string>
|
<string>Logo1</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Flat Shading</string>
|
<string>Logo2</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Default Lights</string>
|
<string>Logo3</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Logo4</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Logo5</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Add table
Reference in a new issue