Removed old DoDialog function.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "lc_profile.h"
|
||||
#include "project.h"
|
||||
#include "lc_mainwindow.h"
|
||||
#include "lc_qpreferencesdialog.h"
|
||||
#include "lc_partselectionwidget.h"
|
||||
#include "lc_shortcuts.h"
|
||||
#include "view.h"
|
||||
@@ -498,7 +499,8 @@ void lcApplication::ShowPreferencesDialog()
|
||||
Options.MouseShortcutsModified = false;
|
||||
Options.MouseShortcutsDefault = false;
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_PREFERENCES, &Options))
|
||||
lcQPreferencesDialog Dialog(gMainWindow, &Options);
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
bool LibraryChanged = Options.LibraryPath != lcGetProfileString(LC_PROFILE_PARTS_LIBRARY);
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
#include "lc_shortcuts.h"
|
||||
#include "image.h"
|
||||
|
||||
enum LC_DIALOG_TYPE
|
||||
{
|
||||
LC_DIALOG_EXPORT_HTML,
|
||||
LC_DIALOG_PROPERTIES,
|
||||
LC_DIALOG_PREFERENCES
|
||||
};
|
||||
|
||||
struct lcHTMLDialogOptions
|
||||
{
|
||||
QString PathName;
|
||||
|
||||
+63
-32
@@ -12,6 +12,7 @@
|
||||
#include "lc_qupdatedialog.h"
|
||||
#include "lc_qaboutdialog.h"
|
||||
#include "lc_setsdatabasedialog.h"
|
||||
#include "lc_qhtmldialog.h"
|
||||
#include "lc_renderdialog.h"
|
||||
#include "lc_profile.h"
|
||||
#include "view.h"
|
||||
@@ -1008,6 +1009,67 @@ void lcMainWindow::ShowAboutDialog()
|
||||
Dialog.exec();
|
||||
}
|
||||
|
||||
void lcMainWindow::ShowHTMLDialog()
|
||||
{
|
||||
lcHTMLDialogOptions Options;
|
||||
|
||||
QString FileName = lcGetActiveProject()->GetFileName();
|
||||
|
||||
if (!FileName.isEmpty())
|
||||
Options.PathName = QFileInfo(FileName).canonicalPath();
|
||||
|
||||
int ImageOptions = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_OPTIONS);
|
||||
int HTMLOptions = lcGetProfileInt(LC_PROFILE_HTML_OPTIONS);
|
||||
|
||||
Options.TransparentImages = (ImageOptions & LC_IMAGE_TRANSPARENT) != 0;
|
||||
Options.SubModels = (HTMLOptions & (LC_HTML_SUBMODELS)) != 0;
|
||||
Options.CurrentOnly = (HTMLOptions & LC_HTML_CURRENT_ONLY) != 0;
|
||||
Options.SinglePage = (HTMLOptions & LC_HTML_SINGLEPAGE) != 0;
|
||||
Options.IndexPage = (HTMLOptions & LC_HTML_INDEX) != 0;
|
||||
Options.StepImagesWidth = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_WIDTH);
|
||||
Options.StepImagesHeight = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_HEIGHT);
|
||||
Options.HighlightNewParts = (HTMLOptions & LC_HTML_HIGHLIGHT) != 0;
|
||||
Options.PartsListStep = (HTMLOptions & LC_HTML_LISTSTEP) != 0;
|
||||
Options.PartsListEnd = (HTMLOptions & LC_HTML_LISTEND) != 0;
|
||||
Options.PartsListImages = (HTMLOptions & LC_HTML_IMAGES) != 0;
|
||||
Options.PartImagesColor = lcGetColorIndex(lcGetProfileInt(LC_PROFILE_HTML_PARTS_COLOR));
|
||||
Options.PartImagesWidth = lcGetProfileInt(LC_PROFILE_HTML_PARTS_WIDTH);
|
||||
Options.PartImagesHeight = lcGetProfileInt(LC_PROFILE_HTML_PARTS_HEIGHT);
|
||||
|
||||
lcQHTMLDialog Dialog(this, &Options);
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
HTMLOptions = 0;
|
||||
|
||||
if (Options.SubModels)
|
||||
HTMLOptions |= LC_HTML_SUBMODELS;
|
||||
if (Options.CurrentOnly)
|
||||
HTMLOptions |= LC_HTML_CURRENT_ONLY;
|
||||
if (Options.SinglePage)
|
||||
HTMLOptions |= LC_HTML_SINGLEPAGE;
|
||||
if (Options.IndexPage)
|
||||
HTMLOptions |= LC_HTML_INDEX;
|
||||
if (Options.HighlightNewParts)
|
||||
HTMLOptions |= LC_HTML_HIGHLIGHT;
|
||||
if (Options.PartsListStep)
|
||||
HTMLOptions |= LC_HTML_LISTSTEP;
|
||||
if (Options.PartsListEnd)
|
||||
HTMLOptions |= LC_HTML_LISTEND;
|
||||
if (Options.PartsListImages)
|
||||
HTMLOptions |= LC_HTML_IMAGES;
|
||||
|
||||
lcSetProfileInt(LC_PROFILE_HTML_IMAGE_OPTIONS, Options.TransparentImages ? LC_IMAGE_TRANSPARENT : 0);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_OPTIONS, HTMLOptions);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_IMAGE_WIDTH, Options.StepImagesWidth);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_IMAGE_HEIGHT, Options.StepImagesHeight);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_PARTS_COLOR, lcGetColorCode(Options.PartImagesColor));
|
||||
lcSetProfileInt(LC_PROFILE_HTML_PARTS_WIDTH, Options.PartImagesWidth);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_PARTS_HEIGHT, Options.PartImagesHeight);
|
||||
|
||||
lcGetActiveProject()->ExportHTML(Options);
|
||||
}
|
||||
|
||||
void lcMainWindow::ShowRenderDialog()
|
||||
{
|
||||
lcRenderDialog Dialog(this);
|
||||
@@ -1048,37 +1110,6 @@ void lcMainWindow::SetSelectionMode(lcSelectionMode SelectionMode)
|
||||
UpdateSelectionMode();
|
||||
}
|
||||
|
||||
// todo: call dialogs directly
|
||||
#include "lc_qhtmldialog.h"
|
||||
#include "lc_qpropertiesdialog.h"
|
||||
#include "lc_qpreferencesdialog.h"
|
||||
|
||||
bool lcMainWindow::DoDialog(LC_DIALOG_TYPE Type, void* Data)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case LC_DIALOG_EXPORT_HTML:
|
||||
{
|
||||
lcQHTMLDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_PROPERTIES:
|
||||
{
|
||||
lcQPropertiesDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
|
||||
case LC_DIALOG_PREFERENCES:
|
||||
{
|
||||
lcQPreferencesDialog Dialog(this, Data);
|
||||
return Dialog.exec() == QDialog::Accepted;
|
||||
} break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void lcMainWindow::RemoveAllModelTabs()
|
||||
{
|
||||
while (mModelTabWidget->count() > 1)
|
||||
@@ -2081,7 +2112,7 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
||||
break;
|
||||
|
||||
case LC_FILE_EXPORT_HTML:
|
||||
lcGetActiveProject()->ExportHTML();
|
||||
ShowHTMLDialog();
|
||||
break;
|
||||
|
||||
case LC_FILE_EXPORT_BRICKLINK:
|
||||
|
||||
@@ -229,8 +229,6 @@ public:
|
||||
return mShadingMenu;
|
||||
}
|
||||
|
||||
bool DoDialog(LC_DIALOG_TYPE Type, void* Data);
|
||||
|
||||
void RemoveAllModelTabs();
|
||||
void SetCurrentModelTab(lcModel* Model);
|
||||
void ResetCameras();
|
||||
@@ -324,6 +322,7 @@ protected:
|
||||
void ShowSearchDialog();
|
||||
void ShowUpdatesDialog();
|
||||
void ShowAboutDialog();
|
||||
void ShowHTMLDialog();
|
||||
void ShowRenderDialog();
|
||||
void ShowPrintDialog();
|
||||
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@
|
||||
#include "lc_qgroupdialog.h"
|
||||
#include "lc_qeditgroupsdialog.h"
|
||||
#include "lc_selectbycolordialog.h"
|
||||
#include "lc_qpropertiesdialog.h"
|
||||
#include "lc_qutils.h"
|
||||
#include "lc_lxf.h"
|
||||
|
||||
@@ -4050,7 +4051,8 @@ void lcModel::ShowPropertiesDialog()
|
||||
|
||||
GetPartsList(gDefaultColor, true, Options.PartsList);
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_PROPERTIES, &Options))
|
||||
lcQPropertiesDialog Dialog(gMainWindow, &Options);
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
if (Options.SetDefault)
|
||||
|
||||
+1
-54
@@ -1626,61 +1626,8 @@ void Project::CreateHTMLPieceList(QTextStream& Stream, lcModel* Model, lcStep St
|
||||
Stream << QLatin1String("</table>\r\n<br>");
|
||||
}
|
||||
|
||||
void Project::ExportHTML()
|
||||
void Project::ExportHTML(const lcHTMLDialogOptions& Options)
|
||||
{
|
||||
lcHTMLDialogOptions Options;
|
||||
|
||||
if (!mFileName.isEmpty())
|
||||
Options.PathName = QFileInfo(mFileName).canonicalPath();
|
||||
|
||||
int ImageOptions = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_OPTIONS);
|
||||
int HTMLOptions = lcGetProfileInt(LC_PROFILE_HTML_OPTIONS);
|
||||
|
||||
Options.TransparentImages = (ImageOptions & LC_IMAGE_TRANSPARENT) != 0;
|
||||
Options.SubModels = (HTMLOptions & (LC_HTML_SUBMODELS)) != 0;
|
||||
Options.CurrentOnly = (HTMLOptions & LC_HTML_CURRENT_ONLY) != 0;
|
||||
Options.SinglePage = (HTMLOptions & LC_HTML_SINGLEPAGE) != 0;
|
||||
Options.IndexPage = (HTMLOptions & LC_HTML_INDEX) != 0;
|
||||
Options.StepImagesWidth = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_WIDTH);
|
||||
Options.StepImagesHeight = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_HEIGHT);
|
||||
Options.HighlightNewParts = (HTMLOptions & LC_HTML_HIGHLIGHT) != 0;
|
||||
Options.PartsListStep = (HTMLOptions & LC_HTML_LISTSTEP) != 0;
|
||||
Options.PartsListEnd = (HTMLOptions & LC_HTML_LISTEND) != 0;
|
||||
Options.PartsListImages = (HTMLOptions & LC_HTML_IMAGES) != 0;
|
||||
Options.PartImagesColor = lcGetColorIndex(lcGetProfileInt(LC_PROFILE_HTML_PARTS_COLOR));
|
||||
Options.PartImagesWidth = lcGetProfileInt(LC_PROFILE_HTML_PARTS_WIDTH);
|
||||
Options.PartImagesHeight = lcGetProfileInt(LC_PROFILE_HTML_PARTS_HEIGHT);
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_EXPORT_HTML, &Options))
|
||||
return;
|
||||
|
||||
HTMLOptions = 0;
|
||||
|
||||
if (Options.SubModels)
|
||||
HTMLOptions |= LC_HTML_SUBMODELS;
|
||||
if (Options.CurrentOnly)
|
||||
HTMLOptions |= LC_HTML_CURRENT_ONLY;
|
||||
if (Options.SinglePage)
|
||||
HTMLOptions |= LC_HTML_SINGLEPAGE;
|
||||
if (Options.IndexPage)
|
||||
HTMLOptions |= LC_HTML_INDEX;
|
||||
if (Options.HighlightNewParts)
|
||||
HTMLOptions |= LC_HTML_HIGHLIGHT;
|
||||
if (Options.PartsListStep)
|
||||
HTMLOptions |= LC_HTML_LISTSTEP;
|
||||
if (Options.PartsListEnd)
|
||||
HTMLOptions |= LC_HTML_LISTEND;
|
||||
if (Options.PartsListImages)
|
||||
HTMLOptions |= LC_HTML_IMAGES;
|
||||
|
||||
lcSetProfileInt(LC_PROFILE_HTML_IMAGE_OPTIONS, Options.TransparentImages ? LC_IMAGE_TRANSPARENT : 0);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_OPTIONS, HTMLOptions);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_IMAGE_WIDTH, Options.StepImagesWidth);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_IMAGE_HEIGHT, Options.StepImagesHeight);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_PARTS_COLOR, lcGetColorCode(Options.PartImagesColor));
|
||||
lcSetProfileInt(LC_PROFILE_HTML_PARTS_WIDTH, Options.PartImagesWidth);
|
||||
lcSetProfileInt(LC_PROFILE_HTML_PARTS_HEIGHT, Options.PartImagesHeight);
|
||||
|
||||
QDir Dir(Options.PathName);
|
||||
Dir.mkpath(QLatin1String("."));
|
||||
|
||||
|
||||
+3
-1
@@ -4,6 +4,8 @@
|
||||
#include "lc_array.h"
|
||||
#include "lc_application.h"
|
||||
|
||||
struct lcHTMLDialogOptions;
|
||||
|
||||
#define LC_SCENE_BG 0x010 // Draw bg image
|
||||
#define LC_SCENE_BG_TILE 0x040 // Tile bg image
|
||||
#define LC_SCENE_GRADIENT 0x100 // Draw gradient
|
||||
@@ -78,7 +80,7 @@ public:
|
||||
void ExportBrickLink();
|
||||
void ExportCOLLADA(const QString& FileName);
|
||||
void ExportCSV();
|
||||
void ExportHTML();
|
||||
void ExportHTML(const lcHTMLDialogOptions& Options);
|
||||
bool ExportPOVRay(const QString& FileName);
|
||||
void ExportWavefront(const QString& FileName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user