示例#1
0
    UploadProject::~UploadProject()
    {
        clearObjs();
        if(imldr)
        {
            if(imldr->isRunning())
                imldr->terminate();

            imldr->deleteLater();
            imldr = 0;
        }
    }
示例#2
0
bool OAM::initialize()
{
	for (int iLoop = 0; iLoop < gsc_iMaxObjs; ++iLoop)
	{
		m_pObjs[iLoop]	= new Obj();
	}

	// Clear Objs
	clearObjs();

	// Create sprite batch
	m_pSpriteBatch	= createSpriteBatch(gsc_iMaxObjs);
	
	if (NULL == m_pSpriteBatch)
	{
		return	false;
	}
	
	return	true;
}
示例#3
0
    void UploadProject::loadFromFile(bool clear, const QString & whe)
    {
        if(whe.isEmpty() == false)
            proj_path = whe;

        if(!proj_setts || proj_setts->fileName() != proj_path)
            proj_setts = QSharedPointer<QSettings>(new QSettings(proj_path, QSettings::IniFormat));

        if(proj_setts->status() != QSettings::NoError)
        {
            QString err;
            switch(proj_setts->status())
            {
                case QSettings::AccessError:
                    err = tr("Can't acces project file");
                    break;
                case QSettings::FormatError:
                    err = tr("Project file has an invalid format.");
                    break;
                default:
                    err = tr("Unknown or no error");
                    break;

            }

            throw UploadProjectError(tr("Can't load settings file '%1': %2").arg(proj_path).arg(err));
        }

        if(clear)
        {
            clearObjs();
            is_modifed = true;
        }

        const quint64 files = proj_setts->value("meta/file_count", 0).toULongLong();
        QStringList filelist;
        QHash<QString, QUuid> uuids;

        for(quint64 i = 0; i < files; ++i)
        {
            const QString &grpn = QString("file_%1").arg(i+1);
            if(proj_setts->contains(grpn + "/file_path") == false)
                continue;

            proj_setts->beginGroup(grpn);


            known_objs.insert(QUuid(proj_setts->value("file_uuid").toString()), proj_setts->group());
            uuids.insert(proj_setts->value("file_path").toString(), QUuid(proj_setts->value("file_uuid").toString()));
            filelist << proj_setts->value("file_path").toString();

            proj_setts->endGroup();
        }

        if(imldr)
        {
            imldr->terminate();
            imldr->deleteLater();

            imldr = 0;
        }

        imldr = new ImageLoader(filelist, uuids, false, this);
        imldr->start();
    }