Ejemplo n.º 1
0
OgreScriptEditor::OgreScriptEditor(const AssetPtr &scriptAsset, Framework *fw, QWidget *parent) :
    QWidget(parent),
    framework(fw),
    asset(scriptAsset),
    lineEditName(0),
    buttonSaveAs(0),
    textEdit(0)
//    propertyTable(0),
//    materialProperties(0)
{
    QUiLoader loader;
    QFile file(Application::InstallationDirectory() + "data/ui/ogrescripteditor.ui");
    if (!file.exists())
    {
        LogError("Cannot find OGRE Script Editor .ui file.");
        return;
    }

    QWidget *mainWidget = loader.load(&file, this);
    file.close();

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(mainWidget);
    layout->setContentsMargins(0, 0, 0, 0);
    setLayout(layout);

    lineEditName = mainWidget->findChild<QLineEdit *>("lineEditName");
    buttonSaveAs = mainWidget->findChild<QPushButton *>("buttonSaveAs");
    QPushButton *buttonSave = mainWidget->findChild<QPushButton *>("buttonSave");
    QPushButton *buttonCancel = mainWidget->findChild<QPushButton *>("buttonCancel");

    ///\todo Save as -functionality disabled for now.
    lineEditName->setDisabled(true);
    buttonSaveAs->setDisabled(true);

    connect(buttonSave, SIGNAL(clicked()), SLOT(Save()));
    connect(buttonSaveAs, SIGNAL(clicked()), SLOT(SaveAs()));
    connect(buttonCancel, SIGNAL(clicked(bool)), SLOT(close()));
    connect(lineEditName, SIGNAL(textChanged(const QString &)), SLOT(ValidateScriptName(const QString &)));

    buttonSaveAs->setEnabled(false);

    SetScriptAsset(scriptAsset);
}
Ejemplo n.º 2
0
OgreScriptEditor::OgreScriptEditor(const AssetPtr &scriptAsset, Framework *fw, QWidget *parent) :
    QWidget(parent),
    framework(fw),
    asset(scriptAsset),
    textEdit(0)
//    propertyTable(0),
//    materialProperties(0)
{
    setupUi(this);

    ///\todo Save as -functionality disabled for now.
    lineEditName->setDisabled(true);
    buttonSaveAs->setDisabled(true);

    connect(buttonSave, SIGNAL(clicked()), SLOT(Save()));
    connect(buttonSaveAs, SIGNAL(clicked()), SLOT(SaveAs()));
    connect(buttonCancel, SIGNAL(clicked(bool)), SLOT(close()));
    connect(lineEditName, SIGNAL(textChanged(const QString &)), SLOT(ValidateScriptName(const QString &)));

    buttonSaveAs->setEnabled(false);

    SetScriptAsset(scriptAsset);
}