void Emulation::setCodec(EmulationCodec codec) { if ( codec == Utf8Codec ) setCodec( QTextCodec::codecForName("utf8") ); else if ( codec == LocaleCodec ) setCodec( QTextCodec::codecForLocale() ); }
QString SGFParser::loadFile(const QString &fileName) { qDebug("Trying to load file <%s>", fileName.toUtf8().constData()); QFile file(fileName); if (!file.exists()) { qDebug() << "Could not find file: " << fileName; return NULL; } if (!file.open(QIODevice::ReadOnly)) { qDebug() << "Could not open file: " << fileName; return NULL; } QTextStream txt(&file); stream = &txt; if (!setCodec()) { qDebug() << "Invalid text encoding given. Please check preferences!"; return NULL; } QString toParse; int i = 10; while (!txt.atEnd() && i--) toParse.append(txt.readLine() + "\n"); QString tmp=""; if (!parseProperty(toParse, "CA", tmp)) //codec return NULL; if (!tmp.isEmpty()) { if(!setCodec(tmp)) return NULL; toParse.clear(); txt.seek(0); } while (!txt.atEnd()) toParse.append(txt.readLine() + "\n"); readCodec = stream->codec(); file.close(); #ifdef DEBUG_CODEC QMessageBox::information(0, "READING", toParse); #endif loadedfromfile = true; //no need to check the codec later return toParse; }
AddressValidator::AddressValidator( QObject* parent, Coding codecId ) : QValidator( parent ), mCodecId( InvalidCoding ), mValueCodec( 0 ) { setCodec( codecId ); }
void RTF::Writer::setCodec(QTextCodec* codec) { if (codec == 0) { return; } m_codec = codec; if (codec->mibEnum() == 2009) { m_header = "{\\rtf1\\pca\\ansicpg850\n\n"; } else if (codec->mibEnum() == 2011) { m_header = "{\\rtf1\\pc\\ansicpg437\n\n"; } else if (codec->mibEnum() == 2027) { m_header = "{\\rtf1\\mac\\ansicpg10000\n\n"; } else { QByteArray codepage; QList<QByteArray> aliases = codec->aliases(); foreach (const QByteArray& alias, aliases) { if (alias.startsWith("CP") || alias.startsWith("cp")) { codepage = alias; break; } } if (!codepage.isEmpty()) { m_header = "{\\rtf1\\ansi\\ansicpg" + codepage.mid(2) + "\n\n"; } else { setCodec(QTextCodec::codecForName("CP1252")); } } }
void configureFromRead( const VideoFFmpegReader& reader ) { setWidth ( reader.width() ); setHeight ( reader.height() ); setAspectRatio ( reader.aspectRatio() ); setFps ( reader.fps() ); setBitRate ( reader.bitRate() ); setFormat ( reader.formatName() ); setCodec ( reader.codecName() ); }
void GwfStreamWriter::startWriting(const char* encoding) { QTextCodec *codec = QTextCodec::codecForName(encoding); setCodec(codec); setAutoFormatting(true); writeStartDocument(); writeStartElement("GWF"); writeAttribute("version", "1.6"); writeStartElement("staticSector"); isWritingStarted = true; }
ByteArrayValidator::ByteArrayValidator( QObject* parent, Coding codecId, int charCodecId ) : QValidator( parent ), mCodecId( InvalidCoding ), mValueCodec( 0 ), mCharCodec( CharCodec::createCodec(Okteta::LocalEncoding) ), mMaxLength( 32767 ), mMinLength( 0 ) { Q_UNUSED(charCodecId) setCodec( codecId ); }
Xml::Xml() { setCodec("UTF-8"); stack.clear(); curTick = 0; curTrack = -1; tickDiff = 0; trackDiff = 0; clipboardmode = false; excerptmode = false; tupletId = 1; beamId = 1; spannerId = 1; writeOmr = true; }
Xml::Xml(QIODevice* device) : QTextStream(device) { setCodec("utf8"); stack.clear(); curTick = 0; curTrack = -1; tickDiff = 0; trackDiff = 0; clipboardmode = false; excerptmode = false; tupletId = 1; beamId = 1; spannerId = 0; slurId = 1; writeOmr = true; }
/* * Writes the SGF code for whot 'tree' into the 'stream' */ bool SGFParser::writeStream(Tree *tree, GameData *gameData) { Q_CHECK_PTR(stream); if (!setCodec(gameData->codec)) { QMessageBox::critical(0, PACKAGE, QObject::tr("Invalid text encoding given. Please check preferences!")); delete stream; return false; } Move *root = tree->getRoot(); if (root == NULL) return false; // GameData *gameData = boardHandler->getGameData(); // Traverse the tree recursive in pre-order isRoot = true; traverse(root, gameData); return true; }
QFObjectRenderer::QFObjectRenderer(QFWorldPlayer& qfWorldPlayer, MovieAtom& movieAtom, HMMIO movieFile) : QFWorldRenderer(qfWorldPlayer, movieAtom, movieFile) { columns = rows = 0; currentColumn = currentRow = -1; degreesPerColumn = degreesPerRow = .0; filePosition = 0; frame = 0; if (movieAtom_p.userDataAtom && movieAtom_p.userDataAtom->navigationAtom) { const NavigationAtom& navigationAtom = *(movieAtom_p.userDataAtom->navigationAtom); columns = navigationAtom.numberOfColumns; minPanReg = navigationAtom.startHPan; maxPanReg = navigationAtom.endHPan; if (columns > 1) degreesPerColumn = (maxPanReg - minPanReg) / (minPanReg == .0 && maxPanReg == 360.0 ? columns : columns - 1); rows = navigationAtom.numberOfRows; minTilt = navigationAtom.startVPan; maxTilt = navigationAtom.endVPan; if (rows > 1) degreesPerRow = (maxTilt - minTilt) / (rows - 1); defaultPan_p = navigationAtom.initialHPan; defaultTilt_p = navigationAtom.initialVPan; //Lock to a view 1/2 of pan range, centered on default pan minPan = max(defaultPan_p - (maxPanReg - minPanReg) / 4.0, minPanReg); maxPan = min(defaultPan_p + (maxPanReg - minPanReg) / 4.0, maxPanReg); } setCodec(videoMap, videoSetup); }
Xml::Xml() { setCodec("UTF-8"); }
bool Encoder::bootstrap(AVCodecID codecId, int width, int height, int fps) { return setCodec(codecId) && createContext(width, height, fps) && openCodec() && createFrame(); }
void MainWindow::addCodecs() { QMenu *codecMenu; QActionGroup *codecGroup; QAction *codecAction; //Set up Menu and action group codecMenu = new QMenu(tr("Set Saving Codec"), ui->menuFile); codecGroup = new QActionGroup(this); codecGroup->setExclusive(true); //Add codecs to menu and actionGroup codecAction = codecMenu->addAction(tr("Ask me (Windows)")); codecAction->setCheckable(true); codecGroup->addAction(codecAction); //Set DIVX Standard codecAction = codecMenu->addAction("DivX"); codecAction->setCheckable(true); codecAction->setChecked(true); setCodec(codecAction); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("FFV1 (FFMPEG Codec)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("HDYC (Raw YUV 4:2:2)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("HEVC (H.265)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("M4S2 (MPEG-4 v2)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("MJPG (Motion JPEG)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("MP2V (MPEG-2)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("MP4V (MPEG-4)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("MPEG (MPEG-1?)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addAction("PIM1 (MPEG-1)"); codecAction->setCheckable(true); codecGroup->addAction(codecAction); codecAction = codecMenu->addSection(tr("For Videos")); codecAction = codecMenu->addAction(tr("Same as Videosource")); codecAction->setCheckable(true); codecAction->setChecked(true); useVideoCodec = true; //Connect and add to MenuBar connect(codecMenu, SIGNAL(triggered(QAction*)), this, SLOT(setCodec(QAction*))); ui->menuFile->insertMenu(ui->actionQuit,codecMenu); }
TextFile::TextFile(QObject *parent) : IFile(parent), d(new Internal::TextFilePrivate) { setCodec(Core::EditorManager::instance()->defaultTextCodec()); }
XmlWriter::XmlWriter(Score* s) { _score = s; setCodec("UTF-8"); }
Track::Track(const Audio::WeakPCM &_pcm, const Audio::SharedCodec &_codec) : m_p(new Private) { setPCM(_pcm); setCodec(_codec); }
Xml::Xml(QIODevice* device) : QTextStream(device) { setCodec("UTF-8"); }
RTF::Writer::Writer() : m_codec(0) { setCodec(QTextCodec::codecForLocale()); }
XmlWriter::XmlWriter(Score* s, QIODevice* device) : QTextStream(device) { _score = s; setCodec("UTF-8"); }
FileOut::FileOut(QFile * fp, bool lf, bool utf8) : QTextStream(fp), _lf(lf), _indent(0) { if (utf8) setCodec("UTF8"); }
/*! *\en * *\_en \ru * *\_ru */ AExtText::AExtText() : AExtension("Text") { text = new QTextStream( &file ); setCodec("UTF-8"); }