Пример #1
0
void menu::recurse(QMenu *cm, QFile &istr)
{
	QString p1,p2,p3;
	
	while(! istr.atEnd())
	{
		QTextStream til(istr.readLine(1024));

		til >> p1;  // command 
		if(p1.isEmpty() || p1 == "#")
			continue;
		
		if(p1 == "End")
			return;

		if(p1 == "Separator")
		{
			cm->addSeparator();
			continue;
		}	

		til >> p2;            // menu label
		
		if(p2.isEmpty())
			continue;

		p3 = til.readLine();  // command line

		if(p2[0] == '"')
		{
			if(p2[p2.length()-1] != '"')
			{
				int i = p3.indexOf('"');
				if(i == -1)
					continue;
				
				p2 += p3.left(i);
				p2 = p2.mid(1, p2.length()-1);
				p3 = p3.right(p3.length()-i-1);
			}
			else p2 = p2.mid(1, p2.length()-2);
		}
		
		if(p1 == "Menu")
		{
			QMenu *nm = new QMenu(p2);
			Q_CHECK_PTR(nm);
			cm->addMenu(nm);
			recurse(nm, istr);
			continue;
		}

		if(p1 == "Quit")
		{
			act_quit->setText(p2);
			cm->addAction(act_quit);
			continue;
		}
		
		if(p1 == "Kill")
		{
			act_kill->setText(p2);
			cm->addAction(act_kill);
			continue;
		}	

		if(p1 == "Restart")
		{
			act_rest->setText(p2);
			cm->addAction(act_rest);
			continue;
		}	
		
		if(p1 != "Entry")
			continue;

		p3 = p3.simplified();
		
		if(p3.isEmpty())
			continue;
			
		QAction *act_run = new QAction(p2, cm);
		act_run->setData(QVariant(p3));
		cm->addAction(act_run);
	}
}	
Пример #2
0
WatchItemBase * ConnectorBoolIn::makeWatchItem()
{
	WatchItemBase * wi = new WatchItemBooleanConnector(this);
	Q_CHECK_PTR(wi);
	return wi;
}
ScPlugin* subdivide_getPlugin()
{
	SubdividePlugin* plug = new SubdividePlugin();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #4
0
QWidget* OptionsDialog::getVariantWidget(const QVariant& v, const QString& message) {
     QWidget* pwidget = NULL;
     QLineEdit *plineedit = NULL;
     QSpinBox *pspinbox;
     QDoubleSpinBox *pdoublespinbox;
     QCheckBox *pcheckbox;
     QComboBox *pcombobox;
     bool ok;
     QRect rect;
     QString currentitem;

     QStringList combolist;
     QStringList editlist;
     InflowEditQListWidget *editlistwidget;
     int currenti = -1, i = 0;
     switch( v.type() ) {
          case QVariant::String:
                   combolist = v.toString().split(",", QString::SkipEmptyParts);
                   if (combolist.count() > 1 ) {
                       pwidget = new QComboBox(this);
                       pcombobox = qobject_cast<QComboBox*>(pwidget);
                       Q_CHECK_PTR(pcombobox);
                       for( i = 0; i < combolist.count(); i++) {
                             currentitem = combolist.at(i);
                             if (currentitem.endsWith("+") ) {
                                 currenti = i;
                                 currentitem.chop(1);

                             }
                            pcombobox->addItem(currentitem);
                       }
                       if ( currenti >= 0 && currenti < pcombobox->count() ) {
                           pcombobox->setCurrentIndex( currenti );
                       }
                       break;
                   }

                   if ( v.toString().endsWith(";") ) {
                       editlist = v.toString().split(";", QString::SkipEmptyParts);
                       pwidget = new InflowEditQListWidget(this);
                       editlistwidget = (qobject_cast<InflowEditQListWidget*>(pwidget));
                       Q_CHECK_PTR( editlistwidget );
                       editlistwidget->buildWidget();
                       editlistwidget->setEditList(editlist);
                       break;
                   }
                   pwidget = new QLineEdit(v.toString() );
                   pwidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding );
                   //rect = pwidget->geometry();
                   //rect.setWidth(350);
                   //pwidget->setGeometry(rect);
                   if (message.contains(QRegExp(tr("contrase[nñ]a|password|clave|pin"),Qt::CaseInsensitive)) ) {
                        plineedit = qobject_cast<QLineEdit*>(pwidget);
                        Q_CHECK_PTR( plineedit );
                        plineedit->setEchoMode(QLineEdit::Password);
                   }
               break;
          case QVariant::Bool:
                   pwidget = new QCheckBox("",this);
                   pcheckbox = qobject_cast<QCheckBox*>(pwidget);
                   if ( v.toBool() ) {
                         pcheckbox->setCheckState(Qt::Checked);
                   }
                   else {
                        pcheckbox->setCheckState(Qt::Unchecked);
                   }
                   break;
          case QVariant::Int:
                   pwidget = new QSpinBox();
                   pspinbox = qobject_cast<QSpinBox*>(pwidget);
                   pspinbox->setValue( v.toInt() );
               break;
          case QVariant::Double:
                    pwidget = new QDoubleSpinBox();
                    pdoublespinbox = qobject_cast<QDoubleSpinBox*>(pwidget);
                    pdoublespinbox->setValue( v.toDouble(&ok) );
               break;
          case QVariant::Date:
                    break;
          case QVariant::DateTime:
                    break;

          default:
               break;

     }
     return pwidget;

}
Пример #5
0
void NBioBSPRollDemo_Widget::Initialize()
{
   //Create a groupbox which layouts its childs in a columns
   // Device Function
   gbox_Device = new QButtonGroup(0, QGroupBox::Vertical, "Device Function", this); 
   gbox_Device->setGeometry(5,7,520,60);
   gbox_Device->setLineWidth(1);
  
   lbl_Device = new QLabel("Device List", this);
   //lbl_Device->setText("Device List");
   lbl_Device->setGeometry(15,40,80,10);
   
   cb_DEV_LIST = new QComboBox(FALSE, gbox_Device);
   Q_CHECK_PTR(cb_DEV_LIST);
   //cb_DEV_LIST->insertStrList(DeviceList, 1);
   cb_DEV_LIST->setGeometry(100,25,250,30);
   connect(cb_DEV_LIST, SIGNAL(activated(int)), this, SLOT(OnComboDeviceList()));
   //cb_DEV_LIST->setCurrentItem(0);
   m_DeviceID = NBioAPI_DEVICE_ID_AUTO;
   
   pb_OPEN = new QPushButton("&Open", gbox_Device, "Open");
   pb_OPEN->setGeometry(360, 25, 150, 30);
   connect(pb_OPEN, SIGNAL(clicked()), this, SLOT(OnBtnOpenDevice()));	
    
   ////////////////////////////////////////////////////////////////  
   // Capture Function   
   gbox_Capture = new QButtonGroup(0, QGroupBox::Vertical, "Capture Function", this); 
   gbox_Capture->setGeometry(5,90,490,355);
   gbox_Capture->setLineWidth(1);
   
   // Create a nice frame to put around the OpenGL widget	
   m_frmRoll = new QFrame(gbox_Capture, "CaptureFunction");
   m_frmRoll->setFrameStyle(QFrame::Sunken | QFrame::Panel);
   m_frmRoll->setLineWidth(1);
   m_frmRoll->setGeometry(5, 25, 300, 300);
   m_frmRoll->unsetPalette();
       
   ////////////////////////////////////////////////////////////////  
   // UI Setting   
   gbox_UISet = new QButtonGroup(0, QGroupBox::Vertical, "UI Setting", this); 
   gbox_UISet->setGeometry(310, 90, 565,140);
   gbox_UISet->setLineWidth(1);
   
   rb_DrawImageY = new QRadioButton("Yes,(Finger image drawing)", gbox_UISet, "rbDrawImageY");
   rb_DrawImageY->setGeometry(5, 20, 260, 20);
   connect(rb_DrawImageY, SIGNAL(clicked()), this, SLOT(OnRadioYes()));
   rb_DrawImageY->setChecked(true);
   m_ScanType = 1;
   
   rb_DrawImageN = new QRadioButton("No,(Finger image drawing)", gbox_UISet, "rbDrawImageY");
   rb_DrawImageN->setGeometry(5, 41, 260, 20);
   connect(rb_DrawImageN, SIGNAL(clicked()), this, SLOT(OnRadioNo()));
   
   gbox_UISet->setEnabled(false);  
   rb_DrawImageY->setEnabled(false);
   rb_DrawImageN->setEnabled(false);
   ////////////////////////////////////////////////////////////////  
   // Roll Capture 
   gbox_Type2 = new QButtonGroup(0, QGroupBox::Vertical, "Roll Capture", this); 
   gbox_Type2->setGeometry(310, 170, 510, 200);
   gbox_Type2->setLineWidth(1);
   
   pb_RollStart = new QPushButton("&Roll Live Capture Start", gbox_Type2, "ppRollStart");
   pb_RollStart->setGeometry(5, 20, 210, 30);
   connect(pb_RollStart, SIGNAL(clicked()), this, SLOT(OnBtnStart()));	
   pb_RollStart->setEnabled(false);
      
   ////////////////////////////////////////////////////////////////  
   // Match 
   gbox_Match = new QButtonGroup(0, QGroupBox::Vertical, "VerifyMatch", this); 
   gbox_Match->setGeometry(310,270,520,270);
   gbox_Match->setLineWidth(1);
   
   pb_RollMatch = new QPushButton("&Verify Match", gbox_Match, "VerifyMatch");
   pb_RollMatch->setGeometry(5, 20, 210, 30);
   connect(pb_RollMatch, SIGNAL(clicked()), this, SLOT(OnBtnVerifyMatch()));
   pb_RollMatch->setEnabled(false);
   
   pb_EXIT = new QPushButton("&Exit", gbox_Match, "VerifyMatch");
   pb_EXIT->setGeometry(5, 55, 210,30 );
   connect(pb_EXIT, SIGNAL(clicked()), this, SLOT(OnBtnExit()));
}
Пример #6
0
void KisDuplicateOp::paintAt(const KisPaintInformation& info)
{
    if (!painter()) return;

    if (!m_duplicateStartIsSet) {
        m_duplicateStartIsSet = true;
        m_duplicateStart = info.pos();
    }

    bool heal = settings->healing();

    if (!source()) return;

    KisBrushSP brush = m_brush;
    if (!brush) return;
    if (! brush->canPaintFor(info))
        return;

    double scale = KisPaintOp::scaleForPressure(info.pressure());
    QPointF hotSpot = brush->hotSpot(scale, scale);
    QPointF pt = info.pos() - hotSpot;

    // Split the coordinates into integer plus fractional parts. The integer
    // is where the dab will be positioned and the fractional part determines
    // the sub-pixel positioning.
    qint32 x;
    double xFraction;
    qint32 y;
    double yFraction;

    splitCoordinate(pt.x(), &x, &xFraction);
    splitCoordinate(pt.y(), &y, &yFraction);
    xFraction = yFraction = 0.0;

    QPointF srcPointF = pt - settings->offset();
    QPoint srcPoint = QPoint(x - static_cast<qint32>(settings->offset().x()),
                             y - static_cast<qint32>(settings->offset().y()));


    qint32 sw = brush->maskWidth(scale, 0.0);
    qint32 sh = brush->maskHeight(scale, 0.0);

    if (srcPoint.x() < 0)
        srcPoint.setX(0);

    if (srcPoint.y() < 0)
        srcPoint.setY(0);
    if (!(m_srcdev && !(*m_srcdev->colorSpace() == *source()->colorSpace()))) {
        m_srcdev = new KisPaintDevice(source()->colorSpace());
    }
    Q_CHECK_PTR(m_srcdev);

    // Perspective correction ?
    KisPainter copyPainter(m_srcdev);
    KisImageSP image = settings->m_image;
    if (settings->perspectiveCorrection() && image && image->perspectiveGrid()->countSubGrids() == 1) {
        Matrix3qreal startM = Matrix3qreal::Identity();
        Matrix3qreal endM = Matrix3qreal::Identity();

        // First look for the grid corresponding to the start point
        KisSubPerspectiveGrid* subGridStart = *image->perspectiveGrid()->begin();
        QRect r = QRect(0, 0, image->width(), image->height());

#if 1
        if (subGridStart) {
            startM = KisPerspectiveMath::computeMatrixTransfoFromPerspective(r, *subGridStart->topLeft(), *subGridStart->topRight(), *subGridStart->bottomLeft(), *subGridStart->bottomRight());
        }
#endif
#if 1
        // Second look for the grid corresponding to the end point
        KisSubPerspectiveGrid* subGridEnd = *image->perspectiveGrid()->begin();
        if (subGridEnd) {
            endM = KisPerspectiveMath::computeMatrixTransfoToPerspective(*subGridEnd->topLeft(), *subGridEnd->topRight(), *subGridEnd->bottomLeft(), *subGridEnd->bottomRight(), r);
        }
#endif

        // Compute the translation in the perspective transformation space:
        QPointF positionStartPaintingT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart));
        QPointF duplicateStartPositionT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart) - QPointF(settings->offset()));
        QPointF translat = duplicateStartPositionT - positionStartPaintingT;
        KisRectIteratorPixel dstIt = m_srcdev->createRectIterator(0, 0, sw, sh);
        KisRandomSubAccessorPixel srcAcc = source()->createRandomSubAccessor();
        //Action
        while (!dstIt.isDone()) {
            if (dstIt.isSelected()) {
                QPointF p =  KisPerspectiveMath::matProd(startM, KisPerspectiveMath::matProd(endM, QPointF(dstIt.x() + x, dstIt.y() + y)) + translat);
                srcAcc.moveTo(p);
                srcAcc.sampledOldRawData(dstIt.rawData());
            }
            ++dstIt;
        }


    } else {
        // Or, copy the source data on the temporary device:
        copyPainter.setCompositeOp(COMPOSITE_COPY);
        copyPainter.bitBlt(0, 0, source(), srcPoint.x(), srcPoint.y(), sw, sh);
        copyPainter.end();
    }

    // heal ?

    if (heal) {
        quint16 dataDevice[4];
        quint16 dataSrcDev[4];
        double* matrix = new double[ 3 * sw * sh ];
        // First divide
        const KoColorSpace* deviceCs = source()->colorSpace();
        KisHLineConstIteratorPixel deviceIt = source()->createHLineConstIterator(x, y, sw);
        KisHLineIteratorPixel srcDevIt = m_srcdev->createHLineIterator(0, 0, sw);
        double* matrixIt = &matrix[0];
        for (int j = 0; j < sh; j++) {
            for (int i = 0; !srcDevIt.isDone(); i++) {
                deviceCs->toLabA16(deviceIt.rawData(), (quint8*)dataDevice, 1);
                deviceCs->toLabA16(srcDevIt.rawData(), (quint8*)dataSrcDev, 1);
                // Division
                for (int k = 0; k < 3; k++) {
                    matrixIt[k] = dataDevice[k] / (double)qMax((int)dataSrcDev [k], 1);
                }
                ++deviceIt;
                ++srcDevIt;
                matrixIt += 3;
            }
            deviceIt.nextRow();
            srcDevIt.nextRow();
        }
        // Minimize energy
        {
            int iter = 0;
            double err;
            double* solution = new double [ 3 * sw * sh ];
            do {
                err = minimizeEnergy(&matrix[0], &solution[0], sw, sh);
                memcpy(&matrix[0], &solution[0], sw * sh * 3 * sizeof(double));
                iter++;
            } while (err < 0.00001 && iter < 100);
            delete [] solution;
        }

        // Finaly multiply
        deviceIt = source()->createHLineIterator(x, y, sw);
        srcDevIt = m_srcdev->createHLineIterator(0, 0, sw);
        matrixIt = &matrix[0];
        for (int j = 0; j < sh; j++) {
            for (int i = 0; !srcDevIt.isDone(); i++) {
                deviceCs->toLabA16(deviceIt.rawData(), (quint8*)dataDevice, 1);
                deviceCs->toLabA16(srcDevIt.rawData(), (quint8*)dataSrcDev, 1);
                // Multiplication
                for (int k = 0; k < 3; k++) {
                    dataSrcDev[k] = (int)CLAMP(matrixIt[k] * qMax((int) dataSrcDev[k], 1), 0, 65535);
                }
                deviceCs->fromLabA16((quint8*)dataSrcDev, srcDevIt.rawData(), 1);
                ++deviceIt;
                ++srcDevIt;
                matrixIt += 3;
            }
            deviceIt.nextRow();
            srcDevIt.nextRow();
        }
        delete [] matrix;
    }

    KisFixedPaintDeviceSP fixedDab = new KisFixedPaintDevice(m_srcdev->colorSpace());
    fixedDab->setRect(QRect(0, 0, sw, sh));
    fixedDab->initialize();

    m_srcdev->readBytes(fixedDab->data(), fixedDab->bounds());
    brush->mask(fixedDab, scale, scale, 0.0, info, xFraction, yFraction);
    m_srcdev->writeBytes(fixedDab->data(), fixedDab->bounds());

    QRect dabRect = QRect(0, 0, brush->maskWidth(scale, 0.0), brush->maskHeight(scale, 0.0));
    QRect dstRect = QRect(x, y, dabRect.width(), dabRect.height());

    if (painter()->bounds().isValid()) {
        dstRect &= painter()->bounds();
    }

    if (dstRect.isNull() || dstRect.isEmpty() || !dstRect.isValid()) return;

    qint32 sx = dstRect.x() - x;
    qint32 sy = dstRect.y() - y;
    sw = dstRect.width();
    sh = dstRect.height();

    painter()->bitBlt(dstRect.x(), dstRect.y(), m_srcdev, sx, sy, sw, sh);


}
ScPlugin* pathconnect_getPlugin()
{
	PathConnectPlugin* plug = new PathConnectPlugin();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #8
0
ScPlugin* scribusexportpixmap_getPlugin()
{
	PixmapExportPlugin* plug = new PixmapExportPlugin();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #9
0
ScPlugin* pathfinder_getPlugin()
{
	PathFinderPlugin* plug = new PathFinderPlugin();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #10
0
MatchScheduler::MatchScheduler(TopWidget *const &parent) :
    parent(parent) {
    Q_CHECK_PTR(parent);
    qDebug() << parent;
}
Пример #11
0
ScPlugin* lenseffects_getPlugin()
{
	LensEffectsPlugin* plug = new LensEffectsPlugin();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #12
0
void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestName, const QHostAddress &nameserver, QDnsLookupReply *reply)
{
    // Load dn_expand, res_ninit and res_nquery on demand.
    static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
    if (!triedResolve.loadAcquire()) {
        QMutexLocker locker(QMutexPool::globalInstanceGet(&local_res_ninit));
        if (!triedResolve.load()) {
            resolveLibrary();
            triedResolve.storeRelease(true);
        }
    }

    // If dn_expand, res_ninit or res_nquery is missing, fail.
    if (!local_dn_expand || !local_res_nclose || !local_res_ninit || !local_res_nquery) {
        reply->error = QDnsLookup::ResolverError;
        reply->errorString = tr("Resolver functions not found");
        return;
    }

    // Initialize state.
    struct __res_state state;
    memset(&state, 0, sizeof(state));
    if (local_res_ninit(&state) < 0) {
        reply->error = QDnsLookup::ResolverError;
        reply->errorString = tr("Resolver initialization failed");
        return;
    }

    //Check if a nameserver was set. If so, use it
    if (!nameserver.isNull()) {
        if (nameserver.protocol() == QAbstractSocket::IPv4Protocol) {
            state.nsaddr_list[0].sin_addr.s_addr = htonl(nameserver.toIPv4Address());
            state.nscount = 1;
        } else if (nameserver.protocol() == QAbstractSocket::IPv6Protocol) {
#if defined(Q_OS_LINUX)
            struct sockaddr_in6 *ns;
            ns = state._u._ext.nsaddrs[0];
            // nsaddrs will be NULL if no nameserver is set in /etc/resolv.conf
            if (!ns) {
                // Memory allocated here will be free'd in res_close() as we
                // have done res_init() above.
                ns = (struct sockaddr_in6*) calloc(1, sizeof(struct sockaddr_in6));
                Q_CHECK_PTR(ns);
                state._u._ext.nsaddrs[0] = ns;
            }
            // Set nsmap[] to indicate that nsaddrs[0] is an IPv6 address
            // See: https://sourceware.org/ml/libc-hacker/2002-05/msg00035.html
            state._u._ext.nsmap[0] = MAXNS + 1;
            state._u._ext.nscount6 = 1;
            ns->sin6_family = AF_INET6;
            ns->sin6_port = htons(53);

            Q_IPV6ADDR ipv6Address = nameserver.toIPv6Address();
            for (int i=0; i<16; i++) {
                ns->sin6_addr.s6_addr[i] = ipv6Address[i];
            }
#else
            qWarning() << Q_FUNC_INFO << "IPv6 addresses for nameservers is currently not supported";
            reply->error = QDnsLookup::ResolverError;
            reply->errorString = tr("IPv6 addresses for nameservers is currently not supported");
            return;
#endif
        }
    }
#ifdef QDNSLOOKUP_DEBUG
    state.options |= RES_DEBUG;
#endif
    QScopedPointer<struct __res_state, QDnsLookupStateDeleter> state_ptr(&state);

    // Perform DNS query.
    unsigned char response[PACKETSZ];
    memset(response, 0, sizeof(response));
    const int responseLength = local_res_nquery(&state, requestName, C_IN, requestType, response, sizeof(response));

    // Check the response header.
    HEADER *header = (HEADER*)response;
    const int answerCount = ntohs(header->ancount);
    switch (header->rcode) {
    case NOERROR:
        break;
    case FORMERR:
        reply->error = QDnsLookup::InvalidRequestError;
        reply->errorString = tr("Server could not process query");
        return;
    case SERVFAIL:
        reply->error = QDnsLookup::ServerFailureError;
        reply->errorString = tr("Server failure");
        return;
    case NXDOMAIN:
        reply->error = QDnsLookup::NotFoundError;
        reply->errorString = tr("Non existent domain");
        return;
    case REFUSED:
        reply->error = QDnsLookup::ServerRefusedError;
        reply->errorString = tr("Server refused to answer");
        return;
    default:
        reply->error = QDnsLookup::InvalidReplyError;
        reply->errorString = tr("Invalid reply received");
        return;
    }

    // Check the reply is valid.
    if (responseLength < int(sizeof(HEADER))) {
        reply->error = QDnsLookup::InvalidReplyError;
        reply->errorString = tr("Invalid reply received");
        return;
    }

    // Skip the query host, type (2 bytes) and class (2 bytes).
    char host[PACKETSZ], answer[PACKETSZ];
    unsigned char *p = response + sizeof(HEADER);
    int status = local_dn_expand(response, response + responseLength, p, host, sizeof(host));
    if (status < 0) {
        reply->error = QDnsLookup::InvalidReplyError;
        reply->errorString = tr("Could not expand domain name");
        return;
    }
    p += status + 4;

    // Extract results.
    int answerIndex = 0;
    while ((p < response + responseLength) && (answerIndex < answerCount)) {
        status = local_dn_expand(response, response + responseLength, p, host, sizeof(host));
        if (status < 0) {
            reply->error = QDnsLookup::InvalidReplyError;
            reply->errorString = tr("Could not expand domain name");
            return;
        }
        const QString name = QUrl::fromAce(host);

        p += status;
        const quint16 type = (p[0] << 8) | p[1];
        p += 2; // RR type
        p += 2; // RR class
        const quint32 ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
        p += 4;
        const quint16 size = (p[0] << 8) | p[1];
        p += 2;

        if (type == QDnsLookup::A) {
            if (size != 4) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid IPv4 address record");
                return;
            }
            const quint32 addr = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
            QDnsHostAddressRecord record;
            record.d->name = name;
            record.d->timeToLive = ttl;
            record.d->value = QHostAddress(addr);
            reply->hostAddressRecords.append(record);
        } else if (type == QDnsLookup::AAAA) {
            if (size != 16) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid IPv6 address record");
                return;
            }
            QDnsHostAddressRecord record;
            record.d->name = name;
            record.d->timeToLive = ttl;
            record.d->value = QHostAddress(p);
            reply->hostAddressRecords.append(record);
        } else if (type == QDnsLookup::CNAME) {
            status = local_dn_expand(response, response + responseLength, p, answer, sizeof(answer));
            if (status < 0) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid canonical name record");
                return;
            }
            QDnsDomainNameRecord record;
            record.d->name = name;
            record.d->timeToLive = ttl;
            record.d->value = QUrl::fromAce(answer);
            reply->canonicalNameRecords.append(record);
        } else if (type == QDnsLookup::NS) {
            status = local_dn_expand(response, response + responseLength, p, answer, sizeof(answer));
            if (status < 0) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid name server record");
                return;
            }
            QDnsDomainNameRecord record;
            record.d->name = name;
            record.d->timeToLive = ttl;
            record.d->value = QUrl::fromAce(answer);
            reply->nameServerRecords.append(record);
        } else if (type == QDnsLookup::PTR) {
            status = local_dn_expand(response, response + responseLength, p, answer, sizeof(answer));
            if (status < 0) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid pointer record");
                return;
            }
            QDnsDomainNameRecord record;
            record.d->name = name;
            record.d->timeToLive = ttl;
            record.d->value = QUrl::fromAce(answer);
            reply->pointerRecords.append(record);
        } else if (type == QDnsLookup::MX) {
            const quint16 preference = (p[0] << 8) | p[1];
            status = local_dn_expand(response, response + responseLength, p + 2, answer, sizeof(answer));
            if (status < 0) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid mail exchange record");
                return;
            }
            QDnsMailExchangeRecord record;
            record.d->exchange = QUrl::fromAce(answer);
            record.d->name = name;
            record.d->preference = preference;
            record.d->timeToLive = ttl;
            reply->mailExchangeRecords.append(record);
        } else if (type == QDnsLookup::SRV) {
            const quint16 priority = (p[0] << 8) | p[1];
            const quint16 weight = (p[2] << 8) | p[3];
            const quint16 port = (p[4] << 8) | p[5];
            status = local_dn_expand(response, response + responseLength, p + 6, answer, sizeof(answer));
            if (status < 0) {
                reply->error = QDnsLookup::InvalidReplyError;
                reply->errorString = tr("Invalid service record");
                return;
            }
            QDnsServiceRecord record;
            record.d->name = name;
            record.d->target = QUrl::fromAce(answer);
            record.d->port = port;
            record.d->priority = priority;
            record.d->timeToLive = ttl;
            record.d->weight = weight;
            reply->serviceRecords.append(record);
        } else if (type == QDnsLookup::TXT) {
            unsigned char *txt = p;
            QDnsTextRecord record;
            record.d->name = name;
            record.d->timeToLive = ttl;
            while (txt < p + size) {
                const unsigned char length = *txt;
                txt++;
                if (txt + length > p + size) {
                    reply->error = QDnsLookup::InvalidReplyError;
                    reply->errorString = tr("Invalid text record");
                    return;
                }
                record.d->values << QByteArray((char*)txt, length);
                txt += length;
            }
            reply->textRecords.append(record);
        }
        p += size;
        answerIndex++;
    }
}
Пример #13
0
KisImageBuilder_Result PSDLoader::decode(const KUrl& uri)
{
    // open the file
    QFile f(uri.toLocalFile());
    if (!f.exists()) {
        return KisImageBuilder_RESULT_NOT_EXIST;
    }
    if (!f.open(QIODevice::ReadOnly)) {
        return KisImageBuilder_RESULT_FAILURE;
    }

    dbgFile << "pos:" << f.pos();

    PSDHeader header;
    if (!header.read(&f)) {
        dbgFile << "failed reading header: " << header.error;
        return KisImageBuilder_RESULT_FAILURE;
    }

    dbgFile << header;
    dbgFile << "Read header. pos:" << f.pos();

    PSDColorModeBlock colorModeBlock(header.colormode);
    if (!colorModeBlock.read(&f)) {
        dbgFile << "failed reading colormode block: " << colorModeBlock.error;
        return KisImageBuilder_RESULT_FAILURE;
    }

    dbgFile << "Read color mode block. pos:" << f.pos();

    PSDResourceSection resourceSection;
    if (!resourceSection.read(&f)) {
        dbgFile << "failed reading resource section: " << resourceSection.error;
        return KisImageBuilder_RESULT_FAILURE;
    }

    dbgFile << "Read resource section. pos:" << f.pos();

    PSDLayerSection layerSection(header);
    if (!layerSection.read(&f)) {
        dbgFile << "failed reading layer section: " << layerSection.error;
        return KisImageBuilder_RESULT_FAILURE;
    }
    // XXX: add all the image resource blocks as annotations to the image

    dbgFile << "Read layer section. " << layerSection.nLayers << "layers. pos:" << f.pos();

    // Get the right colorspace
    QPair<QString, QString> colorSpaceId = psd_colormode_to_colormodelid(header.colormode,
                                                                         header.channelDepth);
    if (colorSpaceId.first.isNull()) return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;

    // Get the icc profile!
    const KoColorProfile* profile = 0;
    if (resourceSection.resources.contains(PSDResourceSection::ICC_PROFILE)) {
        ICC_PROFILE_1039 *iccProfileData = dynamic_cast<ICC_PROFILE_1039*>(resourceSection.resources[PSDResourceSection::ICC_PROFILE]->resource);
        if (iccProfileData ) {
            profile = KoColorSpaceRegistry::instance()->createColorProfile(colorSpaceId.first,
                                                                       colorSpaceId.second,
                                                                       iccProfileData->icc);
            dbgFile  << "Loaded ICC profile" << profile->name();
        }

    }

    // Create the colorspace
    const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId.first, colorSpaceId.second, profile);
    if (!cs) {
        return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
    }

    // Creating the KisImageWSP
    m_image = new KisImage(m_doc->createUndoStore(),  header.width, header.height, cs, "built image");
    Q_CHECK_PTR(m_image);
    m_image->lock();

    // set the correct resolution
    if (resourceSection.resources.contains(PSDResourceSection::RESN_INFO)) {
        RESN_INFO_1005 *resInfo = dynamic_cast<RESN_INFO_1005*>(resourceSection.resources[PSDResourceSection::RESN_INFO]->resource);
        if (resInfo) {
            m_image->setResolution(POINT_TO_INCH(resInfo->hRes), POINT_TO_INCH(resInfo->vRes));
            // let's skip the unit for now; we can only set that on the KoDocument, and krita doesn't use it.
        }
    }
    // Preserve the duotone colormode block for saving back to psd
    if (header.colormode == DuoTone) {
        KisAnnotationSP annotation = new KisAnnotation("DuotoneColormodeBlock",
                                                       i18n("Duotone Colormode Block"),
                                                       colorModeBlock.data);
        m_image->addAnnotation(annotation);
    }

    // read the projection into our single layer
    if (layerSection.nLayers == 0) {
        dbgFile << "Position" << f.pos() << "Going to read the projection into the first layer, which Photoshop calls 'Background'";

        KisPaintLayerSP layer = new KisPaintLayer(m_image, i18n("Background"), OPACITY_OPAQUE_U8);
        KisTransaction("", layer -> paintDevice());

        PSDImageData imageData(&header);
        imageData.read(&f, layer->paintDevice());

        //readLayerData(&f, layer->paintDevice(), f.pos(), QRect(0, 0, header.width, header.height));
        m_image->addNode(layer, m_image->rootLayer());

    }
    else {

        // read the channels for the various layers
        for(int i = 0; i < layerSection.nLayers; ++i) {

            // XXX: work out the group layer structure in Photoshop, as well as the adjustment layers

            PSDLayerRecord* layerRecord = layerSection.layers.at(i);
            dbgFile << "Going to read channels for layer" << i << layerRecord->layerName;

            KisPaintLayerSP layer = new KisPaintLayer(m_image, layerRecord->layerName, layerRecord->opacity);
            layer->setCompositeOp(psd_blendmode_to_composite_op(layerRecord->blendModeKey));
            if (!layerRecord->readPixelData(&f, layer->paintDevice())) {
                dbgFile << "failed reading channels for layer: " << layerRecord->layerName << layerRecord->error;
                return KisImageBuilder_RESULT_FAILURE;
            }

            m_image->addNode(layer, m_image->rootLayer());
            layer->setVisible(layerRecord->visible);
        }
    }

    m_image->unlock();
    return KisImageBuilder_RESULT_OK;
}
Пример #14
0
KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(const QByteArray& from, const QByteArray& to)
{
    dbgFile << "HeightMap export! From:" << from << ", To:" << to;

    if (from != "application/x-krita")
        return KisImportExportFilter::NotImplemented;

    KisDocument *inputDoc = inputDocument();
    QString filename = outputFile();

    if (!inputDoc)
        return KisImportExportFilter::NoDocumentCreated;

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

    KisImageWSP image = inputDoc->image();
    Q_CHECK_PTR(image);

    if (inputDoc->image()->width() != inputDoc->image()->height()) {
        inputDoc->setErrorMessage(i18n("Cannot export this image to a heightmap: it is not square"));
        return KisImportExportFilter::WrongFormat;
    }

    if (inputDoc->image()->colorSpace()->colorModelId() != GrayAColorModelID) {
        inputDoc->setErrorMessage(i18n("Cannot export this image to a heightmap: it is not grayscale"));
        return KisImportExportFilter::WrongFormat;
    }

    KoDialog* kdb = new KoDialog(0);
    kdb->setWindowTitle(i18n("HeightMap Export Options"));
    kdb->setButtons(KoDialog::Ok | KoDialog::Cancel);

    Ui::WdgOptionsHeightMap optionsHeightMap;

    QWidget* wdg = new QWidget(kdb);
    optionsHeightMap.setupUi(wdg);

    kdb->setMainWidget(wdg);
    QApplication::restoreOverrideCursor();

    QString filterConfig = KisConfig().exportConfiguration("HeightMap");
    KisPropertiesConfiguration cfg;
    cfg.fromXML(filterConfig);

    optionsHeightMap.intSize->setValue(image->width());

    int endianness = cfg.getInt("endianness", 0);
    QDataStream::ByteOrder bo = QDataStream::LittleEndian;
    optionsHeightMap.radioPC->setChecked(true);

    if (endianness == 0) {
        bo = QDataStream::BigEndian;
        optionsHeightMap.radioMac->setChecked(true);
    }

    if (!getBatchMode()) {
        if (kdb->exec() == QDialog::Rejected) {
            return KisImportExportFilter::UserCancelled;
        }
    }

    if (optionsHeightMap.radioMac->isChecked()) {
        cfg.setProperty("endianness", 0);
        bo = QDataStream::BigEndian;
    }
    else {
        cfg.setProperty("endianness", 1);
        bo = QDataStream::LittleEndian;
    }
    KisConfig().setExportConfiguration("HeightMap", cfg);

    bool downscale = false;
    if (to == "image/x-r8" && image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) {

        downscale = (QMessageBox::question(0,
                                           i18nc("@title:window", "Downscale Image"),
                                           i18n("You specified the .r8 extension for a 16 bit/channel image. Do you want to save as 8 bit? Your image data will not be changed."),
                                           QMessageBox::Yes | QMessageBox::No)
                          == QMessageBox::Yes);
    }


    // the image must be locked at the higher levels
    KIS_SAFE_ASSERT_RECOVER_NOOP(image->locked());
    KisPaintDeviceSP pd = new KisPaintDevice(*image->projection());

    QFile f(filename);
    f.open(QIODevice::WriteOnly);
    QDataStream s(&f);
    s.setByteOrder(bo);

    KisRandomConstAccessorSP it = pd->createRandomConstAccessorNG(0, 0);
    bool r16 = ((image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) && !downscale);
    for (int i = 0; i < image->height(); ++i) {
        for (int j = 0; j < image->width(); ++j) {
            it->moveTo(i, j);
            if (r16) {
                s << KoGrayU16Traits::gray(const_cast<quint8*>(it->rawDataConst()));
            }
            else {
                s << KoGrayU8Traits::gray(const_cast<quint8*>(it->rawDataConst()));
            }
        }
    }

    f.close();
    return KisImportExportFilter::OK;
}
Пример #15
0
BrushProperties::BrushProperties( QWidget *parent ) : QDialog( parent, "Brush Properties", true )
{
    Q_CHECK_PTR( parent );

    //Initializations
    setCaption( tr( "Brush Properties" ) );
    setFont( QFont( "helvetica", 10 ) );
    parent_widget = parent;
    resize( 235, 155 );
    setMinimumSize( 235, 155 );
    setMaximumSize( 235, 155 );
    drawing_area = ( DrawingArea * )parent_widget;

    //------------- Operations on the static texts ----------

    text_origin = new QLabel( tr( "Origin Point" ) + QString( ":" ), this );
    text_origin -> resize( 100, 20 );
    text_origin -> move( 10, 10 );

    text_origin_x = new QLabel( "X", this );
    text_origin_x -> resize( 15, 20 );
    text_origin_x -> move( text_origin -> x() + text_origin -> width() + 5, text_origin -> y() );

    text_origin_y = new QLabel( "Y", this );
    text_origin_y -> resize( 15, 20 );
    text_origin_y -> move( text_origin_x -> x() + text_origin_x -> width() + 45, text_origin_x -> y() );

    text_pattern = new QLabel( tr( "Border Style" ) + QString( ":" ), this );
    text_pattern -> resize( 100, 20 );
    text_pattern -> move( text_origin -> x(), text_origin -> y() + text_origin -> height() + 5 );

    text_factor = new QLabel( tr( "Stipple Factor" ) + QString( ":" ), this );
    text_factor -> resize( 100, 20 );
    text_factor -> move( text_pattern -> x(), text_pattern -> y() + text_pattern -> height() + 5 );

    text_angle = new QLabel( tr( "Rotation Angle" ) + QString( ":" ), this );
    text_angle -> resize( 100, 20 );
    text_angle -> move( text_factor -> x(), text_factor -> y() + text_factor -> height() + 5 );

    //------------- Operations on the Textfields -------------

    value_origin_x = new QLineEdit( this );
    value_origin_x -> resize( 30, 20 );
    value_origin_x -> move( text_origin_x -> x() + text_origin_x -> width() + 5, text_origin_x -> y() );

    value_origin_y = new QLineEdit( this );
    value_origin_y -> resize( 30, 20 );
    value_origin_y -> move( text_origin_y -> x() + text_origin_y -> width() + 5, text_origin_y -> y() );

    value_factor = new QLineEdit( this );
    value_factor -> resize( 110, 20 );
    value_factor -> move( text_factor -> x() + text_factor -> width() + 5, text_factor -> y() );

    value_angle = new QLineEdit( this );
    value_angle -> resize( 110, 20 );
    value_angle -> move( text_angle -> x() + text_angle -> width() + 5, text_angle -> y() );

    //------------- Operations on other components -------------

    QStringList p_str;
    p_str << "___________" << "_ _ _ _ _ _ _" << "_  _  _  _  _" << ". . . . . . . . ." << ". _ . _ . _ . _"
     	  << "___ ___ ___" << "___ _ ___ _" << "___  _  ___";
    value_pattern = new QComboBox( this );
    value_pattern -> insertStringList( p_str );
    value_pattern -> resize( 110, 20 );
    value_pattern -> move( text_pattern -> x() + text_pattern -> width() + 5, text_pattern -> y() );

    //------------- Operations on the buttons -----------------

    accept = new QPushButton( tr( "Accept" ), this );
    accept -> resize( 60, 30 );
    accept -> move( text_angle -> x() + 45, text_angle -> y() + text_angle -> height() + 10 );
    connect( accept, SIGNAL( clicked() ), SLOT( slotAccept() ) );

    cancel = new QPushButton( tr( "Cancel" ), this );
    cancel -> resize( 60, 30 );
    cancel -> move( accept -> x() + accept -> width() + 5, accept -> y() );
    connect( cancel, SIGNAL( clicked() ), SLOT( slotCancel() ) );
}
Пример #16
0
ScPlugin* importvsd_getPlugin()
{
    ImportVsdPlugin* plug = new ImportVsdPlugin();
    Q_CHECK_PTR(plug);
    return plug;
}
Пример #17
0
ScPlugin* barcodegenerator_getPlugin()
{
	Barcode* plug = new Barcode();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #18
0
bool BpDocument::composeGraphs( bool lineGraphs, bool showDialogs )
{

    // Bar graph settings
    int    tics = 2;
    double max  = 100.;
    double min  = 0.;
    // Line graph settings
    if ( lineGraphs )
    {
        tics = 11;
        max = tableRow( tableRows()-1 );
        min = tableRow(0);
    }
    GraphAxleParms *xParms = new GraphAxleParms( min, max, tics );
    checkmem( __FILE__, __LINE__, xParms, "GraphAxleParms xParms", 1 );
    if ( lineGraphs && min > 0.
      && property()->boolean( "graphXOriginAtZero" ) )
    {
        xParms->useOrigin();
    }

    // Determine the x-, y-, and z-variables.
    EqVar *xVar = m_eqTree->m_rangeVar[0];
    EqVar *zVar = m_eqTree->m_rangeVar[1];
    EqVar *yVar = 0;

    //--------------------------------------------------------------------------
    // 2: Determine nice axis parameters for the x- and all the y-variables.
    //--------------------------------------------------------------------------

    // Initialize the Y axle for each graph to a nice range
    QPtrList<GraphAxleParms> *yParmsList = new QPtrList<GraphAxleParms>();
    yParmsList->setAutoDelete( true );
    GraphAxleParms *yParms = 0;
    int yid;
    for ( yid = 0;
          yid < tableVars();
          yid++ )
    {
        yVar = tableVar( yid );
        yParms = 0;
        // The yVar must be continuous.
        if ( yVar->isContinuous() )
        {
            // Get Y range
            if ( lineGraphs )
            {
                graphYMinMax( yid, min, max );
            }
            else
            {
                barYMinMax( yid, min, max );
            }
            // Determine and store nice axis parameters
            tics = 11;
            yParms = new GraphAxleParms( min, max, tics );
            checkmem( __FILE__, __LINE__, yParms, "GraphAxleParms yParms", 1 );
            yParmsList->append( yParms );
            // If bar graph, or line graphs must start at origin
            if ( min > 0. )
            {
                if ( ! lineGraphs
                    || property()->boolean( "graphYOriginAtZero" ) )
                {
                    yParms->useOrigin();
                }
            }
            // If min and max are the same, make them different
            if ( min == max )
            {
                yParms->setAxle( min-1., max+1., 3 );
            }
        }
    }

    //--------------------------------------------------------------------------
    // 1: Allow the user to change the axle parameters.
    //--------------------------------------------------------------------------

    if ( showDialogs
      && property()->boolean( "graphYUserRange" ) )
    {
        GraphLimitsDialog *dialog =
            new GraphLimitsDialog( this, yParmsList, "graphLimitsDialog" );
        checkmem( __FILE__, __LINE__, dialog, "GraphLimitsDialog dialog", 1 );
        if ( dialog->exec() == QDialog::Accepted )
        {
            dialog->store();
        }
        delete dialog;  dialog = 0;
    }

    //--------------------------------------------------------------------------
    // 3: Draw each graph.
    //--------------------------------------------------------------------------

    // Set up the progress dialog.
    int step = 0;
    int steps = tableVars();
    QString text(""), button("");
    if ( lineGraphs )
    {
        translate( text, "BpDocument:Graphs:DrawingLineGraphs" );
    }
    else
    {
        translate( text, "BpDocument:Graphs:DrawingBarGraphs" );
    }
    translate( button, "BpDocument:Graphs:Abort" );
    QProgressDialog *progress = new QProgressDialog(
        QString( text ).arg( steps ), button, steps );
    Q_CHECK_PTR( progress );
    progress->setMinimumDuration( 0 );
    progress->setProgress( 0 );

    // Loop for each output variable: one graph is composed per output variable.
    bool result = true;
    for ( yid = 0, yParms = yParmsList->first();
          yid < tableVars();
          yid++ )
    {
        yVar = tableVar( yid );
        // The yVar must be continuous.
        if ( yVar->isContinuous() )
        {
            // Recompute nice Y axis
            //min = ( yParms->m_axleMin < yParms->m_dataMin )
            //    ? yParms->m_axleMin
            //    : yParms->m_dataMin;
            min = yParms->m_axleMin;
            //max = ( yParms->m_axleMax > yParms->m_dataMax )
            //    ? yParms->m_axleMax
            //    : yParms->m_dataMax;
            max = yParms->m_axleMax;
            // If min and max are the same, make them different
            tics = 11;
            if ( min == max )
            {
                yParms->setAxle( min-1., max+1., 3 );
            }
            // Compose this graph.
            if ( lineGraphs )
            {
                composeLineGraph( yid, xVar, yVar, zVar, xParms, yParms );
            }
            else
            {
                composeBarGraph( yid, xVar, yVar, xParms, yParms );
            }
            // Update progress dialog.
            progress->setProgress( ++step );
            qApp->processEvents();
            if ( progress->wasCancelled() )
            {
                result = false;
                break;
            }
            yParms = yParmsList->next();
        }
    }
    // Cleanup and return.
    delete progress;    progress = 0;
    delete xParms;      xParms = 0;
    delete yParmsList;  yParmsList = 0;
    return( result );
}
void SdtpCatalogDataProvider::fetch(int type, void *param)
{
    switch(type) {
    case FoldersRecursive:
    {
        XFolder* parent = static_cast<XFolder*>(param);
        Q_CHECK_PTR(parent);

        QUrl url( QString(SDTP_URL_GETALLCATS) );
        createRequest(url, FoldersRecursive, parent);

        break;
    }

    case Folders:
    {
        XFolder* parent = static_cast<XFolder*>(param);
        Q_CHECK_PTR(parent);

        QUrl url( QString(SDTP_URL_GETCATS).arg(parent->id()) );
        createRequest(url, Folders, parent);

        break;
    }

    case Files:
    {
        XFolder* parent = static_cast<XFolder*>(param);
        Q_CHECK_PTR(parent);

        QUrl url( QString(SDTP_URL_GETFILES).arg(parent->id()) );
        createRequest(url, Files, parent);

        break;
    }

    case FileDetails:
    {
        XFile* file = static_cast<XFile*>(param);
        Q_CHECK_PTR(file);

        QUrl url( QString(SDTP_URL_GETDETAILS).arg(file->id()) );
        createRequest(url, FileDetails, file);

        break;
    }

    case Thumbnail:
    {
        XFile* file = static_cast<XFile*>(param);
        Q_CHECK_PTR(file);

        QUrl url( file->thumbLink() );
        createRequest(url, Thumbnail, file);

        break;
    }

    default:
        qDebug("Unknown request type '%d'", static_cast<quint32>(type));
    }

}
Пример #20
0
QString Calendar::getDayName() 
{
	CalendarModel * tmpCal = DataTheme.general.getCalendar();
	Q_CHECK_PTR(tmpCal);
	return tmpCal->getLevelName(0,(_day-1));
}
Пример #21
0
void OptionsDialog::doSaveConfs() {
     MainWindow* mw = qobject_cast<MainWindow*>(parent());
     Q_CHECK_PTR( mw );
     TextEdit* te = mw->centraledit();
     for( int i = 0; i < te->listConfs().count(); i++) {
          QString wkey = te->listConfs().at(i)["namewidget"].toString();
          QMap<QString,QWidget*> mymap =  widgetmap [ wkey ];
          QMap<QString,QVariant>& myconf = const_cast<QMap<QString,QVariant>&>(te->listConfs().at(i));
          for(int j=0; j < mymap.keys().count(); j++) {
               QWidget* pwidget = mymap.value( mymap.keys().at(j));
               qDebug("...doSaveConfs()...(3)...mymap.keys().at(j): %s", qPrintable(mymap.keys().at(j)));
               if (pwidget != NULL) {
//                    qDebug("...doSaveConfs()...(4).i=%d..mymap.keys().at(%d):%s", i, j, qPrintable(mymap.keys().at(j)));
//                    qDebug("...doSaveConfs()...(6)...te->listConfs().at(%d)[\"namewidget\"]=%s",i,
//                           qPrintable(te->listConfs().at(i)["namewidget"].toString()));
//                         qDebug("...doSaveConfs()...(10)...te->listConfs().at(i).count(): %d",
//                                te->listConfs().at(i).count());
                    if ( te->listConfs().at(i)[mymap.keys().at(j)].type() == QVariant::String ) {
 //                        qDebug("...doSaveConfs()...(9)...");
                         QLineEdit* pedit = qobject_cast<QLineEdit*>(pwidget);
                         QString text = "";
                         if ( pedit == NULL) {
                            QComboBox* pcombo = qobject_cast<QComboBox*>(pwidget);                            
                            if ( pcombo == NULL ) {
                                InflowEditQListWidget* editlistwidget = (qobject_cast<InflowEditQListWidget*>(pwidget));
                                Q_CHECK_PTR( editlistwidget );
                                QString text = editlistwidget->editList().join(";");
                                text +=";";
                                myconf[mymap.keys().at(j)] = text;
                                qDebug("...OptionsDialog::doSaveConfs: |%s|",
                                       qPrintable(text));
                                continue;
                            }

                             for(int k=0;k<pcombo->count();k++){
                                    text += pcombo->itemText(k);
                                    if (k == pcombo->currentIndex() ) text += "+";
                                    text += ",";
                             }
                             text.chop(1);                        

           //              qDebug("...doSaveConfs()...(10)...combobox...text: %s", qPrintable(text));
                         myconf[mymap.keys().at(j)] = text;

                         } else {
                             QString text = (pedit)->text();

             //                qDebug("...doSaveConfs()...(8)...lineedit...text: %s", qPrintable(text));

                             myconf[mymap.keys().at(j)] = text;
                         }

                    }
                    else if (te->listConfs().at(i)[mymap.keys().at(j)].type() == QVariant::Int ) {
                         int value = (qobject_cast<QSpinBox*>(pwidget))->value();
                         myconf[mymap.keys().at(j)] = value;
                    }
                    else if (te->listConfs().at(i)[mymap.keys().at(j)].type() == QVariant::Bool ) {
                         Qt::CheckState state  = (qobject_cast<QCheckBox*>(pwidget))->checkState();
                         myconf[mymap.keys().at(j)] = (state == Qt::Checked);
                    }

               }
          }
     } 

}
Пример #22
0
StandardWizard::StandardWizard( BpDocument *bp, EqVar *var,
        unsigned int items,
        const double value[],
        const QString textKey[],
        const QString &col0Key,
        const QString &col1Key,
        const QString &pictureFile,
        const QString &pictureName,
        const char *name ) :
    WizardDialog( bp, var, pictureFile, pictureName, name )
{
    QString text("");
    // If no value column header, display the units
    if ( col0Key.isNull() || col0Key.isEmpty() )
    {
        m_listView->setColumnText( 0, var->m_displayUnits );
    }
    // Otherwise display the text key.
    else
    {
        translate( text, col0Key );
        m_listView->setColumnText( 0, text );
    }
    m_listView->setColumnWidthMode( 0, QListView::Maximum );
    translate( text, col1Key );
    m_listView->addColumn( text );
    m_listView->setColumnWidthMode( 1, QListView::Maximum );
    m_listView->setSorting( -1 );

    // Add the list items
    QListViewItem *item;
    QString str;
    for ( int id = items-1;
          id >= 0;
          id-- )
    {
        var->nativeValue( value[id] );
        str = QString( "%1" ).arg( var->m_displayValue, 10, 'f', var->m_displayDecimals ),
        translate( text, textKey[id] );
        item = new QListViewItem( m_listView, str, text );
        Q_CHECK_PTR( item );
    }
    // Make the column at least as wide as its header
    QFontMetrics fm( m_listView->header()->font() );
    for ( int col = 0;
          col < 2;
          col++ )
    {
        int colWidth = m_listView->columnWidth( col );
        int hdrWidth = fm.width( m_listView->columnText( col ) ) + 10;
        if ( colWidth < hdrWidth )
        {
            m_listView->setColumnWidthMode( col, QListView::Manual );
            m_listView->setColumnWidth( col, hdrWidth );
        }
    }
    // Override the default listview min and max widths
    m_listView->setMinimumWidth( m_listView->sizeHint().width() );

    // Set the initial size for this widget so the entire picture,
    // a good chunk of both the listView and textBrowser are visible.
    int width = widthHint() + m_listView->sizeHint().width();
    resize( width, sizeHint().height() );
    return;
}
Пример #23
0
ScriptEdit::ScriptEdit(ScriptingEnv *env, QWidget *parent, const char *name)
  : QTextEdit(parent, name), scripted(env), d_error(false), d_completer(0),
  d_file_name(QString::null), d_search_string(QString::null)
{
	myScript = scriptEnv->newScript("", this, name);
	connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SLOT(insertErrorMsg(const QString&)));
	connect(myScript, SIGNAL(print(const QString&)), this, SLOT(scriptPrint(const QString&)));

	setLineWrapMode(NoWrap);
	setUndoRedoEnabled(true);
	setTextFormat(Qt::PlainText);
	setAcceptRichText (false);

#ifdef SCRIPTING_PYTHON
	if (scriptEnv->name() == QString("Python"))
		d_highlighter = new PythonSyntaxHighlighter(this);
	else
		d_highlighter = NULL;
#endif

	d_fmt_default.setBackground(palette().brush(QPalette::Base));

	printCursor = textCursor();
	scriptsDirPath = qApp->applicationDirPath();

	actionExecute = new QAction(tr("E&xecute"), this);
	actionExecute->setShortcut( tr("Ctrl+J") );
	connect(actionExecute, SIGNAL(activated()), this, SLOT(execute()));

	actionExecuteAll = new QAction(tr("Execute &All"), this);
	actionExecuteAll->setShortcut( tr("Ctrl+Shift+J") );
	connect(actionExecuteAll, SIGNAL(activated()), this, SLOT(executeAll()));

	actionEval = new QAction(tr("&Evaluate Expression"), this);
	actionEval->setShortcut( tr("Ctrl+Return") );
	connect(actionEval, SIGNAL(activated()), this, SLOT(evaluate()));

	actionPrint = new QAction(QPixmap(fileprint_xpm), tr("&Print"), this);
	connect(actionPrint, SIGNAL(activated()), this, SLOT(print()));

	actionImport = new QAction(tr("&Import..."), this);
	actionImport->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_O));
	connect(actionImport, SIGNAL(activated()), this, SLOT(importASCII()));

	QShortcut *accelImport = new QShortcut(actionImport->shortcut(), this);
	connect(accelImport, SIGNAL(activated()), this, SLOT(importASCII()));

	actionSave = new QAction(QPixmap(filesave_xpm), tr("&Save"), this);
	actionSave->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_S));
	connect(actionSave, SIGNAL(activated()), this, SLOT(save()));

	QShortcut *accelSave = new QShortcut(actionSave->shortcut(), this);
	connect(accelSave, SIGNAL(activated()), this, SLOT(save()));

	actionExport = new QAction(QIcon(QPixmap(filesaveas_xpm)), tr("Sa&ve as..."), this);
	connect(actionExport, SIGNAL(activated()), this, SLOT(exportASCII()));

	actionFind = new QAction(QPixmap(find_xpm), tr("&Find..."), this);
	actionFind->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_F));
	connect(actionFind, SIGNAL(activated()), this, SLOT(showFindDialog()));

	QShortcut *accelFind = new QShortcut(actionFind->shortcut(), this);
	connect(accelFind, SIGNAL(activated()), this, SLOT(showFindDialog()));

	actionReplace = new QAction(tr("&Replace..."), this);
	actionReplace->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_R));
	connect(actionReplace, SIGNAL(activated()), this, SLOT(replace()));

	QShortcut *accelReplace = new QShortcut(actionReplace->shortcut(), this);
	connect(accelReplace, SIGNAL(activated()), this, SLOT(replace()));

	actionFindNext = new QAction(tr("&Find next"), this);
	actionFindNext->setShortcut(QKeySequence(Qt::Key_F3));
	connect(actionFindNext, SIGNAL(activated()), this, SLOT(findNext()));

	QShortcut *accelFindNext = new QShortcut(actionFindNext->shortcut(), this);
	connect(accelFindNext, SIGNAL(activated()), this, SLOT(findNext()));

	actionFindPrevious = new QAction(tr("&Find previous"), this);
	actionFindPrevious->setShortcut(QKeySequence(Qt::Key_F4));
	connect(actionFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious()));

	QShortcut *accelFindPrevious = new QShortcut(actionFindPrevious->shortcut(), this);
	connect(accelFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious()));

	functionsMenu = new QMenu(this);
	Q_CHECK_PTR(functionsMenu);
	connect(functionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(insertFunction(QAction *)));
}
Пример #24
0
void ImageHandler::setSquareSize(int size)
#endif //DONTREDRAWSTONES
{
	QSettings settings;

	Q_CHECK_PTR(stonePixmaps);
	Q_CHECK_PTR(ghostPixmaps);
	
	int stone_look =  ( isDisplayBoard ? 1 : settings.value("STONES_LOOK").toInt());
	int smallstones_size;	
	
	stonePixmaps->clear();
	ghostPixmaps->clear();
	if(preferences.terr_stone_mark)
	{
		smallstones_size = (int)(size / SMALL_STONE_TERR_DIVISOR);
		smallStonePixmaps->clear();
	}

	//repaint black stones
	QImage ib = QImage(size, size, QImage::Format_ARGB32);
	QImage iws;
//	ib.setAlphaBuffer(TRUE);
	paintBlackStone(ib, size, stone_look);
	//stonePixmaps->append(QPixmap::fromImage(ib));//, 
//		Qt::PreferDither | 
//		Qt::DiffuseAlphaDither | 
//		Qt::DiffuseDither) );
//	stonePixmaps->image(0)->setOffset(size/2, size/2);
	stonePixmaps->append(QPixmap::fromImage(ib, 
			Qt::PreferDither | 
			Qt::DiffuseAlphaDither | 
			Qt::DiffuseDither) );
	
	QImage gb(ib);
	ghostImage(&gb);
	ghostPixmaps->append(QPixmap::fromImage(gb));

	//small black stone
	if(preferences.terr_stone_mark)
	{
		QImage ibs = QImage(smallstones_size, smallstones_size, QImage::Format_ARGB32);
		paintBlackStone(ibs, smallstones_size, stone_look);
		smallStonePixmaps->append(QPixmap::fromImage(ibs));

		// small white stones
		iws = QImage(smallstones_size, smallstones_size, QImage::Format_ARGB32);
	}
	// white stones	
	QImage iw1 = QImage(size, size, QImage::Format_ARGB32);

	
	
	for (int i=1 ;	i<=WHITE_STONES_NB;	i++)
	{
		paintWhiteStone(iw1, size, stone_look);
		//stonePixmaps->append(QPixmap::fromImage(iw1));
		stonePixmaps->append(QPixmap::fromImage(iw1, 
			Qt::PreferDither | 
			Qt::DiffuseAlphaDither | 
			Qt::DiffuseDither)   );
		QImage gw1(iw1);
		ghostImage(&gw1);
		ghostPixmaps->append(QPixmap::fromImage(gw1));
		
		if(preferences.terr_stone_mark)
		{
			paintWhiteStone(iws, smallstones_size, stone_look);
			smallStonePixmaps->append(QPixmap::fromImage(iws));
			
			/*smallStonePixmaps->append(QPixmap::fromImage(iws, 
					     	Qt::PreferDither | 
						Qt::DiffuseAlphaDither | 
				  		Qt::DiffuseDither)   );*/
		}
	}
	
	// shadow
	QImage is = QImage(size, size, QImage::Format_ARGB32);

	if (stone_look == 0)
		paintShadowStone(is, size);
	else
		is.fill(0);

	//stonePixmaps->append(QPixmap::fromImage(is));
	stonePixmaps->append(QPixmap::fromImage(is, 
			Qt::PreferDither | 
			Qt::DiffuseAlphaDither | 
			Qt::DiffuseDither)  );
}
Пример #25
0
ScPlugin* importviva_getPlugin()
{
	ImportVivaPlugin* plug = new ImportVivaPlugin();
	Q_CHECK_PTR(plug);
	return plug;
}
Пример #26
0
ImageHandler::ImageHandler()
{
	// Load the pixmaps
//	if (tablePixmap == NULL)
		tablePixmap =  new QPixmap(":/new/prefix1/ressources/pics/table.png");
//	if (woodPixmap1 == NULL)
		woodPixmap1 =  new QPixmap(":/new/prefix1/ressources/pics/wood.png");
		/* I wanted to make it look like an old style go manual, but apparently
		 * this is possible by changing the stone type to "Ugly 2d" and I 
		 * made this little paper graphic with some speckle... but I'll add a
		 * comment here in case someone else has the same bright idea for a
		 * "classic" mode */
		//paperPixmap =  new QPixmap(":/new/prefix1/ressources/pics/paper.png");

//    if (tablePixmap == NULL || tablePixmap->isNull())
//		qFatal("Could not load pixmaps.");
 
	stonePixmaps = NULL;
	ghostPixmaps = NULL;
	smallStonePixmaps = NULL;
#ifdef DONTREDRAWSTONES
	stonePixmapsScaled = NULL;
	ghostPixmapsScaled = NULL;
	smallStonePixmapsScaled = NULL;
#endif //DONTREDRAWSTONES
#define STONEIMAGE_MAXSIZE	400
	painting_buffer = new int[STONEIMAGE_MAXSIZE*STONEIMAGE_MAXSIZE];
	
    // Init the alternate ghost pixmaps
	if (altGhostPixmaps == NULL)
	{
		altGhostPixmaps = new QList<QPixmap>();//::QList();

		QPixmap alt1 = QPixmap(":/new/prefix1/ressources/pics/alt_ghost_black.png");
		QPixmap alt2 = QPixmap(":/new/prefix1/ressources/pics/alt_ghost_white.png");

		if (alt1.isNull() || alt2.isNull())
			qFatal("Could not load alt_ghost pixmaps.");
//		QList<QPixmap*> list;

//		list.append(alt1);
//		list.append(alt2);
		QList<QPoint*> hotspots;
//		hotspots.append(new QPoint(alt1.width()/2, alt1.height()/2));
//		hotspots.append(new QPoint(alt2.width()/2, alt2.height()/2));
//		altGhostPixmaps = new QList<QPixmap*>::QList(list);//, hotspots);

		altGhostPixmaps->append(alt1);
		altGhostPixmaps->append(alt2);
	}
	Q_CHECK_PTR(altGhostPixmaps);
	
	classCounter ++;

    QSettings settings;

    isDisplayBoard = false;

    stonePixmaps = new QList<QPixmap>();//::QList();
    if(preferences.terr_stone_mark)
        smallStonePixmaps = new QList<QPixmap>();
    ghostPixmaps = new QList<QPixmap>();
}
Пример #27
0
KisPhongBumpmapConfigWidget::KisPhongBumpmapConfigWidget(const KisPaintDeviceSP dev, QWidget *parent, Qt::WFlags f)
    : KisConfigWidget(parent, f)
    , m_device(dev)
{
    Q_ASSERT(m_device);
    m_page = new KisPhongBumpmapWidget(this);

    KisSizeGroup *matPropLabelsGroup = new KisSizeGroup(this);
    matPropLabelsGroup->addWidget(m_page->lblAmbientReflectivity);
    matPropLabelsGroup->addWidget(m_page->lblDiffuseReflectivity);
    matPropLabelsGroup->addWidget(m_page->lblSpecularReflectivity);
    matPropLabelsGroup->addWidget(m_page->lblSpecularShinyExp);

    // Connect widgets to each other
    connect(m_page->azimuthDial1, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox1, SLOT(setValue(int)));
    connect(m_page->azimuthDial2, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox2, SLOT(setValue(int)));
    connect(m_page->azimuthDial3, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox3, SLOT(setValue(int)));
    connect(m_page->azimuthDial4, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox4, SLOT(setValue(int)));
    connect(m_page->azimuthSpinBox1, SIGNAL(valueChanged(int)), m_page->azimuthDial1, SLOT(setValue(int)));
    connect(m_page->azimuthSpinBox2, SIGNAL(valueChanged(int)), m_page->azimuthDial2, SLOT(setValue(int)));
    connect(m_page->azimuthSpinBox3, SIGNAL(valueChanged(int)), m_page->azimuthDial3, SLOT(setValue(int)));
    connect(m_page->azimuthSpinBox4, SIGNAL(valueChanged(int)), m_page->azimuthDial4, SLOT(setValue(int)));

    //Let widgets warn the preview of when they are updated
    connect(m_page->azimuthDial1, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->azimuthDial2, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->azimuthDial3, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->azimuthDial4, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));

    connect(m_page->lightKColorCombo1, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->lightKColorCombo2, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->lightKColorCombo3, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->lightKColorCombo4, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged()));

    connect(m_page->inclinationSpinBox1, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->inclinationSpinBox2, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->inclinationSpinBox3, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->inclinationSpinBox4, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));

    connect(m_page->useNormalMap, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->diffuseReflectivityGroup, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->specularReflectivityGroup, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));

    connect(m_page->ambientReflectivityKisDoubleSliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->diffuseReflectivityKisDoubleSliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->specularReflectivityKisDoubleSliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->shinynessExponentKisSliderSpinBox, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));

    connect(m_page->heightChannelComboBox, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged()));

    connect(m_page->lightSourceGroupBox1, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->lightSourceGroupBox2, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->lightSourceGroupBox3, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
    connect(m_page->lightSourceGroupBox4, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));


    QVBoxLayout *l = new QVBoxLayout(this);
    Q_CHECK_PTR(l);

    l->addWidget(m_page);

    /* fill in the channel chooser */
    QList<KoChannelInfo *> channels = m_device->colorSpace()->channels();
    for (quint8 ch = 0; ch < m_device->colorSpace()->colorChannelCount(); ch++)
        m_page->heightChannelComboBox->addItem(channels.at(ch)->name());

    connect(m_page->useNormalMap, SIGNAL(toggled(bool)), this, SLOT(slotDisableHeightChannelCombobox(bool) ) );


}
Пример #28
0
void CatBuilder::storeCatalog() {
    Q_CHECK_PTR(cat);
    QList<CatItem> saveList = cat->getItemsForSave();
    plugins_ptr->saveCatalogs(&(saveList));
}
Пример #29
0
bool QDir::readDirEntries( const QString &nameFilter,
			   int filterSpec, int sortSpec )
{
    int i;
    if ( !fList ) {
	fList  = new QStringList;
	Q_CHECK_PTR( fList );
	fiList = new QFileInfoList;
	Q_CHECK_PTR( fiList );
	fiList->setAutoDelete( TRUE );
    } else {
	fList->clear();
	fiList->clear();
    }

    QValueList<QRegExp> filters = qt_makeFilterList( nameFilter );

    bool doDirs	    = (filterSpec & Dirs)	!= 0;
    bool doFiles    = (filterSpec & Files)	!= 0;
    bool noSymLinks = (filterSpec & NoSymLinks) != 0;
    bool doReadable = (filterSpec & Readable)	!= 0;
    bool doWritable = (filterSpec & Writable)	!= 0;
    bool doExecable = (filterSpec & Executable) != 0;
    bool doHidden   = (filterSpec & Hidden)	!= 0;
    bool doSystem   = (filterSpec & System)     != 0;

    QFileInfo fi;
    DIR	     *dir;
    dirent   *file;

    dir = opendir( QFile::encodeName(dPath) );
    if ( !dir )
	return FALSE; // cannot read the directory

#if defined(QT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
    union {
	struct dirent mt_file;
	char b[sizeof(struct dirent) + MAXNAMLEN + 1];
    } u;
    while ( readdir_r(dir, &u.mt_file, &file ) == 0 && file )
#else
    while ( (file = readdir(dir)) )
#endif // QT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS
    {
	QString fn = QFile::decodeName(file->d_name);
	fi.setFile( *this, fn );
	if ( !qt_matchFilterList(filters, fn) && !(allDirs && fi.isDir()) )
	     continue;
	if  ( (doDirs && fi.isDir()) || (doFiles && fi.isFile()) ||
	      (doSystem && (!fi.isFile() && !fi.isDir())) ) {
	    if ( noSymLinks && fi.isSymLink() )
	        continue;
	    if ( (filterSpec & RWEMask) != 0 )
	        if ( (doReadable && !fi.isReadable()) ||
	             (doWritable && !fi.isWritable()) ||
	             (doExecable && !fi.isExecutable()) )
	            continue;
	    if ( !doHidden && fn[0] == '.' &&
	         fn != QString::fromLatin1(".")
	         && fn != QString::fromLatin1("..") )
	        continue;
	    fiList->append( new QFileInfo( fi ) );
	}
    }
    if ( closedir(dir) != 0 ) {
#if defined(QT_CHECK_NULL)
	qWarning( "QDir::readDirEntries: Cannot close the directory: %s",
		  dPath.local8Bit().data() );
#endif
    }

    // Sort...
    if(fiList->count()) {
	QDirSortItem* si= new QDirSortItem[fiList->count()];
	QFileInfo* itm;
	i=0;
	for (itm = fiList->first(); itm; itm = fiList->next())
	    si[i++].item = itm;
	qt_cmp_si_sortSpec = sortSpec;
	qsort( si, i, sizeof(si[0]), qt_cmp_si );
	// put them back in the list
	fiList->setAutoDelete( FALSE );
	fiList->clear();
	int j;
	for ( j=0; j<i; j++ ) {
	    fiList->append( si[j].item );
	    fList->append( si[j].item->fileName() );
	}
	delete [] si;
	fiList->setAutoDelete( TRUE );
    }

    if ( filterSpec == (FilterSpec)filtS && sortSpec == (SortSpec)sortS &&
	 nameFilter == nameFilt )
	dirty = FALSE;
    else
	dirty = TRUE;
    return TRUE;
}
Пример #30
0
ScPlugin* importpct_getPlugin()
{
	ImportPctPlugin* plug = new ImportPctPlugin();
	Q_CHECK_PTR(plug);
	return plug;
}