mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Clean up of some old dialog code.
This commit is contained in:
parent
21504371dd
commit
6d483252c5
21 changed files with 315 additions and 405 deletions
|
@ -11,27 +11,10 @@
|
|||
|
||||
enum LC_DIALOG_TYPE
|
||||
{
|
||||
LC_DIALOG_SAVE_IMAGE,
|
||||
LC_DIALOG_EXPORT_HTML,
|
||||
LC_DIALOG_EXPORT_POVRAY,
|
||||
LC_DIALOG_PROPERTIES,
|
||||
LC_DIALOG_FIND,
|
||||
LC_DIALOG_SELECT_BY_NAME,
|
||||
LC_DIALOG_MINIFIG,
|
||||
LC_DIALOG_PIECE_ARRAY,
|
||||
LC_DIALOG_EDIT_GROUPS,
|
||||
LC_DIALOG_PREFERENCES,
|
||||
LC_DIALOG_CHECK_UPDATES,
|
||||
LC_DIALOG_ABOUT
|
||||
};
|
||||
|
||||
struct lcImageDialogOptions
|
||||
{
|
||||
QString FileName;
|
||||
int Width;
|
||||
int Height;
|
||||
int Start;
|
||||
int End;
|
||||
LC_DIALOG_PREFERENCES
|
||||
};
|
||||
|
||||
struct lcHTMLDialogOptions
|
||||
|
@ -53,14 +36,6 @@ struct lcHTMLDialogOptions
|
|||
int PartImagesHeight;
|
||||
};
|
||||
|
||||
struct lcPOVRayDialogOptions
|
||||
{
|
||||
QString FileName;
|
||||
QString POVRayPath;
|
||||
QString LGEOPath;
|
||||
bool Render;
|
||||
};
|
||||
|
||||
struct lcPropertiesDialogOptions
|
||||
{
|
||||
lcModelProperties Properties;
|
||||
|
@ -69,26 +44,6 @@ struct lcPropertiesDialogOptions
|
|||
lcArray<lcPartsListEntry> PartsList;
|
||||
};
|
||||
|
||||
struct lcArrayDialogOptions
|
||||
{
|
||||
int Counts[3];
|
||||
lcVector3 Offsets[3];
|
||||
lcVector3 Rotations[3];
|
||||
};
|
||||
|
||||
struct lcEditGroupsDialogOptions
|
||||
{
|
||||
QMap<lcPiece*, lcGroup*> PieceParents;
|
||||
QMap<lcGroup*, lcGroup*> GroupParents;
|
||||
QList<lcGroup*> NewGroups;
|
||||
//QList<lcGroup*> DeletedGroups; // todo: support deleting groups in the edit groups dialog
|
||||
};
|
||||
|
||||
struct lcSelectDialogOptions
|
||||
{
|
||||
lcArray<lcObject*> Objects;
|
||||
};
|
||||
|
||||
struct lcPreferencesDialogOptions
|
||||
{
|
||||
lcPreferences Preferences;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "lc_qcolorlist.h"
|
||||
#include "lc_qpropertiestree.h"
|
||||
#include "lc_qutils.h"
|
||||
#include "lc_qupdatedialog.h"
|
||||
#include "lc_qaboutdialog.h"
|
||||
#include "lc_profile.h"
|
||||
#include "preview.h"
|
||||
#include "view.h"
|
||||
|
@ -1057,6 +1059,18 @@ void lcMainWindow::Print(QPrinter* Printer)
|
|||
Context->EndRenderToTexture();
|
||||
}
|
||||
|
||||
void lcMainWindow::ShowUpdatesDialog()
|
||||
{
|
||||
lcQUpdateDialog Dialog(this, false);
|
||||
Dialog.exec();
|
||||
}
|
||||
|
||||
void lcMainWindow::ShowAboutDialog()
|
||||
{
|
||||
lcQAboutDialog Dialog(this);
|
||||
Dialog.exec();
|
||||
}
|
||||
|
||||
void lcMainWindow::ShowPrintDialog()
|
||||
{
|
||||
lcModel* Model = lcGetActiveModel();
|
||||
|
@ -1075,41 +1089,21 @@ void lcMainWindow::ShowPrintDialog()
|
|||
}
|
||||
|
||||
// todo: call dialogs directly
|
||||
#include "lc_qimagedialog.h"
|
||||
#include "lc_qhtmldialog.h"
|
||||
#include "lc_qpovraydialog.h"
|
||||
#include "lc_qpropertiesdialog.h"
|
||||
#include "lc_qfinddialog.h"
|
||||
#include "lc_qselectdialog.h"
|
||||
#include "lc_qminifigdialog.h"
|
||||
#include "lc_qarraydialog.h"
|
||||
#include "lc_qeditgroupsdialog.h"
|
||||
#include "lc_qpreferencesdialog.h"
|
||||
#include "lc_qupdatedialog.h"
|
||||
#include "lc_qaboutdialog.h"
|
||||
|
||||
bool lcMainWindow::DoDialog(LC_DIALOG_TYPE Type, void* Data)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case LC_DIALOG_SAVE_IMAGE:
|
||||
{
|
||||
lcQImageDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_EXPORT_HTML:
|
||||
{
|
||||
lcQHTMLDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_EXPORT_POVRAY:
|
||||
{
|
||||
lcQPOVRayDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_PROPERTIES:
|
||||
{
|
||||
lcQPropertiesDialog Dialog(this, Data);
|
||||
|
@ -1122,47 +1116,11 @@ bool lcMainWindow::DoDialog(LC_DIALOG_TYPE Type, void* Data)
|
|||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_SELECT_BY_NAME:
|
||||
{
|
||||
lcQSelectDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_MINIFIG:
|
||||
{
|
||||
lcQMinifigDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_PIECE_ARRAY:
|
||||
{
|
||||
lcQArrayDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_EDIT_GROUPS:
|
||||
{
|
||||
lcQEditGroupsDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_PREFERENCES:
|
||||
{
|
||||
lcQPreferencesDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_ABOUT:
|
||||
{
|
||||
lcQAboutDialog Dialog(this);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_CHECK_UPDATES:
|
||||
{
|
||||
lcQUpdateDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -2482,11 +2440,12 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
break;
|
||||
|
||||
case LC_HELP_UPDATES:
|
||||
DoDialog(LC_DIALOG_CHECK_UPDATES, NULL);
|
||||
ShowUpdatesDialog();
|
||||
break;
|
||||
|
||||
case LC_HELP_ABOUT:
|
||||
DoDialog(LC_DIALOG_ABOUT, NULL);
|
||||
ShowAboutDialog();
|
||||
break;
|
||||
|
||||
case LC_VIEW_TIME_ADD_KEYS:
|
||||
SetAddKeys(!GetAddKeys());
|
||||
|
|
|
@ -282,6 +282,8 @@ protected:
|
|||
void CreateToolBars();
|
||||
void CreateStatusBar();
|
||||
void SplitView(Qt::Orientation Orientation);
|
||||
void ShowUpdatesDialog();
|
||||
void ShowAboutDialog();
|
||||
void ShowPrintDialog();
|
||||
|
||||
lcModelTabWidget* GetTabWidgetForModel(lcModel* Model) const
|
||||
|
|
|
@ -15,7 +15,11 @@
|
|||
#include "view.h"
|
||||
#include "preview.h"
|
||||
#include "minifig.h"
|
||||
#include "lc_qarraydialog.h"
|
||||
#include "lc_qselectdialog.h"
|
||||
#include "lc_qminifigdialog.h"
|
||||
#include "lc_qgroupdialog.h"
|
||||
#include "lc_qeditgroupsdialog.h"
|
||||
#include "lc_qutils.h"
|
||||
|
||||
void lcModelProperties::LoadDefaults()
|
||||
|
@ -1618,29 +1622,32 @@ void lcModel::RemoveFocusPieceFromGroup()
|
|||
|
||||
void lcModel::ShowEditGroupsDialog()
|
||||
{
|
||||
lcEditGroupsDialogOptions Options;
|
||||
QMap<lcPiece*, lcGroup*> PieceParents;
|
||||
QMap<lcGroup*, lcGroup*> GroupParents;
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
Options.PieceParents[Piece] = Piece->GetGroup();
|
||||
PieceParents[Piece] = Piece->GetGroup();
|
||||
}
|
||||
|
||||
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||
{
|
||||
lcGroup* Group = mGroups[GroupIdx];
|
||||
Options.GroupParents[Group] = Group->mGroup;
|
||||
GroupParents[Group] = Group->mGroup;
|
||||
}
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_EDIT_GROUPS, &Options))
|
||||
lcQEditGroupsDialog Dialog(gMainWindow, PieceParents, GroupParents);
|
||||
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
bool Modified = Options.NewGroups.isEmpty();
|
||||
bool Modified = Dialog.mNewGroups.isEmpty();
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
lcGroup* ParentGroup = Options.PieceParents.value(Piece);
|
||||
lcGroup* ParentGroup = Dialog.mPieceParents.value(Piece);
|
||||
|
||||
if (ParentGroup != Piece->GetGroup())
|
||||
{
|
||||
|
@ -1652,7 +1659,7 @@ void lcModel::ShowEditGroupsDialog()
|
|||
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||
{
|
||||
lcGroup* Group = mGroups[GroupIdx];
|
||||
lcGroup* ParentGroup = Options.GroupParents.value(Group);
|
||||
lcGroup* ParentGroup = Dialog.mGroupParents.value(Group);
|
||||
|
||||
if (ParentGroup != Group->mGroup)
|
||||
{
|
||||
|
@ -3794,11 +3801,12 @@ void lcModel::ShowSelectByNameDialog()
|
|||
return;
|
||||
}
|
||||
|
||||
lcSelectDialogOptions Options;
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_SELECT_BY_NAME, &Options))
|
||||
lcQSelectDialog Dialog(gMainWindow);
|
||||
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
SetSelectionAndFocus(Options.Objects, NULL, 0);
|
||||
SetSelectionAndFocus(Dialog.mObjects, NULL, 0);
|
||||
}
|
||||
|
||||
void lcModel::ShowArrayDialog()
|
||||
|
@ -3811,17 +3819,12 @@ void lcModel::ShowArrayDialog()
|
|||
return;
|
||||
}
|
||||
|
||||
lcArrayDialogOptions Options;
|
||||
lcQArrayDialog Dialog(gMainWindow);
|
||||
|
||||
memset(&Options, 0, sizeof(Options));
|
||||
Options.Counts[0] = 10;
|
||||
Options.Counts[1] = 1;
|
||||
Options.Counts[2] = 1;
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_PIECE_ARRAY, &Options))
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
if (Options.Counts[0] * Options.Counts[1] * Options.Counts[2] < 2)
|
||||
if (Dialog.mCounts[0] * Dialog.mCounts[1] * Dialog.mCounts[2] < 2)
|
||||
{
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Array only has 1 element or less, no pieces added."));
|
||||
return;
|
||||
|
@ -3829,17 +3832,17 @@ void lcModel::ShowArrayDialog()
|
|||
|
||||
lcArray<lcObject*> NewPieces;
|
||||
|
||||
for (int Step1 = 0; Step1 < Options.Counts[0]; Step1++)
|
||||
for (int Step1 = 0; Step1 < Dialog.mCounts[0]; Step1++)
|
||||
{
|
||||
for (int Step2 = 0; Step2 < Options.Counts[1]; Step2++)
|
||||
for (int Step2 = 0; Step2 < Dialog.mCounts[1]; Step2++)
|
||||
{
|
||||
for (int Step3 = (Step1 == 0 && Step2 == 0) ? 1 : 0; Step3 < Options.Counts[2]; Step3++)
|
||||
for (int Step3 = (Step1 == 0 && Step2 == 0) ? 1 : 0; Step3 < Dialog.mCounts[2]; Step3++)
|
||||
{
|
||||
lcMatrix44 ModelWorld;
|
||||
lcVector3 Position;
|
||||
|
||||
lcVector3 RotationAngles = Options.Rotations[0] * Step1 + Options.Rotations[1] * Step2 + Options.Rotations[2] * Step3;
|
||||
lcVector3 Offset = Options.Offsets[0] * Step1 + Options.Offsets[1] * Step2 + Options.Offsets[2] * Step3;
|
||||
lcVector3 RotationAngles = Dialog.mRotations[0] * Step1 + Dialog.mRotations[1] * Step2 + Dialog.mRotations[2] * Step3;
|
||||
lcVector3 Offset = Dialog.mOffsets[0] * Step1 + Dialog.mOffsets[1] * Step2 + Dialog.mOffsets[2] * Step3;
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
|
@ -3883,15 +3886,16 @@ void lcModel::ShowArrayDialog()
|
|||
|
||||
void lcModel::ShowMinifigDialog()
|
||||
{
|
||||
lcMinifig Minifig;
|
||||
lcQMinifigDialog Dialog(gMainWindow);
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_MINIFIG, &Minifig))
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
|
||||
lcGroup* Group = AddGroup(tr("Minifig #"), NULL);
|
||||
lcArray<lcObject*> Pieces(LC_MFW_NUMITEMS);
|
||||
lcMinifig& Minifig = Dialog.mMinifigWidget->mMinifig;
|
||||
|
||||
for (int PartIdx = 0; PartIdx < LC_MFW_NUMITEMS; PartIdx++)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "lc_context.h"
|
||||
#include "lc_file.h"
|
||||
|
||||
MinifigWizard::MinifigWizard(lcMinifig* Minifig)
|
||||
MinifigWizard::MinifigWizard()
|
||||
{
|
||||
char Filename[LC_MAXPATH];
|
||||
strcpy(Filename, lcGetPiecesLibrary()->mLibraryPath);
|
||||
|
@ -42,13 +42,11 @@ MinifigWizard::MinifigWizard(lcMinifig* Minifig)
|
|||
}
|
||||
}
|
||||
|
||||
mMinifig = Minifig;
|
||||
|
||||
m_RotateX = 75.0f;
|
||||
m_RotateZ = 180.0f;
|
||||
m_Distance = 10.0f;
|
||||
m_AutoZoom = true;
|
||||
m_Tracking = LC_TRACK_NONE;
|
||||
mRotateX = 75.0f;
|
||||
mRotateZ = 180.0f;
|
||||
mDistance = 10.0f;
|
||||
mAutoZoom = true;
|
||||
mTracking = LC_TRACK_NONE;
|
||||
}
|
||||
|
||||
void MinifigWizard::OnInitialUpdate()
|
||||
|
@ -56,19 +54,19 @@ void MinifigWizard::OnInitialUpdate()
|
|||
MakeCurrent();
|
||||
mContext->SetDefaultState();
|
||||
|
||||
memset(mMinifig, 0, sizeof(lcMinifig));
|
||||
memset(&mMinifig, 0, sizeof(lcMinifig));
|
||||
|
||||
const int ColorCodes[LC_MFW_NUMITEMS] = { 4, 7, 14, 7, 1, 0, 7, 4, 4, 14, 14, 7, 7, 0, 0, 7, 7 };
|
||||
const char* Pieces[LC_MFW_NUMITEMS] = { "3624", "None", "3626BP01", "None", "973", "3815", "None", "3819", "3818", "3820", "3820", "None", "None", "3817", "3816", "None", "None" };
|
||||
|
||||
for (int i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
{
|
||||
mMinifig->Colors[i] = lcGetColorIndex(ColorCodes[i]);
|
||||
mMinifig.Colors[i] = lcGetColorIndex(ColorCodes[i]);
|
||||
|
||||
PieceInfo* Info = lcGetPiecesLibrary()->FindPiece(Pieces[i], NULL, false);
|
||||
if (Info)
|
||||
{
|
||||
mMinifig->Parts[i] = Info;
|
||||
mMinifig.Parts[i] = Info;
|
||||
Info->AddRef();
|
||||
}
|
||||
}
|
||||
|
@ -79,8 +77,8 @@ void MinifigWizard::OnInitialUpdate()
|
|||
MinifigWizard::~MinifigWizard()
|
||||
{
|
||||
for (int i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
if (mMinifig->Parts[i])
|
||||
mMinifig->Parts[i]->Release(true);
|
||||
if (mMinifig.Parts[i])
|
||||
mMinifig.Parts[i]->Release(true);
|
||||
}
|
||||
|
||||
void MinifigWizard::ParseSettings(lcFile& Settings)
|
||||
|
@ -227,7 +225,7 @@ void MinifigWizard::OnDraw()
|
|||
|
||||
for (int InfoIdx = 0; InfoIdx < LC_MFW_NUMITEMS; InfoIdx++)
|
||||
{
|
||||
PieceInfo* Info = mMinifig->Parts[InfoIdx];
|
||||
PieceInfo* Info = mMinifig.Parts[InfoIdx];
|
||||
|
||||
if (!Info)
|
||||
continue;
|
||||
|
@ -237,7 +235,7 @@ void MinifigWizard::OnDraw()
|
|||
|
||||
for (int PointIdx = 0; PointIdx < 8; PointIdx++)
|
||||
{
|
||||
lcVector3 Point = lcMul31(Points[PointIdx], mMinifig->Matrices[InfoIdx]);
|
||||
lcVector3 Point = lcMul31(Points[PointIdx], mMinifig.Matrices[InfoIdx]);
|
||||
|
||||
Min = lcMin(Point, Min);
|
||||
Max = lcMax(Point, Max);
|
||||
|
@ -248,15 +246,15 @@ void MinifigWizard::OnDraw()
|
|||
|
||||
lcVector3 Eye(0.0f, 0.0f, 1.0f);
|
||||
|
||||
Eye = lcMul30(Eye, lcMatrix44RotationX(-m_RotateX * LC_DTOR));
|
||||
Eye = lcMul30(Eye, lcMatrix44RotationZ(-m_RotateZ * LC_DTOR));
|
||||
Eye = lcMul30(Eye, lcMatrix44RotationX(-mRotateX * LC_DTOR));
|
||||
Eye = lcMul30(Eye, lcMatrix44RotationZ(-mRotateZ * LC_DTOR));
|
||||
|
||||
lcMatrix44 Projection = lcMatrix44Perspective(30.0f, Aspect, 1.0f, 2500.0f);
|
||||
mContext->SetProjectionMatrix(Projection);
|
||||
|
||||
lcMatrix44 ViewMatrix;
|
||||
|
||||
if (m_AutoZoom)
|
||||
if (mAutoZoom)
|
||||
{
|
||||
lcVector3 Points[8];
|
||||
lcGetBoxCorners(Min, Max, Points);
|
||||
|
@ -270,11 +268,11 @@ void MinifigWizard::OnDraw()
|
|||
|
||||
// Update the new camera distance.
|
||||
lcVector3 d = Eye - Center;
|
||||
m_Distance = d.Length();
|
||||
mDistance = d.Length();
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewMatrix = lcMatrix44LookAt(Eye * m_Distance, Center, lcVector3(0, 0, 1));
|
||||
ViewMatrix = lcMatrix44LookAt(Eye * mDistance, Center, lcVector3(0, 0, 1));
|
||||
}
|
||||
|
||||
mContext->SetViewMatrix(ViewMatrix);
|
||||
|
@ -285,8 +283,8 @@ void MinifigWizard::OnDraw()
|
|||
Scene.Begin(ViewMatrix);
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < LC_MFW_NUMITEMS; PieceIdx++)
|
||||
if (mMinifig->Parts[PieceIdx])
|
||||
mMinifig->Parts[PieceIdx]->AddRenderMeshes(Scene, mMinifig->Matrices[PieceIdx], mMinifig->Colors[PieceIdx], false, false);
|
||||
if (mMinifig.Parts[PieceIdx])
|
||||
mMinifig.Parts[PieceIdx]->AddRenderMeshes(Scene, mMinifig.Matrices[PieceIdx], mMinifig.Colors[PieceIdx], false, false);
|
||||
|
||||
Scene.End();
|
||||
|
||||
|
@ -299,71 +297,71 @@ void MinifigWizard::OnDraw()
|
|||
|
||||
void MinifigWizard::OnLeftButtonDown()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_NONE)
|
||||
if (mTracking == LC_TRACK_NONE)
|
||||
{
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
m_Tracking = LC_TRACK_LEFT;
|
||||
mDownX = mInputState.x;
|
||||
mDownY = mInputState.y;
|
||||
mTracking = LC_TRACK_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
void MinifigWizard::OnLeftButtonUp()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_LEFT)
|
||||
m_Tracking = LC_TRACK_NONE;
|
||||
if (mTracking == LC_TRACK_LEFT)
|
||||
mTracking = LC_TRACK_NONE;
|
||||
}
|
||||
|
||||
void MinifigWizard::OnLeftButtonDoubleClick()
|
||||
{
|
||||
m_AutoZoom = true;
|
||||
mAutoZoom = true;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void MinifigWizard::OnRightButtonDown()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_NONE)
|
||||
if (mTracking == LC_TRACK_NONE)
|
||||
{
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
m_Tracking = LC_TRACK_RIGHT;
|
||||
mDownX = mInputState.x;
|
||||
mDownY = mInputState.y;
|
||||
mTracking = LC_TRACK_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
void MinifigWizard::OnRightButtonUp()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_RIGHT)
|
||||
m_Tracking = LC_TRACK_NONE;
|
||||
if (mTracking == LC_TRACK_RIGHT)
|
||||
mTracking = LC_TRACK_NONE;
|
||||
}
|
||||
|
||||
void MinifigWizard::OnMouseMove()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_LEFT)
|
||||
if (mTracking == LC_TRACK_LEFT)
|
||||
{
|
||||
// Rotate.
|
||||
m_RotateZ += mInputState.x - m_DownX;
|
||||
m_RotateX += mInputState.y - m_DownY;
|
||||
mRotateZ += mInputState.x - mDownX;
|
||||
mRotateX += mInputState.y - mDownY;
|
||||
|
||||
if (m_RotateX > 179.5f)
|
||||
m_RotateX = 179.5f;
|
||||
else if (m_RotateX < 0.5f)
|
||||
m_RotateX = 0.5f;
|
||||
if (mRotateX > 179.5f)
|
||||
mRotateX = 179.5f;
|
||||
else if (mRotateX < 0.5f)
|
||||
mRotateX = 0.5f;
|
||||
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
mDownX = mInputState.x;
|
||||
mDownY = mInputState.y;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
else if (m_Tracking == LC_TRACK_RIGHT)
|
||||
else if (mTracking == LC_TRACK_RIGHT)
|
||||
{
|
||||
// Zoom.
|
||||
m_Distance += (float)(m_DownY - mInputState.y) * 0.2f;
|
||||
m_AutoZoom = false;
|
||||
mDistance += (float)(mDownY - mInputState.y) * 0.2f;
|
||||
mAutoZoom = false;
|
||||
|
||||
if (m_Distance < 0.5f)
|
||||
m_Distance = 0.5f;
|
||||
if (mDistance < 0.5f)
|
||||
mDistance = 0.5f;
|
||||
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
mDownX = mInputState.x;
|
||||
mDownY = mInputState.y;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
@ -374,9 +372,9 @@ void MinifigWizard::Calculate()
|
|||
float HeadOffset = 0.0f;
|
||||
lcMatrix44 Root, Mat, Mat2;
|
||||
|
||||
PieceInfo** Parts = mMinifig->Parts;
|
||||
float* Angles = mMinifig->Angles;
|
||||
lcMatrix44* Matrices = mMinifig->Matrices;
|
||||
PieceInfo** Parts = mMinifig.Parts;
|
||||
float* Angles = mMinifig.Angles;
|
||||
lcMatrix44* Matrices = mMinifig.Matrices;
|
||||
|
||||
bool DroidTorso = Parts[LC_MFW_BODY] && !strcmp(Parts[LC_MFW_BODY]->m_strName, "30375");
|
||||
bool SkeletonTorso = Parts[LC_MFW_BODY] && !strcmp(Parts[LC_MFW_BODY]->m_strName, "6260");
|
||||
|
@ -541,7 +539,7 @@ int MinifigWizard::GetSelectionIndex(int Type) const
|
|||
const lcArray<lcMinifigPieceInfo>& InfoArray = mSettings[Type];
|
||||
|
||||
for (int Index = 0; Index < InfoArray.GetSize(); Index++)
|
||||
if (InfoArray[Index].Info == mMinifig->Parts[Type])
|
||||
if (InfoArray[Index].Info == mMinifig.Parts[Type])
|
||||
return Index;
|
||||
|
||||
return 0;
|
||||
|
@ -551,23 +549,23 @@ void MinifigWizard::SetSelectionIndex(int Type, int Index)
|
|||
{
|
||||
MakeCurrent();
|
||||
|
||||
if (mMinifig->Parts[Type])
|
||||
mMinifig->Parts[Type]->Release(true);
|
||||
if (mMinifig.Parts[Type])
|
||||
mMinifig.Parts[Type]->Release(true);
|
||||
|
||||
mMinifig->Parts[Type] = mSettings[Type][Index].Info;
|
||||
mMinifig.Parts[Type] = mSettings[Type][Index].Info;
|
||||
|
||||
if (mMinifig->Parts[Type])
|
||||
mMinifig->Parts[Type]->AddRef();
|
||||
if (mMinifig.Parts[Type])
|
||||
mMinifig.Parts[Type]->AddRef();
|
||||
|
||||
Calculate();
|
||||
}
|
||||
|
||||
void MinifigWizard::SetColor(int Type, int Color)
|
||||
{
|
||||
mMinifig->Colors[Type] = Color;
|
||||
mMinifig.Colors[Type] = Color;
|
||||
}
|
||||
|
||||
void MinifigWizard::SetAngle(int Type, float Angle)
|
||||
{
|
||||
mMinifig->Angles[Type] = Angle;
|
||||
mMinifig.Angles[Type] = Angle;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#include "lc_math.h"
|
||||
#include "lc_array.h"
|
||||
|
||||
class PieceInfo;
|
||||
|
||||
enum LC_MFW_TYPES
|
||||
{
|
||||
LC_MFW_HATS,
|
||||
|
@ -47,10 +45,10 @@ struct lcMinifig
|
|||
class MinifigWizard : public lcGLWidget
|
||||
{
|
||||
public:
|
||||
MinifigWizard(lcMinifig* Minifig);
|
||||
~MinifigWizard ();
|
||||
MinifigWizard();
|
||||
~MinifigWizard();
|
||||
|
||||
void OnDraw ();
|
||||
void OnDraw();
|
||||
void OnLeftButtonDown();
|
||||
void OnLeftButtonUp();
|
||||
void OnLeftButtonDoubleClick();
|
||||
|
@ -69,16 +67,16 @@ public:
|
|||
|
||||
lcArray<lcMinifigPieceInfo> mSettings[LC_MFW_NUMITEMS];
|
||||
|
||||
lcMinifig* mMinifig;
|
||||
lcMinifig mMinifig;
|
||||
|
||||
int m_Tracking;
|
||||
int m_DownX;
|
||||
int m_DownY;
|
||||
int mTracking;
|
||||
int mDownX;
|
||||
int mDownY;
|
||||
|
||||
float m_Distance;
|
||||
float m_RotateX;
|
||||
float m_RotateZ;
|
||||
bool m_AutoZoom;
|
||||
float mDistance;
|
||||
float mRotateX;
|
||||
float mRotateZ;
|
||||
bool mAutoZoom;
|
||||
};
|
||||
|
||||
#endif // _MINIFIG_H_
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include "lc_profile.h"
|
||||
#include "lc_file.h"
|
||||
#include "preview.h"
|
||||
#include "lc_qimagedialog.h"
|
||||
#include "lc_qmodellistdialog.h"
|
||||
#include "lc_qpovraydialog.h"
|
||||
|
||||
Project::Project()
|
||||
{
|
||||
|
@ -1364,24 +1366,16 @@ void Project::ExportPOVRay()
|
|||
return;
|
||||
}
|
||||
|
||||
lcPOVRayDialogOptions Options;
|
||||
lcQPOVRayDialog Dialog(gMainWindow);
|
||||
|
||||
Options.POVRayPath = lcGetProfileString(LC_PROFILE_POVRAY_PATH);
|
||||
Options.LGEOPath = lcGetProfileString(LC_PROFILE_POVRAY_LGEO_PATH);
|
||||
Options.Render = lcGetProfileInt(LC_PROFILE_POVRAY_RENDER);
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_EXPORT_POVRAY, &Options))
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_PATH, Options.POVRayPath);
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, Options.LGEOPath);
|
||||
lcSetProfileInt(LC_PROFILE_POVRAY_RENDER, Options.Render);
|
||||
|
||||
lcDiskFile POVFile;
|
||||
|
||||
if (!POVFile.Open(Options.FileName, "wt"))
|
||||
if (!POVFile.Open(Dialog.mFileName, "wt"))
|
||||
{
|
||||
QMessageBox::warning(gMainWindow, tr("LeoCAD"), tr("Could not open file '%1' for writing.").arg(Options.FileName));
|
||||
QMessageBox::warning(gMainWindow, tr("LeoCAD"), tr("Could not open file '%1' for writing.").arg(Dialog.mFileName));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1415,15 +1409,15 @@ void Project::ExportPOVRay()
|
|||
LGEO_COLOR_GLITTER = 0x40
|
||||
};
|
||||
|
||||
if (!Options.LGEOPath.isEmpty())
|
||||
if (!Dialog.mLGEOPath.isEmpty())
|
||||
{
|
||||
lcDiskFile TableFile, ColorFile;
|
||||
|
||||
if (!TableFile.Open(QFileInfo(QDir(Options.LGEOPath), QLatin1String("lg_elements.lst")).absoluteFilePath(), "rt"))
|
||||
if (!TableFile.Open(QFileInfo(QDir(Dialog.mLGEOPath), QLatin1String("lg_elements.lst")).absoluteFilePath(), "rt"))
|
||||
{
|
||||
delete[] PieceTable;
|
||||
delete[] PieceFlags;
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Could not find LGEO files in folder '%1'.").arg(Options.LGEOPath));
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Could not find LGEO files in folder '%1'.").arg(Dialog.mLGEOPath));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1461,11 +1455,11 @@ void Project::ExportPOVRay()
|
|||
PieceFlags[Index] |= LGEO_PIECE_SLOPE;
|
||||
}
|
||||
|
||||
if (!ColorFile.Open(QFileInfo(QDir(Options.LGEOPath), QLatin1String("lg_colors.lst")).absoluteFilePath(), "rt"))
|
||||
if (!ColorFile.Open(QFileInfo(QDir(Dialog.mLGEOPath), QLatin1String("lg_colors.lst")).absoluteFilePath(), "rt"))
|
||||
{
|
||||
delete[] PieceTable;
|
||||
delete[] PieceFlags;
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Could not find LGEO files in folder '%1'.").arg(Options.LGEOPath));
|
||||
QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Could not find LGEO files in folder '%1'.").arg(Dialog.mLGEOPath));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1490,7 +1484,7 @@ void Project::ExportPOVRay()
|
|||
|
||||
const char* OldLocale = setlocale(LC_NUMERIC, "C");
|
||||
|
||||
if (!Options.LGEOPath.isEmpty())
|
||||
if (!Dialog.mLGEOPath.isEmpty())
|
||||
{
|
||||
POVFile.WriteLine("#include \"lg_defs.inc\"\n#include \"lg_color.inc\"\n\n");
|
||||
|
||||
|
@ -1617,21 +1611,21 @@ void Project::ExportPOVRay()
|
|||
setlocale(LC_NUMERIC, OldLocale);
|
||||
POVFile.Close();
|
||||
|
||||
if (Options.Render)
|
||||
if (Dialog.mRender)
|
||||
{
|
||||
QStringList Arguments;
|
||||
|
||||
Arguments.append(QString::fromLatin1("+I%1").arg(Options.FileName));
|
||||
Arguments.append(QString::fromLatin1("+I%1").arg(Dialog.mFileName));
|
||||
|
||||
if (!Options.LGEOPath.isEmpty())
|
||||
if (!Dialog.mLGEOPath.isEmpty())
|
||||
{
|
||||
Arguments.append(QString::fromLatin1("+L%1lg/").arg(Options.LGEOPath));
|
||||
Arguments.append(QString::fromLatin1("+L%1ar/").arg(Options.LGEOPath));
|
||||
Arguments.append(QString::fromLatin1("+L%1lg/").arg(Dialog.mLGEOPath));
|
||||
Arguments.append(QString::fromLatin1("+L%1ar/").arg(Dialog.mLGEOPath));
|
||||
}
|
||||
|
||||
Arguments.append(QString::fromLatin1("/EXIT"));
|
||||
|
||||
QProcess::execute(Options.POVRayPath, Arguments);
|
||||
QProcess::execute(Dialog.mPOVRayPath, Arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1739,38 +1733,18 @@ void Project::ExportWavefront(const QString& FileName)
|
|||
|
||||
void Project::SaveImage()
|
||||
{
|
||||
lcImageDialogOptions Options;
|
||||
lcStep LastStep = mActiveModel->GetLastStep();
|
||||
lcQImageDialog Dialog(gMainWindow);
|
||||
|
||||
Options.Width = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
|
||||
Options.Height = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
|
||||
Options.Start = mActiveModel->GetCurrentStep();
|
||||
Options.End = LastStep;
|
||||
|
||||
if (!mFileName.isEmpty())
|
||||
{
|
||||
Options.FileName = mFileName;
|
||||
QString Extension = QFileInfo(Options.FileName).suffix();
|
||||
Options.FileName = Options.FileName.left(Options.FileName.length() - Extension.length() - 1);
|
||||
}
|
||||
else
|
||||
Options.FileName = QLatin1String("image");
|
||||
|
||||
Options.FileName += lcGetProfileString(LC_PROFILE_IMAGE_EXTENSION);
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_SAVE_IMAGE, &Options))
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
QString Extension = QFileInfo(Options.FileName).suffix();
|
||||
QString Extension = QFileInfo(Dialog.mFileName).suffix();
|
||||
|
||||
if (!Extension.isEmpty())
|
||||
lcSetProfileString(LC_PROFILE_IMAGE_EXTENSION, Options.FileName.right(Extension.length() + 1));
|
||||
lcSetProfileString(LC_PROFILE_IMAGE_EXTENSION, Dialog.mFileName.right(Extension.length() + 1));
|
||||
|
||||
lcSetProfileInt(LC_PROFILE_IMAGE_WIDTH, Options.Width);
|
||||
lcSetProfileInt(LC_PROFILE_IMAGE_HEIGHT, Options.Height);
|
||||
if (Dialog.mStart != Dialog.mEnd)
|
||||
Dialog.mFileName = Dialog.mFileName.insert(Dialog.mFileName.length() - Extension.length() - 1, QLatin1String("%1"));
|
||||
|
||||
if (Options.Start != Options.End)
|
||||
Options.FileName = Options.FileName.insert(Options.FileName.length() - Extension.length() - 1, QLatin1String("%1"));
|
||||
|
||||
mActiveModel->SaveStepImages(Options.FileName, Options.Width, Options.Height, Options.Start, Options.End);
|
||||
mActiveModel->SaveStepImages(Dialog.mFileName, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_qarraydialog.h"
|
||||
#include "ui_lc_qarraydialog.h"
|
||||
#include "lc_basewindow.h"
|
||||
#include "lc_qutils.h"
|
||||
|
||||
lcQArrayDialog::lcQArrayDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQArrayDialog)
|
||||
lcQArrayDialog::lcQArrayDialog(QWidget* Parent)
|
||||
: QDialog(Parent), ui(new Ui::lcQArrayDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -29,29 +27,33 @@ lcQArrayDialog::lcQArrayDialog(QWidget *parent, void *data) :
|
|||
ui->rotation3y->setValidator(new QDoubleValidator());
|
||||
ui->rotation3z->setValidator(new QDoubleValidator());
|
||||
|
||||
options = (lcArrayDialogOptions*)data;
|
||||
mCounts[0] = 10;
|
||||
mCounts[1] = 1;
|
||||
mCounts[2] = 1;
|
||||
mOffsets[0] = mOffsets[1] = mOffsets[2] = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
mRotations[0] = mRotations[1] = mRotations[2] = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
ui->count1->setValue(options->Counts[0]);
|
||||
ui->count2->setValue(options->Counts[1]);
|
||||
ui->count3->setValue(options->Counts[2]);
|
||||
ui->offset1x->setText(lcFormatValueLocalized(options->Offsets[0].x));
|
||||
ui->offset1y->setText(lcFormatValueLocalized(options->Offsets[0].y));
|
||||
ui->offset1z->setText(lcFormatValueLocalized(options->Offsets[0].z));
|
||||
ui->offset2x->setText(lcFormatValueLocalized(options->Offsets[1].x));
|
||||
ui->offset2y->setText(lcFormatValueLocalized(options->Offsets[1].y));
|
||||
ui->offset2z->setText(lcFormatValueLocalized(options->Offsets[1].z));
|
||||
ui->offset3x->setText(lcFormatValueLocalized(options->Offsets[2].x));
|
||||
ui->offset3y->setText(lcFormatValueLocalized(options->Offsets[2].y));
|
||||
ui->offset3z->setText(lcFormatValueLocalized(options->Offsets[2].z));
|
||||
ui->rotation1x->setText(lcFormatValueLocalized(options->Rotations[0].x));
|
||||
ui->rotation1y->setText(lcFormatValueLocalized(options->Rotations[0].y));
|
||||
ui->rotation1z->setText(lcFormatValueLocalized(options->Rotations[0].z));
|
||||
ui->rotation2x->setText(lcFormatValueLocalized(options->Rotations[1].x));
|
||||
ui->rotation2y->setText(lcFormatValueLocalized(options->Rotations[1].y));
|
||||
ui->rotation2z->setText(lcFormatValueLocalized(options->Rotations[1].z));
|
||||
ui->rotation3x->setText(lcFormatValueLocalized(options->Rotations[2].x));
|
||||
ui->rotation3y->setText(lcFormatValueLocalized(options->Rotations[2].y));
|
||||
ui->rotation3z->setText(lcFormatValueLocalized(options->Rotations[2].z));
|
||||
ui->count1->setValue(mCounts[0]);
|
||||
ui->count2->setValue(mCounts[1]);
|
||||
ui->count3->setValue(mCounts[2]);
|
||||
ui->offset1x->setText(lcFormatValueLocalized(mOffsets[0].x));
|
||||
ui->offset1y->setText(lcFormatValueLocalized(mOffsets[0].y));
|
||||
ui->offset1z->setText(lcFormatValueLocalized(mOffsets[0].z));
|
||||
ui->offset2x->setText(lcFormatValueLocalized(mOffsets[1].x));
|
||||
ui->offset2y->setText(lcFormatValueLocalized(mOffsets[1].y));
|
||||
ui->offset2z->setText(lcFormatValueLocalized(mOffsets[1].z));
|
||||
ui->offset3x->setText(lcFormatValueLocalized(mOffsets[2].x));
|
||||
ui->offset3y->setText(lcFormatValueLocalized(mOffsets[2].y));
|
||||
ui->offset3z->setText(lcFormatValueLocalized(mOffsets[2].z));
|
||||
ui->rotation1x->setText(lcFormatValueLocalized(mRotations[0].x));
|
||||
ui->rotation1y->setText(lcFormatValueLocalized(mRotations[0].y));
|
||||
ui->rotation1z->setText(lcFormatValueLocalized(mRotations[0].z));
|
||||
ui->rotation2x->setText(lcFormatValueLocalized(mRotations[1].x));
|
||||
ui->rotation2y->setText(lcFormatValueLocalized(mRotations[1].y));
|
||||
ui->rotation2z->setText(lcFormatValueLocalized(mRotations[1].z));
|
||||
ui->rotation3x->setText(lcFormatValueLocalized(mRotations[2].x));
|
||||
ui->rotation3y->setText(lcFormatValueLocalized(mRotations[2].y));
|
||||
ui->rotation3z->setText(lcFormatValueLocalized(mRotations[2].z));
|
||||
}
|
||||
|
||||
lcQArrayDialog::~lcQArrayDialog()
|
||||
|
@ -73,27 +75,27 @@ void lcQArrayDialog::accept()
|
|||
return;
|
||||
}
|
||||
|
||||
options->Counts[0] = Counts[0];
|
||||
options->Counts[1] = Counts[1];
|
||||
options->Counts[2] = Counts[2];
|
||||
options->Offsets[0].x = lcParseValueLocalized(ui->offset1x->text());
|
||||
options->Offsets[0].y = lcParseValueLocalized(ui->offset1y->text());
|
||||
options->Offsets[0].z = lcParseValueLocalized(ui->offset1z->text());
|
||||
options->Offsets[1].x = lcParseValueLocalized(ui->offset2x->text());
|
||||
options->Offsets[1].y = lcParseValueLocalized(ui->offset2y->text());
|
||||
options->Offsets[1].z = lcParseValueLocalized(ui->offset2z->text());
|
||||
options->Offsets[2].x = lcParseValueLocalized(ui->offset3x->text());
|
||||
options->Offsets[2].y = lcParseValueLocalized(ui->offset3y->text());
|
||||
options->Offsets[2].z = lcParseValueLocalized(ui->offset3z->text());
|
||||
options->Rotations[0].x = lcParseValueLocalized(ui->rotation1x->text());
|
||||
options->Rotations[0].y = lcParseValueLocalized(ui->rotation1y->text());
|
||||
options->Rotations[0].z = lcParseValueLocalized(ui->rotation1z->text());
|
||||
options->Rotations[1].x = lcParseValueLocalized(ui->rotation2x->text());
|
||||
options->Rotations[1].y = lcParseValueLocalized(ui->rotation2y->text());
|
||||
options->Rotations[1].z = lcParseValueLocalized(ui->rotation2z->text());
|
||||
options->Rotations[2].x = lcParseValueLocalized(ui->rotation3x->text());
|
||||
options->Rotations[2].y = lcParseValueLocalized(ui->rotation3y->text());
|
||||
options->Rotations[2].z = lcParseValueLocalized(ui->rotation3z->text());
|
||||
mCounts[0] = Counts[0];
|
||||
mCounts[1] = Counts[1];
|
||||
mCounts[2] = Counts[2];
|
||||
mOffsets[0].x = lcParseValueLocalized(ui->offset1x->text());
|
||||
mOffsets[0].y = lcParseValueLocalized(ui->offset1y->text());
|
||||
mOffsets[0].z = lcParseValueLocalized(ui->offset1z->text());
|
||||
mOffsets[1].x = lcParseValueLocalized(ui->offset2x->text());
|
||||
mOffsets[1].y = lcParseValueLocalized(ui->offset2y->text());
|
||||
mOffsets[1].z = lcParseValueLocalized(ui->offset2z->text());
|
||||
mOffsets[2].x = lcParseValueLocalized(ui->offset3x->text());
|
||||
mOffsets[2].y = lcParseValueLocalized(ui->offset3y->text());
|
||||
mOffsets[2].z = lcParseValueLocalized(ui->offset3z->text());
|
||||
mRotations[0].x = lcParseValueLocalized(ui->rotation1x->text());
|
||||
mRotations[0].y = lcParseValueLocalized(ui->rotation1y->text());
|
||||
mRotations[0].z = lcParseValueLocalized(ui->rotation1z->text());
|
||||
mRotations[1].x = lcParseValueLocalized(ui->rotation2x->text());
|
||||
mRotations[1].y = lcParseValueLocalized(ui->rotation2y->text());
|
||||
mRotations[1].z = lcParseValueLocalized(ui->rotation2z->text());
|
||||
mRotations[2].x = lcParseValueLocalized(ui->rotation3x->text());
|
||||
mRotations[2].y = lcParseValueLocalized(ui->rotation3y->text());
|
||||
mRotations[2].z = lcParseValueLocalized(ui->rotation3z->text());
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _LC_QARRAYDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
struct lcArrayDialogOptions;
|
||||
#include "lc_math.h"
|
||||
|
||||
namespace Ui {
|
||||
class lcQArrayDialog;
|
||||
|
@ -13,10 +13,12 @@ class lcQArrayDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQArrayDialog(QWidget *parent, void* data);
|
||||
lcQArrayDialog(QWidget* Parent);
|
||||
~lcQArrayDialog();
|
||||
|
||||
lcArrayDialogOptions *options;
|
||||
int mCounts[3];
|
||||
lcVector3 mOffsets[3];
|
||||
lcVector3 mRotations[3];
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include "group.h"
|
||||
#include "lc_basewindow.h"
|
||||
|
||||
lcQEditGroupsDialog::lcQEditGroupsDialog(QWidget* Parent, void* Data)
|
||||
: QDialog(Parent), ui(new Ui::lcQEditGroupsDialog)
|
||||
lcQEditGroupsDialog::lcQEditGroupsDialog(QWidget* Parent, const QMap<lcPiece*, lcGroup*>& PieceParents, const QMap<lcGroup*, lcGroup*>& GroupParents)
|
||||
: QDialog(Parent), ui(new Ui::lcQEditGroupsDialog), mPieceParents(PieceParents), mGroupParents(GroupParents)
|
||||
{
|
||||
mLastItemClicked = NULL;
|
||||
|
||||
|
@ -20,8 +20,6 @@ lcQEditGroupsDialog::lcQEditGroupsDialog(QWidget* Parent, void* Data)
|
|||
QPushButton *newGroup = ui->buttonBox->addButton(tr("New Group"), QDialogButtonBox::ActionRole);
|
||||
connect(newGroup, SIGNAL(clicked()), this, SLOT(on_newGroup_clicked()));
|
||||
|
||||
mOptions = (lcEditGroupsDialogOptions*)Data;
|
||||
|
||||
AddChildren(ui->treeWidget->invisibleRootItem(), NULL);
|
||||
ui->treeWidget->expandAll();
|
||||
}
|
||||
|
@ -40,8 +38,8 @@ void lcQEditGroupsDialog::accept()
|
|||
|
||||
void lcQEditGroupsDialog::reject()
|
||||
{
|
||||
for (int GroupIdx = 0; GroupIdx < mOptions->NewGroups.size(); GroupIdx++)
|
||||
lcGetActiveModel()->RemoveGroup(mOptions->NewGroups[GroupIdx]);
|
||||
for (int GroupIdx = 0; GroupIdx < mNewGroups.size(); GroupIdx++)
|
||||
lcGetActiveModel()->RemoveGroup(mNewGroups[GroupIdx]);
|
||||
|
||||
QDialog::reject();
|
||||
}
|
||||
|
@ -59,8 +57,8 @@ void lcQEditGroupsDialog::on_newGroup_clicked()
|
|||
lcGroup* ParentGroup = (lcGroup*)CurrentItem->data(0, GroupRole).value<uintptr_t>();
|
||||
|
||||
lcGroup* NewGroup = lcGetActiveModel()->AddGroup(tr("Group #"), ParentGroup);
|
||||
mOptions->GroupParents[NewGroup] = ParentGroup;
|
||||
mOptions->NewGroups.append(NewGroup);
|
||||
mGroupParents[NewGroup] = ParentGroup;
|
||||
mNewGroups.append(NewGroup);
|
||||
|
||||
QTreeWidgetItem* GroupItem = new QTreeWidgetItem(CurrentItem, QStringList(NewGroup->mName));
|
||||
GroupItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);
|
||||
|
@ -120,7 +118,7 @@ void lcQEditGroupsDialog::UpdateParents(QTreeWidgetItem* ParentItem, lcGroup* Pa
|
|||
|
||||
if (Piece)
|
||||
{
|
||||
mOptions->PieceParents[Piece] = ParentGroup;
|
||||
mPieceParents[Piece] = ParentGroup;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -129,7 +127,7 @@ void lcQEditGroupsDialog::UpdateParents(QTreeWidgetItem* ParentItem, lcGroup* Pa
|
|||
// todo: validate unique group name
|
||||
Group->mName = ChildItem->text(0);
|
||||
|
||||
mOptions->GroupParents[Group] = ParentGroup;
|
||||
mGroupParents[Group] = ParentGroup;
|
||||
|
||||
UpdateParents(ChildItem, Group);
|
||||
}
|
||||
|
@ -138,7 +136,7 @@ void lcQEditGroupsDialog::UpdateParents(QTreeWidgetItem* ParentItem, lcGroup* Pa
|
|||
|
||||
void lcQEditGroupsDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* ParentGroup)
|
||||
{
|
||||
for (QMap<lcGroup*, lcGroup*>::const_iterator it = mOptions->GroupParents.constBegin(); it != mOptions->GroupParents.constEnd(); it++)
|
||||
for (QMap<lcGroup*, lcGroup*>::const_iterator it = mGroupParents.constBegin(); it != mGroupParents.constEnd(); it++)
|
||||
{
|
||||
lcGroup* Group = it.key();
|
||||
lcGroup* Parent = it.value();
|
||||
|
@ -153,7 +151,7 @@ void lcQEditGroupsDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* Pare
|
|||
AddChildren(GroupItem, Group);
|
||||
}
|
||||
|
||||
for (QMap<lcPiece*, lcGroup*>::const_iterator it = mOptions->PieceParents.constBegin(); it != mOptions->PieceParents.constEnd(); it++)
|
||||
for (QMap<lcPiece*, lcGroup*>::const_iterator it = mPieceParents.constBegin(); it != mPieceParents.constEnd(); it++)
|
||||
{
|
||||
lcPiece* Piece = it.key();
|
||||
lcGroup* Parent = it.value();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define LC_QEDITGROUPSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
struct lcEditGroupsDialogOptions;
|
||||
|
||||
namespace Ui {
|
||||
class lcQEditGroupsDialog;
|
||||
|
@ -13,10 +12,13 @@ class lcQEditGroupsDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQEditGroupsDialog(QWidget* Parent, void* Data);
|
||||
lcQEditGroupsDialog(QWidget* Parent, const QMap<lcPiece*, lcGroup*>& PieceParents, const QMap<lcGroup*, lcGroup*>& GroupParents);
|
||||
~lcQEditGroupsDialog();
|
||||
|
||||
lcEditGroupsDialogOptions* mOptions;
|
||||
QMap<lcPiece*, lcGroup*> mPieceParents;
|
||||
QMap<lcGroup*, lcGroup*> mGroupParents;
|
||||
QList<lcGroup*> mNewGroups;
|
||||
//QList<lcGroup*> mDeletedGroups; // todo: support deleting groups in the edit groups dialog
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_qimagedialog.h"
|
||||
#include "ui_lc_qimagedialog.h"
|
||||
#include "lc_basewindow.h"
|
||||
#include "lc_application.h"
|
||||
#include "project.h"
|
||||
#include "lc_model.h"
|
||||
#include "lc_profile.h"
|
||||
|
||||
lcQImageDialog::lcQImageDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQImageDialog)
|
||||
lcQImageDialog::lcQImageDialog(QWidget* Parent)
|
||||
: QDialog(Parent), ui(new Ui::lcQImageDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -14,15 +16,26 @@ lcQImageDialog::lcQImageDialog(QWidget *parent, void *data) :
|
|||
ui->firstStep->setValidator(new QIntValidator(this));
|
||||
ui->lastStep->setValidator(new QIntValidator(this));
|
||||
|
||||
options = (lcImageDialogOptions*)data;
|
||||
currentStep = options->Start;
|
||||
lastStep = options->End;
|
||||
Project* Project = lcGetActiveProject();
|
||||
lcModel* Model = Project->GetActiveModel();
|
||||
mWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
|
||||
mHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
|
||||
mStart = Model->GetCurrentStep();
|
||||
mEnd = Model->GetLastStep();
|
||||
mFileName = Project->GetFileName();
|
||||
|
||||
ui->fileName->setText(options->FileName);
|
||||
ui->width->setText(QString::number(options->Width));
|
||||
ui->height->setText(QString::number(options->Height));
|
||||
ui->firstStep->setText(QString::number(1));
|
||||
ui->lastStep->setText(QString::number(lastStep));
|
||||
if (!mFileName.isEmpty())
|
||||
mFileName = QFileInfo(mFileName).completeBaseName();
|
||||
else
|
||||
mFileName = QLatin1String("image");
|
||||
|
||||
mFileName += lcGetProfileString(LC_PROFILE_IMAGE_EXTENSION);
|
||||
|
||||
ui->fileName->setText(mFileName);
|
||||
ui->width->setText(QString::number(mWidth));
|
||||
ui->height->setText(QString::number(mHeight));
|
||||
ui->firstStep->setText(QString::number(mStart));
|
||||
ui->lastStep->setText(QString::number(mEnd));
|
||||
ui->rangeCurrent->setChecked(true);
|
||||
}
|
||||
|
||||
|
@ -57,33 +70,33 @@ void lcQImageDialog::accept()
|
|||
return;
|
||||
}
|
||||
|
||||
int start = currentStep, end = currentStep;
|
||||
int start = mStart, end = mStart;
|
||||
|
||||
if (ui->rangeAll->isChecked())
|
||||
{
|
||||
start = 1;
|
||||
end = lastStep;
|
||||
end = mEnd;
|
||||
}
|
||||
else if (ui->rangeCurrent->isChecked())
|
||||
{
|
||||
start = currentStep;
|
||||
end = currentStep;
|
||||
start = mStart;
|
||||
end = mStart;
|
||||
}
|
||||
else if (ui->rangeCustom->isChecked())
|
||||
{
|
||||
start = ui->firstStep->text().toInt();
|
||||
|
||||
if (start < 1 || start > lastStep)
|
||||
if (start < 1 || start > mEnd)
|
||||
{
|
||||
QMessageBox::information(this, tr("Error"), tr("First step must be between 1 and %1.").arg(QString::number(lastStep)));
|
||||
QMessageBox::information(this, tr("Error"), tr("First step must be between 1 and %1.").arg(QString::number(mEnd)));
|
||||
return;
|
||||
}
|
||||
|
||||
end = ui->lastStep->text().toInt();
|
||||
|
||||
if (end < 1 || end > lastStep)
|
||||
if (end < 1 || end > mEnd)
|
||||
{
|
||||
QMessageBox::information(this, tr("Error"), tr("Last step must be between 1 and %1.").arg(QString::number(lastStep)));
|
||||
QMessageBox::information(this, tr("Error"), tr("Last step must be between 1 and %1.").arg(QString::number(mEnd)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,11 +107,14 @@ void lcQImageDialog::accept()
|
|||
}
|
||||
}
|
||||
|
||||
options->FileName = fileName;
|
||||
options->Width = width;
|
||||
options->Height = height;
|
||||
options->Start = start;
|
||||
options->End = end;
|
||||
mFileName = fileName;
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
mStart = start;
|
||||
mEnd = end;
|
||||
|
||||
lcSetProfileInt(LC_PROFILE_IMAGE_WIDTH, mWidth);
|
||||
lcSetProfileInt(LC_PROFILE_IMAGE_HEIGHT, mHeight);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define LC_QIMAGEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
struct lcImageDialogOptions;
|
||||
|
||||
namespace Ui {
|
||||
class lcQImageDialog;
|
||||
|
@ -13,12 +12,14 @@ class lcQImageDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQImageDialog(QWidget *parent, void *data);
|
||||
lcQImageDialog(QWidget* Parent);
|
||||
~lcQImageDialog();
|
||||
|
||||
lcImageDialogOptions *options;
|
||||
int currentStep;
|
||||
int lastStep;
|
||||
QString mFileName;
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
int mStart;
|
||||
int mEnd;
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "lc_mainwindow.h"
|
||||
#include "preview.h"
|
||||
|
||||
lcQMinifigDialog::lcQMinifigDialog(QWidget *parent, void *data) :
|
||||
lcQMinifigDialog::lcQMinifigDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQMinifigDialog)
|
||||
{
|
||||
|
@ -16,9 +16,9 @@ lcQMinifigDialog::lcQMinifigDialog(QWidget *parent, void *data) :
|
|||
QGridLayout *previewLayout = new QGridLayout(ui->minifigFrame);
|
||||
previewLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
wizard = new MinifigWizard((lcMinifig*)data);
|
||||
mMinifigWidget = new MinifigWizard();
|
||||
|
||||
lcQGLWidget *minifigWidget = new lcQGLWidget(NULL, (lcQGLWidget*)gMainWindow->mPreviewWidget->mWidget, wizard, false);
|
||||
lcQGLWidget *minifigWidget = new lcQGLWidget(NULL, (lcQGLWidget*)gMainWindow->mPreviewWidget->mWidget, mMinifigWidget, false);
|
||||
minifigWidget->setMinimumWidth(100);
|
||||
previewLayout->addWidget(minifigWidget);
|
||||
|
||||
|
@ -72,11 +72,9 @@ lcQMinifigDialog::lcQMinifigDialog(QWidget *parent, void *data) :
|
|||
connect(ui->rlegaAngle, SIGNAL(valueChanged(double)), this, SLOT(angleChanged(double)));
|
||||
connect(ui->llegaAngle, SIGNAL(valueChanged(double)), this, SLOT(angleChanged(double)));
|
||||
|
||||
options = (lcMinifig*)data;
|
||||
|
||||
for (int ItemIndex = 0; ItemIndex < LC_MFW_NUMITEMS; ItemIndex++)
|
||||
{
|
||||
lcArray<lcMinifigPieceInfo>& PartList = wizard->mSettings[ItemIndex];
|
||||
lcArray<lcMinifigPieceInfo>& PartList = mMinifigWidget->mSettings[ItemIndex];
|
||||
QStringList ItemStrings;
|
||||
QVector<int> Separators;
|
||||
|
||||
|
@ -96,16 +94,16 @@ lcQMinifigDialog::lcQMinifigDialog(QWidget *parent, void *data) :
|
|||
ItemCombo->addItems(ItemStrings);
|
||||
for (int SeparatorIndex = Separators.size() - 1; SeparatorIndex >= 0; SeparatorIndex--)
|
||||
ItemCombo->insertSeparator(Separators[SeparatorIndex]);
|
||||
ItemCombo->setCurrentIndex(wizard->GetSelectionIndex(ItemIndex));
|
||||
ItemCombo->setCurrentIndex(mMinifigWidget->GetSelectionIndex(ItemIndex));
|
||||
ItemCombo->blockSignals(false);
|
||||
|
||||
lcQColorPicker *colorPicker = getColorPicker(ItemIndex);
|
||||
colorPicker->blockSignals(true);
|
||||
colorPicker->setCurrentColor(options->Colors[ItemIndex]);
|
||||
colorPicker->setCurrentColor(mMinifigWidget->mMinifig.Colors[ItemIndex]);
|
||||
colorPicker->blockSignals(false);
|
||||
}
|
||||
|
||||
wizard->OnInitialUpdate();
|
||||
mMinifigWidget->OnInitialUpdate();
|
||||
}
|
||||
|
||||
lcQMinifigDialog::~lcQMinifigDialog()
|
||||
|
@ -120,20 +118,20 @@ void lcQMinifigDialog::accept()
|
|||
|
||||
void lcQMinifigDialog::typeChanged(int index)
|
||||
{
|
||||
wizard->SetSelectionIndex(getTypeIndex(sender()), index);
|
||||
wizard->Redraw();
|
||||
mMinifigWidget->SetSelectionIndex(getTypeIndex(sender()), index);
|
||||
mMinifigWidget->Redraw();
|
||||
}
|
||||
|
||||
void lcQMinifigDialog::colorChanged(int index)
|
||||
{
|
||||
wizard->SetColor(getColorIndex(sender()), index);
|
||||
wizard->Redraw();
|
||||
mMinifigWidget->SetColor(getColorIndex(sender()), index);
|
||||
mMinifigWidget->Redraw();
|
||||
}
|
||||
|
||||
void lcQMinifigDialog::angleChanged(double value)
|
||||
{
|
||||
wizard->SetAngle(getAngleIndex(sender()), value);
|
||||
wizard->Redraw();
|
||||
mMinifigWidget->SetAngle(getAngleIndex(sender()), value);
|
||||
mMinifigWidget->Redraw();
|
||||
}
|
||||
|
||||
QComboBox *lcQMinifigDialog::getTypeComboBox(int type)
|
||||
|
|
|
@ -15,11 +15,10 @@ class lcQMinifigDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQMinifigDialog(QWidget *parent, void *data);
|
||||
explicit lcQMinifigDialog(QWidget* Parent);
|
||||
~lcQMinifigDialog();
|
||||
|
||||
lcMinifig *options;
|
||||
MinifigWizard *wizard;
|
||||
MinifigWizard* mMinifigWidget;
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_qpovraydialog.h"
|
||||
#include "ui_lc_qpovraydialog.h"
|
||||
#include "lc_basewindow.h"
|
||||
#include "lc_profile.h"
|
||||
|
||||
lcQPOVRayDialog::lcQPOVRayDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQPOVRayDialog)
|
||||
lcQPOVRayDialog::lcQPOVRayDialog(QWidget* Parent)
|
||||
: QDialog(Parent), ui(new Ui::lcQPOVRayDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
options = (lcPOVRayDialogOptions*)data;
|
||||
mPOVRayPath = lcGetProfileString(LC_PROFILE_POVRAY_PATH);
|
||||
mLGEOPath = lcGetProfileString(LC_PROFILE_POVRAY_LGEO_PATH);
|
||||
mRender = lcGetProfileInt(LC_PROFILE_POVRAY_RENDER);
|
||||
|
||||
ui->outputEdit->setText(options->FileName);
|
||||
ui->povrayEdit->setText(options->POVRayPath);
|
||||
ui->lgeoEdit->setText(options->LGEOPath);
|
||||
ui->render->setChecked(options->Render);
|
||||
ui->outputEdit->setText(mFileName);
|
||||
ui->povrayEdit->setText(mPOVRayPath);
|
||||
ui->lgeoEdit->setText(mLGEOPath);
|
||||
ui->render->setChecked(mRender);
|
||||
}
|
||||
|
||||
lcQPOVRayDialog::~lcQPOVRayDialog()
|
||||
|
@ -32,10 +33,14 @@ void lcQPOVRayDialog::accept()
|
|||
return;
|
||||
}
|
||||
|
||||
options->FileName = fileName;
|
||||
options->POVRayPath = ui->povrayEdit->text();
|
||||
options->LGEOPath = ui->lgeoEdit->text();
|
||||
options->Render = ui->render->isChecked();
|
||||
mFileName = fileName;
|
||||
mPOVRayPath = ui->povrayEdit->text();
|
||||
mLGEOPath = ui->lgeoEdit->text();
|
||||
mRender = ui->render->isChecked();
|
||||
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_PATH, mPOVRayPath);
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, mLGEOPath);
|
||||
lcSetProfileInt(LC_PROFILE_POVRAY_RENDER, mRender);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define _LC_QPOVRAYDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
struct lcPOVRayDialogOptions;
|
||||
|
||||
namespace Ui {
|
||||
class lcQPOVRayDialog;
|
||||
|
@ -13,10 +12,13 @@ class lcQPOVRayDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQPOVRayDialog(QWidget *parent, void* data);
|
||||
lcQPOVRayDialog(QWidget* Parent);
|
||||
~lcQPOVRayDialog();
|
||||
|
||||
lcPOVRayDialogOptions *options;
|
||||
QString mFileName;
|
||||
QString mPOVRayPath;
|
||||
QString mLGEOPath;
|
||||
bool mRender;
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
|
|
@ -3,20 +3,17 @@
|
|||
#include "ui_lc_qselectdialog.h"
|
||||
#include "lc_application.h"
|
||||
#include "project.h"
|
||||
#include "lc_model.h"
|
||||
#include "piece.h"
|
||||
#include "camera.h"
|
||||
#include "light.h"
|
||||
#include "group.h"
|
||||
#include "lc_basewindow.h"
|
||||
|
||||
lcQSelectDialog::lcQSelectDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQSelectDialog)
|
||||
lcQSelectDialog::lcQSelectDialog(QWidget* Parent)
|
||||
: QDialog(Parent), ui(new Ui::lcQSelectDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
options = (lcSelectDialogOptions*)data;
|
||||
|
||||
AddChildren(ui->treeWidget->invisibleRootItem(), NULL);
|
||||
ui->treeWidget->expandAll();
|
||||
|
||||
|
@ -30,7 +27,7 @@ lcQSelectDialog::~lcQSelectDialog()
|
|||
|
||||
void lcQSelectDialog::accept()
|
||||
{
|
||||
options->Objects.RemoveAll();
|
||||
mObjects.RemoveAll();
|
||||
|
||||
QList<QTreeWidgetItem*> Items;
|
||||
Items.append(ui->treeWidget->invisibleRootItem());
|
||||
|
@ -45,7 +42,7 @@ void lcQSelectDialog::accept()
|
|||
if (Item->checkState(0) == Qt::Checked)
|
||||
{
|
||||
lcObject* Object = (lcObject*)Item->data(0, IndexRole).value<uintptr_t>();
|
||||
options->Objects.Add(Object);
|
||||
mObjects.Add(Object);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _LC_QSELECTDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
struct lcSelectDialogOptions;
|
||||
#include "lc_array.h"
|
||||
|
||||
namespace Ui {
|
||||
class lcQSelectDialog;
|
||||
|
@ -13,10 +13,10 @@ class lcQSelectDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQSelectDialog(QWidget *parent, void *data);
|
||||
lcQSelectDialog(QWidget* Parent);
|
||||
~lcQSelectDialog();
|
||||
|
||||
lcSelectDialogOptions *options;
|
||||
lcArray<lcObject*> mObjects;
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -23,16 +23,14 @@ void lcDoInitialUpdateCheck()
|
|||
return;
|
||||
}
|
||||
|
||||
new lcQUpdateDialog(NULL, (void*)1);
|
||||
new lcQUpdateDialog(NULL, true);
|
||||
}
|
||||
|
||||
lcQUpdateDialog::lcQUpdateDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::lcQUpdateDialog)
|
||||
lcQUpdateDialog::lcQUpdateDialog(QWidget* Parent, bool InitialUpdate)
|
||||
: QDialog(Parent), ui(new Ui::lcQUpdateDialog), mInitialUpdate(InitialUpdate)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
initialUpdate = (bool)data;
|
||||
connect(this, SIGNAL(finished(int)), this, SLOT(finished(int)));
|
||||
|
||||
ui->status->setText(tr("Connecting to update server..."));
|
||||
|
@ -81,7 +79,7 @@ void lcQUpdateDialog::finished(int result)
|
|||
{
|
||||
Q_UNUSED(result);
|
||||
|
||||
if (initialUpdate)
|
||||
if (mInitialUpdate)
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
@ -100,7 +98,7 @@ void lcQUpdateDialog::replyFinished(QNetworkReply *reply)
|
|||
QSettings settings;
|
||||
QByteArray ignoreUpdate = settings.value("Updates/IgnoreVersion", QByteArray()).toByteArray();
|
||||
|
||||
if (initialUpdate && ignoreUpdate == versionData)
|
||||
if (mInitialUpdate && ignoreUpdate == versionData)
|
||||
{
|
||||
updateAvailable = false;
|
||||
}
|
||||
|
@ -157,7 +155,7 @@ void lcQUpdateDialog::replyFinished(QNetworkReply *reply)
|
|||
else
|
||||
ui->status->setText(tr("Error connecting to the update server."));
|
||||
|
||||
if (initialUpdate)
|
||||
if (mInitialUpdate)
|
||||
{
|
||||
if (updateAvailable)
|
||||
show();
|
||||
|
|
|
@ -15,7 +15,7 @@ class lcQUpdateDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQUpdateDialog(QWidget *parent, void *data);
|
||||
explicit lcQUpdateDialog(QWidget* Parent, bool InitialUpdate);
|
||||
~lcQUpdateDialog();
|
||||
|
||||
void parseUpdate(const char *update);
|
||||
|
@ -32,7 +32,7 @@ private:
|
|||
QNetworkReply *updateReply;
|
||||
QNetworkAccessManager *manager;
|
||||
QByteArray versionData;
|
||||
bool initialUpdate;
|
||||
bool mInitialUpdate;
|
||||
};
|
||||
|
||||
#endif // LC_QUPDATEDIALOG_H
|
||||
|
|
Loading…
Add table
Reference in a new issue