fix bug #21 (erroneously exiting the UI when trying to export an image on OSX)
parent
e609c8fb39
commit
ef583fec48
|
@ -24,7 +24,6 @@ vars.Add('CXX', 'C++ compiler')
|
|||
vars.Add('CC', 'C compiler')
|
||||
vars.Add('CXXFLAGS', 'C++ flags')
|
||||
vars.Add('CCFLAGS', 'C compiler flags')
|
||||
vars.Add('STRIP', 'Program for stripping away unused symbols')
|
||||
vars.Add('SHCXXFLAGS', 'C++ flags (for shared libraries)')
|
||||
vars.Add('LINK', 'Linker')
|
||||
vars.Add('LINKFLAGS', 'Linker flags')
|
||||
|
@ -217,18 +216,12 @@ else:
|
|||
env = conf.Finish()
|
||||
dist = GetOption('dist') != None
|
||||
|
||||
def stripinst_build_function(self, target, source, pkgname = None, use_own = None):
|
||||
inst = self.Install(target, source)
|
||||
self.AddPostAction(inst, env['STRIP'] + ' $TARGET')
|
||||
return inst
|
||||
|
||||
def osxlibinst_build_function(self, target, source, pkgname = None, use_own = None):
|
||||
inst = self.Install(target, source)
|
||||
prefix, name = os.path.split(source)
|
||||
self.AddPostAction(inst, 'install_name_tool -id @executable_path/../Frameworks/' + name + ' $TARGET')
|
||||
return inst
|
||||
|
||||
env.__class__.StripInst = stripinst_build_function
|
||||
env.__class__.OSXLibInst = osxlibinst_build_function
|
||||
|
||||
if hasCollada:
|
||||
|
|
|
@ -1206,25 +1206,42 @@ inline float toSRGB(float value) {
|
|||
}
|
||||
|
||||
void MainWindow::on_actionExportImage_triggered() {
|
||||
SceneContext *ctx = m_context[ui->tabBar->currentIndex()];
|
||||
QFileDialog dialog(this, tr("Export image .."),
|
||||
QFileDialog *dialog = new QFileDialog(this, tr("Export image .."),
|
||||
"", tr("All supported formats (*.exr *.png);;Linear EXR Image (*.exr)"
|
||||
";; Tonemapped 8-bit PNG Image (*.png)"));
|
||||
|
||||
QSettings settings("mitsuba-renderer.org", "qtgui");
|
||||
dialog.setViewMode(QFileDialog::Detail);
|
||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||
dialog->setViewMode(QFileDialog::Detail);
|
||||
dialog->setAcceptMode(QFileDialog::AcceptSave);
|
||||
|
||||
#if defined(__OSX__)
|
||||
dialog.setOption(QFileDialog::DontUseNativeDialog, true);
|
||||
dialog->setOption(QFileDialog::DontUseNativeDialog, true);
|
||||
#endif
|
||||
|
||||
dialog.restoreState(settings.value("fileDialogState").toByteArray());
|
||||
dialog->restoreState(settings.value("fileDialogState").toByteArray());
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setWindowModality(Qt::WindowModal);
|
||||
connect(dialog, SIGNAL(finished(int)), this, SLOT(onExportDialogClose(int)));
|
||||
m_currentChild = dialog;
|
||||
// prevent a tab drawing artifact on Qt/OSX
|
||||
m_activeWindowHack = true;
|
||||
dialog->show();
|
||||
qApp->processEvents();
|
||||
m_activeWindowHack = false;
|
||||
}
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString fileName = dialog.selectedFiles().value(0);
|
||||
void MainWindow::onExportDialogClose(int reason) {
|
||||
int currentIndex = ui->tabBar->currentIndex();
|
||||
SceneContext *ctx = m_context[currentIndex];
|
||||
|
||||
QSettings settings("mitsuba-renderer.org", "qtgui");
|
||||
QFileDialog *dialog = static_cast<QFileDialog *>(sender());
|
||||
m_currentChild = NULL;
|
||||
|
||||
if (reason == QDialog::Accepted) {
|
||||
QString fileName = dialog->selectedFiles().value(0);
|
||||
Bitmap::EFileFormat format;
|
||||
settings.setValue("fileDialogState", dialog.saveState());
|
||||
settings.setValue("fileDialogState", dialog->saveState());
|
||||
|
||||
if (fileName.endsWith(".exr")) {
|
||||
format = Bitmap::EEXR;
|
||||
|
|
|
@ -150,6 +150,7 @@ private slots:
|
|||
void onPreviewSettingsClose();
|
||||
void onOpenDialogClose(int reason);
|
||||
void onSaveAsDialogClose(int reason);
|
||||
void onExportDialogClose(int reason);
|
||||
void onRenderSettingsClose(int reason);
|
||||
void onImportDialogClose(int reason);
|
||||
|
||||
|
|
Loading…
Reference in New Issue