mirror of
https://github.com/leozide/leocad
synced 2025-01-28 19:58:12 +01:00
Allow custom color and minifig settings files. Fixes #359.
This commit is contained in:
parent
6b26b2597e
commit
5a3abf18e0
11 changed files with 366 additions and 257 deletions
|
@ -650,10 +650,12 @@ void lcApplication::ShowPreferencesDialog()
|
|||
|
||||
Options.Preferences = mPreferences;
|
||||
|
||||
Options.DefaultAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
||||
Options.LibraryPath = lcGetProfileString(LC_PROFILE_PARTS_LIBRARY);
|
||||
Options.MinifigSettingsPath = lcGetProfileString(LC_PROFILE_MINIFIG_SETTINGS);
|
||||
Options.ColorConfigPath = lcGetProfileString(LC_PROFILE_COLOR_CONFIG);
|
||||
Options.POVRayPath = lcGetProfileString(LC_PROFILE_POVRAY_PATH);
|
||||
Options.LGEOPath = lcGetProfileString(LC_PROFILE_POVRAY_LGEO_PATH);
|
||||
Options.DefaultAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
||||
Options.CheckForUpdates = lcGetProfileInt(LC_PROFILE_CHECK_UPDATES);
|
||||
|
||||
Options.AASamples = CurrentAASamples;
|
||||
|
@ -674,6 +676,7 @@ void lcApplication::ShowPreferencesDialog()
|
|||
return;
|
||||
|
||||
bool LibraryChanged = Options.LibraryPath != lcGetProfileString(LC_PROFILE_PARTS_LIBRARY);
|
||||
bool ColorsChanged = Options.ColorConfigPath != lcGetProfileString(LC_PROFILE_COLOR_CONFIG);
|
||||
bool AAChanged = CurrentAASamples != Options.AASamples;
|
||||
|
||||
mPreferences = Options.Preferences;
|
||||
|
@ -682,17 +685,15 @@ void lcApplication::ShowPreferencesDialog()
|
|||
|
||||
lcSetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME, Options.DefaultAuthor);
|
||||
lcSetProfileString(LC_PROFILE_PARTS_LIBRARY, Options.LibraryPath);
|
||||
lcSetProfileString(LC_PROFILE_COLOR_CONFIG, Options.ColorConfigPath);
|
||||
lcSetProfileString(LC_PROFILE_MINIFIG_SETTINGS, Options.MinifigSettingsPath);
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_PATH, Options.POVRayPath);
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, Options.LGEOPath);
|
||||
lcSetProfileInt(LC_PROFILE_CHECK_UPDATES, Options.CheckForUpdates);
|
||||
lcSetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES, Options.AASamples);
|
||||
|
||||
if (LibraryChanged && AAChanged)
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Parts library and Anti-aliasing changes will only take effect the next time you start LeoCAD."));
|
||||
else if (LibraryChanged)
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Parts library changes will only take effect the next time you start LeoCAD."));
|
||||
else if (AAChanged)
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Anti-aliasing changes will only take effect the next time you start LeoCAD."));
|
||||
if (LibraryChanged || ColorsChanged || AAChanged)
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Some changes will only take effect the next time you start LeoCAD."));
|
||||
|
||||
if (Options.CategoriesModified)
|
||||
{
|
||||
|
|
|
@ -20,10 +20,12 @@ struct lcPreferencesDialogOptions
|
|||
{
|
||||
lcPreferences Preferences;
|
||||
|
||||
QString DefaultAuthor;
|
||||
QString LibraryPath;
|
||||
QString ColorConfigPath;
|
||||
QString MinifigSettingsPath;
|
||||
QString POVRayPath;
|
||||
QString LGEOPath;
|
||||
QString DefaultAuthor;
|
||||
int CheckForUpdates;
|
||||
|
||||
int AASamples;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "lc_glextensions.h"
|
||||
#include "lc_synth.h"
|
||||
#include "project.h"
|
||||
#include "lc_profile.h"
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <zlib.h>
|
||||
|
@ -301,12 +302,24 @@ bool lcPiecesLibrary::Load(const QString& LibraryPath, bool ShowProgress)
|
|||
{
|
||||
Unload();
|
||||
|
||||
auto LoadCustomColors = []()
|
||||
{
|
||||
QString CustomColorsPath = lcGetProfileString(LC_PROFILE_COLOR_CONFIG);
|
||||
|
||||
if (CustomColorsPath.isEmpty())
|
||||
return false;
|
||||
|
||||
lcDiskFile ColorFile(CustomColorsPath);
|
||||
return ColorFile.Open(QIODevice::ReadOnly) && lcLoadColorFile(ColorFile);
|
||||
};
|
||||
|
||||
if (OpenArchive(LibraryPath, LC_ZIPFILE_OFFICIAL))
|
||||
{
|
||||
lcMemFile ColorFile;
|
||||
|
||||
if (!mZipFiles[LC_ZIPFILE_OFFICIAL]->ExtractFile("ldraw/ldconfig.ldr", ColorFile) || !lcLoadColorFile(ColorFile))
|
||||
lcLoadDefaultColors();
|
||||
if (!LoadCustomColors())
|
||||
if (!mZipFiles[LC_ZIPFILE_OFFICIAL]->ExtractFile("ldraw/ldconfig.ldr", ColorFile) || !lcLoadColorFile(ColorFile))
|
||||
lcLoadDefaultColors();
|
||||
|
||||
mLibraryDir = QFileInfo(LibraryPath).absoluteDir();
|
||||
QString UnofficialFileName = mLibraryDir.absoluteFilePath(QLatin1String("ldrawunf.zip"));
|
||||
|
@ -322,14 +335,17 @@ bool lcPiecesLibrary::Load(const QString& LibraryPath, bool ShowProgress)
|
|||
|
||||
if (OpenDirectory(mLibraryDir, ShowProgress))
|
||||
{
|
||||
lcDiskFile ColorFile(mLibraryDir.absoluteFilePath(QLatin1String("ldconfig.ldr")));
|
||||
|
||||
if (!ColorFile.Open(QIODevice::ReadOnly) || !lcLoadColorFile(ColorFile))
|
||||
if (!LoadCustomColors())
|
||||
{
|
||||
ColorFile.SetFileName(mLibraryDir.absoluteFilePath(QLatin1String("LDConfig.ldr")));
|
||||
lcDiskFile ColorFile(mLibraryDir.absoluteFilePath(QLatin1String("ldconfig.ldr")));
|
||||
|
||||
if (!ColorFile.Open(QIODevice::ReadOnly) || !lcLoadColorFile(ColorFile))
|
||||
lcLoadDefaultColors();
|
||||
{
|
||||
ColorFile.SetFileName(mLibraryDir.absoluteFilePath(QLatin1String("LDConfig.ldr")));
|
||||
|
||||
if (!ColorFile.Open(QIODevice::ReadOnly) || !lcLoadColorFile(ColorFile))
|
||||
lcLoadDefaultColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -238,7 +238,7 @@ void lcPartSelectionListModel::SetFilter(const QString& Filter)
|
|||
Visible = strcasestr(Description, mFilter) || strcasestr(Info->mFileName, mFilter);
|
||||
}
|
||||
|
||||
mListView->setRowHidden(PartIdx, !Visible);
|
||||
mListView->setRowHidden((int)PartIdx, !Visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ void lcPartSelectionListModel::PartLoaded(PieceInfo* Info)
|
|||
if (PreviewIt != mRequestedPreviews.end())
|
||||
{
|
||||
mRequestedPreviews.erase(PreviewIt);
|
||||
DrawPreview(PartIdx);
|
||||
DrawPreview((int)PartIdx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES
|
||||
lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH
|
||||
lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY
|
||||
lcProfileEntry("Settings", "MinifigSettings", ""), // LC_PROFILE_MINIFIG_SETTINGS
|
||||
lcProfileEntry("Settings", "ColorConfig", ""), // LC_PROFILE_COLOR_CONFIG
|
||||
lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_KEYBOARD_SHORTCUTS
|
||||
lcProfileEntry("Settings", "MouseShortcuts", QStringList()), // LC_PROFILE_MOUSE_SHORTCUTS
|
||||
lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES
|
||||
|
|
|
@ -23,6 +23,8 @@ enum LC_PROFILE_KEY
|
|||
LC_PROFILE_CHECK_UPDATES,
|
||||
LC_PROFILE_PROJECTS_PATH,
|
||||
LC_PROFILE_PARTS_LIBRARY,
|
||||
LC_PROFILE_MINIFIG_SETTINGS,
|
||||
LC_PROFILE_COLOR_CONFIG,
|
||||
LC_PROFILE_KEYBOARD_SHORTCUTS,
|
||||
LC_PROFILE_MOUSE_SHORTCUTS,
|
||||
LC_PROFILE_CATEGORIES,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "lc_context.h"
|
||||
#include "lc_scene.h"
|
||||
#include "lc_file.h"
|
||||
#include "lc_profile.h"
|
||||
|
||||
const char* MinifigWizard::mSectionNames[LC_MFW_NUMITEMS] =
|
||||
{
|
||||
|
@ -36,29 +37,7 @@ const char* MinifigWizard::mSectionNames[LC_MFW_NUMITEMS] =
|
|||
|
||||
MinifigWizard::MinifigWizard()
|
||||
{
|
||||
lcDiskFile DiskSettings(lcGetPiecesLibrary()->mLibraryDir.absoluteFilePath(QLatin1String("mlcad.ini")));
|
||||
|
||||
if (DiskSettings.Open(QIODevice::ReadOnly))
|
||||
ParseSettings(DiskSettings);
|
||||
else
|
||||
{
|
||||
QResource Resource(":/resources/minifig.ini");
|
||||
|
||||
if (Resource.isValid())
|
||||
{
|
||||
QByteArray Data;
|
||||
|
||||
if (Resource.isCompressed())
|
||||
Data = qUncompress(Resource.data(), Resource.size());
|
||||
else
|
||||
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
|
||||
|
||||
lcMemFile MemSettings;
|
||||
MemSettings.WriteBuffer(Data.constData(), Data.size());
|
||||
ParseSettings(MemSettings);
|
||||
}
|
||||
}
|
||||
|
||||
LoadSettings();
|
||||
LoadTemplates();
|
||||
|
||||
mRotateX = 75.0f;
|
||||
|
@ -79,6 +58,38 @@ MinifigWizard::~MinifigWizard()
|
|||
SaveTemplates();
|
||||
}
|
||||
|
||||
void MinifigWizard::LoadSettings()
|
||||
{
|
||||
QString CustomSettingsPath = lcGetProfileString(LC_PROFILE_MINIFIG_SETTINGS);
|
||||
|
||||
if (!CustomSettingsPath.isEmpty())
|
||||
{
|
||||
lcDiskFile DiskSettings(CustomSettingsPath);
|
||||
|
||||
if (DiskSettings.Open(QIODevice::ReadOnly))
|
||||
{
|
||||
ParseSettings(DiskSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QResource Resource(":/resources/minifig.ini");
|
||||
|
||||
if (Resource.isValid())
|
||||
{
|
||||
QByteArray Data;
|
||||
|
||||
if (Resource.isCompressed())
|
||||
Data = qUncompress(Resource.data(), Resource.size());
|
||||
else
|
||||
Data = QByteArray::fromRawData((const char*)Resource.data(), Resource.size());
|
||||
|
||||
lcMemFile MemSettings;
|
||||
MemSettings.WriteBuffer(Data.constData(), Data.size());
|
||||
ParseSettings(MemSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void MinifigWizard::OnInitialUpdate()
|
||||
{
|
||||
MakeCurrent();
|
||||
|
@ -604,7 +615,7 @@ int MinifigWizard::GetSelectionIndex(int Type) const
|
|||
|
||||
for (size_t Index = 0; Index < InfoArray.size(); Index++)
|
||||
if (InfoArray[Index].Info == mMinifig.Parts[Type])
|
||||
return Index;
|
||||
return (int)Index;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
bool mAutoZoom;
|
||||
|
||||
protected:
|
||||
void LoadSettings();
|
||||
void LoadTemplates();
|
||||
void SaveTemplates();
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
#include "lc_glextensions.h"
|
||||
#include "pieceinf.h"
|
||||
|
||||
lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQPreferencesDialog)
|
||||
lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogOptions* Options)
|
||||
: QDialog(Parent), mOptions(Options), ui(new Ui::lcQPreferencesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -35,34 +34,34 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
|||
connect(ui->commandList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(commandChanged(QTreeWidgetItem*)));
|
||||
connect(ui->mouseTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(MouseTreeItemChanged(QTreeWidgetItem*)));
|
||||
|
||||
options = (lcPreferencesDialogOptions*)data;
|
||||
ui->partsLibrary->setText(mOptions->LibraryPath);
|
||||
ui->ColorConfigEdit->setText(mOptions->ColorConfigPath);
|
||||
ui->MinifigSettingsEdit->setText(mOptions->MinifigSettingsPath);
|
||||
ui->povrayExecutable->setText(mOptions->POVRayPath);
|
||||
ui->lgeoPath->setText(mOptions->LGEOPath);
|
||||
ui->authorName->setText(mOptions->DefaultAuthor);
|
||||
ui->mouseSensitivity->setValue(mOptions->Preferences.mMouseSensitivity);
|
||||
ui->checkForUpdates->setCurrentIndex(mOptions->CheckForUpdates);
|
||||
ui->fixedDirectionKeys->setChecked(mOptions->Preferences.mFixedAxes);
|
||||
ui->autoLoadMostRecent->setChecked(mOptions->Preferences.mAutoLoadMostRecent);
|
||||
|
||||
ui->authorName->setText(options->DefaultAuthor);
|
||||
ui->partsLibrary->setText(options->LibraryPath);
|
||||
ui->povrayExecutable->setText(options->POVRayPath);
|
||||
ui->lgeoPath->setText(options->LGEOPath);
|
||||
ui->mouseSensitivity->setValue(options->Preferences.mMouseSensitivity);
|
||||
ui->checkForUpdates->setCurrentIndex(options->CheckForUpdates);
|
||||
ui->fixedDirectionKeys->setChecked(options->Preferences.mFixedAxes);
|
||||
ui->autoLoadMostRecent->setChecked(options->Preferences.mAutoLoadMostRecent);
|
||||
|
||||
ui->antiAliasing->setChecked(options->AASamples != 1);
|
||||
if (options->AASamples == 8)
|
||||
ui->antiAliasing->setChecked(mOptions->AASamples != 1);
|
||||
if (mOptions->AASamples == 8)
|
||||
ui->antiAliasingSamples->setCurrentIndex(2);
|
||||
else if (options->AASamples == 4)
|
||||
else if (mOptions->AASamples == 4)
|
||||
ui->antiAliasingSamples->setCurrentIndex(1);
|
||||
else
|
||||
ui->antiAliasingSamples->setCurrentIndex(0);
|
||||
ui->edgeLines->setChecked(options->Preferences.mDrawEdgeLines);
|
||||
ui->lineWidth->setText(lcFormatValueLocalized(options->Preferences.mLineWidth));
|
||||
ui->gridStuds->setChecked(options->Preferences.mDrawGridStuds);
|
||||
ui->gridLines->setChecked(options->Preferences.mDrawGridLines);
|
||||
ui->gridLineSpacing->setText(QString::number(options->Preferences.mGridLineSpacing));
|
||||
ui->axisIcon->setChecked(options->Preferences.mDrawAxes);
|
||||
ui->edgeLines->setChecked(mOptions->Preferences.mDrawEdgeLines);
|
||||
ui->lineWidth->setText(lcFormatValueLocalized(mOptions->Preferences.mLineWidth));
|
||||
ui->gridStuds->setChecked(mOptions->Preferences.mDrawGridStuds);
|
||||
ui->gridLines->setChecked(mOptions->Preferences.mDrawGridLines);
|
||||
ui->gridLineSpacing->setText(QString::number(mOptions->Preferences.mGridLineSpacing));
|
||||
ui->axisIcon->setChecked(mOptions->Preferences.mDrawAxes);
|
||||
|
||||
ui->ViewSphereLocationCombo->setCurrentIndex((int)options->Preferences.mViewSphereLocation);
|
||||
ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation);
|
||||
|
||||
switch (options->Preferences.mViewSphereSize)
|
||||
switch (mOptions->Preferences.mViewSphereSize)
|
||||
{
|
||||
case 200:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(3);
|
||||
|
@ -80,30 +79,30 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
|||
|
||||
if (!gSupportsShaderObjects)
|
||||
ui->ShadingMode->removeItem(LC_SHADING_DEFAULT_LIGHTS);
|
||||
ui->ShadingMode->setCurrentIndex(options->Preferences.mShadingMode);
|
||||
ui->ShadingMode->setCurrentIndex(mOptions->Preferences.mShadingMode);
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mGridStudColor), LC_RGBA_GREEN(options->Preferences.mGridStudColor), LC_RGBA_BLUE(options->Preferences.mGridStudColor)));
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mGridStudColor), LC_RGBA_GREEN(mOptions->Preferences.mGridStudColor), LC_RGBA_BLUE(mOptions->Preferences.mGridStudColor)));
|
||||
ui->gridStudColor->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mGridLineColor), LC_RGBA_GREEN(options->Preferences.mGridLineColor), LC_RGBA_BLUE(options->Preferences.mGridLineColor)));
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mGridLineColor), LC_RGBA_GREEN(mOptions->Preferences.mGridLineColor), LC_RGBA_BLUE(mOptions->Preferences.mGridLineColor)));
|
||||
ui->gridLineColor->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mViewSphereColor), LC_RGBA_GREEN(options->Preferences.mViewSphereColor), LC_RGBA_BLUE(options->Preferences.mViewSphereColor)));
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereColor)));
|
||||
ui->ViewSphereColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mViewSphereTextColor), LC_RGBA_GREEN(options->Preferences.mViewSphereTextColor), LC_RGBA_BLUE(options->Preferences.mViewSphereTextColor)));
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereTextColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereTextColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereTextColor)));
|
||||
ui->ViewSphereTextColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mViewSphereHighlightColor), LC_RGBA_GREEN(options->Preferences.mViewSphereHighlightColor), LC_RGBA_BLUE(options->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);
|
||||
|
||||
on_antiAliasing_toggled();
|
||||
on_edgeLines_toggled();
|
||||
on_gridStuds_toggled();
|
||||
on_gridLines_toggled();
|
||||
on_ViewSphereSizeCombo_currentIndexChanged((int)options->Preferences.mViewSphereLocation);
|
||||
on_ViewSphereSizeCombo_currentIndexChanged((int)mOptions->Preferences.mViewSphereLocation);
|
||||
|
||||
updateCategories();
|
||||
ui->categoriesTree->setCurrentItem(ui->categoriesTree->topLevelItem(0));
|
||||
|
@ -139,51 +138,53 @@ void lcQPreferencesDialog::accept()
|
|||
return;
|
||||
}
|
||||
|
||||
options->DefaultAuthor = ui->authorName->text();
|
||||
options->LibraryPath = ui->partsLibrary->text();
|
||||
options->POVRayPath = ui->povrayExecutable->text();
|
||||
options->LGEOPath = ui->lgeoPath->text();
|
||||
options->Preferences.mMouseSensitivity = ui->mouseSensitivity->value();
|
||||
options->CheckForUpdates = ui->checkForUpdates->currentIndex();
|
||||
options->Preferences.mFixedAxes = ui->fixedDirectionKeys->isChecked();
|
||||
options->Preferences.mAutoLoadMostRecent = ui->autoLoadMostRecent->isChecked();
|
||||
mOptions->LibraryPath = ui->partsLibrary->text();
|
||||
mOptions->MinifigSettingsPath = ui->MinifigSettingsEdit->text();
|
||||
mOptions->ColorConfigPath = ui->ColorConfigEdit->text();
|
||||
mOptions->POVRayPath = ui->povrayExecutable->text();
|
||||
mOptions->LGEOPath = ui->lgeoPath->text();
|
||||
mOptions->DefaultAuthor = ui->authorName->text();
|
||||
mOptions->Preferences.mMouseSensitivity = ui->mouseSensitivity->value();
|
||||
mOptions->CheckForUpdates = ui->checkForUpdates->currentIndex();
|
||||
mOptions->Preferences.mFixedAxes = ui->fixedDirectionKeys->isChecked();
|
||||
mOptions->Preferences.mAutoLoadMostRecent = ui->autoLoadMostRecent->isChecked();
|
||||
|
||||
if (!ui->antiAliasing->isChecked())
|
||||
options->AASamples = 1;
|
||||
mOptions->AASamples = 1;
|
||||
else if (ui->antiAliasingSamples->currentIndex() == 2)
|
||||
options->AASamples = 8;
|
||||
mOptions->AASamples = 8;
|
||||
else if (ui->antiAliasingSamples->currentIndex() == 1)
|
||||
options->AASamples = 4;
|
||||
mOptions->AASamples = 4;
|
||||
else
|
||||
options->AASamples = 2;
|
||||
mOptions->AASamples = 2;
|
||||
|
||||
options->Preferences.mDrawEdgeLines = ui->edgeLines->isChecked();
|
||||
options->Preferences.mLineWidth = lcParseValueLocalized(ui->lineWidth->text());
|
||||
mOptions->Preferences.mDrawEdgeLines = ui->edgeLines->isChecked();
|
||||
mOptions->Preferences.mLineWidth = lcParseValueLocalized(ui->lineWidth->text());
|
||||
|
||||
options->Preferences.mDrawGridStuds = ui->gridStuds->isChecked();
|
||||
options->Preferences.mDrawGridLines = ui->gridLines->isChecked();
|
||||
options->Preferences.mGridLineSpacing = gridLineSpacing;
|
||||
mOptions->Preferences.mDrawGridStuds = ui->gridStuds->isChecked();
|
||||
mOptions->Preferences.mDrawGridLines = ui->gridLines->isChecked();
|
||||
mOptions->Preferences.mGridLineSpacing = gridLineSpacing;
|
||||
|
||||
options->Preferences.mDrawAxes = ui->axisIcon->isChecked();
|
||||
options->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex();
|
||||
mOptions->Preferences.mDrawAxes = ui->axisIcon->isChecked();
|
||||
mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex();
|
||||
|
||||
switch (ui->ViewSphereSizeCombo->currentIndex())
|
||||
{
|
||||
case 3:
|
||||
options->Preferences.mViewSphereSize = 200;
|
||||
mOptions->Preferences.mViewSphereSize = 200;
|
||||
break;
|
||||
case 2:
|
||||
options->Preferences.mViewSphereSize = 100;
|
||||
mOptions->Preferences.mViewSphereSize = 100;
|
||||
break;
|
||||
case 1:
|
||||
options->Preferences.mViewSphereSize = 50;
|
||||
mOptions->Preferences.mViewSphereSize = 50;
|
||||
break;
|
||||
default:
|
||||
options->Preferences.mViewSphereSize = 0;
|
||||
mOptions->Preferences.mViewSphereSize = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
options->Preferences.mShadingMode = (lcShadingMode)ui->ShadingMode->currentIndex();
|
||||
mOptions->Preferences.mShadingMode = (lcShadingMode)ui->ShadingMode->currentIndex();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
@ -204,6 +205,22 @@ void lcQPreferencesDialog::on_partsArchiveBrowse_clicked()
|
|||
ui->partsLibrary->setText(QDir::toNativeSeparators(result));
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_ColorConfigBrowseButton_clicked()
|
||||
{
|
||||
QString Result = QFileDialog::getOpenFileName(this, tr("Select Color Configuration File"), ui->ColorConfigEdit->text(), tr("Settings Files (*.ldr);;All Files (*.*)"));
|
||||
|
||||
if (!Result.isEmpty())
|
||||
ui->ColorConfigEdit->setText(QDir::toNativeSeparators(Result));
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_MinifigSettingsBrowseButton_clicked()
|
||||
{
|
||||
QString Result = QFileDialog::getOpenFileName(this, tr("Select Minifig Settings File"), ui->MinifigSettingsEdit->text(), tr("Settings Files (*.ini);;All Files (*.*)"));
|
||||
|
||||
if (!Result.isEmpty())
|
||||
ui->MinifigSettingsEdit->setText(QDir::toNativeSeparators(Result));
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_povrayExecutableBrowse_clicked()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -212,7 +229,7 @@ void lcQPreferencesDialog::on_povrayExecutableBrowse_clicked()
|
|||
QString filter(tr("All Files (*.*)"));
|
||||
#endif
|
||||
|
||||
QString result = QFileDialog::getOpenFileName(this, tr("Open POV-Ray Executable"), ui->povrayExecutable->text(), filter);
|
||||
QString result = QFileDialog::getOpenFileName(this, tr("Select POV-Ray Executable"), ui->povrayExecutable->text(), filter);
|
||||
|
||||
if (!result.isEmpty())
|
||||
ui->povrayExecutable->setText(QDir::toNativeSeparators(result));
|
||||
|
@ -235,31 +252,31 @@ void lcQPreferencesDialog::ColorButtonClicked()
|
|||
|
||||
if (button == ui->gridStudColor)
|
||||
{
|
||||
color = &options->Preferences.mGridStudColor;
|
||||
color = &mOptions->Preferences.mGridStudColor;
|
||||
title = tr("Select Grid Stud Color");
|
||||
dialogOptions = QColorDialog::ShowAlphaChannel;
|
||||
}
|
||||
else if (button == ui->gridLineColor)
|
||||
{
|
||||
color = &options->Preferences.mGridLineColor;
|
||||
color = &mOptions->Preferences.mGridLineColor;
|
||||
title = tr("Select Grid Line Color");
|
||||
dialogOptions = 0;
|
||||
}
|
||||
else if (button == ui->ViewSphereColorButton)
|
||||
{
|
||||
color = &options->Preferences.mViewSphereColor;
|
||||
color = &mOptions->Preferences.mViewSphereColor;
|
||||
title = tr("Select View Sphere Color");
|
||||
dialogOptions = 0;
|
||||
}
|
||||
else if (button == ui->ViewSphereTextColorButton)
|
||||
{
|
||||
color = &options->Preferences.mViewSphereTextColor;
|
||||
color = &mOptions->Preferences.mViewSphereTextColor;
|
||||
title = tr("Select View Sphere Text Color");
|
||||
dialogOptions = 0;
|
||||
}
|
||||
else if (button == ui->ViewSphereHighlightColorButton)
|
||||
{
|
||||
color = &options->Preferences.mViewSphereHighlightColor;
|
||||
color = &mOptions->Preferences.mViewSphereHighlightColor;
|
||||
title = tr("Select View Sphere Highlight Color");
|
||||
dialogOptions = 0;
|
||||
}
|
||||
|
@ -318,9 +335,9 @@ void lcQPreferencesDialog::updateCategories()
|
|||
|
||||
tree->clear();
|
||||
|
||||
for (int categoryIndex = 0; categoryIndex < options->Categories.GetSize(); categoryIndex++)
|
||||
for (int categoryIndex = 0; categoryIndex < mOptions->Categories.GetSize(); categoryIndex++)
|
||||
{
|
||||
categoryItem = new QTreeWidgetItem(tree, QStringList(options->Categories[categoryIndex].Name));
|
||||
categoryItem = new QTreeWidgetItem(tree, QStringList(mOptions->Categories[categoryIndex].Name));
|
||||
categoryItem->setData(0, CategoryRole, QVariant(categoryIndex));
|
||||
}
|
||||
|
||||
|
@ -347,7 +364,7 @@ void lcQPreferencesDialog::updateParts()
|
|||
{
|
||||
lcArray<PieceInfo*> singleParts, groupedParts;
|
||||
|
||||
Library->GetCategoryEntries(options->Categories[categoryIndex].Keywords.constData(), false, singleParts, groupedParts);
|
||||
Library->GetCategoryEntries(mOptions->Categories[categoryIndex].Keywords.constData(), false, singleParts, groupedParts);
|
||||
|
||||
for (int partIndex = 0; partIndex < singleParts.GetSize(); partIndex++)
|
||||
{
|
||||
|
@ -365,13 +382,13 @@ void lcQPreferencesDialog::updateParts()
|
|||
{
|
||||
PieceInfo* Info = PartIt.second;
|
||||
|
||||
for (categoryIndex = 0; categoryIndex < options->Categories.GetSize(); categoryIndex++)
|
||||
for (categoryIndex = 0; categoryIndex < mOptions->Categories.GetSize(); categoryIndex++)
|
||||
{
|
||||
if (Library->PieceInCategory(Info, options->Categories[categoryIndex].Keywords.constData()))
|
||||
if (Library->PieceInCategory(Info, mOptions->Categories[categoryIndex].Keywords.constData()))
|
||||
break;
|
||||
}
|
||||
|
||||
if (categoryIndex == options->Categories.GetSize())
|
||||
if (categoryIndex == mOptions->Categories.GetSize())
|
||||
{
|
||||
QStringList rowList(Info->m_strDescription);
|
||||
rowList.append(Info->mFileName);
|
||||
|
@ -393,12 +410,12 @@ void lcQPreferencesDialog::on_newCategory_clicked()
|
|||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
options->CategoriesModified = true;
|
||||
options->CategoriesDefault = false;
|
||||
options->Categories.Add(category);
|
||||
mOptions->CategoriesModified = true;
|
||||
mOptions->CategoriesDefault = false;
|
||||
mOptions->Categories.Add(category);
|
||||
|
||||
updateCategories();
|
||||
ui->categoriesTree->setCurrentItem(ui->categoriesTree->topLevelItem(options->Categories.GetSize() - 1));
|
||||
ui->categoriesTree->setCurrentItem(ui->categoriesTree->topLevelItem(mOptions->Categories.GetSize() - 1));
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_editCategory_clicked()
|
||||
|
@ -414,12 +431,12 @@ void lcQPreferencesDialog::on_editCategory_clicked()
|
|||
if (categoryIndex == -1)
|
||||
return;
|
||||
|
||||
lcQCategoryDialog dialog(this, &options->Categories[categoryIndex]);
|
||||
lcQCategoryDialog dialog(this, &mOptions->Categories[categoryIndex]);
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
options->CategoriesModified = true;
|
||||
options->CategoriesDefault = false;
|
||||
mOptions->CategoriesModified = true;
|
||||
mOptions->CategoriesDefault = false;
|
||||
|
||||
updateCategories();
|
||||
ui->categoriesTree->setCurrentItem(ui->categoriesTree->topLevelItem(categoryIndex));
|
||||
|
@ -438,13 +455,13 @@ void lcQPreferencesDialog::on_deleteCategory_clicked()
|
|||
if (categoryIndex == -1)
|
||||
return;
|
||||
|
||||
QString question = tr("Are you sure you want to delete the category '%1'?").arg(options->Categories[categoryIndex].Name);
|
||||
QString question = tr("Are you sure you want to delete the category '%1'?").arg(mOptions->Categories[categoryIndex].Name);
|
||||
if (QMessageBox::question(this, "LeoCAD", question, QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
options->CategoriesModified = true;
|
||||
options->CategoriesDefault = false;
|
||||
options->Categories.RemoveIndex(categoryIndex);
|
||||
mOptions->CategoriesModified = true;
|
||||
mOptions->CategoriesDefault = false;
|
||||
mOptions->Categories.RemoveIndex(categoryIndex);
|
||||
|
||||
updateCategories();
|
||||
}
|
||||
|
@ -463,9 +480,9 @@ void lcQPreferencesDialog::on_importCategories_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
options->Categories = Categories;
|
||||
options->CategoriesModified = true;
|
||||
options->CategoriesDefault = false;
|
||||
mOptions->Categories = Categories;
|
||||
mOptions->CategoriesModified = true;
|
||||
mOptions->CategoriesDefault = false;
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_exportCategories_clicked()
|
||||
|
@ -475,7 +492,7 @@ void lcQPreferencesDialog::on_exportCategories_clicked()
|
|||
if (FileName.isEmpty())
|
||||
return;
|
||||
|
||||
if (!lcSaveCategories(FileName, options->Categories))
|
||||
if (!lcSaveCategories(FileName, mOptions->Categories))
|
||||
{
|
||||
QMessageBox::warning(this, "LeoCAD", tr("Error saving categories file."));
|
||||
return;
|
||||
|
@ -487,10 +504,10 @@ void lcQPreferencesDialog::on_resetCategories_clicked()
|
|||
if (QMessageBox::question(this, "LeoCAD", tr("Are you sure you want to load the default categories?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
lcResetCategories(options->Categories);
|
||||
lcResetCategories(mOptions->Categories);
|
||||
|
||||
options->CategoriesModified = true;
|
||||
options->CategoriesDefault = true;
|
||||
mOptions->CategoriesModified = true;
|
||||
mOptions->CategoriesDefault = true;
|
||||
|
||||
updateCategories();
|
||||
}
|
||||
|
@ -593,12 +610,12 @@ void lcQPreferencesDialog::updateCommandList()
|
|||
}
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
QKeySequence sequence(options->KeyboardShortcuts.mShortcuts[actionIdx]);
|
||||
QKeySequence sequence(mOptions->KeyboardShortcuts.mShortcuts[actionIdx]);
|
||||
item->setText(0, subId);
|
||||
item->setText(1, sequence.toString(QKeySequence::NativeText));
|
||||
item->setData(0, Qt::UserRole, qVariantFromValue(actionIdx));
|
||||
|
||||
if (options->KeyboardShortcuts.mShortcuts[actionIdx] != gCommands[actionIdx].DefaultShortcut)
|
||||
if (mOptions->KeyboardShortcuts.mShortcuts[actionIdx] != gCommands[actionIdx].DefaultShortcut)
|
||||
setShortcutModified(item, true);
|
||||
|
||||
sections[section]->addChild(item);
|
||||
|
@ -626,7 +643,7 @@ void lcQPreferencesDialog::commandChanged(QTreeWidgetItem *current)
|
|||
ui->shortcutGroup->setEnabled(true);
|
||||
|
||||
int shortcutIndex = qvariant_cast<int>(current->data(0, Qt::UserRole));
|
||||
QKeySequence key(options->KeyboardShortcuts.mShortcuts[shortcutIndex]);
|
||||
QKeySequence key(mOptions->KeyboardShortcuts.mShortcuts[shortcutIndex]);
|
||||
ui->shortcutEdit->setText(key.toString(QKeySequence::NativeText));
|
||||
}
|
||||
|
||||
|
@ -671,14 +688,14 @@ void lcQPreferencesDialog::on_shortcutAssign_clicked()
|
|||
return;
|
||||
|
||||
int shortcutIndex = qvariant_cast<int>(current->data(0, Qt::UserRole));
|
||||
options->KeyboardShortcuts.mShortcuts[shortcutIndex] = ui->shortcutEdit->text();
|
||||
mOptions->KeyboardShortcuts.mShortcuts[shortcutIndex] = ui->shortcutEdit->text();
|
||||
|
||||
current->setText(1, ui->shortcutEdit->text());
|
||||
|
||||
setShortcutModified(current, options->KeyboardShortcuts.mShortcuts[shortcutIndex] != gCommands[shortcutIndex].DefaultShortcut);
|
||||
setShortcutModified(current, mOptions->KeyboardShortcuts.mShortcuts[shortcutIndex] != gCommands[shortcutIndex].DefaultShortcut);
|
||||
|
||||
options->KeyboardShortcutsModified = true;
|
||||
options->KeyboardShortcutsDefault = false;
|
||||
mOptions->KeyboardShortcutsModified = true;
|
||||
mOptions->KeyboardShortcutsDefault = false;
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_shortcutRemove_clicked()
|
||||
|
@ -702,10 +719,10 @@ void lcQPreferencesDialog::on_shortcutsImport_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
options->KeyboardShortcuts = Shortcuts;
|
||||
mOptions->KeyboardShortcuts = Shortcuts;
|
||||
|
||||
options->KeyboardShortcutsModified = true;
|
||||
options->KeyboardShortcutsDefault = false;
|
||||
mOptions->KeyboardShortcutsModified = true;
|
||||
mOptions->KeyboardShortcutsDefault = false;
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_shortcutsExport_clicked()
|
||||
|
@ -715,7 +732,7 @@ void lcQPreferencesDialog::on_shortcutsExport_clicked()
|
|||
if (FileName.isEmpty())
|
||||
return;
|
||||
|
||||
if (!options->KeyboardShortcuts.Save(FileName))
|
||||
if (!mOptions->KeyboardShortcuts.Save(FileName))
|
||||
{
|
||||
QMessageBox::warning(this, "LeoCAD", tr("Error saving keyboard shortcuts file."));
|
||||
return;
|
||||
|
@ -727,11 +744,11 @@ void lcQPreferencesDialog::on_shortcutsReset_clicked()
|
|||
if (QMessageBox::question(this, "LeoCAD", tr("Are you sure you want to load the default keyboard shortcuts?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
options->KeyboardShortcuts.Reset();
|
||||
mOptions->KeyboardShortcuts.Reset();
|
||||
updateCommandList();
|
||||
|
||||
options->KeyboardShortcutsModified = true;
|
||||
options->KeyboardShortcutsDefault = true;
|
||||
mOptions->KeyboardShortcutsModified = true;
|
||||
mOptions->KeyboardShortcutsDefault = true;
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::UpdateMouseTree()
|
||||
|
@ -770,8 +787,8 @@ void lcQPreferencesDialog::UpdateMouseTreeItem(int ItemIndex)
|
|||
return Shortcut;
|
||||
};
|
||||
|
||||
QString Shortcut1 = GetShortcutText(options->MouseShortcuts.mShortcuts[ItemIndex].Button1, options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1);
|
||||
QString Shortcut2 = GetShortcutText(options->MouseShortcuts.mShortcuts[ItemIndex].Button2, options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2);
|
||||
QString Shortcut1 = GetShortcutText(mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button1, mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1);
|
||||
QString Shortcut2 = GetShortcutText(mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button2, mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2);
|
||||
|
||||
QTreeWidgetItem* Item = ui->mouseTree->topLevelItem(ItemIndex);
|
||||
|
||||
|
@ -828,36 +845,36 @@ void lcQPreferencesDialog::on_mouseAssign_clicked()
|
|||
if (ToolIdx == ButtonIndex)
|
||||
continue;
|
||||
|
||||
if (options->MouseShortcuts.mShortcuts[ToolIdx].Button2 == Button && options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2 == Modifiers)
|
||||
if (mOptions->MouseShortcuts.mShortcuts[ToolIdx].Button2 == Button && mOptions->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2 == Modifiers)
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Override Shortcut"), tr("This shortcut is already assigned to '%1', do you want to replace it?").arg(tr(gToolNames[ToolIdx])), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
return;
|
||||
|
||||
options->MouseShortcuts.mShortcuts[ToolIdx].Button2 = Qt::NoButton;
|
||||
options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2 = Qt::NoModifier;
|
||||
mOptions->MouseShortcuts.mShortcuts[ToolIdx].Button2 = Qt::NoButton;
|
||||
mOptions->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2 = Qt::NoModifier;
|
||||
}
|
||||
|
||||
if (options->MouseShortcuts.mShortcuts[ToolIdx].Button1 == Button && options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers1 == Modifiers)
|
||||
if (mOptions->MouseShortcuts.mShortcuts[ToolIdx].Button1 == Button && mOptions->MouseShortcuts.mShortcuts[ToolIdx].Modifiers1 == Modifiers)
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Override Shortcut"), tr("This shortcut is already assigned to '%1', do you want to replace it?").arg(tr(gToolNames[ToolIdx])), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
return;
|
||||
|
||||
options->MouseShortcuts.mShortcuts[ToolIdx].Button1 = options->MouseShortcuts.mShortcuts[ToolIdx].Button2;
|
||||
options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers1 = options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2;
|
||||
options->MouseShortcuts.mShortcuts[ToolIdx].Button2 = Qt::NoButton;
|
||||
options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2 = Qt::NoModifier;
|
||||
mOptions->MouseShortcuts.mShortcuts[ToolIdx].Button1 = mOptions->MouseShortcuts.mShortcuts[ToolIdx].Button2;
|
||||
mOptions->MouseShortcuts.mShortcuts[ToolIdx].Modifiers1 = mOptions->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2;
|
||||
mOptions->MouseShortcuts.mShortcuts[ToolIdx].Button2 = Qt::NoButton;
|
||||
mOptions->MouseShortcuts.mShortcuts[ToolIdx].Modifiers2 = Qt::NoModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ItemIndex = ui->mouseTree->indexOfTopLevelItem(Current);
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Button2 = options->MouseShortcuts.mShortcuts[ItemIndex].Button1;
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2 = options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1;
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Button1 = Button;
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1 = Modifiers;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button2 = mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button1;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2 = mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button1 = Button;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1 = Modifiers;
|
||||
|
||||
options->MouseShortcutsModified = true;
|
||||
options->MouseShortcutsDefault = false;
|
||||
mOptions->MouseShortcutsModified = true;
|
||||
mOptions->MouseShortcutsDefault = false;
|
||||
|
||||
UpdateMouseTreeItem(ItemIndex);
|
||||
}
|
||||
|
@ -870,13 +887,13 @@ void lcQPreferencesDialog::on_mouseRemove_clicked()
|
|||
return;
|
||||
|
||||
int ItemIndex = ui->mouseTree->indexOfTopLevelItem(Current);
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Button1 = options->MouseShortcuts.mShortcuts[ItemIndex].Button2;
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1 = options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2;
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Button2 = Qt::NoButton;
|
||||
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2 = Qt::NoModifier;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button1 = mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button2;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers1 = mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Button2 = Qt::NoButton;
|
||||
mOptions->MouseShortcuts.mShortcuts[ItemIndex].Modifiers2 = Qt::NoModifier;
|
||||
|
||||
options->MouseShortcutsModified = true;
|
||||
options->MouseShortcutsDefault = false;
|
||||
mOptions->MouseShortcutsModified = true;
|
||||
mOptions->MouseShortcutsDefault = false;
|
||||
|
||||
UpdateMouseTreeItem(ItemIndex);
|
||||
MouseTreeItemChanged(Current);
|
||||
|
@ -887,11 +904,11 @@ void lcQPreferencesDialog::on_mouseReset_clicked()
|
|||
if (QMessageBox::question(this, "LeoCAD", tr("Are you sure you want to load the default mouse shortcuts?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
options->MouseShortcuts.Reset();
|
||||
mOptions->MouseShortcuts.Reset();
|
||||
UpdateMouseTree();
|
||||
|
||||
options->MouseShortcutsModified = true;
|
||||
options->MouseShortcutsDefault = true;
|
||||
mOptions->MouseShortcutsModified = true;
|
||||
mOptions->MouseShortcutsDefault = true;
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::MouseTreeItemChanged(QTreeWidgetItem* Current)
|
||||
|
@ -906,7 +923,7 @@ void lcQPreferencesDialog::MouseTreeItemChanged(QTreeWidgetItem* Current)
|
|||
|
||||
int ToolIndex = ui->mouseTree->indexOfTopLevelItem(Current);
|
||||
|
||||
Qt::MouseButton Button = options->MouseShortcuts.mShortcuts[ToolIndex].Button1;
|
||||
Qt::MouseButton Button = mOptions->MouseShortcuts.mShortcuts[ToolIndex].Button1;
|
||||
|
||||
switch (Button)
|
||||
{
|
||||
|
@ -929,7 +946,7 @@ void lcQPreferencesDialog::MouseTreeItemChanged(QTreeWidgetItem* Current)
|
|||
break;
|
||||
}
|
||||
|
||||
Qt::KeyboardModifiers Modifiers = options->MouseShortcuts.mShortcuts[ToolIndex].Modifiers1;
|
||||
Qt::KeyboardModifiers Modifiers = mOptions->MouseShortcuts.mShortcuts[ToolIndex].Modifiers1;
|
||||
ui->mouseControl->setChecked((Modifiers & Qt::ControlModifier) != 0);
|
||||
ui->mouseShift->setChecked((Modifiers & Qt::ShiftModifier) != 0);
|
||||
ui->mouseAlt->setChecked((Modifiers & Qt::AltModifier) != 0);
|
||||
|
|
|
@ -12,10 +12,10 @@ class lcQPreferencesDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQPreferencesDialog(QWidget *parent, void *data);
|
||||
lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogOptions* Options);
|
||||
~lcQPreferencesDialog();
|
||||
|
||||
lcPreferencesDialogOptions *options;
|
||||
lcPreferencesDialogOptions* mOptions;
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -28,6 +28,8 @@ public slots:
|
|||
void accept();
|
||||
void on_partsLibraryBrowse_clicked();
|
||||
void on_partsArchiveBrowse_clicked();
|
||||
void on_ColorConfigBrowseButton_clicked();
|
||||
void on_MinifigSettingsBrowseButton_clicked();
|
||||
void on_povrayExecutableBrowse_clicked();
|
||||
void on_lgeoPathBrowse_clicked();
|
||||
void ColorButtonClicked();
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Default author name:</string>
|
||||
|
@ -47,91 +47,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="authorName"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Custom parts library:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>partsLibrary</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="partsLibrary"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="partsLibraryBrowse">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/resources/file_open.png</normaloff>:/resources/file_open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="partsArchiveBrowse">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/resources/archive.png</normaloff>:/resources/archive.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="povrayLabel">
|
||||
<property name="text">
|
||||
<string>PO&V-Ray Executable:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>povrayExecutable</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="povrayLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="povrayExecutable"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="povrayExecutableBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>&LGEO Path:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lgeoPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lgeoPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="lgeoPathBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Check for updates:</string>
|
||||
|
@ -141,7 +60,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="checkForUpdates">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -160,20 +79,152 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="fixedDirectionKeys">
|
||||
<property name="text">
|
||||
<string>Fixed direction keys</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="autoLoadMostRecent">
|
||||
<property name="text">
|
||||
<string>Open most recent file on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>Custom Paths</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Parts Library:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>partsLibrary</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="povrayLabel">
|
||||
<property name="text">
|
||||
<string>PO&V-Ray Executable:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>povrayExecutable</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>&LGEO Library:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lgeoPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lgeoPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="lgeoPathBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="partsLibrary"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="partsLibraryBrowse">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/resources/file_open.png</normaloff>:/resources/file_open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="partsArchiveBrowse">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/resources/archive.png</normaloff>:/resources/archive.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="povrayLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="povrayExecutable"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="povrayExecutableBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Color Configuration:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Minifig Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="ColorConfigLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ColorConfigEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="ColorConfigBrowseButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="MinifigSettingsLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="MinifigSettingsEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="MinifigSettingsBrowseButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabRendering">
|
||||
|
@ -1002,14 +1053,18 @@
|
|||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>authorName</tabstop>
|
||||
<tabstop>partsLibrary</tabstop>
|
||||
<tabstop>partsLibraryBrowse</tabstop>
|
||||
<tabstop>partsArchiveBrowse</tabstop>
|
||||
<tabstop>ColorConfigEdit</tabstop>
|
||||
<tabstop>ColorConfigBrowseButton</tabstop>
|
||||
<tabstop>MinifigSettingsEdit</tabstop>
|
||||
<tabstop>MinifigSettingsBrowseButton</tabstop>
|
||||
<tabstop>povrayExecutable</tabstop>
|
||||
<tabstop>povrayExecutableBrowse</tabstop>
|
||||
<tabstop>lgeoPath</tabstop>
|
||||
<tabstop>lgeoPathBrowse</tabstop>
|
||||
<tabstop>authorName</tabstop>
|
||||
<tabstop>checkForUpdates</tabstop>
|
||||
<tabstop>fixedDirectionKeys</tabstop>
|
||||
<tabstop>autoLoadMostRecent</tabstop>
|
||||
|
|
Loading…
Add table
Reference in a new issue