Exemplo n.º 1
0
InterlinearChunkEditor::InterlinearChunkEditor(Text *text, Project *project, View::Type type, int chunkSize, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::InterlinearChunkEditor)
{
    ui->setupUi(this);

    mTextTabWidget = 0;

    mText = text;
    mProject = project;
    mType = type;
    mChunkSize = chunkSize;
    mPosition = 0;

    connect( ui->previousButton , SIGNAL(clicked()), this, SLOT(previous()) );
    connect( ui->nextButton, SIGNAL(clicked()), this, SLOT(next()) );
    connect( ui->buttonGoTo, SIGNAL(clicked()), this, SLOT(goTo()) );
    connect( ui->beginningButton, SIGNAL(clicked()), this, SLOT(beginning()));
    connect( ui->endButton, SIGNAL(clicked()), this, SLOT(end()) );

    connect( text, SIGNAL(guiRefreshRequest()), this, SLOT(refreshLayout()));

    refreshLayout();

    mTextTabWidget = new TextTabWidget( mText, mProject, mType, makeLines(), QList<Focus>(), this );
    ui->ildLayout->addWidget(mTextTabWidget);

    setWindowTitle(tr("%1 [%2]").arg(mText->name()).arg(mProject->view(type)->name()));
}
Exemplo n.º 2
0
void main()
{
	int repeat;
	beginning();
	system("pause");
	system("cls");
	printf("Do You Want to try another type of quiz? / Da li zelite probati neku drugu vrtu kviza?\n			1) Yes \n			2) No\n");
	scanf_s("%d", &repeat);
	if (repeat == 1)
	{
		system("cls");
		beginning();
	}
		
		

}
Exemplo n.º 3
0
 /**
  * @brief gets the offset of a given file block
  * @param block the file block that we want to get the offset of
  * @return the offset of the file block
  */
 inline uint64_t getOffsetOfFileBlock(uint64_t const block,
                                      uint64_t const totalBlocks)
 {
     uint64_t const volumeBitMapBytes = totalBlocks / uint64_t(8);
     return beginning()                 // where main start after IV
         + 8                            // number of fs blocks
         + volumeBitMapBytes            // volume bit map
         + 8                            // total number of files
         + (FILE_BLOCK_SIZE * block);   // file block
 }
Exemplo n.º 4
0
/* 2 = exact, 1 = inexact, 0 = no match */
static int find_match(OBJECT_DATA *obj, char *kw, int *perc)
{
  int x = 0;
  int akwlen;
  int mtotal;
  int arglen;
  char arg_kw[128]; /* OBJECT_DATA->keywords is currently 128 bytes */
  char obj_kw[128];
  char *c1, *c2;

  if (!stricmp(obj->keywords, kw))
    return 2;
  /*
    Not exact match, so find how many words in obj->keywords match
    against words in args, get the percentage and "return" it
  */
  /*
    What I want to do:
    - keep track of number of keywords in args that matches (must be 100%)
    - get the percentage of how many characters matched compared to
      the length of obj->keywords (yes I'm incorrectly including spaces)
  */
  next_word(kw, arg_kw, &c1);
  arglen = mtotal = 0;
  while (arg_kw[0] != 0)
  {
    akwlen = strlen(arg_kw);
    arglen += akwlen;
    next_word(obj->keywords, obj_kw, &c2);
    while (obj_kw[0] != 0)
    {
      x = beginning(obj_kw, arg_kw);
      if (x == akwlen) /* match */
      {
        mtotal += x;
        break; /* can't have it matching multiple keywords */
      }
      next_word(0, obj_kw, &c2);
    }
    next_word(0, arg_kw, &c1);
  }
  if (arglen == mtotal) /* matched everything */
  {
    /* it's *1000 so I can get a tenth of a percent */
    *perc = mtotal * 1000 / strlen(obj->keywords);
    return 1;
  }
  return 0;
}
Exemplo n.º 5
0
TEST(SimpleString, Contains)
{
	SimpleString s("hello!");
	SimpleString empty("");
	SimpleString beginning("hello");
	SimpleString end("lo!");
	SimpleString mid("l");
	SimpleString notPartOfString("xxxx");

	CHECK(s.contains(empty));
	CHECK(s.contains(beginning));
	CHECK(s.contains(end));
	CHECK(s.contains(mid));
	CHECK(!s.contains(notPartOfString));

	CHECK(empty.contains(empty));
	CHECK(!empty.contains(s));
}
Exemplo n.º 6
0
int _main( )
{
    return beginning( );
}
Exemplo n.º 7
0
bool SoundFileStream::integrate
( int ch, double f_beg, double f_dur,
  short *minBuffer, short *maxBuffer, float *sumBuf, float *sum2Buf, int bufferSize )
{
  bool ok = _data != 0
            && ch < channels()
            && ( f_beg >= beginning() )
            && ( f_beg + f_dur <= beginning() + duration() );
  if( !ok ) return false;

  double fpu = f_dur / bufferSize;
  double f_pos = f_beg - _dataOffset;
  double f_pos_max = _dataSize;

  int i;
  for( i = 0; i < bufferSize; ++i ) {
    int data_pos = floor(f_pos);

    // increment position

    // slower, but error-proof:
    // f_pos = (double)(i+1) / width() * f_dur + f_beg;

    // the following is a faster variant, but floating point operations are fallible,
    // so we need to make sure we stay within the constraints of f_dur;
    double f_pos1 = f_pos + fpu;
    if( f_pos1 > f_pos_max ) f_pos1 = f_pos_max;

    int frame_count = ceil(f_pos1) - data_pos;

    float frac0 = data_pos + 1.f - f_pos;
    float frac1 = f_pos1 + 1.f - ceil(f_pos1);

    // get min, max and sum
    short *samples = _data + (data_pos * channels()) + ch;
    short min = SHRT_MAX;
    short max = SHRT_MIN;
    float sum = 0.f;
    float sum2 = 0.f;
    int f; // frame
    for( f = 0; f < frame_count; ++f, samples += channels() ){
    // TODO should we overlap min-max or not here?
      float sample = *samples;
      float frac;
      if( f == 0 ) frac = frac0;
      else if( f == frame_count - 1 ) frac = frac1;
      else frac = 1.0;

      if( sample < min ) min = sample;
      if( sample > max ) max = sample;

      sum += sample * frac;
      sum2 += sample * sample * frac;
    }

    minBuffer[i] = min;
    maxBuffer[i] = max;
    sumBuf[i] = sum;
    sum2Buf[i] = sum2;

    f_pos = f_pos1;
  }

  return true;
}
Exemplo n.º 8
0
	void start()
	{
		will_begin();
		beginning();
		ended();
	}