예제 #1
0
void MainWindow::connectObjects()
{
    QObject::connect(tilesetEditor, SIGNAL(statusTipUpdated(const QString &)),
                     this, SLOT(updateStatusBar(const QString &)) );

    QObject::connect(mapView, SIGNAL(mapChange()),
                     this, SLOT(mapWasModified()));

    QObject::connect(mapView, SIGNAL(statusTipUpdated(const QString &)),
                     this, SLOT(updateStatusBar(const QString &)) );

    QObject::connect(tilesetEditor, SIGNAL(targetTileChange(int,int)),
                     mapView, SLOT(targetTileChanged(int,int)));

    QObject::connect(entitySelector, SIGNAL(itemSelectionChanged()), this,
                              SLOT(entityItemChanged()));
    QObject::connect(entitySelector, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this,
                              SLOT(entityItemDoubleClicked(QTreeWidgetItem*,int)));

    QObject::connect(this, SIGNAL(entityListSelectionChange(int)), mapView,
                     SLOT(entityListSelectionChanged(int)));

    QObject::connect(scriptSelector, SIGNAL(runScriptClicked(QString)), this,
                     SLOT(runMapScript(QString)));
}
예제 #2
0
bool MapWindow::loadFile(const QString & fileName)
{
    QApplication::setOverrideCursor(Qt::WaitCursor);

    if(! mapData.loadMap(fileName))
    {
	QApplication::restoreOverrideCursor();
        QMessageBox::warning(this, tr("Map Editor"), tr("Cannot read file %1.").arg(fileName));
        return false;
    }

    setScene(& mapData);

    QApplication::restoreOverrideCursor();
    setCurrentFile(fileName);

    QPair<int, int> vers = mapData.versions();

    if(vers.first != vers.second)
	mapWasModified();
    else
	emit windowModified(& mapData);

    return true;
}