[labplot/frameworks] /: merge fixes

Stefan Gerlach null at kde.org
Wed Dec 28 12:44:06 UTC 2016


Git commit d784a331f99615913369bf554fb93e144dff0ff8 by Stefan Gerlach.
Committed on 28/12/2016 at 12:43.
Pushed by sgerlach into branch 'frameworks'.

merge fixes

M  +2    -2    CMakeLists.txt
M  +304  -269  doc/index.docbook
M  +4    -0    src/backend/core/Project.cpp
M  +2    -4    src/backend/core/column/Column.cpp
M  +15   -7    src/backend/datasources/filters/HDFFilter.cpp
M  +85   -103  src/backend/gsl/ExpressionParser.cpp
M  +21   -26   src/backend/worksheet/TextLabel.cpp
M  +0    -3    src/backend/worksheet/plots/cartesian/Axis.cpp
M  +7    -1    src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
M  +27   -2    src/backend/worksheet/plots/cartesian/XYCurve.cpp
M  +451  -243  src/backend/worksheet/plots/cartesian/XYFitCurve.cpp
M  +6    -16   src/backend/worksheet/plots/cartesian/XYInterpolationCurve.cpp
M  +7    -0    src/commonfrontend/ProjectExplorer.cpp
M  +6    -4    src/commonfrontend/matrix/MatrixView.cpp
M  +97   -108  src/commonfrontend/spreadsheet/SpreadsheetView.cpp
M  +24   -13   src/kdefrontend/HistoryDialog.cpp
M  +0    -3    src/kdefrontend/SettingsDialog.cpp
M  +8    -7    src/kdefrontend/SettingsGeneralPage.cpp
M  +58   -40   src/kdefrontend/dockwidgets/AxisDock.cpp
M  +360  -173  src/kdefrontend/dockwidgets/XYFitCurveDock.cpp
M  +2    -1    src/kdefrontend/dockwidgets/XYIntegrationCurveDock.cpp
M  +10   -1    src/kdefrontend/dockwidgets/XYInterpolationCurveDock.cpp
M  +1    -0    src/kdefrontend/widgets/FitParametersWidget.cpp
M  +48   -13   src/kdefrontend/widgets/LabelWidget.cpp
M  +2    -1    src/kdefrontend/widgets/LabelWidget.h
M  +83   -41   src/tools/TeXRenderer.cpp

https://commits.kde.org/labplot/d784a331f99615913369bf554fb93e144dff0ff8

diff --cc CMakeLists.txt
index 2f7ad1c3,f1d3f9af..4722fc6a
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -5,41 -4,18 +5,41 @@@ cmake_minimum_required(VERSION 3.2.0
  find_package(ECM 1.3.0 REQUIRED NO_MODULE)
  set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
  
 -find_package(Qt4 REQUIRED)
 -find_package(KDE4 REQUIRED)
 +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
 +	Concurrent
 +	Gui
 +	PrintSupport
 +	Svg
 +	Widgets
 +)
 +find_package(KF5 REQUIRED COMPONENTS
 +	Archive
 +	Completion
 +	Config
 +	ConfigWidgets
 +	CoreAddons
 +	DocTools
 +	I18n
 +	IconThemes
 +	KDELibs4Support
 +	KIO
 +	NewStuff
 +	TextWidgets
 +	WidgetsAddons
 +	XmlGui
 +)
  
 +include(FeatureSummary)
  include(ECMInstallIcons)
  include(KDEInstallDirs)
 -include(KDE4Defaults)
 +include(KDECompilerSettings)
 +include(KDECMakeSettings)
  
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -Wunused -fno-omit-frame-pointer -fstack-protector -fno-exceptions")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -Wunused -fno-omit-frame-pointer -fstack-protector -fno-exceptions")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -Wunused -Wswitch-enum -fno-omit-frame-pointer -fstack-protector -fno-exceptions")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -Wunused -Wswitch-enum -fno-omit-frame-pointer -fstack-protector -fno-exceptions")
  
 -add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
 -include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
 +add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
 +include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
  set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
  add_definitions (-DLVERSION=\"2.3.0\")
  # add_definitions (-DLDEBUG='1')
diff --cc src/backend/worksheet/plots/cartesian/Axis.cpp
index 9f32c845,42e8fea8..9aa9b92c
--- a/src/backend/worksheet/plots/cartesian/Axis.cpp
+++ b/src/backend/worksheet/plots/cartesian/Axis.cpp
@@@ -45,11 -45,9 +45,9 @@@
  
  #include "kdefrontend/GuiTools.h"
  #include <KConfigGroup>
 -#include <KIcon>
 +#include <QIcon>
  #include <KLocale>
  
- #include <cmath>
  #include <cfloat>
  
  /**
diff --cc src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
index e18d50a3,2371448f..c9666c60
--- a/src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
+++ b/src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
@@@ -2221,9 -2226,9 +2227,9 @@@ void CartesianPlot::loadTheme(KConfig& 
  	//load the color palettes for the curves
  	this->setColorPalette(config);
  
- 	//load the theme for all the childred
+ 	//load the theme for all the children
  	const QList<WorksheetElement*>& childElements = children<WorksheetElement>(AbstractAspect::IncludeHidden);
 -	foreach(WorksheetElement* child, childElements)
 +	foreach (WorksheetElement *child, childElements)
  		child->loadThemeConfig(config);
  
  	Q_D(CartesianPlot);
diff --cc src/backend/worksheet/plots/cartesian/XYCurve.cpp
index 2a4ca866,55d681ff..b1e7ca95
--- a/src/backend/worksheet/plots/cartesian/XYCurve.cpp
+++ b/src/backend/worksheet/plots/cartesian/XYCurve.cpp
@@@ -148,6 -151,9 +150,9 @@@ void XYCurve::initActions() 
  	visibilityAction = new QAction(i18n("visible"), this);
  	visibilityAction->setCheckable(true);
  	connect(visibilityAction, SIGNAL(triggered()), this, SLOT(visibilityChanged()));
+ 
 -	navigateToAction = new QAction(KIcon("go-next-view"), "", this);
++	navigateToAction = new QAction(QIcon::fromTheme("go-next-view"), "", this);
+ 	connect(navigateToAction, SIGNAL(triggered()), this, SLOT(navigateTo()));
  }
  
  QMenu* XYCurve::createContextMenu() {
diff --cc src/kdefrontend/HistoryDialog.cpp
index 7b8b0577,a3f84ab2..c61f25b6
--- a/src/kdefrontend/HistoryDialog.cpp
+++ b/src/kdefrontend/HistoryDialog.cpp
@@@ -38,35 -37,46 +37,47 @@@
  
  	\ingroup kdefrontend
   */
- HistoryDialog::HistoryDialog(QWidget* parent, QUndoStack* stack, QString& emptyLabel) : KDialog(parent){
- 	m_undoStack = stack;
+ HistoryDialog::HistoryDialog(QWidget* parent, QUndoStack* stack, const QString& emptyLabel) : KDialog(parent), m_undoStack(stack) {
  	QUndoView* undoView = new QUndoView(stack, this);
 -	undoView->setCleanIcon( KIcon("edit-clear-history") );
 +	undoView->setCleanIcon( QIcon::fromTheme("edit-clear-history") );
  	undoView->setEmptyLabel(emptyLabel);
 +	undoView->setMinimumWidth(350);
  	undoView->setWhatsThis(i18n("List of all performed steps/actions.\n"
- 			"Select an item in the list to navigate to the corresponding step."));
+ 	                            "Select an item in the list to navigate to the corresponding step."));
  	setMainWidget(undoView);
  
 -	setWindowIcon( KIcon("view-history") );
 +	setWindowIcon( QIcon::fromTheme("view-history") );
  	setWindowTitle(i18n("Undo/Redo History"));
  	showButtonSeparator(true);
-     setAttribute(Qt::WA_DeleteOnClose);
+ 	setAttribute(Qt::WA_DeleteOnClose);
+ 
  	if (stack->count()) {
  		setButtons( KDialog::Ok | KDialog::User1 | KDialog::Cancel );
  		setButtonToolTip(KDialog::User1, i18n("Clears the undo history. Commands are not undone or redone; the state of the project remains unchanged."));
 -		setButtonIcon(KDialog::User1, KIcon("edit-clear"));
 +		setButtonIcon(KDialog::User1, QIcon::fromTheme("edit-clear"));
  		setButtonText(KDialog::User1, i18n("Clear"));
  		connect(this,SIGNAL(user1Clicked()), this, SLOT(clearUndoStack()));
- 	}else{
+ 	} else
  		setButtons( KDialog::Ok | KDialog::Cancel );
- 	}
+ 
+ 	//restore saved dialog size if available
+ 	KConfigGroup conf(KSharedConfig::openConfig(), "HistoryDialog");
+ 	if (conf.exists())
+ 		restoreDialogSize(conf);
+ 	else
+ 		resize( QSize(500, 300).expandedTo(minimumSize()) );
+ }
+ 
+ HistoryDialog::~HistoryDialog() {
+ 	//save dialog size
+ 	KConfigGroup conf(KSharedConfig::openConfig(), "HistoryDialog");
+ 	saveDialogSize(conf);
  }
  
- void HistoryDialog::clearUndoStack(){
+ void HistoryDialog::clearUndoStack() {
  	if (KMessageBox::questionYesNo( this,
- 									i18n("Do you really want to clear the undo history?"),
- 									i18n("Clear history")
- 								  ) == KMessageBox::Yes)
+ 	                                i18n("Do you really want to clear the undo history?"),
+ 	                                i18n("Clear history")
+ 	                              ) == KMessageBox::Yes)
  		m_undoStack->clear();
  }
diff --cc src/kdefrontend/SettingsDialog.cpp
index fad6a502,35ac8d9f..524ff92e
--- a/src/kdefrontend/SettingsDialog.cpp
+++ b/src/kdefrontend/SettingsDialog.cpp
@@@ -45,43 -38,18 +45,40 @@@
   *
   */
  SettingsDialog::SettingsDialog(QWidget* parent) : KPageDialog(parent), m_changed(false) {
- 	const QSize minSize = minimumSize();
- 	setMinimumSize(QSize(512, minSize.height()));
- 
  	setFaceType(List);
 -	setCaption(i18n("Preferences"));
 -	setWindowIcon(KIcon("preferences-other"));
 -	setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Default);
 -	setDefaultButton(KDialog::Ok);
 -	enableButton(KDialog::Apply, false);
 -    setAttribute(Qt::WA_DeleteOnClose);
 +	setWindowTitle(i18n("Preferences"));
 +	setWindowIcon(QIcon::fromTheme("preferences-other"));
 +
 +	//setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
 +	connect(this, &QDialog::accepted, this, &SettingsDialog::onOkButton);
 +	//connect(this, &KPageDialog::applyClicked, this, &SettingsDialog::onApplyButton);
 +	//TODO: enableButtonApply(false);
 +	setAttribute(Qt::WA_DeleteOnClose);
  
  	generalPage = new SettingsGeneralPage(this);
 -	KPageWidgetItem* generalFrame = addPage(generalPage, i18n("General"));
 -	generalFrame->setIcon(KIcon("system-run"));
  	connect(generalPage, SIGNAL(settingsChanged()), this, SLOT(changed()));
 +	KPageWidgetItem* generalFrame = addPage(generalPage, i18n("General"));
 +	generalFrame->setIcon(QIcon::fromTheme("system-run"));
 +
 +	//QPushButton* defaultbutton = dialogButtonBox->addButton(QDialogButtonBox::RestoreDefaults);
 +	//connect( defaultbutton, &QAbstractButton::clicked, this, &SettingsDialog::onRestoreDefaultsButton );
 +
 +	// unused
 +	//QVBoxLayout* layout = new QVBoxLayout;
 +	//layout->addWidget( dialogButtonBox );
 +	//setLayout( layout );
 +
 +//     printingPage = new SettingsPrintingPage(mainWindow, this);
 +//     KPageWidgetItem* printingFrame = addPage(printingPage, i18nc("@title:group", "Print"));
 +//     printingFrame->setIcon(KIcon("document-print"));
 +
 +	const KConfigGroup dialogConfig = KSharedConfig::openConfig()->group("SettingsDialog");
 +	KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
 +}
 +
 +SettingsDialog::~SettingsDialog(){
 +	KConfigGroup dialogConfig = KSharedConfig::openConfig()->group("SettingsDialog");
 +	KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
  
  	worksheetPage = new SettingsWorksheetPage(this);
  	KPageWidgetItem* worksheetFrame = addPage(worksheetPage, i18n("Worksheet"));
diff --cc src/kdefrontend/SettingsGeneralPage.cpp
index a39f2c04,dc5f7656..469e9b2f
--- a/src/kdefrontend/SettingsGeneralPage.cpp
+++ b/src/kdefrontend/SettingsGeneralPage.cpp
@@@ -45,21 -38,6 +45,21 @@@ SettingsGeneralPage::SettingsGeneralPag
  	ui.setupUi(this);
  	retranslateUi();
  
- 	ui.lLatexWarning->setPixmap( QIcon::fromTheme("state-warning").pixmap(QSize(48,48)) );
++//TODO	ui.lLatexWarning->setPixmap( QIcon::fromTheme("state-warning").pixmap(QSize(48,48)) );
 +
 +	//add available TeX typesetting engines
- 	if (TeXRenderer::executableExists(QLatin1String("lualatex")))
++/*TODO	if (TeXRenderer::executableExists(QLatin1String("lualatex")))
 +		ui.cbTexEngine->addItem(QLatin1String("LuaLaTeX"), QLatin1String("lualatex"));
 +
 +	if (TeXRenderer::executableExists(QLatin1String("xelatex")))
 +		ui.cbTexEngine->addItem(QLatin1String("XeLaTex"), QLatin1String("xelatex"));
 +
 +	if (TeXRenderer::executableExists(QLatin1String("pdflatex")))
 +		ui.cbTexEngine->addItem(QLatin1String("pdfLaTeX"), QLatin1String("pdflatex"));
 +
 +	if (TeXRenderer::executableExists(QLatin1String("latex")))
 +		ui.cbTexEngine->addItem(QLatin1String("LaTeX"), QLatin1String("latex"));
- 
++*/
  	connect(ui.cbLoadOnStart, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()) );
  	connect(ui.cbInterface, SIGNAL(currentIndexChanged(int)), this, SLOT(interfaceChanged(int)) );
  	connect(ui.cbMdiVisibility, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()) );
@@@ -70,40 -48,28 +70,41 @@@
  	interfaceChanged(ui.cbInterface->currentIndex());
  }
  
 -void SettingsGeneralPage::applySettings() {
 -	KConfigGroup group = KGlobal::config()->group(QLatin1String("Settings_General"));
 -	group.writeEntry(QLatin1String("LoadOnStart"), ui.cbLoadOnStart->currentIndex());
 -	group.writeEntry(QLatin1String("ViewMode"), ui.cbInterface->currentIndex());
 -	group.writeEntry(QLatin1String("TabPosition"), ui.cbTabPosition->currentIndex());
 -	group.writeEntry(QLatin1String("MdiWindowVisibility"), ui.cbMdiVisibility->currentIndex());
 -	group.writeEntry(QLatin1String("AutoSave"), ui.chkAutoSave->isChecked());
 -	group.writeEntry(QLatin1String("AutoSaveInterval"), ui.sbAutoSaveInterval->value());
 +void SettingsGeneralPage::applySettings(){
 +	KConfigGroup group = KSharedConfig::openConfig()->group( "Settings_General" );
 +	group.writeEntry("LoadOnStart", ui.cbLoadOnStart->currentIndex());
 +	group.writeEntry("ViewMode", ui.cbInterface->currentIndex());
 +	group.writeEntry("TabPosition", ui.cbTabPosition->currentIndex());
 +	group.writeEntry("MdiWindowVisibility", ui.cbMdiVisibility->currentIndex());
 +	group.writeEntry("AutoSave", ui.chkAutoSave->isChecked());
 +	group.writeEntry("AutoSaveInterval", ui.sbAutoSaveInterval->value());
- 	group.writeEntry("DoubleBuffering", ui.chkDoubleBuffering->isChecked());
- 	group.writeEntry("LaTeXEngine", ui.cbTexEngine->itemData(ui.cbTexEngine->currentIndex()));
++//TODO	group.writeEntry("DoubleBuffering", ui.chkDoubleBuffering->isChecked());
++//TODO	group.writeEntry("LaTeXEngine", ui.cbTexEngine->itemData(ui.cbTexEngine->currentIndex()));
  }
  
 -void SettingsGeneralPage::restoreDefaults() {
 +void SettingsGeneralPage::restoreDefaults(){
  	loadSettings();
  }
  
 -void SettingsGeneralPage::loadSettings() {
 -	const KConfigGroup group = KGlobal::config()->group(QLatin1String("Settings_General"));
 -	ui.cbLoadOnStart->setCurrentIndex(group.readEntry(QLatin1String("LoadOnStart"), 0));
 -	ui.cbInterface->setCurrentIndex(group.readEntry(QLatin1String("ViewMode"), 0));
 -	ui.cbTabPosition->setCurrentIndex(group.readEntry(QLatin1String("TabPosition"), 0));
 -	ui.cbMdiVisibility->setCurrentIndex(group.readEntry(QLatin1String("MdiWindowVisibility"), 0));
 -	ui.chkAutoSave->setChecked(group.readEntry<bool>(QLatin1String("AutoSave"), 0));
 -	ui.sbAutoSaveInterval->setValue(group.readEntry(QLatin1String("AutoSaveInterval"), 0));
 +void SettingsGeneralPage::loadSettings(){
 +	const KConfigGroup group = KSharedConfig::openConfig()->group( "Settings_General" );
 +	ui.cbLoadOnStart->setCurrentIndex(group.readEntry("LoadOnStart", 0));
 +	ui.cbInterface->setCurrentIndex(group.readEntry("ViewMode", 0));
 +	ui.cbTabPosition->setCurrentIndex(group.readEntry("TabPosition", 0));
 +	ui.cbMdiVisibility->setCurrentIndex(group.readEntry("MdiWindowVisibility", 0));
 +	ui.chkAutoSave->setChecked(group.readEntry<bool>("AutoSave", 0));
 +	ui.sbAutoSaveInterval->setValue(group.readEntry("AutoSaveInterval", 0));
- 	ui.chkDoubleBuffering->setChecked(group.readEntry<bool>("DoubleBuffering", 1));
++//TODO	ui.chkDoubleBuffering->setChecked(group.readEntry<bool>("DoubleBuffering", 1));
 +
 +	QString engine = group.readEntry("LaTeXEngine", "");
 +	int index = -1;
- 	if (engine.isEmpty())
++/*TODO	if (engine.isEmpty())
 +		index = ui.cbTexEngine->findData("xelatex");
 +	else
 +		index = ui.cbTexEngine->findData(engine);
 +
 +	ui.cbTexEngine->setCurrentIndex(index);
++*/
  }
  
  void SettingsGeneralPage::retranslateUi() {
diff --cc src/kdefrontend/dockwidgets/XYFitCurveDock.cpp
index 8c8b3bcb,6a817425..dbc59e86
--- a/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp
+++ b/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp
@@@ -83,15 -83,16 +83,17 @@@ void XYFitCurveDock::setupGeneral() 
  	cbWeightsColumn = new TreeViewComboBox(generalTab);
  	gridLayout->addWidget(cbWeightsColumn, 6, 4, 1, 2);
  
- 	for(int i=0; i < NSL_FIT_MODEL_TYPE_COUNT; i++)
- 		uiGeneralTab.cbModel->addItem(nsl_fit_model_name[i]);
+ 	for(int i = 0; i < NSL_FIT_MODEL_CATEGORY_COUNT; i++)
+ 		uiGeneralTab.cbCategory->addItem(nsl_fit_model_category_name[i]);
+ 	//show the fit-model category for the currently selected default (first) fit-model category
+ 	categoryChanged(uiGeneralTab.cbCategory->currentIndex());
  
- 	uiGeneralTab.teEquation->setMaximumHeight(uiGeneralTab.leName->sizeHint().height()*2);
+ 	uiGeneralTab.teEquation->setMaximumHeight(uiGeneralTab.leName->sizeHint().height() * 2);
  
 -	uiGeneralTab.tbConstants->setIcon( KIcon("labplot-format-text-symbol") );
 -	uiGeneralTab.tbFunctions->setIcon( KIcon("preferences-desktop-font") );
 -	uiGeneralTab.pbRecalculate->setIcon(KIcon("run-build"));
 +	uiGeneralTab.tbConstants->setIcon( QIcon::fromTheme("labplot-format-text-symbol") );
 +	uiGeneralTab.tbFunctions->setIcon( QIcon::fromTheme("preferences-desktop-font") );
 +	uiGeneralTab.pbRecalculate->setIcon(QIcon::fromTheme("run-build"));
 +
  
  	QHBoxLayout* layout = new QHBoxLayout(ui.tabGeneral);
  	layout->setMargin(0);
diff --cc src/kdefrontend/widgets/LabelWidget.cpp
index c53a2d25,36c763f6..50ab7794
--- a/src/kdefrontend/widgets/LabelWidget.cpp
+++ b/src/kdefrontend/widgets/LabelWidget.cpp
@@@ -307,8 -307,27 +308,27 @@@ void LabelWidget::teXUsedChanged(bool c
  
  	ui.lFont->setVisible(!checked);
  	ui.kfontRequester->setVisible(!checked);
- 	ui.lFontSize->setVisible(checked);
- 	ui.sbFontSize->setVisible(checked);
+ 
+ 	if (checked) {
 -		KConfigGroup group = KGlobal::config()->group(QLatin1String("Settings_Worksheet"));
 -		QString engine = group.readEntry("LaTeXEngine", "");
 -		if (engine=="xelatex" || engine=="lualatex") {
++		KConfigGroup conf(KSharedConfig::openConfig(), "Settings_Worksheet");
++		QString engine = conf.readEntry("LaTeXEngine", "");
++		if (engine == "xelatex" || engine == "lualatex") {
+ 			ui.lFontTeX->setVisible(true);
+ 			ui.kfontRequesterTeX->setVisible(true);
+ 			ui.lFontSize->setVisible(false);
+ 			ui.sbFontSize->setVisible(false);
+ 		} else {
+ 			ui.lFontTeX->setVisible(false);
+ 			ui.kfontRequesterTeX->setVisible(false);
+ 			ui.lFontSize->setVisible(true);
+ 			ui.sbFontSize->setVisible(true);
+ 		}
+ 	} else {
+ 		ui.lFontTeX->setVisible(false);
+ 		ui.kfontRequesterTeX->setVisible(false);
+ 		ui.lFontSize->setVisible(false);
+ 		ui.sbFontSize->setVisible(false);
+ 	}
  
  	//no latex is available and the user switched to the text mode,
  	//deactivate the button since it shouldn't be possible anymore to switch to the TeX-mode
diff --cc src/tools/TeXRenderer.cpp
index 60839ad0,cea76c40..df78f292
--- a/src/tools/TeXRenderer.cpp
+++ b/src/tools/TeXRenderer.cpp
@@@ -122,51 -133,53 +134,78 @@@ QImage TeXRenderer::renderImageLaTeX(co
  }
  
  // TEX -> PDF -> PNG
- QImage TeXRenderer::imageFromPDF(const QTemporaryFile& file, const int dpi, const QString& engine) {
- 	QProcess latexProcess, convertProcess;
+ QImage TeXRenderer::imageFromPDF(const QTemporaryFile& file, const int dpi, const QString& engine, bool* success) {
+ 	QFileInfo fi(file.fileName());
+ 	QProcess latexProcess;
  	latexProcess.start(engine, QStringList() << "-interaction=batchmode" << file.fileName());
- 
- 	if (latexProcess.waitForFinished()) { // pdflatex finished
- 		QFileInfo fi(file.fileName());
+ 	if (!latexProcess.waitForFinished()) {
+ 		kWarning() << engine << "process failed." << endl;
+ 		*success = false;
  		QFile::remove(fi.completeBaseName()+".aux");
  		QFile::remove(fi.completeBaseName()+".log");
+ 		return QImage();
+ 	}
  
 -	*success = (latexProcess.exitCode()==0);
++/// HEAD
 +		//TODO: pdflatex doesn't come back with EX_OK
 +// 		if(latexProcess.exitCode() != 0)	// skip if pdflatex failed
 +// 			return QImage();
  
 -	QFile::remove(fi.completeBaseName()+".aux");
 -	QFile::remove(fi.completeBaseName()+".log");
 +		// convert: PDF -> PNG
- 		convertProcess.start("convert",  QStringList() << "-density"<< QString::number(dpi) + 'x' + QString::number(dpi)
- 														<< fi.completeBaseName() + ".pdf"
- 														<< fi.completeBaseName() + ".png");
++///		convertProcess.start("convert",  QStringList() << "-density"<< QString::number(dpi) + 'x' + QString::number(dpi)
++///														<< fi.completeBaseName() + ".pdf"
++///														<< fi.completeBaseName() + ".png");
 +
 +		// clean up and read png file
- 		if (convertProcess.waitForFinished()) {
- 			QFile::remove(fi.completeBaseName()+".pdf");
- 
- 			QImage image;
- 			image.load(fi.completeBaseName()+".png");
- 			QFile::remove(fi.completeBaseName()+".png");
- 
- 			return image;
- 		}else{
- 			QFile::remove(fi.completeBaseName()+".pdf");
- 			return QImage();
- 		}
- 	}else{
- 		qWarning()<<"pdflatex failed."<<endl;
++///		if (convertProcess.waitForFinished()) {
++///			QFile::remove(fi.completeBaseName()+".pdf");
++
++///			QImage image;
++///			image.load(fi.completeBaseName()+".png");
++///			QFile::remove(fi.completeBaseName()+".png");
++
++///			return image;
++///		}else{
++///			QFile::remove(fi.completeBaseName()+".pdf");
++///			return QImage();
++///		}
++///	}else{
++///		qWarning()<<"pdflatex failed."<<endl;
++	*success = (latexProcess.exitCode() == 0);
++
++	QFile::remove(fi.completeBaseName() + ".aux");
++	QFile::remove(fi.completeBaseName() + ".log");
+ 
+ 	// convert: PDF -> PNG
+ 	QProcess convertProcess;
+ 	convertProcess.start("convert",  QStringList() << "-density"<< QString::number(dpi) + 'x' + QString::number(dpi)
+ 													<< fi.completeBaseName() + ".pdf"
+ 													<< fi.completeBaseName() + ".png");
+ 	if (!convertProcess.waitForFinished()) {
+ 		kWarning() << "convert process failed." << endl;
+ 		*success = false;
+ 		QFile::remove(fi.completeBaseName()+".pdf");
  		return QImage();
  	}
+ 
+ 	// read png file and clean up
+ 	QImage image;
+ 	image.load(fi.completeBaseName()+".png");
+ 
+ 	// final clean up
+ 	QFile::remove(fi.completeBaseName()+".png");
+ 	QFile::remove(fi.completeBaseName()+".pdf");
+ 
+ 	return image;
  }
  
  // TEX -> DVI -> PS -> PNG
- QImage TeXRenderer::imageFromDVI(const QTemporaryFile& file, const int dpi) {
- 	QProcess latexProcess, convertProcess;
- 	latexProcess.start("latex", QStringList() << "-interaction=batchmode" << file.fileName());
- 
+ QImage TeXRenderer::imageFromDVI(const QTemporaryFile& file, const int dpi, bool* success) {
  	QFileInfo fi(file.fileName());
+ 	QProcess latexProcess;
+ 	latexProcess.start("latex", QStringList() << "-interaction=batchmode" << file.fileName());
  	if (!latexProcess.waitForFinished()) {
- 		qWarning()<<"latex failed."<<endl;
 -		kWarning() << "latex process failed." << endl;
++		qWarning() << "latex process failed." << endl;
  		QFile::remove(fi.completeBaseName()+".aux");
  		QFile::remove(fi.completeBaseName()+".log");
  		return QImage();
@@@ -179,15 -194,17 +220,18 @@@
  	QProcess dvipsProcess;
  	dvipsProcess.start("dvips", QStringList() << "-E" << fi.completeBaseName());
  	if (!dvipsProcess.waitForFinished()) {
- 		qWarning()<<"dvips failed."<<endl;
 -		kWarning() << "dvips process failed." << endl;
++		qWarning() << "dvips process failed." << endl;
  		QFile::remove(fi.completeBaseName()+".dvi");
  		return QImage();
  	}
  
  	// convert: PS -> PNG
+ 	QProcess convertProcess;
  	convertProcess.start("convert", QStringList() << "-density" << QString::number(dpi) + 'x' + QString::number(dpi)  << fi.completeBaseName()+".ps" << fi.completeBaseName()+".png");
  	if (!convertProcess.waitForFinished()) {
- 		qWarning()<<"convert failed."<<endl;
++		qWarning() << "convert process failed." << endl;
+ 		kWarning() << "convert process failed." << endl;
+ 		QFile::remove(fi.completeBaseName()+".dvi");
  		QFile::remove(fi.completeBaseName()+".ps");
  		return QImage();
  	}


More information about the kde-doc-english mailing list