Commit 450871ca authored by Filipe Saraiva's avatar Filipe Saraiva
Browse files

Null backend ported to Qt5/KF5

parent eec961dc
# add_subdirectory(null)
add_subdirectory(null)
# add_subdirectory(maxima)
add_subdirectory(octave)
# add_subdirectory(scilab)
......
set( NullBackend_SRCS
nullbackend.cpp
set( NullBackend_SRCS
nullbackend.cpp
nullsession.cpp
nullexpression.cpp
nullcompletionobject.cpp
)
kde4_add_plugin( cantor_nullbackend ${NullBackend_SRCS} )
target_link_libraries( cantor_nullbackend ${KDE4_KDEUI_LIBS} cantorlibs)
add_library(cantor_nullbackend MODULE ${NullBackend_SRCS} )
target_link_libraries(cantor_nullbackend cantorlibs)
install( FILES nullbackend.desktop DESTINATION ${SERVICES_INSTALL_DIR}/cantor)
install(TARGETS cantor_nullbackend DESTINATION ${PLUGIN_INSTALL_DIR})
......@@ -22,38 +22,38 @@
#include "nullsession.h"
#include "kdebug.h"
#include <QDebug>
#include "cantor_macros.h"
NullBackend::NullBackend( QObject* parent,const QList<QVariant> args ) : Cantor::Backend( parent,args )
{
setObjectName("nullbackend");
kDebug()<<"Creating NullBackend";
setObjectName(QLatin1String("nullbackend"));
qDebug()<<"Creating NullBackend";
setEnabled(false);
}
NullBackend::~NullBackend()
{
kDebug()<<"Destroying NullBackend";
qDebug()<<"Destroying NullBackend";
}
QString NullBackend::id() const
{
return "null";
return QLatin1String("null");
}
Cantor::Session* NullBackend::createSession()
{
kDebug()<<"Spawning a new Null session";
qDebug()<<"Spawning a new Null session";
return new NullSession(this);
}
Cantor::Backend::Capabilities NullBackend::capabilities() const
{
kDebug()<<"Requesting capabilities of NullSession";
qDebug()<<"Requesting capabilities of NullSession";
return Cantor::Backend::Nothing;
}
......
......@@ -21,7 +21,7 @@
#include "nullcompletionobject.h"
#include <QStringList>
#include <kdebug.h>
#include <QDebug>
#include "nullsession.h"
......@@ -37,10 +37,10 @@ NullCompletionObject::~NullCompletionObject()
void NullCompletionObject::fetchCompletions()
{
kDebug()<<"fetching...";
qDebug()<<"fetching...";
QStringList comp;
for (int i=0;i<5;i++)
comp<<QString("%1 %2").arg(command()).arg(i);
comp<<QString::fromLatin1("%1 %2").arg(command()).arg(i);
setCompletions(comp);
emit fetchingDone();
}
......@@ -31,7 +31,7 @@ class NullCompletionObject : public Cantor::CompletionObject
NullCompletionObject( const QString& command, int index, NullSession* session);
~NullCompletionObject();
protected slots:
protected Q_SLOTS:
void fetchCompletions();
};
......
......@@ -23,13 +23,13 @@
#include "textresult.h"
#include "imageresult.h"
#include "helpresult.h"
#include <kdebug.h>
#include <kiconloader.h>
#include <QDebug>
#include <KIconLoader>
#include <QTimer>
NullExpression::NullExpression( Cantor::Session* session ) : Cantor::Expression(session)
{
kDebug();
qDebug();
m_timer=new QTimer(this);
m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()), this, SLOT(evalFinished()));
......@@ -43,7 +43,7 @@ NullExpression::~NullExpression()
void NullExpression::evaluate()
{
kDebug()<<"evaluating "<<command();
qDebug()<<"evaluating "<<command();
setStatus(Cantor::Expression::Computing);
m_timer->start(1000);
......@@ -51,18 +51,18 @@ void NullExpression::evaluate()
void NullExpression::interrupt()
{
kDebug()<<"interruptinging command";
qDebug()<<"interruptinging command";
m_timer->stop();
setStatus(Cantor::Expression::Interrupted);
}
void NullExpression::evalFinished()
{
kDebug()<<"evaluation finished";
if ( command()=="img" )
setResult( new Cantor::ImageResult( KUrl(KIconLoader::global()->iconPath("kde", KIconLoader::Desktop)), "alternative" ) );
qDebug()<<"evaluation finished";
if ( command()==QLatin1String("img") )
setResult( new Cantor::ImageResult( KUrl(KIconLoader::global()->iconPath(QLatin1String("kde"), KIconLoader::Desktop)), QLatin1String("alternative") ) );
else
setResult(new Cantor::TextResult("result: "+command()));
setResult(new Cantor::TextResult(QLatin1String("result: ")+command()));
setStatus(Cantor::Expression::Done);
}
......
......@@ -35,7 +35,7 @@ class NullExpression : public Cantor::Expression
void evaluate();
void interrupt();
public slots:
public Q_SLOTS:
void evalFinished();
private:
......
......@@ -22,33 +22,33 @@
#include "nullexpression.h"
#include "nullcompletionobject.h"
#include <kdebug.h>
#include <QDebug>
NullSession::NullSession( Cantor::Backend* backend) : Session(backend)
{
kDebug();
qDebug();
}
NullSession::~NullSession()
{
kDebug();
qDebug();
}
void NullSession::login()
{
kDebug()<<"login";
qDebug()<<"login";
changeStatus(Cantor::Session::Done);
emit ready();
}
void NullSession::logout()
{
kDebug()<<"logout";
qDebug()<<"logout";
}
void NullSession::interrupt()
{
kDebug()<<"interrupt";
qDebug()<<"interrupt";
foreach(Cantor::Expression* e, m_runningExpressions)
e->interrupt();
m_runningExpressions.clear();
......@@ -57,7 +57,7 @@ void NullSession::interrupt()
Cantor::Expression* NullSession::evaluateExpression(const QString& cmd, Cantor::Expression::FinishingBehavior behave)
{
kDebug()<<"evaluating: "<<cmd;
qDebug()<<"evaluating: "<<cmd;
NullExpression* expr=new NullExpression(this);
expr->setFinishingBehavior(behave);
connect(expr, SIGNAL(statusChanged(Cantor::Expression::Status)), this, SLOT(expressionFinished()));
......@@ -74,16 +74,16 @@ Cantor::Expression* NullSession::evaluateExpression(const QString& cmd, Cantor::
Cantor::CompletionObject* NullSession::completionFor(const QString& command, int index)
{
kDebug()<<"tab completion for "<<command;
qDebug()<<"tab completion for "<<command;
return new NullCompletionObject(command, index, this);
}
void NullSession::expressionFinished()
{
kDebug()<<"finished";
qDebug()<<"finished";
NullExpression* expression=qobject_cast<NullExpression*>(sender());
m_runningExpressions.removeAll(expression);
kDebug()<<"size: "<<m_runningExpressions.size();
qDebug()<<"size: "<<m_runningExpressions.size();
if(m_runningExpressions.isEmpty())
changeStatus(Cantor::Session::Done);
......
......@@ -41,7 +41,7 @@ class NullSession : public Cantor::Session
Cantor::Expression* evaluateExpression(const QString& command, Cantor::Expression::FinishingBehavior behave);
Cantor::CompletionObject* completionFor(const QString& cmd, int index=-1);
private slots:
private Q_SLOTS:
void expressionFinished();
private:
......
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