[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kalgebra/analitzaplot] /: Adapt to analitzaplot changes
From: Aleix Pol <aleixpol () kde ! org>
Date: 2012-10-01 0:22:43
Message-ID: 20121001002243.29A82A605D () git ! kde ! org
[Download RAW message or body]
Git commit dfd6d4d22d80d9a8a06f41bb325daa2d3344bc8e by Aleix Pol.
Committed on 01/10/2012 at 02:23.
Pushed by apol into branch 'analitzaplot'.
Adapt to analitzaplot changes
add the Analitza namespace when appropriate
M +1 -1 mobile/graph2dmobile.h
M +5 -2 mobile/kalgebramobile.cpp
M +3 -3 mobile/kalgebramobile.h
M +4 -4 src/dictionary.cpp
M +4 -4 src/dictionary.h
M +3 -1 src/functionedit.cpp
M +7 -7 src/functionedit.h
M +16 -16 src/kalgebra.cpp
M +7 -4 src/kalgebra.h
http://commits.kde.org/kalgebra/dfd6d4d22d80d9a8a06f41bb325daa2d3344bc8e
diff --git a/mobile/graph2dmobile.h b/mobile/graph2dmobile.h
index 670e593..ee203f6 100644
--- a/mobile/graph2dmobile.h
+++ b/mobile/graph2dmobile.h
@@ -23,7 +23,7 @@
#include <QDeclarativeItem>
#include <analitzaplot/plotter2d.h>
-class Graph2DMobile : public QDeclarativeItem, public Plotter2D
+class Graph2DMobile : public QDeclarativeItem, public Analitza::Plotter2D
{
Q_OBJECT
Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel);
diff --git a/mobile/kalgebramobile.cpp b/mobile/kalgebramobile.cpp
index 4a63ab5..2a7d5bb 100644
--- a/mobile/kalgebramobile.cpp
+++ b/mobile/kalgebramobile.cpp
@@ -29,6 +29,8 @@
#include "graph2dmobile.h"
#include "pluginsmodel.h"
+using namespace Analitza;
+
KAlgebraMobile* KAlgebraMobile::s_self=0;
KAlgebraMobile* KAlgebraMobile::self() { return s_self; }
@@ -41,17 +43,18 @@ KAlgebraMobile::KAlgebraMobile(QObject* parent)
qmlRegisterType<PluginsModel>("org.kde.analitza", 1, 0, "PluginsModel");
qmlRegisterType<AnalitzaWrapper>("org.kde.analitza", 1, 0, "Analitza");
qmlRegisterType<ExpressionWrapper>("org.kde.analitza", 1, 0, "Expression");
- qmlRegisterType<PlotsModel>("org.kde.analitza", 1, 0, "PlotsModel");
+ qmlRegisterType<Analitza::PlotsModel>("org.kde.analitza", 1, 0, "PlotsModel");
qmlRegisterType<Graph2DMobile>("org.kde.analitza", 1, 0, "Graph2DView");
qmlRegisterType<VariablesModel>("org.kde.analitza", 1, 0, "VariablesModel");
qmlRegisterInterface<Analitza::Variables*>("Analitza::Variables");
+ qmlRegisterType<QAbstractItemModel>();
// global.setProperty("VariablesModel", varsmodel, \
QScriptValue::Undeletable|QScriptValue::ReadOnly); }
PlotsModel* KAlgebraMobile::functionsModel()
{
if(!m_functionsModel) {
- m_functionsModel = new PlotsModel(this);
+ m_functionsModel = new Analitza::PlotsModel(this);
connect(m_functionsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), \
SLOT(functionRemoved(QModelIndex,int,int))); connect(m_functionsModel, \
SIGNAL(rowsInserted(QModelIndex,int,int)), \
SLOT(functionInserted(QModelIndex,int,int))); connect(m_functionsModel, \
SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(functionModified(QModelIndex, \
QModelIndex)));
diff --git a/mobile/kalgebramobile.h b/mobile/kalgebramobile.h
index 42f0a97..b4173b2 100644
--- a/mobile/kalgebramobile.h
+++ b/mobile/kalgebramobile.h
@@ -26,9 +26,9 @@ class QModelIndex;
namespace Analitza {
class Variables;
class Expression;
+ class PlotsModel;
}
-class PlotsModel;
class VariablesModel;
class PluginsModel;
class AnalitzaWrapper;
@@ -44,7 +44,7 @@ class KAlgebraMobile : public QObject
void notifyVariablesChanged() { variablesChanged(); }
public slots:
- PlotsModel* functionsModel();
+ Analitza::PlotsModel* functionsModel();
Analitza::Variables* variables() const;
QStringList addFunction(const QString& expression, double up = 0., double down = \
0.);
@@ -59,7 +59,7 @@ class KAlgebraMobile : public QObject
private:
static KAlgebraMobile* s_self;
- PlotsModel* m_functionsModel;
+ Analitza::PlotsModel* m_functionsModel;
Analitza::Variables* m_vars;
};
diff --git a/src/dictionary.cpp b/src/dictionary.cpp
index ab88dc3..7212ec8 100644
--- a/src/dictionary.cpp
+++ b/src/dictionary.cpp
@@ -20,8 +20,8 @@
#include <analitza/variables.h>
#include <analitza/expression.h>
#include <analitzagui/operatorsmodel.h>
+#include <analitzagui/plotsview2d.h>
#include <analitzaplot/plotsmodel.h>
-#include <analitzaplot/plotsview2d.h>
#include <analitzaplot/plotsfactory.h>
#include <analitzaplot/functiongraph.h>
@@ -55,8 +55,8 @@ Dictionary::Dictionary(QWidget *p) : QWidget(p)
// m_formula->setFrameStyle(2);
m_formula->setBaseFontPointSize(10);
m_formula->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- m_funcs=new PlotsModel(descr);
- m_graph=new PlotsView2D(descr);
+ m_funcs=new Analitza::PlotsModel(descr);
+ m_graph=new Analitza::PlotsView2D(descr);
m_graph->setTicksShown(0);
m_graph->setModel(m_funcs);
m_graph->setReadOnly(true);
@@ -120,7 +120,7 @@ void Dictionary::activated(const QModelIndex& idx, const \
QModelIndex& prev) if(!error.isEmpty())
qDebug() << "dict formula error: " << error << e.toMathMLPresentation();
- m_funcs->addPlot(PlotsFactory::self()->requestPlot(e, \
Dim2D).create(QColor(0,150,0), "dict", m_vars)); \
+ m_funcs->addPlot(Analitza::PlotsFactory::self()->requestPlot(e, \
Analitza::Dim2D).create(QColor(0,150,0), "dict", m_vars)); } else {
QString error;
m_name->setText(QString());
diff --git a/src/dictionary.h b/src/dictionary.h
index 07d4dcf..0fa4890 100644
--- a/src/dictionary.h
+++ b/src/dictionary.h
@@ -22,11 +22,11 @@
#include <QWidget>
#include <QSortFilterProxyModel>
-class PlotsView2D;
-class PlotsModel;
namespace Analitza
{
class Variables;
+class PlotsView2D;
+class PlotsModel;
}
class QLabel;
@@ -57,8 +57,8 @@ Q_OBJECT
QLabel *m_example;
QtMmlWidget* m_formula;
- PlotsView2D *m_graph;
- PlotsModel *m_funcs;
+ Analitza::PlotsView2D *m_graph;
+ Analitza::PlotsModel *m_funcs;
OperatorsModel *m_ops;
Analitza::Variables* m_vars;
QSortFilterProxyModel *m_sortProxy;
diff --git a/src/functionedit.cpp b/src/functionedit.cpp
index c17637a..6b494fa 100644
--- a/src/functionedit.cpp
+++ b/src/functionedit.cpp
@@ -33,11 +33,13 @@
#include <analitza/variables.h>
#include <analitza/value.h>
#include <analitzagui/algebrahighlighter.h>
+#include <analitzagui/plotsview2d.h>
#include <analitzaplot/planecurve.h>
#include <analitzaplot/plotsmodel.h>
-#include <analitzaplot/plotsview2d.h>
#include <analitzaplot/plotsfactory.h>
+using namespace Analitza;
+
namespace {
static const int resolution = 200;
}
diff --git a/src/functionedit.h b/src/functionedit.h
index f97a10e..574bfff 100644
--- a/src/functionedit.h
+++ b/src/functionedit.h
@@ -27,16 +27,16 @@
#include <KColorCombo>
#include <KLineEdit>
-class PlaneCurve;
-class PlotsView2D;
-class FunctionGraph;
-class PlotsModel;
class KTabWidget;
class ExpressionEdit;
namespace Analitza
{
class Variables;
class Expression;
+class PlotsView2D;
+class FunctionGraph;
+class PlotsModel;
+class PlaneCurve;
}
/**
@@ -57,7 +57,7 @@ public:
/** Retrieves the resulting expression text. */
Analitza::Expression expression() const;
- PlaneCurve* createFunction() const;
+ Analitza::PlaneCurve* createFunction() const;
/** Sets an expression text to the ExpressionEdit widget. */
void setFunction(const QString &newText);
@@ -116,9 +116,9 @@ private:
QPushButton *m_ok;
QLabel *m_valid;
QLabel *m_validIcon;
- PlotsView2D *m_graph;
+ Analitza::PlotsView2D *m_graph;
KColorCombo *m_color;
- PlotsModel *m_funcsModel;
+ Analitza::PlotsModel *m_funcsModel;
Analitza::Variables* m_vars;
bool m_modmode;
diff --git a/src/kalgebra.cpp b/src/kalgebra.cpp
index eb3f7b4..4452bef 100644
--- a/src/kalgebra.cpp
+++ b/src/kalgebra.cpp
@@ -25,13 +25,13 @@
#include "viewportwidget.h"
#include "functionedit.h"
#ifdef HAVE_OPENGL
-# include <analitzaplot/plotsview3d.h>
+# include <analitzagui//plotsview3d.h>
#endif
#include <analitzagui/operatorsmodel.h>
#include <analitzagui/expressionedit.h>
#include <analitzagui/variablesmodel.h>
-#include <analitzaplot/plotsview2d.h>
+#include <analitzagui/plotsview2d.h>
#include <analitzaplot/plotsmodel.h>
#include <analitzaplot/functiongraph.h>
#include <analitzaplot/planecurve.h>
@@ -66,7 +66,7 @@ class Add2DOption : public InlineOptions
virtual QString id() const { return "add2d"; }
virtual bool matchesExpression(const Analitza::Expression& exp, const \
Analitza::ExpressionType& functype) const {
- return PlotsFactory::self()->requestPlot(exp, Dim2D).canDraw();
+ return Analitza::PlotsFactory::self()->requestPlot(exp, \
Analitza::Dim2D).canDraw(); }
virtual QString caption() const { return i18n("Plot 2D"); }
@@ -88,7 +88,7 @@ class Add3DOption : public InlineOptions
virtual QString id() const { return "add3d"; }
virtual bool matchesExpression(const Analitza::Expression& exp, const \
Analitza::ExpressionType& functype) const {
- return PlotsFactory::self()->requestPlot(exp, Dim2D).canDraw();
+ return Analitza::PlotsFactory::self()->requestPlot(exp, \
Analitza::Dim3D).canDraw(); }
virtual QString caption() const { return i18n("Plot 3D"); }
@@ -185,9 +185,9 @@ KAlgebra::KAlgebra(QWidget *parent) : KMainWindow(parent)
//////EOConsola
//////2D Graph
- b_funcsModel=new PlotsModel(this);
+ b_funcsModel=new Analitza::PlotsModel(this);
- m_graph2d = new PlotsView2D(m_tabs);
+ m_graph2d = new Analitza::PlotsView2D(m_tabs);
m_graph2d->setTicksShown(0);
m_graph2d->setModel(b_funcsModel);
@@ -284,8 +284,8 @@ KAlgebra::KAlgebra(QWidget *parent) : KMainWindow(parent)
t_exp = new ExpressionEdit(tridim);
t_exp->setExamples(QStringList() << "sin x+sin y" << "(x,y)->x" << "x*y");
t_exp->setAns("x");
- t_model3d = new PlotsModel(this);
- m_graph3d = new PlotsView3D(tridim);
+ t_model3d = new Analitza::PlotsModel(this);
+ m_graph3d = new Analitza::PlotsView3D(tridim);
m_graph3d->setModel(t_model3d);
// m_graph3d->setBackgroundColor(Qt::black);
@@ -392,7 +392,7 @@ void KAlgebra::add2D(const Analitza::Expression& exp)
{
qDebug() << "adding" << exp.toString();
- PlotItem* curve = PlotsFactory::self()->requestPlot(exp, \
Dim2D).create(randomFunctionColor(), b_funcsModel->freeId(), + Analitza::PlotItem* \
curve = Analitza::PlotsFactory::self()->requestPlot(exp, \
Analitza::Dim2D).create(randomFunctionColor(), b_funcsModel->freeId(), \
c_results->analitza()->variables()); b_funcsModel->addPlot(curve);
@@ -401,7 +401,7 @@ void KAlgebra::add2D(const Analitza::Expression& exp)
void KAlgebra::new_func()
{
- FunctionGraph* f=b_funced->createFunction();
+ Analitza::FunctionGraph* f=b_funced->createFunction();
if(b_funced->editing()) {
QModelIndex idx = b_funcsModel->indexForName(f->name());
@@ -517,7 +517,7 @@ void KAlgebra::new_func3d()
{
#ifdef HAVE_OPENGL
Analitza::Expression exp = t_exp->expression();
- PlotBuilder plot = PlotsFactory::self()->requestPlot(exp, Dim3D);
+ Analitza::PlotBuilder plot = Analitza::PlotsFactory::self()->requestPlot(exp, \
Analitza::Dim3D); if(plot.canDraw()) {
t_model3d->clear();
t_model3d->addPlot(plot.create(Qt::yellow, "func3d", \
c_results->analitza()->variables())); @@ -529,21 +529,21 @@ void \
KAlgebra::new_func3d() void KAlgebra::set_dots()
{
#ifdef HAVE_OPENGL
- m_graph3d->setPlotStyle(Dots);
+ m_graph3d->setPlotStyle(Analitza::Dots);
#endif
}
void KAlgebra::set_lines()
{
#ifdef HAVE_OPENGL
- m_graph3d->setPlotStyle(Wired);
+ m_graph3d->setPlotStyle(Analitza::Wired);
#endif
}
void KAlgebra::set_solid()
{
#ifdef HAVE_OPENGL
- m_graph3d->setPlotStyle(Solid);
+ m_graph3d->setPlotStyle(Analitza::Solid);
#endif
}
@@ -579,7 +579,7 @@ void KAlgebra::saveGraph()
QString filename = dialog->selectedFile();
bool isSvg = filename.endsWith(".svg") || (!filename.endsWith(".png") && \
filter.mid(2, 3)=="svg");
- PlotsView2D::Format f = isSvg ? PlotsView2D::PNG : PlotsView2D::SVG;
+ Analitza::PlotsView2D::Format f = isSvg ? Analitza::PlotsView2D::PNG : \
Analitza::PlotsView2D::SVG; m_graph2d->toImage(filename, f);
}
delete dialog;
@@ -678,7 +678,7 @@ void KAlgebra::add3D(const Analitza::Expression& exp)
{
#ifdef HAVE_OPENGL
t_model3d->clear();
- t_model3d->addPlot(PlotsFactory::self()->requestPlot(exp, Dim3D).create(Qt::yellow, \
"func3d_console", c_results->analitza()->variables())); \
+ t_model3d->addPlot(Analitza::PlotsFactory::self()->requestPlot(exp, \
Analitza::Dim3D).create(Qt::yellow, "func3d_console", \
c_results->analitza()->variables())); m_tabs->setCurrentIndex(2);
#endif
}
diff --git a/src/kalgebra.h b/src/kalgebra.h
index 026e565..b92e8ff 100644
--- a/src/kalgebra.h
+++ b/src/kalgebra.h
@@ -28,9 +28,12 @@
#include <QListView>
#include <config-kalgebra.h>
+namespace Analitza {
class PlotsView2D;
class PlotsView3D;
class PlotsModel;
+}
+
class ExpressionEdit;
class ConsoleHtml;
class VariablesModel;
@@ -63,10 +66,10 @@ class KAlgebra : public KMainWindow
//graf 2d
QMenu* b_menu;
- PlotsModel* b_funcsModel;
+ Analitza::PlotsModel* b_funcsModel;
QTreeView *b_funcs;
QTabWidget *b_tools;
- PlotsView2D *m_graph2d;
+ Analitza::PlotsView2D *m_graph2d;
QDockWidget *b_dock_funcs;
FunctionEdit *b_funced;
VariablesModel* b_varsModel;
@@ -75,8 +78,8 @@ class KAlgebra : public KMainWindow
//graph 3d
QMenu* t_menu;
ExpressionEdit *t_exp;
- PlotsView3D *m_graph3d;
- PlotsModel* t_model3d;
+ Analitza::PlotsView3D *m_graph3d;
+ Analitza::PlotsModel* t_model3d;
#endif
//Dictionary
QDockWidget *d_dock;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic