Beispiel #1
0
KisImportExportFilter::ConversionStatus KisXCFImport::convert(const QByteArray& from, const QByteArray& to)
{
    Q_UNUSED(from);
    dbgFile << "Importing using XCFImport!";

    if (to != "application/x-krita")
        return KisImportExportFilter::BadMimeType;

    KisDocument * doc = outputDocument();

    if (!doc)
        return KisImportExportFilter::NoDocumentCreated;

    QString filename = inputFile();

    if (filename.isEmpty()) {
        return KisImportExportFilter::FileNotFound;
    }

    QFile fp(filename);
    if (fp.exists()) {
        doc->prepareForImport();
        return loadFromDevice(&fp, doc);
    }

    return KisImportExportFilter::CreationError;
}
Beispiel #2
0
bool KoStopGradient::load()
{
    QFile f(filename());
    if (!f.open(QIODevice::ReadOnly)) {
        warnPigment << "Can't open file " << filename();
        return false;
    }
    bool res = loadFromDevice(&f);
    f.close();
    return res;
}
bool FilterEffectResource::load()
{
    QFile file(filename());

    if (file.size() == 0) return false;
    if (!file.open(QIODevice::ReadOnly)) return false;

    bool res = loadFromDevice(&file);

    file.close();
    return res;
}
Beispiel #4
0
bool KoPattern::load()
{
    QFile file(filename());
    if (file.size() == 0) return false;

    bool result;
    if (!file.open(QIODevice::ReadOnly)) {
        qWarning() << "Can't open file " << filename();
        return false;
    }
    result = loadFromDevice(&file);
    file.close();

    return result;
}
bool KisWorkspaceResource::load()
{
    if (filename().isEmpty())
         return false;
 
    QFile file(filename());
    if (file.size() == 0) return false;
    if (!file.open(QIODevice::ReadOnly)) {
        warnKrita << "Can't open file " << filename();
        return false;
    }

    bool res = loadFromDevice(&file);
    file.close();
    return res;
}
bool TasksetResource::load()
{
    QString fn = filename();
    if (fn.isEmpty()) return false;
 
    QFile file(fn);
    if (file.size() == 0) return false;
    if (!file.open(QIODevice::ReadOnly)) {
        warnKrita << "Can't open file " << filename();
        return false;
    }

    bool res = loadFromDevice(&file);

    file.close();

    return res;
}
Beispiel #7
0
//--------------------------------------------------------------
void testApp::buttonAction(int i)
{
    int butt = i;
    
    switch(butt)
    {
        case 0:
            d->set(770,242);
            if(ib->mode == 0 && ib->active)
                d->mode = ib->type; //rabbitfunction is populated based on ib->type
            else if(ib-> mode == 1)
                d->mode = 11; //display emulator 1
            else
                break;
            d->populateList();
            d->active=true;  
            break;
            
        case 1: 
            d->set(770,178);
            if(ib->mode == 0 || ib -> mode == 3)
                d->mode = 9; //change active element
            else
                d->mode = 10; //output resolution list

            d->populateList();
            d->active=true; 
            break;
        
        case 2:   
            d->set(770,440);
            if(ib->type==0 && ib->mode == 0 && ib->active)
            {
                d->mode = 4; //toggle
            } else if(ib->mode == 1)
            {
                d->mode = 13; //on source loss
            } else
                break;
            d->populateList();
            d->active=true;
            break;
            
        case 3:
        case 4:
        case 5:
        case 6:
            curSkin = butt-3;
            ib->mode=0;
            copyElementDataToInterface();
            break;
        
        case 7:
            ib->reset();
            ib->mode=1;
            
            for(int i = 0; i < numberOfElements; i++)
            {
                e[i]->selected = false;
            }
            break;
            
        case 8:
            saveToDisk(getSaveFileName());
            break;
            
        case 9:
            loadFromFile();
            break;
            
        case 10:
            saveToDevice(); //nooooooo!
            break;
            
        case 11:
            loadFromDevice();
            break;
            
        case 12:
            resetToDefault();
            break;
            
        //IP                   
        case 13: 
            ib->enterIPAddress();
            break;
        
        //enter OSC bar    
        case 14:
            if(ib->mode == 0 && ib->active)
            {
                ib->enterOscAddress();
                if(ib->oscAddress!="")
                {
                    ib->toggleOSC = true;
                    ib->stoggleOSC = d->onOffList[ib->toggleOSC];
                }
                else
                {
                    ib->toggleOSC = false;
                    ib->stoggleOSC = d->onOffList[ib->toggleOSC];
                }
                    
            
                
            }
            break;
        
        //display emulator two   
        case 15:
            
            if(ib->mode == 1)  
            {
                d->set(770,264);
                d->mode = 12; //display emulator 2
                d->populateList();
                d->active=true; 
            }
            break;
            
        case 16:
            d->set(770,330);
            if(ib->mode == 0 && ib->active)
                d->mode = 5; //toggle osc
            else if(ib->mode == 1)
                d->mode = 6; //output hdcp
            else
                break;
            d->populateList();
            d->active=true;  
            break; 
        case 17:
            if(ib->mode == 1)
            {
                d->set(770,350);
                d->mode = 7; //input 01 hdcp
                d->populateList();
                d->active=true;  
            }
            break; 
        case 18:
            if(ib->mode == 1)
            {
                d->set(770,370);
                d->mode = 8; //input 02 hdcp
                d->populateList();
                d->active=true;  
            }
            break;                
            
        default:
            break;
            
    }

}