[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kalgebra
From:       Aleix Pol Gonzalez <aleixpol () gmail ! com>
Date:       2011-01-14 7:01:02
Message-ID: 20110114070102.140FF3E1F1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1214324 by apol:

Solved a bunch of krazy issues.


 M  +5 -1      analitzagui/functionpolar.cpp  
 M  +18 -0     mobile/analitzawrapper.cpp  
 M  +18 -0     mobile/analitzawrapper.h  
 M  +11 -10    mobile/kalgebramobile.cpp  
 M  +18 -0     mobile/widgetswrappers.cpp  
 M  +18 -0     mobile/widgetswrappers.h  
 M  +22 -17    src/kalgebra.cpp  
 M  +2 -2      src/viewportwidget.cpp  
 M  +1 -1      utils/main.cpp  


--- trunk/KDE/kdeedu/kalgebra/analitzagui/functionpolar.cpp #1214323:1214324
@@ -98,8 +98,12 @@
 };
 
 REGISTER_FUNCTION(FunctionPolar)
-static const double pi=acos(-1.);
 
+#ifndef M_PI
+#define M_PI           3.14159265358979323846
+#endif
+static const double pi=M_PI;
+
 FunctionPolar::FunctionPolar(const Expression &e, Variables* v)
 	: FunctionImpl(e, v, 0, 2*M_PI)
 	, m_th(new Cn)
--- trunk/KDE/kdeedu/kalgebra/mobile/analitzawrapper.cpp #1214323:1214324
@@ -1,3 +1,21 @@
+/*************************************************************************************
 + *  Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org>                              \
* + *                                                                                 \
* + *  This program is free software; you can redistribute it and/or                  \
* + *  modify it under the terms of the GNU General Public License                    \
* + *  as published by the Free Software Foundation; either version 2                 \
* + *  of the License, or (at your option) any later version.                         \
* + *                                                                                 \
* + *  This program is distributed in the hope that it will be useful,                \
* + *  but WITHOUT ANY WARRANTY; without even the implied warranty of                 \
* + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  \
* + *  GNU General Public License for more details.                                   \
* + *                                                                                 \
* + *  You should have received a copy of the GNU General Public License              \
* + *  along with this program; if not, write to the Free Software                    \
* + *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA \
* + *************************************************************************************/
 +
 #include "analitzawrapper.h"
 #include <analitza/analyzer.h>
 #include <analitza/value.h>
--- trunk/KDE/kdeedu/kalgebra/mobile/analitzawrapper.h #1214323:1214324
@@ -1,3 +1,21 @@
+/*************************************************************************************
 + *  Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org>                              \
* + *                                                                                 \
* + *  This program is free software; you can redistribute it and/or                  \
* + *  modify it under the terms of the GNU General Public License                    \
* + *  as published by the Free Software Foundation; either version 2                 \
* + *  of the License, or (at your option) any later version.                         \
* + *                                                                                 \
* + *  This program is distributed in the hope that it will be useful,                \
* + *  but WITHOUT ANY WARRANTY; without even the implied warranty of                 \
* + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  \
* + *  GNU General Public License for more details.                                   \
* + *                                                                                 \
* + *  You should have received a copy of the GNU General Public License              \
* + *  along with this program; if not, write to the Free Software                    \
* + *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA \
* + *************************************************************************************/
 +
 #ifndef ANALITZAWRAPPER_H
 #define ANALITZAWRAPPER_H
 
--- trunk/KDE/kdeedu/kalgebra/mobile/kalgebramobile.cpp #1214323:1214324
@@ -127,27 +127,28 @@
 
 void KAlgebraMobile::selectPlugin()
 {
-	QDialog d;
-	d.setLayout(new QVBoxLayout);
+	QPointer<QDialog> d(new QDialog);
+	d->setLayout(new QVBoxLayout);
 	
-	QListView* combo = new QListView(&d);
+	QListView* combo = new QListView(d.data());
 	combo->setViewMode(QListView::IconMode);
 	combo->setModel(m_pluginsModel);
 	combo->setFrameStyle(QFrame::NoFrame);
 	combo->setBackgroundRole(QPalette::NoRole);
 	combo->setEditTriggers(0);
-	connect(combo, SIGNAL(clicked(QModelIndex)), &d, SLOT(accept()));
-	d.layout()->addWidget(combo);
+	connect(combo, SIGNAL(clicked(QModelIndex)), d.data(), SLOT(accept()));
+	d->layout()->addWidget(combo);
 	
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | \
                QDialogButtonBox::Cancel, Qt::Horizontal, &d);
-	connect(buttons, SIGNAL(accepted()), &d, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), &d, SLOT(reject()));
-	d.layout()->addWidget(buttons);
+	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | \
QDialogButtonBox::Cancel, Qt::Horizontal, d.data()); +	connect(buttons, \
SIGNAL(accepted()), d.data(), SLOT(accept())); +	connect(buttons, SIGNAL(rejected()), \
d.data(), SLOT(reject())); +	d->layout()->addWidget(buttons);
 	
-	int ret = d.exec();
+	int ret = d->exec();
 	if(ret == QDialog::Accepted) {
 		displayPlugin(combo->currentIndex().row());
 	}
+	delete d.data();
 }
 
 void KAlgebraMobile::displayPlugin(int plugin)
--- trunk/KDE/kdeedu/kalgebra/mobile/widgetswrappers.cpp #1214323:1214324
@@ -1,3 +1,21 @@
+/*************************************************************************************
 + *  Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org>                              \
* + *                                                                                 \
* + *  This program is free software; you can redistribute it and/or                  \
* + *  modify it under the terms of the GNU General Public License                    \
* + *  as published by the Free Software Foundation; either version 2                 \
* + *  of the License, or (at your option) any later version.                         \
* + *                                                                                 \
* + *  This program is distributed in the hope that it will be useful,                \
* + *  but WITHOUT ANY WARRANTY; without even the implied warranty of                 \
* + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  \
* + *  GNU General Public License for more details.                                   \
* + *                                                                                 \
* + *  You should have received a copy of the GNU General Public License              \
* + *  along with this program; if not, write to the Free Software                    \
* + *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA \
* + *************************************************************************************/
 +
 #include "widgetswrappers.h"
 #include <QVBoxLayout>
 
--- trunk/KDE/kdeedu/kalgebra/mobile/widgetswrappers.h #1214323:1214324
@@ -1,3 +1,21 @@
+/*************************************************************************************
 + *  Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org>                              \
* + *                                                                                 \
* + *  This program is free software; you can redistribute it and/or                  \
* + *  modify it under the terms of the GNU General Public License                    \
* + *  as published by the Free Software Foundation; either version 2                 \
* + *  of the License, or (at your option) any later version.                         \
* + *                                                                                 \
* + *  This program is distributed in the hope that it will be useful,                \
* + *  but WITHOUT ANY WARRANTY; without even the implied warranty of                 \
* + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  \
* + *  GNU General Public License for more details.                                   \
* + *                                                                                 \
* + *  You should have received a copy of the GNU General Public License              \
* + *  along with this program; if not, write to the Free Software                    \
* + *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA \
* + *************************************************************************************/
 +
 #ifndef WIDGETSWRAPPERS_H
 #define WIDGETSWRAPPERS_H
 
--- trunk/KDE/kdeedu/kalgebra/src/kalgebra.cpp #1214323:1214324
@@ -436,16 +436,18 @@
 		c_exp->insertText(idx.data().toString());
 	} else {
 		QModelIndex idxName=idx.sibling(idx.row(), 0);
-		VarEdit e(this, false);
+		
+		QPointer<VarEdit> e(new VarEdit(this, false));
 		QString var = c_variables->model()->data(idxName, Qt::DisplayRole).toString();
 		
-		e.setAnalitza(c_results->analitza());
-		e.setName(var);
+		e->setAnalitza(c_results->analitza());
+		e->setName(var);
 		
-		if(e.exec() == QDialog::Accepted) {
-			QString str=var+" := "+e.val().toString();
+		if(e->exec() == QDialog::Accepted) {
+			QString str=var+" := "+e->val().toString();
 			c_results->addOperation(Analitza::Expression(str, false), str);
 		}
+		delete e;
 	}
 }
 
@@ -559,19 +561,20 @@
 
 void KAlgebra::saveGraph()
 {
-	KFileDialog dialog(KUrl(), i18n("*.png|Image File\n*.svg|SVG File"), this);
-	dialog.setOperationMode(KFileDialog::Saving);
-	dialog.setConfirmOverwrite(true);
+	QPointer<KFileDialog> dialog=new KFileDialog(KUrl(), i18n("*.png|Image \
File\n*.svg|SVG File"), this); +	dialog->setOperationMode(KFileDialog::Saving);
+	dialog->setConfirmOverwrite(true);
 	
-	if(dialog.exec()) {
-		QString filter = dialog.fileWidget()->currentFilter();
-		QString filename = dialog.selectedFile();
+	if(dialog->exec()) {
+		QString filter = dialog->fileWidget()->currentFilter();
+		QString filename = dialog->selectedFile();
 		
 		Graph2D::Format f=Graph2D::PNG;
 		if(filename.endsWith(".svg") || (!filename.endsWith(".png") && filter.mid(2, \
3)=="svg"))  f=Graph2D::SVG;
 		m_graph2d->toImage(filename, f);
 	}
+	delete dialog;
 }
 
 void KAlgebra::tabChanged(int n)
@@ -649,16 +652,18 @@
 
 void KAlgebra::varsContextMenu(const QPoint& p)
 {
-	QMenu m;
-	m.addAction(i18n("Add variable"));
-	QAction* ac=m.exec(b_dock_funcs->widget()->mapToGlobal(p));
+	QPointer<QMenu> m=new QMenu;
+	m->addAction(i18n("Add variable"));
+	QAction* ac=m->exec(b_dock_funcs->widget()->mapToGlobal(p));
 	
 	if(ac) {
-		AskName a(i18n("Enter a name for the new variable"), 0);
+		QPointer<AskName> a=new AskName(i18n("Enter a name for the new variable"), 0);
 		
-		if(a.exec()==QDialog::Accepted)
-			b_varsModel->insertVariable(a.name(), Analitza::Expression(Analitza::Cn(0)));
+		if(a->exec()==QDialog::Accepted)
+			b_varsModel->insertVariable(a->name(), Analitza::Expression(Analitza::Cn(0)));
+		delete a;
 	}
+	delete m;
 }
 
 void KAlgebra::add3D(const Analitza::Expression& exp)
--- trunk/KDE/kdeedu/kalgebra/src/viewportwidget.cpp #1214323:1214324
@@ -25,11 +25,11 @@
 #include <QBoxLayout>
 #include <limits>
 
-static const double LIMIT=std::numeric_limits<double>::max();
-
 ViewportWidget::ViewportWidget(QWidget * parent, Qt::WFlags flags)
 	: QWidget (parent, flags)
 {
+	const double LIMIT=std::numeric_limits<double>::max();
+	
 	m_top=new QDoubleSpinBox(this);
 	m_left=new QDoubleSpinBox(this);
 	m_width=new QDoubleSpinBox(this);
--- trunk/KDE/kdeedu/kalgebra/utils/main.cpp #1214323:1214324
@@ -55,4 +55,4 @@
 	str << "</chapter>\n";
 	
 	return 0;
-}
\ No newline at end of file
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic