Browse Source

- QQMLApplicationEngine and AppContext moved to Extension.h

cl-refactor
yann300 10 years ago
parent
commit
dee7047198
  1. 2
      mix/AssemblyDebuggerCtrl.cpp
  2. 2
      mix/AssemblyDebuggerCtrl.h
  3. 2
      mix/DebuggingStateWrapper.cpp
  4. 17
      mix/Extension.cpp
  5. 10
      mix/Extension.h

2
mix/AssemblyDebuggerCtrl.cpp

@ -32,8 +32,6 @@ using namespace dev::mix;
AssemblyDebuggerCtrl::AssemblyDebuggerCtrl(QTextDocument* _doc): Extension(ExtensionDisplayBehavior::ModalDialog) AssemblyDebuggerCtrl::AssemblyDebuggerCtrl(QTextDocument* _doc): Extension(ExtensionDisplayBehavior::ModalDialog)
{ {
m_ctx = AppContext::getInstance();
m_appEngine = m_ctx->appEngine();
qRegisterMetaType<AssemblyDebuggerData>(); qRegisterMetaType<AssemblyDebuggerData>();
qRegisterMetaType<DebuggingStatusResult>(); qRegisterMetaType<DebuggingStatusResult>();
connect(this, SIGNAL(dataAvailable(bool, DebuggingStatusResult, QList<QObject*>, AssemblyDebuggerData)), connect(this, SIGNAL(dataAvailable(bool, DebuggingStatusResult, QList<QObject*>, AssemblyDebuggerData)),

2
mix/AssemblyDebuggerCtrl.h

@ -55,8 +55,6 @@ public:
private: private:
std::unique_ptr<AssemblyDebuggerModel> m_modelDebugger; std::unique_ptr<AssemblyDebuggerModel> m_modelDebugger;
QTextDocument* m_doc; QTextDocument* m_doc;
AppContext* m_ctx;
QQmlApplicationEngine* m_appEngine;
public slots: public slots:
void keyPressed(int); void keyPressed(int);

2
mix/DebuggingStateWrapper.cpp

@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** @file DebuggingStateWrapper.h /** @file DebuggingStateWrapper.cpp
* @author Yann yann@ethdev.com * @author Yann yann@ethdev.com
* @date 2014 * @date 2014
* Used to translate c++ type (u256, bytes, ...) into friendly value (to be used by QML). * Used to translate c++ type (u256, bytes, ...) into friendly value (to be used by QML).

17
mix/Extension.cpp

@ -25,6 +25,23 @@
using namespace dev; using namespace dev;
using namespace dev::mix; using namespace dev::mix;
Extension::Extension()
{
init();
}
Extension::Extension(ExtensionDisplayBehavior _displayBehavior)
{
init();
m_displayBehavior = _displayBehavior;
}
void Extension::init()
{
m_ctx = AppContext::getInstance();
m_appEngine = m_ctx->appEngine();
}
void Extension::addTabOn(QObject* _view) void Extension::addTabOn(QObject* _view)
{ {
if (contentUrl() == "") if (contentUrl() == "")

10
mix/Extension.h

@ -21,6 +21,7 @@
#include <QApplication> #include <QApplication>
#include <QQmlComponent> #include <QQmlComponent>
#include "AppContext.h"
namespace dev namespace dev
{ {
@ -39,8 +40,8 @@ class Extension: public QObject
Q_OBJECT Q_OBJECT
public: public:
Extension() {} Extension();
Extension(ExtensionDisplayBehavior _displayBehavior) { m_displayBehavior = _displayBehavior; } Extension(ExtensionDisplayBehavior _displayBehavior);
virtual QString contentUrl() const { return ""; } virtual QString contentUrl() const { return ""; }
virtual QString title() const { return ""; } virtual QString title() const { return ""; }
virtual void start() const {} virtual void start() const {}
@ -52,6 +53,11 @@ public:
protected: protected:
QObject* m_view; QObject* m_view;
ExtensionDisplayBehavior m_displayBehavior; ExtensionDisplayBehavior m_displayBehavior;
AppContext* m_ctx;
QQmlApplicationEngine* m_appEngine;
private:
void init();
}; };
} }

Loading…
Cancel
Save