Beispiel #1
0
 MongoShell *App::openShell(MongoCollection *collection,const QString &filePathToSave)
 {
     ConnectionSettings *connection = collection->database()->server()->connectionRecord();
     connection->setDefaultDatabase(collection->database()->name());
     QString script = detail::buildCollectionQuery(collection->name(), "find({})");
     return openShell(connection, ScriptInfo(script, true, CursorPosition(0, -2), QtUtils::toQString(collection->database()->name()),filePathToSave));
 }
Beispiel #2
0
/**
  * @brief  Shift cursor with defined step (CUR_STEP).
  * @param  CursorEvent: specifies direction of shift.
  *   This parameter can be one of the following values:
  *     @arg  CUR_DOWN: shift cursor down by step.
  *     @arg  CUR_UP: shift cursor up by step.
  *     @arg  CUR_RIGHT: shift cursor right by step.
  *     @arg  CUR_LEFT: shift cursor left by step.
  * @retval None
  */
void CursorStepMove(uint8_t CursorEvent)
{
  uint16_t tmpY, tmpX;

  /*Load current cursor position*/
  tmpY = Cursor->Y;
  tmpX = Cursor->X;

  /*Step cursor position with regard to desired direction.*/
  switch (CursorEvent)
  {
    case CUR_DOWN:
      tmpY -= (tmpY >= CUR_STEP) ? (CUR_STEP) : (tmpY);
      break;
    case CUR_LEFT:
      tmpY += (LCD_Width - tmpY - CursorPointer[1] >= CUR_STEP) ? (CUR_STEP) : (LCD_Width - tmpY - CursorPointer[1]);
      break;
    case CUR_RIGHT:
      tmpX += (LCD_Height - tmpX - CursorPointer[0] >= CUR_STEP) ? (CUR_STEP) : (LCD_Height - tmpX - CursorPointer[0]);
      break;
    case CUR_UP:
      tmpX -= (tmpX >= CUR_STEP) ? (CUR_STEP) : (tmpX);
      break;
    default:
      break;
  }

  /*Pass just calculated position to call what handle this change*/
  CursorPosition(tmpX, tmpY);
  GL_Delay(3);
}
Beispiel #3
0
int MenuHandler(void)
{
	lcd_clear(LCD_WHITE);

	int x;
	int y;
	size_t i = 0;
	for (y = 0; y < Y_COUNT; ++y) {
		for (x = 0; x < X_COUNT; ++x) {
			if (MenuRecord[i].ok) {
				MenuRecord[i].x = X_START + (X_SIZE + X_GAP) * x;
				MenuRecord[i].y = Y_START + (Y_SIZE + Y_GAP) * y;
				lcd_bitmap(lcd_get_framebuffer(), LCD_BUFFER_WIDTH_BYTES,
					   MenuRecord[i].x, MenuRecord[i].y,
					   X_SIZE, Y_SIZE, false, MenuRecord[i].icon);
			}
			++i;
		}
	}


	event_flush();

	int cursor = -1;  // valid cursor positions are: 0 .. SizeOfArray(MenuRecord) - 1

	for (;;) {
		event_t event;

		switch(event_wait(&event, NULL, NULL)) {  // no callback, just power off

		case EVENT_NONE:
			break;

		case EVENT_KEY:
			break;

		case EVENT_TOUCH_DOWN:
		case EVENT_TOUCH_MOTION:
		{
			int position = CursorPosition(event.touch.x, event.touch.y);

			if (cursor != position) {
				if (cursor >= 0) {
					lcd_bitmap(lcd_get_framebuffer(), LCD_BUFFER_WIDTH_BYTES,
						   MenuRecord[cursor].x, MenuRecord[cursor].y,
						   X_SIZE, Y_SIZE, false, MenuRecord[cursor].icon);
				}
				if (position >= 0 && position < (int)SizeOfArray(MenuRecord)
				    && MenuRecord[position].ok) {
					cursor = position;
					lcd_bitmap(lcd_get_framebuffer(), LCD_BUFFER_WIDTH_BYTES,
						   MenuRecord[cursor].x, MenuRecord[cursor].y,
						   X_SIZE, Y_SIZE, true, MenuRecord[cursor].icon);
				} else {
					cursor = -1;
				}
			}
		}
		break;

		case EVENT_TOUCH_UP:
			if (cursor >= 0 && cursor < (int)SizeOfArray(MenuRecord)) {
				chain(MenuRecord[cursor].command);
			}
			break;

		case EVENT_BUTTON_DOWN:
			break;

		case EVENT_BUTTON_UP:
			break;

		case EVENT_BATTERY_LOW:
			break;
		}
	}
	return EXIT_POWER_OFF;
}
 void ExplorerCollectionTreeItem::ui_removeDocument()
 {
     openCurrentCollectionShell(
         "remove({ '' : '' });"
         , false, CursorPosition(0, -10));
 }
Beispiel #5
0
 void ExplorerDatabaseTreeItem::ui_dbKillOp()
 {
     openCurrentDatabaseShell(_database, "db.killOp()", false, CursorPosition(0, -1));
 }