Example #1
0
QList<QDomElement> QgsWcsCapabilities::domElements( const QDomElement &element, const QString &path )
{
  QList<QDomElement> list;

  QStringList names = path.split( '.' );
  if ( names.isEmpty() ) return list;
  QString name = names.value( 0 );
  names.removeFirst();

  QDomNode n1 = element.firstChild();
  while ( !n1.isNull() )
  {
    QDomElement el = n1.toElement();
    if ( !el.isNull() )
    {
      QString tagName = stripNS( el.tagName() );
      if ( tagName == name )
      {
        if ( names.isEmpty() )
        {
          list.append( el );
        }
        else
        {
          list.append( domElements( el, names.join( QStringLiteral( "." ) ) ) );
        }
      }
    }
    n1 = n1.nextSibling();
  }

  return list;
}
Example #2
0
/**
 * Inserts an valid image
 * Copies the specific image in the program folder
 */
void MainWindow::on_actionImage_triggered()
{
    QString scriboDir = QDir::home().absolutePath() + QDir::separator() + "scribo";

    if ( !QDir(scriboDir + QDir::separator() + "img").exists() )
        QDir().mkdir(scriboDir + QDir::separator() + "img");

    QString filePath = QFileDialog::getOpenFileName(this, tr("Select an image"),
                                      QDir::home().absolutePath(), "Bitmap Files (*.bmp)\n"
                                        "JPEG (*.jpg *jpeg)\n"
                                        "GIF (*.gif)\n"
                                        "PNG (*.png)");
    QStringList list = filePath.split( "/" );
    QString imageName = list.value(list.length() - 1 );
    QString imagePath = scriboDir + QDir::separator() + "img" + QDir::separator() + imageName;

    QFile::copy(filePath, imagePath);
    QUrl Uri ( QString ( "file://%1" ).arg ( imagePath ) );
    QImage image = QImageReader ( imagePath ).read();

    QTextDocument * textDocument = ui->textEdit_mainWindow_surface->document();
    textDocument->addResource( QTextDocument::ImageResource, Uri, QVariant ( image ) );
    cursor = ui->textEdit_mainWindow_surface->textCursor();
    QTextImageFormat imageFormat;
    imageFormat.setWidth( image.width() );
    imageFormat.setHeight( image.height() );
    imageFormat.setName( Uri.toString() );
    cursor.insertImage(imageFormat);
}
Example #3
0
void Client::on_LoadVideo_clicked()
{
    path = QFileDialog::getOpenFileName(
                this,
                tr("Open File"),
                "D://",
                "Video Files (*.avi);;"
                );

    if(path == NULL)
    {
        QMessageBox::information(this, tr("Error"), tr("File wasn't selected"));
        return;
    }

    QFile file(path);
    filesize = file.size();

    QStringList substrings = path.split("/");
    QString filename = substrings.value(substrings.length() - 1);

    ui->fileName->setText(filename);

    QString request = QString::number(addPicture) + "|";
    request += filename;
    webSocket.sendTextMessage(request);
}
Example #4
0
void NativeClientSocket::connectToHost(){
    QString address = "127.0.0.1";
    ushort port = Config.value("ServerPort","9527").toString().toUShort();

    if(Config.HostAddress.contains(QChar(':'))){
        QStringList texts = Config.HostAddress.split(QChar(':'));
        address = texts.value(0);
        port = texts.value(1).toUShort();
    }else{
        address = Config.HostAddress;
        if(address == "127.0.0.1")
            port = Config.value("ServerPort","9527").toString().toUShort();
    }

    socket->connectToHost(address, port);
}
Example #5
0
/**
 * 	-	remove file name: remove last part from file path
 *
*/
QString Popup::removeFileName(QString Projectpath)
{
    //remove filename from path
    QStringList list = Projectpath.split( "/" );
    Projectpath = Projectpath.left(Projectpath.length() - (list.value(list.length()-1).length()+1));
    return Projectpath;
}
Example #6
0
void ChartDataFromMetricMdiArea::dropEvent(QDropEvent *event)
{

	if(event->mimeData()->hasText() ) {
		QString dropParam = event->mimeData()->text();

		if( !dropParam.contains("//MetricPath/") ) return;

		qDebug()<<dropParam;
		QStringList mimeTextList = dropParam.split("\n", QString::SkipEmptyParts);
		QHash<QString, QStringList> params;
		foreach (QString mimeText, mimeTextList) {
			QStringList dataDirectoryList = mimeText.split("//MetricPath/", QString::SkipEmptyParts);

			
			foreach (QString dataDirectory, dataDirectoryList) {
				qDebug()<<dataDirectory;
				QStringList dataDirList = dataDirectory.split("/", QString::SkipEmptyParts);
				QString metricName = dataDirList.value(0);
				qDebug()<<"Name of metrics "<<metricName;
				dataDirList.pop_front();
				if( !params.contains(metricName) )
					params[metricName] = QStringList();

				if( !dataDirList.isEmpty())
					params[metricName].append(dataDirList.join("/"));

			}
Example #7
0
double QgsDmsAndDdDelegate::dmsToDD( const QString &dms ) const
{
  QStringList list = dms.split( ' ' );
  QString tmpStr = list.at( 0 );
  double res = qAbs( tmpStr.toDouble() );

  tmpStr = list.value( 1 );
  if ( !tmpStr.isEmpty() )
    res += tmpStr.toDouble() / 60;

  tmpStr = list.value( 2 );
  if ( !tmpStr.isEmpty() )
    res += tmpStr.toDouble() / 3600;

  return dms.startsWith( '-' ) ? -res : res;
}
QList<CharacteristicsItem*> CharacteristicsModel::_getDefaultItems()
{
    QList<CharacteristicsItem*> Characteristics;
    QStringList ChList;
    ChList <<
//              QString("Shannon Entropy") <<
//              QString("Signal Entropy") <<
//              QString("Gradation using coefficient") <<
//              QString("Adaptation level of brightness") <<
//              QString("Max dynamic contrast");
                QString("Shannon Entropy") <<
                QString("Signal Entropy") <<
                QString("GUC") <<
                QString("ALB") <<
                QString("MDC");
    for (int i=0;i<ChList.count(); i++)
    {
        QList<QList<QVariant> > data;
        QList<QVariant> value;
        value << QVariant();
        data << value;
        Characteristics.append(new CharacteristicsItem(data, QString(ChList.value(i))));
    }
    return Characteristics;
}
Example #9
0
bool Users::addUserData(QString login, QString password, QString question, QString answer)
{
    SimpleCrypt processSimpleCrypt(USERS_FILE_CRYPTO_KEY);
    QFile file(USERS_FILE_NAME);

    if (file.open(QIODevice::ReadWrite | QIODevice::Text)) {
        QTextStream in(&file);

        while (!in.atEnd()) {
            QString line = in.readLine();
            QStringList userItem = line.split(USERS_FILE_SPLITTER);
            QString rUser = processSimpleCrypt.decryptToString(userItem.value(0));

            if (rUser.compare(login) == 0) {
                return false;
            }
        }

        QString userData = processSimpleCrypt.encryptToString(login) + USERS_FILE_SPLITTER +
                        processSimpleCrypt.encryptToString(password) + USERS_FILE_SPLITTER +
                        processSimpleCrypt.encryptToString(question) + USERS_FILE_SPLITTER +
                        processSimpleCrypt.encryptToString(answer) + "\n";

        in << userData;

        file.close();
    }
    else {
        qDebug() << USERS_FILE_OPEN_ERROR_MSG << endl;
        return false;
    }

    return true;
}
Example #10
0
void I2cif::i2cWrite(QString devName, unsigned char address, QString data)
{
    int file;
    char buf[200];
    bool parseOk;

    QByteArray tmpBa = devName.toUtf8();
    const char* devNameChar = tmpBa.constData();

    fprintf(stderr, "writing to address %02x: ", address);

    /* parse QString data to buf */
    QStringList bytes = data.split(" ");
    int i;
    for (i=0 ; i<bytes.length(); i++)
    {
        QString tmp = bytes.value(i);
        buf[i] = tmp.toInt(&parseOk, 16);
        if (!parseOk)
        {
            fprintf(stderr, "parsing error %d\n", i);
            emit i2cError();
            return;
        }
        fprintf(stderr, "%02x ", buf[i]);
    }
    fprintf(stderr, "\n");


    if ((file = open (devNameChar, O_RDWR)) < 0)
    {
        fprintf(stderr,"open error\n");
        emit i2cError();
        return;
    }

    if (ioctl(file, I2C_SLAVE, address) < 0)
    {
        close(file);
        fprintf(stderr,"ioctl error\n");
        emit i2cError();
        return;
    }

    /* Try to read 2 bytes. This is also safe for LM75 */
    if (write( file, buf, bytes.length() ) != bytes.length())
    {
        close(file);
        fprintf(stderr,"write error\n");
        emit i2cError();
        return;
    }

    close(file);

    fprintf(stderr,"write ok\n");

    emit i2cWriteOk();

}
Example #11
0
QStringList* Helper::readFile(QString aFileName)
{
  // read the data line by line
  QFile *file = new QFile(aFileName);
  QStringList *data = new QStringList();
  if (file->open(QIODevice::ReadOnly) ) {
    // file opened successfully
    QTextStream *tstream = new QTextStream(file);
    while (!tstream->atEnd()) {
      data->append(tstream->readLine());
    }
    file->close();

    // ignore whitespaces
    for (int i = 0; i < data->length(); i++) {
      if (data->value(i) == "") {
        data->removeAt(i);
      }
    }
  }
  else {
    QString msg = tr("Could not open %1.. Please make sure it is existent and readable.").arg(aFileName);
    AlertWindow *alertWin = new AlertWindow("ERROR", msg);
    alertWin->show();
  }

  return data;
}
/*!
  Case sensitive will not be applied to extensions both to Linux and Windows.
  Older files go first.
   \param folder Folder manager object
   \return true if all went well
*/
bool TNxSpooler::filterAndSortFolder(QDir &folder) const
{
   QDEBUG_METHOD_NAME;

   QStringList exts = m_settings.value("exts").toStringList();

   removeExtensionsThatDoNotMustBeOpened(exts);

   int quant_exts = exts.count();
   if (quant_exts == 0)
   {
      return false;
   }

   QStringList filters;

   for(int i = 0; i < quant_exts; i++)
   {
      filters << QString("*.%1").arg(exts.value(i));
   }

   // An special extension will let us to open a path contained inside
   // a text file ended with the m_special_extension
   filters << "*" + m_special_extension;

   // We specify to open only files. This is to avoid cases where for example
   // the user creates a folder named "my .pdf"
   folder.setFilter(QDir::Files);

   folder.setNameFilters(filters);

   folder.setSorting(QDir::Time|QDir::Reversed);

   return true;
}
Example #13
0
void SectionEditor::init(KoReportDesigner * rw)
{
    m_reportDesigner = 0;
    // set all the properties

    cbReportHeader->setChecked(rw->section(KRSectionData::ReportHeader));
    cbReportFooter->setChecked(rw->section(KRSectionData::ReportFooter));

    cbHeadFirst->setChecked(rw->section(KRSectionData::PageHeaderFirst));
    cbHeadOdd->setChecked(rw->section(KRSectionData::PageHeaderOdd));
    cbHeadEven->setChecked(rw->section(KRSectionData::PageHeaderEven));
    cbHeadLast->setChecked(rw->section(KRSectionData::PageHeaderLast));
    cbHeadAny->setChecked(rw->section(KRSectionData::PageHeaderAny));

    cbFootFirst->setChecked(rw->section(KRSectionData::PageFooterFirst));
    cbFootOdd->setChecked(rw->section(KRSectionData::PageFooterOdd));
    cbFootEven->setChecked(rw->section(KRSectionData::PageFooterEven));
    cbFootLast->setChecked(rw->section(KRSectionData::PageFooterLast));
    cbFootAny->setChecked(rw->section(KRSectionData::PageFooterAny));

    // now set the rw value
    m_reportDesigner = rw;
    m_reportSectionDetail = rw->detailSection();

    if (m_reportSectionDetail) {
        for (int i = 0; i < m_reportSectionDetail->groupSectionCount(); i++) {
            QStringList names = rw->fieldNames();
            QStringList keys = rw->fieldKeys();
            int idx = keys.indexOf( m_reportSectionDetail->groupSection(i)->column() );
            QString column = names.value( idx );
            lbGroups->addItem(column);
        }
    }
}
Example #14
0
bool FmAddModifyDialog::saveReplaceMediaList(QString hotnet)
{
    _query.seek(replaceRow);
    int srcMid, srcIndex, destMid;
    srcMid = _query.value("_mid").toInt();
    srcIndex = _query.value("_index").toInt();
    QStringList value;
    if(rowList.isEmpty())
        return false;
    value = rowList.at(0);
    destMid = value.value(0).toInt();

    QString serial_id = value.value(1);

   return  _sql->replaceMediaList(srcMid, srcIndex, destMid, _type, serial_id, hotnet);
}
Example #15
0
QString IrcProtocolPrivate::getColorByMircCode(const QString &code)
{
	static QStringList colors = QStringList()
								<< "white"
								<< "black"
								<< "blue"
								<< "green"
								<< "#FA5A5A" //lightred
								<< "brown"
								<< "purple"
								<< "orange"
								<< "yellow"
								<< "lightgreen"
								<< "cyan"
								<< "lightcyan"
								<< "lightblue"
								<< "pink"
								<< "grey"
								<< "lightgrey";
	bool ok;
	int c = code.toInt(&ok);
	if (ok)
		return colors.value(c);
	else
		return QString();
}
Example #16
0
File: main.cpp Project: kanocz/ujea
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    // some command line arguments parsing stuff
    QCoreApplication::setApplicationName("ujea");
    QCoreApplication::setApplicationVersion("1.2");

    QString hostname = QHostInfo::localHostName();

    QCommandLineParser parser;
    parser.setApplicationDescription("Universal job execution agent using AMQP queue");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addOption(QCommandLineOption("aliveInterval", "Interval in ms between alive messages (1000).", "aliveInterval", "1000"));
    parser.addOption(QCommandLineOption("aliveTTL", "TTL in queue for alive messages (1500).", "aliveTTL", "1500"));
    parser.addOption(QCommandLineOption("queueCmd", "Commands queue name ("+hostname+"_cmd).", "queueCmd", hostname+"_cmd"));
    parser.addOption(QCommandLineOption("queueRpl", "Replays queue name ("+hostname+"_rpl).", "queueRpl", hostname+"_rpl"));
    parser.addOption(QCommandLineOption("execRegex", "Regex for permited commands. (none)", "execRegex", ""));
    parser.addPositionalArgument("url", QCoreApplication::translate("main", "AMQP url"));
    parser.process(app);

    const QStringList args = parser.positionalArguments();

    // we need to have 1 argument and optional named arguments
    if (args.count() != 1) parser.showHelp(-1);

    // create and execure worker
    JobsExecuter qw{QUrl(args.value(0)), parser.value("queueCmd"), parser.value("queueRpl"),
                    parser.value("aliveInterval").toInt(), parser.value("aliveTTL").toInt(),
                    parser.value("execRegex")};

    return app.exec();
}
Example #17
0
CommandLinePluginInterface::RunResult LdapPlugin::handle_help( const QStringList& arguments )
{
	QString command = arguments.value( 0 );

	if( command == "autoconfigurebasedn" )
	{
		printf( "\n"
				"ldap autoconfigurebasedn <LDAP URL> [<naming context attribute name>]\n"
				"\n"
				"Automatically configures the LDAP base DN configuration setting by querying\n"
				"the naming context attribute from given LDAP server. The LDAP url parameter\n"
				"needs to follow the schema:\n"
				"\n"
				"  ldap[s]://[user[:password]@]hostname[:port]\n\n" );
		return NoResult;
	}
	else if( command == "query" )
	{
		printf( "\n"
				"ldap query <object type> [filter]\n"
				"\n"
				"Query objects from configured LDAP directory where <object type> may be one\n"
				"of \"rooms\", \"computers\", \"groups\" or \"users\". You can optionally\n"
				"specify a filter such as \"foo*\".\n"
				"\n" );
		return NoResult;
	}

	return InvalidCommand;
}
Example #18
0
bool POP3Client::getMsgList(QList< QPair<QString, quint64> >& list)
{
    QString res = doCommand("LIST\r\n");
    qDebug() << res;
    if (res.startsWith("+OK")) {
        QStringList lines = res.split("\r\n", QString::SkipEmptyParts);
        int i;
        for (i = 1; i < lines.count(); i++) {
            QStringList words = lines[i].split(' ', QString::SkipEmptyParts);
            for (auto word : words) {
                qDebug() << word;
            }
            bool ok = true;
            words.value(0).toInt(&ok);
            words.value(1).toInt(&ok);

            if (ok) {
                list.append(QPair<QString, quint64>(words[0], words[1].toInt()));
            }
        }
        return true;
    } else {
        return false;
    }
}
QList<VolumeInfo> mountedVolumes()
{
    QList<VolumeInfo> result;

    QFile f(QLatin1String("/etc/mtab"));
    if (!f.open(QIODevice::ReadOnly)) {
        qCritical("%s: Cannot open %s: %s", Q_FUNC_INFO, qPrintable(f.fileName()), qPrintable(f.errorString()));
        return result; //better error-handling?
    }

    QTextStream stream(&f);
    while (true) {
        const QString s = stream.readLine();
        if (s.isNull())
            return result;

        if (!s.startsWith(QLatin1Char('/')) && !s.startsWith(QLatin1String("tmpfs ") + QDir::tempPath()))
            continue;

        const QStringList parts = s.split(QLatin1Char(' '), QString::SkipEmptyParts);

        VolumeInfo v;
        v.setMountPath(parts.at(1));
        v.setVolumeDescriptor(parts.at(0));
        v.setFileSystemType(parts.value(2));

        struct statvfs data;
        if (statvfs(qPrintable(v.mountPath() + QLatin1String("/.")), &data) == 0) {
            v.setSize(quint64(static_cast<quint64>(data.f_blocks) * data.f_bsize));
            v.setAvailableSize(quint64(static_cast<quint64>(data.f_bavail) * data.f_bsize));
        }
        result.append(v);
    }
    return result;
}
bool QFImageWriterLibTIFF::open(const QString& filename)
{
    close();
    QStringList fns;
    if (onefileperchannel) {
        QFileInfo fi(filename);
        const QString base=fi.absolutePath()+"/"+fi.baseName();
        const QString ext=fi.completeSuffix();
        int fw=1;
        if (channels>=10) fw=2;
        if (channels>=100) fw=3;
        for (uint32_t i=0; i<channels; i++) {
            QString fn=base+QString("_%1.").arg(i,fw,10,QLatin1Char('0'))+ext;
            fns<<fn;
            tif << TIFFOpen(fn.toLatin1().data(),"w");
        }
    } else {
        tif << TIFFOpen(filename.toLatin1().data(),"w");
        fns<<filename;
    }
    frames=0;
    bool ok=true;
    for (int i=0; i<tif.size(); i++) {
        ok=ok&&tif[i];
        if (!tif[i]) {
            setLastError(QObject::tr("could not open file '%1' for writing!").arg(fns.value(i)));
        }
    }
    if (!ok) {
        close();
    }
    return ok;
}
Example #21
0
bool text_helper::firstColumnIsIncrimental(QTextStream &stream, const QString &delimiter)
{
    qint64 streamStartingPosition = stream.pos();
    double firstColumnValue, prevFirstColumnValue = 0;
    bool firstColumnIsIncrimental = true;
    QString line = QString();
    QStringList strings;
    bool ok;

    //Read out the first line (possibly header)
    line = QString(stream.readLine());

    while (!stream.atEnd()) {
        line = QString(stream.readLine());
        QStringList strings = line.split(delimiter);

        //Lets determine if we can use the first column as an X-axis
        firstColumnValue = strings.value(0).toDouble(&ok);

        if (!ok || (firstColumnValue < prevFirstColumnValue)) {
            firstColumnIsIncrimental = false;
            break;
        }

        prevFirstColumnValue = firstColumnValue;
    }

    //Reposition the stream
    stream.seek(streamStartingPosition);

    return firstColumnIsIncrimental;
}
Example #22
0
void UIInfo::updateStatistics() {
    QString s;
    QStringList sizePostfix;
    int files, idx;
    float kbyte;

    sizePostfix << "KB" << "MB" << "GB" << "TB";

    files = 0;
    kbyte = 0;

    downloadManager->getStatistics(&files, &kbyte);

    for (idx=0; idx<sizePostfix.size(); idx++) {
        if (kbyte>1024.0) {
            kbyte /= 1024.0;
        }
        else {
            break;
        }
    }

    s = QString("You have downloaded\n%1 files\n%2 %3").arg(files).arg(kbyte).arg(sizePostfix.value(idx));

    ui->lStatistics->setText(s);
}
void InputComponent::handleAction(const QString& action, bool autoRepeat)
{
  if (action.startsWith("host:"))
  {
    QStringList argList = action.mid(5).split(" ");
    QString hostCommand = argList.value(0);
    QString hostArguments;

    if (argList.size() > 1)
    {
      argList.pop_front();
      hostArguments = argList.join(" ");
    }

    QLOG_DEBUG() << "Got host command:" << hostCommand << "arguments:" << hostArguments;
    if (m_hostCommands.contains(hostCommand))
    {
      ReceiverSlot* recvSlot = m_hostCommands.value(hostCommand);
      if (recvSlot)
      {
        QLOG_DEBUG() << "Invoking slot" << qPrintable(recvSlot->m_slot.data());
        QGenericArgument arg0 = QGenericArgument();
        if (recvSlot->m_hasArguments)
          arg0 = Q_ARG(const QString&, hostArguments);
        QMetaObject::invokeMethod(recvSlot->m_receiver, recvSlot->m_slot.data(),
                                  Qt::AutoConnection, arg0);
      }
    }
bool AvolitesD4Parser::parseCapabilities(const QDomElement& elem, QLCChannel* chan, bool isFine)
{
    QDomElement el = elem.firstChildElement(KD4TagFunction);
    for (; !el.isNull(); el = el.nextSiblingElement(KD4TagFunction))
    {
        // Small integrity check
        if (el.attribute(KD4TagFunctionName).isEmpty())
            continue;

        QString dmx = el.attribute(KD4TagFunctionDmx);
        QStringList dmxValues = dmx.split(KD4TagFunctionDmxValueSeparator);

        // Here, instead of checking all the time for both dmxValues, it's more efficient to
        // set a default value if it's missing
        if (dmxValues.size() == 0)
            dmxValues << QString("0") << QString("0");
        else if (dmxValues.size() == 1)
            dmxValues << QString("0");

        // if were trying to get capabilities from a 16bit channel, we need to change them to 8 bit
        int minValue = 0, maxValue = 0;

        if (dmxValues.value(0).toInt() > 256)
            minValue = 0xFF & (dmxValues.value(0).toInt() >> 8);
        else
            minValue = dmxValues.value(0).toInt();

        if (dmxValues.value(1).toInt() > 256)
            maxValue = 0xFF & (dmxValues.value(1).toInt() >> 8);
        else
void ConnectionWidget::refresh()
{
    tree->clear();
    QStringList connectionNames = QSqlDatabase::connectionNames();

    bool gotActiveDb = false;
    for (int i = 0; i < connectionNames.count(); ++i) {
        QTreeWidgetItem *root = new QTreeWidgetItem(tree);
        QSqlDatabase db = QSqlDatabase::database(connectionNames.at(i), false);
        root->setText(0, qDBCaption(db));
        if (connectionNames.at(i) == activeDb) {
            gotActiveDb = true;
            setActive(root);
        }
        if (db.isOpen()) {
            QStringList tables = db.tables();
            for (int t = 0; t < tables.count(); ++t) {
                QTreeWidgetItem *table = new QTreeWidgetItem(root);
                table->setText(0, tables.at(t));
            }
        }
    }
    if (!gotActiveDb) {
        activeDb = connectionNames.value(0);
        setActive(tree->topLevelItem(0));
    }

    tree->doItemsLayout(); // HACK
}
Example #26
0
void Omision::on_pushButton_clicked()
{    
    QString Code;
    Code = ui->textEdit->toPlainText();
    QStringList Valor = Code.split("");
    int Resto = Valor.count();
    QString Resultado = Valor.value(Resto-2);
    if (Resultado == ";")
    {
        QMessageBox m;
        if (Stilo == "A")
            m.setStyleSheet("background-color: "+cantidad51+"; color: "+cantidad50+"; font-size: "+cantidad49+"pt; font-style: "+DatoTalla+"; font-family: "+cantidad47+"; font-weight: "+DatoNegro+"");
        m.setText(tr("No se puede acabar el filtro con el signo de ;"));
        m.exec();
        return;
    }
    if (Code.contains(";;"))
    {
        QMessageBox m;
        if (Stilo == "A")
            m.setStyleSheet("background-color: "+cantidad51+"; color: "+cantidad50+"; font-size: "+cantidad49+"pt; font-style: "+DatoTalla+"; font-family: "+cantidad47+"; font-weight: "+DatoNegro+"");
        m.setText(tr("Has editado mal la introduccion de filtros, comprueba el error"));
        m.exec();
        return;
    }
    QSqlQuery query(db);
    query.exec("UPDATE Sincrono SET Codigo='"+Code+"' WHERE Referencia='"+Nombre+"'");
    close();
}
Example #27
0
void Window::showDetails() {
    Pattern* pattern = m_board->pattern();
    if (!pattern) {
        return;
    }
    QString patternid = QSettings().value("Current/Pattern", 0).toString();
    static const QStringList sizes = QStringList() << NewGameDialog::tr("Low")
                                     << NewGameDialog::tr("Medium")
                                     << NewGameDialog::tr("High")
                                     << NewGameDialog::tr("Very High");
    QString number = "4"
                     + m_board->words()->language()
                     + patternid
                     + QString::number(pattern->wordCount())
                     + QString("%1").arg(int(pattern->wordLength() - 4), 2, 16, QLatin1Char('0'))
                     + QString::number(pattern->seed(), 16);
    QMessageBox dialog(QMessageBox::Information,
                       tr("Details"),
                       QString("<p><b>%1</b> %2<br><b>%3</b> %4<br><b>%5</b> %6<br><b>%7</b> %8<br><b>%9</b> %10</p>")
                       .arg(tr("Pattern:")).arg(pattern->name())
                       .arg(NewGameDialog::tr("Language:")).arg(LocaleDialog::languageName(m_board->words()->language()))
                       .arg(NewGameDialog::tr("Amount of Words:")).arg(sizes.value(pattern->wordCount()))
                       .arg(NewGameDialog::tr("Word Length:")).arg(NewGameDialog::tr("%n letter(s)", "", pattern->wordLength() + 1))
                       .arg(tr("Game Number:")).arg(number),
                       QMessageBox::NoButton,
                       this);
    dialog.setIconPixmap(QIcon(QString(":/patterns/%1.png").arg(patternid)).pixmap(96,96));
    dialog.exec();
}
Example #28
0
void HttpDownload::slotResponseHeaderReceived( const QHttpResponseHeader & resp ){

    QString contentLength = resp.value("Content-Length");

    if( !contentLength.isEmpty() ){
        long length = contentLength.toLong();
    }

    //user define!!
    if(!this->fileName.isEmpty())
            return;

    QString disposition = resp.value("Content-Disposition");

    disposition.replace(" " ,"",Qt::CaseInsensitive);
    QStringList list = disposition.split(";");

    QString fileName = "";

    QRegExp exp = QRegExp("[ ]*[filename][ ]*=[ ]*.*");
    exp.setCaseSensitivity(Qt::CaseInsensitive);

    for(int i = 0 ; i < list.size() ; i ++){
            QString tempStr = list.value(i);
            if( tempStr.contains(exp)) {
                    exp = QRegExp("[ ]*filename[ ]*=[ ]*");
                    exp.setCaseSensitivity(Qt::CaseInsensitive);
                    fileName = tempStr.remove(exp);
                    break;
            }
    }
    if(!fileName.isEmpty()){
            this->fileName = fileName;
    }
}
Example #29
0
void Client::on_addPictures_clicked()
{
    if(i == 0)
    {
        ui->loadedPicture1->setText("");
        ui->loadedPicture2->setText("");
        ui->loadedPicture3->setText("");
        return;
    }

    if(ui->loadedPicture1->text() =="" || ui->loadedPicture2->text() == ""
            || ui->loadedPicture3->text() == "")
    {
        QMessageBox::information(this, tr("Warning"), tr("Please load three pictures!"));
        return;
    }
    QString request = QString::number(addPicture) + "|";
    QStringList substrings = picturePath[i].split("/");
    request += substrings.value(substrings.length() - 1 );
    webSocket.sendTextMessage(request);

    QFile file(picturePath[i]);
    if(!file.open(QIODevice::ReadOnly))
    {
        QMessageBox::information(this, tr("Warning"), tr("Cann't open picture!"));
    }
    QByteArray data = file.readAll();
    webSocket.sendBinaryMessage(data);
    --i;
}
void SongEditorPanelTagWidget::on_okBtn_clicked()
{
	Hydrogen* engine = Hydrogen::get_instance();
	Timeline* pTimeline = engine->getTimeline();

	int patterngroupvectorsize;
	patterngroupvectorsize = engine->getSong()->get_pattern_group_vector()->size();

	//oldText list contains all old item values. we need them for undo an item 
	QStringList oldText;

	if(pTimeline->m_timelinetagvector.size() > 0){
		for (int i = 0; i < patterngroupvectorsize; i++){
			oldText << "";
		}
		for(int i = 0; i < pTimeline->m_timelinetagvector.size(); ++i){
			oldText.replace(pTimeline->m_timelinetagvector[i].m_htimelinetagbeat , pTimeline->m_timelinetagvector[i].m_htimelinetag);
		}
	}

	for( int i = 0; i < __theChangedItems.size() ; i++ )
	{
		QTableWidgetItem *newTagItem = new QTableWidgetItem();
		int songPosition = __theChangedItems.value( i ).toInt();
		newTagItem = tagTableWidget->item( songPosition, 0 );
		if ( newTagItem ) {
			SE_editTagAction *action = new SE_editTagAction(  newTagItem->text() ,oldText.value( songPosition ), songPosition );
			HydrogenApp::get_instance()->m_undoStack->push( action );
		}
	}
	accept();
}