Commit 873e2d34 authored by Fredrik Edemar's avatar Fredrik Edemar

More DCOP-DBUS-porting and cleanups

svn path=/trunk/KDE/kdeedu/kmplot/; revision=549788
parent 94569a64
......@@ -43,8 +43,6 @@ kde4_add_ui_files(kmplotpart_PART_SRCS
parameterswidget.ui
)
# kde4_add_dcop_skels(kmplotpart_PART_SRCS MainDlgIface.h parseriface.h Viewiface.h )
kde4_add_kcfg_files(kmplotpart_PART_SRCS settings.kcfgc )
kde4_add_plugin(kmplotpart WITH_PREFIX ${kmplotpart_PART_SRCS})
......@@ -60,8 +58,6 @@ install_targets(${PLUGIN_INSTALL_DIR} kmplotpart )
set(kmplot_SRCS main.cpp kmplot.cpp kmplotadaptor.cpp )
kde4_automoc(${kmplot_SRCS})
#kde4_add_dcop_skels(kmplot_SRCS kmplotIface.h )
# FIXME: it's wrong, but otherwise it does not compile
kde4_add_kcfg_files(kmplot_SRCS settings.kcfgc )
......
......@@ -30,7 +30,6 @@
#include <QTimer>
// KDE includes
// #include <dcopclient.h>
#include <kaboutdata.h>
#include <kapplication.h>
#include <kconfigdialog.h>
......@@ -104,7 +103,6 @@ MainDlg * MainDlg::m_self = 0;
MainDlg::MainDlg(QWidget *parentWidget, QObject *parent, const QStringList& ) :
// DCOPObject( "MainDlg" ),
KParts::ReadOnlyPart( parent ),
m_recentFiles( 0 ),
m_modified(false),
......@@ -546,28 +544,29 @@ bool MainDlg::openFile()
void MainDlg::slotOpenRecent( const KUrl &url )
{
// if( isModified() || !m_url.isEmpty() ) // open the file in a new window
// {
if( isModified() || !m_url.isEmpty() ) // open the file in a new window
{
// QByteArray data;
// QDataStream stream( &data,QIODevice::WriteOnly);
// stream.setVersion(QDataStream::Qt_3_1);
// stream << url;
// KApplication::kApplication()->dcopClient()->send(KApplication::kApplication()->dcopClient()->appId(), "KmPlotShell","openFileInNewWindow(KUrl)", data);
// return;
// }
//
// View::self()->init();
// if ( !kmplotio->load( url ) ) //if the loading fails
// {
// m_recentFiles->removeUrl(url ); //remove the file from the recent-opened-file-list
// return;
// }
// m_url = m_currentfile = url;
// m_recentFiles->setCurrentItem(-1); //don't select the item in the open-recent menu
// setWindowCaption( m_url.prettyUrl(KUrl::LeaveTrailingSlash) );
// m_modified = false;
// View::self()->updateSliders();
// View::self()->drawPlot();
QDBusReply<void> reply = QDBusInterfacePtr( QDBus::sessionBus().baseService(), "/kmplot", "org.kde.kmplot.Kmplot" )->call( QDBusAbstractInterface::UseEventLoop, "openFileInNewWindow", url.url() );
return;
}
View::self()->init();
if ( !kmplotio->load( url ) ) //if the loading fails
{
m_recentFiles->removeUrl(url ); //remove the file from the recent-opened-file-list
return;
}
m_url = m_currentfile = url;
m_recentFiles->setCurrentItem(-1); //don't select the item in the open-recent menu
setWindowCaption( m_url.prettyUrl(KUrl::LeaveTrailingSlash) );
m_modified = false;
View::self()->updateSliders();
View::self()->drawPlot();
}
void MainDlg::slotPrint()
......
......@@ -49,8 +49,6 @@
#include "View.h"
#include "kminmax.h"
#include "kmplotio.h"
// #include "MainDlgIface.h"
class BrowserExtension;
class EditScaling;
......@@ -84,7 +82,7 @@ class SettingsPageGeneral;
* Its central widget view contains the parser, accessable via its parser() function.
* @see View, View::m_parser, View::parser
*/
class MainDlg : public KParts::ReadOnlyPart/*, virtual public MainDlgIface*/
class MainDlg : public KParts::ReadOnlyPart
{
Q_OBJECT
......
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2004 Fredrik Edemar <f_edemar@linux.se>
*
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* 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 MAINDLGIFACE_H
#define MAINDLGIFACE_H
#include <dcopobject.h>
/**
@author Fredrik Edemar
*/
/// All functions in MainDlgIface are accessible with DCOP. For descriptions about the functions, see MainDlg.
class MainDlgIface : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual bool checkModified() = 0;
virtual bool isModified() = 0;
virtual void editAxes() = 0;
virtual void editScaling() = 0;
virtual void toggleShowSliders() = 0;
virtual void slotSave() = 0;
virtual void slotSaveas() = 0;
virtual void slotPrint() = 0;
virtual void slotExport() = 0;
virtual void slotSettings() = 0;
virtual void slotNames() = 0;
virtual void slotCoord1() = 0;
virtual void slotCoord2() = 0;
virtual void slotCoord3() = 0;
virtual void getYValue() = 0;
virtual void findMinimumValue() = 0;
virtual void findMaximumValue() = 0;
virtual void graphArea() = 0;
};
#endif
......@@ -72,13 +72,11 @@
View * View::m_self = 0;
View::View( bool readOnly, bool & modified, KMenu * functionPopup, QWidget* parent, KActionCollection *ac )
: /*DCOPObject("View"),*/
QWidget( parent, Qt::WStaticContents ),
: QWidget( parent, Qt::WStaticContents ),
buffer( width(), height() ),
m_popupmenu( functionPopup ),
m_modified( modified ),
m_readonly( readOnly ),
// m_dcop_client(KApplication::kApplication()->dcopClient()),
m_ac(ac)
{
assert( !m_self ); // this class should only be constructed once
......@@ -2270,11 +2268,7 @@ void View::setStatusBar(const QString &text, const int id)
}
else
{
QByteArray parameters;
QDataStream arg( &parameters,QIODevice::WriteOnly);
arg.setVersion(QDataStream::Qt_3_1);
arg << text << id;
// m_dcop_client->send(m_dcop_client->appId(), "KmPlotShell","setStatusBarText(QString,int)", parameters);
QDBusReply<void> reply = QDBusInterfacePtr( QDBus::sessionBus().baseService(), "/kmplot", "org.kde.kmplot.Kmplot" )->call( QDBusAbstractInterface::NoWaitForReply, "setStatusBarText", text, id );
}
}
......
......@@ -36,7 +36,6 @@
#include <QEvent>
// KDE includes
// #include <dcopclient.h>
#include <kactionclasses.h>
#include <kdebug.h>
#include <kmenu.h>
......@@ -46,7 +45,6 @@
// local includes
#include "diagr.h"
// #include "Viewiface.h"
#include "xparser.h"
class KMinMax;
......@@ -418,7 +416,6 @@ public slots:
/// timer that is started when the mouse is pressed
QTime * m_mousePressTimer;
// DCOPClient *m_dcop_client;
QString m_statusbartext1;
QString m_statusbartext2;
QString m_statusbartext3;
......
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2004 Fredrik Edemar <f_edemar@linux.se>
*
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* 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 VIEWIFACE_H
#define VIEWIFACE_H
#include <dcopobject.h>
/**
@author Fredrik Edemar
*/
/// All functions in ViewIface are accessible with DCOP. For descriptions about the functions, see View.
class ViewIface : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual void stopDrawing() = 0;
virtual void drawPlot() = 0;
};
#endif
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2004 Fredrik Edemar <f_edemar@linux.se>
*
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* 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 KMPLOTIFACE_H
#define KMPLOTIFACE_H
#include <dcopobject.h>
#include <kurl.h>
/**
@author Fredrik Edemar
*/
/// All functions in KmPlotIface are accessible with DCOP. For descriptions about the functions, see KmPlot.
class KmPlotIface : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual void fileOpen() = 0;
virtual void setStatusBarText(const QString &text, int id) = 0;
virtual void optionsConfigureKeys() = 0;
virtual void optionsConfigureToolbars() = 0;
virtual void openFileInNewWindow(const KUrl url) = 0;
virtual void fileOpen(const KUrl &url) = 0;
};
#endif
......@@ -36,7 +36,6 @@
#include <QVector>
#include "function.h"
#include "parseriface.h"
class Parser;
......@@ -217,7 +216,7 @@ class Constants
*
* Tokenizes a function equation to be evaluated.
*/
class Parser : public QObject/*, virtual public ParserIface*/
class Parser : public QObject
{
Q_OBJECT
public:
......
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2004 Fredrik Edemar <f_edemar@linux.se>
*
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* 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 XPARSERIFACE_H
#define XPARSERIFACE_H
#include <dcopobject.h>
#include <qcolor.h>
#include <qstringlist.h>
/**
@author Fredrik Edemar
*/
/// All functions in ParserIface are accessible with DCOP. For descriptions about the functions, see Parser and XParser.
class ParserIface : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual bool addFunction(const QString &extstr0, const QString &extstr1, bool f_mode, bool f1_mode, bool f2_mode, bool integral_mode, bool integral_use_precision, double _linewidth, double _f1_linewidth, double _f2_linewidth, double _integral_linewidth, const QString &str_dmin, const QString &str_dmax, const QString &str_startx, const QString &str_starty, double integral_precision, QColor color, QColor f1_color, QColor f2_color, QColor integral_color, QStringList str_parameter, int use_slider) = 0;
virtual int addFunction(const QString &f_str0, const QString &f_str1) = 0;
virtual bool removeFunction(uint id) = 0;
virtual bool setFunctionExpression(const QString &f_str, uint id, uint eq) = 0;
virtual uint countFunctions() = 0;
virtual QStringList listFunctionNames() = 0;
virtual int fnameToID(const QString &name) = 0;
virtual double fkt(uint id, uint eq, double x) = 0;
virtual bool functionFVisible(uint id) = 0;
virtual bool functionF1Visible(uint id) = 0;
virtual bool functionF2Visible(uint id) = 0;
virtual bool functionIntVisible(uint id) = 0;
virtual bool setFunctionFVisible(bool visible, uint id) = 0;
virtual bool setFunctionF1Visible(bool visible, uint id) = 0;
virtual bool setFunctionF2Visible(bool visible, uint id) = 0;
virtual bool setFunctionIntVisible(bool visible, uint id) = 0;
virtual QString functionStr(uint id, uint eq) = 0;
virtual QColor functionFColor(uint id) = 0;
virtual QColor functionF1Color(uint id) = 0;
virtual QColor functionF2Color(uint id) = 0;
virtual QColor functionIntColor(uint id) = 0;
virtual bool setFunctionFColor(const QColor &color, uint id) = 0;
virtual bool setFunctionF1Color(const QColor &color, uint id) = 0;
virtual bool setFunctionF2Color(const QColor &color, uint id) = 0;
virtual bool setFunctionIntColor(const QColor &color, uint id) = 0;
virtual double functionFLineWidth(uint id) = 0;
virtual double functionF1LineWidth(uint id) = 0;
virtual double functionF2LineWidth(uint id) = 0;
virtual double functionIntLineWidth(uint id) = 0;
virtual bool setFunctionFLineWidth(double linewidth, uint id) = 0;
virtual bool setFunctionF1LineWidth(double linewidth, uint id) = 0;
virtual bool setFunctionF2LineWidth(double linewidth, uint id) = 0;
virtual bool setFunctionIntLineWidth(double linewidth, uint id) = 0;
virtual QStringList functionParameterList(uint id) = 0;
virtual bool functionAddParameter(const QString &new_parameter, uint id) = 0;
virtual bool functionRemoveParameter(const QString &remove_parameter, uint id) = 0;
virtual QString functionMinValue(uint id) = 0;
virtual QString functionMaxValue(uint id) = 0;
virtual bool setFunctionMinValue(const QString &min, uint id) = 0;
virtual bool setFunctionMaxValue(const QString &max, uint id) = 0;
virtual QString functionStartXValue(uint id) = 0;
virtual QString functionStartYValue(uint id) = 0;
virtual bool setFunctionStartValue(const QString &x, const QString &y, uint id) = 0;
};
#endif
......@@ -23,7 +23,6 @@
*/
// KDE includes
// #include <dcopclient.h>
#include <kapplication.h>
#include <kglobal.h>
#include <kinputdialog.h>
......
......@@ -71,68 +71,68 @@ class XParser : public Parser
/// Interpretates the extended function string (only used by the old file format)
bool getext( Function *, const QString );
/// Functions for the DCOP interface:
/// Functions for the D-BUS interface:
public Q_SLOTS:
/// Returns a list with all functions
QStringList listFunctionNames();
Q_SCRIPTABLE QStringList listFunctionNames();
/// Returns true if the graph is visible, otherwise false.
bool functionFVisible(uint id);
bool functionF1Visible(uint id);
bool functionF2Visible(uint id);
bool functionIntVisible(uint id);
Q_SCRIPTABLE bool functionFVisible(uint id);
Q_SCRIPTABLE bool functionF1Visible(uint id);
Q_SCRIPTABLE bool functionF2Visible(uint id);
Q_SCRIPTABLE bool functionIntVisible(uint id);
/// Set the visible of the function. Returns true if it succeeds, otherwise false.
bool setFunctionFVisible(bool visible, uint id);
bool setFunctionF1Visible(bool visible, uint id);
bool setFunctionF2Visible(bool visible, uint id);
bool setFunctionIntVisible(bool visible, uint id);
Q_SCRIPTABLE bool setFunctionFVisible(bool visible, uint id);
Q_SCRIPTABLE bool setFunctionF1Visible(bool visible, uint id);
Q_SCRIPTABLE bool setFunctionF2Visible(bool visible, uint id);
Q_SCRIPTABLE bool setFunctionIntVisible(bool visible, uint id);
/// Returns the function expression, or an empty string if the function couldn't be found
QString functionStr(uint id, uint eq);
Q_SCRIPTABLE QString functionStr(uint id, uint eq);
/// Returns the complete function string including the extensions of a function, or an empty string if the function couldn't be found
/// Get the color of a graph
QColor functionFColor(uint id);
QColor functionF1Color(uint id);
QColor functionF2Color(uint id);
QColor functionIntColor(uint id);
Q_SCRIPTABLE QColor functionFColor(uint id);
Q_SCRIPTABLE QColor functionF1Color(uint id);
Q_SCRIPTABLE QColor functionF2Color(uint id);
Q_SCRIPTABLE QColor functionIntColor(uint id);
/// Set the color of a graph. Returns true if it succeeds, otherwise false.
bool setFunctionFColor(const QColor &color, uint id);
bool setFunctionF1Color(const QColor &color, uint id);
bool setFunctionF2Color(const QColor &color, uint id);
bool setFunctionIntColor(const QColor &color, uint id);
Q_SCRIPTABLE bool setFunctionFColor(const QColor &color, uint id);
Q_SCRIPTABLE bool setFunctionF1Color(const QColor &color, uint id);
Q_SCRIPTABLE bool setFunctionF2Color(const QColor &color, uint id);
Q_SCRIPTABLE bool setFunctionIntColor(const QColor &color, uint id);
/// Get the line width of a graph
double functionFLineWidth(uint id);
double functionF1LineWidth(uint id);
double functionF2LineWidth(uint id);
double functionIntLineWidth(uint id);
Q_SCRIPTABLE double functionFLineWidth(uint id);
Q_SCRIPTABLE double functionF1LineWidth(uint id);
Q_SCRIPTABLE double functionF2LineWidth(uint id);
Q_SCRIPTABLE double functionIntLineWidth(uint id);
/// Set the line width of a graph. Returns true if it succeeds, otherwise false.
bool setFunctionFLineWidth(double linewidth, uint id);
bool setFunctionF1LineWidth(double linewidth, uint id);
bool setFunctionF2LineWidth(double linewidth, uint id);
bool setFunctionIntLineWidth(double linewidth, uint id);
Q_SCRIPTABLE bool setFunctionFLineWidth(double linewidth, uint id);
Q_SCRIPTABLE bool setFunctionF1LineWidth(double linewidth, uint id);
Q_SCRIPTABLE bool setFunctionF2LineWidth(double linewidth, uint id);
Q_SCRIPTABLE bool setFunctionIntLineWidth(double linewidth, uint id);
/// Returns the function's parameter list
QStringList functionParameterList(uint id);
bool functionAddParameter(const QString &new_parameter, uint id);
bool functionRemoveParameter(const QString &remove_parameter, uint id);
int addFunction(const QString &f_str0, const QString &f_str1);
bool addFunction(const QString &extstr0, const QString &extstr1, bool f_mode, bool f1_mode, bool f2_mode, bool integral_mode, bool integral_use_precision, double linewidth, double f1linewidth, double f2linewidth, double integrallinewidth, const QString &str_dmin, const QString &str_dmax, const QString &str_startx, const QString &str_starty, double integral_precision, QColor color, QColor f1_color, QColor f2_color, QColor integral_color, QStringList str_parameter, int use_slider);
bool setFunctionExpression(const QString &f_str, uint id, uint eq);
Q_SCRIPTABLE QStringList functionParameterList(uint id);
Q_SCRIPTABLE bool functionAddParameter(const QString &new_parameter, uint id);
Q_SCRIPTABLE bool functionRemoveParameter(const QString &remove_parameter, uint id);
Q_SCRIPTABLE int addFunction(const QString &f_str0, const QString &f_str1);
Q_SCRIPTABLE bool addFunction(const QString &extstr0, const QString &extstr1, bool f_mode, bool f1_mode, bool f2_mode, bool integral_mode, bool Q_SCRIPTABLE integral_use_precision, double linewidth, double f1linewidth, double f2linewidth, double integrallinewidth, const QString &str_dmin, const QString &str_dmax, const QString &str_startx, const QString &str_starty, double integral_precision, QColor color, QColor f1_color, QColor f2_color, QColor integral_color, QStringList str_parameter, int use_slider);
Q_SCRIPTABLE bool setFunctionExpression(const QString &f_str, uint id, uint eq);
/// Get the min and max value of a graph
QString functionMinValue(uint id);
QString functionMaxValue(uint id);
Q_SCRIPTABLE QString functionMinValue(uint id);
Q_SCRIPTABLE QString functionMaxValue(uint id);
/// Set the min and max values of a graph. Returns true if it succeeds, otherwise false.
bool setFunctionMinValue(const QString &min, uint id);
bool setFunctionMaxValue(const QString &max, uint id);
Q_SCRIPTABLE bool setFunctionMinValue(const QString &min, uint id);
Q_SCRIPTABLE bool setFunctionMaxValue(const QString &max, uint id);
/// Get the startx and starty value of a graph
QString functionStartXValue(uint id);
QString functionStartYValue(uint id);
Q_SCRIPTABLE QString functionStartXValue(uint id);
Q_SCRIPTABLE QString functionStartYValue(uint id);
/// Set the startx and starty values of a graph. Returns true if it succeeds, otherwise false.
bool setFunctionStartValue(const QString &x, const QString &y, uint id);
Q_SCRIPTABLE bool setFunctionStartValue(const QString &x, const QString &y, uint id);
private:
/// finds a free function name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment