Commit 239e1b80 authored by Alexander A. Maly's avatar Alexander A. Maly

Restyling interfaces

parent 6fa69429
Pipeline #2351 failed with stages
in 2 minutes and 24 seconds
#ifndef ANALIZER_COMPILERINTERFACE_H
#define ANALIZER_COMPILERINTERFACE_H
#include <QtPlugin>
#include <kumir2-libs/dataformats/ast.h>
#include <QString>
#include <QList>
#include <string>
namespace Shared { namespace Analizer {
namespace Shared
{
namespace Analizer
{
enum RunTarget {
RegularRun,
TestingRun
RegularRun,
TestingRun
};
class ASTCompilerInterface {
class ASTCompilerInterface
{
public:
virtual const AST::DataPtr abstractSyntaxTree() const = 0;
virtual const AST::DataPtr abstractSyntaxTree() const = 0;
};
class ExternalExecutableCompilerInterface
{
public:
virtual QString prepareToRun(RunTarget target) = 0;
virtual QString executableFilePath() const = 0;
virtual QString debuggableSourceFileName() const = 0;
virtual QString prepareToRun(RunTarget target) = 0;
virtual QString executableFilePath() const = 0;
virtual QString debuggableSourceFileName() const = 0;
};
}}
} // namespace Analizer
} // namespace Shared
Q_DECLARE_INTERFACE(Shared::Analizer::ASTCompilerInterface,
"kumir2.Analizer.CompilerInterface")
"kumir2.Analizer.CompilerInterface")
Q_DECLARE_INTERFACE(Shared::Analizer::ExternalExecutableCompilerInterface,
"kumir2.Analizer.ExternalExecutableCompilerInterface")
"kumir2.Analizer.ExternalExecutableCompilerInterface")
#endif // ANALIZER_COMPILERINTERFACE_H
#ifndef BROWSER_INSTANCEINTERFACE_H
#define BROWSER_INSTANCEINTERFACE_H
#include <QtGlobal>
#include <QWidget>
#include <QUrl>
#include <QVariantList>
#include "startpage_widget_interface.h"
namespace Shared { namespace Browser {
namespace Shared
{
namespace Browser
{
class InstanceInterface
: public StartpageWidgetInterface
class InstanceInterface : public StartpageWidgetInterface
{
public:
virtual QWidget * widget() = 0;
inline virtual QWidget * startPageWidget() { return widget(); }
virtual void go(const QUrl & url) = 0;
virtual void setContent(const QString & data) = 0;
virtual QUrl currentLocation() const = 0;
virtual QString title() const = 0;
inline virtual QString startPageTitle() const { return title(); }
virtual void setTitleChangeHandler(const QObject * receiver,
const char * method /*(QString title, const InstanceInterface * sender)*/
) = 0;
inline virtual void setStartPageTitleChangeHandler(const QObject *receiver, const char *method)
{ setTitleChangeHandler(receiver, method); }
virtual void evaluateCommand(const QString & method, const QVariantList & arguments) = 0;
virtual QMap<QString,QObject*> & manageableObjects() = 0;
inline QObject* & operator[](const QString & objName)
{
if (!manageableObjects().contains(objName))
manageableObjects().insert(objName, nullptr);
return manageableObjects()[objName];
}
virtual QWidget *widget() = 0;
virtual QWidget *startPageWidget()
{
return widget();
}
virtual void go(const QUrl &url) = 0;
virtual void setContent(const QString &data) = 0;
virtual QUrl currentLocation() const = 0;
virtual QString title() const = 0;
virtual QString startPageTitle() const
{
return title();
}
virtual void setTitleChangeHandler(
const QObject *receiver,
const char *method /*(QString title, const InstanceInterface * sender)*/
) = 0;
virtual void setStartPageTitleChangeHandler(
const QObject *receiver,
const char *method
) {
setTitleChangeHandler(receiver, method);
}
virtual void evaluateCommand(
const QString &method,
const QVariantList &arguments
) = 0;
virtual QMap<QString, QObject *> &manageableObjects() = 0;
QObject *&operator[](const QString &objName)
{
if (!manageableObjects().contains(objName)) {
manageableObjects().insert(objName, nullptr);
}
return manageableObjects()[objName];
}
};
}}
} // namespace Browser
} // namespace Shared
Q_DECLARE_INTERFACE(Shared::Browser::InstanceInterface, "kumir2.browser.instance")
......
#ifndef BROWSER_INTERFACE
#define BROWSER_INTERFACE
#include "browser_instanceinterface.h"
#include <QtPlugin>
namespace Shared
{
namespace Browser {
class InstanceInterface;
}
class BrowserInterface
{
public:
typedef QMap<QString, QObject*> ObjectsMap;
virtual Browser::InstanceInterface * createBrowser(
const QUrl & url = QUrl(),
const ObjectsMap manageableObjects = ObjectsMap(),
bool enableKeyboardNavigation = false) = 0;
typedef QMap<QString, QObject *> ObjectsMap;
virtual Browser::InstanceInterface *createBrowser(
const QUrl &url = QUrl(),
const ObjectsMap manageableObjects = ObjectsMap(),
bool enableKeyboardNavigation = false
) = 0;
};
}
......
......@@ -24,12 +24,13 @@ public:
virtual QAction *actionPerformCheck() const = 0;
virtual QList<QMenu *> menus() const = 0;
inline virtual QStringList getListOfCourses() const
virtual QStringList getListOfCourses() const
{
return QStringList();
}
inline virtual void activateCourseFromList(QString file)
virtual void activateCourseFromList(QString file)
{
Q_UNUSED(file);
}
......@@ -43,5 +44,4 @@ public slots:
Q_DECLARE_INTERFACE(Shared::CoursesInterface, "kumir2.CourseManager")
#endif // COURSESINTERFACE_H
#ifndef RUN_INTERFACE
#define RUN_INTERFACE
#include <QtCore>
#include <QMetaType>
#include <QPair>
class QTextStream;
class QAbstractItemModel;
namespace Shared
{
......@@ -37,12 +41,12 @@ public:
RM_Blind
};
inline virtual bool hasBreakpointsSupport() const
virtual bool hasBreakpointsSupport() const
{
return false;
}
inline virtual void setBreakpoint(
virtual void setBreakpoint(
const QString & /*sourceFileName*/,
const quint16 /*lineNumber*/,
const QString & /*condition*/,
......@@ -78,22 +82,28 @@ public:
virtual void setStdInTextStream(QTextStream *) = 0;
virtual void setStdOutTextStream(QTextStream *) = 0;
inline virtual void setSourceHelper(Analizer::HelperInterface *) {}
virtual void setSourceHelper(Analizer::HelperInterface *) {}
inline virtual void removeAllBreakpoints() {}
virtual void removeAllBreakpoints() {}
inline virtual void insertOrChangeBreakpoint(bool /*enabled*/, const QString &/*fileName*/,
virtual void insertOrChangeBreakpoint(
bool /*enabled*/, const QString &/*fileName*/,
quint32 /*lineNo*/, quint32 /*ignoreCount*/,
const QString & /*condition*/) {}
const QString & /*condition*/
) {}
inline virtual void insertSingleHitBreakpoint(const QString &/*fileName*/, quint32 /*lineNo*/) {}
virtual void insertSingleHitBreakpoint(
const QString &/*fileName*/, quint32 /*lineNo*/
) {}
inline virtual void removeBreakpoint(const QString & /*fileName*/, quint32 /*lineNo*/) {}
virtual void removeBreakpoint(
const QString & /*fileName*/, quint32 /*lineNo*/
) {}
};
} // namespace Shared
}
Q_DECLARE_METATYPE(Shared::RunInterface::StopReason)
Q_DECLARE_INTERFACE(Shared::RunInterface, "kumir2.run")
......
......@@ -2,9 +2,7 @@
#define STARTPAGE_WIDGET_INTERFACE_H
#include <QtPlugin>
#include <QString>
#include <QList>
class QObject;
class QWidget;
class QAction;
class QMenu;
......@@ -17,12 +15,12 @@ class StartpageWidgetInterface
public:
virtual QWidget *startPageWidget() = 0;
inline virtual QMenu *editMenuForStartPage()
virtual QMenu *editMenuForStartPage()
{
return nullptr;
}
inline virtual QList<QAction *> startPageActions()
virtual QList<QAction *> startPageActions()
{
return QList<QAction *>();
}
......
......@@ -3,9 +3,7 @@
#include "ast_module.h"
#include <QList>
#include <QDateTime>
#include <QSharedPointer>
#undef ABSTRACTSYNTAXTREE_EXPORT
#ifdef DATAFORMATS_LIBRARY
......
......@@ -3,8 +3,6 @@
#include "ast_type.h"
#include <QString>
#include <QList>
#include <QSharedPointer>
#include <QWeakPointer>
......
......@@ -13,6 +13,7 @@
#include <kumir2-libs/widgets/iconprovider.h>
#include "toolbarcontextmenu.h"
#include "kumir2/editor_instanceinterface.h"
#include "kumir2/browser_instanceinterface.h"
#include <algorithm>
#include <QSharedPointer>
......
......@@ -10,6 +10,7 @@
#include "tabwidget.h"
#include <kumir2-libs/widgets/iconprovider.h>
#include <kumir2-libs/widgets/actionproxy.h>
#include "kumir2/browser_instanceinterface.h"
#include "guisettingspage.h"
#include "iosettingseditorpage.h"
......
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