コード例 #1
0
ファイル: YabauseGL.cpp プロジェクト: devmiyax/yabause
YabauseGL::YabauseGL( QWidget* p )
  : QGLWidget(p)
{
	setFocusPolicy( Qt::StrongFocus );

  QGLFormat fmt;
  fmt.setProfile(QGLFormat::CompatibilityProfile);
  setFormat(fmt);

	if ( p ) {
		p->setFocusPolicy( Qt::StrongFocus );
		setFocusProxy( p );
	}
  viewport_width_ = 0;
  viewport_height_ = 0;
  viewport_origin_x_ = 0;
  viewport_origin_y_ = 0;
}
コード例 #2
0
ファイル: OccView.cpp プロジェクト: guervillep/Kunie
OccView::OccView(Document* document):
    m_document(document),
    m_mode(Selection)
{
    QSurfaceFormat format;
    format.setDepthBufferSize(16);
    format.setStencilBufferSize(1);
    setFormat(format);

    m_view = m_document->viewer()->CreateView();

    m_widget = QWidget::createWindowContainer(this);
    m_map.insert(m_widget, m_document);

    initCursors();
    initViewActions();
    initRenderActions();
}
コード例 #3
0
void Highlighter::highlightBlock(const QString &text)
{
    QTextCharFormat errorFormat, format;
    errorFormat.setBackground(Qt::red);
    errorFormat.setForeground(Qt::white);
    format.setForeground(Qt::black);

    foreach(const HighlightingRule &rule, highlightingRules)
    {
        QRegExp expression(rule.pattern);
        int index = expression.indexIn(text);
        while(index >= 0)
        {
            int length = expression.matchedLength();
            setFormat(index, length, rule.format);
            index = expression.indexIn(text, index + length);
        }
    }
コード例 #4
0
ファイル: engine.cpp プロジェクト: Andreas665/qt
void Engine::reset()
{
    stopRecording();
    stopPlayback();
    setState(QAudio::AudioInput, QAudio::StoppedState);
    setFormat(QAudioFormat());
    m_generateTone = false;
    delete m_file;
    m_file = 0;
    delete m_analysisFile;
    m_analysisFile = 0;
    m_buffer.clear();
    m_bufferPosition = 0;
    m_bufferLength = 0;
    m_dataLength = 0;
    emit dataLengthChanged(0);
    resetAudioDevices();
}
コード例 #5
0
ファイル: highlighter.cpp プロジェクト: Red54/plantumlqeditor
        /**
         * @brief UML syntax highlighting.
         * @param text
         */
        void highlightBlockUml(const QString &text) {

            if(highlightRestOfLine(text, REGEX_MLC_ON, format_comment) == true) {
                multiLineComment=true;
            }

            if(highlightRestOfLine(text, REGEX_MLC_OFF, format_comment) == true) {
                multiLineComment=false;
            }

            if(multiLineComment == true) {
                setFormat(0, text.length(), format_comment);
                return;
            }

            //------------------------------------------------------------

            highlightWords(text, REGEX_KEYWORD, format_keyword);
            highlightWords(text, REGEX_KEYWORD2, format_keyword);

            highlightWords(text, REGEX_NOTE1,   format_keyword);
            highlightWord( text, REGEX_NOTE2,   format_keyword);

            highlightWords(text, REGEX_HTML_TAG, format_html);

            highlightWords(text, REGEX_MASK, format_mask );

            highlightWords(text, REGEX_COLOR, format_color );

            highlightWord(text, REGEX_SEPARATOR, format_separator);

            //    highlightWords(text, REGEX_ARROWS1, format_arrow);
            //    highlightWords(text, REGEX_ARROWS2, format_arrow);
            // 	highlightArrorws(text);

            //------------------------------------------------------------

            highlightWord(text, REGEX_SKIN,      format_skin);
            highlightWord(text, REGEX_OPTION,    format_option);

            highlightWord(text, REGEX_DECORATION, format_decoration);

            highlightRestOfLine(text, REGEX_COMMENT, format_comment);
        }
コード例 #6
0
ファイル: spellhighlighter.cpp プロジェクト: AlekSi/Jabbin
void SpellHighlighter::highlightBlock(const QString& text)
{
	// Underline 
	QTextCharFormat tcf;
	tcf.setUnderlineColor(QBrush(QColor(255,0,0)));
	tcf.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);

	// Match words (minimally)
	QRegExp expression("\\b\\w+\\b");

	// Iterate through all words
	int index = text.indexOf(expression);
	while (index >= 0) {
		int length = expression.matchedLength();
		if (!SpellChecker::instance()->isCorrect(expression.cap()))
			setFormat(index, length, tcf);
		index = text.indexOf(expression, index + length);
	}
}
コード例 #7
0
void SyntaxHighlighter::highlightBlockInSymbol(ScLexer & lexer)
{
    int originalOffset = lexer.offset();
    int tokenLength;
    Token::Type tokenType = lexer.nextToken(tokenLength);
    int range = lexer.offset() - originalOffset;
    setFormat(originalOffset, range, mGlobals->format(SymbolFormat));

    if (tokenType == Token::Unknown)
        return;

    Q_ASSERT(tokenType == Token::SymbolMark);
    Token token(tokenType, lexer.offset() - 1, 1);
    token.character = '\'';

    TextBlockData *blockData = static_cast<TextBlockData*>(currentBlockUserData());
    Q_ASSERT(blockData);
    blockData->tokens.push_back( token );
}
コード例 #8
0
ファイル: qformatscheme.cpp プロジェクト: Axure/TeXstudio
/*!
	\overload
	\param elem Source element to scan
	\param ignoreNewIds whether unknown format identifiers should be ignored
	
	The given dom element must contain a proper version attribute and format
	data as child elements (&lt;format&gt; tags)
	
	\note Previous content is not discarded
*/
void QFormatScheme::load(const QDomElement& elem, bool ignoreNewIds)
{
	if (!elem.hasAttributes() && !elem.hasChildNodes()) return;

	if ( elem.attribute("version") < QFORMAT_VERSION )
	{
		qWarning("Format encoding version mismatch : [found]%s != [expected]%s",
				qPrintable(elem.attribute("version")),
				QFORMAT_VERSION);
		
		return;
	}
	
	QDomElement e, c;
	QDomNodeList l, f = elem.elementsByTagName("format");
	
	for ( int i = 0; i < f.count(); i++ )
	{
		e = f.at(i).toElement();
		
		if ( ignoreNewIds && !m_formatKeys.contains(e.attribute("id")) )
			continue;
		
		l = e.childNodes();
		
		QFormat fmt;
		
		for ( int i = 0; i < l.count(); i++ )
		{
			c = l.at(i).toElement();
			
			if ( c.isNull() )
				continue;
			
			QString field = c.tagName(),
					value = c.firstChild().toText().data();
			setFormatOption(fmt,field,value);
		}
		fmt.setPriority(fmt.priority); //update priority if other values changed

		setFormat(e.attribute("id"), fmt);
	}
}
コード例 #9
0
ファイル: window.cpp プロジェクト: privet56/BunnyAndQloud
Window::Window(QScreen *screen)
    : QWindow(screen)

{
    setSurfaceType(QSurface::OpenGLSurface);

    resize(1024, 768);

    QSurfaceFormat format;
    if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL)
    {
        //format.setVersion(4,3);
        format.setProfile(QSurfaceFormat::CoreProfile);
    }
    format.setDepthBufferSize( 24 );
    format.setSamples( 4 );
    setFormat(format);
    create();
}
コード例 #10
0
LedsSimulator::LedsSimulator(QWidget *parent /*= 0*/, int cubeX, int cubeY, int cubeZ, int spacing /*= 1*/)
    : QGLWidget(parent),  m_spacing(spacing), m_monoChromeLeds(false)
{
    setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));

    rotationX = 0.0;
    rotationY = 0.0;
    rotationZ = 0.0;

    m_cubeMatrix[0] = cubeX;
    m_cubeMatrix[1] = cubeY;
    m_cubeMatrix[2] = cubeZ;

    m_spacing+=2;
    m_backColor = Qt::darkGray;
    m_offColor = QColor(220,220,220,40);
   setCubeValues();

}
コード例 #11
0
static  void    setOptions(HWND hwndDlg)
{
    UCHAR   title[256] ;

    sprintf(title, "Session Options for <%s>", SessServerName) ;
    WinSetWindowText(hwndDlg, title) ;

    setFormat(hwndDlg) ;
    setEncode(hwndDlg) ;

    setButton(hwndDlg, IDD_OPT_SHARED, SessOptShared)    ;
    setButton(hwndDlg, IDD_OPT_VONLY,  SessOptViewonly)  ;
    setButton(hwndDlg, IDD_OPT_DEICON, SessOptDeiconify) ;

    if (! initialSetup) {
        WinEnableWindow(WinWindowFromID(hwndDlg, IDD_OPT_FORMAT), FALSE) ;
        WinEnableWindow(WinWindowFromID(hwndDlg, IDD_OPT_SHARED), FALSE) ;
    }
}
コード例 #12
0
ファイル: VCanvas.cpp プロジェクト: GhostVIRUS/VV3D
VCanvas::VCanvas(QWidget *parent)
	: QGLWidget(parent)
{
	setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));

	rotationX = 30.0; defaultRotationX = 30.0;
	rotationY = 45.0; defaultRotationY = 45.0;
	rotationZ = 0.0; defaultRotationZ = 0.0;
	scaling = 1;
	defaultScaling = 1;

	drawingData = 0;

	translX = 0.0; translY = 0.0; translZ = 0.0;

	areParticlesNumbersVisible = true;
	areAxesVisible = true;

}
コード例 #13
0
ファイル: guiprogress.cpp プロジェクト: t3t3/QtBuilder
void DiskSpaceBar::refresh()
{
	if (!isVisible())
		return;

	uint total, free;
	if (!getDiskSpace(m_path, total, free))
		return;

	uint usedmb = total-free;
	m_diskSpace = qMax(m_diskSpace, usedmb);
	qreal gbyte = usedmb/1024.0;
	uint percnt = usedmb*100/total;
	QString gbt = PLCHD.arg(gbyte,7,FMT_F,2,FILLSPC);
	QString pct = QString::number(percnt).rightJustified(3,FILLSPC);

	setValue(usedmb);
	setFormat(qtBuilderDiskSpaceTmpl.arg(m_name, gbt, pct));
}
コード例 #14
0
	void OgreTexture::createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format)
	{
		setFormat(_format);
		setUsage(_usage);

		mTexture = Ogre::TextureManager::getSingleton().createManual(
			mName,
			mGroup,
			Ogre::TEX_TYPE_2D,
			_width,
			_height,
			0,
			mPixelFormat,
			mUsage,
			this);

		mTexture->load();

	}
コード例 #15
0
ファイル: StImagePlane.cpp プロジェクト: KindDragon/sview
bool StImagePlane::initSideBySide(const StImagePlane& theImageL,
                                  const StImagePlane& theImageR,
                                  const int theSeparationDx,
                                  const int theSeparationDy,
                                  const int theValue) {
    if(theImageL.isNull() || theImageR.isNull()) {
        // just ignore
        return true;
    }
    if(theImageL.getSizeX() != theImageR.getSizeX() ||
       theImageL.getSizeY() != theImageR.getSizeY()) {
        // currently unsupported operation
        return false;
    }
    size_t dxAbsPx = size_t(abs(theSeparationDx));
    size_t dxLeftRPx  = (theSeparationDx > 0) ?     dxAbsPx : 0;
    size_t dxLeftLPx  = (theSeparationDx < 0) ? 2 * dxAbsPx : 0;

    size_t dyAbsPx = size_t(abs(theSeparationDy));
    size_t dyTopLPx  = (theSeparationDy > 0) ? dyAbsPx : 0;
    size_t dyTopRPx  = (theSeparationDy < 0) ? dyAbsPx : 0;

    size_t outSizeX = (theImageL.getSizeX() + dxAbsPx) * 2;
    size_t outSizeY =  theImageL.getSizeY() + dyAbsPx  * 2;

    setFormat(theImageL.getFormat());
    if(!initZero(theImageL.getFormat(), outSizeX, outSizeY, outSizeX * theImageL.getSizePixelBytes(), theValue)) {
        return false;
    }

    // save cross-eyed
    for(size_t row = 0; row < theImageR.getSizeY(); ++row) {
        stMemCpy(changeData(dyTopRPx + row, dxLeftRPx),
                 theImageR.getData(row, 0),
                 theImageR.getSizeRowBytes());
    }
    for(size_t row = 0; row < theImageR.getSizeY(); ++row) {
        stMemCpy(changeData(dyTopLPx + row, theImageR.getSizeX() + dxLeftLPx + dxLeftRPx),
                 theImageL.getData(row, 0),
                 theImageL.getSizeRowBytes());
    }
    return true;
}
コード例 #16
0
ファイル: main.cpp プロジェクト: JamesLinus/hifi
    QTestWindow() {
        setSurfaceType(QSurface::OpenGLSurface);

        QSurfaceFormat format;
        // Qt Quick may need a depth and stencil buffer. Always make sure these are available.
        format.setDepthBufferSize(16);
        format.setStencilBufferSize(8);
        format.setVersion(4, 3);
        format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
        format.setOption(QSurfaceFormat::DebugContext);
        format.setSwapInterval(0);

        setFormat(format);

        _qGlContext.setFormat(format);
        _qGlContext.create();

        show();
        makeCurrent();
        setupDebugLogger(this);

        gpu::Context::init<gpu::GLBackend>();
        _context = std::make_shared<gpu::Context>();
        
        auto shader = makeShader(unlit_vert, unlit_frag, gpu::Shader::BindingSet{});
        auto state = std::make_shared<gpu::State>();
        state->setMultisampleEnable(true);
        state->setDepthTest(gpu::State::DepthTest { true });
        _pipeline = gpu::Pipeline::create(shader, state);
        
        // Clear screen
        gpu::Batch batch;
        batch.clearColorFramebuffer(gpu::Framebuffer::BUFFER_COLORS, { 1.0, 0.0, 0.5, 1.0 });
        _context->render(batch);
        
        DependencyManager::set<GeometryCache>();
        DependencyManager::set<DeferredLightingEffect>();

        resize(QSize(800, 600));
        
        _time.start();
    }
コード例 #17
0
ファイル: XILCapture.c プロジェクト: TheCrazyT/jmf
/*
 * Class:	com_sun_media_protocol_sunvideo_XILCapture
 * Method:	xilSetCompress
 * Signature:	(Ljava/lang/String;)Z
 */
JNIEXPORT jboolean JNICALL
Java_com_sun_media_protocol_sunvideo_XILCapture_xilSetCompress(JNIEnv *env,
						      jobject jxil,
						      jstring jcompress)
{
    const char *compress;

    InstanceState *inst = (InstanceState *) GetLongField(env, jxil, "peer");

    if (inst == NULL)
	return;

    /*    Debug Message*/
    PRINT("In xilSetCompress\n");

    compress = (*env)->GetStringUTFChars(env, jcompress, 0);

    if (strcasecmp(compress, "rgb") == 0) {
	inst->do_cis = RAW;
	inst->cis_type = "Raw";
    } else if (strcasecmp(compress, "jpeg") == 0) {
	inst->do_cis = JPEG;
	inst->cis_type = "Jpeg";
    } else if ((strcasecmp(compress, "mpeg") == 0) ||
		(strcasecmp(compress, "mpeg1") == 0)) {
	inst->do_cis = MPEG;
	inst->cis_type = "Mpeg1";
    } else if (strcasecmp(compress, "cellb") == 0) {
	inst->do_cis = CELLB;
	inst->cis_type = "CellB";
    } else {
	/*    Debug Message */
	PRINT("Invalid compress format specified %s ");
	PRINT(compress);
	PRINT("\n");
    }
    (*env)->ReleaseStringUTFChars(env, jcompress, compress);

    setFormat(env, jxil, inst);

    return TRUE;
}
コード例 #18
0
ファイル: highlighter.cpp プロジェクト: honsey/fztaxedit
void Highlighter::highlightStrings(int startStringIndex, QString & text) {
	if (startStringIndex < 0) {
		startStringIndex = m_syntaxer->matchStringStart(text, 0);
	}

	// TODO: not handling "" as a way to escape-quote
	while (startStringIndex >= 0) {
		int endIndex = -1;
		int ssi = startStringIndex;
		while (true) {
			endIndex = m_syntaxer->matchStringEnd(text, ssi + 1);
			if (!m_syntaxer->hlCStringChar()) {
				// only some languages use \ to escape 
				break;
			}

			if (endIndex == -1) {
				break;
			}

			// TODO: escape char is backslash only; are there others in other compilers?
			if (text.at(endIndex - 1) != CEscapeChar) {
				break;
			}
			ssi = endIndex;
		}
		int stringLength;
		if (endIndex == -1) {
			setCurrentBlockState(STRINGOFFSET);
			stringLength = text.length() - startStringIndex;
		} 
		else {
			stringLength = endIndex - startStringIndex + 1;
		}
		text.replace(startStringIndex, stringLength, QString(stringLength, ' '));
		QTextCharFormat * sf = m_styleFormats.value("String", NULL);
		if (sf != NULL) {
			setFormat(startStringIndex, stringLength, *sf);
		}
		startStringIndex = m_syntaxer->matchStringStart(text, startStringIndex + stringLength);
	}
}
コード例 #19
0
ファイル: openglwindow.cpp プロジェクト: hasbromlp/ocs
OpenGLWindow::OpenGLWindow( QWindow *parent )
    : QWindow( parent ), d( new Private(this) )
{
    setSurfaceType( QWindow::OpenGLSurface );

    QSurfaceFormat format;
    //format.setDepthBufferSize( 24 );
    //format.setSamples( 4 );
    //format.setMajorVersion( 3 );
    //format.setMinorVersion( 3 );
    format.setSwapBehavior( QSurfaceFormat::DoubleBuffer );
    format.setRenderableType( QSurfaceFormat::OpenGL );
    format.setProfile( QSurfaceFormat::CompatibilityProfile );
    setFormat( format );
    create();

    d->thread = OpenGLRenderThread::instance();
    d->renderId = d->thread->registerSurface( this );
    d->thread->update( d->renderId );
}
コード例 #20
0
void ressource_num::load(std::istream &file)
{
    string tampon;
    ressource::load(file);
    cout << "Quel est le format de cette ressource?" << endl;
    do{
    getline( file, tampon);
    }while(tampon.size()==0);
    setFormat(tampon);
    cout << "Quelle est la taille de cette ressource? (En octets)" << endl;
    do{
    getline( file, tampon);
    }while(tampon.size()==0);
    setTaille(atoi(tampon.c_str()));
    cout << "Quem est l'URL de cette ressource?" << endl;
    do{
    getline( file, tampon);
    }while(tampon.size()==0);
    setURL(tampon);
}
コード例 #21
0
void ItemSourceHighlighter::highlightBlock(const QString& text)
{
   //
   // Apply matching highlighting rules.
   //

   for (const auto& rule : rules_)
   {
      for (const auto& expression : rule.expressions)
      {
         auto matches = expression.globalMatch(text);
         while (matches.hasNext() == true)
         {
            auto match = matches.next();

            setFormat(match.capturedStart(1), match.capturedLength(1), rule.format);
         }
      }
   }
}
コード例 #22
0
ファイル: spellhighlighter.cpp プロジェクト: Nikoli/vacuum-im
void SpellHighlighter::highlightBlock(const QString &AText)
{
	if (FEnabled)
	{
		// Match words (minimally) excluding digits within a word
		static const QRegExp expression("\\b[^\\s\\d]+\\b");

		int index = 0;
		while ((index = expression.indexIn(AText, index)) != -1)
		{
			int length = expression.matchedLength();
			if (!isUserNickName(expression.cap()))
			{
				if (!SpellBackend::instance()->isCorrect(expression.cap()))
					setFormat(index, length, FCharFormat);
			}
			index += length;
		}
	}
}
コード例 #23
0
ファイル: bashhighlighter.cpp プロジェクト: ovsm-dev/sdp
void BashHighlighter::highlightBlock(const QString& text) {

	for (RuleList::iterator it = __rules.begin();
	        it != __rules.end(); ++it) {
		int idx = (*it).pattern.indexIn(text, 0);
		while ( idx >= 0 ) {
			// Get index of Nth match
			idx = (*it).pattern.pos((*it).nth);
			int length = (*it).pattern.cap((*it).nth).length();
			setFormat(idx, length, (*it).format);
			idx = (*it).pattern.indexIn(text, idx + length);
		}
	}

	setCurrentBlockState(0);

	// Do multi-line strings
	bool isInMultilne = matchMultiline(text, triSingleQuote, 1, __basicStyles.value("string2"));
	if ( !isInMultilne )
	    isInMultilne = matchMultiline(text, triDoubleQuote, 2, __basicStyles.value("string2"));
}
コード例 #24
0
//--------------------------------------------------------------------------------------------
void MSyntaxHighlighterParamsTest::highlightBlock(const QString& text)
{
  int pos = text.indexOf((*PListParamsChannel)[IListItem], 0, Qt::CaseSensitive);
  if(pos >= 0)
  {
    pos += (*PListParamsChannel)[IListItem].length();
    QString s = text.mid(pos);
    if(!s.isEmpty())
    {
      float param = s.toFloat();
      QColor color;
      if((*PListParamsChannel)[IListItem+1].toFloat() <= param && param <= (*PListParamsChannel)[IListItem+2].toFloat())
        color = QColor(0,255,0);
      else
        color = QColor(255,0,0);
      setFormat(pos, s.length(), color);

      IListItem += DeltaNItemListParamsChannel;
    }
  }
 }
コード例 #25
0
void TournamentProgressBar::setDatabase(TournamentDB* _db)
{
  db = _db;

  // reset all timers; updates will be triggered automatically
  // via the CentralSignalEmitter
  avgMatchDuration__secs = -1;
  lastMatchFinishTime__UTC = 0;

  // clear all content if we have no database open
  if (db == nullptr)
  {
    // clear all content
    setFormat("");
    setValue(0);
    return;
  }

  // in all other cases update the status string
  updateProgressBar();
}
コード例 #26
0
void ProFileHighlighter::highlightBlock(const QString &text)
{
    if (text.isEmpty())
        return;

    QString buf;
    bool inCommentMode = false;

    QTextCharFormat emptyFormat;
    int i = 0;
    for (;;) {
        const QChar c = text.at(i);
        if (inCommentMode) {
            setFormat(i, 1, formatForCategory(ProfileCommentFormat));
        } else {
            if (c.isLetter() || c == QLatin1Char('_') || c == QLatin1Char('.') || c.isDigit()) {
                buf += c;
                setFormat(i - buf.length()+1, buf.length(), emptyFormat);
                if (!buf.isEmpty() && m_keywords.isFunction(buf))
                    setFormat(i - buf.length()+1, buf.length(), formatForCategory(ProfileFunctionFormat));
                else if (!buf.isEmpty() && m_keywords.isVariable(buf))
                    setFormat(i - buf.length()+1, buf.length(), formatForCategory(ProfileVariableFormat));
            } else if (c == QLatin1Char('(')) {
                if (!buf.isEmpty() && m_keywords.isFunction(buf))
                    setFormat(i - buf.length(), buf.length(), formatForCategory(ProfileFunctionFormat));
                buf.clear();
            } else if (c == QLatin1Char('#')) {
                inCommentMode = true;
                setFormat(i, 1, formatForCategory(ProfileCommentFormat));
                buf.clear();
            } else {
                if (!buf.isEmpty() && m_keywords.isVariable(buf))
                    setFormat(i - buf.length(), buf.length(), formatForCategory(ProfileVariableFormat));
                buf.clear();
            }
        }
        i++;
        if (i >= text.length())
            break;
    }

    applyFormatToSpaces(text, formatForCategory(ProfileVisualWhitespaceFormat));
}
コード例 #27
0
// coords are offsets in file
//
void pqHighlighter::highlightBlock(const QString &text)
{
    if (status == idle)
        return;

    if (!marker.isNull() && currentBlock() == marker.block()) {
        QTextCharFormat f;
        f.setBackground(Qt::yellow);
        int s = marker.selectionStart(), e = marker.selectionEnd(), b = marker.block().position();
        setFormat(s - b, e - s, f);
        marker = QTextCursor();
        return;
    }

    if (status == completed) {
        QTextBlock b = currentBlock();
        set_sem_attrs(b.position(), b.position() + b.length(), cats);
    }
    else
        pqMiniSyntax::highlightBlock(text);
}
コード例 #28
0
/**
 *  Kopierkonstruktor von @p baseArchivItem_Bitmap.
 *
 *  @param[in] item Quellitem
 *
 *  @author FloSoft
 */
libsiedler2::baseArchivItem_Bitmap::baseArchivItem_Bitmap(const baseArchivItem_Bitmap& item) : ArchivItem( item )
{
    width = item.width;
    height = item.height;

    nx = item.nx;
    ny = item.ny;

    length = item.length;

    tex_width = item.tex_width;
    tex_height = item.tex_height;

    tex_bpp = item.tex_bpp;

    tex_data = item.tex_data;

    palette = NULL;
    setPalette(item.palette);
    setFormat(item.format);
}
コード例 #29
0
ファイル: TimeSeriesMotion.cpp プロジェクト: jingxu002/strata
void TimeSeriesMotion::fromJson(const QJsonObject &json)
{
    AbstractMotion::fromJson(json);

    m_saveData = json["saveData"].toBool();
    m_fileName = json["fileName"].toString();
    m_timeStep = json["timeStep"].toDouble();
    m_pointCount = json["pointCount"].toInt();
    m_scale = json["scale"].toDouble();
    m_dataColumn = json["dataColumn"].toInt();
    m_startLine = json["startLine"].toInt();
    m_stopLine = json["stopLine"].toInt();

    setFormat(json["format"].toInt());
    setInputUnits(json["inputUnits"].toInt());

    if (m_saveData) {
        m_accel.clear();
        foreach (const QJsonValue &v, json["accel"].toArray())
            m_accel << v.toDouble();
    } else {
コード例 #30
0
// ====================================================
//  HIGHLIGHT BLOCK (inherited)
// ====================================================
void Highlighter::highlightBlock(const QString &text)
{
  // Highlighting
  foreach (const config::FormatHighlighting &rule, mHighlightingRules) 
  {
    bool ruleApplied = false;
    foreach (const QRegExp& expression, rule.patterns)
    {
      int index = expression.indexIn(text);
      while (index >= 0) 
      {
        ruleApplied = true;
        int length = expression.matchedLength();
        setFormat(index, length, rule.format);
        index = expression.indexIn(text, index + length);
      }
    }

    if ((rule.name == "comment" || rule.name == "string") && ruleApplied)
      return;
  }