Exemplo n.º 1
0
void KMyMoneyAccountTreeView::openIndex(const QModelIndex &index)
{
  if (index.isValid()) {
    QVariant data = model()->data(index, AccountsModel::AccountRole);
    if (data.isValid()) {
      if (data.canConvert<MyMoneyAccount>()) {
        emit openObject(data.value<MyMoneyAccount>());
      }
      if (data.canConvert<MyMoneyInstitution>()) {
        emit openObject(data.value<MyMoneyInstitution>());
      }
    }
  }
}
Exemplo n.º 2
0
std::string IMAccountListJSONSerializer::serialize() 
{
	int nCount		   = 0;
	int totalContacts  = 0;
	int onlineContacts = 0;

	openArray( "" );

	for ( IMAccountList::const_iterator it = _imAccountList.begin(); it != _imAccountList.end(); ++it) 
	{
		const IMAccount& imAccount = (*it).second;

		if ( !imAccount.isSip() )
		{
			openObject();

			addValue( "id",				imAccount.getKey()			);
			addValue( "login",			imAccount.getLogin()		);
			addValue( "qtprotocol",		imAccount.getQtProtocol()   );
			addValue( "qtprotocolname", QtEnumIMProtocolMap::getQtProtocolName( imAccount.getQtProtocol() ) );

			closeObject();
		}
	}

	closeArray();

	std::string result = toString( false );

	return result;
}
Exemplo n.º 3
0
void ObjectEditor::ClikedButton(QPushButton *b){
    if(b==OpenObjectButton){
        openObject((*Projectpatch)+"/"+OBJECT_DIR);
    }
    if(b==PlayAnimation&&ObjectRender!=NULL&&AnimationsIndex->count()){
        ObjectRender->Play(AnimationsIndex->currentIndex());
    }
    if(b==create){
        createObject((*Projectpatch)+"/"+SPRITE_DIR);
    }
    if(b==ClearAnimation&&ObjectRender!=NULL){
        ObjectRender->Replay();
    }
    if(b==Save&&ObjectRender){
        saveObject();
    }
    if(b==Bcolor&&ObjectRender!=NULL&&AnimationsIndex->count()){
        QColor temp=QColorDialog::getColor(Qt::black,getMain());
        camera->setBackgroundColor(temp);
    }
    if(b==Delete&&ObjectRender){
        int temp = QMessageBox::question(getMain(), "Warning","delete \'"+ObjectRender->getObjectPatch()+"\' Object?",
                                      QMessageBox::No|QMessageBox::Yes);
        if(temp== QMessageBox::Yes){
            if(ObjectRender->getEObjectNameClass()==E_GAME_RESURS){
                pack->remove(((EGameResurs*)ObjectRender)->getRes()->getSource()->id());
                pack->save();
            }
            QString temp=ObjectRender->getObjectPatch();
            this->removeObject(ObjectRender);
            QFile(temp).remove();
            ObjectRender=NULL;
        }
    }
}
Exemplo n.º 4
0
void MainWindow2::openDocument()
{
    if ( maybeSave() )
    {
        QSettings settings( PENCIL2D, PENCIL2D );

        QString strLastOpenPath = settings.value( LAST_FILE_PATH, QDir::homePath() ).toString();
        QString fileName = QFileDialog::getOpenFileName( this,
                                                         tr( "Open File..." ),
                                                         strLastOpenPath,
                                                         tr( PFF_OPEN_ALL_FILE_FILTER ) );
        if ( fileName.isEmpty() )
        {
            return;
        }

        QFileInfo fileInfo( fileName );
        if ( fileInfo.isDir() )
        {
            return;
        }

        bool ok = openObject( fileName );

        if ( !ok )
        {
            QMessageBox::warning( this, tr("Warning"), tr("Pencil cannot read this file. If you want to import images, use the command import.") );
            newDocument();
        }
    }
}
Exemplo n.º 5
0
void MainWindow2::openFile( QString filename )
{
    qDebug() << "open recent file" << filename;
    bool ok = openObject( filename );
    if ( !ok )
    {
        QMessageBox::warning( this, tr("Warning"), tr("Pencil cannot read this file. If you want to import images, use the command import.") );
        newDocument();
    }
}
Exemplo n.º 6
0
void MainWindow2::openFile( QString filename )
{
    qDebug() << "open recent file" << filename;
    bool ok = openObject( filename );
    if ( !ok )
    {
        QMessageBox::warning( this, tr("Warning"), tr("Pencil cannot read this file. If you want to import images, use the command import.") );
        Object* pObject = new Object();
        pObject->defaultInitialisation();

        editor->setObject( pObject );
        editor->resetUI();
    }
    else
    {
        editor->updateMaxFrame();
    }
}
Exemplo n.º 7
0
void MainWindow2::openRecent()
{
    QSettings settings("Pencil","Pencil");
    QString myPath = settings.value("lastFilePath", QVariant(QDir::homePath())).toString();
    bool ok = openObject(myPath);
    if ( !ok )
    {
        QMessageBox::warning(this, "Warning", "Pencil cannot read this file. If you want to import images, use the command import.");
        Object* pObject = new Object();
        pObject->defaultInitialisation();

        editor->setObject(pObject);
        editor->resetUI();
    }
    else
    {
        editor->updateMaxFrame();
    }
}
Exemplo n.º 8
0
void MainWindow2::openDocument()
{
    if ( maybeSave() )
    {
        QSettings settings("Pencil","Pencil");

        QString myPath = settings.value("lastFilePath", QVariant(QDir::homePath())).toString();
        QString fileName = QFileDialog::getOpenFileName(
                    this,
                    tr("Open File..."),
                    myPath,
                    tr("PCL (*.pcl);;Any files (*)"));

        if (fileName.isEmpty())
        {
            return ;
        }

        QFileInfo fileInfo(fileName);
        if ( fileInfo.isDir() )
        {
            return;
        }

        bool ok = openObject(fileName);

        if (!ok)
        {
            QMessageBox::warning(this, "Warning", "Pencil cannot read this file. If you want to import images, use the command import.");
            newDocument();
        }
        else
        {
            editor->updateMaxFrame();
        }

    }
}