Exemplo n.º 1
0
ScriptSandbox* PluginManager::addScript(const QString &file, const QString &script, AdamantPlugin* owner) {
    ScriptSandbox* s = new ScriptSandbox(this, file, script, owner);
    if (s->isValid()) {
        connect(s, &ScriptSandbox::terminating, [this, s] () {
            onScriptFinished(s);
        });
        connect(s, &ScriptSandbox::scriptOutput, this, &PluginManager::onScriptOutput);
        _scripts.append(s);
        return s;
    }
    s->deleteLater();
    return nullptr;
}
Exemplo n.º 2
0
ScriptUi::ScriptUi(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::ScriptUi)
{
    qRegisterMetaType<UserRequest>("UserRequest");
    ui->setupUi(this);
    ui->informationBox->hide();
    connect(HilecSingleton::hilec(), SIGNAL(userInputRequested(UserRequest)), SLOT(handleUserRequest(UserRequest)));
    connect(HilecSingleton::hilec(), SIGNAL(userInputAborted(int)), SLOT(abortUserRequest(int)));
    connect(HilecSingleton::hilec(), SIGNAL(newProgressBar(int,QString, int)), SLOT(onNewPrgoressBar(int,QString, int)));
    connect(HilecSingleton::hilec(), SIGNAL(progressBarUpdated(int,int)), SLOT(onProgressBarUpdated(int,int)));
    connect(HilecSingleton::hilec(), SIGNAL(progressBarRemoved(int)), SLOT(onProgressBarRemoved(int)));
    connect(HilecSingleton::hilec(), SIGNAL(newInfoPanel(int,QString,QStringList)), SLOT(onNewInfoPanel(int,QString,QStringList)));
    connect(HilecSingleton::hilec(), SIGNAL(infoPanelUpdated(int,QStringList)), SLOT(onInfoPanelUpdated(int,QStringList)));
    connect(HilecSingleton::hilec(), SIGNAL(infoPanelRemoved(int)), SLOT(onInfoPanelRemoved(int)));
    connect(HilecSingleton::hilec(), SIGNAL(infoCleared()), ui->information, SLOT(clear()));
    connect(HilecSingleton::hilec(), SIGNAL(infoCleared()), ui->informationBox, SLOT(hide()));
    connect(HilecSingleton::hilec(), SIGNAL(infoAppended(QString)),  ui->information, SLOT(append(QString)));
    connect(HilecSingleton::hilec(), SIGNAL(infoAppended(QString)),  ui->informationBox, SLOT(show()));

    connect(HilecSingleton::hilec(), SIGNAL(scriptExecutionFinished()), SLOT(onScriptFinished()));
    //connect(HilecSingleton::hilec(), SIGNAL(), SLOT());
    connect(this, SIGNAL(newUserInput(int,int,QList<QVariant>)), HilecSingleton::hilec(), SLOT(userInput(int,int, const QList<QVariant>&)));
}